Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
97 lines
2.3 KiB
Vue
97 lines
2.3 KiB
Vue
<script setup>
|
|
import { ref, useTemplateRef, provide, computed, watch } from 'vue';
|
|
import { useElementSize } from '@vueuse/core';
|
|
|
|
const props = defineProps({
|
|
index: {
|
|
type: Number,
|
|
default: 0,
|
|
},
|
|
border: {
|
|
type: Boolean,
|
|
default: true,
|
|
},
|
|
});
|
|
|
|
const emit = defineEmits(['change']);
|
|
|
|
const tabsContainer = useTemplateRef('tabsContainer');
|
|
const tabsList = useTemplateRef('tabsList');
|
|
|
|
const { width: containerWidth } = useElementSize(tabsContainer);
|
|
const { width: listWidth } = useElementSize(tabsList);
|
|
|
|
const hasScroll = ref(false);
|
|
|
|
const activeIndex = computed({
|
|
get: () => props.index,
|
|
set: newValue => {
|
|
emit('change', newValue);
|
|
},
|
|
});
|
|
|
|
provide('activeIndex', activeIndex);
|
|
provide('updateActiveIndex', index => {
|
|
activeIndex.value = index;
|
|
});
|
|
|
|
const computeScrollWidth = () => {
|
|
if (tabsContainer.value && tabsList.value) {
|
|
hasScroll.value = tabsList.value.scrollWidth > tabsList.value.clientWidth;
|
|
}
|
|
};
|
|
|
|
const onScrollClick = direction => {
|
|
if (tabsContainer.value && tabsList.value) {
|
|
let scrollPosition = tabsList.value.scrollLeft;
|
|
scrollPosition += direction === 'left' ? -100 : 100;
|
|
tabsList.value.scrollTo({
|
|
top: 0,
|
|
left: scrollPosition,
|
|
behavior: 'smooth',
|
|
});
|
|
}
|
|
};
|
|
|
|
// Watch for changes in element sizes with immediate execution
|
|
watch(
|
|
[containerWidth, listWidth],
|
|
() => {
|
|
computeScrollWidth();
|
|
},
|
|
{ immediate: true }
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<div
|
|
ref="tabsContainer"
|
|
class="flex"
|
|
:class="[border && 'border-b border-b-n-weak']"
|
|
>
|
|
<button
|
|
v-if="hasScroll"
|
|
class="items-center rounded-none cursor-pointer flex h-auto justify-center min-w-8"
|
|
@click="onScrollClick('left')"
|
|
>
|
|
<fluent-icon icon="chevron-left" :size="16" />
|
|
</button>
|
|
<ul
|
|
ref="tabsList"
|
|
class="border-r-0 border-l-0 border-t-0 flex min-w-[6.25rem] py-0 px-4 list-none mb-0"
|
|
:class="
|
|
hasScroll ? 'overflow-hidden py-0 px-1 max-w-[calc(100%-64px)]' : ''
|
|
"
|
|
>
|
|
<slot />
|
|
</ul>
|
|
<button
|
|
v-if="hasScroll"
|
|
class="items-center rounded-none cursor-pointer flex h-auto justify-center min-w-8"
|
|
@click="onScrollClick('right')"
|
|
>
|
|
<fluent-icon icon="chevron-right" :size="16" />
|
|
</button>
|
|
</div>
|
|
</template>
|