@dataloop-ai/components 0.18.133 → 0.18.135

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.133",
3
+ "version": "0.18.135",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -128,7 +128,8 @@ export default defineComponent({
128
128
  : 'flex-end',
129
129
  '--option-group-width':
130
130
  this.leftLabel && !this.inline ? '100%' : 'auto',
131
- '--option-group-max-width': this.maxWidth
131
+ '--option-group-max-width': this.maxWidth,
132
+ '--option-group-gap': this.isInMenu ? '0px' : '10px'
132
133
  }
133
134
  }
134
135
  },
@@ -175,7 +176,7 @@ export default defineComponent({
175
176
  }
176
177
  .option-group-wrapper.column {
177
178
  flex-direction: column;
178
- gap: 10px;
179
+ gap: var(--option-group-gap);
179
180
  }
180
181
 
181
182
  .option {
@@ -439,14 +439,6 @@ export default defineComponent({
439
439
  emit('change', val)
440
440
  emit('selected', val)
441
441
  }
442
- const handleSelectedItem = (value: any) => {
443
- selectedIndex.value = props.options.findIndex(
444
- (option: string | Record<string, string | number> | number) =>
445
- isEqual(option as any, value)
446
- )
447
-
448
- handleModelValueUpdate(value)
449
- }
450
442
 
451
443
  return {
452
444
  uuid: `dl-select-${v4()}`,
@@ -456,7 +448,6 @@ export default defineComponent({
456
448
  highlightedIndex,
457
449
  selectedIndex,
458
450
  setHighlightedIndex,
459
- handleSelectedItem,
460
451
  handleModelValueUpdate,
461
452
  searchTerm, // todo: merge this sometime
462
453
  searchInputValue
@@ -743,6 +734,9 @@ export default defineComponent({
743
734
  isEqual(option, this.modelValue)
744
735
  )
745
736
  },
737
+ handleSelectedItem(value: DlSelectOptionType) {
738
+ this.selectOption(value)
739
+ },
746
740
  getOptionValue(option: any) {
747
741
  return option?.value ?? option
748
742
  },
@@ -796,20 +790,11 @@ export default defineComponent({
796
790
  this.selectedIndex = -1
797
791
  this.closeMenu()
798
792
  },
799
- selectOption(selected: any) {
793
+ selectOption(selectedOption: DlSelectOptionType) {
800
794
  if (this.multiselect) {
801
795
  return
802
796
  }
803
797
 
804
- this.selectedIndex = this.options.findIndex(
805
- (el: string | Record<string, string | number> | number) =>
806
- isEqual(el, selected)
807
- )
808
- const selectedOption =
809
- this.selectedIndex === -1
810
- ? undefined
811
- : this.options[this.selectedIndex]
812
-
813
798
  if (this.searchable) {
814
799
  const searchInput = this.$refs.searchInput as HTMLInputElement
815
800
  searchInput.value =
@@ -29,17 +29,15 @@
29
29
  />
30
30
 
31
31
  <h1>in menu : The chosen options are {{ switchValue }}</h1>
32
- <dl-button
33
- label="Menu"
34
- @click="$refs.menu.show()"
35
- >
32
+ <dl-button label="Menu">
36
33
  <dl-menu
37
34
  ref="menu"
38
- fit-container
35
+ fit-content
39
36
  >
40
37
  <dl-option-group
41
38
  v-model="switchValue"
42
- type="checkbox"
39
+ left-label
40
+ type="switch"
43
41
  :options="options"
44
42
  />
45
43
  </dl-menu>