@94ai/nf-virtual-select 100.1.30 → 100.1.32
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.
|
@@ -257,8 +257,41 @@ const _sfc_main = {
|
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
259
|
data() {
|
|
260
|
+
const that = this;
|
|
261
|
+
const ElOption = {
|
|
262
|
+
props: {
|
|
263
|
+
index: {
|
|
264
|
+
// 每一行的索引
|
|
265
|
+
type: Number,
|
|
266
|
+
required: true
|
|
267
|
+
},
|
|
268
|
+
source: {
|
|
269
|
+
// 每一行的内容
|
|
270
|
+
type: Object,
|
|
271
|
+
default() {
|
|
272
|
+
return {};
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
showTip: {
|
|
276
|
+
// 提示
|
|
277
|
+
type: Boolean,
|
|
278
|
+
default: true
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
render(h) {
|
|
282
|
+
return h(ElOptionNode, {
|
|
283
|
+
attrs: {
|
|
284
|
+
label: that.keyValue[0],
|
|
285
|
+
value: that.keyValue[1],
|
|
286
|
+
showTip: this.showTip,
|
|
287
|
+
source: this.source,
|
|
288
|
+
index: this.index
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
};
|
|
260
293
|
return {
|
|
261
|
-
itemComponent: this.dataComponent ??
|
|
294
|
+
itemComponent: this.dataComponent ?? ElOption,
|
|
262
295
|
selectArr: []
|
|
263
296
|
};
|
|
264
297
|
},
|
|
@@ -425,17 +458,15 @@ const _sfc_main = {
|
|
|
425
458
|
this.$nextTick(() => {
|
|
426
459
|
var _a;
|
|
427
460
|
if (this.isVirtualSelect) {
|
|
428
|
-
|
|
429
|
-
this.
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
} else {
|
|
436
|
-
this.selectArr = this.optionsList ? lodashEs.cloneDeep(this.optionsList) : [];
|
|
461
|
+
this.selectArr = ((_a = this.optionsList) == null ? void 0 : _a.map((it) => ({
|
|
462
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
463
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
464
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
465
|
+
disabled: it["disabled"] ?? false
|
|
466
|
+
}))) ?? [];
|
|
467
|
+
if (this.currentVal) {
|
|
437
468
|
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
438
|
-
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item.
|
|
469
|
+
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
439
470
|
this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
440
471
|
} else {
|
|
441
472
|
const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
|
|
@@ -447,8 +478,8 @@ const _sfc_main = {
|
|
|
447
478
|
}
|
|
448
479
|
} else {
|
|
449
480
|
this.selectArr = (this.optionsList || []).map((it) => ({
|
|
450
|
-
|
|
451
|
-
|
|
481
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
482
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
452
483
|
disabled: it["disabled"] ?? false
|
|
453
484
|
}));
|
|
454
485
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import virtualList from "vue-virtual-scroll-list";
|
|
2
2
|
import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
|
|
3
|
-
import { isEqual
|
|
3
|
+
import { isEqual } from "lodash-es";
|
|
4
4
|
const _sfc_main$1 = {
|
|
5
5
|
name: "ItemComponent",
|
|
6
6
|
props: {
|
|
@@ -255,8 +255,41 @@ const _sfc_main = {
|
|
|
255
255
|
}
|
|
256
256
|
},
|
|
257
257
|
data() {
|
|
258
|
+
const that = this;
|
|
259
|
+
const ElOption = {
|
|
260
|
+
props: {
|
|
261
|
+
index: {
|
|
262
|
+
// 每一行的索引
|
|
263
|
+
type: Number,
|
|
264
|
+
required: true
|
|
265
|
+
},
|
|
266
|
+
source: {
|
|
267
|
+
// 每一行的内容
|
|
268
|
+
type: Object,
|
|
269
|
+
default() {
|
|
270
|
+
return {};
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
showTip: {
|
|
274
|
+
// 提示
|
|
275
|
+
type: Boolean,
|
|
276
|
+
default: true
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
render(h) {
|
|
280
|
+
return h(ElOptionNode, {
|
|
281
|
+
attrs: {
|
|
282
|
+
label: that.keyValue[0],
|
|
283
|
+
value: that.keyValue[1],
|
|
284
|
+
showTip: this.showTip,
|
|
285
|
+
source: this.source,
|
|
286
|
+
index: this.index
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
};
|
|
258
291
|
return {
|
|
259
|
-
itemComponent: this.dataComponent ??
|
|
292
|
+
itemComponent: this.dataComponent ?? ElOption,
|
|
260
293
|
selectArr: []
|
|
261
294
|
};
|
|
262
295
|
},
|
|
@@ -423,17 +456,15 @@ const _sfc_main = {
|
|
|
423
456
|
this.$nextTick(() => {
|
|
424
457
|
var _a;
|
|
425
458
|
if (this.isVirtualSelect) {
|
|
426
|
-
|
|
427
|
-
this.
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
} else {
|
|
434
|
-
this.selectArr = this.optionsList ? cloneDeep(this.optionsList) : [];
|
|
459
|
+
this.selectArr = ((_a = this.optionsList) == null ? void 0 : _a.map((it) => ({
|
|
460
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
461
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
462
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
463
|
+
disabled: it["disabled"] ?? false
|
|
464
|
+
}))) ?? [];
|
|
465
|
+
if (this.currentVal) {
|
|
435
466
|
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
436
|
-
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item.
|
|
467
|
+
const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
|
|
437
468
|
this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
|
|
438
469
|
} else {
|
|
439
470
|
const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
|
|
@@ -445,8 +476,8 @@ const _sfc_main = {
|
|
|
445
476
|
}
|
|
446
477
|
} else {
|
|
447
478
|
this.selectArr = (this.optionsList || []).map((it) => ({
|
|
448
|
-
|
|
449
|
-
|
|
479
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
480
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
450
481
|
disabled: it["disabled"] ?? false
|
|
451
482
|
}));
|
|
452
483
|
}
|
|
@@ -256,8 +256,38 @@ export default {
|
|
|
256
256
|
}
|
|
257
257
|
},
|
|
258
258
|
data() {
|
|
259
|
+
const that = this
|
|
260
|
+
const ElOption = {
|
|
261
|
+
props: {
|
|
262
|
+
index: { // 每一行的索引
|
|
263
|
+
type: Number,
|
|
264
|
+
required: true
|
|
265
|
+
},
|
|
266
|
+
source: { // 每一行的内容
|
|
267
|
+
type: Object,
|
|
268
|
+
default() {
|
|
269
|
+
return {}
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
showTip: { // 提示
|
|
273
|
+
type: Boolean,
|
|
274
|
+
default: true
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
render(h) {
|
|
278
|
+
return h(ElOptionNode, {
|
|
279
|
+
attrs: {
|
|
280
|
+
label: that.keyValue[0],
|
|
281
|
+
value: that.keyValue[1],
|
|
282
|
+
showTip: this.showTip,
|
|
283
|
+
source: this.source,
|
|
284
|
+
index: this.index,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
259
289
|
return {
|
|
260
|
-
itemComponent: this.dataComponent ??
|
|
290
|
+
itemComponent: this.dataComponent ?? ElOption,
|
|
261
291
|
selectArr: []
|
|
262
292
|
}
|
|
263
293
|
},
|
|
@@ -420,23 +450,21 @@ export default {
|
|
|
420
450
|
this.$nextTick(() => {
|
|
421
451
|
if ((this.isVirtualSelect)) {
|
|
422
452
|
// 虚拟
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
} else {
|
|
453
|
+
// 无回显值
|
|
454
|
+
this.selectArr = this.optionsList?.map(it => ({
|
|
455
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
456
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
457
|
+
[this.dataKey]: it[this.keyValue[1]],
|
|
458
|
+
disabled: it['disabled'] ?? false
|
|
459
|
+
})) ?? [];
|
|
460
|
+
if (this.currentVal) {
|
|
432
461
|
// 有回显值
|
|
433
|
-
this.selectArr = this.optionsList ? cloneDeep(this.optionsList) : [];
|
|
434
462
|
if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
|
|
435
|
-
|
|
436
|
-
const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item.
|
|
463
|
+
// 多选
|
|
464
|
+
const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
|
|
437
465
|
this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))];
|
|
438
466
|
} else {
|
|
439
|
-
|
|
467
|
+
// 单选
|
|
440
468
|
const index = this.selectArr.findIndex(item => item.value === this.currentVal);
|
|
441
469
|
if (index !== -1) {
|
|
442
470
|
const obj = this.selectArr.splice(index, 1)[0];
|
|
@@ -447,8 +475,8 @@ export default {
|
|
|
447
475
|
} else {
|
|
448
476
|
// 非虚拟选择器
|
|
449
477
|
this.selectArr = (this.optionsList || []).map(it => ({
|
|
450
|
-
|
|
451
|
-
|
|
478
|
+
[this.keyValue[0]]: it[this.keyValue[0]],
|
|
479
|
+
[this.keyValue[1]]: it[this.keyValue[1]],
|
|
452
480
|
disabled: it['disabled'] ?? false
|
|
453
481
|
}))
|
|
454
482
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-virtual-select",
|
|
3
|
-
"version": "100.1.
|
|
3
|
+
"version": "100.1.32",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "DESKTOP-1EDDQ79\\dev026 <liuxiangxiang@94ai.com>",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-theme-chalk": "^100.1.
|
|
17
|
+
"@94ai/nf-theme-chalk": "^100.1.32",
|
|
18
18
|
"lodash-es": "^4.17.21",
|
|
19
19
|
"vue-demi": "^0.14.5",
|
|
20
20
|
"vue-virtual-scroll-list": "^2.3.5"
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"types": "lib/index.d.ts",
|
|
33
33
|
"main": "lib/nf-virtual-select.cjs.js",
|
|
34
34
|
"module": "lib/nf-virtual-select.esm-bundler.js",
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "790349805e1e9cc30983feedbb3ca69cb7dccfaf"
|
|
36
36
|
}
|