@dataloop-ai/components 0.20.186 → 0.20.187-ds-v3.0

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.
@@ -12,11 +12,7 @@
12
12
  :icon="
13
13
  focused ? defaultIcon : statusIcon || defaultIcon
14
14
  "
15
- :color="
16
- focused
17
- ? defaultIconColor
18
- : statusIconColor || defaultIconColor
19
- "
15
+ :color="iconColor"
20
16
  size="16px"
21
17
  :inline="false"
22
18
  />
@@ -53,7 +49,7 @@
53
49
  </div>
54
50
  </div>
55
51
  <dl-tooltip
56
- v-if="!focused"
52
+ v-if="!focused && !noTooltip"
57
53
  border="1px solid var(--dl-color-separator)"
58
54
  background-color="dl-color-panel-background"
59
55
  color="dl-color-darker"
@@ -248,6 +244,10 @@ export default defineComponent({
248
244
  type: String,
249
245
  default: '28px'
250
246
  },
247
+ noTooltip: {
248
+ type: Boolean,
249
+ default: false
250
+ },
251
251
  omitSuggestions: {
252
252
  type: Array as PropType<string[]>,
253
253
  default: () => [] as string[]
@@ -275,6 +275,7 @@ export default defineComponent({
275
275
  'blur',
276
276
  'input',
277
277
  'search',
278
+ 'status',
278
279
  'error',
279
280
  'clear'
280
281
  ],
@@ -297,6 +298,7 @@ export default defineComponent({
297
298
  defaultIcon,
298
299
  defaultIconColor,
299
300
  schema,
301
+ noTooltip,
300
302
  omitSuggestions,
301
303
  operatorsOverride,
302
304
  height,
@@ -960,6 +962,16 @@ export default defineComponent({
960
962
  }
961
963
  })
962
964
 
965
+ const iconColor = computed(() => {
966
+ if (disabled.value) {
967
+ return 'dl-color-disabled'
968
+ }
969
+ if (focused.value) {
970
+ return defaultIconColor.value
971
+ }
972
+ return statusIconColor.value || defaultIconColor.value
973
+ })
974
+
963
975
  const textareaStyles = computed<Record<string, string | number>>(() => {
964
976
  const overflow: string =
965
977
  scroll.value && focused.value ? 'scroll' : 'hidden'
@@ -994,9 +1006,14 @@ export default defineComponent({
994
1006
  })
995
1007
 
996
1008
  const inputClass = computed<string>(() => {
997
- return `dl-smart-search-input__textarea${
998
- focused.value ? ' focus' : ''
999
- }`
1009
+ let classes = 'dl-smart-search-input__textarea'
1010
+ if (focused.value) {
1011
+ classes += ' focus'
1012
+ }
1013
+ if (disabled.value) {
1014
+ classes += ' dl-smart-search-input__textarea--disabled'
1015
+ }
1016
+ return classes
1000
1017
  })
1001
1018
 
1002
1019
  const showClearButton = computed(() => {
@@ -1035,24 +1052,31 @@ export default defineComponent({
1035
1052
  return status.value
1036
1053
  }
1037
1054
 
1055
+ let newStatus: {
1056
+ type: string
1057
+ message: string
1058
+ }
1059
+
1038
1060
  if (!error.value && searchQuery.value !== '') {
1039
- return {
1061
+ newStatus = {
1040
1062
  type: 'success',
1041
1063
  message: ''
1042
1064
  }
1043
- }
1044
-
1045
- if (error.value === 'warning') {
1046
- return {
1065
+ } else if (error.value === 'warning') {
1066
+ newStatus = {
1047
1067
  type: 'warning',
1048
1068
  message: 'The query is not supported technically.'
1049
1069
  }
1070
+ } else {
1071
+ newStatus = {
1072
+ type: 'error',
1073
+ message: error.value
1074
+ }
1050
1075
  }
1051
1076
 
1052
- return {
1053
- type: 'error',
1054
- message: error.value
1055
- }
1077
+ emit('status', newStatus)
1078
+
1079
+ return newStatus
1056
1080
  })
1057
1081
 
1058
1082
  const inputPlaceholder = computed<string>(() => {
@@ -1173,6 +1197,7 @@ export default defineComponent({
1173
1197
  debouncedSetInputValue,
1174
1198
  statusIcon,
1175
1199
  statusIconColor,
1200
+ iconColor,
1176
1201
  textareaStyles,
1177
1202
  searchBarClasses,
1178
1203
  inputClass,
@@ -1325,6 +1350,21 @@ export default defineComponent({
1325
1350
  }
1326
1351
  }
1327
1352
 
1353
+ &__textarea--disabled {
1354
+ &::before {
1355
+ color: var(--dl-color-disabled);
1356
+ }
1357
+ }
1358
+
1359
+ &__search-bar--disabled {
1360
+ .dl-smart-search-input__input,
1361
+ .dl-smart-search-input__textarea {
1362
+ &::before {
1363
+ color: var(--dl-color-disabled);
1364
+ }
1365
+ }
1366
+ }
1367
+
1328
1368
  &__input-wrapper,
1329
1369
  &__textarea-wrapper {
1330
1370
  min-height: 28px;
@@ -4,48 +4,116 @@
4
4
  v-model="isOpen"
5
5
  :height="500"
6
6
  :width="800"
7
- style="--dl-dialog-box-footer-padding: 10px 16px"
7
+ style="--dl-dialog-box-footer-padding: 10px 16px; --dl-dialog-box-content-padding: 0"
8
8
  >
9
9
  <template #header>
10
10
  <dl-dialog-box-header
11
- title="DQL Search"
11
+ title="DQL Editor"
12
12
  :close-button="true"
13
13
  @onClose="isOpen = false"
14
14
  />
15
15
  </template>
16
16
  <template #body>
17
17
  <div class="json-editor-layout">
18
- <div
19
- class="json-query-menu"
20
- style="margin-bottom: 10px"
21
- >
18
+ <div class="json-query-menu">
22
19
  <dl-select
23
20
  :model-value="selectedOption"
21
+ ref="jsonQueryMenu"
24
22
  width="300px"
25
23
  :options="selectOptions"
26
24
  placeholder="New Query"
25
+ searchable
26
+ size="m"
27
+ after-options-padding="0"
28
+ no-options-padding="0"
29
+ menu-style="overflow-y: hidden;"
27
30
  @update:model-value="onQuerySelect"
28
31
  >
29
32
  <template #selected="scope">
30
- <span class="json-query-menu-option">
33
+ <span class="json-query-menu-selected">
31
34
  {{ scope.opt ? scope.opt.label : '' }}
32
35
  </span>
33
36
  </template>
34
37
  <template #option="scope">
35
- <span class="json-query-menu-option">
36
- {{ scope.opt.label }}
37
- </span>
38
+ <div
39
+ v-if="selectOptions.length < 2"
40
+ class="json-query-menu-no-option"
41
+ disabled
42
+ style="cursor: default !important; padding: 14px 0 10px 0;"
43
+ >
44
+ No Saved Queries
45
+ </div>
46
+ <div v-else class="json-query-menu-option">
47
+ <div class="json-query-menu-option-label">
48
+ {{ scope.opt.label }}
49
+ </div>
50
+ <dl-icon
51
+ v-if="scope.opt.label !== 'New Query'"
52
+ icon="icon-dl-delete"
53
+ color="dl-color-negative"
54
+ class="json-query-menu-option-delete"
55
+ @click.stop="onDelete(scope.opt)"
56
+ >
57
+ <dl-tooltip>Delete</dl-tooltip>
58
+ </dl-icon>
59
+ </div>
60
+ </template>
61
+ <template #after-options>
62
+ <dl-separator
63
+ style="margin: 0 0 2px 0 !important"
64
+ type="horizontal"
65
+ />
66
+ <dl-button
67
+ icon="icon-dl-save"
68
+ flat
69
+ fluid
70
+ secondary
71
+ size="s"
72
+ label="Save Query"
73
+ class="json-query-menu-save-button"
74
+ @click="onSave"
75
+ />
76
+ </template>
77
+ <template #no-options>
78
+ <div class="json-query-menu-no-option">
79
+ No Results Found
80
+ </div>
81
+ <dl-separator
82
+ style="margin: 0 0 2px 0 !important"
83
+ type="horizontal"
84
+ />
85
+ <dl-button
86
+ icon="icon-dl-save"
87
+ flat
88
+ fluid
89
+ secondary
90
+ size="s"
91
+ label="Save Query"
92
+ class="json-query-menu-save-button"
93
+ @click="onSave"
94
+ />
38
95
  </template>
39
96
  </dl-select>
40
- <dl-button
41
- icon="icon-dl-align-left"
42
- label="Align Left"
43
- flat
44
- color="secondary"
45
- padding="0px 3px"
46
- :disabled="alignDisabled"
47
- @click="alignJSON"
48
- />
97
+ <div>
98
+ <dl-button
99
+ icon="icon-dl-align-left"
100
+ tooltip="Align Left"
101
+ flat
102
+ color="secondary"
103
+ padding="0px 3px"
104
+ :disabled="alignDisabled"
105
+ @click="alignJSON"
106
+ />
107
+ <dl-button
108
+ icon="icon-dl-copy"
109
+ tooltip="Copy"
110
+ flat
111
+ color="secondary"
112
+ padding="0px 3px"
113
+ :disabled="alignDisabled"
114
+ @click="copyJSON"
115
+ />
116
+ </div>
49
117
  </div>
50
118
  <dl-json-editor
51
119
  ref="jsonEditor"
@@ -65,7 +133,7 @@
65
133
  flat
66
134
  color="secondary"
67
135
  padding="0"
68
- @click="showDeleteDialog = true"
136
+ @click="optionToDelete = selectedOption"
69
137
  />
70
138
  <div class="json-editor-footer-actions">
71
139
  <dl-button
@@ -101,27 +169,20 @@
101
169
  <template #body>
102
170
  <dl-input
103
171
  v-model="newQueryName"
104
- title="Query name"
105
- style="text-align: center"
106
- placeholder="Type query name"
172
+ :red-asterisk="true"
173
+ :required="true"
174
+ title="Query Name"
175
+ placeholder="Insert query name"
107
176
  />
108
177
  </template>
109
178
  <template #footer>
110
179
  <div class="dl-smart-search__buttons--save">
111
180
  <dl-button
112
181
  :disabled="!newQueryName"
113
- outlined
114
- style="margin-right: 5px"
115
182
  @click="() => saveQuery(false)"
116
183
  >
117
184
  Save
118
185
  </dl-button>
119
- <dl-button
120
- :disabled="!newQueryName"
121
- @click="() => saveQuery(true)"
122
- >
123
- Save and Search
124
- </dl-button>
125
186
  </div>
126
187
  </template>
127
188
  </dl-dialog-box>
@@ -135,12 +196,13 @@
135
196
  />
136
197
  </template>
137
198
  <template #body>
138
- <dl-typography
139
- size="h3"
140
- style="display: flex; justify-content: center"
141
- >
142
- Are you sure you want to delete
143
- {{ selectedOption.label }}?
199
+ <dl-typography size="h5">
200
+ Are you sure you want to permanently delete the following query?
201
+ <br />
202
+ {{ optionToDelete.label }}
203
+ <br />
204
+ <br />
205
+ This action cannot be undone.
144
206
  </dl-typography>
145
207
  </template>
146
208
  <template #footer>
@@ -166,10 +228,12 @@ import {
166
228
  } from 'vue-demi'
167
229
  import { DlSelect } from '../../../DlSelect'
168
230
  import { DlSelectOption } from '../../../DlSelect/types'
231
+ import { DlSeparator } from '../../../../essential/DlSeparator'
169
232
  import { DlButton } from '../../../../basic'
170
233
  import { DlDialogBox, DlDialogBoxHeader } from '../../../DlDialogBox'
171
234
  import { DlJsonEditor } from '../../../DlJsonEditor'
172
- import { DlTypography } from '../../../../essential'
235
+ import { DlTooltip } from '../../../../shared/DlTooltip'
236
+ import { DlTypography, DlIcon } from '../../../../essential'
173
237
  import { DlInput } from '../../../DlInput'
174
238
  import { stateManager } from '../../../../../StateManager'
175
239
  import { cloneDeep, isEqual, uniqBy } from 'lodash'
@@ -179,9 +243,12 @@ export default defineComponent({
179
243
  components: {
180
244
  DlDialogBox,
181
245
  DlDialogBoxHeader,
246
+ DlIcon,
182
247
  DlJsonEditor,
183
248
  DlButton,
184
249
  DlSelect,
250
+ DlSeparator,
251
+ DlTooltip,
185
252
  DlTypography,
186
253
  DlInput
187
254
  },
@@ -214,11 +281,24 @@ export default defineComponent({
214
281
  'update:modelValue',
215
282
  'search',
216
283
  'change',
284
+ 'copied',
217
285
  'update:options',
218
286
  'save',
219
287
  'delete',
220
288
  'select'
221
289
  ],
290
+ methods: {
291
+ onDelete(option: DlSelectOption) {
292
+ const select = this.$refs['jsonQueryMenu'] as InstanceType<typeof DlSelect>
293
+ select?.closeMenu()
294
+ this.optionToDelete = option
295
+ },
296
+ onSave() {
297
+ const select = this.$refs['jsonQueryMenu'] as InstanceType<typeof DlSelect>
298
+ select?.closeMenu()
299
+ this.showSaveDialog = true
300
+ }
301
+ },
222
302
  setup(props, { emit }) {
223
303
  const { modelValue, options, json, selectedFilter } = toRefs(props)
224
304
 
@@ -230,7 +310,15 @@ export default defineComponent({
230
310
  const currentQuery = ref<{ [key: string]: any }>(cloneDeep(json.value))
231
311
  const jsonEditor = ref<any>(null)
232
312
  const showSaveDialog = ref(false)
233
- const showDeleteDialog = ref(false)
313
+ const optionToDelete = ref<DlSelectOption>(null)
314
+ const showDeleteDialog = computed<boolean>({
315
+ get: () => !!optionToDelete.value,
316
+ set: (val) => {
317
+ if (!val) {
318
+ optionToDelete.value = null
319
+ }
320
+ }
321
+ })
234
322
  const newQueryName = ref('')
235
323
  const alignDisabled = ref(false)
236
324
 
@@ -273,6 +361,11 @@ export default defineComponent({
273
361
  jsonEditor.value?.format()
274
362
  }
275
363
 
364
+ const copyJSON = async () => {
365
+ await navigator.clipboard.writeText(stringifiedJSON.value)
366
+ emit('copied')
367
+ }
368
+
276
369
  const onQuerySelect = (option: DlSelectOption) => {
277
370
  if (option.label === selectedOption.value.label) {
278
371
  return
@@ -356,10 +449,10 @@ export default defineComponent({
356
449
 
357
450
  const deleteQuery = () => {
358
451
  const toDelete = options.value.find(
359
- (o: DlSelectOption) => o.label === selectedOption.value.label
452
+ (o: DlSelectOption) => o.label === optionToDelete.value.label
360
453
  )
361
454
  const newOptions = options.value.filter(
362
- (o: DlSelectOption) => o.label !== selectedOption.value.label
455
+ (o: DlSelectOption) => o.label !== optionToDelete.value.label
363
456
  )
364
457
 
365
458
  emit('delete', toDelete)
@@ -392,9 +485,11 @@ export default defineComponent({
392
485
  selectedOption,
393
486
  hasActiveFilter,
394
487
  alignJSON,
488
+ copyJSON,
395
489
  onQuerySelect,
396
490
  newQueryName,
397
491
  alignDisabled,
492
+ optionToDelete,
398
493
  showDeleteDialog,
399
494
  selectOptions,
400
495
  search,
@@ -407,29 +502,76 @@ export default defineComponent({
407
502
  })
408
503
  </script>
409
504
 
410
- <style scoped lang="scss">
505
+ <style scoped>
411
506
  .json-editor-layout {
412
507
  display: flex;
413
508
  flex-direction: column;
414
509
  height: 100%;
415
510
  }
416
511
 
417
- .json-editor-footer,
418
- .json-query-menu {
512
+ .json-editor-footer {
419
513
  width: 100%;
420
514
  display: flex;
421
515
  align-items: center;
422
516
  justify-content: space-between;
423
517
  }
518
+ .json-query-menu {
519
+ display: flex;
520
+ align-items: center;
521
+ background-color: var(--dl-color-fill);
522
+ justify-content: space-between;
523
+ padding: 6px 16px;
524
+ }
424
525
  .json-editor {
425
- height: 100%;
526
+ height: calc(100% - 40px);
527
+ --jse-main-border: none;
426
528
  }
427
529
 
428
530
  .json-query-menu-option {
531
+ display: flex;
532
+ flex-direction: row;
533
+ }
534
+ .json-query-menu-option-label,
535
+ .json-query-menu-selected {
536
+ padding-top: 3px;
429
537
  white-space: nowrap;
430
538
  display: inline-block;
431
539
  width: 265px;
432
540
  overflow: hidden;
433
541
  text-overflow: ellipsis;
434
542
  }
543
+ .json-query-menu-option:hover .json-query-menu-option-label {
544
+ margin-right: 6px;
545
+ width: 255px;
546
+ }
547
+ .json-query-menu-option-delete {
548
+ overflow-x: hidden;
549
+ width: 0;
550
+ }
551
+ .json-query-menu-option:hover .json-query-menu-option-delete {
552
+ border-radius: 4px;
553
+ overflow-x: visible;
554
+ padding: 4px;
555
+ width: auto;
556
+ }
557
+ .json-query-menu-option-delete:hover {
558
+ background-color: var(--dl-color-fill-secondary);
559
+ }
560
+ .json-query-menu-option-delete:active {
561
+ background-color: var(--dl-color-negative-background);
562
+ }
563
+ .json-query-menu-no-option {
564
+ display: flex;
565
+ padding: 20px 0;
566
+ flex-direction: column;
567
+ align-items: center;
568
+ align-self: stretch;
569
+ }
570
+ .json-query-menu-save-button:hover {
571
+ background-color: var(--dl-color-fill-secondary);
572
+ }
573
+ .dl-smart-search__buttons--save {
574
+ text-align: right;
575
+ width: 100%;
576
+ }
435
577
  </style>
@@ -170,13 +170,17 @@
170
170
  <slot name="before-options" />
171
171
  </dl-item-section>
172
172
  </dl-list-item>
173
- <dl-list-item v-if="noOptions" :style="computedNoOptionsStyle">
173
+ <dl-list-item
174
+ v-if="noOptions"
175
+ :style="computedNoOptionsStyle"
176
+ :padding="noOptionsPadding"
177
+ >
174
178
  <dl-item-section color="dl-color-medium">
175
179
  <slot name="no-options"> No options </slot>
176
180
  </dl-item-section>
177
181
  </dl-list-item>
178
182
  <dl-list
179
- v-if="showMenuList"
183
+ v-else-if="showMenuList"
180
184
  class="select-list"
181
185
  :padding="false"
182
186
  :style="
@@ -515,6 +519,10 @@ export default defineComponent({
515
519
  type: String,
516
520
  default: null
517
521
  },
522
+ noOptionsPadding: {
523
+ type: String,
524
+ default: null
525
+ },
518
526
  keepFocusOnBlur: {
519
527
  type: Boolean,
520
528
  default: false
@@ -1048,7 +1056,11 @@ export default defineComponent({
1048
1056
  return !!option?.readonly
1049
1057
  },
1050
1058
  isDisableRowOption(option: DlSelectOptionType) {
1051
- return typeof option === 'object' && option !== null && !!option.disableRow
1059
+ return (
1060
+ typeof option === 'object' &&
1061
+ option !== null &&
1062
+ !!option.disableRow
1063
+ )
1052
1064
  },
1053
1065
  getOptionCount(option: any) {
1054
1066
  return option?.count ?? null
@@ -17,7 +17,7 @@
17
17
  <dl-list-item
18
18
  v-else
19
19
  class="option"
20
- :class="{
20
+ :class="{
21
21
  highlighted: highlightSelected && isSelected,
22
22
  'disabled-row': disableRow
23
23
  }"
@@ -142,10 +142,7 @@ import { v4 } from 'uuid'
142
142
  import { debounce } from 'lodash'
143
143
  import { stateManager } from '../../../../StateManager'
144
144
  import { getCaseInsensitiveInput, getLabel } from '../utils'
145
- import {
146
- DlSelectOption,
147
- DlSelectOptionType
148
- } from '../../types'
145
+ import { DlSelectOption, DlSelectOptionType } from '../../types'
149
146
 
150
147
  const ValueTypes = [Array, Boolean, String, Number, Object, Function]
151
148
 
@@ -406,7 +403,11 @@ export default defineComponent({
406
403
  return !!option?.readonly
407
404
  },
408
405
  isDisableRowOption(option: DlSelectOptionType) {
409
- return typeof option === 'object' && option !== null && !!option.disableRow
406
+ return (
407
+ typeof option === 'object' &&
408
+ option !== null &&
409
+ !!option.disableRow
410
+ )
410
411
  }
411
412
  }
412
413
  })
@@ -161,7 +161,7 @@
161
161
  <div
162
162
  v-if="
163
163
  visibleColumns &&
164
- visibleColumns.length
164
+ visibleColumns.length
165
165
  "
166
166
  class="visible-columns-justify-end"
167
167
  style="width: 100%; display: flex"
@@ -274,8 +274,8 @@
274
274
  isRowSelected(getRowKey(props.item))
275
275
  ? 'selected'
276
276
  : hasAnyAction
277
- ? ' cursor-pointer'
278
- : ''
277
+ ? ' cursor-pointer'
278
+ : ''
279
279
  "
280
280
  :no-hover="noHover"
281
281
  @click="
@@ -565,7 +565,7 @@
565
565
  <div
566
566
  v-if="
567
567
  visibleColumns &&
568
- visibleColumns.length
568
+ visibleColumns.length
569
569
  "
570
570
  class="visible-columns-justify-end"
571
571
  style="width: 100%; display: flex"
@@ -674,8 +674,8 @@
674
674
  <dl-top-scroll
675
675
  v-if="
676
676
  tableScroll &&
677
- infiniteScroll &&
678
- !isDataEmpty
677
+ infiniteScroll &&
678
+ !isDataEmpty
679
679
  "
680
680
  :container-ref="tableScroll"
681
681
  @scroll-to-top="
@@ -709,8 +709,8 @@
709
709
  isRowSelected(getRowKey(row))
710
710
  ? 'selected'
711
711
  : hasAnyAction
712
- ? ' cursor-pointer'
713
- : ''
712
+ ? ' cursor-pointer'
713
+ : ''
714
714
  "
715
715
  :no-hover="noHover"
716
716
  @click="onTrClick($event, row, pageIndex)"
@@ -845,8 +845,8 @@
845
845
  <dl-bottom-scroll
846
846
  v-if="
847
847
  tableScroll &&
848
- infiniteScroll &&
849
- !isDataEmpty
848
+ infiniteScroll &&
849
+ !isDataEmpty
850
850
  "
851
851
  :container-ref="tableScroll"
852
852
  @scroll-to-bottom="
@@ -903,7 +903,7 @@
903
903
  <div
904
904
  v-if="
905
905
  hasBottomSelectionBanner &&
906
- selectedRowsLabel(rowsSelectedNumber)
906
+ selectedRowsLabel(rowsSelectedNumber)
907
907
  "
908
908
  class="dl-table__control"
909
909
  >