@94ai/nf-virtual-select 9.0.0 → 10.0.0

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.
@@ -1,34 +1,34 @@
1
- declare const _default: import("vue-demi").DefineComponent<{
2
- tag: {
3
- type: StringConstructor;
4
- default: string;
5
- };
6
- value: {
7
- type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
8
- default: () => "";
9
- };
10
- config: {
11
- type: ObjectConstructor;
12
- default: () => {};
13
- };
14
- }, {}, {
15
- sortable: undefined;
16
- }, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{
17
- tag: {
18
- type: StringConstructor;
19
- default: string;
20
- };
21
- value: {
22
- type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
23
- default: () => "";
24
- };
25
- config: {
26
- type: ObjectConstructor;
27
- default: () => {};
28
- };
29
- }>>, {
30
- value: string | number | boolean | unknown[];
31
- tag: string;
32
- config: Record<string, any>;
33
- }>;
34
- export default _default;
1
+ declare const _default: import("vue-demi").DefineComponent<{
2
+ tag: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ value: {
7
+ type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
8
+ default: () => "";
9
+ };
10
+ config: {
11
+ type: ObjectConstructor;
12
+ default: () => {};
13
+ };
14
+ }, {}, {
15
+ sortable: undefined;
16
+ }, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue-demi").ExtractPropTypes<{
17
+ tag: {
18
+ type: StringConstructor;
19
+ default: string;
20
+ };
21
+ value: {
22
+ type: (NumberConstructor | StringConstructor | ArrayConstructor | BooleanConstructor)[];
23
+ default: () => "";
24
+ };
25
+ config: {
26
+ type: ObjectConstructor;
27
+ default: () => {};
28
+ };
29
+ }>>, {
30
+ value: string | number | boolean | unknown[];
31
+ tag: string;
32
+ config: Record<string, any>;
33
+ }>;
34
+ export default _default;
@@ -2697,7 +2697,7 @@ const _sfc_main = {
2697
2697
  // 绑定方法
2698
2698
  bindEvents() {
2699
2699
  const events = {
2700
- ...this.$listeners || {},
2700
+ ...this.$listeners,
2701
2701
  ...this.itemOptions.events
2702
2702
  };
2703
2703
  if (events == null ? void 0 : events.change) {
@@ -2712,7 +2712,7 @@ const _sfc_main = {
2712
2712
  if (events == null ? void 0 : events["visible-change"]) {
2713
2713
  delete events["visible-change"];
2714
2714
  }
2715
- return events || {};
2715
+ return events;
2716
2716
  },
2717
2717
  isVirtualSelect() {
2718
2718
  return this.virtualList || this.itemOptions.virtualList;
@@ -2741,10 +2741,7 @@ const _sfc_main = {
2741
2741
  return (_b = (_a = this.$refs.nfVirtualSelectContainer) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfVirtualSelect;
2742
2742
  },
2743
2743
  matchedCount() {
2744
- const matchedNum = this.currentVal.filter((id) => {
2745
- var _a;
2746
- return (_a = this.selectArr) == null ? void 0 : _a.some((obj) => obj[this.keyValue[1]] === id);
2747
- }).length || 0;
2744
+ const matchedNum = this.currentVal.filter((id) => this.selectArr.some((obj) => obj[this.keyValue[1]] === id)).length;
2748
2745
  return matchedNum;
2749
2746
  }
2750
2747
  },
@@ -2831,18 +2828,17 @@ const _sfc_main = {
2831
2828
  }
2832
2829
  },
2833
2830
  init() {
2834
- var _a, _b;
2835
2831
  if (this.isVirtualSelect) {
2836
- let selectArr = (_b = (_a = this.optionsList) == null ? void 0 : _a.map((it) => {
2837
- var _a2;
2832
+ let selectArr = this.optionsList.map((it) => {
2833
+ var _a;
2838
2834
  return {
2839
2835
  ...it,
2840
2836
  [this.keyValue[0]]: it[this.keyValue[0]],
2841
2837
  [this.keyValue[1]]: it[this.keyValue[1]],
2842
2838
  [this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
2843
- disabled: (_a2 = it["disabled"]) != null ? _a2 : false
2839
+ disabled: (_a = it["disabled"]) != null ? _a : false
2844
2840
  };
2845
- })) != null ? _b : [];
2841
+ });
2846
2842
  if (this.currentVal && this.echoValueTop) {
2847
2843
  if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
2848
2844
  const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
@@ -2864,19 +2860,19 @@ const _sfc_main = {
2864
2860
  }
2865
2861
  } else {
2866
2862
  let selectArr = [];
2867
- selectArr = (this.optionsList || []).map((it) => {
2868
- var _a2;
2863
+ selectArr = this.optionsList.map((it) => {
2864
+ var _a;
2869
2865
  return {
2870
2866
  ...it,
2871
2867
  [this.keyValue[0]]: it[this.keyValue[0]],
2872
2868
  [this.keyValue[1]]: it[this.keyValue[1]],
2873
- disabled: (_a2 = it["disabled"]) != null ? _a2 : false
2869
+ disabled: (_a = it["disabled"]) != null ? _a : false
2874
2870
  };
2875
2871
  });
2876
2872
  if (this.isKeywordHighlight) {
2877
2873
  if (this.keyword) {
2878
2874
  const queryLower = this.keyword.toLowerCase().trim();
2879
- const queryText = (this.keyword || "").replace(/\,/g, ",");
2875
+ const queryText = this.keyword.replace(/\,/g, ",");
2880
2876
  let querySet = null;
2881
2877
  if (queryText.includes(",")) {
2882
2878
  querySet = new Set(queryText.split(","));
@@ -2911,7 +2907,7 @@ const _sfc_main = {
2911
2907
  if (needReset)
2912
2908
  this.reset();
2913
2909
  const queryLower = query.toLowerCase().trim();
2914
- const queryText = (query || "").replace(/\,/g, ",");
2910
+ const queryText = query.replace(/\,/g, ",");
2915
2911
  let querySet = null;
2916
2912
  if (queryText.includes(",")) {
2917
2913
  querySet = new Set(queryText.split(","));
@@ -2934,7 +2930,7 @@ const _sfc_main = {
2934
2930
  const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
2935
2931
  selectArr = [...multiple_elements, ...selectArr.filter((item) => !multiple_elements.includes(item))];
2936
2932
  }
2937
- this.selectArr = (selectArr || []).map((it) => {
2933
+ this.selectArr = selectArr.map((it) => {
2938
2934
  return {
2939
2935
  [this.keyValue[0]]: it[this.keyValue[0]],
2940
2936
  [this.keyValue[1]]: it[this.keyValue[1]],
@@ -2957,7 +2953,7 @@ const _sfc_main = {
2957
2953
  },
2958
2954
  async visibleChange(bool) {
2959
2955
  const events = {
2960
- ...this.$listeners || {},
2956
+ ...this.$listeners,
2961
2957
  ...this.itemOptions.events
2962
2958
  };
2963
2959
  const fn = events["visible-change"];
@@ -2695,7 +2695,7 @@ const _sfc_main = {
2695
2695
  // 绑定方法
2696
2696
  bindEvents() {
2697
2697
  const events = {
2698
- ...this.$listeners || {},
2698
+ ...this.$listeners,
2699
2699
  ...this.itemOptions.events
2700
2700
  };
2701
2701
  if (events == null ? void 0 : events.change) {
@@ -2710,7 +2710,7 @@ const _sfc_main = {
2710
2710
  if (events == null ? void 0 : events["visible-change"]) {
2711
2711
  delete events["visible-change"];
2712
2712
  }
2713
- return events || {};
2713
+ return events;
2714
2714
  },
2715
2715
  isVirtualSelect() {
2716
2716
  return this.virtualList || this.itemOptions.virtualList;
@@ -2739,10 +2739,7 @@ const _sfc_main = {
2739
2739
  return (_b = (_a = this.$refs.nfVirtualSelectContainer) == null ? void 0 : _a.$refs) == null ? void 0 : _b.nfVirtualSelect;
2740
2740
  },
2741
2741
  matchedCount() {
2742
- const matchedNum = this.currentVal.filter((id) => {
2743
- var _a;
2744
- return (_a = this.selectArr) == null ? void 0 : _a.some((obj) => obj[this.keyValue[1]] === id);
2745
- }).length || 0;
2742
+ const matchedNum = this.currentVal.filter((id) => this.selectArr.some((obj) => obj[this.keyValue[1]] === id)).length;
2746
2743
  return matchedNum;
2747
2744
  }
2748
2745
  },
@@ -2829,18 +2826,17 @@ const _sfc_main = {
2829
2826
  }
2830
2827
  },
2831
2828
  init() {
2832
- var _a, _b;
2833
2829
  if (this.isVirtualSelect) {
2834
- let selectArr = (_b = (_a = this.optionsList) == null ? void 0 : _a.map((it) => {
2835
- var _a2;
2830
+ let selectArr = this.optionsList.map((it) => {
2831
+ var _a;
2836
2832
  return {
2837
2833
  ...it,
2838
2834
  [this.keyValue[0]]: it[this.keyValue[0]],
2839
2835
  [this.keyValue[1]]: it[this.keyValue[1]],
2840
2836
  [this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
2841
- disabled: (_a2 = it["disabled"]) != null ? _a2 : false
2837
+ disabled: (_a = it["disabled"]) != null ? _a : false
2842
2838
  };
2843
- })) != null ? _b : [];
2839
+ });
2844
2840
  if (this.currentVal && this.echoValueTop) {
2845
2841
  if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
2846
2842
  const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
@@ -2862,19 +2858,19 @@ const _sfc_main = {
2862
2858
  }
2863
2859
  } else {
2864
2860
  let selectArr = [];
2865
- selectArr = (this.optionsList || []).map((it) => {
2866
- var _a2;
2861
+ selectArr = this.optionsList.map((it) => {
2862
+ var _a;
2867
2863
  return {
2868
2864
  ...it,
2869
2865
  [this.keyValue[0]]: it[this.keyValue[0]],
2870
2866
  [this.keyValue[1]]: it[this.keyValue[1]],
2871
- disabled: (_a2 = it["disabled"]) != null ? _a2 : false
2867
+ disabled: (_a = it["disabled"]) != null ? _a : false
2872
2868
  };
2873
2869
  });
2874
2870
  if (this.isKeywordHighlight) {
2875
2871
  if (this.keyword) {
2876
2872
  const queryLower = this.keyword.toLowerCase().trim();
2877
- const queryText = (this.keyword || "").replace(/\,/g, ",");
2873
+ const queryText = this.keyword.replace(/\,/g, ",");
2878
2874
  let querySet = null;
2879
2875
  if (queryText.includes(",")) {
2880
2876
  querySet = new Set(queryText.split(","));
@@ -2909,7 +2905,7 @@ const _sfc_main = {
2909
2905
  if (needReset)
2910
2906
  this.reset();
2911
2907
  const queryLower = query.toLowerCase().trim();
2912
- const queryText = (query || "").replace(/\,/g, ",");
2908
+ const queryText = query.replace(/\,/g, ",");
2913
2909
  let querySet = null;
2914
2910
  if (queryText.includes(",")) {
2915
2911
  querySet = new Set(queryText.split(","));
@@ -2932,7 +2928,7 @@ const _sfc_main = {
2932
2928
  const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
2933
2929
  selectArr = [...multiple_elements, ...selectArr.filter((item) => !multiple_elements.includes(item))];
2934
2930
  }
2935
- this.selectArr = (selectArr || []).map((it) => {
2931
+ this.selectArr = selectArr.map((it) => {
2936
2932
  return {
2937
2933
  [this.keyValue[0]]: it[this.keyValue[0]],
2938
2934
  [this.keyValue[1]]: it[this.keyValue[1]],
@@ -2955,7 +2951,7 @@ const _sfc_main = {
2955
2951
  },
2956
2952
  async visibleChange(bool) {
2957
2953
  const events = {
2958
- ...this.$listeners || {},
2954
+ ...this.$listeners,
2959
2955
  ...this.itemOptions.events
2960
2956
  };
2961
2957
  const fn = events["visible-change"];