classcard-ui 0.2.1462 → 0.2.1464
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/README.md +24 -24
- package/dist/classcard-ui.common.js +148 -113
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +148 -113
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +2 -2
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +83 -83
- package/src/App.vue +16 -16
- package/src/colorConfig.js +52 -52
- package/src/components/CAlertModal/CAlertModal.vue +179 -179
- package/src/components/CAlertModal/index.js +3 -3
- package/src/components/CAlerts/CAlerts.vue +97 -97
- package/src/components/CAlerts/index.js +2 -2
- package/src/components/CAnchorTabs/CAnchorTabs.vue +100 -100
- package/src/components/CAnchorTabs/index.js +2 -2
- package/src/components/CAnchorTag/CAnchorTag.vue +84 -84
- package/src/components/CAnchorTag/index.js +2 -2
- package/src/components/CAvatar/CAvatar.vue +230 -230
- package/src/components/CAvatar/index.js +2 -2
- package/src/components/CAvatarGroup/CAvatarGroup.vue +213 -213
- package/src/components/CAvatarGroup/index.js +2 -2
- package/src/components/CBasicTable/CBasicTable.vue +184 -184
- package/src/components/CBasicTable/index.js +2 -2
- package/src/components/CBreadcrumbs/CBreadcrumbs.vue +38 -38
- package/src/components/CBreadcrumbs/index.js +2 -2
- package/src/components/CButton/CButton.vue +239 -239
- package/src/components/CButton/index.js +2 -2
- package/src/components/CButtonGroup/CButtonGroup.vue +155 -155
- package/src/components/CButtonGroup/index.js +2 -2
- package/src/components/CButtonIcon/CButtonIcon.vue +166 -166
- package/src/components/CButtonIcon/index.js +2 -2
- package/src/components/CButtonLink/CButtonLink.vue +43 -43
- package/src/components/CButtonLink/index.js +2 -2
- package/src/components/CButtonSelect/CButtonSelect.vue +186 -186
- package/src/components/CButtonSelect/index.js +2 -2
- package/src/components/CButtonSelectBorder/CButtonSelectBorder.vue +265 -265
- package/src/components/CButtonSelectBorder/index.js +3 -3
- package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +152 -152
- package/src/components/CButtonWithDropdown/index.js +2 -2
- package/src/components/CCalendar/CCalendar.vue +443 -443
- package/src/components/CCalendar/index.js +3 -3
- package/src/components/CCard/CCard.vue +53 -53
- package/src/components/CCard/index.js +2 -2
- package/src/components/CCheckbox/CCheckbox.vue +200 -200
- package/src/components/CCheckbox/index.js +2 -2
- package/src/components/CCircularButton/CCircularButton.vue +57 -57
- package/src/components/CCircularButton/index.js +2 -2
- package/src/components/CCollapsibleSection/CCollapsibleSection.vue +121 -121
- package/src/components/CCollapsibleSection/index.js +2 -2
- package/src/components/CColorDots/CColorDots.vue +52 -52
- package/src/components/CColorDots/index.js +3 -3
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +198 -198
- package/src/components/CConfirmActionModal/index.js +3 -3
- package/src/components/CDatepicker/CDatepicker.vue +235 -235
- package/src/components/CDatepicker/index.js +2 -2
- package/src/components/CDualSelect/CDualSelect.vue +193 -193
- package/src/components/CDualSelect/index.js +2 -2
- package/src/components/CEditor/CEditor.vue +114 -114
- package/src/components/CEditor/index.js +2 -2
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +76 -76
- package/src/components/CFormSectionHeading/index.js +2 -2
- package/src/components/CGroupedFilterDropdown/CGroupedFilterDropdown.vue +253 -253
- package/src/components/CGroupedFilterDropdown/index.js +2 -2
- package/src/components/CGroupedSelect/CGroupedSelect.vue +366 -366
- package/src/components/CGroupedSelect/index.js +3 -3
- package/src/components/CIcon/CIcon.vue +112 -112
- package/src/components/CIcon/index.js +2 -2
- package/src/components/CIconDropdown/CIconDropdown.vue +191 -191
- package/src/components/CIconDropdown/index.js +2 -2
- package/src/components/CIconSelect/CIconSelect.vue +182 -182
- package/src/components/CIconSelect/index.js +3 -3
- package/src/components/CInput/CInput.vue +173 -173
- package/src/components/CInput/index.js +2 -2
- package/src/components/CInputAddon/CInputAddon.vue +297 -297
- package/src/components/CInputAddon/index.js +2 -2
- package/src/components/CInputEmail/CInputEmail.vue +107 -107
- package/src/components/CInputEmail/index.js +2 -2
- package/src/components/CInsetTabs/CInsetTabs.vue +134 -134
- package/src/components/CInsetTabs/index.js +3 -3
- package/src/components/CModalHeading/CModalHeading.vue +22 -22
- package/src/components/CModalHeading/index.js +2 -2
- package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +88 -88
- package/src/components/CModuleHelpLinks/index.js +3 -3
- package/src/components/CMultiselect/CMultiselect.vue +930 -930
- package/src/components/CMultiselect/index.js +2 -2
- package/src/components/CMultiselectr/CMultiselectr.vue +44 -44
- package/src/components/CMultiselectr/index.js +2 -2
- package/src/components/CPageHeading/CPageHeading.vue +83 -83
- package/src/components/CPageHeading/index.js +2 -2
- package/src/components/CPagination/CPagination.vue +239 -239
- package/src/components/CPagination/index.js +2 -2
- package/src/components/CPhoneNumber/CPhoneNumber.vue +213 -213
- package/src/components/CPhoneNumber/index.js +2 -2
- package/src/components/CProgress/CProgress.vue +91 -91
- package/src/components/CProgress/index.js +2 -2
- package/src/components/CRadio/CRadio.vue +197 -197
- package/src/components/CRadio/index.js +2 -2
- package/src/components/CRadioGroup/CRadioGroup.vue +96 -96
- package/src/components/CRadioGroup/index.js +2 -2
- package/src/components/CRangeSlider/CRangeSlider.vue +55 -55
- package/src/components/CRangeSlider/index.js +2 -2
- package/src/components/CReorderableStackedList/CReorderableStackedList.vue +94 -94
- package/src/components/CReorderableStackedList/index.js +2 -2
- package/src/components/CSelect/CSelect.vue +1165 -1165
- package/src/components/CSelect/index.js +2 -2
- package/src/components/CSmallTimeline/CSmallTimeline.vue +40 -40
- package/src/components/CSmallTimeline/index.js +2 -2
- package/src/components/CStackedList/CStackedList.vue +162 -162
- package/src/components/CStackedList/index.js +2 -2
- package/src/components/CStats/CStats.vue +187 -187
- package/src/components/CStats/index.js +2 -2
- package/src/components/CSwitch/CSwitch.vue +200 -200
- package/src/components/CSwitch/index.js +2 -2
- package/src/components/CTabLazy/CTabLazy.vue +83 -83
- package/src/components/CTabLazy/index.js +2 -2
- package/src/components/CTable/CTable.vue +1114 -1114
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +250 -250
- package/src/components/CTabs/index.js +2 -2
- package/src/components/CTag/CTag.vue +109 -109
- package/src/components/CTag/index.js +2 -2
- package/src/components/CTextarea/CTextarea.vue +118 -118
- package/src/components/CTextarea/index.js +2 -2
- package/src/components/CTimeline/CTimeline.vue +237 -237
- package/src/components/CTimeline/index.js +2 -2
- package/src/components/CToolTip/CToolTip.vue +108 -108
- package/src/components/CToolTip/index.js +3 -3
- package/src/components/CUpload/CUpload.vue +331 -331
- package/src/components/CUpload/index.js +2 -2
- package/src/components/NumberAnimator.vue +112 -112
- package/src/components/index.js +57 -57
- package/src/helper.js +8 -8
- package/src/icons.js +829 -827
- package/src/main.js +22 -22
- package/src/stories/CAlertModal.stories.js +30 -30
- package/src/stories/CAlerts.stories.js +37 -37
- package/src/stories/CAnchorTabs.stories.js +29 -29
- package/src/stories/CAnchorTag.stories.js +38 -38
- package/src/stories/CAvatar.stories.js +38 -38
- package/src/stories/CAvatarGroup.stories.js +136 -136
- package/src/stories/CBasicTable.stories.js +316 -316
- package/src/stories/CBreadcrumbs.stories.js +24 -24
- package/src/stories/CButton.stories.js +49 -49
- package/src/stories/CButtonGroup.stories.js +43 -43
- package/src/stories/CButtonIcon.stories.js +27 -27
- package/src/stories/CButtonLink.stories.js +24 -24
- package/src/stories/CButtonSelect.stories.js +44 -44
- package/src/stories/CButtonSelectBorder.stories.js +56 -56
- package/src/stories/CButtonWithDropdown.stories.js +41 -41
- package/src/stories/CCalendar.stories.js +16 -16
- package/src/stories/CCard.stories.js +30 -30
- package/src/stories/CCheckbox.stories.js +38 -38
- package/src/stories/CCircularButton.stories.js +29 -29
- package/src/stories/CCollapsibleSection.stories.js +29 -29
- package/src/stories/CColorDots.stories.js +37 -37
- package/src/stories/CConfirmActionModal.stories.js +60 -60
- package/src/stories/CDatepicker.stories.js +31 -31
- package/src/stories/CDualSelect.stories.js +29 -29
- package/src/stories/CEditor.stories.js +30 -30
- package/src/stories/CFormSectionHeading.stories.js +37 -37
- package/src/stories/CGroupedFilterDropdown.stories.js +176 -176
- package/src/stories/CGroupedSelect.stories.js +103 -103
- package/src/stories/CIcon.stories.js +31 -31
- package/src/stories/CIconDropdown.stories.js +52 -52
- package/src/stories/CIconSelect.stories.js +45 -45
- package/src/stories/CInput.stories.js +36 -36
- package/src/stories/CInputAddon.stories.js +37 -37
- package/src/stories/CInputEmail.stories.js +27 -27
- package/src/stories/CInsetTabs.stories.js +48 -48
- package/src/stories/CModalHeading.stories.js +25 -25
- package/src/stories/CModuleHelpLinks.stories.js +25 -25
- package/src/stories/CMultiselect.stories.js +136 -136
- package/src/stories/CMultiselectr.stories.js +23 -23
- package/src/stories/CPageHeading.stories.js +32 -32
- package/src/stories/CPagination.stories.js +30 -30
- package/src/stories/CPhoneNumber.stories.js +37 -37
- package/src/stories/CProgress.stories.js +23 -23
- package/src/stories/CRadio.stories.js +44 -44
- package/src/stories/CRadioGroup.stories.js +51 -51
- package/src/stories/CRangeSlider.stories.js +23 -23
- package/src/stories/CReorderableStackedList.stories.js +23 -23
- package/src/stories/CSelect.stories.js +157 -157
- package/src/stories/CSmallTimeline.stories.js +26 -26
- package/src/stories/CStackedList.stories.js +37 -37
- package/src/stories/CStats.stories.js +53 -53
- package/src/stories/CSwitch.stories.js +28 -28
- package/src/stories/CTabLazy.stories.js +42 -42
- package/src/stories/CTable.stories.js +203 -203
- package/src/stories/CTabs.stories.js +36 -36
- package/src/stories/CTag.stories.js +37 -37
- package/src/stories/CTextarea.stories.js +32 -32
- package/src/stories/CTimeline.stories.js +26 -26
- package/src/stories/CToolTip.stories.js +27 -27
- package/src/stories/CUpload.stories.js +36 -36
- package/src/stories/Introduction.stories.mdx +207 -207
- package/src/stories/Page.vue +88 -88
- package/src/stories/assets/code-brackets.svg +0 -0
- package/src/stories/assets/colors.svg +0 -0
- package/src/stories/assets/comments.svg +0 -0
- package/src/stories/assets/direction.svg +0 -0
- package/src/stories/assets/flow.svg +0 -0
- package/src/stories/assets/plugin.svg +0 -0
- package/src/stories/assets/repo.svg +0 -0
- package/src/stories/assets/stackalt.svg +0 -0
- package/src/stories/header.css +26 -26
- package/src/stories/page.css +69 -69
- package/src/stories/utils.css +32 -32
|
@@ -1,930 +1,930 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="mb-1 flex w-full items-center justify-between" v-if="label">
|
|
4
|
-
<div class="flex items-center">
|
|
5
|
-
<!-- label of multiselect field -->
|
|
6
|
-
<label v-if="label" class="text-sm font-medium text-gray-900">{{
|
|
7
|
-
label
|
|
8
|
-
}}</label>
|
|
9
|
-
<!-- asterisk sign to render if field is required -->
|
|
10
|
-
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
|
-
</div>
|
|
12
|
-
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="relative">
|
|
15
|
-
<v-select
|
|
16
|
-
ref="vselect"
|
|
17
|
-
class="disabled:custom-disabled-state absolute inline-block h-full w-full text-sm"
|
|
18
|
-
:placeholder="placeholder"
|
|
19
|
-
:multiple="isMultiple"
|
|
20
|
-
:taggable="isTaggable"
|
|
21
|
-
:push-tags="pushTags"
|
|
22
|
-
:filterable="filterable"
|
|
23
|
-
@keydown.native="handleKeydown"
|
|
24
|
-
v-model="value"
|
|
25
|
-
:options="isGrouped ? groupedArray : options"
|
|
26
|
-
@input="setSelectedOptions"
|
|
27
|
-
@search="fetchOptions"
|
|
28
|
-
@search:focus="$emit('search:focus')"
|
|
29
|
-
@option:selecting="handleSingleSelect"
|
|
30
|
-
@option:selected="($event) => (addCheckBox ? null : $event)"
|
|
31
|
-
@option:deselected="($event) => (addCheckBox ? null : $event)"
|
|
32
|
-
:label="optionLabel"
|
|
33
|
-
:clearable="clearable"
|
|
34
|
-
:loading="loading"
|
|
35
|
-
:id="id"
|
|
36
|
-
@open="onOpen"
|
|
37
|
-
@close="onClose"
|
|
38
|
-
:disabled="isDisabled"
|
|
39
|
-
:selectable="
|
|
40
|
-
isGrouped
|
|
41
|
-
? (option) => (option.header ? false : getDisableOptions(option))
|
|
42
|
-
: (option) => getDisableOptions(option)
|
|
43
|
-
"
|
|
44
|
-
:closeOnSelect="addCheckBox ? false : isGrouped ? false : true"
|
|
45
|
-
>
|
|
46
|
-
<template #open-indicator="{ attributes }">
|
|
47
|
-
<span
|
|
48
|
-
v-bind="attributes"
|
|
49
|
-
:style="!shouldIconRotate ? 'transform:none;' : ''"
|
|
50
|
-
>
|
|
51
|
-
<c-icon
|
|
52
|
-
v-if="icon"
|
|
53
|
-
:name="icon.name"
|
|
54
|
-
:type="icon.type"
|
|
55
|
-
class="h-5 w-5 text-gray-400"
|
|
56
|
-
/>
|
|
57
|
-
<c-icon
|
|
58
|
-
v-else
|
|
59
|
-
name="chevron-down"
|
|
60
|
-
type="solid"
|
|
61
|
-
class="h-5 w-5 text-gray-400"
|
|
62
|
-
/>
|
|
63
|
-
</span>
|
|
64
|
-
</template>
|
|
65
|
-
<template #selected-option="option">
|
|
66
|
-
<div v-if="!option.header" :class="['flex items-center gap-2', isDisabled ? 'text-gray-500' : '']">
|
|
67
|
-
<c-icon
|
|
68
|
-
v-if="option.icon"
|
|
69
|
-
:name="option.icon.name"
|
|
70
|
-
:type="option.icon.type"
|
|
71
|
-
:class="[
|
|
72
|
-
'h-4 w-4 flex-shrink-0 text-gray-400',
|
|
73
|
-
option.icon.optionIconClass,
|
|
74
|
-
]"
|
|
75
|
-
/>
|
|
76
|
-
<c-avatar
|
|
77
|
-
v-if="option.image && displaySelectedOptionAvatar"
|
|
78
|
-
:size="
|
|
79
|
-
option.description && showAdditionalText
|
|
80
|
-
? 'extrasmall'
|
|
81
|
-
: 'extraextrasmall'
|
|
82
|
-
"
|
|
83
|
-
:image="option.image"
|
|
84
|
-
:rounded="true"
|
|
85
|
-
:description="option.description"
|
|
86
|
-
class="mr-2"
|
|
87
|
-
></c-avatar>
|
|
88
|
-
<c-avatar
|
|
89
|
-
v-else-if="option.initials && displaySelectedOptionAvatar"
|
|
90
|
-
size="extraextrasmall"
|
|
91
|
-
:nameInitials="option.initials"
|
|
92
|
-
:description="option.description"
|
|
93
|
-
:rounded="true"
|
|
94
|
-
:isDynamicallyColored="true"
|
|
95
|
-
class="mr-2"
|
|
96
|
-
></c-avatar>
|
|
97
|
-
<span>{{
|
|
98
|
-
selectedOptionLabel && option[selectedOptionLabel]
|
|
99
|
-
? option[selectedOptionLabel]
|
|
100
|
-
: optionLabelSecondary && option[optionLabelSecondary]
|
|
101
|
-
? option[optionLabelSecondary]
|
|
102
|
-
: optionLabel && option[optionLabel]
|
|
103
|
-
? option[optionLabel]
|
|
104
|
-
: ""
|
|
105
|
-
}}</span>
|
|
106
|
-
</div>
|
|
107
|
-
</template>
|
|
108
|
-
<!-- eslint-disable-next-line vue/no-unused-vars -->
|
|
109
|
-
<template #no-options="{ search, searching, loading }">
|
|
110
|
-
<span v-if="search.length < 1"
|
|
111
|
-
>Start typing to search for options...</span
|
|
112
|
-
>
|
|
113
|
-
<span v-else>No options found, try searching something else.</span>
|
|
114
|
-
</template>
|
|
115
|
-
<template #spinner="{ loading }">
|
|
116
|
-
<svg
|
|
117
|
-
class="h-5 w-5 animate-spin text-gray-400"
|
|
118
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
119
|
-
fill="none"
|
|
120
|
-
viewBox="0 0 24 24"
|
|
121
|
-
v-if="loading"
|
|
122
|
-
>
|
|
123
|
-
<circle
|
|
124
|
-
class="opacity-25"
|
|
125
|
-
cx="12"
|
|
126
|
-
cy="12"
|
|
127
|
-
r="10"
|
|
128
|
-
stroke="currentColor"
|
|
129
|
-
stroke-width="4"
|
|
130
|
-
></circle>
|
|
131
|
-
<path
|
|
132
|
-
class="opacity-75"
|
|
133
|
-
fill="currentColor"
|
|
134
|
-
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
135
|
-
></path>
|
|
136
|
-
</svg>
|
|
137
|
-
</template>
|
|
138
|
-
<template slot="option" slot-scope="option">
|
|
139
|
-
<slot
|
|
140
|
-
name="custom-option"
|
|
141
|
-
v-bind:option="isGrouped ? option : groupedArray"
|
|
142
|
-
></slot>
|
|
143
|
-
</template>
|
|
144
|
-
<template v-slot:option="option">
|
|
145
|
-
<div v-if="!isGrouped">
|
|
146
|
-
<div v-if="option.hasNoData" class="dropdown-menu-bordered"></div>
|
|
147
|
-
<div v-else class="mt-1 flex h-full w-full items-center">
|
|
148
|
-
<p v-if="showOptionImage" class="flex-shrink-0">
|
|
149
|
-
<c-avatar
|
|
150
|
-
v-if="option[imageLabel]"
|
|
151
|
-
:size="
|
|
152
|
-
option.description && showAdditionalText
|
|
153
|
-
? 'extrasmall'
|
|
154
|
-
: 'extraextrasmall'
|
|
155
|
-
"
|
|
156
|
-
:image="option[imageLabel]"
|
|
157
|
-
:rounded="true"
|
|
158
|
-
:description="option.description"
|
|
159
|
-
class="mr-2"
|
|
160
|
-
></c-avatar>
|
|
161
|
-
<c-avatar
|
|
162
|
-
v-if="!option.icon && !option[imageLabel] && option.initials"
|
|
163
|
-
:size="
|
|
164
|
-
option.description && showAdditionalText
|
|
165
|
-
? 'extrasmall'
|
|
166
|
-
: 'extraextrasmall'
|
|
167
|
-
"
|
|
168
|
-
:nameInitials="option.initials"
|
|
169
|
-
:description="option.description"
|
|
170
|
-
:rounded="true"
|
|
171
|
-
:isDynamicallyColored="true"
|
|
172
|
-
class="mr-2"
|
|
173
|
-
></c-avatar>
|
|
174
|
-
<c-icon
|
|
175
|
-
v-if="option.icon && !option[imageLabel] && !option.initials"
|
|
176
|
-
:name="option.icon.name"
|
|
177
|
-
:type="option.icon.type"
|
|
178
|
-
:class="`mr-2 h-5 w-5 text-gray-400 ${
|
|
179
|
-
option.icon.optionIconClass
|
|
180
|
-
? option.icon.optionIconClass
|
|
181
|
-
: ''
|
|
182
|
-
}`"
|
|
183
|
-
cursorType="cursor-pointer"
|
|
184
|
-
/>
|
|
185
|
-
</p>
|
|
186
|
-
<div class="w-full">
|
|
187
|
-
<div :class="`flex items-center justify-between ${checkboxWrapperClass}`">
|
|
188
|
-
<div :class="`flex items-center ${tagWrapperClass}`">
|
|
189
|
-
<p>
|
|
190
|
-
{{
|
|
191
|
-
option[optionLabelSecondary]
|
|
192
|
-
? option[optionLabelSecondary]
|
|
193
|
-
: option[optionLabel]
|
|
194
|
-
}}
|
|
195
|
-
</p>
|
|
196
|
-
<div class="ml-3">
|
|
197
|
-
<c-tag
|
|
198
|
-
v-if="tags && option.info && option.info !== ''"
|
|
199
|
-
:label="option.info"
|
|
200
|
-
color="gray"
|
|
201
|
-
></c-tag>
|
|
202
|
-
<span v-else class="-ml-3 text-gray-300">
|
|
203
|
-
{{ option.info }}
|
|
204
|
-
</span>
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
<div @click.stop v-if="addCheckBox">
|
|
208
|
-
<c-checkbox
|
|
209
|
-
:value="isChecked(option)"
|
|
210
|
-
@onChange="handleSingleSelect(option)"
|
|
211
|
-
/>
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
<p
|
|
215
|
-
class="text-xs"
|
|
216
|
-
v-if="option.description && showAdditionalText"
|
|
217
|
-
>
|
|
218
|
-
{{ option.description }}
|
|
219
|
-
</p>
|
|
220
|
-
</div>
|
|
221
|
-
</div>
|
|
222
|
-
</div>
|
|
223
|
-
<div
|
|
224
|
-
v-if="isGrouped"
|
|
225
|
-
:class="[
|
|
226
|
-
option.header
|
|
227
|
-
? 'sticky-group-header -mx-4 -my-2 bg-gray-200 px-3 py-2'
|
|
228
|
-
: '',
|
|
229
|
-
]"
|
|
230
|
-
>
|
|
231
|
-
<v-list-subheader
|
|
232
|
-
v-if="option.header"
|
|
233
|
-
class="flex items-center gap-1 text-gray-900"
|
|
234
|
-
>
|
|
235
|
-
<c-icon
|
|
236
|
-
v-if="option.icon"
|
|
237
|
-
:name="option.icon.name"
|
|
238
|
-
:type="option.icon.type"
|
|
239
|
-
:class="`${
|
|
240
|
-
option.icon.headerIconClass
|
|
241
|
-
? option.icon.headerIconClass
|
|
242
|
-
: 'h-4 w-4'
|
|
243
|
-
} text-gray-400`"
|
|
244
|
-
/>
|
|
245
|
-
{{ option.header }}
|
|
246
|
-
</v-list-subheader>
|
|
247
|
-
<div
|
|
248
|
-
:class="[
|
|
249
|
-
'mt-1 flex h-full w-full',
|
|
250
|
-
option.description ? 'items-start' : 'items-center',
|
|
251
|
-
]"
|
|
252
|
-
>
|
|
253
|
-
<div @click.stop v-if="addCheckBox && !option.header">
|
|
254
|
-
<c-checkbox
|
|
255
|
-
:value="isChecked(option)"
|
|
256
|
-
@onChange="handleSingleSelect(option)"
|
|
257
|
-
/>
|
|
258
|
-
</div>
|
|
259
|
-
<div v-if="!option.header && showOptionImage">
|
|
260
|
-
<c-avatar
|
|
261
|
-
v-if="option.image"
|
|
262
|
-
size="extraextrasmall"
|
|
263
|
-
:image="option.image"
|
|
264
|
-
:rounded="true"
|
|
265
|
-
:description="option.description"
|
|
266
|
-
class="mr-2"
|
|
267
|
-
></c-avatar>
|
|
268
|
-
<c-avatar
|
|
269
|
-
v-else
|
|
270
|
-
size="extraextrasmall"
|
|
271
|
-
:nameInitials="option.initials"
|
|
272
|
-
:description="option.description"
|
|
273
|
-
:rounded="true"
|
|
274
|
-
:isDynamicallyColored="true"
|
|
275
|
-
class="mr-2"
|
|
276
|
-
></c-avatar>
|
|
277
|
-
</div>
|
|
278
|
-
<div class="w-full">
|
|
279
|
-
<div class="flex items-center">
|
|
280
|
-
<p>
|
|
281
|
-
{{
|
|
282
|
-
option[optionLabelSecondary]
|
|
283
|
-
? option[optionLabelSecondary]
|
|
284
|
-
: option[optionLabel]
|
|
285
|
-
}}
|
|
286
|
-
</p>
|
|
287
|
-
<div class="ml-3">
|
|
288
|
-
<span
|
|
289
|
-
v-if="tags && option.info && option.info !== ''"
|
|
290
|
-
class="inline-flex rounded-md bg-gray-400 px-2 py-px text-sm leading-5 text-white"
|
|
291
|
-
>
|
|
292
|
-
{{ option.info }}
|
|
293
|
-
</span>
|
|
294
|
-
<span v-else class="text-gray-300">
|
|
295
|
-
{{ option.info }}
|
|
296
|
-
</span>
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
|
|
300
|
-
<p class="text-xs" v-if="option.description">
|
|
301
|
-
{{ option.description }}
|
|
302
|
-
</p>
|
|
303
|
-
</div>
|
|
304
|
-
</div>
|
|
305
|
-
</div>
|
|
306
|
-
</template>
|
|
307
|
-
<template #list-footer="{ search }">
|
|
308
|
-
<li ref="load" class="loader" v-show="hasNextPage">
|
|
309
|
-
Loading more options...
|
|
310
|
-
</li>
|
|
311
|
-
<div
|
|
312
|
-
class="group sticky bottom-0 mt-1 bg-white"
|
|
313
|
-
:class="showFooterButton && showFooterButton2 ? 'space-y-2' : ''"
|
|
314
|
-
>
|
|
315
|
-
<li
|
|
316
|
-
v-if="showFooterButton"
|
|
317
|
-
:class="footerBtnClasses"
|
|
318
|
-
class="cursor-pointer select-none bg-gray-50 py-2 pl-3 pr-9 text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
319
|
-
:id="getActionIDFn(footerButtonText)"
|
|
320
|
-
role="option"
|
|
321
|
-
@click="$emit('footerButtonClick')"
|
|
322
|
-
>
|
|
323
|
-
<div class="flex items-center">
|
|
324
|
-
<svg
|
|
325
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
326
|
-
class="h-6 w-6 flex-shrink-0 text-gray-400"
|
|
327
|
-
viewBox="0 0 20 20"
|
|
328
|
-
fill="currentColor"
|
|
329
|
-
>
|
|
330
|
-
<path
|
|
331
|
-
fill-rule="evenodd"
|
|
332
|
-
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z"
|
|
333
|
-
clip-rule="evenodd"
|
|
334
|
-
/>
|
|
335
|
-
</svg>
|
|
336
|
-
<span class="ml-3 block truncate font-semibold">
|
|
337
|
-
{{ footerButtonText }}
|
|
338
|
-
</span>
|
|
339
|
-
</div>
|
|
340
|
-
</li>
|
|
341
|
-
<li
|
|
342
|
-
v-if="showFooterButton2"
|
|
343
|
-
class="cursor-pointer select-none bg-gray-50 py-2 pl-3 pr-9 text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
344
|
-
:class="footerBtnClasses2"
|
|
345
|
-
:id="getActionIDFn(footerButtonText2)"
|
|
346
|
-
role="option"
|
|
347
|
-
@click="$emit('footerButtonClick2')"
|
|
348
|
-
>
|
|
349
|
-
<div class="flex items-center">
|
|
350
|
-
<svg
|
|
351
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
352
|
-
class="h-6 w-6 flex-shrink-0 text-gray-400"
|
|
353
|
-
viewBox="0 0 20 20"
|
|
354
|
-
fill="currentColor"
|
|
355
|
-
>
|
|
356
|
-
<path
|
|
357
|
-
fill-rule="evenodd"
|
|
358
|
-
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z"
|
|
359
|
-
clip-rule="evenodd"
|
|
360
|
-
/>
|
|
361
|
-
</svg>
|
|
362
|
-
<span class="ml-3 block truncate font-semibold">
|
|
363
|
-
{{ footerButtonText2 }}
|
|
364
|
-
</span>
|
|
365
|
-
</div>
|
|
366
|
-
</li>
|
|
367
|
-
</div>
|
|
368
|
-
<div
|
|
369
|
-
v-if="
|
|
370
|
-
showCreateOption &&
|
|
371
|
-
showCreateOptionAfterSearch &&
|
|
372
|
-
search &&
|
|
373
|
-
search.trim()
|
|
374
|
-
"
|
|
375
|
-
class="sticky bottom-0 z-10 flex min-h-[44px] items-start gap-3 rounded-b-md bg-white px-3 py-2 shadow-lg ring-1 ring-gray-900 ring-opacity-5"
|
|
376
|
-
>
|
|
377
|
-
<span class="word-break flex-1 text-sm text-gray-700">{{
|
|
378
|
-
search
|
|
379
|
-
}}</span>
|
|
380
|
-
|
|
381
|
-
<button
|
|
382
|
-
type="button"
|
|
383
|
-
:id="id + '_create_button'"
|
|
384
|
-
@mousedown="handleCreateOption($event, search)"
|
|
385
|
-
class="flex items-center gap-1 text-sm text-indigo-700"
|
|
386
|
-
>
|
|
387
|
-
<c-icon
|
|
388
|
-
type="solid"
|
|
389
|
-
name="plus-circle-solid-v2"
|
|
390
|
-
class="h-5 w-5 text-indigo-600"
|
|
391
|
-
viewBox="0 0 24 24"
|
|
392
|
-
></c-icon>
|
|
393
|
-
Create
|
|
394
|
-
</button>
|
|
395
|
-
</div>
|
|
396
|
-
<div
|
|
397
|
-
v-if="otherOption"
|
|
398
|
-
class="sticky bottom-0 z-10 border-t border-gray-100 bg-gray-50 px-3 py-2"
|
|
399
|
-
>
|
|
400
|
-
<div class="flex" @mousedown.prevent.stop>
|
|
401
|
-
<c-checkbox
|
|
402
|
-
:value="isChecked(otherOption)"
|
|
403
|
-
@onChange="handleOtherOptionChange"
|
|
404
|
-
/>
|
|
405
|
-
<div class="flex-1" @click.stop="handleOtherOptionChange">
|
|
406
|
-
<p class="text-sm font-medium text-gray-700">
|
|
407
|
-
{{ otherOption[optionLabel] }}
|
|
408
|
-
</p>
|
|
409
|
-
<p class="mt-1 text-sm text-gray-500">
|
|
410
|
-
{{ otherOption.description }}
|
|
411
|
-
</p>
|
|
412
|
-
</div>
|
|
413
|
-
</div>
|
|
414
|
-
</div>
|
|
415
|
-
</template>
|
|
416
|
-
</v-select>
|
|
417
|
-
<button
|
|
418
|
-
class="absolute top-2.5 right-10 z-100"
|
|
419
|
-
:id="id + '_close_button'"
|
|
420
|
-
v-if="showCloseButton && (value == null || value.length == 0)"
|
|
421
|
-
@click.stop="handleCrossClick"
|
|
422
|
-
>
|
|
423
|
-
<c-icon
|
|
424
|
-
name="close"
|
|
425
|
-
type="outline-v2"
|
|
426
|
-
class="h-4 w-4 text-gray-400"
|
|
427
|
-
cursorType="cursor-pointer"
|
|
428
|
-
/>
|
|
429
|
-
</button>
|
|
430
|
-
</div>
|
|
431
|
-
<p v-if="subLabel" class="mt-2 text-sm text-gray-500">{{ subLabel }}</p>
|
|
432
|
-
<p v-if="!isValidate && errorMessage" class="mt-2 text-sm text-red-600 text-left">
|
|
433
|
-
{{ errorMessage }}
|
|
434
|
-
</p>
|
|
435
|
-
<p v-if="helpText && isValidate == true" class="mt-2 text-sm text-gray-500">
|
|
436
|
-
{{ helpText }}
|
|
437
|
-
</p>
|
|
438
|
-
</div>
|
|
439
|
-
</template>
|
|
440
|
-
<script>
|
|
441
|
-
import vSelect from "vue-select";
|
|
442
|
-
import CAvatar from "../CAvatar/CAvatar.vue";
|
|
443
|
-
import CIcon from "../CIcon/CIcon.vue";
|
|
444
|
-
import CCheckbox from "../CCheckbox/CCheckbox.vue";
|
|
445
|
-
import { debounce } from "lodash-es";
|
|
446
|
-
// import Fuse from "fuse.js";
|
|
447
|
-
import "vue-select/dist/vue-select.css";
|
|
448
|
-
import { getActionID } from "../../helper";
|
|
449
|
-
import CTag from "../CTag/CTag.vue";
|
|
450
|
-
export default {
|
|
451
|
-
name: "CMultiselect",
|
|
452
|
-
components: { vSelect, CAvatar, CCheckbox, CIcon, CTag },
|
|
453
|
-
props: {
|
|
454
|
-
id: {
|
|
455
|
-
type: String,
|
|
456
|
-
},
|
|
457
|
-
options: {
|
|
458
|
-
type: Array,
|
|
459
|
-
required: true,
|
|
460
|
-
},
|
|
461
|
-
extraDetails: {
|
|
462
|
-
type: Boolean,
|
|
463
|
-
default: false,
|
|
464
|
-
},
|
|
465
|
-
displaySelectedOptionAvatar: {
|
|
466
|
-
type: Boolean,
|
|
467
|
-
default: false,
|
|
468
|
-
},
|
|
469
|
-
showFooterButton: {
|
|
470
|
-
type: Boolean,
|
|
471
|
-
default: false,
|
|
472
|
-
},
|
|
473
|
-
footerButtonText: {
|
|
474
|
-
type: String,
|
|
475
|
-
default: "",
|
|
476
|
-
},
|
|
477
|
-
label: String,
|
|
478
|
-
isRequired: {
|
|
479
|
-
type: Boolean,
|
|
480
|
-
},
|
|
481
|
-
subLabel: String,
|
|
482
|
-
placeholder: {
|
|
483
|
-
type: String,
|
|
484
|
-
},
|
|
485
|
-
// whether multiple fields are allowed or not
|
|
486
|
-
isMultiple: {
|
|
487
|
-
type: Boolean,
|
|
488
|
-
},
|
|
489
|
-
// append newly created tags in options
|
|
490
|
-
pushTags: {
|
|
491
|
-
type: Boolean,
|
|
492
|
-
},
|
|
493
|
-
// whether to allow user to create new options
|
|
494
|
-
isTaggable: {
|
|
495
|
-
type: Boolean,
|
|
496
|
-
},
|
|
497
|
-
getOptions: {
|
|
498
|
-
// function to emit on search{
|
|
499
|
-
type: Function,
|
|
500
|
-
},
|
|
501
|
-
customiseOption: {
|
|
502
|
-
type: Boolean,
|
|
503
|
-
},
|
|
504
|
-
// whether to show profile picture in option
|
|
505
|
-
showOptionImage: {
|
|
506
|
-
type: Boolean,
|
|
507
|
-
},
|
|
508
|
-
// the name of the option to render in the selectpicker
|
|
509
|
-
optionLabel: {
|
|
510
|
-
type: String,
|
|
511
|
-
},
|
|
512
|
-
// the name of the option to render in the selectpicker
|
|
513
|
-
optionLabelSecondary: {
|
|
514
|
-
type: String,
|
|
515
|
-
},
|
|
516
|
-
selectedOptionLabel: {
|
|
517
|
-
type: String,
|
|
518
|
-
},
|
|
519
|
-
// action to trigger after selecting option from dropdown
|
|
520
|
-
onSelectOptions: {
|
|
521
|
-
type: Function,
|
|
522
|
-
},
|
|
523
|
-
optionsSelected: {
|
|
524
|
-
type: [Array, Object],
|
|
525
|
-
},
|
|
526
|
-
filterable: {
|
|
527
|
-
type: Boolean,
|
|
528
|
-
default: false,
|
|
529
|
-
},
|
|
530
|
-
clearable: {
|
|
531
|
-
type: Boolean,
|
|
532
|
-
default: true,
|
|
533
|
-
},
|
|
534
|
-
isValidate: {
|
|
535
|
-
type: Boolean,
|
|
536
|
-
default: true,
|
|
537
|
-
},
|
|
538
|
-
errorMessage: {
|
|
539
|
-
type: String,
|
|
540
|
-
},
|
|
541
|
-
loading: {
|
|
542
|
-
type: Boolean,
|
|
543
|
-
default: false,
|
|
544
|
-
},
|
|
545
|
-
hasNextPage: {
|
|
546
|
-
type: Boolean,
|
|
547
|
-
default: false,
|
|
548
|
-
},
|
|
549
|
-
isDisabled: {
|
|
550
|
-
type: Boolean,
|
|
551
|
-
default: false,
|
|
552
|
-
},
|
|
553
|
-
// text adjacent to label of dropdown to provide hint about field
|
|
554
|
-
hint: { type: String },
|
|
555
|
-
helpText: {
|
|
556
|
-
type: String,
|
|
557
|
-
},
|
|
558
|
-
tags: {
|
|
559
|
-
type: Boolean,
|
|
560
|
-
default: false,
|
|
561
|
-
},
|
|
562
|
-
isGrouped: {
|
|
563
|
-
type: Boolean,
|
|
564
|
-
default: false,
|
|
565
|
-
},
|
|
566
|
-
//to show the additional text, default true to prevent failure at any other place
|
|
567
|
-
showAdditionalText: {
|
|
568
|
-
type: Boolean,
|
|
569
|
-
default: true,
|
|
570
|
-
},
|
|
571
|
-
addCheckBox: {
|
|
572
|
-
type: Boolean,
|
|
573
|
-
default: false,
|
|
574
|
-
},
|
|
575
|
-
showSelectedAvatar: {
|
|
576
|
-
type: Boolean,
|
|
577
|
-
default: false,
|
|
578
|
-
},
|
|
579
|
-
icon: {
|
|
580
|
-
type: Object,
|
|
581
|
-
},
|
|
582
|
-
footerBtnClasses: {
|
|
583
|
-
type: String,
|
|
584
|
-
},
|
|
585
|
-
shouldIconRotate: {
|
|
586
|
-
type: Boolean,
|
|
587
|
-
default: true,
|
|
588
|
-
},
|
|
589
|
-
imageLabel: {
|
|
590
|
-
type: String,
|
|
591
|
-
default: "image",
|
|
592
|
-
},
|
|
593
|
-
showFooterButton2: {
|
|
594
|
-
type: Boolean,
|
|
595
|
-
default: false,
|
|
596
|
-
},
|
|
597
|
-
footerButtonText2: {
|
|
598
|
-
type: String,
|
|
599
|
-
default: "",
|
|
600
|
-
},
|
|
601
|
-
footerBtnClasses2: {
|
|
602
|
-
type: String,
|
|
603
|
-
},
|
|
604
|
-
showCloseButton: {
|
|
605
|
-
type: Boolean,
|
|
606
|
-
default: false,
|
|
607
|
-
},
|
|
608
|
-
showCreateOption: {
|
|
609
|
-
type: Boolean,
|
|
610
|
-
default: false,
|
|
611
|
-
},
|
|
612
|
-
otherOption: {
|
|
613
|
-
type: Object,
|
|
614
|
-
},
|
|
615
|
-
tagWrapperClass: {
|
|
616
|
-
type: String,
|
|
617
|
-
default: "",
|
|
618
|
-
},
|
|
619
|
-
checkboxWrapperClass: {
|
|
620
|
-
type: String,
|
|
621
|
-
default: "",
|
|
622
|
-
},
|
|
623
|
-
},
|
|
624
|
-
computed: {
|
|
625
|
-
groupedArray() {
|
|
626
|
-
const groups = {};
|
|
627
|
-
|
|
628
|
-
this.options.forEach((x) => {
|
|
629
|
-
// create empty object if it doesn't exists.
|
|
630
|
-
groups[x.category] = groups[x.category] || {
|
|
631
|
-
text: x.category,
|
|
632
|
-
list: [],
|
|
633
|
-
...(x.icon ? { icon: x.icon } : {}),
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
groups[x.category].list.push(x);
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
// The flattened list of items that holds items as well as unique headers
|
|
640
|
-
const flattened = [];
|
|
641
|
-
|
|
642
|
-
// Iterate over all the unique categories and
|
|
643
|
-
// then flatten into a list that v-select needs.
|
|
644
|
-
Object.keys(groups).forEach((categoryId) => {
|
|
645
|
-
const category = groups[categoryId];
|
|
646
|
-
const categoryName = category.text;
|
|
647
|
-
|
|
648
|
-
// Create a group
|
|
649
|
-
flattened.push({
|
|
650
|
-
header: categoryName,
|
|
651
|
-
...(category.icon ? { icon: category.icon } : {}),
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
// Add all the items followed by category header
|
|
655
|
-
flattened.push(...category.list);
|
|
656
|
-
});
|
|
657
|
-
|
|
658
|
-
return flattened;
|
|
659
|
-
},
|
|
660
|
-
showCreateOptionAfterSearch() {
|
|
661
|
-
if (!this.showCreateOption) return false;
|
|
662
|
-
|
|
663
|
-
// Get current search term from v-select
|
|
664
|
-
const vSelectRef = this.$refs.vselect;
|
|
665
|
-
const search = (vSelectRef && vSelectRef.search) || "";
|
|
666
|
-
const term = search.trim().toLowerCase();
|
|
667
|
-
if (!term) return false;
|
|
668
|
-
|
|
669
|
-
// Check if any options exactly match the search term
|
|
670
|
-
const hasExactMatch = this.options.some((option) => {
|
|
671
|
-
const label = option[this.optionLabel];
|
|
672
|
-
return label && String(label).toLowerCase() === term;
|
|
673
|
-
});
|
|
674
|
-
|
|
675
|
-
return !hasExactMatch;
|
|
676
|
-
},
|
|
677
|
-
},
|
|
678
|
-
data() {
|
|
679
|
-
return {
|
|
680
|
-
loaderSearching: true,
|
|
681
|
-
value:
|
|
682
|
-
this.optionsSelected && this.optionsSelected.length
|
|
683
|
-
? this.optionsSelected
|
|
684
|
-
: [],
|
|
685
|
-
observer: null,
|
|
686
|
-
};
|
|
687
|
-
},
|
|
688
|
-
methods: {
|
|
689
|
-
getActionIDFn(name) {
|
|
690
|
-
return getActionID(name, this.id);
|
|
691
|
-
},
|
|
692
|
-
handleCrossClick(event) {
|
|
693
|
-
event.preventDefault();
|
|
694
|
-
this.$emit("hide-multiselect-dropdown");
|
|
695
|
-
},
|
|
696
|
-
fetchOptions(search, loaderSearching) {
|
|
697
|
-
this.emitGetOptions(search, loaderSearching);
|
|
698
|
-
},
|
|
699
|
-
emitGetOptions: debounce(function (search, loaderSearching) {
|
|
700
|
-
this.$emit("getOptions", search.trim(), loaderSearching);
|
|
701
|
-
}, 300),
|
|
702
|
-
setSelectedOptions(params) {
|
|
703
|
-
this.value = params;
|
|
704
|
-
this.$emit("onSelectOptions", params);
|
|
705
|
-
},
|
|
706
|
-
async onOpen() {
|
|
707
|
-
if (this.hasNextPage) {
|
|
708
|
-
await this.$nextTick();
|
|
709
|
-
if (this.$refs ? this.$refs.load : false && this.observer) {
|
|
710
|
-
this.observer.observe(this.$refs.load);
|
|
711
|
-
} else {
|
|
712
|
-
setTimeout(() => {
|
|
713
|
-
this.onOpen();
|
|
714
|
-
}, 500);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
this.emitGetOptions("", true);
|
|
718
|
-
},
|
|
719
|
-
onClose() {
|
|
720
|
-
this.observer.disconnect();
|
|
721
|
-
},
|
|
722
|
-
async infiniteScroll([{ isIntersecting }]) {
|
|
723
|
-
if (isIntersecting) {
|
|
724
|
-
this.emitLoadNextPage();
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
getIndex(option) {
|
|
728
|
-
return this.value.findIndex((item) => item.id == option.id);
|
|
729
|
-
},
|
|
730
|
-
isChecked(option) {
|
|
731
|
-
return this.value.findIndex((item) => item.id == option.id) == -1 ? 0 : 1;
|
|
732
|
-
},
|
|
733
|
-
handleSingleSelect(option) {
|
|
734
|
-
if (this.addCheckBox) {
|
|
735
|
-
if (this.isChecked(option) == 1) {
|
|
736
|
-
this.value = this.value.filter((item) => item.id != option.id);
|
|
737
|
-
} else {
|
|
738
|
-
this.value = [...this.value, option];
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
this.$emit("onSelectOptions", this.value);
|
|
742
|
-
|
|
743
|
-
return false;
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
handleOtherOptionChange() {
|
|
747
|
-
const isSelected = this.isChecked(this.otherOption) == 1;
|
|
748
|
-
if (isSelected) {
|
|
749
|
-
this.value = this.value.filter(
|
|
750
|
-
(item) => item.id != this.otherOption.id
|
|
751
|
-
);
|
|
752
|
-
} else {
|
|
753
|
-
this.value = [...this.value, this.otherOption];
|
|
754
|
-
}
|
|
755
|
-
this.$emit("onSelectOptions", this.value);
|
|
756
|
-
|
|
757
|
-
this.$nextTick(() => {
|
|
758
|
-
if (this.$refs.vselect) {
|
|
759
|
-
this.$refs.vselect.open = false;
|
|
760
|
-
this.$refs.vselect.search = "";
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
const input = this.$refs.vselect.$el.querySelector("input");
|
|
764
|
-
if (input) {
|
|
765
|
-
input.blur();
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
},
|
|
769
|
-
getDisableOptions(option) {
|
|
770
|
-
if (!option) return true;
|
|
771
|
-
if (option.header) return false;
|
|
772
|
-
if (option.isDisabled || option.disabled) return false;
|
|
773
|
-
return true;
|
|
774
|
-
},
|
|
775
|
-
|
|
776
|
-
// a function that will set the location when the component has mounted and the location is passed after that
|
|
777
|
-
forceSetData(params) {
|
|
778
|
-
this.value = params;
|
|
779
|
-
},
|
|
780
|
-
emitLoadNextPage: debounce(function () {
|
|
781
|
-
this.$emit("loadNextPage");
|
|
782
|
-
}, 300),
|
|
783
|
-
handleCreateOption(event, searchText) {
|
|
784
|
-
event.preventDefault();
|
|
785
|
-
|
|
786
|
-
this.$emit("handleCreateOption", {
|
|
787
|
-
event,
|
|
788
|
-
searchText: searchText.trim(),
|
|
789
|
-
});
|
|
790
|
-
this.$refs.vselect.open = false;
|
|
791
|
-
this.$refs.vselect.search = "";
|
|
792
|
-
|
|
793
|
-
this.$nextTick(() => {
|
|
794
|
-
const input = this.$refs.vselect.$el.querySelector("input");
|
|
795
|
-
if (input) {
|
|
796
|
-
input.blur();
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
},
|
|
800
|
-
handleKeydown(event) {
|
|
801
|
-
if (event.key === "Enter") {
|
|
802
|
-
event.preventDefault();
|
|
803
|
-
event.stopPropagation();
|
|
804
|
-
|
|
805
|
-
const vSelectRef = this.$refs.vselect;
|
|
806
|
-
const search = (vSelectRef && vSelectRef.search) || "";
|
|
807
|
-
|
|
808
|
-
if (
|
|
809
|
-
this.showCreateOption &&
|
|
810
|
-
this.showCreateOptionAfterSearch &&
|
|
811
|
-
search &&
|
|
812
|
-
search.trim()
|
|
813
|
-
) {
|
|
814
|
-
this.handleCreateOption(event, search.trim());
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
},
|
|
819
|
-
watch: {
|
|
820
|
-
optionsSelected: {
|
|
821
|
-
handler(newVal) {
|
|
822
|
-
this.value = newVal;
|
|
823
|
-
},
|
|
824
|
-
deep: true,
|
|
825
|
-
},
|
|
826
|
-
},
|
|
827
|
-
mounted() {
|
|
828
|
-
this.observer = new IntersectionObserver(this.infiniteScroll);
|
|
829
|
-
},
|
|
830
|
-
};
|
|
831
|
-
</script>
|
|
832
|
-
<style>
|
|
833
|
-
.disabled {
|
|
834
|
-
pointer-events: none;
|
|
835
|
-
color: #bfcbd9;
|
|
836
|
-
cursor: not-allowed;
|
|
837
|
-
background-image: none;
|
|
838
|
-
background-color: #eef1f6;
|
|
839
|
-
border-color: #d1dbe5;
|
|
840
|
-
}
|
|
841
|
-
.v-select {
|
|
842
|
-
@apply cursor-pointer;
|
|
843
|
-
}
|
|
844
|
-
.vs__dropdown-toggle {
|
|
845
|
-
@apply w-full min-h-[36px] rounded-md border border-gray-300 bg-white px-3 py-2 text-left shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 sm:text-sm;
|
|
846
|
-
}
|
|
847
|
-
.vs__selected-options {
|
|
848
|
-
flex-wrap: wrap !important;
|
|
849
|
-
height: auto;
|
|
850
|
-
max-height: 60px;
|
|
851
|
-
overflow: hidden;
|
|
852
|
-
overflow-y: auto;
|
|
853
|
-
}
|
|
854
|
-
.vs--open .vs__dropdown-toggle {
|
|
855
|
-
border-bottom-color: rgba(212, 212, 216, var(--tw-border-opacity));
|
|
856
|
-
@apply rounded-b-md;
|
|
857
|
-
}
|
|
858
|
-
.vs__selected {
|
|
859
|
-
@apply m-0 border-none text-gray-700;
|
|
860
|
-
}
|
|
861
|
-
.extra:hover {
|
|
862
|
-
color: white;
|
|
863
|
-
}
|
|
864
|
-
.vs__search,
|
|
865
|
-
.vs__search:focus {
|
|
866
|
-
@apply m-0 p-0;
|
|
867
|
-
}
|
|
868
|
-
.vs__search::placeholder {
|
|
869
|
-
@apply text-gray-500;
|
|
870
|
-
}
|
|
871
|
-
.vs__actions {
|
|
872
|
-
@apply p-0;
|
|
873
|
-
}
|
|
874
|
-
.vs__dropdown-menu {
|
|
875
|
-
@apply mt-2 max-h-60 overflow-auto rounded-md bg-white py-0 text-base shadow-lg ring-1 ring-opacity-5 focus:outline-none sm:text-sm;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
.dropdown-menu-bordered {
|
|
879
|
-
@apply border-b border-gray-200;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
.vs__dropdown-menu li {
|
|
883
|
-
min-height: fit-content;
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
.vs__dropdown-menu li:has(.sticky-group-header) {
|
|
887
|
-
@apply sticky top-0 z-10 bg-gray-200;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
/* Remove li padding if it contains a bordered option */
|
|
891
|
-
.vs__dropdown-menu li:has(.dropdown-menu-bordered) {
|
|
892
|
-
padding: 0 !important;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
.vs__dropdown-option {
|
|
896
|
-
@apply whitespace-normal !px-3 !py-2 text-gray-700;
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
.vs__dropdown-toggle.vs__dropdown-option--highlight {
|
|
900
|
-
@apply bg-indigo-700 text-white;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
.vs__dropdown-option--highlight {
|
|
904
|
-
@apply bg-indigo-700 text-white;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
.vs__dropdown-option--disabled {
|
|
908
|
-
@apply !text-gray-500 !bg-gray-50 !border-gray-200 shadow-none opacity-100 cursor-not-allowed;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
.vs__dropdown-option--disabled * {
|
|
912
|
-
@apply text-gray-500;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
.vs__dropdown-menu li {
|
|
916
|
-
@apply opacity-100;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
.v-list-subheader {
|
|
920
|
-
@apply pointer-events-none opacity-100;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
.vs__dropdown-toggle {
|
|
924
|
-
height: 100%;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
.vs__no-options {
|
|
928
|
-
@apply px-4 py-3 text-sm text-gray-500;
|
|
929
|
-
}
|
|
930
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="mb-1 flex w-full items-center justify-between" v-if="label">
|
|
4
|
+
<div class="flex items-center">
|
|
5
|
+
<!-- label of multiselect field -->
|
|
6
|
+
<label v-if="label" class="text-sm font-medium text-gray-900">{{
|
|
7
|
+
label
|
|
8
|
+
}}</label>
|
|
9
|
+
<!-- asterisk sign to render if field is required -->
|
|
10
|
+
<p v-if="isRequired" class="ml-1 text-red-600">*</p>
|
|
11
|
+
</div>
|
|
12
|
+
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="relative">
|
|
15
|
+
<v-select
|
|
16
|
+
ref="vselect"
|
|
17
|
+
class="disabled:custom-disabled-state absolute inline-block h-full w-full text-sm"
|
|
18
|
+
:placeholder="placeholder"
|
|
19
|
+
:multiple="isMultiple"
|
|
20
|
+
:taggable="isTaggable"
|
|
21
|
+
:push-tags="pushTags"
|
|
22
|
+
:filterable="filterable"
|
|
23
|
+
@keydown.native="handleKeydown"
|
|
24
|
+
v-model="value"
|
|
25
|
+
:options="isGrouped ? groupedArray : options"
|
|
26
|
+
@input="setSelectedOptions"
|
|
27
|
+
@search="fetchOptions"
|
|
28
|
+
@search:focus="$emit('search:focus')"
|
|
29
|
+
@option:selecting="handleSingleSelect"
|
|
30
|
+
@option:selected="($event) => (addCheckBox ? null : $event)"
|
|
31
|
+
@option:deselected="($event) => (addCheckBox ? null : $event)"
|
|
32
|
+
:label="optionLabel"
|
|
33
|
+
:clearable="clearable"
|
|
34
|
+
:loading="loading"
|
|
35
|
+
:id="id"
|
|
36
|
+
@open="onOpen"
|
|
37
|
+
@close="onClose"
|
|
38
|
+
:disabled="isDisabled"
|
|
39
|
+
:selectable="
|
|
40
|
+
isGrouped
|
|
41
|
+
? (option) => (option.header ? false : getDisableOptions(option))
|
|
42
|
+
: (option) => getDisableOptions(option)
|
|
43
|
+
"
|
|
44
|
+
:closeOnSelect="addCheckBox ? false : isGrouped ? false : true"
|
|
45
|
+
>
|
|
46
|
+
<template #open-indicator="{ attributes }">
|
|
47
|
+
<span
|
|
48
|
+
v-bind="attributes"
|
|
49
|
+
:style="!shouldIconRotate ? 'transform:none;' : ''"
|
|
50
|
+
>
|
|
51
|
+
<c-icon
|
|
52
|
+
v-if="icon"
|
|
53
|
+
:name="icon.name"
|
|
54
|
+
:type="icon.type"
|
|
55
|
+
class="h-5 w-5 text-gray-400"
|
|
56
|
+
/>
|
|
57
|
+
<c-icon
|
|
58
|
+
v-else
|
|
59
|
+
name="chevron-down"
|
|
60
|
+
type="solid"
|
|
61
|
+
class="h-5 w-5 text-gray-400"
|
|
62
|
+
/>
|
|
63
|
+
</span>
|
|
64
|
+
</template>
|
|
65
|
+
<template #selected-option="option">
|
|
66
|
+
<div v-if="!option.header" :class="['flex items-center gap-2', isDisabled ? 'text-gray-500' : '']">
|
|
67
|
+
<c-icon
|
|
68
|
+
v-if="option.icon"
|
|
69
|
+
:name="option.icon.name"
|
|
70
|
+
:type="option.icon.type"
|
|
71
|
+
:class="[
|
|
72
|
+
'h-4 w-4 flex-shrink-0 text-gray-400',
|
|
73
|
+
option.icon.optionIconClass,
|
|
74
|
+
]"
|
|
75
|
+
/>
|
|
76
|
+
<c-avatar
|
|
77
|
+
v-if="option.image && displaySelectedOptionAvatar"
|
|
78
|
+
:size="
|
|
79
|
+
option.description && showAdditionalText
|
|
80
|
+
? 'extrasmall'
|
|
81
|
+
: 'extraextrasmall'
|
|
82
|
+
"
|
|
83
|
+
:image="option.image"
|
|
84
|
+
:rounded="true"
|
|
85
|
+
:description="option.description"
|
|
86
|
+
class="mr-2"
|
|
87
|
+
></c-avatar>
|
|
88
|
+
<c-avatar
|
|
89
|
+
v-else-if="option.initials && displaySelectedOptionAvatar"
|
|
90
|
+
size="extraextrasmall"
|
|
91
|
+
:nameInitials="option.initials"
|
|
92
|
+
:description="option.description"
|
|
93
|
+
:rounded="true"
|
|
94
|
+
:isDynamicallyColored="true"
|
|
95
|
+
class="mr-2"
|
|
96
|
+
></c-avatar>
|
|
97
|
+
<span>{{
|
|
98
|
+
selectedOptionLabel && option[selectedOptionLabel]
|
|
99
|
+
? option[selectedOptionLabel]
|
|
100
|
+
: optionLabelSecondary && option[optionLabelSecondary]
|
|
101
|
+
? option[optionLabelSecondary]
|
|
102
|
+
: optionLabel && option[optionLabel]
|
|
103
|
+
? option[optionLabel]
|
|
104
|
+
: ""
|
|
105
|
+
}}</span>
|
|
106
|
+
</div>
|
|
107
|
+
</template>
|
|
108
|
+
<!-- eslint-disable-next-line vue/no-unused-vars -->
|
|
109
|
+
<template #no-options="{ search, searching, loading }">
|
|
110
|
+
<span v-if="search.length < 1"
|
|
111
|
+
>Start typing to search for options...</span
|
|
112
|
+
>
|
|
113
|
+
<span v-else>No options found, try searching something else.</span>
|
|
114
|
+
</template>
|
|
115
|
+
<template #spinner="{ loading }">
|
|
116
|
+
<svg
|
|
117
|
+
class="h-5 w-5 animate-spin text-gray-400"
|
|
118
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
119
|
+
fill="none"
|
|
120
|
+
viewBox="0 0 24 24"
|
|
121
|
+
v-if="loading"
|
|
122
|
+
>
|
|
123
|
+
<circle
|
|
124
|
+
class="opacity-25"
|
|
125
|
+
cx="12"
|
|
126
|
+
cy="12"
|
|
127
|
+
r="10"
|
|
128
|
+
stroke="currentColor"
|
|
129
|
+
stroke-width="4"
|
|
130
|
+
></circle>
|
|
131
|
+
<path
|
|
132
|
+
class="opacity-75"
|
|
133
|
+
fill="currentColor"
|
|
134
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
135
|
+
></path>
|
|
136
|
+
</svg>
|
|
137
|
+
</template>
|
|
138
|
+
<template slot="option" slot-scope="option">
|
|
139
|
+
<slot
|
|
140
|
+
name="custom-option"
|
|
141
|
+
v-bind:option="isGrouped ? option : groupedArray"
|
|
142
|
+
></slot>
|
|
143
|
+
</template>
|
|
144
|
+
<template v-slot:option="option">
|
|
145
|
+
<div v-if="!isGrouped">
|
|
146
|
+
<div v-if="option.hasNoData" class="dropdown-menu-bordered"></div>
|
|
147
|
+
<div v-else class="mt-1 flex h-full w-full items-center">
|
|
148
|
+
<p v-if="showOptionImage" class="flex-shrink-0">
|
|
149
|
+
<c-avatar
|
|
150
|
+
v-if="option[imageLabel]"
|
|
151
|
+
:size="
|
|
152
|
+
option.description && showAdditionalText
|
|
153
|
+
? 'extrasmall'
|
|
154
|
+
: 'extraextrasmall'
|
|
155
|
+
"
|
|
156
|
+
:image="option[imageLabel]"
|
|
157
|
+
:rounded="true"
|
|
158
|
+
:description="option.description"
|
|
159
|
+
class="mr-2"
|
|
160
|
+
></c-avatar>
|
|
161
|
+
<c-avatar
|
|
162
|
+
v-if="!option.icon && !option[imageLabel] && option.initials"
|
|
163
|
+
:size="
|
|
164
|
+
option.description && showAdditionalText
|
|
165
|
+
? 'extrasmall'
|
|
166
|
+
: 'extraextrasmall'
|
|
167
|
+
"
|
|
168
|
+
:nameInitials="option.initials"
|
|
169
|
+
:description="option.description"
|
|
170
|
+
:rounded="true"
|
|
171
|
+
:isDynamicallyColored="true"
|
|
172
|
+
class="mr-2"
|
|
173
|
+
></c-avatar>
|
|
174
|
+
<c-icon
|
|
175
|
+
v-if="option.icon && !option[imageLabel] && !option.initials"
|
|
176
|
+
:name="option.icon.name"
|
|
177
|
+
:type="option.icon.type"
|
|
178
|
+
:class="`mr-2 h-5 w-5 text-gray-400 ${
|
|
179
|
+
option.icon.optionIconClass
|
|
180
|
+
? option.icon.optionIconClass
|
|
181
|
+
: ''
|
|
182
|
+
}`"
|
|
183
|
+
cursorType="cursor-pointer"
|
|
184
|
+
/>
|
|
185
|
+
</p>
|
|
186
|
+
<div class="w-full">
|
|
187
|
+
<div :class="`flex items-center justify-between ${checkboxWrapperClass}`">
|
|
188
|
+
<div :class="`flex items-center ${tagWrapperClass}`">
|
|
189
|
+
<p>
|
|
190
|
+
{{
|
|
191
|
+
option[optionLabelSecondary]
|
|
192
|
+
? option[optionLabelSecondary]
|
|
193
|
+
: option[optionLabel]
|
|
194
|
+
}}
|
|
195
|
+
</p>
|
|
196
|
+
<div class="ml-3">
|
|
197
|
+
<c-tag
|
|
198
|
+
v-if="tags && option.info && option.info !== ''"
|
|
199
|
+
:label="option.info"
|
|
200
|
+
color="gray"
|
|
201
|
+
></c-tag>
|
|
202
|
+
<span v-else class="-ml-3 text-gray-300">
|
|
203
|
+
{{ option.info }}
|
|
204
|
+
</span>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
<div @click.stop v-if="addCheckBox">
|
|
208
|
+
<c-checkbox
|
|
209
|
+
:value="isChecked(option)"
|
|
210
|
+
@onChange="handleSingleSelect(option)"
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
<p
|
|
215
|
+
class="text-xs"
|
|
216
|
+
v-if="option.description && showAdditionalText"
|
|
217
|
+
>
|
|
218
|
+
{{ option.description }}
|
|
219
|
+
</p>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
<div
|
|
224
|
+
v-if="isGrouped"
|
|
225
|
+
:class="[
|
|
226
|
+
option.header
|
|
227
|
+
? 'sticky-group-header -mx-4 -my-2 bg-gray-200 px-3 py-2'
|
|
228
|
+
: '',
|
|
229
|
+
]"
|
|
230
|
+
>
|
|
231
|
+
<v-list-subheader
|
|
232
|
+
v-if="option.header"
|
|
233
|
+
class="flex items-center gap-1 text-gray-900"
|
|
234
|
+
>
|
|
235
|
+
<c-icon
|
|
236
|
+
v-if="option.icon"
|
|
237
|
+
:name="option.icon.name"
|
|
238
|
+
:type="option.icon.type"
|
|
239
|
+
:class="`${
|
|
240
|
+
option.icon.headerIconClass
|
|
241
|
+
? option.icon.headerIconClass
|
|
242
|
+
: 'h-4 w-4'
|
|
243
|
+
} text-gray-400`"
|
|
244
|
+
/>
|
|
245
|
+
{{ option.header }}
|
|
246
|
+
</v-list-subheader>
|
|
247
|
+
<div
|
|
248
|
+
:class="[
|
|
249
|
+
'mt-1 flex h-full w-full',
|
|
250
|
+
option.description ? 'items-start' : 'items-center',
|
|
251
|
+
]"
|
|
252
|
+
>
|
|
253
|
+
<div @click.stop v-if="addCheckBox && !option.header">
|
|
254
|
+
<c-checkbox
|
|
255
|
+
:value="isChecked(option)"
|
|
256
|
+
@onChange="handleSingleSelect(option)"
|
|
257
|
+
/>
|
|
258
|
+
</div>
|
|
259
|
+
<div v-if="!option.header && showOptionImage">
|
|
260
|
+
<c-avatar
|
|
261
|
+
v-if="option.image"
|
|
262
|
+
size="extraextrasmall"
|
|
263
|
+
:image="option.image"
|
|
264
|
+
:rounded="true"
|
|
265
|
+
:description="option.description"
|
|
266
|
+
class="mr-2"
|
|
267
|
+
></c-avatar>
|
|
268
|
+
<c-avatar
|
|
269
|
+
v-else
|
|
270
|
+
size="extraextrasmall"
|
|
271
|
+
:nameInitials="option.initials"
|
|
272
|
+
:description="option.description"
|
|
273
|
+
:rounded="true"
|
|
274
|
+
:isDynamicallyColored="true"
|
|
275
|
+
class="mr-2"
|
|
276
|
+
></c-avatar>
|
|
277
|
+
</div>
|
|
278
|
+
<div class="w-full">
|
|
279
|
+
<div class="flex items-center">
|
|
280
|
+
<p>
|
|
281
|
+
{{
|
|
282
|
+
option[optionLabelSecondary]
|
|
283
|
+
? option[optionLabelSecondary]
|
|
284
|
+
: option[optionLabel]
|
|
285
|
+
}}
|
|
286
|
+
</p>
|
|
287
|
+
<div class="ml-3">
|
|
288
|
+
<span
|
|
289
|
+
v-if="tags && option.info && option.info !== ''"
|
|
290
|
+
class="inline-flex rounded-md bg-gray-400 px-2 py-px text-sm leading-5 text-white"
|
|
291
|
+
>
|
|
292
|
+
{{ option.info }}
|
|
293
|
+
</span>
|
|
294
|
+
<span v-else class="text-gray-300">
|
|
295
|
+
{{ option.info }}
|
|
296
|
+
</span>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
<p class="text-xs" v-if="option.description">
|
|
301
|
+
{{ option.description }}
|
|
302
|
+
</p>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</div>
|
|
306
|
+
</template>
|
|
307
|
+
<template #list-footer="{ search }">
|
|
308
|
+
<li ref="load" class="loader" v-show="hasNextPage">
|
|
309
|
+
Loading more options...
|
|
310
|
+
</li>
|
|
311
|
+
<div
|
|
312
|
+
class="group sticky bottom-0 mt-1 bg-white"
|
|
313
|
+
:class="showFooterButton && showFooterButton2 ? 'space-y-2' : ''"
|
|
314
|
+
>
|
|
315
|
+
<li
|
|
316
|
+
v-if="showFooterButton"
|
|
317
|
+
:class="footerBtnClasses"
|
|
318
|
+
class="cursor-pointer select-none bg-gray-50 py-2 pl-3 pr-9 text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
319
|
+
:id="getActionIDFn(footerButtonText)"
|
|
320
|
+
role="option"
|
|
321
|
+
@click="$emit('footerButtonClick')"
|
|
322
|
+
>
|
|
323
|
+
<div class="flex items-center">
|
|
324
|
+
<svg
|
|
325
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
326
|
+
class="h-6 w-6 flex-shrink-0 text-gray-400"
|
|
327
|
+
viewBox="0 0 20 20"
|
|
328
|
+
fill="currentColor"
|
|
329
|
+
>
|
|
330
|
+
<path
|
|
331
|
+
fill-rule="evenodd"
|
|
332
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z"
|
|
333
|
+
clip-rule="evenodd"
|
|
334
|
+
/>
|
|
335
|
+
</svg>
|
|
336
|
+
<span class="ml-3 block truncate font-semibold">
|
|
337
|
+
{{ footerButtonText }}
|
|
338
|
+
</span>
|
|
339
|
+
</div>
|
|
340
|
+
</li>
|
|
341
|
+
<li
|
|
342
|
+
v-if="showFooterButton2"
|
|
343
|
+
class="cursor-pointer select-none bg-gray-50 py-2 pl-3 pr-9 text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
|
344
|
+
:class="footerBtnClasses2"
|
|
345
|
+
:id="getActionIDFn(footerButtonText2)"
|
|
346
|
+
role="option"
|
|
347
|
+
@click="$emit('footerButtonClick2')"
|
|
348
|
+
>
|
|
349
|
+
<div class="flex items-center">
|
|
350
|
+
<svg
|
|
351
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
352
|
+
class="h-6 w-6 flex-shrink-0 text-gray-400"
|
|
353
|
+
viewBox="0 0 20 20"
|
|
354
|
+
fill="currentColor"
|
|
355
|
+
>
|
|
356
|
+
<path
|
|
357
|
+
fill-rule="evenodd"
|
|
358
|
+
d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z"
|
|
359
|
+
clip-rule="evenodd"
|
|
360
|
+
/>
|
|
361
|
+
</svg>
|
|
362
|
+
<span class="ml-3 block truncate font-semibold">
|
|
363
|
+
{{ footerButtonText2 }}
|
|
364
|
+
</span>
|
|
365
|
+
</div>
|
|
366
|
+
</li>
|
|
367
|
+
</div>
|
|
368
|
+
<div
|
|
369
|
+
v-if="
|
|
370
|
+
showCreateOption &&
|
|
371
|
+
showCreateOptionAfterSearch &&
|
|
372
|
+
search &&
|
|
373
|
+
search.trim()
|
|
374
|
+
"
|
|
375
|
+
class="sticky bottom-0 z-10 flex min-h-[44px] items-start gap-3 rounded-b-md bg-white px-3 py-2 shadow-lg ring-1 ring-gray-900 ring-opacity-5"
|
|
376
|
+
>
|
|
377
|
+
<span class="word-break flex-1 text-sm text-gray-700">{{
|
|
378
|
+
search
|
|
379
|
+
}}</span>
|
|
380
|
+
|
|
381
|
+
<button
|
|
382
|
+
type="button"
|
|
383
|
+
:id="id + '_create_button'"
|
|
384
|
+
@mousedown="handleCreateOption($event, search)"
|
|
385
|
+
class="flex items-center gap-1 text-sm text-indigo-700"
|
|
386
|
+
>
|
|
387
|
+
<c-icon
|
|
388
|
+
type="solid"
|
|
389
|
+
name="plus-circle-solid-v2"
|
|
390
|
+
class="h-5 w-5 text-indigo-600"
|
|
391
|
+
viewBox="0 0 24 24"
|
|
392
|
+
></c-icon>
|
|
393
|
+
Create
|
|
394
|
+
</button>
|
|
395
|
+
</div>
|
|
396
|
+
<div
|
|
397
|
+
v-if="otherOption"
|
|
398
|
+
class="sticky bottom-0 z-10 border-t border-gray-100 bg-gray-50 px-3 py-2"
|
|
399
|
+
>
|
|
400
|
+
<div class="flex" @mousedown.prevent.stop>
|
|
401
|
+
<c-checkbox
|
|
402
|
+
:value="isChecked(otherOption)"
|
|
403
|
+
@onChange="handleOtherOptionChange"
|
|
404
|
+
/>
|
|
405
|
+
<div class="flex-1" @click.stop="handleOtherOptionChange">
|
|
406
|
+
<p class="text-sm font-medium text-gray-700">
|
|
407
|
+
{{ otherOption[optionLabel] }}
|
|
408
|
+
</p>
|
|
409
|
+
<p class="mt-1 text-sm text-gray-500">
|
|
410
|
+
{{ otherOption.description }}
|
|
411
|
+
</p>
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
</template>
|
|
416
|
+
</v-select>
|
|
417
|
+
<button
|
|
418
|
+
class="absolute top-2.5 right-10 z-100"
|
|
419
|
+
:id="id + '_close_button'"
|
|
420
|
+
v-if="showCloseButton && (value == null || value.length == 0)"
|
|
421
|
+
@click.stop="handleCrossClick"
|
|
422
|
+
>
|
|
423
|
+
<c-icon
|
|
424
|
+
name="close"
|
|
425
|
+
type="outline-v2"
|
|
426
|
+
class="h-4 w-4 text-gray-400"
|
|
427
|
+
cursorType="cursor-pointer"
|
|
428
|
+
/>
|
|
429
|
+
</button>
|
|
430
|
+
</div>
|
|
431
|
+
<p v-if="subLabel" class="mt-2 text-sm text-gray-500">{{ subLabel }}</p>
|
|
432
|
+
<p v-if="!isValidate && errorMessage" class="mt-2 text-sm text-red-600 text-left">
|
|
433
|
+
{{ errorMessage }}
|
|
434
|
+
</p>
|
|
435
|
+
<p v-if="helpText && isValidate == true" class="mt-2 text-sm text-gray-500">
|
|
436
|
+
{{ helpText }}
|
|
437
|
+
</p>
|
|
438
|
+
</div>
|
|
439
|
+
</template>
|
|
440
|
+
<script>
|
|
441
|
+
import vSelect from "vue-select";
|
|
442
|
+
import CAvatar from "../CAvatar/CAvatar.vue";
|
|
443
|
+
import CIcon from "../CIcon/CIcon.vue";
|
|
444
|
+
import CCheckbox from "../CCheckbox/CCheckbox.vue";
|
|
445
|
+
import { debounce } from "lodash-es";
|
|
446
|
+
// import Fuse from "fuse.js";
|
|
447
|
+
import "vue-select/dist/vue-select.css";
|
|
448
|
+
import { getActionID } from "../../helper";
|
|
449
|
+
import CTag from "../CTag/CTag.vue";
|
|
450
|
+
export default {
|
|
451
|
+
name: "CMultiselect",
|
|
452
|
+
components: { vSelect, CAvatar, CCheckbox, CIcon, CTag },
|
|
453
|
+
props: {
|
|
454
|
+
id: {
|
|
455
|
+
type: String,
|
|
456
|
+
},
|
|
457
|
+
options: {
|
|
458
|
+
type: Array,
|
|
459
|
+
required: true,
|
|
460
|
+
},
|
|
461
|
+
extraDetails: {
|
|
462
|
+
type: Boolean,
|
|
463
|
+
default: false,
|
|
464
|
+
},
|
|
465
|
+
displaySelectedOptionAvatar: {
|
|
466
|
+
type: Boolean,
|
|
467
|
+
default: false,
|
|
468
|
+
},
|
|
469
|
+
showFooterButton: {
|
|
470
|
+
type: Boolean,
|
|
471
|
+
default: false,
|
|
472
|
+
},
|
|
473
|
+
footerButtonText: {
|
|
474
|
+
type: String,
|
|
475
|
+
default: "",
|
|
476
|
+
},
|
|
477
|
+
label: String,
|
|
478
|
+
isRequired: {
|
|
479
|
+
type: Boolean,
|
|
480
|
+
},
|
|
481
|
+
subLabel: String,
|
|
482
|
+
placeholder: {
|
|
483
|
+
type: String,
|
|
484
|
+
},
|
|
485
|
+
// whether multiple fields are allowed or not
|
|
486
|
+
isMultiple: {
|
|
487
|
+
type: Boolean,
|
|
488
|
+
},
|
|
489
|
+
// append newly created tags in options
|
|
490
|
+
pushTags: {
|
|
491
|
+
type: Boolean,
|
|
492
|
+
},
|
|
493
|
+
// whether to allow user to create new options
|
|
494
|
+
isTaggable: {
|
|
495
|
+
type: Boolean,
|
|
496
|
+
},
|
|
497
|
+
getOptions: {
|
|
498
|
+
// function to emit on search{
|
|
499
|
+
type: Function,
|
|
500
|
+
},
|
|
501
|
+
customiseOption: {
|
|
502
|
+
type: Boolean,
|
|
503
|
+
},
|
|
504
|
+
// whether to show profile picture in option
|
|
505
|
+
showOptionImage: {
|
|
506
|
+
type: Boolean,
|
|
507
|
+
},
|
|
508
|
+
// the name of the option to render in the selectpicker
|
|
509
|
+
optionLabel: {
|
|
510
|
+
type: String,
|
|
511
|
+
},
|
|
512
|
+
// the name of the option to render in the selectpicker
|
|
513
|
+
optionLabelSecondary: {
|
|
514
|
+
type: String,
|
|
515
|
+
},
|
|
516
|
+
selectedOptionLabel: {
|
|
517
|
+
type: String,
|
|
518
|
+
},
|
|
519
|
+
// action to trigger after selecting option from dropdown
|
|
520
|
+
onSelectOptions: {
|
|
521
|
+
type: Function,
|
|
522
|
+
},
|
|
523
|
+
optionsSelected: {
|
|
524
|
+
type: [Array, Object],
|
|
525
|
+
},
|
|
526
|
+
filterable: {
|
|
527
|
+
type: Boolean,
|
|
528
|
+
default: false,
|
|
529
|
+
},
|
|
530
|
+
clearable: {
|
|
531
|
+
type: Boolean,
|
|
532
|
+
default: true,
|
|
533
|
+
},
|
|
534
|
+
isValidate: {
|
|
535
|
+
type: Boolean,
|
|
536
|
+
default: true,
|
|
537
|
+
},
|
|
538
|
+
errorMessage: {
|
|
539
|
+
type: String,
|
|
540
|
+
},
|
|
541
|
+
loading: {
|
|
542
|
+
type: Boolean,
|
|
543
|
+
default: false,
|
|
544
|
+
},
|
|
545
|
+
hasNextPage: {
|
|
546
|
+
type: Boolean,
|
|
547
|
+
default: false,
|
|
548
|
+
},
|
|
549
|
+
isDisabled: {
|
|
550
|
+
type: Boolean,
|
|
551
|
+
default: false,
|
|
552
|
+
},
|
|
553
|
+
// text adjacent to label of dropdown to provide hint about field
|
|
554
|
+
hint: { type: String },
|
|
555
|
+
helpText: {
|
|
556
|
+
type: String,
|
|
557
|
+
},
|
|
558
|
+
tags: {
|
|
559
|
+
type: Boolean,
|
|
560
|
+
default: false,
|
|
561
|
+
},
|
|
562
|
+
isGrouped: {
|
|
563
|
+
type: Boolean,
|
|
564
|
+
default: false,
|
|
565
|
+
},
|
|
566
|
+
//to show the additional text, default true to prevent failure at any other place
|
|
567
|
+
showAdditionalText: {
|
|
568
|
+
type: Boolean,
|
|
569
|
+
default: true,
|
|
570
|
+
},
|
|
571
|
+
addCheckBox: {
|
|
572
|
+
type: Boolean,
|
|
573
|
+
default: false,
|
|
574
|
+
},
|
|
575
|
+
showSelectedAvatar: {
|
|
576
|
+
type: Boolean,
|
|
577
|
+
default: false,
|
|
578
|
+
},
|
|
579
|
+
icon: {
|
|
580
|
+
type: Object,
|
|
581
|
+
},
|
|
582
|
+
footerBtnClasses: {
|
|
583
|
+
type: String,
|
|
584
|
+
},
|
|
585
|
+
shouldIconRotate: {
|
|
586
|
+
type: Boolean,
|
|
587
|
+
default: true,
|
|
588
|
+
},
|
|
589
|
+
imageLabel: {
|
|
590
|
+
type: String,
|
|
591
|
+
default: "image",
|
|
592
|
+
},
|
|
593
|
+
showFooterButton2: {
|
|
594
|
+
type: Boolean,
|
|
595
|
+
default: false,
|
|
596
|
+
},
|
|
597
|
+
footerButtonText2: {
|
|
598
|
+
type: String,
|
|
599
|
+
default: "",
|
|
600
|
+
},
|
|
601
|
+
footerBtnClasses2: {
|
|
602
|
+
type: String,
|
|
603
|
+
},
|
|
604
|
+
showCloseButton: {
|
|
605
|
+
type: Boolean,
|
|
606
|
+
default: false,
|
|
607
|
+
},
|
|
608
|
+
showCreateOption: {
|
|
609
|
+
type: Boolean,
|
|
610
|
+
default: false,
|
|
611
|
+
},
|
|
612
|
+
otherOption: {
|
|
613
|
+
type: Object,
|
|
614
|
+
},
|
|
615
|
+
tagWrapperClass: {
|
|
616
|
+
type: String,
|
|
617
|
+
default: "",
|
|
618
|
+
},
|
|
619
|
+
checkboxWrapperClass: {
|
|
620
|
+
type: String,
|
|
621
|
+
default: "",
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
computed: {
|
|
625
|
+
groupedArray() {
|
|
626
|
+
const groups = {};
|
|
627
|
+
|
|
628
|
+
this.options.forEach((x) => {
|
|
629
|
+
// create empty object if it doesn't exists.
|
|
630
|
+
groups[x.category] = groups[x.category] || {
|
|
631
|
+
text: x.category,
|
|
632
|
+
list: [],
|
|
633
|
+
...(x.icon ? { icon: x.icon } : {}),
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
groups[x.category].list.push(x);
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
// The flattened list of items that holds items as well as unique headers
|
|
640
|
+
const flattened = [];
|
|
641
|
+
|
|
642
|
+
// Iterate over all the unique categories and
|
|
643
|
+
// then flatten into a list that v-select needs.
|
|
644
|
+
Object.keys(groups).forEach((categoryId) => {
|
|
645
|
+
const category = groups[categoryId];
|
|
646
|
+
const categoryName = category.text;
|
|
647
|
+
|
|
648
|
+
// Create a group
|
|
649
|
+
flattened.push({
|
|
650
|
+
header: categoryName,
|
|
651
|
+
...(category.icon ? { icon: category.icon } : {}),
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
// Add all the items followed by category header
|
|
655
|
+
flattened.push(...category.list);
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
return flattened;
|
|
659
|
+
},
|
|
660
|
+
showCreateOptionAfterSearch() {
|
|
661
|
+
if (!this.showCreateOption) return false;
|
|
662
|
+
|
|
663
|
+
// Get current search term from v-select
|
|
664
|
+
const vSelectRef = this.$refs.vselect;
|
|
665
|
+
const search = (vSelectRef && vSelectRef.search) || "";
|
|
666
|
+
const term = search.trim().toLowerCase();
|
|
667
|
+
if (!term) return false;
|
|
668
|
+
|
|
669
|
+
// Check if any options exactly match the search term
|
|
670
|
+
const hasExactMatch = this.options.some((option) => {
|
|
671
|
+
const label = option[this.optionLabel];
|
|
672
|
+
return label && String(label).toLowerCase() === term;
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
return !hasExactMatch;
|
|
676
|
+
},
|
|
677
|
+
},
|
|
678
|
+
data() {
|
|
679
|
+
return {
|
|
680
|
+
loaderSearching: true,
|
|
681
|
+
value:
|
|
682
|
+
this.optionsSelected && this.optionsSelected.length
|
|
683
|
+
? this.optionsSelected
|
|
684
|
+
: [],
|
|
685
|
+
observer: null,
|
|
686
|
+
};
|
|
687
|
+
},
|
|
688
|
+
methods: {
|
|
689
|
+
getActionIDFn(name) {
|
|
690
|
+
return getActionID(name, this.id);
|
|
691
|
+
},
|
|
692
|
+
handleCrossClick(event) {
|
|
693
|
+
event.preventDefault();
|
|
694
|
+
this.$emit("hide-multiselect-dropdown");
|
|
695
|
+
},
|
|
696
|
+
fetchOptions(search, loaderSearching) {
|
|
697
|
+
this.emitGetOptions(search, loaderSearching);
|
|
698
|
+
},
|
|
699
|
+
emitGetOptions: debounce(function (search, loaderSearching) {
|
|
700
|
+
this.$emit("getOptions", search.trim(), loaderSearching);
|
|
701
|
+
}, 300),
|
|
702
|
+
setSelectedOptions(params) {
|
|
703
|
+
this.value = params;
|
|
704
|
+
this.$emit("onSelectOptions", params);
|
|
705
|
+
},
|
|
706
|
+
async onOpen() {
|
|
707
|
+
if (this.hasNextPage) {
|
|
708
|
+
await this.$nextTick();
|
|
709
|
+
if (this.$refs ? this.$refs.load : false && this.observer) {
|
|
710
|
+
this.observer.observe(this.$refs.load);
|
|
711
|
+
} else {
|
|
712
|
+
setTimeout(() => {
|
|
713
|
+
this.onOpen();
|
|
714
|
+
}, 500);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
this.emitGetOptions("", true);
|
|
718
|
+
},
|
|
719
|
+
onClose() {
|
|
720
|
+
this.observer.disconnect();
|
|
721
|
+
},
|
|
722
|
+
async infiniteScroll([{ isIntersecting }]) {
|
|
723
|
+
if (isIntersecting) {
|
|
724
|
+
this.emitLoadNextPage();
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
getIndex(option) {
|
|
728
|
+
return this.value.findIndex((item) => item.id == option.id);
|
|
729
|
+
},
|
|
730
|
+
isChecked(option) {
|
|
731
|
+
return this.value.findIndex((item) => item.id == option.id) == -1 ? 0 : 1;
|
|
732
|
+
},
|
|
733
|
+
handleSingleSelect(option) {
|
|
734
|
+
if (this.addCheckBox) {
|
|
735
|
+
if (this.isChecked(option) == 1) {
|
|
736
|
+
this.value = this.value.filter((item) => item.id != option.id);
|
|
737
|
+
} else {
|
|
738
|
+
this.value = [...this.value, option];
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
this.$emit("onSelectOptions", this.value);
|
|
742
|
+
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
handleOtherOptionChange() {
|
|
747
|
+
const isSelected = this.isChecked(this.otherOption) == 1;
|
|
748
|
+
if (isSelected) {
|
|
749
|
+
this.value = this.value.filter(
|
|
750
|
+
(item) => item.id != this.otherOption.id
|
|
751
|
+
);
|
|
752
|
+
} else {
|
|
753
|
+
this.value = [...this.value, this.otherOption];
|
|
754
|
+
}
|
|
755
|
+
this.$emit("onSelectOptions", this.value);
|
|
756
|
+
|
|
757
|
+
this.$nextTick(() => {
|
|
758
|
+
if (this.$refs.vselect) {
|
|
759
|
+
this.$refs.vselect.open = false;
|
|
760
|
+
this.$refs.vselect.search = "";
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const input = this.$refs.vselect.$el.querySelector("input");
|
|
764
|
+
if (input) {
|
|
765
|
+
input.blur();
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
},
|
|
769
|
+
getDisableOptions(option) {
|
|
770
|
+
if (!option) return true;
|
|
771
|
+
if (option.header) return false;
|
|
772
|
+
if (option.isDisabled || option.disabled) return false;
|
|
773
|
+
return true;
|
|
774
|
+
},
|
|
775
|
+
|
|
776
|
+
// a function that will set the location when the component has mounted and the location is passed after that
|
|
777
|
+
forceSetData(params) {
|
|
778
|
+
this.value = params;
|
|
779
|
+
},
|
|
780
|
+
emitLoadNextPage: debounce(function () {
|
|
781
|
+
this.$emit("loadNextPage");
|
|
782
|
+
}, 300),
|
|
783
|
+
handleCreateOption(event, searchText) {
|
|
784
|
+
event.preventDefault();
|
|
785
|
+
|
|
786
|
+
this.$emit("handleCreateOption", {
|
|
787
|
+
event,
|
|
788
|
+
searchText: searchText.trim(),
|
|
789
|
+
});
|
|
790
|
+
this.$refs.vselect.open = false;
|
|
791
|
+
this.$refs.vselect.search = "";
|
|
792
|
+
|
|
793
|
+
this.$nextTick(() => {
|
|
794
|
+
const input = this.$refs.vselect.$el.querySelector("input");
|
|
795
|
+
if (input) {
|
|
796
|
+
input.blur();
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
},
|
|
800
|
+
handleKeydown(event) {
|
|
801
|
+
if (event.key === "Enter") {
|
|
802
|
+
event.preventDefault();
|
|
803
|
+
event.stopPropagation();
|
|
804
|
+
|
|
805
|
+
const vSelectRef = this.$refs.vselect;
|
|
806
|
+
const search = (vSelectRef && vSelectRef.search) || "";
|
|
807
|
+
|
|
808
|
+
if (
|
|
809
|
+
this.showCreateOption &&
|
|
810
|
+
this.showCreateOptionAfterSearch &&
|
|
811
|
+
search &&
|
|
812
|
+
search.trim()
|
|
813
|
+
) {
|
|
814
|
+
this.handleCreateOption(event, search.trim());
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
},
|
|
819
|
+
watch: {
|
|
820
|
+
optionsSelected: {
|
|
821
|
+
handler(newVal) {
|
|
822
|
+
this.value = newVal;
|
|
823
|
+
},
|
|
824
|
+
deep: true,
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
mounted() {
|
|
828
|
+
this.observer = new IntersectionObserver(this.infiniteScroll);
|
|
829
|
+
},
|
|
830
|
+
};
|
|
831
|
+
</script>
|
|
832
|
+
<style>
|
|
833
|
+
.disabled {
|
|
834
|
+
pointer-events: none;
|
|
835
|
+
color: #bfcbd9;
|
|
836
|
+
cursor: not-allowed;
|
|
837
|
+
background-image: none;
|
|
838
|
+
background-color: #eef1f6;
|
|
839
|
+
border-color: #d1dbe5;
|
|
840
|
+
}
|
|
841
|
+
.v-select {
|
|
842
|
+
@apply cursor-pointer;
|
|
843
|
+
}
|
|
844
|
+
.vs__dropdown-toggle {
|
|
845
|
+
@apply w-full min-h-[36px] rounded-md border border-gray-300 bg-white px-3 py-2 text-left shadow-sm focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 sm:text-sm;
|
|
846
|
+
}
|
|
847
|
+
.vs__selected-options {
|
|
848
|
+
flex-wrap: wrap !important;
|
|
849
|
+
height: auto;
|
|
850
|
+
max-height: 60px;
|
|
851
|
+
overflow: hidden;
|
|
852
|
+
overflow-y: auto;
|
|
853
|
+
}
|
|
854
|
+
.vs--open .vs__dropdown-toggle {
|
|
855
|
+
border-bottom-color: rgba(212, 212, 216, var(--tw-border-opacity));
|
|
856
|
+
@apply rounded-b-md;
|
|
857
|
+
}
|
|
858
|
+
.vs__selected {
|
|
859
|
+
@apply m-0 border-none text-gray-700;
|
|
860
|
+
}
|
|
861
|
+
.extra:hover {
|
|
862
|
+
color: white;
|
|
863
|
+
}
|
|
864
|
+
.vs__search,
|
|
865
|
+
.vs__search:focus {
|
|
866
|
+
@apply m-0 p-0;
|
|
867
|
+
}
|
|
868
|
+
.vs__search::placeholder {
|
|
869
|
+
@apply text-gray-500;
|
|
870
|
+
}
|
|
871
|
+
.vs__actions {
|
|
872
|
+
@apply p-0;
|
|
873
|
+
}
|
|
874
|
+
.vs__dropdown-menu {
|
|
875
|
+
@apply mt-2 max-h-60 overflow-auto rounded-md bg-white py-0 text-base shadow-lg ring-1 ring-opacity-5 focus:outline-none sm:text-sm;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
.dropdown-menu-bordered {
|
|
879
|
+
@apply border-b border-gray-200;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
.vs__dropdown-menu li {
|
|
883
|
+
min-height: fit-content;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
.vs__dropdown-menu li:has(.sticky-group-header) {
|
|
887
|
+
@apply sticky top-0 z-10 bg-gray-200;
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/* Remove li padding if it contains a bordered option */
|
|
891
|
+
.vs__dropdown-menu li:has(.dropdown-menu-bordered) {
|
|
892
|
+
padding: 0 !important;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
.vs__dropdown-option {
|
|
896
|
+
@apply whitespace-normal !px-3 !py-2 text-gray-700;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
.vs__dropdown-toggle.vs__dropdown-option--highlight {
|
|
900
|
+
@apply bg-indigo-700 text-white;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
.vs__dropdown-option--highlight {
|
|
904
|
+
@apply bg-indigo-700 text-white;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.vs__dropdown-option--disabled {
|
|
908
|
+
@apply !text-gray-500 !bg-gray-50 !border-gray-200 shadow-none opacity-100 cursor-not-allowed;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.vs__dropdown-option--disabled * {
|
|
912
|
+
@apply text-gray-500;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
.vs__dropdown-menu li {
|
|
916
|
+
@apply opacity-100;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.v-list-subheader {
|
|
920
|
+
@apply pointer-events-none opacity-100;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
.vs__dropdown-toggle {
|
|
924
|
+
height: 100%;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
.vs__no-options {
|
|
928
|
+
@apply px-4 py-3 text-sm text-gray-500;
|
|
929
|
+
}
|
|
930
|
+
</style>
|