@dataloop-ai/components 0.18.20 → 0.18.22

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.20",
3
+ "version": "0.18.22",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -249,7 +249,7 @@ export default defineComponent({
249
249
 
250
250
  this.dateInterval = { from: date, to: date }
251
251
 
252
- if (this.singleSelection) {
252
+ if (!this.singleSelection) {
253
253
  this.isSelectionMode = true
254
254
  } else {
255
255
  this.updateModelValue(this.dateInterval)
@@ -297,7 +297,10 @@ export default defineComponent({
297
297
  }
298
298
  }
299
299
 
300
- this.dateInterval = { from: this.dateInterval.from, to: date }
300
+ this.dateInterval = {
301
+ from: this.dateInterval.from,
302
+ to: date
303
+ }
301
304
  }
302
305
  }
303
306
  })
@@ -442,9 +442,9 @@ export default defineComponent({
442
442
  this.dateInterval = {
443
443
  from: value.from,
444
444
  to: new Date(
445
- value.from.getFullYear(),
446
- value.from.getMonth(),
447
- value.from.getDate(),
445
+ value.to.getFullYear(),
446
+ value.to.getMonth(),
447
+ value.to.getDate(),
448
448
  23,
449
449
  59
450
450
  )
@@ -324,7 +324,8 @@ import {
324
324
  getIconSize,
325
325
  optionsValidator,
326
326
  DlSelectOptionType,
327
- getLabelOfSelectedOption
327
+ getLabelOfSelectedOption,
328
+ getCaseInsensitiveInput
328
329
  } from './utils'
329
330
  import DlSelectOption from './components/DlSelectOption.vue'
330
331
  import { isEqual } from 'lodash'
@@ -836,14 +837,15 @@ export default defineComponent({
836
837
  this.$emit('search-input', searchValue)
837
838
  },
838
839
  getOptionHtml(option: DlSelectOptionType) {
839
- let label = `${this.getOptionLabel(option)}`
840
- if (this.capitalizedOptions) {
841
- label = label.toLowerCase()
842
- }
840
+ const label = `${this.getOptionLabel(option)}`
841
+ const toReplace = new RegExp(this.searchInputValue, 'gi')
843
842
 
844
843
  const highlightedHtml = label.replace(
845
- this.searchInputValue,
846
- `<span style="background: var(--dl-color-warning)">${this.searchInputValue}</span>`
844
+ toReplace,
845
+ `<span style="background: var(--dl-color-warning)">${getCaseInsensitiveInput(
846
+ label,
847
+ this.searchInputValue
848
+ )}</span>`
847
849
  )
848
850
  const html = `<span>${highlightedHtml}</span>`
849
851
 
@@ -44,3 +44,9 @@ export const optionsValidator = (opts: DlSelectOptionType[]) => {
44
44
  return keys.includes('value') && keys.includes('label')
45
45
  })
46
46
  }
47
+
48
+ export const getCaseInsensitiveInput = (label: string, input: string) => {
49
+ const inputRegexp = new RegExp(input, 'gi')
50
+ const position = label.search(inputRegexp)
51
+ return label.slice(position, input.length)
52
+ }