@usssa/component-library 1.0.0-alpha.104 → 1.0.0-alpha.105
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
|
@@ -18,10 +18,14 @@ const props = defineProps({
|
|
|
18
18
|
},
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
const emit = defineEmits(['updateInputVal'])
|
|
21
|
+
const emit = defineEmits(['updateInputVal', 'onInputBlur'])
|
|
22
22
|
|
|
23
23
|
const searchInputRef = ref(null)
|
|
24
24
|
|
|
25
|
+
const onInputBlur = () => {
|
|
26
|
+
emit('onInputBlur')
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
const updateInputVal = (event) => {
|
|
26
30
|
emit('updateInputVal', event)
|
|
27
31
|
}
|
|
@@ -41,6 +45,7 @@ const updateInputVal = (event) => {
|
|
|
41
45
|
:modelValue="searchText"
|
|
42
46
|
ref="searchInputRef"
|
|
43
47
|
spellcheck="false"
|
|
48
|
+
@blur="onInputBlur"
|
|
44
49
|
@update:modelValue="updateInputVal($event)"
|
|
45
50
|
/>
|
|
46
51
|
|
|
@@ -24,6 +24,9 @@ const props = defineProps({
|
|
|
24
24
|
actionButtonLoading: {
|
|
25
25
|
type: Boolean,
|
|
26
26
|
},
|
|
27
|
+
addedBtnIcon: {
|
|
28
|
+
type: String,
|
|
29
|
+
},
|
|
27
30
|
// Set default tab
|
|
28
31
|
advancedSearchSelectedTab: {
|
|
29
32
|
type: String,
|
|
@@ -31,6 +34,9 @@ const props = defineProps({
|
|
|
31
34
|
algoliaIndex: {
|
|
32
35
|
type: Object,
|
|
33
36
|
},
|
|
37
|
+
alreadyAddedIds: {
|
|
38
|
+
type: Array,
|
|
39
|
+
},
|
|
34
40
|
// Set context for component for special handling
|
|
35
41
|
// context.action (e.g. addContact)
|
|
36
42
|
// context.data (e.g. array of existing contacts)
|
|
@@ -53,7 +59,6 @@ const props = defineProps({
|
|
|
53
59
|
},
|
|
54
60
|
labelIcon: {
|
|
55
61
|
type: String,
|
|
56
|
-
default: 'fa-kit-duotone fa-filter-search',
|
|
57
62
|
},
|
|
58
63
|
menuClass: {
|
|
59
64
|
type: String,
|
|
@@ -351,19 +356,35 @@ const specialContextHandler = (results) => {
|
|
|
351
356
|
if (data?.label) {
|
|
352
357
|
result.label = data?.label
|
|
353
358
|
}
|
|
359
|
+
result.color = data?.color ?? props.disabledButtonColor
|
|
354
360
|
}
|
|
355
361
|
})
|
|
356
362
|
|
|
357
363
|
if (isAlreadyAddedSearch && isAlreadyAddedSearch.length > 0) {
|
|
358
|
-
const color = props.disabledButtonColor
|
|
359
364
|
return {
|
|
360
365
|
...result,
|
|
361
366
|
disable: true,
|
|
362
367
|
btnProps: {
|
|
363
|
-
|
|
368
|
+
...result.btnProps,
|
|
369
|
+
color: result.btnProps?.color ?? result?.color,
|
|
364
370
|
},
|
|
365
371
|
}
|
|
366
372
|
}
|
|
373
|
+
if (props.alreadyAddedIds?.length) {
|
|
374
|
+
if (props.alreadyAddedIds.includes(result.docId || result.id)) {
|
|
375
|
+
return {
|
|
376
|
+
...result,
|
|
377
|
+
disable: true,
|
|
378
|
+
label: 'Added',
|
|
379
|
+
icon: props.addedBtnIcon,
|
|
380
|
+
btnProps: {
|
|
381
|
+
...result.btnProps,
|
|
382
|
+
color: result.btnProps?.color ?? 'positive',
|
|
383
|
+
outline: false,
|
|
384
|
+
},
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
367
388
|
return {
|
|
368
389
|
...result,
|
|
369
390
|
}
|
|
@@ -549,11 +570,12 @@ watch(
|
|
|
549
570
|
item.disable ||
|
|
550
571
|
(selectedItem?.id !== item.id && actionButtonLoading)
|
|
551
572
|
"
|
|
573
|
+
:leftIcon="item.icon"
|
|
552
574
|
:label="item.label ? item.label : actionButtonLabel"
|
|
553
575
|
:loading="
|
|
554
576
|
selectedItem?.id === item.id ? actionButtonLoading : false
|
|
555
577
|
"
|
|
556
|
-
outline
|
|
578
|
+
:outline="item.btnProps?.outline ?? true"
|
|
557
579
|
size="sm"
|
|
558
580
|
@click.stop="onItemActionClick(item)"
|
|
559
581
|
>
|
|
@@ -645,7 +667,12 @@ watch(
|
|
|
645
667
|
/>
|
|
646
668
|
</div>
|
|
647
669
|
<div
|
|
648
|
-
v-if="
|
|
670
|
+
v-if="
|
|
671
|
+
showRecentSelected &&
|
|
672
|
+
recentSearches &&
|
|
673
|
+
recentSearches.length &&
|
|
674
|
+
!recentSearchesLoading
|
|
675
|
+
"
|
|
649
676
|
>
|
|
650
677
|
<span class="text-overline-xs"> Recently Selected </span>
|
|
651
678
|
|
|
@@ -690,11 +717,12 @@ watch(
|
|
|
690
717
|
item.disable ||
|
|
691
718
|
(selectedItem?.id !== item.id && actionButtonLoading)
|
|
692
719
|
"
|
|
720
|
+
:leftIcon="item.icon"
|
|
693
721
|
:label="item.label ? item.label : actionButtonLabel"
|
|
694
722
|
:loading="
|
|
695
723
|
selectedItem?.id === item.id ? actionButtonLoading : false
|
|
696
724
|
"
|
|
697
|
-
outline
|
|
725
|
+
:outline="item.btnProps?.outline ?? true"
|
|
698
726
|
size="sm"
|
|
699
727
|
@click.stop="onItemActionClick(item, true)"
|
|
700
728
|
>
|