@94ai/nf-popup-lazy-select 3.2.78 → 3.2.79
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.
|
@@ -404,6 +404,11 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
404
404
|
const props = __props;
|
|
405
405
|
const emit = __ctx.emit;
|
|
406
406
|
const refreshLazySelect = vueDemi.ref(Date.now());
|
|
407
|
+
const resetPlaceholder = vueDemi.ref(false);
|
|
408
|
+
const placeholderComputed = vueDemi.computed(() => {
|
|
409
|
+
var _a;
|
|
410
|
+
return resetPlaceholder.value ? "" : !props.multiple && !props.assignmentOnSelect && ((_a = popLazySelectRef.value) == null ? void 0 : _a.keyword) ? popLazySelectRef.value.keyword : props.placeholder;
|
|
411
|
+
});
|
|
407
412
|
const changeHide = () => {
|
|
408
413
|
emit("popup-hide", false);
|
|
409
414
|
popLazySelectRef.value.visibleIntersect = false;
|
|
@@ -421,6 +426,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
421
426
|
const visibleChange = async (e) => {
|
|
422
427
|
if (!e) {
|
|
423
428
|
return "break";
|
|
429
|
+
} else if (!props.popdownOnSelect && !props.multiple && props.assignmentOnSelect) {
|
|
430
|
+
return "discard-cache";
|
|
424
431
|
}
|
|
425
432
|
};
|
|
426
433
|
const popLazySelectRef = vueDemi.ref();
|
|
@@ -446,6 +453,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
446
453
|
return props.value;
|
|
447
454
|
},
|
|
448
455
|
set(val) {
|
|
456
|
+
var _a, _b, _c, _d;
|
|
449
457
|
const changeVal = (value) => {
|
|
450
458
|
emit("input", value);
|
|
451
459
|
emit("update:value", value);
|
|
@@ -458,6 +466,20 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
458
466
|
return val ? dataList.value.find((item) => item[props.valueAlias] === val) : val;
|
|
459
467
|
}
|
|
460
468
|
};
|
|
469
|
+
if (!props.multiple && !props.assignmentOnSelect) {
|
|
470
|
+
const elSelectRef = (_d = (_c = (_b = (_a = popLazySelectRef.value) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfLazySelect) == null ? void 0 : _c.$refs) == null ? void 0 : _d.nfVirtualSelect;
|
|
471
|
+
if (elSelectRef) {
|
|
472
|
+
vueDemi.nextTick(() => {
|
|
473
|
+
resetPlaceholder.value = true;
|
|
474
|
+
let timer = setTimeout(() => {
|
|
475
|
+
clearTimeout(timer);
|
|
476
|
+
timer = void 0;
|
|
477
|
+
resetPlaceholder.value = false;
|
|
478
|
+
elSelectRef.selectedLabel = popLazySelectRef.value.keyword;
|
|
479
|
+
}, 30);
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
461
483
|
if (!props.multiple) {
|
|
462
484
|
if (props.popdownOnSelect) {
|
|
463
485
|
changeVal(void 0);
|
|
@@ -479,6 +501,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
479
501
|
});
|
|
480
502
|
return Object.assign({
|
|
481
503
|
refreshLazySelect,
|
|
504
|
+
placeholderComputed,
|
|
482
505
|
changeHide,
|
|
483
506
|
changeShow,
|
|
484
507
|
visibleChange,
|
|
@@ -542,7 +565,7 @@ var _sfc_render = function render() {
|
|
|
542
565
|
"keyword-alias": _vm.keywordAlias,
|
|
543
566
|
"loading-desc": _vm.loadingDesc,
|
|
544
567
|
"no-data-text": _vm.noDataText,
|
|
545
|
-
"placeholder": _vm.
|
|
568
|
+
"placeholder": _vm.placeholderComputed,
|
|
546
569
|
"multiple-limit": _vm.multipleLimit,
|
|
547
570
|
"collapse-tags": _vm.collapseTags,
|
|
548
571
|
"disabled": _vm.disabled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, computed } from "vue-demi";
|
|
1
|
+
import { defineComponent, ref, computed, nextTick } from "vue-demi";
|
|
2
2
|
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
3
|
const __sfc_main = defineComponent({
|
|
4
4
|
name: "nf-popup-lazy-select"
|
|
@@ -402,6 +402,11 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
402
402
|
const props = __props;
|
|
403
403
|
const emit = __ctx.emit;
|
|
404
404
|
const refreshLazySelect = ref(Date.now());
|
|
405
|
+
const resetPlaceholder = ref(false);
|
|
406
|
+
const placeholderComputed = computed(() => {
|
|
407
|
+
var _a;
|
|
408
|
+
return resetPlaceholder.value ? "" : !props.multiple && !props.assignmentOnSelect && ((_a = popLazySelectRef.value) == null ? void 0 : _a.keyword) ? popLazySelectRef.value.keyword : props.placeholder;
|
|
409
|
+
});
|
|
405
410
|
const changeHide = () => {
|
|
406
411
|
emit("popup-hide", false);
|
|
407
412
|
popLazySelectRef.value.visibleIntersect = false;
|
|
@@ -419,6 +424,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
419
424
|
const visibleChange = async (e) => {
|
|
420
425
|
if (!e) {
|
|
421
426
|
return "break";
|
|
427
|
+
} else if (!props.popdownOnSelect && !props.multiple && props.assignmentOnSelect) {
|
|
428
|
+
return "discard-cache";
|
|
422
429
|
}
|
|
423
430
|
};
|
|
424
431
|
const popLazySelectRef = ref();
|
|
@@ -444,6 +451,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
444
451
|
return props.value;
|
|
445
452
|
},
|
|
446
453
|
set(val) {
|
|
454
|
+
var _a, _b, _c, _d;
|
|
447
455
|
const changeVal = (value) => {
|
|
448
456
|
emit("input", value);
|
|
449
457
|
emit("update:value", value);
|
|
@@ -456,6 +464,20 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
456
464
|
return val ? dataList.value.find((item) => item[props.valueAlias] === val) : val;
|
|
457
465
|
}
|
|
458
466
|
};
|
|
467
|
+
if (!props.multiple && !props.assignmentOnSelect) {
|
|
468
|
+
const elSelectRef = (_d = (_c = (_b = (_a = popLazySelectRef.value) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfLazySelect) == null ? void 0 : _c.$refs) == null ? void 0 : _d.nfVirtualSelect;
|
|
469
|
+
if (elSelectRef) {
|
|
470
|
+
nextTick(() => {
|
|
471
|
+
resetPlaceholder.value = true;
|
|
472
|
+
let timer = setTimeout(() => {
|
|
473
|
+
clearTimeout(timer);
|
|
474
|
+
timer = void 0;
|
|
475
|
+
resetPlaceholder.value = false;
|
|
476
|
+
elSelectRef.selectedLabel = popLazySelectRef.value.keyword;
|
|
477
|
+
}, 30);
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
459
481
|
if (!props.multiple) {
|
|
460
482
|
if (props.popdownOnSelect) {
|
|
461
483
|
changeVal(void 0);
|
|
@@ -477,6 +499,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
477
499
|
});
|
|
478
500
|
return Object.assign({
|
|
479
501
|
refreshLazySelect,
|
|
502
|
+
placeholderComputed,
|
|
480
503
|
changeHide,
|
|
481
504
|
changeShow,
|
|
482
505
|
visibleChange,
|
|
@@ -540,7 +563,7 @@ var _sfc_render = function render() {
|
|
|
540
563
|
"keyword-alias": _vm.keywordAlias,
|
|
541
564
|
"loading-desc": _vm.loadingDesc,
|
|
542
565
|
"no-data-text": _vm.noDataText,
|
|
543
|
-
"placeholder": _vm.
|
|
566
|
+
"placeholder": _vm.placeholderComputed,
|
|
544
567
|
"multiple-limit": _vm.multipleLimit,
|
|
545
568
|
"collapse-tags": _vm.collapseTags,
|
|
546
569
|
"disabled": _vm.disabled,
|
package/package/index.ts
CHANGED
|
@@ -5,4 +5,4 @@ NfPopupLazySelect.install = (app: typeof Vue2) => {
|
|
|
5
5
|
app!.component('nf-popup-lazy-select', NfPopupLazySelect)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export default NfPopupLazySelect as typeof NfPopupLazySelect & PluginObject<undefined>
|
|
8
|
+
export default NfPopupLazySelect as typeof NfPopupLazySelect & PluginObject<undefined>
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
:loading-desc="loadingDesc"
|
|
37
37
|
:no-data-text="noDataText"
|
|
38
|
-
:placeholder="
|
|
38
|
+
:placeholder="placeholderComputed"
|
|
39
39
|
|
|
40
40
|
:multiple-limit="multipleLimit"
|
|
41
41
|
:collapse-tags="collapseTags"
|
|
@@ -115,6 +115,7 @@ export default defineComponent({
|
|
|
115
115
|
<script lang="ts" setup>
|
|
116
116
|
import {
|
|
117
117
|
computed,
|
|
118
|
+
nextTick,
|
|
118
119
|
ref
|
|
119
120
|
} from 'vue-demi'
|
|
120
121
|
|
|
@@ -350,6 +351,10 @@ const emit = defineEmits<{
|
|
|
350
351
|
(e: 'popup-show', event: boolean): void
|
|
351
352
|
}>()
|
|
352
353
|
const refreshLazySelect = ref(Date.now())
|
|
354
|
+
const resetPlaceholder = ref(false)
|
|
355
|
+
const placeholderComputed = computed(() => {
|
|
356
|
+
return resetPlaceholder.value ? '' : (!props.multiple && !props.assignmentOnSelect && popLazySelectRef.value?.keyword) ? popLazySelectRef.value.keyword : props.placeholder
|
|
357
|
+
})
|
|
353
358
|
const changeHide = () => {
|
|
354
359
|
emit('popup-hide', false)
|
|
355
360
|
popLazySelectRef.value.visibleIntersect = false
|
|
@@ -368,6 +373,8 @@ const changeShow = () => {
|
|
|
368
373
|
const visibleChange = async (e) => {
|
|
369
374
|
if (!e) {
|
|
370
375
|
return 'break'
|
|
376
|
+
} else if (!props.popdownOnSelect && !props.multiple && props.assignmentOnSelect) {
|
|
377
|
+
return 'discard-cache'
|
|
371
378
|
}
|
|
372
379
|
}
|
|
373
380
|
|
|
@@ -407,6 +414,20 @@ const currentVal = computed({
|
|
|
407
414
|
return val ? dataList.value.find(item => item[props.valueAlias] === val) : val
|
|
408
415
|
}
|
|
409
416
|
}
|
|
417
|
+
if (!props.multiple && !props.assignmentOnSelect) {
|
|
418
|
+
const elSelectRef = popLazySelectRef.value?.$refs?.nfLazySelect?.$refs?.nfVirtualSelect
|
|
419
|
+
if (elSelectRef) {
|
|
420
|
+
nextTick(() => {
|
|
421
|
+
resetPlaceholder.value = true
|
|
422
|
+
let timer: ReturnType<typeof setTimeout> | undefined = setTimeout(() => {
|
|
423
|
+
clearTimeout(timer)
|
|
424
|
+
timer = undefined
|
|
425
|
+
resetPlaceholder.value = false
|
|
426
|
+
elSelectRef.selectedLabel = popLazySelectRef.value.keyword
|
|
427
|
+
}, 30)
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
}
|
|
410
431
|
if (!props.multiple) { // 单选
|
|
411
432
|
if (props.popdownOnSelect) { // 选中关闭浮层
|
|
412
433
|
changeVal(undefined)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-popup-lazy-select",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.79",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/ui/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-lazy-select": "^3.2.
|
|
18
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
17
|
+
"@94ai/nf-lazy-select": "^3.2.79",
|
|
18
|
+
"@94ai/nf-theme-chalk": "^3.2.79",
|
|
19
19
|
"vue-demi": "^0.14.5"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"types": "lib/index.d.ts",
|
|
32
32
|
"main": "lib/nf-popup-lazy-select.cjs.js",
|
|
33
33
|
"module": "lib/nf-popup-lazy-select.esm-bundler.js",
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "9278b240de46890072d7b7177b5438990e31e09b"
|
|
35
35
|
}
|