@dataloop-ai/components 0.14.3 → 0.14.4

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.14.3",
3
+ "version": "0.14.4",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@dataloop-ai/icons": "^2.0.13",
25
25
  "@types/lodash": "^4.14.184",
26
- "chart.js": "^4.2.1",
26
+ "chart.js": "^3.9.1",
27
27
  "lodash": "^4.17.21",
28
28
  "moment": "^2.29.4",
29
29
  "sass": "^1.51.0",
@@ -271,8 +271,8 @@ export default defineComponent({
271
271
  &__counter {
272
272
  display: flex;
273
273
  width: 100%;
274
- text-align: end;
275
- justify-content: end;
274
+ text-align: flex-end;
275
+ justify-content: flex-end;
276
276
  color: var(--dl-color-darker);
277
277
  }
278
278
  }
@@ -188,6 +188,14 @@ export default defineComponent({
188
188
  height: 100vh !important;
189
189
  border-radius: 0px;
190
190
  }
191
+ &--right {
192
+ position: absolute !important;
193
+ right: 0;
194
+ }
195
+ &--left {
196
+ position: absolute !important;
197
+ left: 0;
198
+ }
191
199
  }
192
200
 
193
201
  .header {
@@ -10,11 +10,21 @@
10
10
  style="padding: 0; margin-bottom: 10px"
11
11
  @click.stop.prevent="$emit('onClose')"
12
12
  />
13
- <h2 class="title">
14
- {{ title }}
13
+ <h2
14
+ v-if="hasTitle"
15
+ class="title"
16
+ >
17
+ <slot name="title">
18
+ {{ title }}
19
+ </slot>
15
20
  </h2>
16
- <p class="subtitle">
17
- {{ subtitle }}
21
+ <p
22
+ v-if="hasSubtitle"
23
+ class="subtitle"
24
+ >
25
+ <slot name="subtitle">
26
+ {{ subtitle }}
27
+ </slot>
18
28
  </p>
19
29
  </div>
20
30
  <dl-button
@@ -30,7 +40,7 @@
30
40
  </template>
31
41
 
32
42
  <script lang="ts">
33
- import { defineComponent } from 'vue-demi'
43
+ import { computed, defineComponent } from 'vue-demi'
34
44
  import { DlButton } from '../DlButton'
35
45
 
36
46
  export default defineComponent({
@@ -44,7 +54,12 @@ export default defineComponent({
44
54
  closeButton: { type: Boolean, default: true },
45
55
  hasBackButton: Boolean
46
56
  },
47
- emits: ['onClose']
57
+ emits: ['onClose'],
58
+ setup(props, { slots }) {
59
+ const hasTitle = computed(() => !!props.title || !!slots.title)
60
+ const hasSubtitle = computed(() => !!props.subtitle || !!slots.subtitle)
61
+ return { hasTitle, hasSubtitle }
62
+ }
48
63
  })
49
64
  </script>
50
65
 
@@ -60,6 +75,7 @@ export default defineComponent({
60
75
  font-size: var(--dl-font-size-h2);
61
76
  margin: 0;
62
77
  color: var(--dl-color-darker);
78
+ line-height: 2rem !important;
63
79
  }
64
80
 
65
81
  .subtitle {
@@ -78,7 +78,8 @@
78
78
  :class="contentClass"
79
79
  :style="contentStyle"
80
80
  :cover="cover"
81
- fit
81
+ fit-container
82
+ :fit-content="fitContent"
82
83
  :persistent="persistent"
83
84
  :auto-close="autoClose"
84
85
  :anchor="menuAnchor"
@@ -142,7 +143,8 @@
142
143
  :class="contentClass"
143
144
  :style="contentStyle"
144
145
  :cover="cover"
145
- fit
146
+ fit-container
147
+ :fit-content="fitContent"
146
148
  :persistent="persistent"
147
149
  :auto-close="autoClose"
148
150
  :anchor="menuAnchor"
@@ -227,7 +229,8 @@ export default defineComponent({
227
229
  flat: Boolean,
228
230
  uppercase: Boolean,
229
231
  outlined: Boolean,
230
- padding: { type: String, default: '5px' }
232
+ padding: { type: String, default: '5px' },
233
+ fitContent: Boolean
231
234
  },
232
235
  emits: [
233
236
  'update:model-value',
@@ -349,19 +352,6 @@ export default defineComponent({
349
352
  }
350
353
  }
351
354
 
352
- // expose public methods
353
- Object.assign(proxy, {
354
- show,
355
- hide,
356
- toggle,
357
- onClickHide,
358
- onClick,
359
- onBeforeShow,
360
- onShow,
361
- onBeforeHide,
362
- onHide
363
- })
364
-
365
355
  onMounted(() => {
366
356
  if (props.modelValue) {
367
357
  show()
@@ -98,7 +98,8 @@ export default defineComponent({
98
98
 
99
99
  noRefocus: Boolean,
100
100
 
101
- fit: Boolean,
101
+ fitContainer: Boolean,
102
+ fitContent: Boolean,
102
103
  cover: Boolean,
103
104
 
104
105
  square: Boolean,
@@ -358,7 +359,8 @@ export default defineComponent({
358
359
  anchorOrigin: anchorOrigin.value,
359
360
  selfOrigin: selfOrigin.value,
360
361
  absoluteOffset,
361
- fit: props.fit,
362
+ fitContainer: props.fitContainer,
363
+ fitContent: props.fitContent,
362
364
  cover: props.cover,
363
365
  maxHeight: props.maxHeight,
364
366
  maxWidth: props.maxWidth
@@ -12,7 +12,6 @@
12
12
  size="s"
13
13
  :options="options"
14
14
  :disabled="disabled"
15
- :fit="false"
16
15
  width="min-content"
17
16
  align-right
18
17
  disable-dropdown-icon-padding
@@ -55,7 +54,7 @@ export default defineComponent({
55
54
  },
56
55
  emits: ['update:modelValue'],
57
56
  computed: {
58
- hasSingeValue() {
57
+ hasSingeValue(): boolean {
59
58
  return this.options.length <= 1
60
59
  }
61
60
  },
@@ -384,7 +384,6 @@ export default defineComponent({
384
384
  anchorOrigin: anchorOrigin.value,
385
385
  selfOrigin: selfOrigin.value,
386
386
  absoluteOffset,
387
- fit: false,
388
387
  cover: false,
389
388
  maxHeight: props.maxHeight,
390
389
  maxWidth: props.maxWidth
@@ -76,6 +76,7 @@
76
76
  class="select-search-input"
77
77
  :style="!isExpanded ? 'display: none;' : 'width: 100%;'"
78
78
  :disabled="disabled"
79
+ :readonly="readonly"
79
80
  @input="handleSearchInput"
80
81
  @focus="handleSearchFocus"
81
82
  @blur="handleSearchBlur"
@@ -134,12 +135,13 @@
134
135
  <dl-menu
135
136
  ref="menu"
136
137
  v-model="isExpanded"
137
- :fit="fit"
138
+ fit-container
139
+ :fit-content="fitContent"
138
140
  square
139
141
  no-focus
140
142
  :offset="[0, 3]"
141
143
  style="border-radius: 0"
142
- :disabled="disabled"
144
+ :disabled="disabled || readonly"
143
145
  @show="onMenuOpen"
144
146
  @hide="closeMenu"
145
147
  >
@@ -297,7 +299,7 @@ export default defineComponent({
297
299
  search: { type: Boolean, default: false },
298
300
  required: { type: Boolean, default: false },
299
301
  optional: { type: Boolean, default: false },
300
- fit: { type: Boolean, default: true },
302
+ fitContent: Boolean,
301
303
  tooltip: { type: String, default: '' },
302
304
  highlightSelected: { type: Boolean, default: false },
303
305
  type: { type: String, default: 'text' },
@@ -309,6 +311,7 @@ export default defineComponent({
309
311
  errorMessage: { type: String, default: '' },
310
312
  error: { type: Boolean, default: false },
311
313
  disabled: { type: Boolean, default: false },
314
+ readonly: { type: Boolean, default: false },
312
315
  emitValue: { type: Boolean, default: false }, // We emit the value from the option and compare with it as a modelvalue
313
316
  options: {
314
317
  type: Array as PropType<SelectOptionType[]>,
@@ -497,6 +500,9 @@ export default defineComponent({
497
500
  if (this.disabled) {
498
501
  classes.push('dl_select__select--disabled')
499
502
  }
503
+ if (this.readonly) {
504
+ classes.push('dl_select__select--readonly')
505
+ }
500
506
  if (this.isExpanded) {
501
507
  classes.push('dl_select__select--focused')
502
508
  }
@@ -718,6 +724,7 @@ export default defineComponent({
718
724
  if (!this.preserveSearch) {
719
725
  const inputRef = this.$refs.searchInput as HTMLInputElement
720
726
  if (inputRef) inputRef.value = ''
727
+ this.$emit('filter', '')
721
728
  }
722
729
  },
723
730
  getLabel,
@@ -901,6 +908,18 @@ export default defineComponent({
901
908
  pointer-events: none;
902
909
  }
903
910
  }
911
+
912
+ &--readonly {
913
+ border-color: var(--dl-color-separator);
914
+ cursor: text;
915
+
916
+ &:hover {
917
+ border-color: var(--dl-color-separator);
918
+ }
919
+ & input {
920
+ pointer-events: none;
921
+ }
922
+ }
904
923
  }
905
924
 
906
925
  .selected {
@@ -7,7 +7,7 @@
7
7
  :target="defaultTarget"
8
8
  :offset="offset"
9
9
  :disabled="disabled"
10
- fit
10
+ fit-container
11
11
  :model-value="modelValue"
12
12
  @update:modelValue="$emit('update:modelValue', $event)"
13
13
  >
@@ -51,6 +51,7 @@
51
51
  :maxlength="maxLength"
52
52
  :type="showPass ? 'text' : type"
53
53
  :disabled="disabled"
54
+ :readonly="readonly"
54
55
  @input="onChange"
55
56
  @focus="onFocus"
56
57
  @blur="debouncedBlur()"
@@ -102,13 +103,23 @@
102
103
  </dl-tooltip>
103
104
  </span>
104
105
  </div>
106
+ <div
107
+ v-show="hasAction"
108
+ :class="[
109
+ ...adornmentClasses,
110
+ 'dl-text-input__adornment-container--pos-right-out'
111
+ ]"
112
+ >
113
+ <slot name="action" />
114
+ </div>
105
115
  <dl-menu
106
116
  v-if="showSuggestItems"
107
117
  v-model="isMenuOpen"
108
118
  auto-close
109
119
  no-focus
110
120
  :offset="[0, 3]"
111
- fit
121
+ fit-container
122
+ :fit-content="fitContent"
112
123
  @click="onMenuShow"
113
124
  >
114
125
  <dl-list
@@ -274,6 +285,10 @@ export default defineComponent({
274
285
  type: Boolean,
275
286
  default: false
276
287
  },
288
+ readonly: {
289
+ type: Boolean,
290
+ default: false
291
+ },
277
292
  maxLength: {
278
293
  type: Number,
279
294
  default: null
@@ -309,7 +324,8 @@ export default defineComponent({
309
324
  clearButtonTooltip: {
310
325
  type: Boolean,
311
326
  default: false
312
- }
327
+ },
328
+ fitContent: Boolean
313
329
  },
314
330
  emits: ['input', 'focus', 'blur', 'clear', 'enter', 'update:model-value'],
315
331
  data() {
@@ -323,9 +339,9 @@ export default defineComponent({
323
339
  computed: {
324
340
  bottomMessage(): boolean {
325
341
  return (
326
- !!this.infoMessage.length ||
327
- !!this.errorMessage.length ||
328
- !!this.warningMessage.length ||
342
+ !!this.infoMessage?.length ||
343
+ !!this.errorMessage?.length ||
344
+ !!this.warningMessage?.length ||
329
345
  this.showCounter
330
346
  )
331
347
  },
@@ -391,6 +407,9 @@ export default defineComponent({
391
407
  !this.isSmall
392
408
  )
393
409
  },
410
+ hasAction(): boolean {
411
+ return !!this.$slots.action && !this.isSmall
412
+ },
394
413
  passShowIcon(): string {
395
414
  return this.showPass ? 'icon-dl-hide' : 'icon-dl-show'
396
415
  },
@@ -400,6 +419,7 @@ export default defineComponent({
400
419
  !this.disableClearBtn &&
401
420
  this.type !== 'password' &&
402
421
  !this.disabled &&
422
+ !this.readonly &&
403
423
  !!this.modelValue
404
424
  // this.focused
405
425
  )
@@ -443,10 +463,18 @@ export default defineComponent({
443
463
  this.$emit('input', e.target.value, e)
444
464
  this.$emit('update:model-value', e.target.value)
445
465
  },
466
+ focus(): void {
467
+ const inputRef = this.$refs.input as HTMLInputElement
468
+ inputRef.focus()
469
+ },
446
470
  onFocus(e: InputEvent): void {
447
471
  this.focused = true
448
472
  this.$emit('focus', e)
449
473
  },
474
+ blur(): void {
475
+ const inputRef = this.$refs.input as HTMLInputElement
476
+ inputRef.blur()
477
+ },
450
478
  onBlur(e: InputEvent): void {
451
479
  this.focused = false
452
480
  this.$emit('blur', e)
@@ -473,8 +501,7 @@ export default defineComponent({
473
501
  inputRef.value = item
474
502
  },
475
503
  onMenuShow(): void {
476
- const inputRef = this.$refs.input as HTMLInputElement
477
- inputRef.focus()
504
+ this.focus()
478
505
  },
479
506
  getSuggestWords(
480
507
  item: string,
@@ -697,6 +724,13 @@ export default defineComponent({
697
724
  color: var(--dl-color-disabled);
698
725
  cursor: not-allowed;
699
726
  }
727
+ &:readonly {
728
+ border-color: var(--dl-color-separator);
729
+ cursor: text;
730
+ &:hover {
731
+ border-color: var(--dl-color-separator) !important;
732
+ }
733
+ }
700
734
  }
701
735
 
702
736
  &__adornment-container {
@@ -725,7 +759,11 @@ export default defineComponent({
725
759
 
726
760
  &--pos-right {
727
761
  top: 0;
728
- right: 0px;
762
+ right: 0;
763
+ }
764
+ &--pos-right-out {
765
+ top: 0;
766
+ right: -30px;
729
767
  }
730
768
  }
731
769
 
@@ -75,7 +75,7 @@ export default defineComponent({
75
75
  default: true
76
76
  }
77
77
  },
78
- setup(props) {
78
+ setup(props: any) {
79
79
  const { position, duration, message } = props
80
80
  const root = ref(null)
81
81
  let parentTop: HTMLElement = null
@@ -1,8 +1,10 @@
1
- import * as VueDemi from 'vue-demi'
1
+ import * as VueDemiModule from 'vue-demi'
2
2
  import ToastComponent from '../components/ToastComponent.vue'
3
3
 
4
4
  let createComponent: Function
5
5
 
6
+ const VueDemi: any = VueDemiModule
7
+
6
8
  if (VueDemi.isVue3) {
7
9
  createComponent = function (
8
10
  component: object,
@@ -184,7 +184,7 @@ export default defineComponent({
184
184
  },
185
185
  methods: {
186
186
  removeChip() {
187
- (this.$refs.removableChip as typeof DlChip).remove()
187
+ (this.$refs.removableChip as any).remove()
188
188
  }
189
189
  }
190
190
  })
@@ -204,7 +204,7 @@
204
204
  @click="() => onClose('Videos and long text')"
205
205
  >
206
206
  <dl-item-section>
207
- Videos and long text
207
+ Videos and long text Videos and long text
208
208
  </dl-item-section>
209
209
  </dl-list-item>
210
210
 
@@ -389,7 +389,7 @@
389
389
  <h4>Sizing and styling</h4>
390
390
  <div>
391
391
  <dl-button label="Fit Menu">
392
- <dl-menu fit>
392
+ <dl-menu fit-container>
393
393
  <dl-list>
394
394
  <dl-list-item clickable>
395
395
  <dl-item-section>New tab</dl-item-section>
@@ -35,7 +35,7 @@
35
35
  >
36
36
  <dl-menu
37
37
  ref="menu"
38
- fit
38
+ fit-container
39
39
  >
40
40
  <dl-option-group
41
41
  v-model="switchValue"
@@ -167,7 +167,7 @@
167
167
  multiselect
168
168
  search
169
169
  capitalized-options
170
- fit
170
+ fit-container
171
171
  />
172
172
  With Label and sub label
173
173
  <dl-select
@@ -126,7 +126,8 @@ interface PositionConfig {
126
126
  maxHeight?: string
127
127
  maxWidth?: string
128
128
  absoluteOffset?: any
129
- fit?: boolean // fit the size to the content
129
+ fitContent?: boolean // fit the size to the content
130
+ fitContainer?: boolean // fit the size to the container
130
131
  cover?: boolean
131
132
  }
132
133
 
@@ -194,13 +195,21 @@ export function setPosition(cfg: PositionConfig) {
194
195
  visibility: 'visible'
195
196
  }
196
197
 
197
- if (cfg.fit === true || cfg.cover === true) {
198
+ if (
199
+ cfg.fitContainer === true ||
200
+ cfg.cover === true ||
201
+ cfg.fitContent === true
202
+ ) {
198
203
  elStyle.minWidth = cfg.maxWidth || anchorProps.width + 'px'
199
204
  elStyle.maxWidth = cfg.maxWidth || anchorProps.width + 'px'
200
205
 
201
206
  if (cfg.cover === true) {
202
207
  elStyle.minHeight = anchorProps.height + 'px'
203
208
  }
209
+
210
+ if (cfg.fitContent === true) {
211
+ elStyle.maxWidth = cfg.el.offsetWidth + 'px'
212
+ }
204
213
  }
205
214
 
206
215
  Object.assign(cfg.el!.style, elStyle)