@dataloop-ai/components 0.18.136 → 0.18.138
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/basic/DlPopup/DlPopup.vue +2 -2
- package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +75 -22
- package/src/components/compound/DlSearches/DlSmartSearch/components/SuggestionsDropdown.vue +9 -2
- package/src/components/compound/DlTable/DlTable.vue +4 -1
- package/src/components/compound/DlTable/components/DlTh.vue +13 -7
- package/src/components/compound/DlTable/styles/dl-table-styles.scss +6 -0
- package/src/components/essential/DlMenu/DlMenu.vue +2 -2
- package/src/demos/DlTableDemo.vue +2 -2
- package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +1 -0
package/package.json
CHANGED
|
@@ -201,7 +201,7 @@ export default defineComponent({
|
|
|
201
201
|
'show',
|
|
202
202
|
'before-show',
|
|
203
203
|
'hide',
|
|
204
|
-
'
|
|
204
|
+
'escapekey',
|
|
205
205
|
'before-hide',
|
|
206
206
|
'update:model-value'
|
|
207
207
|
],
|
|
@@ -402,7 +402,7 @@ export default defineComponent({
|
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
function onEscapeKey(evt: AnchorEvent) {
|
|
405
|
-
proxy.$emit('
|
|
405
|
+
proxy.$emit('escapekey')
|
|
406
406
|
if (!props.disableCloseByEsc) {
|
|
407
407
|
hide(evt)
|
|
408
408
|
}
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
:placeholder="inputPlaceholder"
|
|
31
31
|
:contenteditable="!disabled"
|
|
32
32
|
@keypress="onKeyPress"
|
|
33
|
+
@keyup.esc="onKeyPress"
|
|
33
34
|
@input="onInput"
|
|
34
35
|
@click.stop.prevent="focus"
|
|
35
36
|
@blur="blur"
|
|
@@ -69,12 +70,14 @@
|
|
|
69
70
|
:offset="menuOffset"
|
|
70
71
|
:expanded="expanded"
|
|
71
72
|
@set-input-value="setInputFromSuggestion"
|
|
73
|
+
@escapekey="onEscapeKey"
|
|
72
74
|
/>
|
|
73
75
|
<dl-menu
|
|
74
76
|
v-if="showDatePicker && focused"
|
|
75
77
|
v-model="showDatePicker"
|
|
76
78
|
:disabled="disabled"
|
|
77
79
|
:offset="[0, 3]"
|
|
80
|
+
@escapekey="onEscapeKey"
|
|
78
81
|
>
|
|
79
82
|
<div class="dl-smart-search-input__date-picker-wrapper">
|
|
80
83
|
<dl-date-picker
|
|
@@ -362,7 +365,7 @@ export default defineComponent({
|
|
|
362
365
|
const bracketless = removeBrackets(searchQuery.value)
|
|
363
366
|
const cleanedAliases = revertAliases(bracketless, aliases.value)
|
|
364
367
|
const json = toJSON(cleanedAliases)
|
|
365
|
-
if (!isEqual(json, modelValue.value)) {
|
|
368
|
+
if (isValid.value && !isEqual(json, modelValue.value)) {
|
|
366
369
|
emit('update:model-value', json)
|
|
367
370
|
}
|
|
368
371
|
return json
|
|
@@ -371,7 +374,7 @@ export default defineComponent({
|
|
|
371
374
|
error: e,
|
|
372
375
|
message: 'Could not translate given JSON to a valid Scheme'
|
|
373
376
|
})
|
|
374
|
-
return
|
|
377
|
+
return null
|
|
375
378
|
}
|
|
376
379
|
}
|
|
377
380
|
|
|
@@ -410,6 +413,15 @@ export default defineComponent({
|
|
|
410
413
|
emit('focus')
|
|
411
414
|
}
|
|
412
415
|
|
|
416
|
+
const processBlur = () => {
|
|
417
|
+
input.value.scrollLeft = 0
|
|
418
|
+
input.value.scrollTop = 0
|
|
419
|
+
focused.value = false
|
|
420
|
+
expanded.value = true
|
|
421
|
+
updateJSONQuery()
|
|
422
|
+
emit('blur')
|
|
423
|
+
}
|
|
424
|
+
|
|
413
425
|
const blur = (
|
|
414
426
|
e: Event | null = null,
|
|
415
427
|
options: { force?: boolean } = {}
|
|
@@ -430,12 +442,7 @@ export default defineComponent({
|
|
|
430
442
|
return
|
|
431
443
|
}
|
|
432
444
|
|
|
433
|
-
|
|
434
|
-
input.value.scrollTop = 0
|
|
435
|
-
focused.value = false
|
|
436
|
-
expanded.value = true
|
|
437
|
-
updateJSONQuery()
|
|
438
|
-
emit('blur')
|
|
445
|
+
processBlur()
|
|
439
446
|
} else {
|
|
440
447
|
focus()
|
|
441
448
|
cancelBlur.value = cancelBlur.value - 1
|
|
@@ -468,24 +475,19 @@ export default defineComponent({
|
|
|
468
475
|
})
|
|
469
476
|
|
|
470
477
|
const onKeyPress = (e: KeyboardEvent) => {
|
|
471
|
-
if (e.code === '
|
|
478
|
+
if (e.code === 'Escape' || e.key === 'Escape') {
|
|
472
479
|
e.preventDefault()
|
|
473
480
|
e.stopPropagation()
|
|
474
481
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
if (endsWithOperator.value) {
|
|
480
|
-
return
|
|
481
|
-
}
|
|
482
|
+
onEscapeKey()
|
|
483
|
+
return
|
|
484
|
+
}
|
|
482
485
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
+
if (e.code === 'Enter' || e.key === 'Enter') {
|
|
487
|
+
e.preventDefault()
|
|
488
|
+
e.stopPropagation()
|
|
486
489
|
|
|
487
|
-
|
|
488
|
-
showSuggestions.value = false
|
|
490
|
+
onEnterKey()
|
|
489
491
|
return
|
|
490
492
|
}
|
|
491
493
|
|
|
@@ -554,6 +556,52 @@ export default defineComponent({
|
|
|
554
556
|
return ''
|
|
555
557
|
}
|
|
556
558
|
}
|
|
559
|
+
|
|
560
|
+
const onEnterKey = () => {
|
|
561
|
+
if (showSuggestions.value || showDatePicker.value) {
|
|
562
|
+
return
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (endsWithOperator.value) {
|
|
566
|
+
return
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
if (!input.value.innerHTML.length) {
|
|
570
|
+
return
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (!isValid.value) {
|
|
574
|
+
return
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
const toSearch = updateJSONQuery()
|
|
578
|
+
if (toSearch) {
|
|
579
|
+
emit('search', toSearch)
|
|
580
|
+
showSuggestions.value = false
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
const onEscapeKey = () => {
|
|
585
|
+
if (!focused.value) {
|
|
586
|
+
return
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (showDatePicker.value) {
|
|
590
|
+
showDatePicker.value = false
|
|
591
|
+
showSuggestions.value = true
|
|
592
|
+
datePickerSelection.value = null
|
|
593
|
+
setCaret(input.value)
|
|
594
|
+
return
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (showSuggestions.value) {
|
|
598
|
+
showSuggestions.value = false
|
|
599
|
+
return
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
input.value.blur()
|
|
603
|
+
processBlur()
|
|
604
|
+
}
|
|
557
605
|
//#endregion
|
|
558
606
|
|
|
559
607
|
//#region computed
|
|
@@ -688,6 +736,10 @@ export default defineComponent({
|
|
|
688
736
|
: props.placeholder
|
|
689
737
|
})
|
|
690
738
|
|
|
739
|
+
const isValid = computed(() => {
|
|
740
|
+
return computedStatus.value.type !== 'error'
|
|
741
|
+
})
|
|
742
|
+
|
|
691
743
|
//#endregion
|
|
692
744
|
|
|
693
745
|
//#region watcher
|
|
@@ -792,7 +844,8 @@ export default defineComponent({
|
|
|
792
844
|
onDateSelection,
|
|
793
845
|
computedStatus,
|
|
794
846
|
setInputFromSuggestion,
|
|
795
|
-
inputPlaceholder
|
|
847
|
+
inputPlaceholder,
|
|
848
|
+
onEscapeKey
|
|
796
849
|
}
|
|
797
850
|
}
|
|
798
851
|
})
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
@hide="onHide"
|
|
19
19
|
@highlightedIndex="setHighlightedIndex"
|
|
20
20
|
@handleSelectedItem="handleSelectedItem"
|
|
21
|
+
@escapekey="onEscapeKey"
|
|
21
22
|
>
|
|
22
23
|
<dl-list>
|
|
23
24
|
<dl-list-item
|
|
@@ -81,7 +82,7 @@ export default defineComponent({
|
|
|
81
82
|
default: 1
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
|
-
emits: ['set-input-value', 'update:model-value'],
|
|
85
|
+
emits: ['set-input-value', 'update:model-value', 'escapekey'],
|
|
85
86
|
setup(props, { emit }) {
|
|
86
87
|
const isMenuOpen = ref(false)
|
|
87
88
|
const highlightedIndex = ref(-1)
|
|
@@ -109,6 +110,11 @@ export default defineComponent({
|
|
|
109
110
|
return `#dl-smart-search-input-text-area-${props.parentId}`
|
|
110
111
|
})
|
|
111
112
|
|
|
113
|
+
const onEscapeKey = () => {
|
|
114
|
+
emit('escapekey')
|
|
115
|
+
emit('update:model-value', false)
|
|
116
|
+
}
|
|
117
|
+
|
|
112
118
|
return {
|
|
113
119
|
defaultTarget,
|
|
114
120
|
setHighlightedIndex,
|
|
@@ -117,7 +123,8 @@ export default defineComponent({
|
|
|
117
123
|
onShow,
|
|
118
124
|
onHide,
|
|
119
125
|
emitModelValue,
|
|
120
|
-
handleOption
|
|
126
|
+
handleOption,
|
|
127
|
+
onEscapeKey
|
|
121
128
|
}
|
|
122
129
|
}
|
|
123
130
|
})
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
<DlTh
|
|
148
148
|
v-if="hasVisibleColumns"
|
|
149
149
|
key="header-cell-visible-columns"
|
|
150
|
+
class="visible-columns-justify-end"
|
|
150
151
|
>
|
|
151
152
|
<dl-button
|
|
152
153
|
text-color="dl-color-medium"
|
|
@@ -317,6 +318,7 @@
|
|
|
317
318
|
<DlTd
|
|
318
319
|
v-if="hasVisibleColumns"
|
|
319
320
|
key="body-cell-row-actions"
|
|
321
|
+
class="visible-columns-justify-end"
|
|
320
322
|
>
|
|
321
323
|
<slot
|
|
322
324
|
v-bind="
|
|
@@ -446,6 +448,7 @@
|
|
|
446
448
|
<DlTh
|
|
447
449
|
v-if="hasVisibleColumns"
|
|
448
450
|
key="header-cell-visible-columns"
|
|
451
|
+
class="visible-columns-justify-end"
|
|
449
452
|
>
|
|
450
453
|
<dl-button
|
|
451
454
|
text-color="dl-color-medium"
|
|
@@ -601,6 +604,7 @@
|
|
|
601
604
|
<DlTd
|
|
602
605
|
v-if="hasVisibleColumns"
|
|
603
606
|
key="body-cell-row-actions"
|
|
607
|
+
class="visible-columns-justify-end"
|
|
604
608
|
>
|
|
605
609
|
<slot
|
|
606
610
|
v-bind="
|
|
@@ -713,7 +717,6 @@ import {
|
|
|
713
717
|
getCurrentInstance,
|
|
714
718
|
ComputedRef,
|
|
715
719
|
onMounted,
|
|
716
|
-
toRef,
|
|
717
720
|
toRefs
|
|
718
721
|
} from 'vue-demi'
|
|
719
722
|
import { props } from './utils/props'
|
|
@@ -27,8 +27,10 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script lang="ts">
|
|
30
|
+
import { isString } from 'lodash'
|
|
30
31
|
import { defineComponent, getCurrentInstance, computed, ref } from 'vue-demi'
|
|
31
32
|
import { useSizeObserver } from '../../../../hooks/use-size-observer'
|
|
33
|
+
import { stringStyleToRecord } from '../../../../utils'
|
|
32
34
|
import { DlIcon } from '../../../essential'
|
|
33
35
|
import { DlTooltip } from '../../../shared'
|
|
34
36
|
|
|
@@ -44,7 +46,7 @@ export default defineComponent({
|
|
|
44
46
|
},
|
|
45
47
|
emits: ['click'],
|
|
46
48
|
|
|
47
|
-
setup(props, { emit }) {
|
|
49
|
+
setup(props, { emit, attrs }) {
|
|
48
50
|
const vm = getCurrentInstance()
|
|
49
51
|
const tableTh = ref(null)
|
|
50
52
|
|
|
@@ -104,21 +106,25 @@ export default defineComponent({
|
|
|
104
106
|
|
|
105
107
|
const onClick = !hasOptionalProps.value ? onClickFn : handleClick
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
return {
|
|
108
110
|
isSortable: !hasOptionalProps.value
|
|
109
111
|
? false
|
|
110
112
|
: column?.value?.sortable ?? false,
|
|
111
|
-
thClasses,
|
|
113
|
+
thClasses: ((attrs.class ?? '') + ' ' + thClasses.value).trim(),
|
|
112
114
|
align: column?.value?.align ?? 'left',
|
|
113
115
|
iconClass: column?.value?.iconClass ?? null,
|
|
114
116
|
hasOptionalProps,
|
|
115
|
-
headerStyle:
|
|
117
|
+
headerStyle: [
|
|
118
|
+
isString(attrs.style)
|
|
119
|
+
? stringStyleToRecord(attrs.style)
|
|
120
|
+
: attrs.style,
|
|
121
|
+
stringStyleToRecord(column.value.headerStyle ?? '')
|
|
122
|
+
] as any,
|
|
116
123
|
tableTh,
|
|
117
124
|
hasEllipsis,
|
|
118
|
-
onClick
|
|
125
|
+
onClick,
|
|
126
|
+
column
|
|
119
127
|
}
|
|
120
|
-
|
|
121
|
-
return state
|
|
122
128
|
}
|
|
123
129
|
})
|
|
124
130
|
</script>
|
|
@@ -170,7 +170,7 @@ export default defineComponent({
|
|
|
170
170
|
emits: [
|
|
171
171
|
...useModelToggleEmits,
|
|
172
172
|
'click',
|
|
173
|
-
'
|
|
173
|
+
'escapekey',
|
|
174
174
|
'highlightedIndex',
|
|
175
175
|
'handleSelectedItem'
|
|
176
176
|
],
|
|
@@ -385,7 +385,7 @@ export default defineComponent({
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
function onEscapeKey(evt: AnchorEvent) {
|
|
388
|
-
emit('
|
|
388
|
+
emit('escapekey')
|
|
389
389
|
hide(evt)
|
|
390
390
|
}
|
|
391
391
|
|
|
@@ -416,8 +416,8 @@
|
|
|
416
416
|
title="Editable Columns"
|
|
417
417
|
has-visible-columns
|
|
418
418
|
>
|
|
419
|
-
<template #body-cell-row-actions="
|
|
420
|
-
|
|
419
|
+
<template #body-cell-row-actions="">
|
|
420
|
+
<dl-button label="test button" />
|
|
421
421
|
</template>
|
|
422
422
|
</DlTable>
|
|
423
423
|
</div>
|