@94ai/nf-virtual-select 3.3.2 → 3.3.10

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 CHANGED
@@ -94,6 +94,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
94
94
  type: NumberConstructor;
95
95
  default: number;
96
96
  };
97
+ echoValueTop: {
98
+ type: BooleanConstructor;
99
+ default: boolean;
100
+ };
97
101
  extraProps: {
98
102
  type: ObjectConstructor;
99
103
  default: () => {
@@ -247,6 +251,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
247
251
  type: NumberConstructor;
248
252
  default: number;
249
253
  };
254
+ echoValueTop: {
255
+ type: BooleanConstructor;
256
+ default: boolean;
257
+ };
250
258
  extraProps: {
251
259
  type: ObjectConstructor;
252
260
  default: () => {
@@ -333,6 +341,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
333
341
  footerStyle: Record<string, any>;
334
342
  keeps: number;
335
343
  estimateSize: number;
344
+ echoValueTop: boolean;
336
345
  extraProps: Record<string, any>;
337
346
  dataKey: string | Function;
338
347
  keyValue: unknown[];
@@ -436,6 +445,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
436
445
  type: NumberConstructor;
437
446
  default: number;
438
447
  };
448
+ echoValueTop: {
449
+ type: BooleanConstructor;
450
+ default: boolean;
451
+ };
439
452
  extraProps: {
440
453
  type: ObjectConstructor;
441
454
  default: () => {
@@ -605,6 +618,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
605
618
  type: NumberConstructor;
606
619
  default: number;
607
620
  };
621
+ echoValueTop: {
622
+ type: BooleanConstructor;
623
+ default: boolean;
624
+ };
608
625
  extraProps: {
609
626
  type: ObjectConstructor;
610
627
  default: () => {
@@ -758,6 +775,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
758
775
  type: NumberConstructor;
759
776
  default: number;
760
777
  };
778
+ echoValueTop: {
779
+ type: BooleanConstructor;
780
+ default: boolean;
781
+ };
761
782
  extraProps: {
762
783
  type: ObjectConstructor;
763
784
  default: () => {
@@ -860,6 +881,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
860
881
  footerStyle: Record<string, any>;
861
882
  keeps: number;
862
883
  estimateSize: number;
884
+ echoValueTop: boolean;
863
885
  extraProps: Record<string, any>;
864
886
  dataKey: string | Function;
865
887
  keyValue: unknown[];
@@ -964,6 +986,10 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
964
986
  type: NumberConstructor;
965
987
  default: number;
966
988
  };
989
+ echoValueTop: {
990
+ type: BooleanConstructor;
991
+ default: boolean;
992
+ };
967
993
  extraProps: {
968
994
  type: ObjectConstructor;
969
995
  default: () => {
@@ -228,6 +228,11 @@ const _sfc_main = {
228
228
  type: Number,
229
229
  default: 50
230
230
  },
231
+ echoValueTop: {
232
+ // 处理当回显值在虚拟滚动渲染外不能正确回显问题
233
+ type: Boolean,
234
+ default: true
235
+ },
231
236
  extraProps: {
232
237
  type: Object,
233
238
  default: () => ({
@@ -523,6 +528,18 @@ const _sfc_main = {
523
528
  [this.dataKey]: it[this.keyValue[1]],
524
529
  disabled: it["disabled"] ?? false
525
530
  }))) ?? [];
531
+ if (this.currentVal && this.echoValueTop) {
532
+ if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
533
+ const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
534
+ this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
535
+ } else {
536
+ const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
537
+ if (index !== -1) {
538
+ const obj = this.selectArr.splice(index, 1)[0];
539
+ this.selectArr.unshift(obj);
540
+ }
541
+ }
542
+ }
526
543
  } else {
527
544
  this.selectArr = (this.optionsList || []).map((it) => ({
528
545
  [this.keyValue[0]]: it[this.keyValue[0]],
@@ -226,6 +226,11 @@ const _sfc_main = {
226
226
  type: Number,
227
227
  default: 50
228
228
  },
229
+ echoValueTop: {
230
+ // 处理当回显值在虚拟滚动渲染外不能正确回显问题
231
+ type: Boolean,
232
+ default: true
233
+ },
229
234
  extraProps: {
230
235
  type: Object,
231
236
  default: () => ({
@@ -521,6 +526,18 @@ const _sfc_main = {
521
526
  [this.dataKey]: it[this.keyValue[1]],
522
527
  disabled: it["disabled"] ?? false
523
528
  }))) ?? [];
529
+ if (this.currentVal && this.echoValueTop) {
530
+ if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
531
+ const multiple_elements = this.selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
532
+ this.selectArr = [...multiple_elements, ...this.selectArr.filter((item) => !multiple_elements.includes(item))];
533
+ } else {
534
+ const index = this.selectArr.findIndex((item) => item.value === this.currentVal);
535
+ if (index !== -1) {
536
+ const obj = this.selectArr.splice(index, 1)[0];
537
+ this.selectArr.unshift(obj);
538
+ }
539
+ }
540
+ }
524
541
  } else {
525
542
  this.selectArr = (this.optionsList || []).map((it) => ({
526
543
  [this.keyValue[0]]: it[this.keyValue[0]],
@@ -90,6 +90,10 @@ declare const _default: import("vue").DefineComponent<{
90
90
  type: NumberConstructor;
91
91
  default: number;
92
92
  };
93
+ echoValueTop: {
94
+ type: BooleanConstructor;
95
+ default: boolean;
96
+ };
93
97
  extraProps: {
94
98
  type: ObjectConstructor;
95
99
  default: () => {
@@ -259,6 +263,10 @@ declare const _default: import("vue").DefineComponent<{
259
263
  type: NumberConstructor;
260
264
  default: number;
261
265
  };
266
+ echoValueTop: {
267
+ type: BooleanConstructor;
268
+ default: boolean;
269
+ };
262
270
  extraProps: {
263
271
  type: ObjectConstructor;
264
272
  default: () => {
@@ -345,6 +353,7 @@ declare const _default: import("vue").DefineComponent<{
345
353
  footerStyle: Record<string, any>;
346
354
  keeps: number;
347
355
  estimateSize: number;
356
+ echoValueTop: boolean;
348
357
  extraProps: Record<string, any>;
349
358
  dataKey: string | Function;
350
359
  keyValue: unknown[];
@@ -196,6 +196,10 @@ export default {
196
196
  type: Number,
197
197
  default: 50
198
198
  },
199
+ echoValueTop: { // 处理当回显值在虚拟滚动渲染外不能正确回显问题
200
+ type: Boolean,
201
+ default: true
202
+ },
199
203
  extraProps: {
200
204
  type: Object,
201
205
  default: () => ({
@@ -482,21 +486,21 @@ export default {
482
486
  [this.dataKey]: it[this.keyValue[1]],
483
487
  disabled: it['disabled'] ?? false
484
488
  })) ?? []
485
- // if (this.currentVal) {
486
- // // 有回显值
487
- // if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
488
- // // 多选
489
- // const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
490
- // this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))]
491
- // } else {
492
- // // 单选
493
- // const index = this.selectArr.findIndex(item => item.value === this.currentVal)
494
- // if (index !== -1) {
495
- // const obj = this.selectArr.splice(index, 1)[0]
496
- // this.selectArr.unshift(obj)
497
- // }
498
- // }
499
- // }
489
+ if (this.currentVal && this.echoValueTop) {
490
+ // 有回显值
491
+ if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
492
+ // 多选
493
+ const multiple_elements = this.selectArr.filter(item => this.currentVal.includes(item[this.keyValue[1]]))
494
+ this.selectArr = [...multiple_elements, ...this.selectArr.filter(item => !multiple_elements.includes(item))]
495
+ } else {
496
+ // 单选
497
+ const index = this.selectArr.findIndex(item => item.value === this.currentVal)
498
+ if (index !== -1) {
499
+ const obj = this.selectArr.splice(index, 1)[0]
500
+ this.selectArr.unshift(obj)
501
+ }
502
+ }
503
+ }
500
504
  } else {
501
505
  // 非虚拟选择器
502
506
  this.selectArr = (this.optionsList || []).map(it => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-virtual-select",
3
- "version": "3.3.2",
3
+ "version": "3.3.10",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>,DESKTOP-1EDDQ79\\dev026 <liuxiangxiang@94ai.com>",
@@ -14,8 +14,8 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-utils": "^3.3.2",
18
- "@94ai/nf-theme-chalk": "^3.3.2",
17
+ "@94ai/common-utils": "^3.3.10",
18
+ "@94ai/nf-theme-chalk": "^3.3.10",
19
19
  "lodash-es": "^4.17.21",
20
20
  "vue-demi": "^0.14.5",
21
21
  "vue-virtual-scroll-list": "^2.3.5"
@@ -33,5 +33,5 @@
33
33
  "types": "lib/index.d.ts",
34
34
  "main": "lib/nf-virtual-select.cjs.js",
35
35
  "module": "lib/nf-virtual-select.esm-bundler.js",
36
- "gitHead": "452ef85be9233a97e8514ea86cdf20c1fac1c9e5"
36
+ "gitHead": "167d2cc9b9da08f267ff55ba260378bd4c317c1f"
37
37
  }