@dataloop-ai/components 0.20.182 → 0.20.183-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.20.182",
3
+ "version": "0.20.183-ds-v3.0",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div class="dl-date-time-range--card">
3
+ <div v-if="mode === 'multi'" class="dl-date-time-range--card_sidebar">
4
+ <card-sidebar
5
+ v-if="typeState === 'day'"
6
+ :options="sidebarDayOptions"
7
+ :current-option="currentSidebarOption"
8
+ @click="handleDayTypeOptionClick"
9
+ />
10
+ <card-sidebar
11
+ v-else
12
+ :options="sidebarMonthOptions"
13
+ :current-option="currentSidebarOption"
14
+ @click="handleMonthTypeOptionClick"
15
+ />
16
+ </div>
17
+ <div
18
+ class="dl-date-time-range--card_content"
19
+ :style="cardContentStyles"
20
+ >
21
+ <dl-date-picker
22
+ :model-value="dateInterval"
23
+ :type="typeState"
24
+ :available-range="availableRange"
25
+ :disabled="isInputDisabled"
26
+ :normalize-calendars="normalizeCalendars"
27
+ :active-date-from="activeDateFrom"
28
+ :active-date-to="activeDateTo"
29
+ @update:model-value="updateDateIntervalWithAutoClose"
30
+ @update:from-to-date="updateFromToDate"
31
+ />
32
+ <dl-time-picker
33
+ v-if="showTime && typeState === 'day'"
34
+ :disabled="isInputDisabled"
35
+ :model-value="dateInterval"
36
+ @update:model-value="updateDateInterval"
37
+ />
38
+
39
+ <dl-button
40
+ v-if="!hideClearButton"
41
+ size="s"
42
+ outlined
43
+ class="dl-date-time-range--button"
44
+ @click="handleClear"
45
+ >
46
+ <span style="text-transform: capitalize"> Clear </span>
47
+ </dl-button>
48
+ </div>
49
+ </div>
50
+ </template>
51
+
52
+ <script lang="ts">
53
+ import { defineComponent, PropType } from 'vue-demi'
54
+ import { DlTimePicker } from '../DlTimePicker'
55
+ import { DateInterval } from '../types'
56
+ import CardSidebar from './CardSidebar.vue'
57
+ import { DayTypeOption, MonthTypeOption } from './types'
58
+ import DlDatePicker from '../DlDatePicker/DlDatePicker.vue'
59
+ import { CalendarDate } from '../DlDatePicker/models/CalendarDate'
60
+ import { DlButton } from '../../../basic'
61
+
62
+ export default defineComponent({
63
+ components: {
64
+ CardSidebar,
65
+ DlDatePicker,
66
+ DlTimePicker,
67
+ DlButton
68
+ },
69
+ props: {
70
+ mode: {
71
+ type: String as PropType<'single' | 'multi'>,
72
+ required: true
73
+ },
74
+ typeState: {
75
+ type: String as PropType<'day' | 'month'>,
76
+ required: true
77
+ },
78
+ sidebarDayOptions: {
79
+ type: Array as PropType<DayTypeOption[]>,
80
+ required: true
81
+ },
82
+ sidebarMonthOptions: {
83
+ type: Array as PropType<MonthTypeOption[]>,
84
+ required: true
85
+ },
86
+ currentSidebarOption: {
87
+ type: String,
88
+ required: true
89
+ },
90
+ dateInterval: {
91
+ type: Object as PropType<DateInterval | null>,
92
+ default: null
93
+ },
94
+ availableRange: {
95
+ type: Object as PropType<Partial<DateInterval> | null>,
96
+ default: null
97
+ },
98
+ isInputDisabled: {
99
+ type: Boolean,
100
+ default: false
101
+ },
102
+ normalizeCalendars: {
103
+ type: Boolean,
104
+ default: false
105
+ },
106
+ activeDateFrom: {
107
+ type: Object as PropType<CalendarDate | null>,
108
+ default: null
109
+ },
110
+ activeDateTo: {
111
+ type: Object as PropType<CalendarDate | null>,
112
+ default: null
113
+ },
114
+ showTime: {
115
+ type: Boolean,
116
+ default: false
117
+ },
118
+ cardContentStyles: {
119
+ type: Object as PropType<Record<string, any>>,
120
+ default: () => ({})
121
+ },
122
+ hideClearButton: {
123
+ type: Boolean,
124
+ default: false
125
+ }
126
+ },
127
+ emits: [
128
+ 'day-type-option-click',
129
+ 'month-type-option-click',
130
+ 'update-date-interval',
131
+ 'update-date-interval-with-auto-close',
132
+ 'update-from-to-date',
133
+ 'clear'
134
+ ],
135
+ methods: {
136
+ handleDayTypeOptionClick(option: DayTypeOption) {
137
+ this.$emit('day-type-option-click', option)
138
+ },
139
+ handleMonthTypeOptionClick(option: MonthTypeOption) {
140
+ this.$emit('month-type-option-click', option)
141
+ },
142
+ updateDateInterval(value: DateInterval | null) {
143
+ this.$emit('update-date-interval', value)
144
+ },
145
+ updateDateIntervalWithAutoClose(value: DateInterval) {
146
+ this.$emit('update-date-interval-with-auto-close', value)
147
+ },
148
+ updateFromToDate(value?: { from: CalendarDate; to: CalendarDate }) {
149
+ this.$emit('update-from-to-date', value)
150
+ },
151
+ handleClear() {
152
+ this.$emit('clear')
153
+ }
154
+ }
155
+ })
156
+ </script>
157
+
158
+ <style lang="scss" scoped>
159
+ .dl-date-time-range--card {
160
+ background-color: var(--dl-color-bg);
161
+ z-index: 1;
162
+ display: flex;
163
+ border-radius: 2px;
164
+ }
165
+
166
+ .dl-date-time-range--card_content {
167
+ width: var(--card-content-width);
168
+ }
169
+
170
+ .dl-date-time-range--button {
171
+ display: flex;
172
+ margin-left: auto;
173
+ width: fit-content;
174
+ margin-right: 16px;
175
+ margin-bottom: 16px;
176
+ }
177
+ </style>
@@ -1,104 +1,71 @@
1
1
  <template>
2
2
  <div :id="uuid" class="dl-date-time-range">
3
- <date-input
4
- :text="dateInputText"
5
- :input-style="dateInputStyle"
6
- :disabled="disabled"
7
- :width="width"
8
- >
9
- <dl-menu
10
- ref="dateTimeRangeMenu"
11
- anchor="bottom middle"
12
- self="top middle"
13
- :offset="[0, 5]"
3
+ <template v-if="isInputMode">
4
+ <date-input
5
+ :text="dateInputText"
6
+ :input-style="dateInputStyle"
14
7
  :disabled="disabled"
8
+ :width="width"
15
9
  >
16
- <div class="dl-date-time-range--card">
17
- <div
18
- v-if="mode === 'multi'"
19
- class="dl-date-time-range--card_sidebar"
20
- >
21
- <card-sidebar
22
- v-if="typeState === 'day'"
23
- :options="sidebarDayOptions"
24
- :current-option="currentSidebarOption"
25
- @click="handleDayTypeOptionClick"
26
- />
27
- <card-sidebar
28
- v-else
29
- :options="sidebarMonthOptions"
30
- :current-option="currentSidebarOption"
31
- @click="handleMonthTypeOptionClick"
32
- />
33
- </div>
34
- <div
35
- class="dl-date-time-range--card_content"
36
- :style="cardContentStyles"
37
- >
38
- <dl-date-picker
39
- :model-value="dateInterval"
40
- :type="typeState"
41
- :available-range="availableRange"
42
- :disabled="isInputDisabled"
43
- :normalize-calendars="normalizeCalendars"
44
- :active-date-from="activeDateFrom"
45
- :active-date-to="activeDateTo"
46
- @update:model-value="
47
- updateDateIntervalWithAutoClose
48
- "
49
- @update:from-to-date="updateFromToDate"
50
- />
51
- <dl-time-picker
52
- v-if="showTime && typeState === 'day'"
53
- :disabled="isInputDisabled"
54
- :model-value="dateInterval"
55
- @update:model-value="updateDateInterval"
56
- />
57
-
58
- <dl-button
59
- size="s"
60
- outlined
61
- class="dl-date-time-range--button"
62
- @click="handleClearAction"
63
- >
64
- <span style="text-transform: capitalize">
65
- Clear
66
- </span>
67
- </dl-button>
68
- </div>
69
- </div>
70
- </dl-menu>
71
- </date-input>
10
+ <dl-menu
11
+ ref="dateTimeRangeMenu"
12
+ anchor="bottom middle"
13
+ self="top middle"
14
+ :offset="[0, 5]"
15
+ :disabled="disabled"
16
+ >
17
+ <date-time-range-content
18
+ v-bind="dateTimeRangeContentProps"
19
+ @day-type-option-click="handleDayTypeOptionClick"
20
+ @month-type-option-click="handleMonthTypeOptionClick"
21
+ @update-date-interval="updateDateInterval"
22
+ @update-date-interval-with-auto-close="
23
+ updateDateIntervalWithAutoClose
24
+ "
25
+ @update-from-to-date="updateFromToDate"
26
+ @clear="handleClearAction"
27
+ />
28
+ </dl-menu>
29
+ </date-input>
30
+ </template>
31
+ <template v-else>
32
+ <date-time-range-content
33
+ v-bind="dateTimeRangeContentProps"
34
+ @day-type-option-click="handleDayTypeOptionClick"
35
+ @month-type-option-click="handleMonthTypeOptionClick"
36
+ @update-date-interval="updateDateInterval"
37
+ @update-date-interval-with-auto-close="
38
+ updateDateIntervalWithAutoClose
39
+ "
40
+ @update-from-to-date="updateFromToDate"
41
+ @clear="handleClearAction"
42
+ />
43
+ </template>
72
44
  </div>
73
45
  </template>
74
46
  <script lang="ts">
75
- import { DlTimePicker } from '../DlTimePicker'
76
47
  import { DateInterval } from '../types'
77
- import CardSidebar from './CardSidebar.vue'
78
48
  import {
79
49
  DayTypeOption,
80
50
  DAY_SIDEBAR_OPTION,
81
51
  MonthTypeOption,
82
- MONTH_SIDEBAR_OPTION
52
+ MONTH_SIDEBAR_OPTION,
53
+ DATETIME_RANGE_VIEW_MODE
83
54
  } from './types'
84
55
  import { CustomDate } from '../DlDatePicker/models/CustomDate'
85
- import DlDatePicker from '../DlDatePicker/DlDatePicker.vue'
86
56
  import { CalendarDate } from '../DlDatePicker/models/CalendarDate'
87
57
  import DateInput from './DateInput.vue'
58
+ import DateTimeRangeContent from './DateTimeRangeContent.vue'
88
59
  import { DlMenu } from '../../../essential'
89
- import { DlButton } from '../../../basic'
90
60
  import { defineComponent, PropType } from 'vue-demi'
91
61
  import { isInRange } from '../DlDatePicker/utils'
92
62
  import { v4 } from 'uuid'
93
63
 
94
64
  export default defineComponent({
95
65
  components: {
96
- CardSidebar,
97
- DlDatePicker,
98
- DlTimePicker,
99
66
  DateInput,
100
- DlMenu,
101
- DlButton
67
+ DateTimeRangeContent,
68
+ DlMenu
102
69
  },
103
70
  model: {
104
71
  prop: 'modelValue',
@@ -152,6 +119,14 @@ export default defineComponent({
152
119
  shouldClearSelectFirstOption: {
153
120
  type: Boolean,
154
121
  default: false
122
+ },
123
+ viewMode: {
124
+ type: String as PropType<DATETIME_RANGE_VIEW_MODE>,
125
+ default: DATETIME_RANGE_VIEW_MODE.input
126
+ },
127
+ hideClearButton: {
128
+ type: Boolean,
129
+ default: false
155
130
  }
156
131
  },
157
132
  emits: ['update:model-value', 'set-type', 'change'],
@@ -437,6 +412,27 @@ export default defineComponent({
437
412
  return {
438
413
  '--card-content-width': this.datePickerCardWidth
439
414
  }
415
+ },
416
+ isInputMode(): boolean {
417
+ return this.viewMode === DATETIME_RANGE_VIEW_MODE.input
418
+ },
419
+ dateTimeRangeContentProps(): Record<string, any> {
420
+ return {
421
+ mode: this.mode,
422
+ typeState: this.typeState,
423
+ sidebarDayOptions: this.sidebarDayOptions,
424
+ sidebarMonthOptions: this.sidebarMonthOptions,
425
+ currentSidebarOption: this.currentSidebarOption,
426
+ dateInterval: this.dateInterval,
427
+ availableRange: this.availableRange,
428
+ isInputDisabled: this.isInputDisabled,
429
+ normalizeCalendars: this.normalizeCalendars,
430
+ activeDateFrom: this.activeDateFrom,
431
+ activeDateTo: this.activeDateTo,
432
+ showTime: this.showTime,
433
+ cardContentStyles: this.cardContentStyles,
434
+ hideClearButton: this.hideClearButton
435
+ }
440
436
  }
441
437
  },
442
438
  watch: {
@@ -524,6 +520,14 @@ export default defineComponent({
524
520
  from: value.from,
525
521
  to: new Date(value.to)
526
522
  }
523
+ // When in multi mode, update sidebar option to custom if user manually selects date
524
+ if (this.mode === 'multi') {
525
+ this.currentSidebarOption =
526
+ this.typeState === 'day'
527
+ ? DAY_SIDEBAR_OPTION.custom
528
+ : MONTH_SIDEBAR_OPTION.custom
529
+ this.isInputDisabled = false
530
+ }
527
531
  }
528
532
  this.$emit('update:model-value', value)
529
533
  this.$emit('change', value)
@@ -535,13 +539,18 @@ export default defineComponent({
535
539
  updateDateIntervalWithAutoClose(value: DateInterval) {
536
540
  this.updateDateInterval(value)
537
541
 
538
- if (this.autoClose) {
542
+ if (
543
+ this.autoClose &&
544
+ this.viewMode === DATETIME_RANGE_VIEW_MODE.input
545
+ ) {
539
546
  const dateTimeRangeMenu = this.$refs[
540
547
  'dateTimeRangeMenu'
541
548
  ] as unknown as {
542
549
  hide: () => void
543
550
  }
544
- dateTimeRangeMenu.hide()
551
+ if (dateTimeRangeMenu) {
552
+ dateTimeRangeMenu.hide()
553
+ }
545
554
  }
546
555
  },
547
556
  handleDayTypeOptionClick(option: DayTypeOption) {
@@ -583,25 +592,5 @@ export default defineComponent({
583
592
  .dl-date-time-range {
584
593
  display: flex;
585
594
  justify-content: center;
586
-
587
- &--card {
588
- background-color: var(--dl-color-bg);
589
- z-index: 1;
590
- display: flex;
591
- border-radius: 2px;
592
- border-radius: 2px;
593
- }
594
-
595
- &--card_content {
596
- width: var(--card-content-width);
597
- }
598
-
599
- &--button {
600
- display: flex;
601
- margin-left: auto;
602
- width: fit-content;
603
- margin-right: 16px;
604
- margin-bottom: 16px;
605
- }
606
595
  }
607
596
  </style>
@@ -40,3 +40,8 @@ export type MonthTypeOption = {
40
40
  value?: DateInterval
41
41
  disabled?: boolean
42
42
  }
43
+
44
+ export enum DATETIME_RANGE_VIEW_MODE {
45
+ input = 'input',
46
+ inline = 'inline'
47
+ }
@@ -1470,6 +1470,9 @@ export default defineComponent({
1470
1470
  &--s {
1471
1471
  height: 18px;
1472
1472
  }
1473
+ &--m {
1474
+ height: 26px;
1475
+ }
1473
1476
  }
1474
1477
 
1475
1478
  &__input {
@@ -1518,6 +1521,7 @@ export default defineComponent({
1518
1521
  }
1519
1522
 
1520
1523
  &--m {
1524
+ height: 12px;
1521
1525
  line-height: 12px;
1522
1526
  padding-top: 7px;
1523
1527
  padding-bottom: 7px;
@@ -158,6 +158,18 @@ export default defineComponent({
158
158
  },
159
159
  onSearchButtonPress(): void {
160
160
  this.$emit('search', this.modelValue)
161
+ },
162
+ focus(): void {
163
+ const inputComponent = this.$refs.input as InstanceType<
164
+ typeof DlInput
165
+ >
166
+ inputComponent?.focus()
167
+ },
168
+ blur(): void {
169
+ const inputComponent = this.$refs.input as InstanceType<
170
+ typeof DlInput
171
+ >
172
+ inputComponent?.blur()
161
173
  }
162
174
  }
163
175
  })
@@ -53,7 +53,7 @@
53
53
  </div>
54
54
  </div>
55
55
  <dl-tooltip
56
- v-if="!focused"
56
+ v-if="!focused && !noTooltip"
57
57
  border="1px solid var(--dl-color-separator)"
58
58
  background-color="dl-color-panel-background"
59
59
  color="dl-color-darker"
@@ -248,6 +248,10 @@ export default defineComponent({
248
248
  type: String,
249
249
  default: '28px'
250
250
  },
251
+ noTooltip: {
252
+ type: Boolean,
253
+ default: false
254
+ },
251
255
  omitSuggestions: {
252
256
  type: Array as PropType<string[]>,
253
257
  default: () => [] as string[]
@@ -275,6 +279,7 @@ export default defineComponent({
275
279
  'blur',
276
280
  'input',
277
281
  'search',
282
+ 'status',
278
283
  'error',
279
284
  'clear'
280
285
  ],
@@ -297,6 +302,7 @@ export default defineComponent({
297
302
  defaultIcon,
298
303
  defaultIconColor,
299
304
  schema,
305
+ noTooltip,
300
306
  omitSuggestions,
301
307
  operatorsOverride,
302
308
  height,
@@ -1035,24 +1041,35 @@ export default defineComponent({
1035
1041
  return status.value
1036
1042
  }
1037
1043
 
1044
+ let newStatus: {
1045
+ type: string
1046
+ message: string
1047
+ }
1048
+
1038
1049
  if (!error.value && searchQuery.value !== '') {
1039
- return {
1050
+ newStatus = {
1040
1051
  type: 'success',
1041
1052
  message: ''
1042
1053
  }
1043
1054
  }
1044
1055
 
1045
- if (error.value === 'warning') {
1046
- return {
1056
+ else if (error.value === 'warning') {
1057
+ newStatus = {
1047
1058
  type: 'warning',
1048
1059
  message: 'The query is not supported technically.'
1049
1060
  }
1050
1061
  }
1051
1062
 
1052
- return {
1053
- type: 'error',
1054
- message: error.value
1063
+ else {
1064
+ newStatus = {
1065
+ type: 'error',
1066
+ message: error.value
1067
+ }
1055
1068
  }
1069
+
1070
+ emit('status', newStatus)
1071
+
1072
+ return newStatus
1056
1073
  })
1057
1074
 
1058
1075
  const inputPlaceholder = computed<string>(() => {
@@ -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
  })
@@ -156,7 +156,7 @@
156
156
  <div
157
157
  v-if="
158
158
  visibleColumns &&
159
- visibleColumns.length
159
+ visibleColumns.length
160
160
  "
161
161
  class="visible-columns-justify-end"
162
162
  style="width: 100%; display: flex"
@@ -269,8 +269,8 @@
269
269
  isRowSelected(getRowKey(props.item))
270
270
  ? 'selected'
271
271
  : hasAnyAction
272
- ? ' cursor-pointer'
273
- : ''
272
+ ? ' cursor-pointer'
273
+ : ''
274
274
  "
275
275
  :no-hover="noHover"
276
276
  @click="
@@ -555,7 +555,7 @@
555
555
  <div
556
556
  v-if="
557
557
  visibleColumns &&
558
- visibleColumns.length
558
+ visibleColumns.length
559
559
  "
560
560
  class="visible-columns-justify-end"
561
561
  style="width: 100%; display: flex"
@@ -666,8 +666,8 @@
666
666
  <dl-top-scroll
667
667
  v-if="
668
668
  tableScroll &&
669
- infiniteScroll &&
670
- !isDataEmpty
669
+ infiniteScroll &&
670
+ !isDataEmpty
671
671
  "
672
672
  :container-ref="tableScroll"
673
673
  @scroll-to-top="
@@ -701,8 +701,8 @@
701
701
  isRowSelected(getRowKey(row))
702
702
  ? 'selected'
703
703
  : hasAnyAction
704
- ? ' cursor-pointer'
705
- : ''
704
+ ? ' cursor-pointer'
705
+ : ''
706
706
  "
707
707
  :no-hover="noHover"
708
708
  @click="onTrClick($event, row, pageIndex)"
@@ -837,8 +837,8 @@
837
837
  <dl-bottom-scroll
838
838
  v-if="
839
839
  tableScroll &&
840
- infiniteScroll &&
841
- !isDataEmpty
840
+ infiniteScroll &&
841
+ !isDataEmpty
842
842
  "
843
843
  :container-ref="tableScroll"
844
844
  @scroll-to-bottom="
@@ -895,7 +895,7 @@
895
895
  <div
896
896
  v-if="
897
897
  hasBottomSelectionBanner &&
898
- selectedRowsLabel(rowsSelectedNumber)
898
+ selectedRowsLabel(rowsSelectedNumber)
899
899
  "
900
900
  class="dl-table__control"
901
901
  >
@@ -804,7 +804,9 @@ export default defineComponent({
804
804
  targetRow: finalTarget
805
805
  })
806
806
 
807
- const isDragValid = shouldSkipValidation || checkParentCondition(draggedRow.value, finalTarget)
807
+ const isDragValid =
808
+ shouldSkipValidation ||
809
+ checkParentCondition(draggedRow.value, finalTarget)
808
810
  if (isDragValid) {
809
811
  const smartSortingMovement = {
810
812
  ...sortingMovement.value,
@@ -929,7 +931,7 @@ export default defineComponent({
929
931
  }
930
932
 
931
933
  const isValid = checkParentCondition(draggedRow.value, targetRow)
932
-
934
+
933
935
  if (isValid) {
934
936
  storedValidTarget.value = targetRow
935
937
  }
@@ -16,7 +16,7 @@
16
16
  }`"
17
17
  >
18
18
  <dl-icon
19
- v-if="hasDraggableRows && !row.disableDraggable"
19
+ v-if="hasDraggableRows && !row.disableDraggable"
20
20
  class="draggable-icon"
21
21
  icon="icon-dl-drag"
22
22
  size="12px"
@@ -7,12 +7,14 @@
7
7
  }`"
8
8
  >
9
9
  <label
10
- v-if="!!leftLabel"
10
+ v-if="hasLeftLabel"
11
11
  class="left dl-switch-label"
12
12
  :for="computedId"
13
13
  :style="cssLabelVars"
14
14
  >
15
- {{ leftLabel }}
15
+ <slot name="left-label">
16
+ {{ leftLabel }}
17
+ </slot>
16
18
  </label>
17
19
  <span
18
20
  class="dl-switch-container"
@@ -35,12 +37,14 @@
35
37
  />
36
38
  </span>
37
39
  <label
38
- v-if="!!rightLabel"
40
+ v-if="hasRightLabel"
39
41
  class="right dl-switch-label"
40
42
  :for="computedId"
41
43
  :style="cssLabelVars"
42
44
  >
43
- {{ rightLabel }}
45
+ <slot name="right-label">
46
+ {{ rightLabel }}
47
+ </slot>
44
48
  </label>
45
49
  </div>
46
50
  </template>
@@ -143,6 +147,12 @@ export default defineComponent({
143
147
  ? this.index === -1
144
148
  : toRaw(this.modelValue) === toRaw(this.falseValue)
145
149
  },
150
+ hasLeftLabel(): boolean {
151
+ return !!this.leftLabel || !!this.$slots['left-label']
152
+ },
153
+ hasRightLabel(): boolean {
154
+ return !!this.rightLabel || !!this.$slots['right-label']
155
+ },
146
156
  cssVars(): Record<string, string> {
147
157
  return {
148
158
  '--dl-checkbox-height': `${this.size}px`,
@@ -176,6 +176,26 @@
176
176
  @change="handleModelValueUpdate"
177
177
  />
178
178
  </div>
179
+ <div style="width: 500px; margin-top: 30px">
180
+ <div style="margin-bottom: 10px; font-weight: bold">
181
+ Inline Mode
182
+ </div>
183
+ <dl-date-time-range
184
+ v-model="date"
185
+ :type="type"
186
+ width="100%"
187
+ :available-range="range ? availableRange : null"
188
+ :mode="mode"
189
+ :show-time="showTime"
190
+ :auto-close="autoClose"
191
+ :including-current-month="includesCurrentMonthEnd"
192
+ :should-clear-select-first-option="shouldClearSelectFirstOption"
193
+ :disabled-type="type === 'day' ? 'month' : 'day'"
194
+ view-mode="inline"
195
+ @set-type="handleSetType"
196
+ @change="handleModelValueUpdate"
197
+ />
198
+ </div>
179
199
  </div>
180
200
  </template>
181
201
  <script lang="ts">
@@ -42,6 +42,7 @@
42
42
 
43
43
  <dl-smart-search-input
44
44
  v-model="queryObject"
45
+ no-tooltip
45
46
  :aliases="aliases"
46
47
  :schema="schema"
47
48
  :color-schema="colorSchema"