@dataloop-ai/components 0.18.136 → 0.18.137

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.18.136",
3
+ "version": "0.18.137",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -201,7 +201,7 @@ export default defineComponent({
201
201
  'show',
202
202
  'before-show',
203
203
  'hide',
204
- 'escape-key',
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('escape-key')
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
+ @escape-key="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
+ @escape-key="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 modelValue.value
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
- input.value.scrollLeft = 0
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 === 'Enter' || e.key === 'Enter') {
478
+ if (e.code === 'Escape' || e.key === 'Escape') {
472
479
  e.preventDefault()
473
480
  e.stopPropagation()
474
481
 
475
- if (showSuggestions.value || showDatePicker.value) {
476
- return
477
- }
478
-
479
- if (endsWithOperator.value) {
480
- return
481
- }
482
+ onEscapeKey()
483
+ return
484
+ }
482
485
 
483
- if (!input.value.innerHTML.length) {
484
- return
485
- }
486
+ if (e.code === 'Enter' || e.key === 'Enter') {
487
+ e.preventDefault()
488
+ e.stopPropagation()
486
489
 
487
- emit('search', updateJSONQuery())
488
- showSuggestions.value = false
490
+ onEnterKey()
489
491
  return
490
492
  }
491
493
 
@@ -554,6 +556,43 @@ 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 (
586
+ showDatePicker.value ||
587
+ !focused.value ||
588
+ showSuggestions.value
589
+ ) {
590
+ return
591
+ }
592
+
593
+ input.value.blur()
594
+ processBlur()
595
+ }
557
596
  //#endregion
558
597
 
559
598
  //#region computed
@@ -688,6 +727,10 @@ export default defineComponent({
688
727
  : props.placeholder
689
728
  })
690
729
 
730
+ const isValid = computed(() => {
731
+ return computedStatus.value.type !== 'error'
732
+ })
733
+
691
734
  //#endregion
692
735
 
693
736
  //#region watcher
@@ -792,7 +835,8 @@ export default defineComponent({
792
835
  onDateSelection,
793
836
  computedStatus,
794
837
  setInputFromSuggestion,
795
- inputPlaceholder
838
+ inputPlaceholder,
839
+ onEscapeKey
796
840
  }
797
841
  }
798
842
  })
@@ -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
@@ -37,6 +38,7 @@
37
38
  import { computed, defineComponent, PropType, ref } from 'vue-demi'
38
39
  import { DlMenu, DlList } from '../../../../essential'
39
40
  import { DlListItem } from '../../../../basic'
41
+ import { emit } from 'process'
40
42
 
41
43
  export default defineComponent({
42
44
  components: {
@@ -81,7 +83,7 @@ export default defineComponent({
81
83
  default: 1
82
84
  }
83
85
  },
84
- emits: ['set-input-value', 'update:model-value'],
86
+ emits: ['set-input-value', 'update:model-value', 'escapeKey'],
85
87
  setup(props, { emit }) {
86
88
  const isMenuOpen = ref(false)
87
89
  const highlightedIndex = ref(-1)
@@ -109,6 +111,11 @@ export default defineComponent({
109
111
  return `#dl-smart-search-input-text-area-${props.parentId}`
110
112
  })
111
113
 
114
+ const onEscapeKey = () => {
115
+ emit('escapeKey')
116
+ emit('update:model-value', false)
117
+ }
118
+
112
119
  return {
113
120
  defaultTarget,
114
121
  setHighlightedIndex,
@@ -117,7 +124,8 @@ export default defineComponent({
117
124
  onShow,
118
125
  onHide,
119
126
  emitModelValue,
120
- handleOption
127
+ handleOption,
128
+ onEscapeKey
121
129
  }
122
130
  }
123
131
  })
@@ -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
- const state = {
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: column.value.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>
@@ -508,4 +508,10 @@
508
508
  position: relative;
509
509
  border-bottom: 1px solid var(--dl-color-separator);
510
510
  }
511
+ }
512
+
513
+ .visible-columns-justify-end {
514
+ &::v-deep div {
515
+ justify-content: flex-end;
516
+ }
511
517
  }
@@ -170,7 +170,7 @@ export default defineComponent({
170
170
  emits: [
171
171
  ...useModelToggleEmits,
172
172
  'click',
173
- 'escape-key',
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('escape-key')
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="{ row }">
420
- {{ row }} actiosnsss
419
+ <template #body-cell-row-actions="">
420
+ <dl-button label="test button" />
421
421
  </template>
422
422
  </DlTable>
423
423
  </div>