@dataloop-ai/components 0.20.172 → 0.20.173
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
|
@@ -101,9 +101,7 @@
|
|
|
101
101
|
v-if="multiselect && (!searchable || !isExpanded)"
|
|
102
102
|
class="root-container--placeholder"
|
|
103
103
|
>
|
|
104
|
-
<template
|
|
105
|
-
v-if="allFiltersModel || isAllOptionsSelected"
|
|
106
|
-
>
|
|
104
|
+
<template v-if="allFiltersModel">
|
|
107
105
|
<dl-ellipsis :text="computedAllItemsLabel" />
|
|
108
106
|
</template>
|
|
109
107
|
<template v-else>
|
|
@@ -198,6 +196,7 @@
|
|
|
198
196
|
:highlight-selected="highlightSelected"
|
|
199
197
|
:filter-term="searchTerm"
|
|
200
198
|
:fit-content="fitContent"
|
|
199
|
+
:uniform-width="uniformWidth"
|
|
201
200
|
total-items
|
|
202
201
|
@update:model-value="selectAll"
|
|
203
202
|
@depth-change="handleDepthChange"
|
|
@@ -243,6 +242,7 @@
|
|
|
243
242
|
:indentation="indentation"
|
|
244
243
|
:is-expanded="item.expanded"
|
|
245
244
|
:tooltip="getOptionTooltip(item)"
|
|
245
|
+
:uniform-width="uniformWidth"
|
|
246
246
|
@update:model-value="handleModelValueUpdate"
|
|
247
247
|
@click="selectOption(item)"
|
|
248
248
|
@selected="handleSelected"
|
|
@@ -294,6 +294,7 @@
|
|
|
294
294
|
:indentation="indentation"
|
|
295
295
|
:is-expanded="isExpandedOption(option)"
|
|
296
296
|
:tooltip="getOptionTooltip(option)"
|
|
297
|
+
:uniform-width="uniformWidth"
|
|
297
298
|
@update:model-value="handleModelValueUpdate"
|
|
298
299
|
@click="selectOption(option)"
|
|
299
300
|
@selected="handleSelected"
|
|
@@ -428,7 +429,6 @@ export default defineComponent({
|
|
|
428
429
|
alignRight: { type: Boolean, default: false },
|
|
429
430
|
allItemsOption: { type: Boolean, default: false },
|
|
430
431
|
allItemsOptionLabel: { type: String, default: null },
|
|
431
|
-
isAllOptionsSelected: { type: Boolean, default: false },
|
|
432
432
|
placeholder: { type: String, default: null },
|
|
433
433
|
removableSelection: { type: Boolean, default: false },
|
|
434
434
|
width: { type: String, default: '100%' },
|
|
@@ -680,6 +680,35 @@ export default defineComponent({
|
|
|
680
680
|
optionsCount(): number {
|
|
681
681
|
return this.options?.length ?? 0
|
|
682
682
|
},
|
|
683
|
+
maxDepth(): number {
|
|
684
|
+
const hasChildren = (option: DlSelectOptionType) =>
|
|
685
|
+
typeof option === 'object' && option?.children?.length > 0
|
|
686
|
+
|
|
687
|
+
const getMaxDepth = (
|
|
688
|
+
options: DlSelectOptionType[],
|
|
689
|
+
depth: number = 0
|
|
690
|
+
): number => {
|
|
691
|
+
let max = depth
|
|
692
|
+
for (const option of options) {
|
|
693
|
+
if (hasChildren(option)) {
|
|
694
|
+
const childDepth = getMaxDepth(
|
|
695
|
+
(option as any).children,
|
|
696
|
+
depth + 1
|
|
697
|
+
)
|
|
698
|
+
if (childDepth > max) {
|
|
699
|
+
max = childDepth
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return max
|
|
704
|
+
}
|
|
705
|
+
return getMaxDepth(this.options)
|
|
706
|
+
},
|
|
707
|
+
uniformWidth(): string {
|
|
708
|
+
return this.maxDepth === 0
|
|
709
|
+
? '100%'
|
|
710
|
+
: `calc(100% + ${(this.maxDepth - 1) * this.indentation}px)`
|
|
711
|
+
},
|
|
683
712
|
identifierClass(): string {
|
|
684
713
|
return `dl-select-${this.title}-${
|
|
685
714
|
this.placeholder ?? ''
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
<div
|
|
4
4
|
v-if="readonly"
|
|
5
5
|
:class="[{ 'readonly-option': true }, { capitalized }]"
|
|
6
|
-
:style="`padding-left: ${
|
|
6
|
+
:style="`padding-left: ${
|
|
7
|
+
10 + depth * indentation
|
|
8
|
+
}px; width: ${computedWidth};`"
|
|
7
9
|
>
|
|
8
10
|
<dl-tooltip v-if="tooltip">
|
|
9
11
|
{{ tooltip }}
|
|
@@ -18,10 +20,10 @@
|
|
|
18
20
|
:class="{ highlighted: highlightSelected && isSelected }"
|
|
19
21
|
:with-wave="withWave"
|
|
20
22
|
clickable
|
|
21
|
-
style="width:
|
|
23
|
+
:style="`width: ${computedWidth}`"
|
|
22
24
|
@click="handleClick"
|
|
23
25
|
>
|
|
24
|
-
<dl-item-section :color="color"
|
|
26
|
+
<dl-item-section :color="color">
|
|
25
27
|
<span
|
|
26
28
|
v-if="multiselect"
|
|
27
29
|
class="multiselect-option"
|
|
@@ -98,6 +100,7 @@
|
|
|
98
100
|
:filter-term="filterTerm"
|
|
99
101
|
:fit-content="fitContent"
|
|
100
102
|
:tooltip="tooltip"
|
|
103
|
+
:uniform-width="uniformWidth"
|
|
101
104
|
@update:model-value="handleCheckboxUpdate"
|
|
102
105
|
@selected="handleSingleSelect($event, true)"
|
|
103
106
|
@deselected="handleSingleDeselect"
|
|
@@ -194,7 +197,8 @@ export default defineComponent({
|
|
|
194
197
|
type: Boolean,
|
|
195
198
|
default: true
|
|
196
199
|
},
|
|
197
|
-
tooltip: { type: String, default: null }
|
|
200
|
+
tooltip: { type: String, default: null },
|
|
201
|
+
uniformWidth: { type: String, default: null }
|
|
198
202
|
},
|
|
199
203
|
emits: [
|
|
200
204
|
'update:model-value',
|
|
@@ -238,6 +242,12 @@ export default defineComponent({
|
|
|
238
242
|
},
|
|
239
243
|
displayLabel(): string {
|
|
240
244
|
return String(this.label ? this.label : this.value)
|
|
245
|
+
},
|
|
246
|
+
computedWidth(): string {
|
|
247
|
+
if (this.uniformWidth) {
|
|
248
|
+
return this.uniformWidth
|
|
249
|
+
}
|
|
250
|
+
return 'max-content; min-width: 100%'
|
|
241
251
|
}
|
|
242
252
|
},
|
|
243
253
|
methods: {
|
|
@@ -38,22 +38,25 @@ const isValueSelected = (
|
|
|
38
38
|
export const getLabelOfSelectedOption = (
|
|
39
39
|
selected: string[] | string,
|
|
40
40
|
options: DlSelectOptionType[] | string[]
|
|
41
|
-
): string
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
): string => {
|
|
42
|
+
const selectedValue = Array.isArray(selected) ? selected[0] : selected
|
|
43
|
+
|
|
44
|
+
const findLabel = (opts: DlSelectOptionType[]): string | undefined => {
|
|
45
|
+
for (const opt of opts) {
|
|
46
|
+
const optValue = typeof opt === 'object' ? opt.value : opt
|
|
47
|
+
if (optValue === selectedValue) {
|
|
48
|
+
return typeof opt === 'object' ? String(opt.label) : String(opt)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof opt === 'object' && opt?.children?.length) {
|
|
52
|
+
const found = findLabel(opt.children as DlSelectOptionType[])
|
|
53
|
+
if (found) return found
|
|
54
|
+
}
|
|
54
55
|
}
|
|
56
|
+
return undefined
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
|
|
59
|
+
return findLabel(options as DlSelectOptionType[]) ?? '1 Option Selected'
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export const getIconSize = (size: TInputSizes) => ICON_SIZES[size] ?? '14px'
|