@94ai/nf-popup-lazy-select 3.2.72 → 3.2.75
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/lib/index.d.ts +308 -132
- package/lib/nf-popup-lazy-select.cjs.js +204 -72
- package/lib/nf-popup-lazy-select.esm-bundler.js +205 -73
- package/lib/nf-popup-lazy-select.vue.d.ts +131 -50
- package/package/nf-popup-lazy-select.vue +276 -129
- package/package.json +4 -4
|
@@ -6,6 +6,18 @@ const __sfc_main = vueDemi.defineComponent({
|
|
|
6
6
|
name: "nf-popup-lazy-select"
|
|
7
7
|
});
|
|
8
8
|
__sfc_main.props = {
|
|
9
|
+
popdownOnSelect: {
|
|
10
|
+
key: "popdownOnSelect",
|
|
11
|
+
required: false,
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
assignmentOnSelect: {
|
|
16
|
+
key: "assignmentOnSelect",
|
|
17
|
+
required: false,
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
9
21
|
keywordAlias: {
|
|
10
22
|
key: "keywordAlias",
|
|
11
23
|
required: false,
|
|
@@ -96,12 +108,6 @@ __sfc_main.props = {
|
|
|
96
108
|
type: Boolean,
|
|
97
109
|
default: false
|
|
98
110
|
},
|
|
99
|
-
popperAppendToBody: {
|
|
100
|
-
key: "popperAppendToBody",
|
|
101
|
-
required: false,
|
|
102
|
-
type: Boolean,
|
|
103
|
-
default: true
|
|
104
|
-
},
|
|
105
111
|
placeholder: {
|
|
106
112
|
key: "placeholder",
|
|
107
113
|
required: false,
|
|
@@ -282,7 +288,7 @@ __sfc_main.props = {
|
|
|
282
288
|
key: "width",
|
|
283
289
|
required: false,
|
|
284
290
|
type: String,
|
|
285
|
-
default: "100%"
|
|
291
|
+
default: "calc(100% - 6px)"
|
|
286
292
|
},
|
|
287
293
|
height: {
|
|
288
294
|
key: "height",
|
|
@@ -290,62 +296,73 @@ __sfc_main.props = {
|
|
|
290
296
|
type: String,
|
|
291
297
|
default: "245px"
|
|
292
298
|
},
|
|
299
|
+
maxWidth: {
|
|
300
|
+
key: "maxWidth",
|
|
301
|
+
required: false,
|
|
302
|
+
type: String,
|
|
303
|
+
default: "calc(100% - 6px)"
|
|
304
|
+
},
|
|
293
305
|
showTip: {
|
|
294
306
|
key: "showTip",
|
|
295
307
|
required: false,
|
|
296
308
|
type: Boolean,
|
|
297
309
|
default: false
|
|
298
310
|
},
|
|
299
|
-
|
|
300
|
-
key: "
|
|
311
|
+
popupWidth: {
|
|
312
|
+
key: "popupWidth",
|
|
301
313
|
required: false,
|
|
302
314
|
type: [String, Number],
|
|
303
|
-
default: "
|
|
315
|
+
default: "200"
|
|
304
316
|
},
|
|
305
|
-
|
|
306
|
-
key: "
|
|
317
|
+
popupClass: {
|
|
318
|
+
key: "popupClass",
|
|
307
319
|
required: false,
|
|
308
320
|
type: String,
|
|
309
321
|
default: ""
|
|
310
322
|
},
|
|
311
|
-
|
|
312
|
-
key: "
|
|
323
|
+
popupTitle: {
|
|
324
|
+
key: "popupTitle",
|
|
325
|
+
required: false,
|
|
326
|
+
type: String
|
|
327
|
+
},
|
|
328
|
+
popupDisabled: {
|
|
329
|
+
key: "popupDisabled",
|
|
313
330
|
required: false,
|
|
314
331
|
type: Boolean,
|
|
315
332
|
default: false
|
|
316
333
|
},
|
|
317
|
-
|
|
318
|
-
key: "
|
|
334
|
+
popupOffset: {
|
|
335
|
+
key: "popupOffset",
|
|
319
336
|
required: false,
|
|
320
337
|
type: Number,
|
|
321
338
|
default: 0
|
|
322
339
|
},
|
|
323
|
-
|
|
324
|
-
key: "
|
|
340
|
+
popupPlacement: {
|
|
341
|
+
key: "popupPlacement",
|
|
325
342
|
required: false,
|
|
326
343
|
type: String,
|
|
327
344
|
default: "bottom"
|
|
328
345
|
},
|
|
329
|
-
|
|
330
|
-
key: "
|
|
346
|
+
popupTrigger: {
|
|
347
|
+
key: "popupTrigger",
|
|
331
348
|
required: false,
|
|
332
349
|
type: String,
|
|
333
350
|
default: "click"
|
|
334
351
|
},
|
|
335
|
-
|
|
336
|
-
key: "
|
|
352
|
+
popupTransition: {
|
|
353
|
+
key: "popupTransition",
|
|
337
354
|
required: false,
|
|
338
355
|
type: String,
|
|
339
356
|
default: "fade-in-linear"
|
|
340
357
|
},
|
|
341
|
-
|
|
342
|
-
key: "
|
|
358
|
+
popupVisibleArrow: {
|
|
359
|
+
key: "popupVisibleArrow",
|
|
343
360
|
required: false,
|
|
344
361
|
type: Boolean,
|
|
345
362
|
default: true
|
|
346
363
|
},
|
|
347
|
-
|
|
348
|
-
key: "
|
|
364
|
+
popupOptions: {
|
|
365
|
+
key: "popupOptions",
|
|
349
366
|
required: false,
|
|
350
367
|
type: Object,
|
|
351
368
|
default: () => ({
|
|
@@ -353,20 +370,19 @@ __sfc_main.props = {
|
|
|
353
370
|
gpuAcceleration: false
|
|
354
371
|
})
|
|
355
372
|
},
|
|
356
|
-
|
|
357
|
-
key: "
|
|
373
|
+
popupOpenDelay: {
|
|
374
|
+
key: "popupOpenDelay",
|
|
358
375
|
required: false,
|
|
359
|
-
type: Number
|
|
360
|
-
default: void 0
|
|
376
|
+
type: Number
|
|
361
377
|
},
|
|
362
|
-
|
|
363
|
-
key: "
|
|
378
|
+
popupCloseDelay: {
|
|
379
|
+
key: "popupCloseDelay",
|
|
364
380
|
required: false,
|
|
365
381
|
type: Number,
|
|
366
382
|
default: 200
|
|
367
383
|
},
|
|
368
|
-
|
|
369
|
-
key: "
|
|
384
|
+
popupTabindex: {
|
|
385
|
+
key: "popupTabindex",
|
|
370
386
|
required: false,
|
|
371
387
|
type: Number,
|
|
372
388
|
default: 0
|
|
@@ -376,46 +392,143 @@ __sfc_main.props = {
|
|
|
376
392
|
required: false,
|
|
377
393
|
type: String,
|
|
378
394
|
default: "mini"
|
|
395
|
+
},
|
|
396
|
+
value: {
|
|
397
|
+
key: "value",
|
|
398
|
+
required: false,
|
|
399
|
+
type: [String, Number, Array],
|
|
400
|
+
default: void 0
|
|
379
401
|
}
|
|
380
402
|
};
|
|
381
403
|
__sfc_main.setup = (__props, __ctx) => {
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
404
|
+
const props = __props;
|
|
405
|
+
const emit = __ctx.emit;
|
|
406
|
+
const changeShow = () => {
|
|
407
|
+
var _a, _b, _c, _d, _e;
|
|
408
|
+
const visible = (_e = (_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) == null ? void 0 : _e.visible;
|
|
409
|
+
if (popup.value && typeof visible === "boolean" && !visible) {
|
|
410
|
+
popLazySelectRef.value.$refs.nfLazySelect.$refs.nfVirtualSelect.toggleMenu();
|
|
411
|
+
}
|
|
412
|
+
emit("popup-show", popup.value);
|
|
413
|
+
};
|
|
414
|
+
const popLazySelectRef = vueDemi.ref();
|
|
415
|
+
const popup = vueDemi.ref(false);
|
|
416
|
+
const dataList = vueDemi.ref([]);
|
|
417
|
+
const dataMap = vueDemi.ref({});
|
|
418
|
+
const lockVisibleChange = vueDemi.ref(false);
|
|
419
|
+
const visibleChange = async (e) => {
|
|
420
|
+
if (lockVisibleChange.value) {
|
|
421
|
+
lockVisibleChange.value = false;
|
|
422
|
+
return "break";
|
|
423
|
+
}
|
|
424
|
+
emit("visible-change", e);
|
|
425
|
+
};
|
|
426
|
+
const fetchDataHandler = (e) => {
|
|
427
|
+
var _a;
|
|
428
|
+
(_a = e.originData) == null ? void 0 : _a.forEach((data) => {
|
|
429
|
+
if (!dataMap.value[data[props.valueAlias]]) {
|
|
430
|
+
dataMap.value[data[props.valueAlias]] = true;
|
|
431
|
+
dataList.value.push(data);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
emit("fetch-data", {
|
|
435
|
+
allCachedList: dataList.value,
|
|
436
|
+
currentList: e.originData,
|
|
437
|
+
event: e
|
|
438
|
+
});
|
|
385
439
|
};
|
|
440
|
+
const currentVal = vueDemi.computed({
|
|
441
|
+
get() {
|
|
442
|
+
return props.value;
|
|
443
|
+
},
|
|
444
|
+
set(val) {
|
|
445
|
+
const changeVal = (value) => {
|
|
446
|
+
emit("input", value);
|
|
447
|
+
emit("update:value", value);
|
|
448
|
+
emit("change", value);
|
|
449
|
+
};
|
|
450
|
+
const getValItem = () => {
|
|
451
|
+
if (props.multiple) {
|
|
452
|
+
return val == null ? void 0 : val.map((it) => dataList.value.find((item) => item[props.valueAlias] === it));
|
|
453
|
+
} else {
|
|
454
|
+
return val ? dataList.value.find((item) => item[props.valueAlias] === val) : val;
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
if (!props.multiple) {
|
|
458
|
+
if (props.popdownOnSelect) {
|
|
459
|
+
changeVal(void 0);
|
|
460
|
+
if (val) {
|
|
461
|
+
popup.value = false;
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
if (!props.assignmentOnSelect) {
|
|
465
|
+
changeVal(void 0);
|
|
466
|
+
} else {
|
|
467
|
+
changeVal(val);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (val) {
|
|
471
|
+
lockVisibleChange.value = true;
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
changeVal(val);
|
|
475
|
+
}
|
|
476
|
+
emit("select-item", getValItem());
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
return Object.assign({
|
|
480
|
+
changeShow,
|
|
481
|
+
popLazySelectRef,
|
|
482
|
+
popup,
|
|
483
|
+
dataList,
|
|
484
|
+
visibleChange,
|
|
485
|
+
fetchDataHandler,
|
|
486
|
+
currentVal
|
|
487
|
+
}, {
|
|
488
|
+
currentVal,
|
|
489
|
+
dataMap,
|
|
490
|
+
dataList,
|
|
491
|
+
popup,
|
|
492
|
+
popLazySelectRef
|
|
493
|
+
});
|
|
386
494
|
};
|
|
387
495
|
var _sfc_render = function render() {
|
|
388
496
|
var _vm = this, _c = _vm._self._c;
|
|
389
497
|
_vm._self._setupProxy;
|
|
390
|
-
return _c("
|
|
391
|
-
staticClass: "nf-popup-lazy-select"
|
|
392
|
-
}, [_c("el-popover", {
|
|
498
|
+
return _c("el-popover", {
|
|
499
|
+
staticClass: "nf-popup-lazy-select",
|
|
393
500
|
attrs: {
|
|
394
|
-
"
|
|
395
|
-
"
|
|
396
|
-
"
|
|
397
|
-
"
|
|
398
|
-
"
|
|
399
|
-
"
|
|
400
|
-
"
|
|
401
|
-
"
|
|
402
|
-
"
|
|
403
|
-
"
|
|
404
|
-
"
|
|
405
|
-
"
|
|
501
|
+
"width": _vm.popupWidth,
|
|
502
|
+
"disabled": _vm.popupDisabled,
|
|
503
|
+
"popper-class": (_vm.popupClass || "") + " nf-popup-lazy-select-popover",
|
|
504
|
+
"offset": _vm.popupOffset,
|
|
505
|
+
"title": _vm.popupTitle,
|
|
506
|
+
"trigger": _vm.popupTrigger,
|
|
507
|
+
"placement": _vm.popupPlacement,
|
|
508
|
+
"transition": _vm.popupTransition,
|
|
509
|
+
"visible-arrow": _vm.popupVisibleArrow,
|
|
510
|
+
"popper-options": _vm.popupOptions,
|
|
511
|
+
"open-delay": _vm.popupOpenDelay,
|
|
512
|
+
"close-delay": _vm.popupCloseDelay,
|
|
513
|
+
"tabindex": _vm.popupTabindex
|
|
406
514
|
},
|
|
407
515
|
on: {
|
|
408
|
-
"after-enter": (e) => _vm.$emit("after-enter", e),
|
|
409
|
-
"after-leave": (e) => _vm.$emit("after-leave", e),
|
|
410
|
-
"hide": (e) => _vm.$emit("hide", e),
|
|
411
|
-
"show":
|
|
412
|
-
}
|
|
413
|
-
}, [_c("span", {
|
|
414
|
-
attrs: {
|
|
415
|
-
"slot": "reference"
|
|
516
|
+
"after-enter": (e) => _vm.$emit("popup-after-enter", e),
|
|
517
|
+
"after-leave": (e) => _vm.$emit("popup-after-leave", e),
|
|
518
|
+
"hide": (e) => _vm.$emit("popup-hide", e),
|
|
519
|
+
"show": _vm.changeShow
|
|
416
520
|
},
|
|
417
|
-
|
|
418
|
-
|
|
521
|
+
model: {
|
|
522
|
+
value: _vm.popup,
|
|
523
|
+
callback: function($$v) {
|
|
524
|
+
_vm.popup = $$v;
|
|
525
|
+
},
|
|
526
|
+
expression: "popup"
|
|
527
|
+
}
|
|
528
|
+
}, [_vm._t("default", null, {
|
|
529
|
+
"slot": "reference"
|
|
530
|
+
}), _c("nf-lazy-select", _vm._b({
|
|
531
|
+
ref: "popLazySelectRef",
|
|
419
532
|
attrs: {
|
|
420
533
|
"request": _vm.request,
|
|
421
534
|
"page-size": _vm.pageSize,
|
|
@@ -433,7 +546,7 @@ var _sfc_render = function render() {
|
|
|
433
546
|
"multiple": _vm.multiple,
|
|
434
547
|
"reserve-keyword": _vm.reserveKeyword,
|
|
435
548
|
"default-first-option": _vm.defaultFirstOption,
|
|
436
|
-
"popper-append-to-body":
|
|
549
|
+
"popper-append-to-body": false,
|
|
437
550
|
"key-value": _vm.keyValue,
|
|
438
551
|
"data-key": _vm.dataKey,
|
|
439
552
|
"virtual-list": _vm.virtualList,
|
|
@@ -459,28 +572,47 @@ var _sfc_render = function render() {
|
|
|
459
572
|
"footer-tag": _vm.footerTag,
|
|
460
573
|
"footer-class": _vm.footerClass,
|
|
461
574
|
"footer-style": _vm.footerStyle,
|
|
462
|
-
"extra-props": _vm.extraProps
|
|
575
|
+
"extra-props": _vm.extraProps,
|
|
576
|
+
"size": _vm.size,
|
|
577
|
+
"showTip": _vm.showTip,
|
|
578
|
+
"width": _vm.width,
|
|
579
|
+
"max-width": _vm.maxWidth,
|
|
580
|
+
"height": _vm.dataList.length ? _vm.height : "0"
|
|
463
581
|
},
|
|
464
582
|
on: {
|
|
465
583
|
"scroll": (e) => _vm.$emit("scroll", e),
|
|
466
584
|
"totop": (e) => _vm.$emit("totop", e),
|
|
467
585
|
"tobottom": (e) => _vm.$emit("tobottom", e),
|
|
468
586
|
"resized": (e) => _vm.$emit("resized", e),
|
|
469
|
-
"fetch-data": (e) => _vm.$emit(e),
|
|
470
587
|
"remove-tag": (e) => _vm.$emit("remove-tag", e),
|
|
471
588
|
"blur": (e) => _vm.$emit("blur", e),
|
|
472
|
-
"focus": (e) => _vm.$emit("
|
|
473
|
-
"clear": (e) => _vm.$emit("
|
|
474
|
-
"visible-change":
|
|
589
|
+
"focus": (e) => _vm.$emit("focus", e),
|
|
590
|
+
"clear": (e) => _vm.$emit("clear", e),
|
|
591
|
+
"visible-change": _vm.visibleChange,
|
|
592
|
+
"fetch-data": _vm.fetchDataHandler
|
|
475
593
|
},
|
|
476
594
|
model: {
|
|
477
|
-
value: _vm.
|
|
595
|
+
value: _vm.currentVal,
|
|
478
596
|
callback: function($$v) {
|
|
479
|
-
_vm.
|
|
597
|
+
_vm.currentVal = $$v;
|
|
480
598
|
},
|
|
481
|
-
expression: "
|
|
599
|
+
expression: "currentVal"
|
|
482
600
|
}
|
|
483
|
-
}, "nf-
|
|
601
|
+
}, "nf-lazy-select", _vm.$attrs, false), [!_vm.multiple ? _vm._t("prefix", function() {
|
|
602
|
+
return [_c("span", {
|
|
603
|
+
staticClass: "nf-input__prefix el-input__prefix"
|
|
604
|
+
}, [_c("i", {
|
|
605
|
+
staticClass: "el-icon-search"
|
|
606
|
+
})])];
|
|
607
|
+
}, {
|
|
608
|
+
"slot": "prefix"
|
|
609
|
+
}) : _vm._e(), _vm._t("header", null, {
|
|
610
|
+
"slot": "header"
|
|
611
|
+
}), _vm._t("empty", null, {
|
|
612
|
+
"slot": "empty"
|
|
613
|
+
}), _vm._t("loading", null, {
|
|
614
|
+
"slot": "loading"
|
|
615
|
+
})], 2)], 2);
|
|
484
616
|
};
|
|
485
617
|
var _sfc_staticRenderFns = [];
|
|
486
618
|
var __component__ = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(__sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, null, null, null);
|