@dataloop-ai/components 0.20.67 → 0.20.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
<slot name="before-options" />
|
|
159
159
|
</dl-item-section>
|
|
160
160
|
</dl-list-item>
|
|
161
|
-
<dl-list-item v-if="noOptions">
|
|
161
|
+
<dl-list-item v-if="noOptions" :style="computedNoOptionsStyle">
|
|
162
162
|
<dl-item-section color="dl-color-medium">
|
|
163
163
|
<slot name="no-options"> No options </slot>
|
|
164
164
|
</dl-item-section>
|
|
@@ -225,6 +225,7 @@
|
|
|
225
225
|
:children="getOptionChildren(item)"
|
|
226
226
|
:capitalized="capitalizedOptions"
|
|
227
227
|
:readonly="isReadonlyOption(item)"
|
|
228
|
+
:indentation="indentation"
|
|
228
229
|
:is-expanded="item.expanded"
|
|
229
230
|
@update:model-value="handleModelValueUpdate"
|
|
230
231
|
@click="selectOption(item)"
|
|
@@ -274,6 +275,7 @@
|
|
|
274
275
|
:children="getOptionChildren(option)"
|
|
275
276
|
:capitalized="capitalizedOptions"
|
|
276
277
|
:readonly="isReadonlyOption(option)"
|
|
278
|
+
:indentation="indentation"
|
|
277
279
|
:is-expanded="isExpandedOption(option)"
|
|
278
280
|
@update:model-value="handleModelValueUpdate"
|
|
279
281
|
@click="selectOption(option)"
|
|
@@ -281,6 +283,9 @@
|
|
|
281
283
|
@deselected="handleDeselected"
|
|
282
284
|
@depth-change="handleDepthChange"
|
|
283
285
|
>
|
|
286
|
+
<template #option="scope">
|
|
287
|
+
<slot name="option" v-bind="scope" />
|
|
288
|
+
</template>
|
|
284
289
|
<slot :opt="option" name="option">
|
|
285
290
|
<span
|
|
286
291
|
v-if="fitContent"
|
|
@@ -393,6 +398,7 @@ export default defineComponent({
|
|
|
393
398
|
type: { type: String, default: 'text' },
|
|
394
399
|
multiselect: { type: Boolean, default: false },
|
|
395
400
|
dropdownIcon: { type: String, default: 'icon-dl-down-chevron' },
|
|
401
|
+
indentation: { type: Number, default: 30 },
|
|
396
402
|
topMessage: { type: String, default: '' },
|
|
397
403
|
redAsterisk: { type: Boolean, default: false },
|
|
398
404
|
infoMessage: { type: String, default: '' },
|
|
@@ -464,6 +470,7 @@ export default defineComponent({
|
|
|
464
470
|
const searchTerm = ref('')
|
|
465
471
|
const searchInputValue = ref('')
|
|
466
472
|
const MAX_ITEMS_PER_LIST = 100 // HARDCODED - max items per list before virtual scroll
|
|
473
|
+
const initialMenuWidth = ref(0)
|
|
467
474
|
|
|
468
475
|
const setHighlightedIndex = (value: any) => {
|
|
469
476
|
highlightedIndex.value = value
|
|
@@ -496,7 +503,8 @@ export default defineComponent({
|
|
|
496
503
|
searchTerm, // todo: merge this sometime
|
|
497
504
|
searchInputValue,
|
|
498
505
|
hasSlotByName,
|
|
499
|
-
hasSlotContent
|
|
506
|
+
hasSlotContent,
|
|
507
|
+
initialMenuWidth
|
|
500
508
|
}
|
|
501
509
|
},
|
|
502
510
|
computed: {
|
|
@@ -582,6 +590,9 @@ export default defineComponent({
|
|
|
582
590
|
}
|
|
583
591
|
return style
|
|
584
592
|
},
|
|
593
|
+
computedNoOptionsStyle(): string {
|
|
594
|
+
return `min-width: ${this.initialMenuWidth}px`
|
|
595
|
+
},
|
|
585
596
|
optionsCount(): number {
|
|
586
597
|
return this.options?.length ?? 0
|
|
587
598
|
},
|
|
@@ -805,6 +816,13 @@ export default defineComponent({
|
|
|
805
816
|
const inputRef = this.$refs.searchInput as HTMLInputElement
|
|
806
817
|
this.$nextTick(() => {
|
|
807
818
|
inputRef?.focus({})
|
|
819
|
+
setTimeout(() => {
|
|
820
|
+
const menuRef = this.$refs.menu as {
|
|
821
|
+
innerRef?: HTMLElement
|
|
822
|
+
}
|
|
823
|
+
this.initialMenuWidth =
|
|
824
|
+
menuRef?.innerRef?.clientWidth ?? 0
|
|
825
|
+
}, 100)
|
|
808
826
|
})
|
|
809
827
|
}
|
|
810
828
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div
|
|
4
4
|
v-if="readonly"
|
|
5
5
|
:class="[{ 'readonly-option': true }, { capitalized }]"
|
|
6
|
-
:style="`padding-left: ${10 + depth *
|
|
6
|
+
:style="`padding-left: ${10 + depth * indentation}px;`"
|
|
7
7
|
>
|
|
8
8
|
<slot>
|
|
9
9
|
{{ label ? (capitalized ? label.toLowerCase() : label) : null }}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<span
|
|
23
23
|
v-if="multiselect"
|
|
24
24
|
class="multiselect-option"
|
|
25
|
-
:style="`padding-left: ${depth *
|
|
25
|
+
:style="`padding-left: ${depth * indentation}px;`"
|
|
26
26
|
>
|
|
27
27
|
<span v-if="hasChildren">
|
|
28
28
|
<dl-icon
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
:ref="`option-${getValue(child)}`"
|
|
74
74
|
:multiselect="multiselect"
|
|
75
75
|
:select-children="selectChildren"
|
|
76
|
-
:count="
|
|
76
|
+
:count="getOptionCount(child)"
|
|
77
77
|
clickable
|
|
78
78
|
:model-value="modelValue"
|
|
79
79
|
:value="getValue(child)"
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
:with-wave="withWave"
|
|
85
85
|
:capitalized="capitalized"
|
|
86
86
|
:readonly="isReadonlyOption(child)"
|
|
87
|
+
:indentation="indentation"
|
|
87
88
|
:is-expanded="isExpanded"
|
|
88
89
|
:filter-term="filterTerm"
|
|
89
90
|
:fit-content="fitContent"
|
|
@@ -92,17 +93,22 @@
|
|
|
92
93
|
@deselected="handleSingleDeselect"
|
|
93
94
|
@depth-change="$emit('depth-change')"
|
|
94
95
|
>
|
|
95
|
-
<
|
|
96
|
-
v-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/>
|
|
100
|
-
<dl-ellipsis v-else>
|
|
96
|
+
<template #option="scope">
|
|
97
|
+
<slot name="option" v-bind="scope" />
|
|
98
|
+
</template>
|
|
99
|
+
<slot :opt="child" name="option">
|
|
101
100
|
<span
|
|
101
|
+
v-if="fitContent"
|
|
102
102
|
class="inner-option"
|
|
103
103
|
v-html="getOptionHtml(child)"
|
|
104
104
|
/>
|
|
105
|
-
|
|
105
|
+
<dl-ellipsis v-else>
|
|
106
|
+
<span
|
|
107
|
+
class="inner-option"
|
|
108
|
+
v-html="getOptionHtml(child)"
|
|
109
|
+
/>
|
|
110
|
+
</dl-ellipsis>
|
|
111
|
+
</slot>
|
|
106
112
|
</dl-select-option>
|
|
107
113
|
</div>
|
|
108
114
|
</div>
|
|
@@ -160,6 +166,7 @@ export default defineComponent({
|
|
|
160
166
|
label: { type: String, default: null },
|
|
161
167
|
capitalized: { type: Boolean, default: false },
|
|
162
168
|
readonly: { type: Boolean, default: false },
|
|
169
|
+
indentation: { type: Number, default: 30 },
|
|
163
170
|
isExpanded: {
|
|
164
171
|
type: Boolean,
|
|
165
172
|
default: false
|
|
@@ -217,9 +224,6 @@ export default defineComponent({
|
|
|
217
224
|
hasChildren(): boolean {
|
|
218
225
|
return this.children && this.children?.length > 0
|
|
219
226
|
},
|
|
220
|
-
indent(): { padding: string } {
|
|
221
|
-
return { padding: `0 ${this.depth * 30}px 0 0` }
|
|
222
|
-
},
|
|
223
227
|
displayLabel(): string {
|
|
224
228
|
return String(this.label ? this.label : this.value)
|
|
225
229
|
}
|
|
@@ -341,6 +345,9 @@ export default defineComponent({
|
|
|
341
345
|
toggleChildren() {
|
|
342
346
|
this.showChildren = !this.showChildren
|
|
343
347
|
},
|
|
348
|
+
getOptionCount(option: any) {
|
|
349
|
+
return option?.count ?? null
|
|
350
|
+
},
|
|
344
351
|
getChildren(option: any) {
|
|
345
352
|
return typeof option === 'object' ? option.children : null
|
|
346
353
|
},
|
|
@@ -155,13 +155,15 @@ export default defineComponent({
|
|
|
155
155
|
|
|
156
156
|
const loadSvg = () => {
|
|
157
157
|
return new Promise<void>((resolve, reject) => {
|
|
158
|
+
const loadedIcon = icon.value
|
|
159
|
+
|
|
158
160
|
const svgElement = new Image()
|
|
159
161
|
svgElement.setAttribute('height', size.value)
|
|
160
162
|
svgElement.setAttribute('width', size.value)
|
|
161
163
|
|
|
162
164
|
svgElement.onload = () => {
|
|
163
165
|
// In order to handle events and loading that occur mid unmounting.
|
|
164
|
-
if (isDestroyed.value) {
|
|
166
|
+
if (isDestroyed.value || loadedIcon !== icon.value) {
|
|
165
167
|
return
|
|
166
168
|
}
|
|
167
169
|
const container = svgIcon.value as HTMLDivElement
|