Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ declare module 'vue' {
MainMenu: typeof import('./src/components/MainMenu.vue')['default']
MarginHandler: typeof import('./src/components/MarginHandler.vue')['default']
Meta: typeof import('./src/components/Icons/Meta.vue')['default']
MiddleEllipsis: typeof import('./src/components/MiddleEllipsis.vue')['default']
NewBlockTemplate: typeof import('./src/components/Modals/NewBlockTemplate.vue')['default']
NewBuilderVariable: typeof import('./src/components/Modals/NewBuilderVariable.vue')['default']
NewComponent: typeof import('./src/components/Modals/NewComponent.vue')['default']
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/Controls/DynamicValueHandler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
<div
class="w-full cursor-pointer truncate rounded bg-surface-gray-3 p-2 text-left font-mono text-p-sm text-ink-gray-9"
@click.stop="selectAndSetItem(selectedItem)">
{{ selectedItem.key }}
<MiddleEllipsis :text="selectedItem.key" />
<p class="truncate text-xs text-ink-gray-5" :class="{ italic: getValue(selectedItem) == null }">
{{ getValue(selectedItem) == null ? "No Value Set" : getValue(selectedItem) }}
</p>
</div>
</li>
<li v-for="(item, index) in filteredItems" :key="index">
<li v-for="item in filteredItems" :key="item.key">
<div
class="w-full cursor-pointer truncate rounded p-2 text-left font-mono text-p-sm text-ink-gray-7 hover:bg-surface-gray-2"
:class="{
'bg-surface-gray-3 text-ink-gray-9':
selectedItem?.key === item.key && selectedItem?.comesFrom === item.comesFrom,
}"
@click.stop="selectAndSetItem(item)">
{{ item.key }}
<MiddleEllipsis :text="item.key" />
<p class="truncate text-xs text-ink-gray-5" :class="{ italic: getValue(item) == null }">
{{ getValue(item) == null ? "No Value Set" : getValue(item) }}
</p>
Expand Down Expand Up @@ -80,6 +80,7 @@ import usePageStore from "@/stores/pageStore";
import blockController from "@/utils/blockController";
import { getDataArray, getDefaultPropsList, getParentProps, getPropValue } from "@/utils/helpers";
import { computed, ref } from "vue";
import MiddleEllipsis from "../MiddleEllipsis.vue";

const pageStore = usePageStore();
const builderStore = useBuilderStore();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Controls/PropertyControlInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class="absolute bottom-0 left-0 right-0 top-0 flex cursor-pointer items-center gap-2 rounded bg-surface-violet-1 py-0.5 pl-2.5 pr-6 text-sm text-ink-violet-1"
@click.stop="$emit('openDynamicModal')">
<FeatherIcon name="zap" class="size-3"></FeatherIcon>
<span class="truncate">{{ dynamicValueKey }}</span>
<span class="truncate" :title="dynamicValueKey">{{ dynamicValueKey }}</span>
</div>

<!-- Clear button -->
Expand Down
40 changes: 40 additions & 0 deletions frontend/src/components/MiddleEllipsis.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div class="flex w-full overflow-hidden whitespace-nowrap" :title="text">
<span ref="start" class="min-w-0 overflow-hidden">{{ start }}</span>
<span v-if="hasEllipsis">...</span>
<span class="shrink-0">{{ end }}</span>
</div>
</template>

<script setup lang="ts">
import { computed, useTemplateRef } from "vue";

const props = withDefaults(
defineProps<{
text: string;
lettersAfterSplit?: number;
}>(),
{
lettersAfterSplit: 16,
},
);

const startSplitRef = useTemplateRef("start");

const splitIndex = computed(() => {
return Math.floor(props.text.length - props.lettersAfterSplit);
});

const start = computed(() => {
return props.text.slice(0, splitIndex.value);
});

const end = computed(() => {
return props.text.slice(splitIndex.value);
});

const hasEllipsis = computed(() => {
if (startSplitRef.value) return startSplitRef.value.scrollWidth > startSplitRef.value.clientWidth;
return false;
});
</script>
Loading