@dataloop-ai/components 0.19.159 → 0.19.161
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/DlDropdownButton/DlDropdownButton.vue +14 -14
- package/src/components/compound/DlInput/DlInput.vue +2 -2
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +35 -8
- package/src/components/compound/DlSearches/DlSmartSearch/components/SuggestionsDropdown.vue +9 -7
- package/src/components/compound/DlSelect/DlSelect.vue +22 -40
- package/src/components/compound/DlTable/DlTable.vue +38 -80
- package/src/components/essential/DlMenu/DlMenu.vue +16 -20
- package/src/demos/DlDropdownButtonDemo.vue +10 -30
- package/src/hooks/use-arrow-navigation.ts +11 -1
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
:aria-haspopup="true"
|
|
27
27
|
:aria-disabled="
|
|
28
28
|
disabled === true ||
|
|
29
|
-
(split
|
|
29
|
+
(!split && disableMainButton === true) ||
|
|
30
30
|
disableDropdown === true
|
|
31
31
|
"
|
|
32
32
|
:overflow="overflow"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
:aria-haspopup="true"
|
|
47
47
|
:aria-disabled="
|
|
48
48
|
disabled === true ||
|
|
49
|
-
(split
|
|
49
|
+
(!split && disableMainButton === true) ||
|
|
50
50
|
disableDropdown === true
|
|
51
51
|
"
|
|
52
52
|
:no-wrap="noWrap"
|
|
@@ -155,8 +155,8 @@
|
|
|
155
155
|
@show="onShow"
|
|
156
156
|
@before-hide="onBeforeHide"
|
|
157
157
|
@hide="onHide"
|
|
158
|
-
@
|
|
159
|
-
@
|
|
158
|
+
@highlighted-item="setHighlightedIndex"
|
|
159
|
+
@selected-item="handleSelectedItem"
|
|
160
160
|
>
|
|
161
161
|
<slot />
|
|
162
162
|
</dl-menu>
|
|
@@ -182,6 +182,7 @@ import {
|
|
|
182
182
|
import { v4 } from 'uuid'
|
|
183
183
|
import { DlTextTransformOptions } from '../../shared/types'
|
|
184
184
|
import { getColor } from '../../../utils'
|
|
185
|
+
import { arrowNavigationEvents } from '../../../hooks/use-arrow-navigation'
|
|
185
186
|
|
|
186
187
|
export default defineComponent({
|
|
187
188
|
name: 'DlDropdownButton',
|
|
@@ -197,9 +198,9 @@ export default defineComponent({
|
|
|
197
198
|
},
|
|
198
199
|
props: {
|
|
199
200
|
modelValue: Boolean,
|
|
200
|
-
split: Boolean,
|
|
201
|
+
split: { type: Boolean, default: false },
|
|
201
202
|
dropdownIcon: { type: String, default: 'icon-dl-down-chevron' },
|
|
202
|
-
contentClass: { type:
|
|
203
|
+
contentClass: { type: String, default: '' },
|
|
203
204
|
contentStyle: { type: [Array, String, Object], default: '' },
|
|
204
205
|
mainButtonStyle: { type: [Array, String, Object], default: '' },
|
|
205
206
|
cover: Boolean,
|
|
@@ -244,7 +245,7 @@ export default defineComponent({
|
|
|
244
245
|
overflow: { type: Boolean, default: false, required: false },
|
|
245
246
|
tooltip: { type: String, default: null, required: false },
|
|
246
247
|
arrowNavItems: {
|
|
247
|
-
type:
|
|
248
|
+
type: Array as PropType<any[]>,
|
|
248
249
|
default: () => [] as any[]
|
|
249
250
|
}
|
|
250
251
|
},
|
|
@@ -256,8 +257,7 @@ export default defineComponent({
|
|
|
256
257
|
'show',
|
|
257
258
|
'before-hide',
|
|
258
259
|
'hide',
|
|
259
|
-
|
|
260
|
-
'handleSelectedItem'
|
|
260
|
+
...arrowNavigationEvents
|
|
261
261
|
],
|
|
262
262
|
|
|
263
263
|
setup(props, { emit }) {
|
|
@@ -322,7 +322,7 @@ export default defineComponent({
|
|
|
322
322
|
() => props.modelValue,
|
|
323
323
|
(val) => {
|
|
324
324
|
if (menuRef.value) {
|
|
325
|
-
(menuRef!.value as Record<string, Function>)[
|
|
325
|
+
;(menuRef!.value as Record<string, Function>)[
|
|
326
326
|
val ? 'show' : 'hide'
|
|
327
327
|
]()
|
|
328
328
|
}
|
|
@@ -363,26 +363,26 @@ export default defineComponent({
|
|
|
363
363
|
|
|
364
364
|
function toggle(evt: Event) {
|
|
365
365
|
if (menuRef.value) {
|
|
366
|
-
(menuRef.value as Record<string, Function>).toggle(evt)
|
|
366
|
+
;(menuRef.value as Record<string, Function>).toggle(evt)
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
function show(evt?: Event) {
|
|
371
371
|
if (menuRef.value) {
|
|
372
|
-
(menuRef.value as Record<string, Function>).show(evt)
|
|
372
|
+
;(menuRef.value as Record<string, Function>).show(evt)
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
function hide(evt?: any) {
|
|
377
377
|
if (menuRef.value) {
|
|
378
|
-
(menuRef.value as Record<string, Function>).hide(evt)
|
|
378
|
+
;(menuRef.value as Record<string, Function>).hide(evt)
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
381
|
const setHighlightedIndex = (value: any) => {
|
|
382
382
|
emit('highlightedIndex', value)
|
|
383
383
|
}
|
|
384
384
|
const handleSelectedItem = (value: any) => {
|
|
385
|
-
emit('
|
|
385
|
+
emit('selected-item', value)
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
onMounted(() => {
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
:fit-content="fitContent"
|
|
146
146
|
:arrow-nav-items="stringSuggestions"
|
|
147
147
|
@click="onMenuShow"
|
|
148
|
-
@
|
|
149
|
-
@
|
|
148
|
+
@highlighted-item="setHighlightedIndex"
|
|
149
|
+
@selected-item="handleSelectedItem"
|
|
150
150
|
>
|
|
151
151
|
<dl-list
|
|
152
152
|
bordered
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
:expanded="expanded"
|
|
66
66
|
@set-input-value="setInputFromSuggestion"
|
|
67
67
|
@escapekey="onEscapeKey"
|
|
68
|
+
@enterkey="onEnterKey({ fromSuggestion: true })"
|
|
68
69
|
/>
|
|
69
70
|
<dl-menu
|
|
70
71
|
v-if="showDatePicker && focused"
|
|
@@ -145,6 +146,7 @@ import {
|
|
|
145
146
|
removeLeadingExpression
|
|
146
147
|
} from '../../../../../hooks/use-suggestions'
|
|
147
148
|
import { parseSmartQuery, stringifySmartQuery } from '../../../../../utils'
|
|
149
|
+
import { stateManager } from '../../../../../StateManager'
|
|
148
150
|
|
|
149
151
|
export default defineComponent({
|
|
150
152
|
components: {
|
|
@@ -216,6 +218,10 @@ export default defineComponent({
|
|
|
216
218
|
strict: {
|
|
217
219
|
type: Boolean,
|
|
218
220
|
default: false
|
|
221
|
+
},
|
|
222
|
+
inputDebounce: {
|
|
223
|
+
type: Number,
|
|
224
|
+
default: 300
|
|
219
225
|
}
|
|
220
226
|
},
|
|
221
227
|
emits: [
|
|
@@ -246,7 +252,8 @@ export default defineComponent({
|
|
|
246
252
|
omitSuggestions,
|
|
247
253
|
height,
|
|
248
254
|
width,
|
|
249
|
-
forbiddenKeys
|
|
255
|
+
forbiddenKeys,
|
|
256
|
+
inputDebounce
|
|
250
257
|
} = toRefs(props)
|
|
251
258
|
//#endregion
|
|
252
259
|
|
|
@@ -415,7 +422,13 @@ export default defineComponent({
|
|
|
415
422
|
setSelectionOffset(input.value, caretPosition, caretPosition)
|
|
416
423
|
}
|
|
417
424
|
|
|
418
|
-
const debouncedSetInputValue =
|
|
425
|
+
const debouncedSetInputValue = computed<any>(() => {
|
|
426
|
+
if (stateManager?.disableDebounce) {
|
|
427
|
+
return setInputValue
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return debounce(setInputValue, inputDebounce.value)
|
|
431
|
+
})
|
|
419
432
|
|
|
420
433
|
let lastSearchQuery: string
|
|
421
434
|
|
|
@@ -448,7 +461,13 @@ export default defineComponent({
|
|
|
448
461
|
setInputValue(inputValue, { noEmit: true })
|
|
449
462
|
}
|
|
450
463
|
|
|
451
|
-
const debouncedSetInputFromModel =
|
|
464
|
+
const debouncedSetInputFromModel = computed<any>(() => {
|
|
465
|
+
if (stateManager?.disableDebounce) {
|
|
466
|
+
return setInputFromModel
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return debounce(setInputFromModel, inputDebounce.value)
|
|
470
|
+
})
|
|
452
471
|
|
|
453
472
|
const setMenuOffset = (value: number[]) => {
|
|
454
473
|
menuOffset.value = value
|
|
@@ -571,7 +590,7 @@ export default defineComponent({
|
|
|
571
590
|
if (text.endsWith('.')) {
|
|
572
591
|
setInputValue(text)
|
|
573
592
|
} else {
|
|
574
|
-
debouncedSetInputValue(text)
|
|
593
|
+
debouncedSetInputValue.value(text)
|
|
575
594
|
}
|
|
576
595
|
}
|
|
577
596
|
|
|
@@ -608,7 +627,9 @@ export default defineComponent({
|
|
|
608
627
|
aliased !== searchQuery.value.trim() ||
|
|
609
628
|
!input.value?.innerHTML.length
|
|
610
629
|
) {
|
|
611
|
-
|
|
630
|
+
nextTick(() => {
|
|
631
|
+
debouncedSetInputFromModel.value(aliased)
|
|
632
|
+
})
|
|
612
633
|
}
|
|
613
634
|
}
|
|
614
635
|
}
|
|
@@ -654,8 +675,13 @@ export default defineComponent({
|
|
|
654
675
|
}
|
|
655
676
|
}
|
|
656
677
|
|
|
657
|
-
const onEnterKey = () => {
|
|
658
|
-
|
|
678
|
+
const onEnterKey = (options: { fromSuggestion?: boolean } = {}) => {
|
|
679
|
+
const { fromSuggestion } = options
|
|
680
|
+
|
|
681
|
+
if (
|
|
682
|
+
(!fromSuggestion && showSuggestions.value) ||
|
|
683
|
+
showDatePicker.value
|
|
684
|
+
) {
|
|
659
685
|
return
|
|
660
686
|
}
|
|
661
687
|
|
|
@@ -952,7 +978,8 @@ export default defineComponent({
|
|
|
952
978
|
computedStatus,
|
|
953
979
|
setInputFromSuggestion,
|
|
954
980
|
inputPlaceholder,
|
|
955
|
-
onEscapeKey
|
|
981
|
+
onEscapeKey,
|
|
982
|
+
onEnterKey
|
|
956
983
|
}
|
|
957
984
|
}
|
|
958
985
|
})
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="suggestions.length > 0"
|
|
4
|
-
class="dl-suggestions-dropdown"
|
|
5
|
-
>
|
|
2
|
+
<div v-if="suggestions.length > 0" class="dl-suggestions-dropdown">
|
|
6
3
|
<dl-menu
|
|
7
4
|
:target="defaultTarget"
|
|
8
5
|
:offset="offset"
|
|
@@ -16,8 +13,8 @@
|
|
|
16
13
|
@update:model-value="emitModelValue($event)"
|
|
17
14
|
@show="onShow"
|
|
18
15
|
@hide="onHide"
|
|
19
|
-
@
|
|
20
|
-
@
|
|
16
|
+
@highlighted-item="setHighlightedIndex"
|
|
17
|
+
@selected-item="handleSelectedItem"
|
|
21
18
|
@escapekey="onEscapeKey"
|
|
22
19
|
>
|
|
23
20
|
<dl-list>
|
|
@@ -82,7 +79,7 @@ export default defineComponent({
|
|
|
82
79
|
default: 1
|
|
83
80
|
}
|
|
84
81
|
},
|
|
85
|
-
emits: ['set-input-value', 'update:model-value', 'escapekey'],
|
|
82
|
+
emits: ['set-input-value', 'update:model-value', 'escapekey', 'enterkey'],
|
|
86
83
|
setup(props, { emit }) {
|
|
87
84
|
const isMenuOpen = ref(false)
|
|
88
85
|
const highlightedIndex = ref(-1)
|
|
@@ -97,6 +94,11 @@ export default defineComponent({
|
|
|
97
94
|
highlightedIndex.value = value
|
|
98
95
|
}
|
|
99
96
|
const handleSelectedItem = (value: any) => {
|
|
97
|
+
if (!value) {
|
|
98
|
+
// enter occurred on non selected values
|
|
99
|
+
emit('enterkey')
|
|
100
|
+
return
|
|
101
|
+
}
|
|
100
102
|
handleOption(value)
|
|
101
103
|
}
|
|
102
104
|
const emitModelValue = (event: any) => {
|
|
@@ -16,15 +16,9 @@
|
|
|
16
16
|
'dl-select__title-container--s': isSmall
|
|
17
17
|
}"
|
|
18
18
|
>
|
|
19
|
-
<label
|
|
20
|
-
v-show="!!title.length"
|
|
21
|
-
class="dl-select__title"
|
|
22
|
-
>
|
|
19
|
+
<label v-show="!!title.length" class="dl-select__title">
|
|
23
20
|
{{ title
|
|
24
|
-
}}<span
|
|
25
|
-
v-show="required"
|
|
26
|
-
:class="asteriskClasses"
|
|
27
|
-
> *</span>
|
|
21
|
+
}}<span v-show="required" :class="asteriskClasses"> *</span>
|
|
28
22
|
{{ !required && optional ? ' (Optional)' : null }}
|
|
29
23
|
</label>
|
|
30
24
|
<span v-show="!!tooltip.length">
|
|
@@ -49,15 +43,8 @@
|
|
|
49
43
|
:value="topMessage"
|
|
50
44
|
/>
|
|
51
45
|
</div>
|
|
52
|
-
<div
|
|
53
|
-
|
|
54
|
-
tabindex="0"
|
|
55
|
-
:style="placeholderStyles"
|
|
56
|
-
>
|
|
57
|
-
<div
|
|
58
|
-
ref="select"
|
|
59
|
-
:class="selectClasses"
|
|
60
|
-
>
|
|
46
|
+
<div class="select-wrapper" tabindex="0" :style="placeholderStyles">
|
|
47
|
+
<div ref="select" :class="selectClasses">
|
|
61
48
|
<div
|
|
62
49
|
v-show="hasPrepend || searchable"
|
|
63
50
|
:class="[
|
|
@@ -84,14 +71,11 @@
|
|
|
84
71
|
@input="handleSearchInput"
|
|
85
72
|
@focus="handleSearchFocus"
|
|
86
73
|
@blur="handleSearchBlur"
|
|
87
|
-
|
|
74
|
+
/>
|
|
88
75
|
<dl-tooltip v-if="disabled && disabledTooltip">
|
|
89
76
|
{{ disabledTooltip }}
|
|
90
77
|
</dl-tooltip>
|
|
91
|
-
<div
|
|
92
|
-
v-if="hasSelectedSlot"
|
|
93
|
-
style="width: 100%"
|
|
94
|
-
>
|
|
78
|
+
<div v-if="hasSelectedSlot" style="width: 100%">
|
|
95
79
|
<slot
|
|
96
80
|
v-if="searchable ? !isExpanded : true"
|
|
97
81
|
:opt="selectedOption"
|
|
@@ -168,18 +152,13 @@
|
|
|
168
152
|
:trigger-percentage="triggerPercentage"
|
|
169
153
|
@show="onMenuOpen"
|
|
170
154
|
@hide="closeMenu"
|
|
171
|
-
@
|
|
172
|
-
@
|
|
155
|
+
@highlighted-item="setHighlightedIndex"
|
|
156
|
+
@selected-item="handleSelectedItem"
|
|
173
157
|
>
|
|
174
|
-
<dl-list
|
|
175
|
-
class="select-list"
|
|
176
|
-
:padding="false"
|
|
177
|
-
>
|
|
158
|
+
<dl-list class="select-list" :padding="false">
|
|
178
159
|
<dl-list-item v-if="noOptions">
|
|
179
160
|
<dl-item-section color="dl-color-medium">
|
|
180
|
-
<slot name="no-options">
|
|
181
|
-
No options
|
|
182
|
-
</slot>
|
|
161
|
+
<slot name="no-options"> No options </slot>
|
|
183
162
|
</dl-item-section>
|
|
184
163
|
</dl-list-item>
|
|
185
164
|
<dl-list-item v-if="hasBeforeOptions && !noOptions">
|
|
@@ -246,10 +225,7 @@
|
|
|
246
225
|
@selected="handleSelected"
|
|
247
226
|
@deselected="handleDeselected"
|
|
248
227
|
>
|
|
249
|
-
<slot
|
|
250
|
-
name="option"
|
|
251
|
-
:opt="item"
|
|
252
|
-
>
|
|
228
|
+
<slot name="option" :opt="item">
|
|
253
229
|
<span
|
|
254
230
|
v-if="fitContent"
|
|
255
231
|
class="inner-option"
|
|
@@ -292,17 +268,14 @@
|
|
|
292
268
|
:children="getOptionChildren(option)"
|
|
293
269
|
:capitalized="capitalizedOptions"
|
|
294
270
|
:readonly="isReadonlyOption(option)"
|
|
295
|
-
:is-expanded="option
|
|
271
|
+
:is-expanded="isExpandedOption(option)"
|
|
296
272
|
@update:model-value="handleModelValueUpdate"
|
|
297
273
|
@click="selectOption(option)"
|
|
298
274
|
@selected="handleSelected"
|
|
299
275
|
@deselected="handleDeselected"
|
|
300
276
|
@depth-change="handleDepthChange"
|
|
301
277
|
>
|
|
302
|
-
<slot
|
|
303
|
-
:opt="option"
|
|
304
|
-
name="option"
|
|
305
|
-
>
|
|
278
|
+
<slot :opt="option" name="option">
|
|
306
279
|
<span
|
|
307
280
|
v-if="fitContent"
|
|
308
281
|
class="inner-option"
|
|
@@ -808,6 +781,15 @@ export default defineComponent({
|
|
|
808
781
|
this.setSelectedIndex()
|
|
809
782
|
},
|
|
810
783
|
methods: {
|
|
784
|
+
isExpandedOption(option: DlSelectOptionType): boolean {
|
|
785
|
+
if (typeof option === 'string') {
|
|
786
|
+
return false
|
|
787
|
+
}
|
|
788
|
+
if (typeof option === 'number') {
|
|
789
|
+
return false
|
|
790
|
+
}
|
|
791
|
+
return !!option?.expanded
|
|
792
|
+
},
|
|
811
793
|
handleDepthChange() {
|
|
812
794
|
// todo: remove this hack
|
|
813
795
|
setTimeout(() => {
|
|
@@ -6,37 +6,19 @@
|
|
|
6
6
|
:style="containerStyle"
|
|
7
7
|
:class="containerClass"
|
|
8
8
|
>
|
|
9
|
-
<div
|
|
10
|
-
ref="dragRef"
|
|
11
|
-
class="dl-table__drag"
|
|
12
|
-
/>
|
|
9
|
+
<div ref="dragRef" class="dl-table__drag" />
|
|
13
10
|
<!-- Top Slots -->
|
|
14
|
-
<div
|
|
15
|
-
v-
|
|
16
|
-
class="dl-table__top row items-center"
|
|
17
|
-
>
|
|
18
|
-
<slot
|
|
19
|
-
v-bind="marginalsScope"
|
|
20
|
-
name="top"
|
|
21
|
-
>
|
|
11
|
+
<div v-if="hasTopSlots" class="dl-table__top row items-center">
|
|
12
|
+
<slot v-bind="marginalsScope" name="top">
|
|
22
13
|
<slot
|
|
23
14
|
v-if="hasTopSelectionMode"
|
|
24
15
|
v-bind="marginalsScope"
|
|
25
16
|
name="top-selection"
|
|
26
17
|
/>
|
|
27
18
|
|
|
28
|
-
<div
|
|
29
|
-
v-
|
|
30
|
-
|
|
31
|
-
>
|
|
32
|
-
<slot
|
|
33
|
-
name="top-left"
|
|
34
|
-
v-bind="marginalsScope"
|
|
35
|
-
>
|
|
36
|
-
<div
|
|
37
|
-
v-if="title"
|
|
38
|
-
class="dl-table__control"
|
|
39
|
-
>
|
|
19
|
+
<div v-else class="dl-table__control">
|
|
20
|
+
<slot name="top-left" v-bind="marginalsScope">
|
|
21
|
+
<div v-if="title" class="dl-table__control">
|
|
40
22
|
<div :class="titleClasses">
|
|
41
23
|
{{ title }}
|
|
42
24
|
</div>
|
|
@@ -46,10 +28,7 @@
|
|
|
46
28
|
|
|
47
29
|
<div class="dl-table__separator col" />
|
|
48
30
|
<div class="dl-table__control">
|
|
49
|
-
<slot
|
|
50
|
-
name="top-right"
|
|
51
|
-
v-bind="marginalsScope"
|
|
52
|
-
/>
|
|
31
|
+
<slot name="top-right" v-bind="marginalsScope" />
|
|
53
32
|
</div>
|
|
54
33
|
</slot>
|
|
55
34
|
</div>
|
|
@@ -244,19 +223,13 @@
|
|
|
244
223
|
:colspan="colspanWithExpandableRow"
|
|
245
224
|
class="relative-position"
|
|
246
225
|
>
|
|
247
|
-
<dl-progress-bar
|
|
248
|
-
indeterminate
|
|
249
|
-
:color="color"
|
|
250
|
-
/>
|
|
226
|
+
<dl-progress-bar indeterminate :color="color" />
|
|
251
227
|
</th>
|
|
252
228
|
</tr>
|
|
253
229
|
</thead>
|
|
254
230
|
</template>
|
|
255
231
|
<template #default="props">
|
|
256
|
-
<slot
|
|
257
|
-
name="table-body"
|
|
258
|
-
v-bind="props"
|
|
259
|
-
>
|
|
232
|
+
<slot name="table-body" v-bind="props">
|
|
260
233
|
<template v-if="!isDataEmpty && !hasSlotBody">
|
|
261
234
|
<slot
|
|
262
235
|
v-bind="
|
|
@@ -452,16 +425,8 @@
|
|
|
452
425
|
</DlVirtualScroll>
|
|
453
426
|
<!-- -->
|
|
454
427
|
|
|
455
|
-
<div
|
|
456
|
-
|
|
457
|
-
ref="tableScroll"
|
|
458
|
-
class="dl-table__middle scroll"
|
|
459
|
-
>
|
|
460
|
-
<table
|
|
461
|
-
ref="tableRef"
|
|
462
|
-
class="dl-table"
|
|
463
|
-
:class="additionalClasses"
|
|
464
|
-
>
|
|
428
|
+
<div v-else ref="tableScroll" class="dl-table__middle scroll">
|
|
429
|
+
<table ref="tableRef" class="dl-table" :class="additionalClasses">
|
|
465
430
|
<thead :colspan="colspanWithExpandableRow">
|
|
466
431
|
<slot
|
|
467
432
|
v-if="!hideHeader"
|
|
@@ -637,10 +602,7 @@
|
|
|
637
602
|
:colspan="colspanWithExpandableRow"
|
|
638
603
|
class="relative-position"
|
|
639
604
|
>
|
|
640
|
-
<dl-progress-bar
|
|
641
|
-
indeterminate
|
|
642
|
-
:color="color"
|
|
643
|
-
/>
|
|
605
|
+
<dl-progress-bar indeterminate :color="color" />
|
|
644
606
|
</th>
|
|
645
607
|
</tr>
|
|
646
608
|
</thead>
|
|
@@ -662,16 +624,14 @@
|
|
|
662
624
|
:is-sortable="hasDraggableRows"
|
|
663
625
|
:options="sortableOptions"
|
|
664
626
|
>
|
|
665
|
-
<slot
|
|
666
|
-
|
|
667
|
-
:cols="computedCols"
|
|
668
|
-
/>
|
|
669
|
-
<slot
|
|
670
|
-
name="table-body"
|
|
671
|
-
:computed-rows="computedRows"
|
|
672
|
-
>
|
|
627
|
+
<slot name="top-row" :cols="computedCols" />
|
|
628
|
+
<slot name="table-body" :computed-rows="computedRows">
|
|
673
629
|
<dl-top-scroll
|
|
674
|
-
v-if="
|
|
630
|
+
v-if="
|
|
631
|
+
tableScroll &&
|
|
632
|
+
infiniteScroll &&
|
|
633
|
+
!isDataEmpty
|
|
634
|
+
"
|
|
675
635
|
:container-ref="tableScroll"
|
|
676
636
|
@scroll-to-top="
|
|
677
637
|
$emit(
|
|
@@ -836,7 +796,11 @@
|
|
|
836
796
|
</tr>
|
|
837
797
|
</slot>
|
|
838
798
|
<dl-bottom-scroll
|
|
839
|
-
v-if="
|
|
799
|
+
v-if="
|
|
800
|
+
tableScroll &&
|
|
801
|
+
infiniteScroll &&
|
|
802
|
+
!isDataEmpty
|
|
803
|
+
"
|
|
840
804
|
:container-ref="tableScroll"
|
|
841
805
|
@scroll-to-bottom="
|
|
842
806
|
$emit(
|
|
@@ -848,10 +812,7 @@
|
|
|
848
812
|
/>
|
|
849
813
|
</slot>
|
|
850
814
|
|
|
851
|
-
<slot
|
|
852
|
-
name="bottom-row"
|
|
853
|
-
:cols="computedCols"
|
|
854
|
-
/>
|
|
815
|
+
<slot name="bottom-row" :cols="computedCols" />
|
|
855
816
|
</Sortable>
|
|
856
817
|
</slot>
|
|
857
818
|
</table>
|
|
@@ -890,14 +851,8 @@
|
|
|
890
851
|
</div>
|
|
891
852
|
</slot>
|
|
892
853
|
</div>
|
|
893
|
-
<div
|
|
894
|
-
v-
|
|
895
|
-
class="dl-table__control"
|
|
896
|
-
>
|
|
897
|
-
<slot
|
|
898
|
-
name="bottom"
|
|
899
|
-
v-bind="marginalsScope"
|
|
900
|
-
>
|
|
854
|
+
<div v-else class="dl-table__control">
|
|
855
|
+
<slot name="bottom" v-bind="marginalsScope">
|
|
901
856
|
<div
|
|
902
857
|
v-if="
|
|
903
858
|
hasBotomSelectionBanner &&
|
|
@@ -910,10 +865,7 @@
|
|
|
910
865
|
</div>
|
|
911
866
|
</div>
|
|
912
867
|
|
|
913
|
-
<slot
|
|
914
|
-
name="pagination"
|
|
915
|
-
v-bind="marginalsScope"
|
|
916
|
-
>
|
|
868
|
+
<slot name="pagination" v-bind="marginalsScope">
|
|
917
869
|
<dl-pagination
|
|
918
870
|
v-if="displayPagination"
|
|
919
871
|
v-bind="marginalsScope.pagination"
|
|
@@ -930,10 +882,7 @@
|
|
|
930
882
|
</div>
|
|
931
883
|
</div>
|
|
932
884
|
|
|
933
|
-
<slot
|
|
934
|
-
v-if="loading"
|
|
935
|
-
name="loading"
|
|
936
|
-
/>
|
|
885
|
+
<slot v-if="loading" name="loading" />
|
|
937
886
|
</div>
|
|
938
887
|
</template>
|
|
939
888
|
|
|
@@ -1297,6 +1246,7 @@ export default defineComponent({
|
|
|
1297
1246
|
draggable,
|
|
1298
1247
|
virtualScroll,
|
|
1299
1248
|
rows,
|
|
1249
|
+
pagination,
|
|
1300
1250
|
visibleColumns,
|
|
1301
1251
|
rowKey,
|
|
1302
1252
|
titleClass,
|
|
@@ -1595,6 +1545,14 @@ export default defineComponent({
|
|
|
1595
1545
|
{ deep: true, flush: 'post' }
|
|
1596
1546
|
)
|
|
1597
1547
|
|
|
1548
|
+
watch(
|
|
1549
|
+
pagination,
|
|
1550
|
+
(newPagination) => {
|
|
1551
|
+
setPagination(newPagination)
|
|
1552
|
+
},
|
|
1553
|
+
{ deep: true }
|
|
1554
|
+
)
|
|
1555
|
+
|
|
1598
1556
|
const { computedFilterMethod } = useTableFilter(props, setPagination)
|
|
1599
1557
|
|
|
1600
1558
|
const { isRowExpanded, setExpanded, updateExpanded } =
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<dl-teleport
|
|
3
|
-
|
|
4
|
-
:to="portalEl"
|
|
5
|
-
>
|
|
6
|
-
<transition
|
|
7
|
-
name="fade"
|
|
8
|
-
appear
|
|
9
|
-
>
|
|
2
|
+
<dl-teleport v-if="portalIsActive" :to="portalEl">
|
|
3
|
+
<transition name="fade" appear>
|
|
10
4
|
<div
|
|
11
5
|
v-if="showing"
|
|
12
6
|
:id="uuid"
|
|
@@ -83,7 +77,10 @@ import {
|
|
|
83
77
|
} from './utils'
|
|
84
78
|
import { isMobileOrTablet } from '../../../utils'
|
|
85
79
|
import { v4 } from 'uuid'
|
|
86
|
-
import {
|
|
80
|
+
import {
|
|
81
|
+
arrowNavigationEvents,
|
|
82
|
+
useArrowNavigation
|
|
83
|
+
} from '../../../hooks/use-arrow-navigation'
|
|
87
84
|
|
|
88
85
|
export default defineComponent({
|
|
89
86
|
name: 'DlMenu',
|
|
@@ -154,7 +151,7 @@ export default defineComponent({
|
|
|
154
151
|
default: ''
|
|
155
152
|
},
|
|
156
153
|
arrowNavItems: {
|
|
157
|
-
type:
|
|
154
|
+
type: Array as PropType<any[]>,
|
|
158
155
|
default: () => [] as any[]
|
|
159
156
|
},
|
|
160
157
|
zIndex: {
|
|
@@ -176,10 +173,9 @@ export default defineComponent({
|
|
|
176
173
|
|
|
177
174
|
emits: [
|
|
178
175
|
...useModelToggleEmits,
|
|
176
|
+
...arrowNavigationEvents,
|
|
179
177
|
'click',
|
|
180
|
-
'escapekey'
|
|
181
|
-
'highlightedIndex',
|
|
182
|
-
'handleSelectedItem'
|
|
178
|
+
'escapekey'
|
|
183
179
|
],
|
|
184
180
|
|
|
185
181
|
setup(props, { attrs }) {
|
|
@@ -195,7 +191,7 @@ export default defineComponent({
|
|
|
195
191
|
|
|
196
192
|
const innerRef: Ref<HTMLElement | null> = ref(null)
|
|
197
193
|
const showing = ref(false)
|
|
198
|
-
const { toggleKey } = toRefs(props)
|
|
194
|
+
const { toggleKey, arrowNavItems } = toRefs(props)
|
|
199
195
|
|
|
200
196
|
const { registerTick, removeTick } = useTick()
|
|
201
197
|
const { registerTimeout, removeTimeout } = useTimeout()
|
|
@@ -371,7 +367,7 @@ export default defineComponent({
|
|
|
371
367
|
|
|
372
368
|
function configureScrollTarget() {
|
|
373
369
|
if (anchorEl.value !== null || props.scrollTarget) {
|
|
374
|
-
(localScrollTarget as Ref<any>).value = getScrollTarget(
|
|
370
|
+
;(localScrollTarget as Ref<any>).value = getScrollTarget(
|
|
375
371
|
anchorEl.value as HTMLElement,
|
|
376
372
|
props.scrollTarget
|
|
377
373
|
)
|
|
@@ -466,16 +462,16 @@ export default defineComponent({
|
|
|
466
462
|
Object.assign(proxy, { focus, updatePosition })
|
|
467
463
|
|
|
468
464
|
const isMenuOpen = ref(false)
|
|
469
|
-
const navItems = computed(() => props.arrowNavItems)
|
|
470
465
|
const { selectedItem, highlightedIndex } = useArrowNavigation(
|
|
471
|
-
|
|
472
|
-
isMenuOpen
|
|
466
|
+
arrowNavItems,
|
|
467
|
+
isMenuOpen,
|
|
468
|
+
emit
|
|
473
469
|
)
|
|
474
470
|
watch(selectedItem, (value: any) => {
|
|
475
|
-
emit('
|
|
471
|
+
emit('selected-item', value)
|
|
476
472
|
})
|
|
477
473
|
watch(highlightedIndex, (value: any) => {
|
|
478
|
-
emit('
|
|
474
|
+
emit('highlighted-item', value, arrowNavItems.value[value] ?? null)
|
|
479
475
|
})
|
|
480
476
|
|
|
481
477
|
return {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
outlined
|
|
33
33
|
split
|
|
34
34
|
:label="outlinedLabel"
|
|
35
|
-
@
|
|
35
|
+
@selected-item="handleOutlinedSelect"
|
|
36
36
|
>
|
|
37
37
|
<dl-list>
|
|
38
38
|
<dl-list-item
|
|
@@ -68,11 +68,7 @@
|
|
|
68
68
|
</dl-list>
|
|
69
69
|
</dl-dropdown-button>
|
|
70
70
|
|
|
71
|
-
<dl-dropdown-button
|
|
72
|
-
split
|
|
73
|
-
:label="containedLabel"
|
|
74
|
-
auto-close
|
|
75
|
-
>
|
|
71
|
+
<dl-dropdown-button split :label="containedLabel" auto-close>
|
|
76
72
|
<dl-list>
|
|
77
73
|
<dl-list-item
|
|
78
74
|
v-for="val in ['Photos', 'Videos', 'Articles']"
|
|
@@ -94,10 +90,7 @@
|
|
|
94
90
|
@click="onClick"
|
|
95
91
|
>
|
|
96
92
|
<dl-list>
|
|
97
|
-
<dl-list-item
|
|
98
|
-
clickable
|
|
99
|
-
@click="() => onClose('Photos')"
|
|
100
|
-
>
|
|
93
|
+
<dl-list-item clickable @click="() => onClose('Photos')">
|
|
101
94
|
<dl-item-section> Photos </dl-item-section>
|
|
102
95
|
</dl-list-item>
|
|
103
96
|
|
|
@@ -111,10 +104,7 @@
|
|
|
111
104
|
</dl-item-section>
|
|
112
105
|
</dl-list-item>
|
|
113
106
|
|
|
114
|
-
<dl-list-item
|
|
115
|
-
clickable
|
|
116
|
-
@click="() => onClose('Articles')"
|
|
117
|
-
>
|
|
107
|
+
<dl-list-item clickable @click="() => onClose('Articles')">
|
|
118
108
|
<dl-item-section> Articles </dl-item-section>
|
|
119
109
|
</dl-list-item>
|
|
120
110
|
</dl-list>
|
|
@@ -123,15 +113,8 @@
|
|
|
123
113
|
|
|
124
114
|
<div style="display: flex; gap: 20px; flex-direction: column">
|
|
125
115
|
<h2>One Button</h2>
|
|
126
|
-
<div
|
|
127
|
-
|
|
128
|
-
style="column-gap: 10px"
|
|
129
|
-
>
|
|
130
|
-
<dl-dropdown-button
|
|
131
|
-
auto-close
|
|
132
|
-
outlined
|
|
133
|
-
:label="outlinedLabel"
|
|
134
|
-
>
|
|
116
|
+
<div class="grid grid-cols-3" style="column-gap: 10px">
|
|
117
|
+
<dl-dropdown-button auto-close outlined :label="outlinedLabel">
|
|
135
118
|
<dl-list>
|
|
136
119
|
<dl-list-item clickable>
|
|
137
120
|
<dl-item-section> Photos </dl-item-section>
|
|
@@ -211,10 +194,7 @@
|
|
|
211
194
|
</dl-dropdown-button>
|
|
212
195
|
</div>
|
|
213
196
|
|
|
214
|
-
<div
|
|
215
|
-
class="grid grid-cols-3"
|
|
216
|
-
style="column-gap: 10px"
|
|
217
|
-
>
|
|
197
|
+
<div class="grid grid-cols-3" style="column-gap: 10px">
|
|
218
198
|
<dl-dropdown-button
|
|
219
199
|
auto-close
|
|
220
200
|
:model-value="showing"
|
|
@@ -315,8 +295,8 @@
|
|
|
315
295
|
tooltip="Tooltip message"
|
|
316
296
|
:arrow-nav-items="listItems"
|
|
317
297
|
@show="onOpen"
|
|
318
|
-
@
|
|
319
|
-
@
|
|
298
|
+
@highlighted-item="setHighlightedIndex"
|
|
299
|
+
@selected-item="handleSelectedItem"
|
|
320
300
|
>
|
|
321
301
|
<dl-list>
|
|
322
302
|
<dl-list-item
|
|
@@ -342,7 +322,7 @@
|
|
|
342
322
|
outlined
|
|
343
323
|
text-color="red"
|
|
344
324
|
:label="outlinedLabel"
|
|
345
|
-
@
|
|
325
|
+
@selected-item="handleOutlinedSelect"
|
|
346
326
|
>
|
|
347
327
|
<dl-list>
|
|
348
328
|
<dl-list-item
|
|
@@ -2,7 +2,15 @@ import { ref, isRef, onMounted, onBeforeUnmount, computed } from 'vue-demi'
|
|
|
2
2
|
|
|
3
3
|
type ItemType = Record<string, any> | string
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export const arrowNavigationEvents = ['selected-item', 'highlighted-index']
|
|
6
|
+
|
|
7
|
+
// todo: add tests for util
|
|
8
|
+
|
|
9
|
+
export function useArrowNavigation(
|
|
10
|
+
items: any,
|
|
11
|
+
isOpen: any,
|
|
12
|
+
emit?: (event: string, ...args: any[]) => void
|
|
13
|
+
) {
|
|
6
14
|
const selectItem = ref<ItemType | null>(null)
|
|
7
15
|
const highlightIndex = ref<number>(-1)
|
|
8
16
|
|
|
@@ -66,6 +74,8 @@ export function useArrowNavigation(items: any, isOpen: any) {
|
|
|
66
74
|
if (isEligibleToHandleEnter.value) {
|
|
67
75
|
selectedItem.value = itemsData.value[highlightedIndex.value]
|
|
68
76
|
resetHighlightedIndex()
|
|
77
|
+
} else if (emit) {
|
|
78
|
+
emit('selected-item', null)
|
|
69
79
|
}
|
|
70
80
|
}
|
|
71
81
|
|