@dataloop-ai/components 0.20.141 → 0.20.143
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/DlSelect/DlSelect.vue +8 -1
- package/src/components/compound/DlTreeTable/DlTreeTable.vue +14 -20
- package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +25 -1
- package/src/components/compound/DlTreeTable/views/DlTrTreeView.vue +2 -1
package/package.json
CHANGED
|
@@ -315,7 +315,10 @@
|
|
|
315
315
|
</dl-select-option>
|
|
316
316
|
</div>
|
|
317
317
|
</dl-list>
|
|
318
|
-
<dl-list-item
|
|
318
|
+
<dl-list-item
|
|
319
|
+
v-if="hasAfterOptions && !noOptions"
|
|
320
|
+
:padding="afterOptionsPadding"
|
|
321
|
+
>
|
|
319
322
|
<dl-item-section>
|
|
320
323
|
<slot name="after-options" />
|
|
321
324
|
</dl-item-section>
|
|
@@ -500,6 +503,10 @@ export default defineComponent({
|
|
|
500
503
|
openMenuDuringSearch: {
|
|
501
504
|
type: Boolean,
|
|
502
505
|
default: false
|
|
506
|
+
},
|
|
507
|
+
afterOptionsPadding: {
|
|
508
|
+
type: String,
|
|
509
|
+
default: null
|
|
503
510
|
}
|
|
504
511
|
},
|
|
505
512
|
emits: [
|
|
@@ -333,7 +333,7 @@ export default defineComponent({
|
|
|
333
333
|
emits,
|
|
334
334
|
setup(props, { emit, slots }) {
|
|
335
335
|
const dlTableRef = ref(null)
|
|
336
|
-
const selectedData = ref([])
|
|
336
|
+
const selectedData = ref<DlTableRow[]>([])
|
|
337
337
|
const borderState = ref([])
|
|
338
338
|
const denseState = ref([])
|
|
339
339
|
const resizableState = ref([])
|
|
@@ -393,7 +393,8 @@ export default defineComponent({
|
|
|
393
393
|
|
|
394
394
|
isRowSelected,
|
|
395
395
|
clearSelection,
|
|
396
|
-
updateSelection
|
|
396
|
+
updateSelection,
|
|
397
|
+
selectAllRows
|
|
397
398
|
} = useTreeTableRowSelection(
|
|
398
399
|
props as unknown as DlTableProps,
|
|
399
400
|
emit,
|
|
@@ -515,11 +516,19 @@ export default defineComponent({
|
|
|
515
516
|
|
|
516
517
|
updateSelected(value ? tableRows.value : [])
|
|
517
518
|
}
|
|
518
|
-
const updateSelected = (payload:
|
|
519
|
+
const updateSelected = (payload: DlTableRow[]) => {
|
|
520
|
+
const hasSelection = selectedData.value.length > 0
|
|
519
521
|
selectedData.value = payload
|
|
520
|
-
|
|
522
|
+
|
|
523
|
+
if (payload.length > 0) {
|
|
524
|
+
selectAllRows(true)
|
|
525
|
+
} else if (payload.length === 0 && hasSelection) {
|
|
526
|
+
selectAllRows(false)
|
|
527
|
+
} else {
|
|
528
|
+
emitSelectedItems(payload)
|
|
529
|
+
}
|
|
521
530
|
}
|
|
522
|
-
const emitSelectedItems = (payload:
|
|
531
|
+
const emitSelectedItems = (payload: DlTableRow[]) => {
|
|
523
532
|
emit('selected-items', payload)
|
|
524
533
|
}
|
|
525
534
|
const emitRowClick = (...payload: any) => {
|
|
@@ -988,21 +997,6 @@ export default defineComponent({
|
|
|
988
997
|
'col-update': this.updateColumns
|
|
989
998
|
},
|
|
990
999
|
scopedSlots: {
|
|
991
|
-
'header-selection': () =>
|
|
992
|
-
renderComponent(
|
|
993
|
-
vue2h,
|
|
994
|
-
DlCheckbox,
|
|
995
|
-
{
|
|
996
|
-
color: this.color,
|
|
997
|
-
modelValue: this.headerSelectedValue,
|
|
998
|
-
indeterminateValue: true,
|
|
999
|
-
'onUpdate:modelValue': this.onMultipleSelectionSet,
|
|
1000
|
-
on: {
|
|
1001
|
-
'update:modelValue': this.onMultipleSelectionSet
|
|
1002
|
-
}
|
|
1003
|
-
},
|
|
1004
|
-
(): [] => []
|
|
1005
|
-
),
|
|
1006
1000
|
tbody,
|
|
1007
1001
|
'no-data': this.$slots['no-data']
|
|
1008
1002
|
? () => this.$slots['no-data']
|
|
@@ -174,6 +174,29 @@ export function useTreeTableRowSelection(
|
|
|
174
174
|
return selectedKeys.value[rowKeyValue] === true
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
function getAllRows(rows: DlTableRow[]): DlTableRow[] {
|
|
178
|
+
const allRows: DlTableRow[] = []
|
|
179
|
+
for (const row of rows) {
|
|
180
|
+
allRows.push(row)
|
|
181
|
+
if (row.children && row.children.length > 0) {
|
|
182
|
+
allRows.push(...getAllRows(row.children))
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return allRows
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function selectAllRows(select: boolean) {
|
|
189
|
+
if (select) {
|
|
190
|
+
const allRows = getAllRows(computedRows.value)
|
|
191
|
+
const allKeys = allRows.map(getRowKey.value)
|
|
192
|
+
updateSelection(allKeys, allRows, true)
|
|
193
|
+
} else {
|
|
194
|
+
clearSelection()
|
|
195
|
+
selectedItemsNested.value = []
|
|
196
|
+
emit('selected-items', [])
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
177
200
|
return {
|
|
178
201
|
hasSelectionMode,
|
|
179
202
|
singleSelection,
|
|
@@ -183,6 +206,7 @@ export function useTreeTableRowSelection(
|
|
|
183
206
|
rowsSelectedNumber,
|
|
184
207
|
isRowSelected,
|
|
185
208
|
clearSelection,
|
|
186
|
-
updateSelection
|
|
209
|
+
updateSelection,
|
|
210
|
+
selectAllRows
|
|
187
211
|
}
|
|
188
212
|
}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
}`"
|
|
18
18
|
>
|
|
19
19
|
<dl-icon
|
|
20
|
+
v-if="!row.disableDraggable"
|
|
20
21
|
class="draggable-icon"
|
|
21
22
|
icon="icon-dl-drag"
|
|
22
23
|
size="12px"
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
:indeterminate-value="true"
|
|
41
42
|
:false-value="false"
|
|
42
43
|
:true-value="true"
|
|
43
|
-
:disabled="isCheckboxDisabled"
|
|
44
|
+
:disabled="isCheckboxDisabled || !row.isSelectable"
|
|
44
45
|
@update:model-value="
|
|
45
46
|
(adding, evt) => emitUpdateModelValue(adding, evt)
|
|
46
47
|
"
|