diff --git a/packages/editor-ui/src/components/InlineExpressionEditor/OutputItemSelect.vue b/packages/editor-ui/src/components/InlineExpressionEditor/OutputItemSelect.vue index 6845b77bf5..7966cf51a5 100644 --- a/packages/editor-ui/src/components/InlineExpressionEditor/OutputItemSelect.vue +++ b/packages/editor-ui/src/components/InlineExpressionEditor/OutputItemSelect.vue @@ -10,7 +10,9 @@ const hoveringItem = computed(() => ndvStore.getHoveringItem); const hoveringItemIndex = computed(() => hoveringItem.value?.itemIndex); const isHoveringItem = computed(() => Boolean(hoveringItem.value)); const itemsLength = computed(() => ndvStore.ndvInputDataWithPinnedData.length); -const itemIndex = computed(() => hoveringItemIndex.value ?? ndvStore.expressionOutputItemIndex); +const itemIndex = computed( + () => hoveringItemIndex.value ?? ndvStore.expressionOutputItemIndex ?? 0, +); const max = computed(() => Math.max(itemsLength.value - 1, 0)); const isItemIndexEditable = computed(() => !isHoveringItem.value && itemsLength.value > 0); const hideTableHoverHint = computed(() => ndvStore.isTableHoverOnboarded); @@ -19,6 +21,8 @@ const canSelectNextItem = computed( () => isItemIndexEditable.value && itemIndex.value < itemsLength.value - 1, ); +const inputCharWidth = computed(() => itemIndex.value.toString().length); + function updateItemIndex(index: number) { ndvStore.expressionOutputItemIndex = index; } @@ -47,6 +51,7 @@ function prevItem() { :min="0" :max="max" :model-value="itemIndex" + :style="{ '--input-width': `calc(${inputCharWidth}ch + var(--spacing-s))` }" @update:model-value="updateItemIndex" >