@katlux/toolkit 0.1.1-alpha.123 → 0.1.1-alpha.125
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/bin/cli.mjs +0 -0
- package/bin/create-preset.mjs +0 -0
- package/dist/compiled/composables/useDataProvider.mjs +7 -59
- package/dist/compiled/composables/useKatluxForm.mjs +23 -4
- package/dist/compiled/composables/usePresetComponent.mjs +1 -1
- package/dist/compiled/composables/useVirtualScroll.mjs +24 -11
- package/dist/compiled/utils/sanitize.mjs +39 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +3 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +2 -0
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +3 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +2 -0
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +22 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +11 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +4 -3
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +11 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +5 -0
- package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +4 -0
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +3 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +3 -41
- package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +9 -1
- package/dist/runtime/components/KDatatable/KDatatable.global.vue +17 -1
- package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +9 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +7 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +58 -54
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGantt/KGantt.logic.js +2 -4
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +2 -0
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue +1 -1
- package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue +1 -1
- package/dist/runtime/components/KSlider/KSlider.global.vue +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.vue +2 -0
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTree/KTree.logic.js +38 -12
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +1 -1
- package/dist/runtime/composables/useDataProvider.d.ts +1 -5
- package/dist/runtime/composables/useDataProvider.js +7 -59
- package/dist/runtime/composables/useKatluxForm.js +23 -4
- package/dist/runtime/composables/usePresetComponent.js +1 -1
- package/dist/runtime/composables/useVirtualScroll.js +24 -11
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +2 -1
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +9 -3
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +35 -12
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +9 -3
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +8 -0
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +183 -31
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +8 -0
- package/dist/runtime/presets/default/components/KIcon/KIcon.vue +5 -2
- package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +1 -0
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
- package/dist/runtime/presets/default/components/KTree/KTree.vue +245 -115
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +27 -0
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +179 -0
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +27 -0
- package/dist/runtime/utils/sanitize.d.ts +5 -0
- package/dist/runtime/utils/sanitize.js +39 -0
- package/package.json +6 -3
|
@@ -17,7 +17,11 @@
|
|
|
17
17
|
thead
|
|
18
18
|
tr
|
|
19
19
|
th.check(v-if="props.bulkActions && props.bulkActions.length > 0")
|
|
20
|
-
KCheckbox(
|
|
20
|
+
KCheckbox(
|
|
21
|
+
:model-value="isAllSelected"
|
|
22
|
+
:indeterminate="isIndeterminate"
|
|
23
|
+
@update:model-value="handleSelectAll"
|
|
24
|
+
)
|
|
21
25
|
th(
|
|
22
26
|
v-for="field in visibleFields || props.dataProvider.fields"
|
|
23
27
|
:key="field"
|
|
@@ -78,10 +82,10 @@
|
|
|
78
82
|
)
|
|
79
83
|
td(:colspan="totalColspan")
|
|
80
84
|
.footer(v-if="!props.virtualScroll")
|
|
81
|
-
KBulkActions.bulk-actions(v-if="props.bulkActions && props.bulkActions.length > 0" :bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :filter="props.dataProvider.filter")
|
|
85
|
+
KBulkActions.bulk-actions(v-if="props.bulkActions && props.bulkActions.length > 0" :bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :unselectedRows="unselectedRows" :filter="props.dataProvider.filter")
|
|
82
86
|
KPagination.pagination(:dataProvider="props.dataProvider" @update:currentPage="emit('update:currentPage', $event)" @update:pageSize="emit('update:pageSize', $event)")
|
|
83
87
|
.footer.virtual-footer(v-else-if="props.bulkActions && props.bulkActions.length > 0")
|
|
84
|
-
KBulkActions.bulk-actions(:bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :filter="props.dataProvider.filter")
|
|
88
|
+
KBulkActions.bulk-actions(:bulkActions="props.bulkActions" :selectedRows="selectedRows" :selectAll="selectAll" :unselectedRows="unselectedRows" :filter="props.dataProvider.filter")
|
|
85
89
|
</template>
|
|
86
90
|
|
|
87
91
|
<script setup lang="ts">
|
|
@@ -101,6 +105,8 @@ const props = withDefaults(defineProps<{
|
|
|
101
105
|
bulkActions: Array<IKDatatableAction>
|
|
102
106
|
selectedRows: any[]
|
|
103
107
|
selectAll: boolean
|
|
108
|
+
selectAllScope?: 'page' | 'dataset'
|
|
109
|
+
unselectedRows?: any[]
|
|
104
110
|
currentPage?: number
|
|
105
111
|
pageSize?: number
|
|
106
112
|
cellSlots?: Record<string, any>
|
|
@@ -114,6 +120,8 @@ const props = withDefaults(defineProps<{
|
|
|
114
120
|
viewportHeight?: number
|
|
115
121
|
buffer?: number
|
|
116
122
|
}>(), {
|
|
123
|
+
selectAllScope: undefined,
|
|
124
|
+
unselectedRows: () => [],
|
|
117
125
|
virtualScroll: false,
|
|
118
126
|
itemHeight: 40,
|
|
119
127
|
viewportHeight: 500,
|
|
@@ -125,6 +133,8 @@ const props = withDefaults(defineProps<{
|
|
|
125
133
|
const emit = defineEmits<{
|
|
126
134
|
(e: 'update:selectedRows', value: any[]): void
|
|
127
135
|
(e: 'update:selectAll', value: boolean): void
|
|
136
|
+
(e: 'update:unselectedRows', value: any[]): void
|
|
137
|
+
(e: 'update:selectAllScope', value: 'page' | 'dataset'): void
|
|
128
138
|
(e: 'update:currentPage', value: number): void
|
|
129
139
|
(e: 'update:pageSize', value: number): void
|
|
130
140
|
}>()
|
|
@@ -140,6 +150,21 @@ const selectAll = computed({
|
|
|
140
150
|
set: (val) => emit('update:selectAll', val)
|
|
141
151
|
})
|
|
142
152
|
|
|
153
|
+
const unselectedRows = computed({
|
|
154
|
+
get: () => props.unselectedRows || [],
|
|
155
|
+
set: (val) => emit('update:unselectedRows', val)
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
const effectiveSelectAllScope = computed<'page' | 'dataset'>(() => {
|
|
159
|
+
if (props.virtualScroll) {
|
|
160
|
+
if (props.selectAllScope === 'page') {
|
|
161
|
+
console.warn('[KDatatable] virtualScroll is enabled with selectAllScope="page". Overriding selectAllScope to "dataset" because page-scoped selection is incompatible with virtual scrolling.')
|
|
162
|
+
}
|
|
163
|
+
return 'dataset'
|
|
164
|
+
}
|
|
165
|
+
return props.selectAllScope || 'page'
|
|
166
|
+
})
|
|
167
|
+
|
|
143
168
|
const rowIdKey = computed(() => (props.dataProvider as any)?.idKey || 'id')
|
|
144
169
|
|
|
145
170
|
const getRowKey = (row: any, index: number): string | number => {
|
|
@@ -167,33 +192,124 @@ const selectedRowIds = computed(() => {
|
|
|
167
192
|
return set
|
|
168
193
|
})
|
|
169
194
|
|
|
195
|
+
const unselectedRowIds = computed(() => {
|
|
196
|
+
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
197
|
+
const set = new Set<any>()
|
|
198
|
+
for (const r of unselectedRows.value || []) {
|
|
199
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
200
|
+
set.add(id)
|
|
201
|
+
set.add(r)
|
|
202
|
+
}
|
|
203
|
+
return set
|
|
204
|
+
})
|
|
205
|
+
|
|
170
206
|
const isRowSelected = (row: any) => {
|
|
171
|
-
if (selectAll.value) return true
|
|
172
207
|
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
173
208
|
const rowId = row?.[idKey] ?? row?.id ?? row?._id ?? row
|
|
209
|
+
if (effectiveSelectAllScope.value === 'dataset' && selectAll.value) {
|
|
210
|
+
return !unselectedRowIds.value.has(rowId) && !unselectedRowIds.value.has(row)
|
|
211
|
+
}
|
|
174
212
|
return selectedRowIds.value.has(rowId) || selectedRowIds.value.has(row)
|
|
175
213
|
}
|
|
176
214
|
|
|
177
|
-
const
|
|
215
|
+
const pageSelectedCount = computed(() => {
|
|
216
|
+
if (!datatableItems.value || datatableItems.value.length === 0) return 0
|
|
217
|
+
let count = 0
|
|
218
|
+
const ids = selectedRowIds.value
|
|
178
219
|
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
220
|
+
for (const r of datatableItems.value) {
|
|
221
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
222
|
+
if (ids.has(id) || ids.has(r)) count++
|
|
223
|
+
}
|
|
224
|
+
return count
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
const isAllSelected = computed(() => {
|
|
228
|
+
const total = datatableItems.value.length
|
|
229
|
+
if (total === 0) return false
|
|
230
|
+
if (effectiveSelectAllScope.value === 'dataset') {
|
|
231
|
+
return selectAll.value === true && unselectedRows.value.length === 0
|
|
232
|
+
}
|
|
233
|
+
return pageSelectedCount.value === total
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
const isIndeterminate = computed(() => {
|
|
237
|
+
const total = datatableItems.value.length
|
|
238
|
+
if (total === 0) return false
|
|
239
|
+
if (effectiveSelectAllScope.value === 'dataset') {
|
|
240
|
+
if (selectAll.value === true) {
|
|
241
|
+
return unselectedRows.value.length > 0
|
|
242
|
+
}
|
|
243
|
+
return (selectedRows.value && selectedRows.value.length > 0)
|
|
244
|
+
}
|
|
245
|
+
return pageSelectedCount.value > 0 && pageSelectedCount.value < total
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
const handleSelectAll = () => {
|
|
249
|
+
const total = datatableItems.value.length
|
|
250
|
+
if (total === 0) return
|
|
251
|
+
|
|
252
|
+
if (effectiveSelectAllScope.value === 'dataset') {
|
|
253
|
+
if (isAllSelected.value) {
|
|
254
|
+
selectAll.value = false
|
|
255
|
+
unselectedRows.value = []
|
|
256
|
+
selectedRows.value = []
|
|
257
|
+
} else {
|
|
258
|
+
selectAll.value = true
|
|
259
|
+
unselectedRows.value = []
|
|
260
|
+
selectedRows.value = []
|
|
261
|
+
}
|
|
262
|
+
return
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// page scope: retain selections from other pages
|
|
266
|
+
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
267
|
+
if (isAllSelected.value) {
|
|
268
|
+
const pageIdSet = new Set(datatableItems.value.map((r: any) => r?.[idKey] ?? r?.id ?? r?._id ?? r))
|
|
269
|
+
selectedRows.value = (selectedRows.value || []).filter((r: any) => {
|
|
270
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
271
|
+
return !pageIdSet.has(id) && !pageIdSet.has(r)
|
|
186
272
|
})
|
|
273
|
+
unselectedRows.value = []
|
|
274
|
+
selectAll.value = false
|
|
187
275
|
} else {
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
276
|
+
const existingIds = selectedRowIds.value
|
|
277
|
+
const toAdd = datatableItems.value.filter((r: any) => {
|
|
278
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
279
|
+
return !existingIds.has(id) && !existingIds.has(r)
|
|
280
|
+
})
|
|
281
|
+
selectedRows.value = [...(selectedRows.value || []), ...toAdd]
|
|
282
|
+
unselectedRows.value = []
|
|
283
|
+
selectAll.value = false
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const toggleRow = (row: any) => {
|
|
288
|
+
const idKey = (props.dataProvider as any)?.idKey || 'id'
|
|
289
|
+
const rowId = row?.[idKey] ?? row?.id ?? row?._id ?? row
|
|
290
|
+
|
|
291
|
+
if (effectiveSelectAllScope.value === 'dataset' && selectAll.value) {
|
|
292
|
+
const isCurrentlyExcluded = unselectedRowIds.value.has(rowId) || unselectedRowIds.value.has(row)
|
|
293
|
+
if (isCurrentlyExcluded) {
|
|
294
|
+
unselectedRows.value = (unselectedRows.value || []).filter((r: any) => {
|
|
191
295
|
const rId = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
192
296
|
return rId !== rowId && r !== row
|
|
193
297
|
})
|
|
194
298
|
} else {
|
|
195
|
-
|
|
299
|
+
unselectedRows.value = [...(unselectedRows.value || []), row]
|
|
196
300
|
}
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const isSelected = isRowSelected(row)
|
|
305
|
+
if (isSelected) {
|
|
306
|
+
const next = (selectedRows.value || []).filter((r: any) => {
|
|
307
|
+
const rId = r?.[idKey] ?? r?.id ?? r?._id ?? r
|
|
308
|
+
return rId !== rowId && r !== row
|
|
309
|
+
})
|
|
310
|
+
selectedRows.value = next
|
|
311
|
+
} else {
|
|
312
|
+
selectedRows.value = [...(selectedRows.value || []), row]
|
|
197
313
|
}
|
|
198
314
|
}
|
|
199
315
|
|
|
@@ -234,9 +350,9 @@ const datatableItems = computed(() => {
|
|
|
234
350
|
const currentRows = pageRows.value
|
|
235
351
|
const dp = props.dataProvider as any
|
|
236
352
|
if (props.virtualScroll) {
|
|
353
|
+
if (Array.isArray(virtualRows?.value)) return virtualRows.value
|
|
237
354
|
if (Array.isArray(dp?.rowMap)) return dp.rowMap
|
|
238
355
|
if (Array.isArray(dp?.rowMap?.value)) return dp.rowMap.value
|
|
239
|
-
if (Array.isArray(virtualRows?.value) && virtualRows.value.length > 0) return virtualRows.value
|
|
240
356
|
if (Array.isArray(dp?.allVisibleRows)) return dp.allVisibleRows
|
|
241
357
|
if (Array.isArray(dp?.allVisibleRows?.value)) return dp.allVisibleRows.value
|
|
242
358
|
if (Array.isArray(dp?.allVisibleNodes)) return dp.allVisibleNodes
|
|
@@ -257,12 +373,13 @@ const {
|
|
|
257
373
|
containerRef,
|
|
258
374
|
onScroll,
|
|
259
375
|
scrollToIndex,
|
|
260
|
-
containerCssVars
|
|
376
|
+
containerCssVars,
|
|
377
|
+
scrollTop
|
|
261
378
|
} = useVirtualScroll({
|
|
262
379
|
items: datatableItems,
|
|
263
|
-
itemHeight: props.itemHeight || 40,
|
|
264
|
-
containerHeight: props.viewportHeight || 500,
|
|
265
|
-
buffer: props.buffer ?? 5,
|
|
380
|
+
itemHeight: computed(() => props.itemHeight || 40),
|
|
381
|
+
containerHeight: computed(() => props.viewportHeight || 500),
|
|
382
|
+
buffer: computed(() => props.buffer ?? 5),
|
|
266
383
|
virtualScroll: computed(() => !!props.virtualScroll),
|
|
267
384
|
onThresholdReach: () => {
|
|
268
385
|
const dp = props.dataProvider as any
|
|
@@ -295,24 +412,59 @@ const handleKeyDown = (e: KeyboardEvent) => {
|
|
|
295
412
|
const total = datatableItems.value.length
|
|
296
413
|
if (total === 0) return
|
|
297
414
|
|
|
415
|
+
const itemH = props.itemHeight || 40
|
|
416
|
+
const vpH = props.viewportHeight || 500
|
|
417
|
+
const firstInView = Math.floor(scrollTop.value / itemH)
|
|
418
|
+
const lastInView = Math.min(total - 1, Math.floor((scrollTop.value + vpH) / itemH) - 1)
|
|
419
|
+
|
|
420
|
+
const ensureVisible = (index: number) => {
|
|
421
|
+
const rowTop = index * itemH
|
|
422
|
+
const rowBottom = rowTop + itemH
|
|
423
|
+
if (rowTop < scrollTop.value) {
|
|
424
|
+
scrollToIndex(index, 'auto', index > 0 ? theadStickyOffset : 0)
|
|
425
|
+
} else if (rowBottom > scrollTop.value + vpH) {
|
|
426
|
+
const targetScroll = Math.max(0, rowBottom - vpH)
|
|
427
|
+
scrollTop.value = targetScroll
|
|
428
|
+
if (containerRef.value) {
|
|
429
|
+
containerRef.value.scrollTop = targetScroll
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
298
434
|
if (e.key === 'ArrowDown') {
|
|
299
435
|
e.preventDefault()
|
|
300
|
-
focusedIndex.value
|
|
301
|
-
|
|
436
|
+
if (focusedIndex.value < firstInView || focusedIndex.value > lastInView) {
|
|
437
|
+
focusedIndex.value = Math.min(total - 1, firstInView)
|
|
438
|
+
} else {
|
|
439
|
+
focusedIndex.value = Math.min(total - 1, focusedIndex.value + 1)
|
|
440
|
+
}
|
|
441
|
+
ensureVisible(focusedIndex.value)
|
|
302
442
|
} else if (e.key === 'ArrowUp') {
|
|
303
443
|
e.preventDefault()
|
|
304
|
-
focusedIndex.value
|
|
305
|
-
|
|
444
|
+
if (focusedIndex.value < firstInView || focusedIndex.value > lastInView) {
|
|
445
|
+
focusedIndex.value = Math.max(0, lastInView)
|
|
446
|
+
} else {
|
|
447
|
+
focusedIndex.value = Math.max(0, focusedIndex.value - 1)
|
|
448
|
+
}
|
|
449
|
+
ensureVisible(focusedIndex.value)
|
|
306
450
|
} else if (e.key === 'PageDown') {
|
|
307
451
|
e.preventDefault()
|
|
308
|
-
const step = Math.floor(
|
|
309
|
-
focusedIndex.value
|
|
310
|
-
|
|
452
|
+
const step = Math.max(1, Math.floor(vpH / itemH))
|
|
453
|
+
if (focusedIndex.value < firstInView || focusedIndex.value > lastInView) {
|
|
454
|
+
focusedIndex.value = Math.min(total - 1, firstInView + step)
|
|
455
|
+
} else {
|
|
456
|
+
focusedIndex.value = Math.min(total - 1, focusedIndex.value + step)
|
|
457
|
+
}
|
|
458
|
+
ensureVisible(focusedIndex.value)
|
|
311
459
|
} else if (e.key === 'PageUp') {
|
|
312
460
|
e.preventDefault()
|
|
313
|
-
const step = Math.floor(
|
|
314
|
-
focusedIndex.value
|
|
315
|
-
|
|
461
|
+
const step = Math.max(1, Math.floor(vpH / itemH))
|
|
462
|
+
if (focusedIndex.value < firstInView || focusedIndex.value > lastInView) {
|
|
463
|
+
focusedIndex.value = Math.max(0, lastInView - step)
|
|
464
|
+
} else {
|
|
465
|
+
focusedIndex.value = Math.max(0, focusedIndex.value - step)
|
|
466
|
+
}
|
|
467
|
+
ensureVisible(focusedIndex.value)
|
|
316
468
|
} else if (e.key === 'Home') {
|
|
317
469
|
e.preventDefault()
|
|
318
470
|
focusedIndex.value = 0
|
|
@@ -7,6 +7,8 @@ type __VLS_Props = {
|
|
|
7
7
|
bulkActions: Array<IKDatatableAction>;
|
|
8
8
|
selectedRows: any[];
|
|
9
9
|
selectAll: boolean;
|
|
10
|
+
selectAllScope?: 'page' | 'dataset';
|
|
11
|
+
unselectedRows?: any[];
|
|
10
12
|
currentPage?: number;
|
|
11
13
|
pageSize?: number;
|
|
12
14
|
cellSlots?: Record<string, any>;
|
|
@@ -25,16 +27,22 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
25
27
|
"update:pageSize": (value: number) => any;
|
|
26
28
|
"update:selectedRows": (value: any[]) => any;
|
|
27
29
|
"update:selectAll": (value: boolean) => any;
|
|
30
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
31
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
28
32
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
33
|
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
30
34
|
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
31
35
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
32
36
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
37
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
38
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
33
39
|
}>, {
|
|
40
|
+
unselectedRows: any[];
|
|
34
41
|
virtualScroll: boolean;
|
|
35
42
|
itemHeight: number;
|
|
36
43
|
buffer: number;
|
|
37
44
|
viewportHeight: number;
|
|
45
|
+
selectAllScope: "page" | "dataset";
|
|
38
46
|
emptyStateText: string;
|
|
39
47
|
emptyFilterStateText: string;
|
|
40
48
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
span.KIcon(
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="sanitizedIcon"
|
|
4
4
|
:style="iconStyle"
|
|
5
|
-
v-html="
|
|
5
|
+
v-html="sanitizedIcon"
|
|
6
6
|
)
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script lang="ts" setup>
|
|
10
10
|
import { computed } from 'vue'
|
|
11
|
+
import { sanitizeHtml } from '../../../../utils/sanitize'
|
|
11
12
|
|
|
12
13
|
const props = defineProps<{
|
|
13
14
|
widthPx?: string
|
|
@@ -16,6 +17,8 @@ const props = defineProps<{
|
|
|
16
17
|
rotate: number | string
|
|
17
18
|
}>()
|
|
18
19
|
|
|
20
|
+
const sanitizedIcon = computed(() => sanitizeHtml(props.iconComponent))
|
|
21
|
+
|
|
19
22
|
const iconStyle = computed(() => ({
|
|
20
23
|
width: props.widthPx,
|
|
21
24
|
height: props.heightPx,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:aria-disabled="disabled"
|
|
7
7
|
tabindex="0"
|
|
8
8
|
@keydown.space.prevent="model = value"
|
|
9
|
+
@click="!disabled && (model = value)"
|
|
9
10
|
)
|
|
10
11
|
input(type="radio" v-model="model" :disabled="disabled" :value="value" tabindex="-1")
|
|
11
12
|
.icon-container(:class="validation ? `is-${validation}` : ''")
|
|
@@ -13,6 +13,8 @@ type __VLS_Props = {
|
|
|
13
13
|
selectable?: boolean;
|
|
14
14
|
dataProvider?: any;
|
|
15
15
|
searchtext?: string;
|
|
16
|
+
modelValue?: any;
|
|
17
|
+
selectedNode?: any;
|
|
16
18
|
virtualScroll?: boolean;
|
|
17
19
|
itemHeight?: number;
|
|
18
20
|
viewportHeight?: number;
|
|
@@ -20,10 +22,8 @@ type __VLS_Props = {
|
|
|
20
22
|
};
|
|
21
23
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
22
24
|
select: (row: TTreeRow) => any;
|
|
23
|
-
"node-toggle": (id: string | number) => any;
|
|
24
25
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
25
26
|
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
26
|
-
"onNode-toggle"?: ((id: string | number) => any) | undefined;
|
|
27
27
|
}>, {
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
idKey: string;
|
|
@@ -35,8 +35,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
35
35
|
multiSelect: boolean;
|
|
36
36
|
viewportHeight: number;
|
|
37
37
|
iconField: string;
|
|
38
|
-
isNodeSelected: (node: any) => boolean;
|
|
39
38
|
selectable: boolean;
|
|
39
|
+
isNodeSelected: (node: any) => boolean;
|
|
40
40
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
41
|
declare const _default: typeof __VLS_export;
|
|
42
42
|
export default _default;
|