@dataloop-ai/components 0.17.117 → 0.17.118

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.17.117",
3
+ "version": "0.17.118",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -198,6 +198,7 @@
198
198
  {{ computedAllItemsLabel }}
199
199
  </template>
200
200
  </dl-select-option>
201
+
201
202
  <!-- Virtual scroll -->
202
203
  <dl-virtual-scroll
203
204
  v-if="optionsCount > MAX_ITEMS_PER_LIST"
@@ -249,48 +250,47 @@
249
250
  </template>
250
251
  </dl-select-option>
251
252
  </dl-virtual-scroll>
252
-
253
253
  <!-- Else normal list -->
254
- <dl-select-option
255
- v-for="(option, optionIndex) in options"
256
- v-else
257
- :key="getKeyForOption(option)"
258
- clickable
259
- :multiselect="multiselect"
260
- :class="{
261
- selected:
262
- option === selectedOption && highlightSelected
263
- }"
264
- :style="
265
- optionIndex === highlightedIndex
266
- ? 'background-color: var(--dl-color-fill)'
267
- : ''
268
- "
269
- :with-wave="withWave"
270
- :model-value="modelValue"
271
- :value="getOptionValue(option)"
272
- :highlight-selected="highlightSelected"
273
- :count="getOptionCount(option)"
274
- :children="getOptionChildren(option)"
275
- :capitalized="capitalizedOptions"
276
- @update:model-value="handleModelValueUpdate"
277
- @click="selectOption(option)"
278
- @selected="handleSelected"
279
- @deselected="handleDeselected"
280
- @depth-change="handleDepthChange"
281
- >
282
- <slot
283
- v-if="hasOptionSlot"
284
- :opt="option"
285
- name="option"
286
- />
287
- <template v-else>
288
- <span
289
- class="inner-option"
290
- v-html="getOptionHtml(option)"
291
- />
292
- </template>
293
- </dl-select-option>
254
+ <div v-else>
255
+ <dl-select-option
256
+ v-for="(option, optionIndex) in options"
257
+ :key="getKeyForOption(option)"
258
+ clickable
259
+ :multiselect="multiselect"
260
+ :class="{
261
+ selected:
262
+ option === selectedOption &&
263
+ highlightSelected
264
+ }"
265
+ :style="
266
+ optionIndex === highlightedIndex
267
+ ? 'background-color: var(--dl-color-fill)'
268
+ : ''
269
+ "
270
+ :with-wave="withWave"
271
+ :model-value="modelValue"
272
+ :value="getOptionValue(option)"
273
+ :highlight-selected="highlightSelected"
274
+ :count="getOptionCount(option)"
275
+ :children="getOptionChildren(option)"
276
+ :capitalized="capitalizedOptions"
277
+ @update:model-value="handleModelValueUpdate"
278
+ @click="selectOption(option)"
279
+ @selected="handleSelected"
280
+ @deselected="handleDeselected"
281
+ @depth-change="handleDepthChange"
282
+ >
283
+ <slot
284
+ :opt="option"
285
+ name="option"
286
+ >
287
+ <span
288
+ class="inner-option"
289
+ v-html="getOptionHtml(option)"
290
+ />
291
+ </slot>
292
+ </dl-select-option>
293
+ </div>
294
294
  <dl-list-item v-if="hasAfterOptions && !noOptions">
295
295
  <dl-item-section>
296
296
  <slot name="after-options" />
@@ -793,7 +793,8 @@ export default defineComponent({
793
793
  : this.options[this.selectedIndex]
794
794
 
795
795
  if (this.search) {
796
- (this.$refs.searchInput as HTMLInputElement).value =
796
+ const searchInput = this.$refs.searchInput as HTMLInputElement
797
+ searchInput.value =
797
798
  typeof selectedOption === 'string'
798
799
  ? selectedOption
799
800
  : (selectedOption as Record<string, any>)?.label
@@ -817,7 +818,8 @@ export default defineComponent({
817
818
  (e.target as HTMLInputElement).value.trim() === ''
818
819
 
819
820
  this.$nextTick(() => {
820
- (this.$refs.menu as any)?.updatePosition()
821
+ const menu = this.$refs.menu as any
822
+ menu?.updatePosition()
821
823
  })
822
824
  }
823
825
  const searchValue = (e.target as HTMLInputElement).value
@@ -825,14 +827,18 @@ export default defineComponent({
825
827
  this.$emit('search-input', searchValue)
826
828
  },
827
829
  getOptionHtml(option: DlSelectOptionType) {
828
- return `<span>${(this.capitalizedOptions
829
- ? typeof this.getOptionLabel(option) === 'string' &&
830
- this.getOptionLabel(option).toLowerCase()
831
- : this.getOptionLabel(option)
832
- ).replace(
830
+ let label = `${this.getOptionLabel(option)}`
831
+ if (this.capitalizedOptions) {
832
+ label = label.toLowerCase()
833
+ }
834
+
835
+ const highlightedHtml = label.replace(
833
836
  this.searchInputValue,
834
837
  `<span style="background: var(--dl-color-warning)">${this.searchInputValue}</span>`
835
- )}</span>`
838
+ )
839
+ const html = `<span>${highlightedHtml}</span>`
840
+
841
+ return html
836
842
  },
837
843
  handleSearchBlur(e: Event): void {
838
844
  if (this.search) {
@@ -216,7 +216,7 @@
216
216
  </dl-select>
217
217
  With tooltip
218
218
  <dl-select
219
- v-model="selectedOption"
219
+ v-model="select2"
220
220
  title="With tooltip"
221
221
  :tooltip="'Test Me'"
222
222
  :options="[
@@ -251,7 +251,7 @@
251
251
  </dl-select>
252
252
  Small size
253
253
  <dl-select
254
- v-model="selectedOption"
254
+ v-model="select3"
255
255
  :size="'s'"
256
256
  :options="[
257
257
  {
@@ -285,7 +285,7 @@
285
285
  </dl-select>
286
286
  Small size with tooltip
287
287
  <dl-select
288
- v-model="selectedOption"
288
+ v-model="select4"
289
289
  :size="'s'"
290
290
  title="test"
291
291
  tooltip="test me"
@@ -322,7 +322,7 @@
322
322
 
323
323
  Select with max-height
324
324
  <dl-select
325
- v-model="selectedOption"
325
+ v-model="select5"
326
326
  :size="'s'"
327
327
  title="test"
328
328
  dropdown-max-height="50px"
@@ -484,6 +484,10 @@ export default defineComponent({
484
484
  bgColor: 'dl-color-error',
485
485
  textColor: 'dl-color-white'
486
486
  },
487
+ select2: null,
488
+ select3: null,
489
+ select4: null,
490
+ select5: null,
487
491
  statusOption: {
488
492
  label: 'Status 1',
489
493
  value: 1,