@dataloop-ai/components 0.20.25 → 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.25",
3
+ "version": "0.20.27",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -95,7 +95,7 @@
95
95
  class="root-container--placeholder"
96
96
  >
97
97
  <template v-if="allFiltersModel">
98
- {{ computedAllItemsLabel }}
98
+ <dl-ellipsis :text="computedAllItemsLabel" />
99
99
  </template>
100
100
  <template v-else>
101
101
  <dl-ellipsis :text="filterSelectLabel" />
@@ -108,7 +108,7 @@
108
108
  "
109
109
  class="selected-label"
110
110
  >
111
- {{ getLabel(selectedOption) }}
111
+ <dl-ellipsis :text="getLabel(selectedOption)" />
112
112
  </span>
113
113
  </template>
114
114
  <div
@@ -631,10 +631,10 @@ export default defineComponent({
631
631
  }
632
632
  return this.modelValueLength > 0
633
633
  ? `${this.modelValueLength} ${this.selectedResourceLabel}`
634
- : this.computedPlaceholder
634
+ : String(this.computedPlaceholder)
635
635
  },
636
636
  computedAllItemsLabel(): string {
637
- return this.allItemsOptionLabel || 'All Items'
637
+ return String(this.allItemsOptionLabel ?? 'All Items')
638
638
  },
639
639
  isModelValuePrimitiveType(): boolean {
640
640
  return this.isPrimitiveValue(this.modelValue)
@@ -670,7 +670,7 @@ export default defineComponent({
670
670
  return this.searchable && this.isExpanded
671
671
  },
672
672
  computedPlaceholder(): string {
673
- return this.placeholder || 'Select option'
673
+ return String(this.placeholder ?? 'Select option')
674
674
  },
675
675
  placeholderStyles(): Record<string, string> {
676
676
  if (this.disabled) {
@@ -1088,6 +1088,8 @@ export default defineComponent({
1088
1088
 
1089
1089
  .selected-label {
1090
1090
  color: var(--dl-select-placeholder-color, var(--placeholder-color));
1091
+ width: fit-content;
1092
+ max-width: 100%;
1091
1093
  }
1092
1094
 
1093
1095
  .dl-select__title {
@@ -1096,6 +1098,7 @@ export default defineComponent({
1096
1098
  text-align: left;
1097
1099
  margin-right: 5px;
1098
1100
  white-space: nowrap;
1101
+ width: 100%;
1099
1102
  }
1100
1103
 
1101
1104
  .required-asterisk {
@@ -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: {