@ctzy-web-client/plugin-component-vue 1.0.39 → 1.0.41

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/pct-filter-panel/pct-compents/index.mjs +1 -1
  3. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +2 -2
  4. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +145 -79
  5. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c5c05287_lang.mjs +13 -0
  6. package/es/plugins.css +1 -0
  7. package/lib/advance-select/advance-option.js +2 -2
  8. package/lib/pct-filter-panel/pct-compents/index.js +2 -2
  9. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +2 -2
  10. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +144 -78
  11. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c5c05287_lang.js +17 -0
  12. package/lib/plugins.css +1 -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 +165 -95
  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/make-installer.css +0 -1
  22. package/lib/make-installer.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 };
@@ -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,10 @@
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, onMounted, unref, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, withCtx, renderSlot, 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 '../../advance-select/advance-option.mjs';
7
+ import './pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c5c05287_lang.mjs';
5
8
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.mjs';
6
9
 
7
10
  // Inject __name helper
@@ -13,53 +16,36 @@ if (typeof __name === 'undefined') {
13
16
  });
14
17
  }
15
18
  }
19
+ const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
20
+ const _hoisted_2 = { style: { "margin-left": "8px" } };
16
21
  const __default__ = defineComponent({
17
22
  name: "BwaPctMultipleMenuCondition",
18
- __conditionTitle__: "\u591A\u9009\u83DC\u5355-PZ",
23
+ __conditionTitle__: "\u591A\u9009\u83DC\u5355",
19
24
  __conditionDefault__: () => []
20
25
  });
21
26
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
22
27
  props: {
23
28
  ...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
- }
29
+ modelValue: { type: null },
30
+ options: { type: Array, default: () => [] },
31
+ labelProp: { type: String, default: "label" },
32
+ valueProp: { type: String, default: "value" },
33
+ multiple: { type: Boolean, default: true },
34
+ showSearch: { type: Boolean, default: true },
35
+ filterable: { type: Boolean, default: true },
36
+ placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
37
+ remote: { type: Boolean, default: true },
38
+ showLetterAvatar: { type: Boolean, default: false },
39
+ size: { type: String, default: "" },
40
+ searchPlaceholder: { type: String, default: "" },
41
+ labelAttr: { type: String, default: "" },
42
+ valueAttr: { type: String, default: "" },
43
+ searchAttr: { type: String, default: "" },
44
+ itfInfo: { type: Object, default: null },
45
+ isRequiredByVisibleChange: { type: Boolean, default: false }
59
46
  },
60
47
  emits: ["update:modelValue", "search", "visible-change"],
61
48
  setup(__props, { emit: __emit }) {
62
- var _a, _b;
63
49
  const httpRequest = useService(HttpRequest);
64
50
  ;
65
51
  const props = __props;
@@ -71,34 +57,101 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
71
57
  const emit = __emit;
72
58
  const filterPanelItem = inject(filterPanelItemKey, null);
73
59
  const column = computed(() => {
74
- var _a2;
75
- return (_a2 = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a2 : null;
60
+ var _a;
61
+ return (_a = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a : null;
76
62
  });
77
- const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title);
78
- const getData = async (query) => {
79
- var _a2;
63
+ onMounted(() => {
64
+ var _a, _b, _c;
65
+ if (props.itfInfo && column.value) {
66
+ column.value.componentProps = {
67
+ itfInfo: props.itfInfo,
68
+ labelAttr: props.labelAttr,
69
+ valueAttr: props.valueAttr,
70
+ searchAttr: props.searchAttr,
71
+ showLetterAvatar: props.showLetterAvatar
72
+ };
73
+ }
74
+ if (!((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo)) {
75
+ data.value = (_c = props.options) != null ? _c : [];
76
+ }
77
+ });
78
+ const placeholderStr = computed(
79
+ () => {
80
+ var _a;
81
+ return showTitle.value ? props.placeholder : (_a = column.value) == null ? void 0 : _a.title;
82
+ }
83
+ );
84
+ const labelPropStr = computed(
85
+ () => {
86
+ var _a, _b;
87
+ return ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.labelAttr) || props.labelProp;
88
+ }
89
+ );
90
+ const valuePropStr = computed(
91
+ () => {
92
+ var _a, _b;
93
+ return ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.valueAttr) || props.valueProp;
94
+ }
95
+ );
96
+ const showLetterAvatarStatus = computed(
97
+ () => {
98
+ var _a, _b;
99
+ return ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.showLetterAvatar) || props.showLetterAvatar;
100
+ }
101
+ );
102
+ const COLOR_POOL = ["#2DC86D", "#19BBFF", "#FFA901"];
103
+ function processLabel(label = "") {
104
+ const match = (label + "").match(/^(.*)\(/);
105
+ const txt = match ? match[1] : label;
106
+ const first = txt.charAt(0);
107
+ let letter = "#";
108
+ if (/[\u4e00-\u9fa5]/.test(first)) {
109
+ letter = pinyin(first, { pattern: "first" }).toUpperCase();
110
+ } else if (/[a-zA-Z]/.test(first)) {
111
+ letter = first.toUpperCase();
112
+ }
113
+ let color = COLOR_POOL[0];
114
+ if (/[A-Z]/.test(letter)) {
115
+ color = COLOR_POOL[(letter.charCodeAt(0) - 65) % 3];
116
+ }
117
+ return { firstLetter: letter, color };
118
+ }
119
+ const getData = async (query = "") => {
120
+ var _a, _b, _c;
121
+ if (!((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo)) {
122
+ data.value = (_c = props.options) != null ? _c : [];
123
+ return;
124
+ }
80
125
  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;
126
+ try {
127
+ const { itfInfo, searchAttr } = column.value.componentProps;
128
+ const method = unref(itfInfo).method || "POST";
129
+ const url = unref(itfInfo).url;
130
+ const params = { ...unref(itfInfo).params, [searchAttr]: query };
131
+ const res = await unref(httpRequest)[method.toLowerCase()](url, params);
132
+ data.value = (res == null ? void 0 : res.data) || [];
133
+ } catch (err) {
134
+ console.error("\u8BF7\u6C42\u5931\u8D25:", err);
135
+ data.value = [];
136
+ } finally {
137
+ loading.value = false;
138
+ }
90
139
  };
91
- if ((_a = column.value) == null ? void 0 : _a.componentProps) {
92
- } else {
93
- data.value = (_b = props.options) != null ? _b : [];
94
- }
95
140
  const visibleChange = (val) => {
96
- if (!val || !column.value.componentProps)
97
- return;
98
- getData();
141
+ var _a, _b;
142
+ emit("visible-change", val);
143
+ if (val) {
144
+ if (props.isRequiredByVisibleChange) {
145
+ emit("search", "");
146
+ }
147
+ if ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo) {
148
+ getData("");
149
+ }
150
+ }
99
151
  };
100
- const remoteMethod = (query) => {
101
- if (column.value.componentProps) {
152
+ const handleFieldSearch = (query) => {
153
+ var _a, _b;
154
+ if ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo) {
102
155
  getData(query);
103
156
  } else {
104
157
  emit("search", query);
@@ -106,16 +159,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
106
159
  };
107
160
  const modelValue = computed({
108
161
  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
- }
162
+ var _a;
163
+ return props.multiple ? Array.isArray(props.modelValue) ? props.modelValue : [] : (_a = props.modelValue) != null ? _a : "";
114
164
  },
115
165
  set: (v) => emit("update:modelValue", v)
116
166
  });
117
167
  return (_ctx, _cache) => {
118
- return openBlock(), createElementBlock(Fragment, null, [
168
+ return openBlock(), createElementBlock("div", {
169
+ class: normalizeClass(unref(ns).e("conditbox"))
170
+ }, [
119
171
  showTitle.value ? (openBlock(), createElementBlock("span", {
120
172
  key: 0,
121
173
  class: normalizeClass(unref(ns).e("title"))
@@ -130,7 +182,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
130
182
  loading: loading.value,
131
183
  onVisibleChange: visibleChange,
132
184
  remote: __props.remote,
133
- "remote-method": remoteMethod,
185
+ "remote-method": handleFieldSearch,
134
186
  size: __props.size,
135
187
  class: normalizeClass(unref(ns).e("multiple")),
136
188
  "collapse-tags": "",
@@ -138,20 +190,34 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
138
190
  "no-data-text": "\u6682\u65E0\u6570\u636E"
139
191
  }, {
140
192
  default: withCtx(() => [
141
- (openBlock(true), createElementBlock(Fragment, null, renderList(data.value, (item, index) => {
142
- 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"]);
147
- }), 128))
193
+ renderSlot(_ctx.$slots, "default", {}, () => [
194
+ (openBlock(true), createElementBlock(Fragment, null, renderList(data.value, (item) => {
195
+ return openBlock(), createBlock(unref(ElOption), {
196
+ key: item[valuePropStr.value],
197
+ value: item[valuePropStr.value],
198
+ label: item[labelPropStr.value]
199
+ }, {
200
+ default: withCtx(() => [
201
+ createElementVNode("div", _hoisted_1, [
202
+ showLetterAvatarStatus.value ? (openBlock(), createElementBlock("div", {
203
+ key: 0,
204
+ class: "letter-circle",
205
+ style: normalizeStyle({ backgroundColor: processLabel(item[labelPropStr.value]).color })
206
+ }, toDisplayString(processLabel(item[labelPropStr.value]).firstLetter), 5)) : createCommentVNode("v-if", true),
207
+ createElementVNode("span", _hoisted_2, toDisplayString(item[labelPropStr.value]), 1)
208
+ ])
209
+ ]),
210
+ _: 2
211
+ }, 1032, ["value", "label"]);
212
+ }), 128))
213
+ ], true)
148
214
  ]),
149
- _: 1
215
+ _: 3
150
216
  }, 8, ["modelValue", "multiple", "filterable", "placeholder", "loading", "remote", "size", "class"])
151
- ], 64);
217
+ ], 2);
152
218
  };
153
219
  }
154
220
  });
155
- var pctMultipleMenuCondition2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "pct-multiple-menu-condition2.vue"]]);
221
+ var PctMultipleMenuCondition = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c5c05287"], ["__file", "pct-multiple-menu-condition2.vue"]]);
156
222
 
157
- export { pctMultipleMenuCondition2 as default };
223
+ 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 };
package/es/plugins.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-9ba46efc],.letter-circle[data-v-c5c05287]{align-items:center;border-radius:50%;color:#fff;display:flex;justify-content:center}.letter-circle[data-v-c5c05287]{flex-shrink:0;font-size:12px;height:22px;width:22px}
@@ -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;
@@ -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;