@dataloop-ai/components 0.19.70 → 0.19.72
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 +1 -1
- package/src/components/compound/DlPagination/components/RowsSelector.vue +1 -1
- package/src/components/compound/DlSelect/DlSelect.vue +11 -0
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +7 -4
- package/src/components/compound/DlTreeTable/hooks/nestedTableFilter.ts +11 -8
- package/src/demos/DlSelectDemo.vue +45 -0
- package/src/demos/DlTreeTableDemo.vue +1 -1
package/package.json
CHANGED
|
@@ -160,6 +160,8 @@
|
|
|
160
160
|
no-focus
|
|
161
161
|
:offset="[0, 3]"
|
|
162
162
|
style="border-radius: 0"
|
|
163
|
+
:style="menuStyle"
|
|
164
|
+
:menu-class="menuClass"
|
|
163
165
|
:disabled="disabled || readonly"
|
|
164
166
|
:arrow-nav-items="options"
|
|
165
167
|
:max-height="dropdownMaxHeight"
|
|
@@ -412,6 +414,14 @@ export default defineComponent({
|
|
|
412
414
|
triggerPercentage: {
|
|
413
415
|
type: Number,
|
|
414
416
|
default: 1
|
|
417
|
+
},
|
|
418
|
+
menuStyle: {
|
|
419
|
+
type: String,
|
|
420
|
+
default: null
|
|
421
|
+
},
|
|
422
|
+
menuClass: {
|
|
423
|
+
type: String,
|
|
424
|
+
default: null
|
|
415
425
|
}
|
|
416
426
|
},
|
|
417
427
|
emits: [
|
|
@@ -1106,6 +1116,7 @@ export default defineComponent({
|
|
|
1106
1116
|
padding: 5px 0;
|
|
1107
1117
|
max-height: var(--dl-select-dropdown-max-height);
|
|
1108
1118
|
overflow: auto;
|
|
1119
|
+
width: fit-content;
|
|
1109
1120
|
}
|
|
1110
1121
|
|
|
1111
1122
|
.expand-icon {
|
|
@@ -347,13 +347,16 @@ export default defineComponent({
|
|
|
347
347
|
const { filteredRows } = useNestedTableFilter(
|
|
348
348
|
tableRows.value,
|
|
349
349
|
(row) => {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
.
|
|
350
|
+
let filter = props.filter ?? ''
|
|
351
|
+
if (typeof filter === 'string') {
|
|
352
|
+
filter = filter.toLowerCase()
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return row.name.toLowerCase?.().includes(filter)
|
|
353
356
|
}
|
|
354
357
|
)
|
|
355
358
|
|
|
356
|
-
const computedFilter = computed(() =>
|
|
359
|
+
const computedFilter = computed<DlTableRow[]>(() =>
|
|
357
360
|
props.filter && filteredRows.value.length
|
|
358
361
|
? filteredRows.value
|
|
359
362
|
: tableRows.value
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, computed, watchEffect } from 'vue'
|
|
1
|
+
import { ref, computed, watchEffect } from 'vue-demi'
|
|
2
2
|
import { DlTableRow } from '../../types'
|
|
3
3
|
|
|
4
4
|
export function useNestedTableFilter(
|
|
@@ -8,27 +8,30 @@ export function useNestedTableFilter(
|
|
|
8
8
|
const nestedRows = ref<DlTableRow[]>(rows)
|
|
9
9
|
const criteria = ref(filerCriteria)
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const nestedSearch = (
|
|
12
12
|
array: DlTableRow[],
|
|
13
13
|
criteria: (item: DlTableRow) => boolean
|
|
14
14
|
): DlTableRow[] => {
|
|
15
|
-
|
|
15
|
+
const result = []
|
|
16
|
+
const stack = [...array]
|
|
17
|
+
while (stack.length) {
|
|
18
|
+
const item = stack.pop()
|
|
16
19
|
if (criteria(item)) {
|
|
17
20
|
result.push(item)
|
|
18
21
|
}
|
|
19
22
|
if (item.children) {
|
|
20
|
-
|
|
23
|
+
stack.push(...item.children)
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
}
|
|
26
|
+
return result
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const filteredRows = computed(() => {
|
|
27
|
-
return
|
|
30
|
+
return nestedSearch(nestedRows.value, criteria.value)
|
|
28
31
|
})
|
|
29
32
|
|
|
30
33
|
watchEffect(() => {
|
|
31
|
-
|
|
34
|
+
nestedSearch(nestedRows.value, criteria.value)
|
|
32
35
|
})
|
|
33
36
|
|
|
34
37
|
return {
|
|
@@ -99,6 +99,51 @@
|
|
|
99
99
|
</div>
|
|
100
100
|
</template>
|
|
101
101
|
</dl-select>
|
|
102
|
+
fit content
|
|
103
|
+
<dl-select
|
|
104
|
+
v-model="statusOption"
|
|
105
|
+
width="96px"
|
|
106
|
+
without-borders
|
|
107
|
+
fit-content
|
|
108
|
+
align-right
|
|
109
|
+
:options="[
|
|
110
|
+
{
|
|
111
|
+
label: 'S1',
|
|
112
|
+
value: 1,
|
|
113
|
+
badgeColor: 'var(--dl-color-disabled)'
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: 'S 2',
|
|
117
|
+
value: 2,
|
|
118
|
+
badgeColor: 'var(--dl-color-secondary)'
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
label: 'S3',
|
|
122
|
+
value: 3,
|
|
123
|
+
badgeColor: 'var(--dl-color-positive)'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
label: 'S4',
|
|
127
|
+
value: 4,
|
|
128
|
+
badgeColor: 'var(--dl-color-warning)'
|
|
129
|
+
}
|
|
130
|
+
]"
|
|
131
|
+
required
|
|
132
|
+
>
|
|
133
|
+
<template #selected="scope">
|
|
134
|
+
<div style="display: flex; align-items: center; gap: 5px">
|
|
135
|
+
<dl-badge :color="scope.opt.badgeColor" />
|
|
136
|
+
{{ scope.opt.label }}
|
|
137
|
+
</div>
|
|
138
|
+
</template>
|
|
139
|
+
<template #option="scope">
|
|
140
|
+
<div style="display: flex; align-items: center; gap: 5px">
|
|
141
|
+
<dl-badge :color="scope.opt.badgeColor" />
|
|
142
|
+
{{ scope.opt.label }}
|
|
143
|
+
</div>
|
|
144
|
+
</template>
|
|
145
|
+
</dl-select>
|
|
146
|
+
|
|
102
147
|
with prepend
|
|
103
148
|
<dl-select
|
|
104
149
|
v-model="tasksFilter"
|
|
@@ -774,7 +774,7 @@ export default defineComponent({
|
|
|
774
774
|
align-items: flex-start;
|
|
775
775
|
gap: 10px;
|
|
776
776
|
padding: 10px;
|
|
777
|
-
background-color:
|
|
777
|
+
background-color: var(--dl-color-panel-background);
|
|
778
778
|
border-radius: 4px;
|
|
779
779
|
box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
|
|
780
780
|
}
|