@dataloop-ai/components 0.18.111 → 0.18.112

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.111",
3
+ "version": "0.18.112",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -133,6 +133,14 @@
133
133
  }`
134
134
  ]"
135
135
  >
136
+ <dl-icon
137
+ v-if="clearable && hasSelection"
138
+ class=".dl-select__clear-button"
139
+ icon="icon-dl-close"
140
+ :size="withoutBorders ? '10px' : '12px'"
141
+ style="margin-right: 3px; cursor: pointer"
142
+ @click.prevent.stop="clearSelection"
143
+ />
136
144
  <dl-icon
137
145
  :icon="dropdownIcon"
138
146
  :color="chevronIconColor"
@@ -388,7 +396,7 @@ export default defineComponent({
388
396
  },
389
397
  capitalizedOptions: { type: Boolean, default: false },
390
398
  withoutDropdownIconPadding: { type: Boolean, default: false },
391
- clearButtonTooltip: { type: Boolean, default: false },
399
+ clearable: { type: Boolean, default: false },
392
400
  dropdownMaxHeight: { type: String, default: '30vh' },
393
401
  preserveSearch: { type: Boolean, default: false },
394
402
  disabledTooltip: { type: String, default: 'Disabled' },
@@ -455,6 +463,9 @@ export default defineComponent({
455
463
  }
456
464
  },
457
465
  computed: {
466
+ hasSelection(): boolean {
467
+ return !!this.modelValueLength || this.selectedIndex !== -1
468
+ },
458
469
  filteredOptions(): DlSelectOptionType[] {
459
470
  if (this.customFilter || this.searchTerm === '') {
460
471
  return this.options
@@ -778,6 +789,13 @@ export default defineComponent({
778
789
  this.$emit('change', toEmit)
779
790
  },
780
791
  clearSelection(): void {
792
+ let toEmit: any[] | string = []
793
+ if (this.isModelValuePrimitiveType) {
794
+ toEmit = ''
795
+ }
796
+
797
+ this.$emit('update:model-value', toEmit)
798
+ this.$emit('change', toEmit)
781
799
  this.selectedIndex = -1
782
800
  this.closeMenu()
783
801
  },
@@ -241,6 +241,7 @@
241
241
  />
242
242
  </slot>
243
243
  </td>
244
+ <!-- todo wrap this with dltd -->
244
245
  <slot
245
246
  v-for="col in computedCols"
246
247
  v-bind="
@@ -161,6 +161,13 @@
161
161
  multiselect
162
162
  searchable
163
163
  />
164
+ <dl-select
165
+ v-model="selectedWithChildrenSearch"
166
+ :options="treeOptions"
167
+ size="m"
168
+ multiselect
169
+ clearable
170
+ />
164
171
  Capitalized options
165
172
  <dl-select
166
173
  v-model="selectedWithChildrenCapitalized"
@@ -383,6 +390,42 @@
383
390
  </div>
384
391
  </template>
385
392
  </dl-select>
393
+
394
+ Select clearable
395
+ <dl-select
396
+ v-model="selectedOption"
397
+ :options="[
398
+ {
399
+ subLabel: 'not so high',
400
+ label: 'High',
401
+ value: 'high',
402
+ bgColor: 'dl-color-negative'
403
+ },
404
+ {
405
+ subLabel: 'not so medium',
406
+ label: 'Medium',
407
+ value: 'medium',
408
+ bgColor: 'dl-color-warning',
409
+ textColor: 'dl-color-darker'
410
+ },
411
+ {
412
+ subLabel: 'not so low',
413
+ label: 'Low',
414
+ value: 'low',
415
+ bgColor: 'dl-color-positive',
416
+ textColor: 'dl-color-darker'
417
+ }
418
+ ]"
419
+ clearable
420
+ style="margin-bottom: 150px"
421
+ >
422
+ <template #option="scope">
423
+ <div style="padding: 5px 0px">
424
+ <div>{{ scope.opt.label }}</div>
425
+ <div>{{ scope.opt.subLabel }}</div>
426
+ </div>
427
+ </template>
428
+ </dl-select>
386
429
  </div>
387
430
  </template>
388
431