classcard-ui 0.2.331 → 0.2.334
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 +1974 -99
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.css +1 -1
- package/dist/classcard-ui.umd.js +1974 -99
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +5 -5
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CEditor/CEditor.vue +2 -1
- package/src/components/CMultiselect/CMultiselect.vue +60 -6
package/package.json
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
:label="optionLabel"
|
|
24
24
|
:clearable="clearable"
|
|
25
25
|
:loading="loading"
|
|
26
|
+
@open="onOpen"
|
|
27
|
+
@close="onClose"
|
|
26
28
|
>
|
|
27
29
|
<template #open-indicator="{ attributes }">
|
|
28
30
|
<span v-bind="attributes">
|
|
@@ -92,6 +94,31 @@
|
|
|
92
94
|
<p>{{ option[optionLabel] }}</p>
|
|
93
95
|
</div>
|
|
94
96
|
</template>
|
|
97
|
+
<template #list-footer>
|
|
98
|
+
<li ref="load" class="loader" v-show="hasNextPage">
|
|
99
|
+
<svg
|
|
100
|
+
class="h-5 w-5 animate-spin text-gray-400"
|
|
101
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
102
|
+
fill="none"
|
|
103
|
+
viewBox="0 0 24 24"
|
|
104
|
+
v-if="loading"
|
|
105
|
+
>
|
|
106
|
+
<circle
|
|
107
|
+
class="opacity-25"
|
|
108
|
+
cx="12"
|
|
109
|
+
cy="12"
|
|
110
|
+
r="10"
|
|
111
|
+
stroke="currentColor"
|
|
112
|
+
stroke-width="4"
|
|
113
|
+
></circle>
|
|
114
|
+
<path
|
|
115
|
+
class="opacity-75"
|
|
116
|
+
fill="currentColor"
|
|
117
|
+
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"
|
|
118
|
+
></path>
|
|
119
|
+
</svg>
|
|
120
|
+
</li>
|
|
121
|
+
</template>
|
|
95
122
|
</v-select>
|
|
96
123
|
<p v-if="!isValidate" class="mt-2 text-sm text-red-600">
|
|
97
124
|
{{ errorMessage }}
|
|
@@ -174,6 +201,10 @@ export default {
|
|
|
174
201
|
type: Boolean,
|
|
175
202
|
default: false,
|
|
176
203
|
},
|
|
204
|
+
hasNextPage: {
|
|
205
|
+
type: Boolean,
|
|
206
|
+
default: false,
|
|
207
|
+
},
|
|
177
208
|
},
|
|
178
209
|
computed: {},
|
|
179
210
|
data() {
|
|
@@ -183,27 +214,50 @@ export default {
|
|
|
183
214
|
this.optionsSelected && this.optionsSelected.length
|
|
184
215
|
? this.optionsSelected
|
|
185
216
|
: [],
|
|
186
|
-
|
|
217
|
+
observer: null,
|
|
187
218
|
};
|
|
188
219
|
},
|
|
189
220
|
methods: {
|
|
190
221
|
fetchOptions(search, loaderSearching) {
|
|
191
|
-
this
|
|
192
|
-
this.emitSearch(search);
|
|
222
|
+
this.emitGetOptions(search, loaderSearching);
|
|
193
223
|
},
|
|
194
|
-
|
|
195
|
-
this.$emit("
|
|
196
|
-
},
|
|
224
|
+
emitGetOptions: debounce(function (search, loaderSearching) {
|
|
225
|
+
this.$emit("getOptions", search, loaderSearching);
|
|
226
|
+
}, 300),
|
|
197
227
|
setSelectedOptions(params) {
|
|
198
228
|
this.value = params;
|
|
199
229
|
this.$emit("onSelectOptions", params);
|
|
200
230
|
},
|
|
231
|
+
async onOpen() {
|
|
232
|
+
if (this.hasNextPage) {
|
|
233
|
+
await this.$nextTick();
|
|
234
|
+
this.observer.observe(this.$refs.load);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
onClose() {
|
|
238
|
+
this.observer.disconnect();
|
|
239
|
+
},
|
|
240
|
+
async infiniteScroll([{ isIntersecting, target }]) {
|
|
241
|
+
if (isIntersecting) {
|
|
242
|
+
const ul = target.offsetParent;
|
|
243
|
+
const scrollTop = target.offsetParent.scrollTop;
|
|
244
|
+
this.emitLoadNextPage();
|
|
245
|
+
await this.$nextTick();
|
|
246
|
+
ul.scrollTop = scrollTop;
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
emitLoadNextPage: debounce(function () {
|
|
250
|
+
this.$emit("loadNextPage");
|
|
251
|
+
}, 300),
|
|
201
252
|
},
|
|
202
253
|
watch: {
|
|
203
254
|
optionsSelected() {
|
|
204
255
|
this.value = this.optionsSelected;
|
|
205
256
|
},
|
|
206
257
|
},
|
|
258
|
+
mounted() {
|
|
259
|
+
this.observer = new IntersectionObserver(this.infiniteScroll);
|
|
260
|
+
},
|
|
207
261
|
};
|
|
208
262
|
</script>
|
|
209
263
|
<style>
|