@94ai/nf-virtual-select 8.3.23 → 9.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;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const commonUtils = require("@94ai/common-utils");
3
4
  const virtualList = require("vue-virtual-scroll-list");
4
5
  const vue2RuntimeHelpers = require("@94ai/vue2-runtime-helpers");
5
6
  const lodashEs = require("lodash-es");
@@ -2181,7 +2182,7 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
2181
2182
  clearInterval(autoScrolls[layersOut].pid);
2182
2183
  if (vx != 0 || vy != 0) {
2183
2184
  scrollThisInstance = true;
2184
- autoScrolls[layersOut].pid = setInterval((function() {
2185
+ autoScrolls[layersOut].pid = setInterval(function() {
2185
2186
  if (isFallback && this.layer === 0) {
2186
2187
  Sortable.active._onTouchMove(touchEvt$1);
2187
2188
  }
@@ -2193,7 +2194,7 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
2193
2194
  }
2194
2195
  }
2195
2196
  scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2196
- }).bind({
2197
+ }.bind({
2197
2198
  layer: layersOut
2198
2199
  }), 24);
2199
2200
  }
@@ -2357,6 +2358,7 @@ var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc
2357
2358
  const VirtualSelectContainer = __component__$1.exports;
2358
2359
  const _sfc_main = {
2359
2360
  name: "nf-virtual-select",
2361
+ mixins: [commonUtils.LocaleMixin],
2360
2362
  components: {
2361
2363
  "virtual-list": virtualList,
2362
2364
  "virtual-select-container": VirtualSelectContainer
@@ -2523,7 +2525,7 @@ const _sfc_main = {
2523
2525
  },
2524
2526
  placeholder: {
2525
2527
  type: String,
2526
- default: "请选择"
2528
+ default: void 0
2527
2529
  },
2528
2530
  multiple: {
2529
2531
  type: Boolean,
@@ -2537,7 +2539,7 @@ const _sfc_main = {
2537
2539
  /** 全部 文字(兼容国际化翻译) */
2538
2540
  selectAllText: {
2539
2541
  type: String,
2540
- default: "全部"
2542
+ default: void 0
2541
2543
  },
2542
2544
  width: {
2543
2545
  type: String,
@@ -2575,6 +2577,7 @@ const _sfc_main = {
2575
2577
  }
2576
2578
  },
2577
2579
  data() {
2580
+ var _a;
2578
2581
  const that = this;
2579
2582
  const ElOption = {
2580
2583
  props: {
@@ -2607,13 +2610,20 @@ const _sfc_main = {
2607
2610
  }
2608
2611
  };
2609
2612
  return {
2610
- itemComponent: this.dataComponent ?? ElOption,
2613
+ itemComponent: (_a = this.dataComponent) != null ? _a : ElOption,
2611
2614
  selectArr: [],
2612
2615
  keyword: ""
2613
2616
  // 当前搜索关键词
2614
2617
  };
2615
2618
  },
2616
2619
  computed: {
2620
+ localeText() {
2621
+ var _a, _b;
2622
+ return {
2623
+ placeholder: (_a = this.placeholder) != null ? _a : this.t("nf.common.placeholderSelect"),
2624
+ selectAllText: (_b = this.selectAllText) != null ? _b : this.t("nf.common.all")
2625
+ };
2626
+ },
2617
2627
  /** 当前条件是否符合关键词高亮 */
2618
2628
  isKeywordHighlight() {
2619
2629
  return this.bindProps.keywordHighlight && !!(this.bindProps.filterable || this.isVirtualSelect);
@@ -2714,7 +2724,7 @@ const _sfc_main = {
2714
2724
  return this.reserveKeyword || this.itemOptions.reserveKeyword;
2715
2725
  },
2716
2726
  placeholderDesc() {
2717
- return this.itemOptions.placeholder || this.placeholder;
2727
+ return this.itemOptions.placeholder || this.localeText.placeholder;
2718
2728
  },
2719
2729
  optionsList() {
2720
2730
  var _a;
@@ -2821,15 +2831,18 @@ const _sfc_main = {
2821
2831
  }
2822
2832
  },
2823
2833
  init() {
2824
- var _a;
2834
+ var _a, _b;
2825
2835
  if (this.isVirtualSelect) {
2826
- let selectArr = ((_a = this.optionsList) == null ? void 0 : _a.map((it) => ({
2827
- ...it,
2828
- [this.keyValue[0]]: it[this.keyValue[0]],
2829
- [this.keyValue[1]]: it[this.keyValue[1]],
2830
- [this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
2831
- disabled: it["disabled"] ?? false
2832
- }))) ?? [];
2836
+ let selectArr = (_b = (_a = this.optionsList) == null ? void 0 : _a.map((it) => {
2837
+ var _a2;
2838
+ return {
2839
+ ...it,
2840
+ [this.keyValue[0]]: it[this.keyValue[0]],
2841
+ [this.keyValue[1]]: it[this.keyValue[1]],
2842
+ [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
2844
+ };
2845
+ })) != null ? _b : [];
2833
2846
  if (this.currentVal && this.echoValueTop) {
2834
2847
  if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
2835
2848
  const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
@@ -2851,12 +2864,15 @@ const _sfc_main = {
2851
2864
  }
2852
2865
  } else {
2853
2866
  let selectArr = [];
2854
- selectArr = (this.optionsList || []).map((it) => ({
2855
- ...it,
2856
- [this.keyValue[0]]: it[this.keyValue[0]],
2857
- [this.keyValue[1]]: it[this.keyValue[1]],
2858
- disabled: it["disabled"] ?? false
2859
- }));
2867
+ selectArr = (this.optionsList || []).map((it) => {
2868
+ var _a2;
2869
+ return {
2870
+ ...it,
2871
+ [this.keyValue[0]]: it[this.keyValue[0]],
2872
+ [this.keyValue[1]]: it[this.keyValue[1]],
2873
+ disabled: (_a2 = it["disabled"]) != null ? _a2 : false
2874
+ };
2875
+ });
2860
2876
  if (this.isKeywordHighlight) {
2861
2877
  if (this.keyword) {
2862
2878
  const queryLower = this.keyword.toLowerCase().trim();
@@ -3087,7 +3103,7 @@ var _sfc_render = function render2() {
3087
3103
  on: {
3088
3104
  "change": _vm.toggleCheckAll
3089
3105
  }
3090
- }, [_vm._v(_vm._s(_vm.selectAllText) + " "), ((_f = _vm.selectArr) == null ? void 0 : _f.length) ? _c("span", [_vm._v("(" + _vm._s(`${_vm.matchedCount}/${(_g = _vm.selectArr) == null ? void 0 : _g.length}`) + ")")]) : _vm._e()])], 1) : _vm._e(), _vm._l(_vm.selectArr, function(item, index2) {
3106
+ }, [_vm._v(_vm._s(_vm.localeText.selectAllText) + " "), ((_f = _vm.selectArr) == null ? void 0 : _f.length) ? _c("span", [_vm._v("(" + _vm._s(`${_vm.matchedCount}/${(_g = _vm.selectArr) == null ? void 0 : _g.length}`) + ")")]) : _vm._e()])], 1) : _vm._e(), _vm._l(_vm.selectArr, function(item, index2) {
3091
3107
  return _c("el-option", {
3092
3108
  key: item[_vm.keyValue[0]] + "_" + index2,
3093
3109
  attrs: {
@@ -1,3 +1,4 @@
1
+ import { LocaleMixin } from "@94ai/common-utils";
1
2
  import virtualList from "vue-virtual-scroll-list";
2
3
  import { normalizeComponent } from "@94ai/vue2-runtime-helpers";
3
4
  import { isEqual } from "lodash-es";
@@ -2179,7 +2180,7 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
2179
2180
  clearInterval(autoScrolls[layersOut].pid);
2180
2181
  if (vx != 0 || vy != 0) {
2181
2182
  scrollThisInstance = true;
2182
- autoScrolls[layersOut].pid = setInterval((function() {
2183
+ autoScrolls[layersOut].pid = setInterval(function() {
2183
2184
  if (isFallback && this.layer === 0) {
2184
2185
  Sortable.active._onTouchMove(touchEvt$1);
2185
2186
  }
@@ -2191,7 +2192,7 @@ var autoScroll = throttle(function(evt, options, rootEl2, isFallback) {
2191
2192
  }
2192
2193
  }
2193
2194
  scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2194
- }).bind({
2195
+ }.bind({
2195
2196
  layer: layersOut
2196
2197
  }), 24);
2197
2198
  }
@@ -2355,6 +2356,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(_sfc_main$1, _sfc_rende
2355
2356
  const VirtualSelectContainer = __component__$1.exports;
2356
2357
  const _sfc_main = {
2357
2358
  name: "nf-virtual-select",
2359
+ mixins: [LocaleMixin],
2358
2360
  components: {
2359
2361
  "virtual-list": virtualList,
2360
2362
  "virtual-select-container": VirtualSelectContainer
@@ -2521,7 +2523,7 @@ const _sfc_main = {
2521
2523
  },
2522
2524
  placeholder: {
2523
2525
  type: String,
2524
- default: "请选择"
2526
+ default: void 0
2525
2527
  },
2526
2528
  multiple: {
2527
2529
  type: Boolean,
@@ -2535,7 +2537,7 @@ const _sfc_main = {
2535
2537
  /** 全部 文字(兼容国际化翻译) */
2536
2538
  selectAllText: {
2537
2539
  type: String,
2538
- default: "全部"
2540
+ default: void 0
2539
2541
  },
2540
2542
  width: {
2541
2543
  type: String,
@@ -2573,6 +2575,7 @@ const _sfc_main = {
2573
2575
  }
2574
2576
  },
2575
2577
  data() {
2578
+ var _a;
2576
2579
  const that = this;
2577
2580
  const ElOption = {
2578
2581
  props: {
@@ -2605,13 +2608,20 @@ const _sfc_main = {
2605
2608
  }
2606
2609
  };
2607
2610
  return {
2608
- itemComponent: this.dataComponent ?? ElOption,
2611
+ itemComponent: (_a = this.dataComponent) != null ? _a : ElOption,
2609
2612
  selectArr: [],
2610
2613
  keyword: ""
2611
2614
  // 当前搜索关键词
2612
2615
  };
2613
2616
  },
2614
2617
  computed: {
2618
+ localeText() {
2619
+ var _a, _b;
2620
+ return {
2621
+ placeholder: (_a = this.placeholder) != null ? _a : this.t("nf.common.placeholderSelect"),
2622
+ selectAllText: (_b = this.selectAllText) != null ? _b : this.t("nf.common.all")
2623
+ };
2624
+ },
2615
2625
  /** 当前条件是否符合关键词高亮 */
2616
2626
  isKeywordHighlight() {
2617
2627
  return this.bindProps.keywordHighlight && !!(this.bindProps.filterable || this.isVirtualSelect);
@@ -2712,7 +2722,7 @@ const _sfc_main = {
2712
2722
  return this.reserveKeyword || this.itemOptions.reserveKeyword;
2713
2723
  },
2714
2724
  placeholderDesc() {
2715
- return this.itemOptions.placeholder || this.placeholder;
2725
+ return this.itemOptions.placeholder || this.localeText.placeholder;
2716
2726
  },
2717
2727
  optionsList() {
2718
2728
  var _a;
@@ -2819,15 +2829,18 @@ const _sfc_main = {
2819
2829
  }
2820
2830
  },
2821
2831
  init() {
2822
- var _a;
2832
+ var _a, _b;
2823
2833
  if (this.isVirtualSelect) {
2824
- let selectArr = ((_a = this.optionsList) == null ? void 0 : _a.map((it) => ({
2825
- ...it,
2826
- [this.keyValue[0]]: it[this.keyValue[0]],
2827
- [this.keyValue[1]]: it[this.keyValue[1]],
2828
- [this.dataKey]: typeof it[this.keyValue[1]] === "boolean" ? `${it[this.keyValue[0]]}${it[this.keyValue[1]]}` : it[this.keyValue[1]],
2829
- disabled: it["disabled"] ?? false
2830
- }))) ?? [];
2834
+ let selectArr = (_b = (_a = this.optionsList) == null ? void 0 : _a.map((it) => {
2835
+ var _a2;
2836
+ return {
2837
+ ...it,
2838
+ [this.keyValue[0]]: it[this.keyValue[0]],
2839
+ [this.keyValue[1]]: it[this.keyValue[1]],
2840
+ [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
2842
+ };
2843
+ })) != null ? _b : [];
2831
2844
  if (this.currentVal && this.echoValueTop) {
2832
2845
  if ((this.itemOptions.multiple || this.multiple) && Array.isArray(this.currentVal)) {
2833
2846
  const multiple_elements = selectArr.filter((item) => this.currentVal.includes(item[this.keyValue[1]]));
@@ -2849,12 +2862,15 @@ const _sfc_main = {
2849
2862
  }
2850
2863
  } else {
2851
2864
  let selectArr = [];
2852
- selectArr = (this.optionsList || []).map((it) => ({
2853
- ...it,
2854
- [this.keyValue[0]]: it[this.keyValue[0]],
2855
- [this.keyValue[1]]: it[this.keyValue[1]],
2856
- disabled: it["disabled"] ?? false
2857
- }));
2865
+ selectArr = (this.optionsList || []).map((it) => {
2866
+ var _a2;
2867
+ return {
2868
+ ...it,
2869
+ [this.keyValue[0]]: it[this.keyValue[0]],
2870
+ [this.keyValue[1]]: it[this.keyValue[1]],
2871
+ disabled: (_a2 = it["disabled"]) != null ? _a2 : false
2872
+ };
2873
+ });
2858
2874
  if (this.isKeywordHighlight) {
2859
2875
  if (this.keyword) {
2860
2876
  const queryLower = this.keyword.toLowerCase().trim();
@@ -3085,7 +3101,7 @@ var _sfc_render = function render2() {
3085
3101
  on: {
3086
3102
  "change": _vm.toggleCheckAll
3087
3103
  }
3088
- }, [_vm._v(_vm._s(_vm.selectAllText) + " "), ((_f = _vm.selectArr) == null ? void 0 : _f.length) ? _c("span", [_vm._v("(" + _vm._s(`${_vm.matchedCount}/${(_g = _vm.selectArr) == null ? void 0 : _g.length}`) + ")")]) : _vm._e()])], 1) : _vm._e(), _vm._l(_vm.selectArr, function(item, index2) {
3104
+ }, [_vm._v(_vm._s(_vm.localeText.selectAllText) + " "), ((_f = _vm.selectArr) == null ? void 0 : _f.length) ? _c("span", [_vm._v("(" + _vm._s(`${_vm.matchedCount}/${(_g = _vm.selectArr) == null ? void 0 : _g.length}`) + ")")]) : _vm._e()])], 1) : _vm._e(), _vm._l(_vm.selectArr, function(item, index2) {
3089
3105
  return _c("el-option", {
3090
3106
  key: item[_vm.keyValue[0]] + "_" + index2,
3091
3107
  attrs: {