@94ai/nf-virtual-select 3.3.0 → 3.3.4

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: () => {
@@ -311,7 +319,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
311
319
  }>>, {}, {
312
320
  value: string | number | unknown[];
313
321
  showTip: boolean;
314
- placeholder: string;
315
322
  tag: string;
316
323
  offset: number;
317
324
  start: number;
@@ -334,12 +341,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
334
341
  footerStyle: Record<string, any>;
335
342
  keeps: number;
336
343
  estimateSize: number;
344
+ echoValueTop: boolean;
337
345
  extraProps: Record<string, any>;
338
346
  dataKey: string | Function;
339
347
  keyValue: unknown[];
340
348
  itemOptions: Record<string, any>;
341
349
  virtualList: boolean;
342
350
  options: unknown[];
351
+ placeholder: string;
343
352
  multiple: boolean;
344
353
  width: string;
345
354
  maxWidth: string;
@@ -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: () => {
@@ -838,7 +859,6 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
838
859
  }, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, {
839
860
  value: string | number | unknown[];
840
861
  showTip: boolean;
841
- placeholder: string;
842
862
  tag: string;
843
863
  offset: number;
844
864
  start: number;
@@ -861,12 +881,14 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
861
881
  footerStyle: Record<string, any>;
862
882
  keeps: number;
863
883
  estimateSize: number;
884
+ echoValueTop: boolean;
864
885
  extraProps: Record<string, any>;
865
886
  dataKey: string | Function;
866
887
  keyValue: unknown[];
867
888
  itemOptions: Record<string, any>;
868
889
  virtualList: boolean;
869
890
  options: unknown[];
891
+ placeholder: string;
870
892
  multiple: boolean;
871
893
  width: string;
872
894
  maxWidth: string;
@@ -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: () => {
@@ -323,7 +331,6 @@ declare const _default: import("vue").DefineComponent<{
323
331
  }>>, {
324
332
  value: string | number | unknown[];
325
333
  showTip: boolean;
326
- placeholder: string;
327
334
  tag: string;
328
335
  offset: number;
329
336
  start: number;
@@ -346,12 +353,14 @@ declare const _default: import("vue").DefineComponent<{
346
353
  footerStyle: Record<string, any>;
347
354
  keeps: number;
348
355
  estimateSize: number;
356
+ echoValueTop: boolean;
349
357
  extraProps: Record<string, any>;
350
358
  dataKey: string | Function;
351
359
  keyValue: unknown[];
352
360
  itemOptions: Record<string, any>;
353
361
  virtualList: boolean;
354
362
  options: unknown[];
363
+ placeholder: string;
355
364
  multiple: boolean;
356
365
  width: string;
357
366
  maxWidth: string;
@@ -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.0",
3
+ "version": "3.3.4",
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.0",
18
- "@94ai/nf-theme-chalk": "^3.3.0",
17
+ "@94ai/common-utils": "^3.3.4",
18
+ "@94ai/nf-theme-chalk": "^3.3.4",
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": "3fb4167c1ba3abcf18bdce8af115483594286216"
36
+ "gitHead": "c4bc5f0d68cd00eded4eeb6ebe88e83f0e82d8a5"
37
37
  }