@dataloop-ai/components 0.20.128 → 0.20.129
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataloop-ai/components",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.129",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": "./index.ts",
|
|
6
6
|
"./models": "./models.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"check-only": "if grep -E -H -r --exclude-dir=.git --exclude-dir=node_modules --exclude=*.json --exclude=*.yml '^(describe|it).only' .; then echo 'Found only in test files' && exit 1; fi"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@dataloop-ai/icons": "^3.1.
|
|
26
|
+
"@dataloop-ai/icons": "^3.1.22",
|
|
27
27
|
"@types/flat": "^5.0.2",
|
|
28
28
|
"@types/lodash": "^4.14.184",
|
|
29
29
|
"@types/sortablejs": "^1.15.7",
|
|
@@ -305,6 +305,20 @@ export default defineComponent({
|
|
|
305
305
|
type: Number,
|
|
306
306
|
default: 100
|
|
307
307
|
},
|
|
308
|
+
/**
|
|
309
|
+
* Disable child checkbox when parent is selected
|
|
310
|
+
*/
|
|
311
|
+
disableChildCheckbox: {
|
|
312
|
+
type: Boolean,
|
|
313
|
+
default: false
|
|
314
|
+
},
|
|
315
|
+
/**
|
|
316
|
+
* Tooltip text for disabled child checkbox
|
|
317
|
+
*/
|
|
318
|
+
childDisabledCheckboxTooltip: {
|
|
319
|
+
type: String,
|
|
320
|
+
default: 'Cannot unselect child when parent is selected'
|
|
321
|
+
},
|
|
308
322
|
...useTableActionsProps,
|
|
309
323
|
...commonVirtScrollProps,
|
|
310
324
|
...useTableRowExpandProps,
|
|
@@ -532,12 +546,14 @@ export default defineComponent({
|
|
|
532
546
|
row: DlTableRow,
|
|
533
547
|
index: number,
|
|
534
548
|
children: DlTableRow[] = [],
|
|
535
|
-
level: number = 1
|
|
549
|
+
level: number = 1,
|
|
550
|
+
parentSelected: boolean = false
|
|
536
551
|
) => {
|
|
537
552
|
const currentSlots = {
|
|
538
553
|
default: () => children,
|
|
539
554
|
...computedCellSlots.value
|
|
540
555
|
}
|
|
556
|
+
|
|
541
557
|
return renderComponent(vue2h.value, DlTrTreeView, {
|
|
542
558
|
row,
|
|
543
559
|
rowIndex: index,
|
|
@@ -580,6 +596,10 @@ export default defineComponent({
|
|
|
580
596
|
customIconExpandedRow: props.customIconExpandedRow,
|
|
581
597
|
customIconCompressedRow: props.customIconCompressedRow,
|
|
582
598
|
chevronIconColor: props.chevronIconColor,
|
|
599
|
+
disableChildCheckbox: props.disableChildCheckbox,
|
|
600
|
+
childDisabledCheckboxTooltip:
|
|
601
|
+
props.childDisabledCheckboxTooltip,
|
|
602
|
+
parentSelected,
|
|
583
603
|
'onUpdate:modelValue': (adding: boolean, evt: Event) => {
|
|
584
604
|
updateSelectionHierarchy(adding, evt, row)
|
|
585
605
|
},
|
|
@@ -623,11 +643,14 @@ export default defineComponent({
|
|
|
623
643
|
const renderTr = (
|
|
624
644
|
row: DlTableRow,
|
|
625
645
|
index: number,
|
|
626
|
-
level: number = 1
|
|
646
|
+
level: number = 1,
|
|
647
|
+
parentSelected: boolean = false
|
|
627
648
|
) => {
|
|
628
649
|
const children = []
|
|
650
|
+
const isCurrentRowSelected =
|
|
651
|
+
isRowSelected(props.rowKey, getRowKey.value(row)) === true
|
|
629
652
|
|
|
630
|
-
children.push(renderDlTrTree(row, index, [], level))
|
|
653
|
+
children.push(renderDlTrTree(row, index, [], level, parentSelected))
|
|
631
654
|
|
|
632
655
|
const tbodyEls: VNode[] = []
|
|
633
656
|
|
|
@@ -645,7 +668,7 @@ export default defineComponent({
|
|
|
645
668
|
'data-level': level,
|
|
646
669
|
class: 'nested-tbody'
|
|
647
670
|
},
|
|
648
|
-
renderTr(childRow, i, level)
|
|
671
|
+
renderTr(childRow, i, level, isCurrentRowSelected)
|
|
649
672
|
) as VNode
|
|
650
673
|
)
|
|
651
674
|
})
|
|
@@ -20,12 +20,18 @@
|
|
|
20
20
|
</td>
|
|
21
21
|
<td v-if="hasSelectionMode" class="dl-table--col-auto-width">
|
|
22
22
|
<slot name="body-selection" v-bind="bindBodySelection">
|
|
23
|
+
<dl-tooltip
|
|
24
|
+
v-if="isCheckboxDisabled && childDisabledCheckboxTooltip"
|
|
25
|
+
>
|
|
26
|
+
{{ childDisabledCheckboxTooltip }}
|
|
27
|
+
</dl-tooltip>
|
|
23
28
|
<DlCheckbox
|
|
24
29
|
:color="color"
|
|
25
30
|
:model-value="modelValue"
|
|
26
31
|
:indeterminate-value="true"
|
|
27
32
|
:false-value="false"
|
|
28
33
|
:true-value="true"
|
|
34
|
+
:disabled="isCheckboxDisabled"
|
|
29
35
|
@update:model-value="
|
|
30
36
|
(adding, evt) => emitUpdateModelValue(adding, evt)
|
|
31
37
|
"
|
|
@@ -84,12 +90,14 @@ import {
|
|
|
84
90
|
ref,
|
|
85
91
|
toRefs,
|
|
86
92
|
watch,
|
|
87
|
-
getCurrentInstance
|
|
93
|
+
getCurrentInstance,
|
|
94
|
+
computed
|
|
88
95
|
} from 'vue-demi'
|
|
89
96
|
import DlTrTree from '../components/DlTrTree.vue'
|
|
90
97
|
import DlTdTree from '../components/DlTdTree.vue'
|
|
91
98
|
import DlIcon from '../../../essential/DlIcon/DlIcon.vue'
|
|
92
99
|
import DlCheckbox from '../../../essential/DlCheckbox/DlCheckbox.vue'
|
|
100
|
+
import DlTooltip from '../../../shared/DlTooltip/DlTooltip.vue'
|
|
93
101
|
import { getRowKey } from '../utils/getRowKey'
|
|
94
102
|
import { DlTableRow } from '../../DlTable/types'
|
|
95
103
|
import { setTrPadding } from '../utils/trSpacing'
|
|
@@ -101,7 +109,8 @@ export default defineComponent({
|
|
|
101
109
|
DlTrTree,
|
|
102
110
|
DlTdTree,
|
|
103
111
|
DlIcon,
|
|
104
|
-
DlCheckbox
|
|
112
|
+
DlCheckbox,
|
|
113
|
+
DlTooltip
|
|
105
114
|
},
|
|
106
115
|
props: {
|
|
107
116
|
row: {
|
|
@@ -187,6 +196,27 @@ export default defineComponent({
|
|
|
187
196
|
isRowHighlighted: {
|
|
188
197
|
type: Boolean,
|
|
189
198
|
default: false
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* Disable child checkbox when parent is selected
|
|
202
|
+
*/
|
|
203
|
+
disableChildCheckbox: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
default: false
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* Tooltip text for disabled child checkbox
|
|
209
|
+
*/
|
|
210
|
+
childDisabledCheckboxTooltip: {
|
|
211
|
+
type: String,
|
|
212
|
+
default: 'Cannot unselect child when parent is selected'
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* Whether the parent row is selected
|
|
216
|
+
*/
|
|
217
|
+
parentSelected: {
|
|
218
|
+
type: Boolean,
|
|
219
|
+
default: false
|
|
190
220
|
}
|
|
191
221
|
},
|
|
192
222
|
emits: [
|
|
@@ -206,6 +236,18 @@ export default defineComponent({
|
|
|
206
236
|
|
|
207
237
|
const vm = getCurrentInstance()
|
|
208
238
|
|
|
239
|
+
const isCheckboxDisabled = computed(() => {
|
|
240
|
+
if (!props.disableChildCheckbox) {
|
|
241
|
+
return false
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (props.level === 1) {
|
|
245
|
+
return false
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return props.parentSelected
|
|
249
|
+
})
|
|
250
|
+
|
|
209
251
|
watch(
|
|
210
252
|
row,
|
|
211
253
|
() => {
|
|
@@ -364,7 +406,8 @@ export default defineComponent({
|
|
|
364
406
|
getExpandedvisibleChildren,
|
|
365
407
|
updateExpandedvisibleChildren,
|
|
366
408
|
onRowHoverStart,
|
|
367
|
-
onRowHoverEnd
|
|
409
|
+
onRowHoverEnd,
|
|
410
|
+
isCheckboxDisabled
|
|
368
411
|
}
|
|
369
412
|
}
|
|
370
413
|
})
|
|
@@ -86,6 +86,14 @@
|
|
|
86
86
|
:model-value="resizableState"
|
|
87
87
|
@update:model-value="updateResizableState"
|
|
88
88
|
/>
|
|
89
|
+
<dl-switch
|
|
90
|
+
left-label="Disable Child Checkbox"
|
|
91
|
+
value="disableChildCheckbox"
|
|
92
|
+
:model-value="disableChildCheckboxState"
|
|
93
|
+
@update:model-value="
|
|
94
|
+
updateDisableChildCheckboxState
|
|
95
|
+
"
|
|
96
|
+
/>
|
|
89
97
|
</div>
|
|
90
98
|
</div>
|
|
91
99
|
</div>
|
|
@@ -109,6 +117,8 @@
|
|
|
109
117
|
style="height: 500px"
|
|
110
118
|
:rows-per-page-options="rowsPerPageOptions"
|
|
111
119
|
highlighted-row="Frozen Yogurt"
|
|
120
|
+
:disable-child-checkbox="disableChildCheckbox"
|
|
121
|
+
child-disabled-checkbox-tooltip="Child checkbox is disabled (parent is selected)"
|
|
112
122
|
@row-click="onRowClick"
|
|
113
123
|
@th-click="log"
|
|
114
124
|
@selected-items="selectedItems"
|
|
@@ -583,6 +593,9 @@ export default defineComponent({
|
|
|
583
593
|
|
|
584
594
|
const nextPageNumber = ref(2)
|
|
585
595
|
|
|
596
|
+
const disableChildCheckbox = ref(false)
|
|
597
|
+
const disableChildCheckboxState = ref([])
|
|
598
|
+
|
|
586
599
|
let allRows: DlTableRow[] = []
|
|
587
600
|
for (let i = 0; i < 100; i++) {
|
|
588
601
|
allRows = allRows.concat(
|
|
@@ -732,7 +745,9 @@ export default defineComponent({
|
|
|
732
745
|
isFirstPage,
|
|
733
746
|
onRowClick,
|
|
734
747
|
rows2,
|
|
735
|
-
columns2
|
|
748
|
+
columns2,
|
|
749
|
+
disableChildCheckbox,
|
|
750
|
+
disableChildCheckboxState
|
|
736
751
|
}
|
|
737
752
|
},
|
|
738
753
|
|
|
@@ -765,6 +780,11 @@ export default defineComponent({
|
|
|
765
780
|
|
|
766
781
|
this.resizable = val.length !== 0
|
|
767
782
|
},
|
|
783
|
+
updateDisableChildCheckboxState(val: boolean[]): void {
|
|
784
|
+
this.disableChildCheckboxState = val
|
|
785
|
+
|
|
786
|
+
this.disableChildCheckbox = val.length !== 0
|
|
787
|
+
},
|
|
768
788
|
log(...args: any[]) {
|
|
769
789
|
console.log(...args)
|
|
770
790
|
}
|