@dataloop-ai/components 0.19.70 → 0.19.71
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
|
@@ -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 {
|
|
@@ -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
|
}
|