@dataloop-ai/components 0.20.128 → 0.20.130
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.130",
|
|
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.23",
|
|
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
|
})
|
|
@@ -16,16 +16,31 @@
|
|
|
16
16
|
isDragIconVisible || isRowHighlighted ? '1' : '0'
|
|
17
17
|
}`"
|
|
18
18
|
>
|
|
19
|
-
<dl-icon
|
|
19
|
+
<dl-icon
|
|
20
|
+
class="draggable-icon"
|
|
21
|
+
icon="icon-dl-drag"
|
|
22
|
+
size="12px"
|
|
23
|
+
:color="
|
|
24
|
+
isDragIconHovered ? 'dl-color-darker' : 'dl-color-lighter'
|
|
25
|
+
"
|
|
26
|
+
@mouseenter="isDragIconHovered = true"
|
|
27
|
+
@mouseleave="isDragIconHovered = false"
|
|
28
|
+
/>
|
|
20
29
|
</td>
|
|
21
30
|
<td v-if="hasSelectionMode" class="dl-table--col-auto-width">
|
|
22
31
|
<slot name="body-selection" v-bind="bindBodySelection">
|
|
32
|
+
<dl-tooltip
|
|
33
|
+
v-if="isCheckboxDisabled && childDisabledCheckboxTooltip"
|
|
34
|
+
>
|
|
35
|
+
{{ childDisabledCheckboxTooltip }}
|
|
36
|
+
</dl-tooltip>
|
|
23
37
|
<DlCheckbox
|
|
24
38
|
:color="color"
|
|
25
39
|
:model-value="modelValue"
|
|
26
40
|
:indeterminate-value="true"
|
|
27
41
|
:false-value="false"
|
|
28
42
|
:true-value="true"
|
|
43
|
+
:disabled="isCheckboxDisabled"
|
|
29
44
|
@update:model-value="
|
|
30
45
|
(adding, evt) => emitUpdateModelValue(adding, evt)
|
|
31
46
|
"
|
|
@@ -84,12 +99,14 @@ import {
|
|
|
84
99
|
ref,
|
|
85
100
|
toRefs,
|
|
86
101
|
watch,
|
|
87
|
-
getCurrentInstance
|
|
102
|
+
getCurrentInstance,
|
|
103
|
+
computed
|
|
88
104
|
} from 'vue-demi'
|
|
89
105
|
import DlTrTree from '../components/DlTrTree.vue'
|
|
90
106
|
import DlTdTree from '../components/DlTdTree.vue'
|
|
91
107
|
import DlIcon from '../../../essential/DlIcon/DlIcon.vue'
|
|
92
108
|
import DlCheckbox from '../../../essential/DlCheckbox/DlCheckbox.vue'
|
|
109
|
+
import DlTooltip from '../../../shared/DlTooltip/DlTooltip.vue'
|
|
93
110
|
import { getRowKey } from '../utils/getRowKey'
|
|
94
111
|
import { DlTableRow } from '../../DlTable/types'
|
|
95
112
|
import { setTrPadding } from '../utils/trSpacing'
|
|
@@ -101,7 +118,8 @@ export default defineComponent({
|
|
|
101
118
|
DlTrTree,
|
|
102
119
|
DlTdTree,
|
|
103
120
|
DlIcon,
|
|
104
|
-
DlCheckbox
|
|
121
|
+
DlCheckbox,
|
|
122
|
+
DlTooltip
|
|
105
123
|
},
|
|
106
124
|
props: {
|
|
107
125
|
row: {
|
|
@@ -187,6 +205,27 @@ export default defineComponent({
|
|
|
187
205
|
isRowHighlighted: {
|
|
188
206
|
type: Boolean,
|
|
189
207
|
default: false
|
|
208
|
+
},
|
|
209
|
+
/**
|
|
210
|
+
* Disable child checkbox when parent is selected
|
|
211
|
+
*/
|
|
212
|
+
disableChildCheckbox: {
|
|
213
|
+
type: Boolean,
|
|
214
|
+
default: false
|
|
215
|
+
},
|
|
216
|
+
/**
|
|
217
|
+
* Tooltip text for disabled child checkbox
|
|
218
|
+
*/
|
|
219
|
+
childDisabledCheckboxTooltip: {
|
|
220
|
+
type: String,
|
|
221
|
+
default: 'Cannot unselect child when parent is selected'
|
|
222
|
+
},
|
|
223
|
+
/**
|
|
224
|
+
* Whether the parent row is selected
|
|
225
|
+
*/
|
|
226
|
+
parentSelected: {
|
|
227
|
+
type: Boolean,
|
|
228
|
+
default: false
|
|
190
229
|
}
|
|
191
230
|
},
|
|
192
231
|
emits: [
|
|
@@ -203,9 +242,21 @@ export default defineComponent({
|
|
|
203
242
|
const childrenCount = ref(0)
|
|
204
243
|
const { row } = toRefs(props)
|
|
205
244
|
const isDragIconVisible = ref(false)
|
|
206
|
-
|
|
245
|
+
const isDragIconHovered = ref(false)
|
|
207
246
|
const vm = getCurrentInstance()
|
|
208
247
|
|
|
248
|
+
const isCheckboxDisabled = computed(() => {
|
|
249
|
+
if (!props.disableChildCheckbox) {
|
|
250
|
+
return false
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (props.level === 1) {
|
|
254
|
+
return false
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return props.parentSelected
|
|
258
|
+
})
|
|
259
|
+
|
|
209
260
|
watch(
|
|
210
261
|
row,
|
|
211
262
|
() => {
|
|
@@ -349,6 +400,7 @@ export default defineComponent({
|
|
|
349
400
|
visibleChildren,
|
|
350
401
|
childrenCount,
|
|
351
402
|
isDragIconVisible,
|
|
403
|
+
isDragIconHovered,
|
|
352
404
|
getRowKey,
|
|
353
405
|
emitRowClick,
|
|
354
406
|
onTrDoubleClick,
|
|
@@ -364,7 +416,8 @@ export default defineComponent({
|
|
|
364
416
|
getExpandedvisibleChildren,
|
|
365
417
|
updateExpandedvisibleChildren,
|
|
366
418
|
onRowHoverStart,
|
|
367
|
-
onRowHoverEnd
|
|
419
|
+
onRowHoverEnd,
|
|
420
|
+
isCheckboxDisabled
|
|
368
421
|
}
|
|
369
422
|
}
|
|
370
423
|
})
|
|
@@ -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
|
}
|