@tmagic/form 1.2.4 → 1.2.6
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/tmagic-form.js +30 -19
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +29 -18
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/fields/Select.vue +29 -19
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.2.
|
|
2
|
+
"version": "1.2.6",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@element-plus/icons-vue": "^2.0.9",
|
|
39
|
-
"@tmagic/design": "1.2.
|
|
40
|
-
"@tmagic/utils": "1.2.
|
|
39
|
+
"@tmagic/design": "1.2.6",
|
|
40
|
+
"@tmagic/utils": "1.2.6",
|
|
41
41
|
"lodash-es": "^4.17.21",
|
|
42
42
|
"sortablejs": "^1.14.0",
|
|
43
43
|
"vue": "^3.2.37"
|
package/src/fields/Select.vue
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script lang="ts" setup name="MFormSelect">
|
|
29
|
-
import { inject,
|
|
29
|
+
import { inject, onBeforeMount, Ref, ref, watch, watchEffect } from 'vue';
|
|
30
30
|
|
|
31
31
|
import { TMagicSelect } from '@tmagic/design';
|
|
32
32
|
|
|
@@ -331,26 +331,36 @@ if (typeof props.config.options === 'function') {
|
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
props.config.remote
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (moreLoadingVisible.value) {
|
|
334
|
+
if (props.config.remote) {
|
|
335
|
+
const unWacth = watch(
|
|
336
|
+
() => tMagicSelect.value?.scrollbarWrap,
|
|
337
|
+
(scrollbarWrap) => {
|
|
338
|
+
if (!scrollbarWrap) {
|
|
340
339
|
return;
|
|
341
340
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
341
|
+
scrollbarWrap.addEventListener('scroll', async (e: Event) => {
|
|
342
|
+
const el = e.currentTarget as HTMLDivElement;
|
|
343
|
+
if (moreLoadingVisible.value) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (el.scrollHeight - el.clientHeight - el.scrollTop > 1) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (total.value <= options.value.length) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
moreLoadingVisible.value = true;
|
|
353
|
+
pgIndex.value += 1;
|
|
354
|
+
options.value = await getOptions();
|
|
355
|
+
moreLoadingVisible.value = false;
|
|
356
|
+
});
|
|
357
|
+
unWacth();
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
immediate: true,
|
|
361
|
+
},
|
|
362
|
+
);
|
|
363
|
+
}
|
|
354
364
|
|
|
355
365
|
const popperClass = mForm?.popperClass;
|
|
356
366
|
|