@dataloop-ai/components 0.18.19 → 0.18.21
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
|
@@ -53,6 +53,17 @@
|
|
|
53
53
|
:model-value="dateInterval"
|
|
54
54
|
@update:model-value="updateDateInterval"
|
|
55
55
|
/>
|
|
56
|
+
|
|
57
|
+
<dl-button
|
|
58
|
+
size="s"
|
|
59
|
+
outlined
|
|
60
|
+
class="dl-date-time-range--button"
|
|
61
|
+
@click="handleClearAction"
|
|
62
|
+
>
|
|
63
|
+
<span style="text-transform: capitalize">
|
|
64
|
+
Clear
|
|
65
|
+
</span>
|
|
66
|
+
</dl-button>
|
|
56
67
|
</div>
|
|
57
68
|
</div>
|
|
58
69
|
</dl-menu>
|
|
@@ -74,6 +85,7 @@ import DlDatePicker from '../DlDatePicker/DlDatePicker.vue'
|
|
|
74
85
|
import { CalendarDate } from '../DlDatePicker/models/CalendarDate'
|
|
75
86
|
import DateInput from './DateInput.vue'
|
|
76
87
|
import { DlMenu } from '../../../essential'
|
|
88
|
+
import { DlButton } from '../../../basic'
|
|
77
89
|
import { defineComponent, PropType } from 'vue-demi'
|
|
78
90
|
import { isInRange } from '../DlDatePicker/utils'
|
|
79
91
|
import { v4 } from 'uuid'
|
|
@@ -84,7 +96,8 @@ export default defineComponent({
|
|
|
84
96
|
DlDatePicker,
|
|
85
97
|
DlTimePicker,
|
|
86
98
|
DateInput,
|
|
87
|
-
DlMenu
|
|
99
|
+
DlMenu,
|
|
100
|
+
DlButton
|
|
88
101
|
},
|
|
89
102
|
model: {
|
|
90
103
|
prop: 'modelValue',
|
|
@@ -407,6 +420,11 @@ export default defineComponent({
|
|
|
407
420
|
}
|
|
408
421
|
},
|
|
409
422
|
methods: {
|
|
423
|
+
handleClearAction() {
|
|
424
|
+
this.currentSidebarOption = DAY_SIDEBAR_OPTION.custom
|
|
425
|
+
this.isInputDisabled = false
|
|
426
|
+
this.updateDateInterval(null)
|
|
427
|
+
},
|
|
410
428
|
handleTypeChange(value: 'day' | 'month') {
|
|
411
429
|
this.isInputDisabled = false
|
|
412
430
|
this.currentSidebarOption =
|
|
@@ -418,15 +436,19 @@ export default defineComponent({
|
|
|
418
436
|
this.$emit('set-type', value)
|
|
419
437
|
},
|
|
420
438
|
updateDateInterval(value: DateInterval | null) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
value.from
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
439
|
+
if (value === null) {
|
|
440
|
+
this.dateInterval = null
|
|
441
|
+
} else {
|
|
442
|
+
this.dateInterval = {
|
|
443
|
+
from: value.from,
|
|
444
|
+
to: new Date(
|
|
445
|
+
value.from.getFullYear(),
|
|
446
|
+
value.from.getMonth(),
|
|
447
|
+
value.from.getDate(),
|
|
448
|
+
23,
|
|
449
|
+
59
|
|
450
|
+
)
|
|
451
|
+
}
|
|
430
452
|
}
|
|
431
453
|
this.$emit('update:model-value', value)
|
|
432
454
|
this.$emit('change', value)
|
|
@@ -484,10 +506,19 @@ export default defineComponent({
|
|
|
484
506
|
z-index: 1;
|
|
485
507
|
display: flex;
|
|
486
508
|
border-radius: 2px;
|
|
509
|
+
border-radius: 2px;
|
|
487
510
|
}
|
|
488
511
|
|
|
489
512
|
&--card_content {
|
|
490
513
|
width: var(--card-content-width);
|
|
491
514
|
}
|
|
515
|
+
|
|
516
|
+
&--button {
|
|
517
|
+
display: flex;
|
|
518
|
+
margin-left: auto;
|
|
519
|
+
width: fit-content;
|
|
520
|
+
margin-right: 16px;
|
|
521
|
+
margin-bottom: 16px;
|
|
522
|
+
}
|
|
492
523
|
}
|
|
493
524
|
</style>
|
|
@@ -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
|
-
|
|
840
|
-
|
|
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
|
-
|
|
846
|
-
`<span style="background: var(--dl-color-warning)">${
|
|
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
|
+
}
|