classcard-ui 0.2.250 → 0.2.251
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/dist/classcard-ui.common.js +100 -60
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +100 -60
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +1 -1
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CSelect/CSelect.vue +41 -15
- package/src/stories/CSelect.stories.js +1 -1
package/package.json
CHANGED
|
@@ -11,39 +11,53 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
<span v-if="hint" class="text-sm text-gray-500">{{ hint }}</span>
|
|
13
13
|
</div>
|
|
14
|
+
|
|
14
15
|
<div class="relative" :class="label ? 'mt-1' : ''">
|
|
15
|
-
<
|
|
16
|
-
type="
|
|
16
|
+
<input
|
|
17
|
+
type="text"
|
|
18
|
+
v-model="selectSearch"
|
|
17
19
|
@click="toggleDropdown = !toggleDropdown"
|
|
18
20
|
@focus="type == 'tertiary' ? (showFocus = true) : ''"
|
|
19
21
|
@blur="close()"
|
|
22
|
+
@keyup="search()"
|
|
20
23
|
aria-haspopup="listbox"
|
|
21
24
|
aria-expanded="true"
|
|
22
25
|
aria-labelledby="listbox-label"
|
|
23
26
|
:class="classes"
|
|
24
|
-
class="relative w-full rounded-md pl-
|
|
27
|
+
class="relative w-full rounded-md pl-3 pr-10 py-2 text-left cursor-pointer focus:outline-none sm:text-sm disabled:opacity-50"
|
|
25
28
|
:disabled="isDisabled"
|
|
26
|
-
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<div class="absolute top-2 left-3 flex pointer-events-none">
|
|
27
32
|
<span class="flex items-center">
|
|
28
33
|
<c-avatar
|
|
29
|
-
v-if="showImage"
|
|
34
|
+
v-if="showImage && !selectSearch"
|
|
30
35
|
size="extraextrasmall"
|
|
31
36
|
image="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
|
32
37
|
:rounded="true"
|
|
33
38
|
></c-avatar>
|
|
34
|
-
<c-icon
|
|
39
|
+
<c-icon
|
|
40
|
+
v-if="icon && !selectSearch"
|
|
41
|
+
:class="icon.class"
|
|
42
|
+
:name="icon.name"
|
|
43
|
+
:type="icon.type"
|
|
44
|
+
>
|
|
45
|
+
</c-icon>
|
|
35
46
|
<span :class="showImage ? 'ml-3' : ''" class="block truncate">
|
|
36
|
-
{{ selectedValue ? selectedValue :
|
|
47
|
+
{{ selectedValue ? selectedValue :
|
|
48
|
+
selectSearch && selectSearch.length > 0 ? null : placeholder
|
|
49
|
+
}}
|
|
37
50
|
</span>
|
|
38
51
|
</span>
|
|
39
|
-
|
|
40
|
-
|
|
52
|
+
</div>
|
|
53
|
+
<div class="absolute top-2.5 right-3 flex pointer-events-none">
|
|
54
|
+
<div
|
|
41
55
|
v-if="type == 'tertiary' ? showFocus : true"
|
|
42
|
-
class="
|
|
43
|
-
|
|
56
|
+
class="right-0 flex items-center pointer-events-none"
|
|
57
|
+
>
|
|
44
58
|
<c-icon name="selector" type="solid" class="h-5 w-5"></c-icon>
|
|
45
|
-
</
|
|
46
|
-
</
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
47
61
|
<transition
|
|
48
62
|
enter-active-class="transition ease-out duration-100"
|
|
49
63
|
enter-class="transform opacity-0 scale-95"
|
|
@@ -75,7 +89,7 @@
|
|
|
75
89
|
{{ addAction.label }}
|
|
76
90
|
</li>
|
|
77
91
|
<li
|
|
78
|
-
v-for="(option, index) in
|
|
92
|
+
v-for="(option, index) in renderOptions"
|
|
79
93
|
:key="index"
|
|
80
94
|
id="listbox-option-0"
|
|
81
95
|
role="option"
|
|
@@ -184,6 +198,8 @@ export default {
|
|
|
184
198
|
selectedValue: this.value !== null && this.value.option ? this.value.option : this.value,
|
|
185
199
|
showSelectedValue: false,
|
|
186
200
|
showFocus: false,
|
|
201
|
+
selectSearch: null,
|
|
202
|
+
renderOptions: this.options
|
|
187
203
|
};
|
|
188
204
|
},
|
|
189
205
|
computed: {
|
|
@@ -200,7 +216,7 @@ export default {
|
|
|
200
216
|
},
|
|
201
217
|
methods: {
|
|
202
218
|
handleSelect(event, option) {
|
|
203
|
-
this.selectedValue = option.
|
|
219
|
+
this.selectedValue = option[this.renderOptionName];
|
|
204
220
|
this.$emit("onChangeValue", option);
|
|
205
221
|
this.toggleDropdown = false;
|
|
206
222
|
},
|
|
@@ -211,6 +227,16 @@ export default {
|
|
|
211
227
|
this.toggleDropdown = false;
|
|
212
228
|
this.type === "tertiary" ? (this.showFocus = false) : "";
|
|
213
229
|
},
|
|
230
|
+
search() {
|
|
231
|
+
if(!this.selectSearch && this.selectSearch == '') {
|
|
232
|
+
this.renderOptions = this.options;
|
|
233
|
+
}
|
|
234
|
+
let options = [...this.options];
|
|
235
|
+
this.renderOptions = options.filter((option) => {
|
|
236
|
+
return option[this.renderOptionName].toLowerCase().includes(this.selectSearch.toLowerCase());
|
|
237
|
+
});
|
|
238
|
+
console.log(this.renderOptions);
|
|
239
|
+
}
|
|
214
240
|
},
|
|
215
241
|
watch: {
|
|
216
242
|
value() {
|