@dataloop-ai/components 0.20.178-ds-v3.2 → 0.20.179

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.178-ds-v3.2",
3
+ "version": "0.20.179",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -1,42 +1,76 @@
1
1
  <template>
2
- <div
3
- v-if="show"
4
- :id="uuid"
5
- ref="rootRef"
6
- class="root"
7
- :style="rootStyle"
8
- data-test="root"
9
- >
10
- <div>
11
- <dl-icon
12
- data-test="icon"
13
- :style="iconStyle"
14
- :icon="icon"
15
- :color="iconColor"
16
- :size="iconSize"
17
- />
18
- <span class="text" :style="textStyle">
19
- <slot v-if="!text" />
20
- <span v-else>
21
- {{ text }}
22
- </span>
23
- </span>
24
- </div>
2
+ <div>
25
3
  <div
26
- v-if="closable"
27
- class="close-button"
28
- data-test="close-button"
29
- :style="closeButtonStyle"
4
+ v-if="show"
5
+ :id="uuid"
6
+ ref="rootRef"
7
+ class="root"
8
+ :style="rootStyle"
9
+ data-test="root"
30
10
  >
31
- <dl-icon
32
- class="close-button-icon"
33
- data-test="close-button-icon"
34
- icon="icon-dl-close"
35
- color="dl-color-darker"
36
- size="16px"
37
- @click="handleClose"
38
- />
11
+ <div>
12
+ <dl-icon
13
+ data-test="icon"
14
+ :style="iconStyle"
15
+ :icon="icon"
16
+ :color="iconColor"
17
+ :size="iconSize"
18
+ />
19
+ <span class="text" :style="textStyle">
20
+ <slot v-if="!text" />
21
+ <span v-else>
22
+ {{ text }}
23
+ </span>
24
+ </span>
25
+ </div>
26
+ <div
27
+ v-if="closable"
28
+ class="close-button"
29
+ data-test="close-button"
30
+ :style="closeButtonStyle"
31
+ >
32
+ <dl-icon
33
+ class="close-button-icon"
34
+ data-test="close-button-icon"
35
+ icon="icon-dl-close"
36
+ color="dl-color-darker"
37
+ size="16px"
38
+ @click="handleClose"
39
+ />
40
+ </div>
39
41
  </div>
42
+ <dl-dialog-box
43
+ v-model="showConfirmDialog"
44
+ :width="400"
45
+ data-test="confirm-dialog"
46
+ >
47
+ <template #header>
48
+ <dl-dialog-box-header
49
+ :title="props.confirmCloseHeader"
50
+ @onClose="handleCancelDismiss"
51
+ />
52
+ </template>
53
+ <template #body>
54
+ <p class="confirm-message">
55
+ {{ props.confirmCloseMessage }}
56
+ </p>
57
+ </template>
58
+ <template #footer>
59
+ <dl-dialog-box-footer>
60
+ <dl-button
61
+ outlined
62
+ label="Cancel"
63
+ data-test="cancel-button"
64
+ @click="handleCancelDismiss"
65
+ />
66
+ <dl-button
67
+ label="Dismiss"
68
+ data-test="dismiss-button"
69
+ @click="handleConfirmDismiss"
70
+ />
71
+ </dl-dialog-box-footer>
72
+ </template>
73
+ </dl-dialog-box>
40
74
  </div>
41
75
  </template>
42
76
 
@@ -54,6 +88,12 @@ import {
54
88
  } from 'vue-demi'
55
89
  import { getColor, includes } from '../../../utils'
56
90
  import { DlIcon } from '../../essential'
91
+ import { DlButton } from '../DlButton'
92
+ import {
93
+ DlDialogBox,
94
+ DlDialogBoxHeader,
95
+ DlDialogBoxFooter
96
+ } from '../../compound/DlDialogBox'
57
97
  import { DlAlertType } from './types'
58
98
 
59
99
  const typeToIconMap: Record<DlAlertType, string> = {
@@ -80,7 +120,11 @@ const typeToBackgroundMap: Record<DlAlertType, string> = {
80
120
  export default defineComponent({
81
121
  name: 'DlAlert',
82
122
  components: {
83
- DlIcon
123
+ DlIcon,
124
+ DlButton,
125
+ DlDialogBox,
126
+ DlDialogBoxHeader,
127
+ DlDialogBoxFooter
84
128
  },
85
129
  model: {
86
130
  prop: 'modelValue',
@@ -120,9 +164,21 @@ export default defineComponent({
120
164
  padding: {
121
165
  type: String,
122
166
  default: null
167
+ },
168
+ confirmClose: {
169
+ type: Boolean,
170
+ default: false
171
+ },
172
+ confirmCloseHeader: {
173
+ type: String,
174
+ default: 'Are you sure?'
175
+ },
176
+ confirmCloseMessage: {
177
+ type: String,
178
+ default: ''
123
179
  }
124
180
  },
125
- emits: ['update:model-value'],
181
+ emits: ['update:model-value', 'dismiss'],
126
182
  setup(props, { emit }) {
127
183
  const { padding, modelValue, type } = toRefs(props)
128
184
  const show = ref(modelValue.value)
@@ -138,6 +194,7 @@ export default defineComponent({
138
194
  const rootStyle = ref()
139
195
  const iconStyle = ref()
140
196
  const closeButtonStyle = ref()
197
+ const showConfirmDialog = ref(false)
141
198
 
142
199
  onMounted(() => {
143
200
  normalizeStyles(props.fluid)
@@ -166,9 +223,12 @@ export default defineComponent({
166
223
 
167
224
  function normalizeStyles(fluid?: boolean) {
168
225
  nextTick(() => {
169
- const { height } = (
170
- rootRef as Ref<HTMLElement | null>
171
- ).value!.getBoundingClientRect()
226
+ const rootElement = (rootRef as Ref<HTMLElement | null>).value
227
+ if (!rootElement) {
228
+ return
229
+ }
230
+
231
+ const { height } = rootElement.getBoundingClientRect()
172
232
  const iconS: Record<string, any> = {
173
233
  display: 'flex'
174
234
  }
@@ -199,10 +259,28 @@ export default defineComponent({
199
259
  }
200
260
 
201
261
  function handleClose() {
262
+ if (props.confirmClose) {
263
+ showConfirmDialog.value = true
264
+ } else {
265
+ closeAlert()
266
+ }
267
+ }
268
+
269
+ function closeAlert() {
202
270
  show.value = false
203
271
  emit('update:model-value', false)
204
272
  }
205
273
 
274
+ function handleConfirmDismiss() {
275
+ showConfirmDialog.value = false
276
+ closeAlert()
277
+ emit('dismiss')
278
+ }
279
+
280
+ function handleCancelDismiss() {
281
+ showConfirmDialog.value = false
282
+ }
283
+
206
284
  return {
207
285
  uuid: `dl-alert-${v4()}`,
208
286
  rootRef,
@@ -213,7 +291,11 @@ export default defineComponent({
213
291
  iconStyle,
214
292
  closeButtonStyle,
215
293
  textStyle,
216
- handleClose
294
+ showConfirmDialog,
295
+ props,
296
+ handleClose,
297
+ handleConfirmDismiss,
298
+ handleCancelDismiss
217
299
  }
218
300
  },
219
301
  template: 'dl-alert'
@@ -257,4 +339,11 @@ export default defineComponent({
257
339
  cursor: pointer;
258
340
  }
259
341
  }
342
+
343
+ .confirm-message {
344
+ margin: 0;
345
+ color: var(--dl-color-darker);
346
+ font-size: var(--dl-font-size-body);
347
+ line-height: 1.5;
348
+ }
260
349
  </style>
@@ -1,71 +1,104 @@
1
1
  <template>
2
2
  <div :id="uuid" class="dl-date-time-range">
3
- <template v-if="isInputMode">
4
- <date-input
5
- :text="dateInputText"
6
- :input-style="dateInputStyle"
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]"
7
14
  :disabled="disabled"
8
- :width="width"
9
15
  >
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>
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>
44
72
  </div>
45
73
  </template>
46
74
  <script lang="ts">
75
+ import { DlTimePicker } from '../DlTimePicker'
47
76
  import { DateInterval } from '../types'
77
+ import CardSidebar from './CardSidebar.vue'
48
78
  import {
49
79
  DayTypeOption,
50
80
  DAY_SIDEBAR_OPTION,
51
81
  MonthTypeOption,
52
- MONTH_SIDEBAR_OPTION,
53
- DATETIME_RANGE_VIEW_MODE
82
+ MONTH_SIDEBAR_OPTION
54
83
  } from './types'
55
84
  import { CustomDate } from '../DlDatePicker/models/CustomDate'
85
+ import DlDatePicker from '../DlDatePicker/DlDatePicker.vue'
56
86
  import { CalendarDate } from '../DlDatePicker/models/CalendarDate'
57
87
  import DateInput from './DateInput.vue'
58
- import DateTimeRangeContent from './DateTimeRangeContent.vue'
59
88
  import { DlMenu } from '../../../essential'
89
+ import { DlButton } from '../../../basic'
60
90
  import { defineComponent, PropType } from 'vue-demi'
61
91
  import { isInRange } from '../DlDatePicker/utils'
62
92
  import { v4 } from 'uuid'
63
93
 
64
94
  export default defineComponent({
65
95
  components: {
96
+ CardSidebar,
97
+ DlDatePicker,
98
+ DlTimePicker,
66
99
  DateInput,
67
- DateTimeRangeContent,
68
- DlMenu
100
+ DlMenu,
101
+ DlButton
69
102
  },
70
103
  model: {
71
104
  prop: 'modelValue',
@@ -119,14 +152,6 @@ export default defineComponent({
119
152
  shouldClearSelectFirstOption: {
120
153
  type: Boolean,
121
154
  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
130
155
  }
131
156
  },
132
157
  emits: ['update:model-value', 'set-type', 'change'],
@@ -412,27 +437,6 @@ export default defineComponent({
412
437
  return {
413
438
  '--card-content-width': this.datePickerCardWidth
414
439
  }
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
- }
436
440
  }
437
441
  },
438
442
  watch: {
@@ -520,14 +524,6 @@ export default defineComponent({
520
524
  from: value.from,
521
525
  to: new Date(value.to)
522
526
  }
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
- }
531
527
  }
532
528
  this.$emit('update:model-value', value)
533
529
  this.$emit('change', value)
@@ -539,18 +535,13 @@ export default defineComponent({
539
535
  updateDateIntervalWithAutoClose(value: DateInterval) {
540
536
  this.updateDateInterval(value)
541
537
 
542
- if (
543
- this.autoClose &&
544
- this.viewMode === DATETIME_RANGE_VIEW_MODE.input
545
- ) {
538
+ if (this.autoClose) {
546
539
  const dateTimeRangeMenu = this.$refs[
547
540
  'dateTimeRangeMenu'
548
541
  ] as unknown as {
549
542
  hide: () => void
550
543
  }
551
- if (dateTimeRangeMenu) {
552
- dateTimeRangeMenu.hide()
553
- }
544
+ dateTimeRangeMenu.hide()
554
545
  }
555
546
  },
556
547
  handleDayTypeOptionClick(option: DayTypeOption) {
@@ -592,5 +583,25 @@ export default defineComponent({
592
583
  .dl-date-time-range {
593
584
  display: flex;
594
585
  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
+ }
595
606
  }
596
607
  </style>
@@ -40,8 +40,3 @@ 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,9 +1470,6 @@ export default defineComponent({
1470
1470
  &--s {
1471
1471
  height: 18px;
1472
1472
  }
1473
- &--m {
1474
- height: 26px;
1475
- }
1476
1473
  }
1477
1474
 
1478
1475
  &__input {
@@ -1521,7 +1518,6 @@ export default defineComponent({
1521
1518
  }
1522
1519
 
1523
1520
  &--m {
1524
- height: 12px;
1525
1521
  line-height: 12px;
1526
1522
  padding-top: 7px;
1527
1523
  padding-bottom: 7px;
@@ -158,18 +158,6 @@ 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()
173
161
  }
174
162
  }
175
163
  })
@@ -53,7 +53,7 @@
53
53
  </div>
54
54
  </div>
55
55
  <dl-tooltip
56
- v-if="!focused && !noTooltip"
56
+ v-if="!focused"
57
57
  border="1px solid var(--dl-color-separator)"
58
58
  background-color="dl-color-panel-background"
59
59
  color="dl-color-darker"
@@ -248,10 +248,6 @@ export default defineComponent({
248
248
  type: String,
249
249
  default: '28px'
250
250
  },
251
- noTooltip: {
252
- type: Boolean,
253
- default: false
254
- },
255
251
  omitSuggestions: {
256
252
  type: Array as PropType<string[]>,
257
253
  default: () => [] as string[]
@@ -279,7 +275,6 @@ export default defineComponent({
279
275
  'blur',
280
276
  'input',
281
277
  'search',
282
- 'status',
283
278
  'error',
284
279
  'clear'
285
280
  ],
@@ -302,7 +297,6 @@ export default defineComponent({
302
297
  defaultIcon,
303
298
  defaultIconColor,
304
299
  schema,
305
- noTooltip,
306
300
  omitSuggestions,
307
301
  operatorsOverride,
308
302
  height,
@@ -1041,35 +1035,24 @@ export default defineComponent({
1041
1035
  return status.value
1042
1036
  }
1043
1037
 
1044
- let newStatus: {
1045
- type: string
1046
- message: string
1047
- }
1048
-
1049
1038
  if (!error.value && searchQuery.value !== '') {
1050
- newStatus = {
1039
+ return {
1051
1040
  type: 'success',
1052
1041
  message: ''
1053
1042
  }
1054
1043
  }
1055
1044
 
1056
- else if (error.value === 'warning') {
1057
- newStatus = {
1045
+ if (error.value === 'warning') {
1046
+ return {
1058
1047
  type: 'warning',
1059
1048
  message: 'The query is not supported technically.'
1060
1049
  }
1061
1050
  }
1062
1051
 
1063
- else {
1064
- newStatus = {
1065
- type: 'error',
1066
- message: error.value
1067
- }
1052
+ return {
1053
+ type: 'error',
1054
+ message: error.value
1068
1055
  }
1069
-
1070
- emit('status', newStatus)
1071
-
1072
- return newStatus
1073
1056
  })
1074
1057
 
1075
1058
  const inputPlaceholder = computed<string>(() => {