@dataloop-ai/components 0.20.26 → 0.20.27

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.26",
3
+ "version": "0.20.27",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -82,9 +82,7 @@
82
82
  name="selected"
83
83
  >
84
84
  <span class="root-container--placeholder">
85
- <dl-ellipsis>
86
- {{ filterSelectLabel }}
87
- </dl-ellipsis>
85
+ <dl-ellipsis :text="filterSelectLabel" />
88
86
  </span>
89
87
  </slot>
90
88
  </div>
@@ -97,10 +95,10 @@
97
95
  class="root-container--placeholder"
98
96
  >
99
97
  <template v-if="allFiltersModel">
100
- {{ computedAllItemsLabel }}
98
+ <dl-ellipsis :text="computedAllItemsLabel" />
101
99
  </template>
102
100
  <template v-else>
103
- <dl-ellipsis> filterSelectLabel </dl-ellipsis>
101
+ <dl-ellipsis :text="filterSelectLabel" />
104
102
  </template>
105
103
  </span>
106
104
  <span
@@ -110,9 +108,7 @@
110
108
  "
111
109
  class="selected-label"
112
110
  >
113
- <dl-ellipsis>
114
- {{ getLabel(selectedOption) }}
115
- </dl-ellipsis>
111
+ <dl-ellipsis :text="getLabel(selectedOption)" />
116
112
  </span>
117
113
  </template>
118
114
  <div
@@ -635,10 +631,10 @@ export default defineComponent({
635
631
  }
636
632
  return this.modelValueLength > 0
637
633
  ? `${this.modelValueLength} ${this.selectedResourceLabel}`
638
- : this.computedPlaceholder
634
+ : String(this.computedPlaceholder)
639
635
  },
640
636
  computedAllItemsLabel(): string {
641
- return this.allItemsOptionLabel || 'All Items'
637
+ return String(this.allItemsOptionLabel ?? 'All Items')
642
638
  },
643
639
  isModelValuePrimitiveType(): boolean {
644
640
  return this.isPrimitiveValue(this.modelValue)
@@ -674,7 +670,7 @@ export default defineComponent({
674
670
  return this.searchable && this.isExpanded
675
671
  },
676
672
  computedPlaceholder(): string {
677
- return this.placeholder || 'Select option'
673
+ return String(this.placeholder ?? 'Select option')
678
674
  },
679
675
  placeholderStyles(): Record<string, string> {
680
676
  if (this.disabled) {
@@ -3,10 +3,10 @@ import { DlSelectOptionType } from './types'
3
3
 
4
4
  export const getLabel = (option: any) => {
5
5
  if (typeof option === 'object' && 'label' in option) {
6
- return option.label
6
+ return String(option.label)
7
7
  }
8
8
 
9
- return option
9
+ return String(option)
10
10
  }
11
11
 
12
12
  const ICON_SIZES = {
@@ -45,12 +45,12 @@ export const getLabelOfSelectedOption = (
45
45
  typeof selected === 'string' &&
46
46
  option === selected
47
47
  ) {
48
- return option
48
+ return String(option)
49
49
  } else if (
50
50
  typeof option === 'object' &&
51
51
  isValueSelected(option, selected)
52
52
  ) {
53
- return option.label
53
+ return String(option.label)
54
54
  }
55
55
  }
56
56
  return '1 Option Selected'
@@ -697,6 +697,19 @@
697
697
  <div>{{ scope.opt.label }}</div>
698
698
  </template>
699
699
  </dl-select>
700
+
701
+ Select numbers as labels
702
+ <dl-select
703
+ v-model="selectedNumbers"
704
+ :options="optionsAsNumbers"
705
+ multiselect
706
+ searchable
707
+ style="margin-bottom: 150px; width: 200px"
708
+ >
709
+ <template #selected="scope">
710
+ <div>{{ scope.opt.label }}</div>
711
+ </template>
712
+ </dl-select>
700
713
  </div>
701
714
  </template>
702
715
 
@@ -712,6 +725,12 @@ const defaultOptions = [
712
725
  { label: 'Contributor 3', value: 'c3' }
713
726
  ]
714
727
 
728
+ const optionsAsNumbers = [
729
+ { label: 1, value: 1 },
730
+ { label: 2, value: 2 },
731
+ { label: 3, value: 3 }
732
+ ]
733
+
715
734
  const defaultOptions1 = [
716
735
  {
717
736
  label: 'Contributor 1 Contributor 1 Contributor 1 Contributor 1 Contributor 1 Contributor 1',
@@ -980,7 +999,9 @@ export default defineComponent({
980
999
  tasksFilter: [],
981
1000
  showAllOption: true,
982
1001
  disabledSelected: 'disabled option',
983
- preSelectedValue: null
1002
+ preSelectedValue: null,
1003
+ optionsAsNumbers,
1004
+ selectedNumbers: []
984
1005
  }
985
1006
  },
986
1007
  computed: {