@ctzy-web-client/plugin-component-vue 1.0.37 → 1.0.38

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.
Files changed (24) hide show
  1. package/es/advance-select/advance-option.mjs +2 -2
  2. package/es/index.css +1 -0
  3. package/es/pct-filter-panel/pct-compents/index.mjs +1 -1
  4. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +2 -2
  5. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +131 -77
  6. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.mjs +13 -0
  7. package/lib/advance-select/advance-option.js +2 -2
  8. package/lib/index.css +1 -0
  9. package/lib/pct-filter-panel/pct-compents/index.js +2 -2
  10. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +2 -2
  11. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +130 -76
  12. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.js +17 -0
  13. package/package.json +1 -1
  14. package/src/advance-select/advance-option.vue +4 -4
  15. package/src/pct-filter-panel/pct-compents/index.js +1 -1
  16. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +4 -4
  17. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +148 -96
  18. package/style/index.css +1 -1
  19. package/style/src/var.scss +2 -0
  20. package/style/var.css +1 -1
  21. package/es/plugins.css +0 -1
  22. package/lib/plugins.css +0 -1
  23. /package/es/advance-select/{advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.mjs → advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.mjs} +0 -0
  24. /package/lib/advance-select/{advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.js → advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.js} +0 -0
@@ -4,7 +4,7 @@ import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
4
4
  import { useEvent } from './events-helpers.mjs';
5
5
  import { useAdvanceOption } from './use-advance-option.mjs';
6
6
  import { pinyin } from 'pinyin-pro';
7
- import './advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.mjs';
7
+ import './advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.mjs';
8
8
  import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
9
9
 
10
10
  // Inject __name helper
@@ -159,6 +159,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
159
159
  }, 8, ["class"])) : createCommentVNode("v-if", true)
160
160
  ], 2);
161
161
  }
162
- var BwaAdvanceOption = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1e505c71"], ["__file", "advance-option.vue"]]);
162
+ var BwaAdvanceOption = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9ba46efc"], ["__file", "advance-option.vue"]]);
163
163
 
164
164
  export { BwaAdvanceOption as default };
package/es/index.css ADDED
@@ -0,0 +1 @@
1
+ .letter-circle[data-v-9ba46efc]{font-size:14px;height:24px;margin-right:8px;width:24px}.letter-circle[data-v-0a08184f],.letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-0a08184f]{flex-shrink:0;font-size:12px;height:22px;width:22px}
@@ -1,5 +1,5 @@
1
1
  import { withInstall } from 'element-plus/es/utils/vue/install';
2
- import PctMultipleMenuCondition from './pct-multiple-menu-condition.mjs';
2
+ import PctMultipleMenuCondition from './pct-multiple-menu-condition2.mjs';
3
3
  import PctInputCondition from './pct-Input-condition.mjs';
4
4
  import PctDateRangeCondition from './pct-date-range-condition.mjs';
5
5
 
@@ -391,6 +391,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
391
391
  };
392
392
  }
393
393
  });
394
- var PctMultipleMenuCondition = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "pct-multiple-menu-condition.vue"]]);
394
+ var pctMultipleMenuCondition = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "pct-multiple-menu-condition.vue"]]);
395
395
 
396
- export { PctMultipleMenuCondition as default };
396
+ export { pctMultipleMenuCondition as default };
@@ -1,7 +1,9 @@
1
- import { defineComponent, useAttrs, computed, ref, inject, unref, openBlock, createElementBlock, Fragment, normalizeClass, toDisplayString, createCommentVNode, createVNode, withCtx, renderList, createBlock } from 'vue';
1
+ import { defineComponent, useAttrs, computed, ref, inject, unref, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, withCtx, Fragment, renderList, createBlock, createElementVNode, normalizeStyle } from 'vue';
2
2
  import { ElSelect, ElOption } from 'element-plus';
3
3
  import { useService, HttpRequest, useNamespace, filterPanelItemKey } from '@ctzy-web-client/web-base-client-vue';
4
4
  import { dataProps } from '../../hooks/use-data/index.mjs';
5
+ import { pinyin } from 'pinyin-pro';
6
+ import './pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.mjs';
5
7
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.mjs';
6
8
 
7
9
  // Inject __name helper
@@ -13,53 +15,37 @@ if (typeof __name === 'undefined') {
13
15
  });
14
16
  }
15
17
  }
18
+ const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
19
+ const _hoisted_2 = { style: { "margin-left": "8px" } };
16
20
  const __default__ = defineComponent({
17
21
  name: "BwaPctMultipleMenuCondition",
18
- __conditionTitle__: "\u591A\u9009\u83DC\u5355-PZ",
22
+ __conditionTitle__: "\u591A\u9009\u83DC\u5355",
19
23
  __conditionDefault__: () => []
20
24
  });
21
25
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
22
26
  props: {
23
27
  ...dataProps,
24
- modelValue: {
25
- type: null
26
- },
27
- options: {
28
- type: Array,
29
- default: () => []
30
- },
31
- labelProp: {
32
- type: String,
33
- default: "label"
34
- },
35
- valueProp: {
36
- type: String,
37
- default: "value"
38
- },
39
- multiple: {
40
- type: Boolean,
41
- default: false
42
- },
43
- filterable: {
44
- type: Boolean,
45
- default: true
46
- },
47
- placeholder: {
48
- type: String,
49
- default: "\u8BF7\u9009\u62E9"
50
- },
51
- remote: {
52
- type: Boolean,
53
- default: true
54
- },
55
- size: {
56
- type: String,
57
- default: "small"
58
- }
28
+ modelValue: { type: null },
29
+ options: { type: Array, default: () => [] },
30
+ labelProp: { type: String, default: "label" },
31
+ valueProp: { type: String, default: "value" },
32
+ multiple: { type: Boolean, default: true },
33
+ showSearch: { type: Boolean, default: true },
34
+ filterable: { type: Boolean, default: true },
35
+ placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
36
+ remote: { type: Boolean, default: true },
37
+ showLetterAvatar: { type: Boolean, default: false },
38
+ size: { type: String, default: "" },
39
+ searchPlaceholder: { type: String, default: "" },
40
+ labelAttr: { type: String, default: "" },
41
+ valueAttr: { type: String, default: "" },
42
+ searchAttr: { type: String, default: "" },
43
+ itfInfo: { type: Object, default: null },
44
+ isRequiredByVisibleChange: { type: Boolean, default: false }
59
45
  },
60
46
  emits: ["update:modelValue", "search", "visible-change"],
61
47
  setup(__props, { emit: __emit }) {
62
- var _a, _b;
48
+ var _a;
63
49
  const httpRequest = useService(HttpRequest);
64
50
  ;
65
51
  const props = __props;
@@ -74,48 +60,103 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
74
60
  var _a2;
75
61
  return (_a2 = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a2 : null;
76
62
  });
77
- const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title);
63
+ if (props.itfInfo && column.value) {
64
+ column.value.componentProps = {
65
+ itfInfo: props.itfInfo,
66
+ labelAttr: props.labelAttr,
67
+ valueAttr: props.valueAttr,
68
+ searchAttr: props.searchAttr,
69
+ showLetterAvatar: props.showLetterAvatar
70
+ };
71
+ }
72
+ const placeholderStr = computed(
73
+ () => {
74
+ var _a2;
75
+ return showTitle.value ? props.placeholder : (_a2 = column.value) == null ? void 0 : _a2.title;
76
+ }
77
+ );
78
+ const labelPropStr = computed(
79
+ () => {
80
+ var _a2, _b;
81
+ return ((_b = (_a2 = column.value) == null ? void 0 : _a2.componentProps) == null ? void 0 : _b.labelAttr) || props.labelProp;
82
+ }
83
+ );
84
+ const valuePropStr = computed(
85
+ () => {
86
+ var _a2, _b;
87
+ return ((_b = (_a2 = column.value) == null ? void 0 : _a2.componentProps) == null ? void 0 : _b.valueAttr) || props.valueProp;
88
+ }
89
+ );
90
+ const showLetterAvatarStatus = computed(
91
+ () => {
92
+ var _a2, _b;
93
+ return ((_b = (_a2 = column.value) == null ? void 0 : _a2.componentProps) == null ? void 0 : _b.showLetterAvatar) || props.showLetterAvatar;
94
+ }
95
+ );
96
+ const COLOR_POOL = ["#2DC86D", "#19BBFF", "#FFA901"];
97
+ function processLabel(label = "") {
98
+ const match = (label + "").match(/^(.*)\(/);
99
+ const txt = match ? match[1] : label;
100
+ const first = txt.charAt(0);
101
+ let letter = "#";
102
+ if (/[\u4e00-\u9fa5]/.test(first)) {
103
+ letter = pinyin(first, { pattern: "first" }).toUpperCase();
104
+ } else if (/[a-zA-Z]/.test(first)) {
105
+ letter = first.toUpperCase();
106
+ }
107
+ let color = COLOR_POOL[0];
108
+ if (/[A-Z]/.test(letter)) {
109
+ color = COLOR_POOL[(letter.charCodeAt(0) - 65) % 3];
110
+ }
111
+ return { firstLetter: letter, color };
112
+ }
78
113
  const getData = async (query) => {
79
- var _a2;
114
+ var _a2, _b, _c;
115
+ if (!((_a2 = column.value) == null ? void 0 : _a2.componentProps)) {
116
+ data.value = (_b = props.options) != null ? _b : [];
117
+ loading.value = false;
118
+ return;
119
+ }
80
120
  loading.value = true;
81
- const { itfInfo, searchAttr } = column.value.componentProps;
82
- const { url, method, options, params } = {
83
- url: unref(itfInfo).url,
84
- method: unref(itfInfo).method || "POST",
85
- options: unref(itfInfo).options || {},
86
- params: { ...unref(itfInfo).params, [searchAttr]: query || "" }
87
- };
88
- data.value = (_a2 = await unref(httpRequest)[method.toLowerCase()](url, params, options)) == null ? void 0 : _a2.data;
89
- loading.value = false;
121
+ try {
122
+ const { itfInfo, searchAttr } = column.value.componentProps;
123
+ const { url, method, options, params } = {
124
+ url: unref(itfInfo).url,
125
+ method: unref(itfInfo).method || "POST",
126
+ options: unref(itfInfo).options || {},
127
+ params: { ...unref(itfInfo).params, [searchAttr]: query || "" }
128
+ };
129
+ data.value = ((_c = await unref(httpRequest)[method.toLowerCase()](url, params, options)) == null ? void 0 : _c.data) || [];
130
+ } catch (err) {
131
+ data.value = [];
132
+ } finally {
133
+ loading.value = false;
134
+ }
90
135
  };
91
- if ((_a = column.value) == null ? void 0 : _a.componentProps) {
92
- } else {
93
- data.value = (_b = props.options) != null ? _b : [];
94
- }
136
+ data.value = (_a = props.options) != null ? _a : [];
95
137
  const visibleChange = (val) => {
96
- if (!val || !column.value.componentProps)
97
- return;
98
- getData();
138
+ var _a2;
139
+ emit("visible-change", val);
140
+ if (val && props.isRequiredByVisibleChange)
141
+ emit("search", "");
142
+ if (val && ((_a2 = column.value) == null ? void 0 : _a2.componentProps))
143
+ getData();
99
144
  };
100
- const remoteMethod = (query) => {
101
- if (column.value.componentProps) {
102
- getData(query);
103
- } else {
104
- emit("search", query);
105
- }
145
+ const handleFieldSearch = (query) => {
146
+ var _a2;
147
+ ((_a2 = column.value) == null ? void 0 : _a2.componentProps) ? getData(query) : emit("search", query);
106
148
  };
107
149
  const modelValue = computed({
108
150
  get: () => {
109
- if (props.multiple) {
110
- return Array.isArray(props.modelValue) ? props.modelValue.map((item) => item + "") : [];
111
- } else {
112
- return props.modelValue == null ? "" : props.modelValue + "";
113
- }
151
+ var _a2;
152
+ return props.multiple ? Array.isArray(props.modelValue) ? props.modelValue : [] : (_a2 = props.modelValue) != null ? _a2 : "";
114
153
  },
115
154
  set: (v) => emit("update:modelValue", v)
116
155
  });
117
156
  return (_ctx, _cache) => {
118
- return openBlock(), createElementBlock(Fragment, null, [
157
+ return openBlock(), createElementBlock("div", {
158
+ class: normalizeClass(unref(ns).e("conditbox"))
159
+ }, [
119
160
  showTitle.value ? (openBlock(), createElementBlock("span", {
120
161
  key: 0,
121
162
  class: normalizeClass(unref(ns).e("title"))
@@ -130,7 +171,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
130
171
  loading: loading.value,
131
172
  onVisibleChange: visibleChange,
132
173
  remote: __props.remote,
133
- "remote-method": remoteMethod,
174
+ "remote-method": handleFieldSearch,
134
175
  size: __props.size,
135
176
  class: normalizeClass(unref(ns).e("multiple")),
136
177
  "collapse-tags": "",
@@ -138,20 +179,33 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
138
179
  "no-data-text": "\u6682\u65E0\u6570\u636E"
139
180
  }, {
140
181
  default: withCtx(() => [
141
- (openBlock(true), createElementBlock(Fragment, null, renderList(data.value, (item, index) => {
182
+ (openBlock(true), createElementBlock(Fragment, null, renderList(data.value, (item) => {
142
183
  return openBlock(), createBlock(unref(ElOption), {
143
- key: item[__props.valueProp] + index,
144
- value: item[__props.valueProp] + "",
145
- label: item[__props.labelProp]
146
- }, null, 8, ["value", "label"]);
184
+ key: item[valuePropStr.value],
185
+ value: item[valuePropStr.value],
186
+ label: item[labelPropStr.value]
187
+ }, {
188
+ default: withCtx(() => [
189
+ createCommentVNode(" \u6587\u5B57\u5934\u50CF "),
190
+ createElementVNode("div", _hoisted_1, [
191
+ showLetterAvatarStatus.value ? (openBlock(), createElementBlock("div", {
192
+ key: 0,
193
+ class: "letter-circle",
194
+ style: normalizeStyle({ backgroundColor: processLabel(item[labelPropStr.value]).color })
195
+ }, toDisplayString(processLabel(item[labelPropStr.value]).firstLetter), 5)) : createCommentVNode("v-if", true),
196
+ createElementVNode("span", _hoisted_2, toDisplayString(item[labelPropStr.value]), 1)
197
+ ])
198
+ ]),
199
+ _: 2
200
+ }, 1032, ["value", "label"]);
147
201
  }), 128))
148
202
  ]),
149
203
  _: 1
150
204
  }, 8, ["modelValue", "multiple", "filterable", "placeholder", "loading", "remote", "size", "class"])
151
- ], 64);
205
+ ], 2);
152
206
  };
153
207
  }
154
208
  });
155
- var pctMultipleMenuCondition2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "pct-multiple-menu-condition2.vue"]]);
209
+ var PctMultipleMenuCondition = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0a08184f"], ["__file", "pct-multiple-menu-condition2.vue"]]);
156
210
 
157
- export { pctMultipleMenuCondition2 as default };
211
+ export { PctMultipleMenuCondition as default };
@@ -0,0 +1,13 @@
1
+ // Inject __name helper
2
+ if (typeof __name === 'undefined') {
3
+ function __name(obj, name) {
4
+ Object.defineProperty(obj, "name", {
5
+ value: name,
6
+ configurable: true
7
+ });
8
+ }
9
+ }
10
+
11
+ var undefined$1 = undefined;
12
+
13
+ export { undefined$1 as default };
@@ -8,7 +8,7 @@ var webBaseClientVue = require('@ctzy-web-client/web-base-client-vue');
8
8
  var eventsHelpers = require('./events-helpers.js');
9
9
  var useAdvanceOption = require('./use-advance-option.js');
10
10
  var pinyinPro = require('pinyin-pro');
11
- require('./advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.js');
11
+ require('./advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.js');
12
12
  var _pluginVue_exportHelper = require('../_virtual/_plugin-vue_export-helper.js');
13
13
 
14
14
  // Inject __name helper
@@ -163,6 +163,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
163
163
  }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
164
164
  ], 2);
165
165
  }
166
- var BwaAdvanceOption = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1e505c71"], ["__file", "advance-option.vue"]]);
166
+ var BwaAdvanceOption = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-9ba46efc"], ["__file", "advance-option.vue"]]);
167
167
 
168
168
  exports["default"] = BwaAdvanceOption;
package/lib/index.css ADDED
@@ -0,0 +1 @@
1
+ .letter-circle[data-v-9ba46efc]{font-size:14px;height:24px;margin-right:8px;width:24px}.letter-circle[data-v-0a08184f],.letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-0a08184f]{flex-shrink:0;font-size:12px;height:22px;width:22px}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var install = require('element-plus/es/utils/vue/install');
6
- var pctMultipleMenuCondition = require('./pct-multiple-menu-condition.js');
6
+ var pctMultipleMenuCondition2 = require('./pct-multiple-menu-condition2.js');
7
7
  var pctInputCondition = require('./pct-Input-condition.js');
8
8
  var pctDateRangeCondition = require('./pct-date-range-condition.js');
9
9
 
@@ -17,7 +17,7 @@ if (typeof __name === 'undefined') {
17
17
  }
18
18
  }
19
19
  const BwaPctInputCondition = install.withInstall(pctInputCondition["default"], {});
20
- const BwaPctMultipleMenuCondition = install.withInstall(pctMultipleMenuCondition["default"], {});
20
+ const BwaPctMultipleMenuCondition = install.withInstall(pctMultipleMenuCondition2["default"], {});
21
21
  const BwaPctDateRangeCondition = install.withInstall(pctDateRangeCondition["default"], {});
22
22
 
23
23
  exports.BwaPctDateRangeCondition = BwaPctDateRangeCondition;
@@ -395,6 +395,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
395
395
  };
396
396
  }
397
397
  });
398
- var PctMultipleMenuCondition = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__file", "pct-multiple-menu-condition.vue"]]);
398
+ var pctMultipleMenuCondition = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__file", "pct-multiple-menu-condition.vue"]]);
399
399
 
400
- exports["default"] = PctMultipleMenuCondition;
400
+ exports["default"] = pctMultipleMenuCondition;
@@ -6,6 +6,8 @@ var vue = require('vue');
6
6
  var ElementPlus = require('element-plus');
7
7
  var webBaseClientVue = require('@ctzy-web-client/web-base-client-vue');
8
8
  var index = require('../../hooks/use-data/index.js');
9
+ var pinyinPro = require('pinyin-pro');
10
+ require('./pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.js');
9
11
  var _pluginVue_exportHelper = require('../../_virtual/_plugin-vue_export-helper.js');
10
12
 
11
13
  // Inject __name helper
@@ -17,53 +19,37 @@ if (typeof __name === 'undefined') {
17
19
  });
18
20
  }
19
21
  }
22
+ const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
23
+ const _hoisted_2 = { style: { "margin-left": "8px" } };
20
24
  const __default__ = vue.defineComponent({
21
25
  name: "BwaPctMultipleMenuCondition",
22
- __conditionTitle__: "\u591A\u9009\u83DC\u5355-PZ",
26
+ __conditionTitle__: "\u591A\u9009\u83DC\u5355",
23
27
  __conditionDefault__: () => []
24
28
  });
25
29
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
26
30
  props: {
27
31
  ...index.dataProps,
28
- modelValue: {
29
- type: null
30
- },
31
- options: {
32
- type: Array,
33
- default: () => []
34
- },
35
- labelProp: {
36
- type: String,
37
- default: "label"
38
- },
39
- valueProp: {
40
- type: String,
41
- default: "value"
42
- },
43
- multiple: {
44
- type: Boolean,
45
- default: false
46
- },
47
- filterable: {
48
- type: Boolean,
49
- default: true
50
- },
51
- placeholder: {
52
- type: String,
53
- default: "\u8BF7\u9009\u62E9"
54
- },
55
- remote: {
56
- type: Boolean,
57
- default: true
58
- },
59
- size: {
60
- type: String,
61
- default: "small"
62
- }
32
+ modelValue: { type: null },
33
+ options: { type: Array, default: () => [] },
34
+ labelProp: { type: String, default: "label" },
35
+ valueProp: { type: String, default: "value" },
36
+ multiple: { type: Boolean, default: true },
37
+ showSearch: { type: Boolean, default: true },
38
+ filterable: { type: Boolean, default: true },
39
+ placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
40
+ remote: { type: Boolean, default: true },
41
+ showLetterAvatar: { type: Boolean, default: false },
42
+ size: { type: String, default: "" },
43
+ searchPlaceholder: { type: String, default: "" },
44
+ labelAttr: { type: String, default: "" },
45
+ valueAttr: { type: String, default: "" },
46
+ searchAttr: { type: String, default: "" },
47
+ itfInfo: { type: Object, default: null },
48
+ isRequiredByVisibleChange: { type: Boolean, default: false }
63
49
  },
64
50
  emits: ["update:modelValue", "search", "visible-change"],
65
51
  setup(__props, { emit: __emit }) {
66
- var _a, _b;
52
+ var _a;
67
53
  const httpRequest = webBaseClientVue.useService(webBaseClientVue.HttpRequest);
68
54
  ;
69
55
  const props = __props;
@@ -78,48 +64,103 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
78
64
  var _a2;
79
65
  return (_a2 = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a2 : null;
80
66
  });
81
- const placeholderStr = vue.computed(() => showTitle.value ? props.placeholder : column.value.title);
67
+ if (props.itfInfo && column.value) {
68
+ column.value.componentProps = {
69
+ itfInfo: props.itfInfo,
70
+ labelAttr: props.labelAttr,
71
+ valueAttr: props.valueAttr,
72
+ searchAttr: props.searchAttr,
73
+ showLetterAvatar: props.showLetterAvatar
74
+ };
75
+ }
76
+ const placeholderStr = vue.computed(
77
+ () => {
78
+ var _a2;
79
+ return showTitle.value ? props.placeholder : (_a2 = column.value) == null ? void 0 : _a2.title;
80
+ }
81
+ );
82
+ const labelPropStr = vue.computed(
83
+ () => {
84
+ var _a2, _b;
85
+ return ((_b = (_a2 = column.value) == null ? void 0 : _a2.componentProps) == null ? void 0 : _b.labelAttr) || props.labelProp;
86
+ }
87
+ );
88
+ const valuePropStr = vue.computed(
89
+ () => {
90
+ var _a2, _b;
91
+ return ((_b = (_a2 = column.value) == null ? void 0 : _a2.componentProps) == null ? void 0 : _b.valueAttr) || props.valueProp;
92
+ }
93
+ );
94
+ const showLetterAvatarStatus = vue.computed(
95
+ () => {
96
+ var _a2, _b;
97
+ return ((_b = (_a2 = column.value) == null ? void 0 : _a2.componentProps) == null ? void 0 : _b.showLetterAvatar) || props.showLetterAvatar;
98
+ }
99
+ );
100
+ const COLOR_POOL = ["#2DC86D", "#19BBFF", "#FFA901"];
101
+ function processLabel(label = "") {
102
+ const match = (label + "").match(/^(.*)\(/);
103
+ const txt = match ? match[1] : label;
104
+ const first = txt.charAt(0);
105
+ let letter = "#";
106
+ if (/[\u4e00-\u9fa5]/.test(first)) {
107
+ letter = pinyinPro.pinyin(first, { pattern: "first" }).toUpperCase();
108
+ } else if (/[a-zA-Z]/.test(first)) {
109
+ letter = first.toUpperCase();
110
+ }
111
+ let color = COLOR_POOL[0];
112
+ if (/[A-Z]/.test(letter)) {
113
+ color = COLOR_POOL[(letter.charCodeAt(0) - 65) % 3];
114
+ }
115
+ return { firstLetter: letter, color };
116
+ }
82
117
  const getData = async (query) => {
83
- var _a2;
118
+ var _a2, _b, _c;
119
+ if (!((_a2 = column.value) == null ? void 0 : _a2.componentProps)) {
120
+ data.value = (_b = props.options) != null ? _b : [];
121
+ loading.value = false;
122
+ return;
123
+ }
84
124
  loading.value = true;
85
- const { itfInfo, searchAttr } = column.value.componentProps;
86
- const { url, method, options, params } = {
87
- url: vue.unref(itfInfo).url,
88
- method: vue.unref(itfInfo).method || "POST",
89
- options: vue.unref(itfInfo).options || {},
90
- params: { ...vue.unref(itfInfo).params, [searchAttr]: query || "" }
91
- };
92
- data.value = (_a2 = await vue.unref(httpRequest)[method.toLowerCase()](url, params, options)) == null ? void 0 : _a2.data;
93
- loading.value = false;
125
+ try {
126
+ const { itfInfo, searchAttr } = column.value.componentProps;
127
+ const { url, method, options, params } = {
128
+ url: vue.unref(itfInfo).url,
129
+ method: vue.unref(itfInfo).method || "POST",
130
+ options: vue.unref(itfInfo).options || {},
131
+ params: { ...vue.unref(itfInfo).params, [searchAttr]: query || "" }
132
+ };
133
+ data.value = ((_c = await vue.unref(httpRequest)[method.toLowerCase()](url, params, options)) == null ? void 0 : _c.data) || [];
134
+ } catch (err) {
135
+ data.value = [];
136
+ } finally {
137
+ loading.value = false;
138
+ }
94
139
  };
95
- if ((_a = column.value) == null ? void 0 : _a.componentProps) {
96
- } else {
97
- data.value = (_b = props.options) != null ? _b : [];
98
- }
140
+ data.value = (_a = props.options) != null ? _a : [];
99
141
  const visibleChange = (val) => {
100
- if (!val || !column.value.componentProps)
101
- return;
102
- getData();
142
+ var _a2;
143
+ emit("visible-change", val);
144
+ if (val && props.isRequiredByVisibleChange)
145
+ emit("search", "");
146
+ if (val && ((_a2 = column.value) == null ? void 0 : _a2.componentProps))
147
+ getData();
103
148
  };
104
- const remoteMethod = (query) => {
105
- if (column.value.componentProps) {
106
- getData(query);
107
- } else {
108
- emit("search", query);
109
- }
149
+ const handleFieldSearch = (query) => {
150
+ var _a2;
151
+ ((_a2 = column.value) == null ? void 0 : _a2.componentProps) ? getData(query) : emit("search", query);
110
152
  };
111
153
  const modelValue = vue.computed({
112
154
  get: () => {
113
- if (props.multiple) {
114
- return Array.isArray(props.modelValue) ? props.modelValue.map((item) => item + "") : [];
115
- } else {
116
- return props.modelValue == null ? "" : props.modelValue + "";
117
- }
155
+ var _a2;
156
+ return props.multiple ? Array.isArray(props.modelValue) ? props.modelValue : [] : (_a2 = props.modelValue) != null ? _a2 : "";
118
157
  },
119
158
  set: (v) => emit("update:modelValue", v)
120
159
  });
121
160
  return (_ctx, _cache) => {
122
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
161
+ return vue.openBlock(), vue.createElementBlock("div", {
162
+ class: vue.normalizeClass(vue.unref(ns).e("conditbox"))
163
+ }, [
123
164
  showTitle.value ? (vue.openBlock(), vue.createElementBlock("span", {
124
165
  key: 0,
125
166
  class: vue.normalizeClass(vue.unref(ns).e("title"))
@@ -134,7 +175,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
134
175
  loading: loading.value,
135
176
  onVisibleChange: visibleChange,
136
177
  remote: __props.remote,
137
- "remote-method": remoteMethod,
178
+ "remote-method": handleFieldSearch,
138
179
  size: __props.size,
139
180
  class: vue.normalizeClass(vue.unref(ns).e("multiple")),
140
181
  "collapse-tags": "",
@@ -142,20 +183,33 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
142
183
  "no-data-text": "\u6682\u65E0\u6570\u636E"
143
184
  }, {
144
185
  default: vue.withCtx(() => [
145
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.value, (item, index) => {
186
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.value, (item) => {
146
187
  return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElOption), {
147
- key: item[__props.valueProp] + index,
148
- value: item[__props.valueProp] + "",
149
- label: item[__props.labelProp]
150
- }, null, 8, ["value", "label"]);
188
+ key: item[valuePropStr.value],
189
+ value: item[valuePropStr.value],
190
+ label: item[labelPropStr.value]
191
+ }, {
192
+ default: vue.withCtx(() => [
193
+ vue.createCommentVNode(" \u6587\u5B57\u5934\u50CF "),
194
+ vue.createElementVNode("div", _hoisted_1, [
195
+ showLetterAvatarStatus.value ? (vue.openBlock(), vue.createElementBlock("div", {
196
+ key: 0,
197
+ class: "letter-circle",
198
+ style: vue.normalizeStyle({ backgroundColor: processLabel(item[labelPropStr.value]).color })
199
+ }, vue.toDisplayString(processLabel(item[labelPropStr.value]).firstLetter), 5)) : vue.createCommentVNode("v-if", true),
200
+ vue.createElementVNode("span", _hoisted_2, vue.toDisplayString(item[labelPropStr.value]), 1)
201
+ ])
202
+ ]),
203
+ _: 2
204
+ }, 1032, ["value", "label"]);
151
205
  }), 128))
152
206
  ]),
153
207
  _: 1
154
208
  }, 8, ["modelValue", "multiple", "filterable", "placeholder", "loading", "remote", "size", "class"])
155
- ], 64);
209
+ ], 2);
156
210
  };
157
211
  }
158
212
  });
159
- var pctMultipleMenuCondition2 = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__file", "pct-multiple-menu-condition2.vue"]]);
213
+ var PctMultipleMenuCondition = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__scopeId", "data-v-0a08184f"], ["__file", "pct-multiple-menu-condition2.vue"]]);
160
214
 
161
- exports["default"] = pctMultipleMenuCondition2;
215
+ exports["default"] = PctMultipleMenuCondition;