|
|
@ -99,7 +99,7 @@ const Overflow = defineComponent({
|
|
|
|
const mergedRestWidth = computed(() => Math.max(prevRestWidth.value, restWidth.value));
|
|
|
|
const mergedRestWidth = computed(() => Math.max(prevRestWidth.value, restWidth.value));
|
|
|
|
|
|
|
|
|
|
|
|
// ================================= Data =================================
|
|
|
|
// ================================= Data =================================
|
|
|
|
const isResponsive = computed(() => props.data.length && props.maxCount === RESPONSIVE);
|
|
|
|
const isResponsive = computed(() => !!(props.data.length && props.maxCount === RESPONSIVE));
|
|
|
|
const invalidate = computed(() => props.maxCount === INVALIDATE);
|
|
|
|
const invalidate = computed(() => props.maxCount === INVALIDATE);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -183,7 +183,7 @@ const Overflow = defineComponent({
|
|
|
|
|
|
|
|
|
|
|
|
// ================================ Effect ================================
|
|
|
|
// ================================ Effect ================================
|
|
|
|
const getItemWidth = (index: number) => {
|
|
|
|
const getItemWidth = (index: number) => {
|
|
|
|
return itemWidths.value.get(getKey(mergedData[index], index));
|
|
|
|
return itemWidths.value.get(getKey(mergedData.value[index], index));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
watch(
|
|
|
@ -215,8 +215,11 @@ const Overflow = defineComponent({
|
|
|
|
totalWidth += currentItemWidth;
|
|
|
|
totalWidth += currentItemWidth;
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
i === lastIndex - 1 &&
|
|
|
|
// Only one means `totalWidth` is the final width
|
|
|
|
totalWidth + getItemWidth(lastIndex)! <= mergedContainerWidth.value
|
|
|
|
(lastIndex === 0 && totalWidth <= mergedContainerWidth.value) ||
|
|
|
|
|
|
|
|
// Last two width will be the final width
|
|
|
|
|
|
|
|
(i === lastIndex - 1 &&
|
|
|
|
|
|
|
|
totalWidth + getItemWidth(lastIndex)! <= mergedContainerWidth.value)
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
// Additional check if match the end
|
|
|
|
// Additional check if match the end
|
|
|
|
updateDisplayCount(lastIndex);
|
|
|
|
updateDisplayCount(lastIndex);
|
|
|
@ -228,11 +231,6 @@ const Overflow = defineComponent({
|
|
|
|
suffixFixedStart.value =
|
|
|
|
suffixFixedStart.value =
|
|
|
|
totalWidth - currentItemWidth - suffixWidth.value + restWidth.value;
|
|
|
|
totalWidth - currentItemWidth - suffixWidth.value + restWidth.value;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
} else if (i === lastIndex) {
|
|
|
|
|
|
|
|
// Reach the end
|
|
|
|
|
|
|
|
updateDisplayCount(lastIndex);
|
|
|
|
|
|
|
|
suffixFixedStart.value = totalWidth - suffixWidth.value;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|