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

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
@@ -6,6 +6,9 @@ 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('../../advance-select/advance-option.js');
11
+ require('./pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c5c05287_lang.js');
9
12
  var _pluginVue_exportHelper = require('../../_virtual/_plugin-vue_export-helper.js');
10
13
 
11
14
  // Inject __name helper
@@ -17,53 +20,36 @@ if (typeof __name === 'undefined') {
17
20
  });
18
21
  }
19
22
  }
23
+ const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
24
+ const _hoisted_2 = { style: { "margin-left": "8px" } };
20
25
  const __default__ = vue.defineComponent({
21
26
  name: "BwaPctMultipleMenuCondition",
22
- __conditionTitle__: "\u591A\u9009\u83DC\u5355-PZ",
27
+ __conditionTitle__: "\u591A\u9009\u83DC\u5355",
23
28
  __conditionDefault__: () => []
24
29
  });
25
30
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
26
31
  props: {
27
32
  ...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
- }
33
+ modelValue: { type: null },
34
+ options: { type: Array, default: () => [] },
35
+ labelProp: { type: String, default: "label" },
36
+ valueProp: { type: String, default: "value" },
37
+ multiple: { type: Boolean, default: true },
38
+ showSearch: { type: Boolean, default: true },
39
+ filterable: { type: Boolean, default: true },
40
+ placeholder: { type: String, default: "\u8BF7\u9009\u62E9" },
41
+ remote: { type: Boolean, default: true },
42
+ showLetterAvatar: { type: Boolean, default: false },
43
+ size: { type: String, default: "" },
44
+ searchPlaceholder: { type: String, default: "" },
45
+ labelAttr: { type: String, default: "" },
46
+ valueAttr: { type: String, default: "" },
47
+ searchAttr: { type: String, default: "" },
48
+ itfInfo: { type: Object, default: null },
49
+ isRequiredByVisibleChange: { type: Boolean, default: false }
63
50
  },
64
51
  emits: ["update:modelValue", "search", "visible-change"],
65
52
  setup(__props, { emit: __emit }) {
66
- var _a, _b;
67
53
  const httpRequest = webBaseClientVue.useService(webBaseClientVue.HttpRequest);
68
54
  ;
69
55
  const props = __props;
@@ -75,34 +61,101 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
75
61
  const emit = __emit;
76
62
  const filterPanelItem = vue.inject(webBaseClientVue.filterPanelItemKey, null);
77
63
  const column = vue.computed(() => {
78
- var _a2;
79
- return (_a2 = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a2 : null;
64
+ var _a;
65
+ return (_a = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a : null;
80
66
  });
81
- const placeholderStr = vue.computed(() => showTitle.value ? props.placeholder : column.value.title);
82
- const getData = async (query) => {
83
- var _a2;
67
+ vue.onMounted(() => {
68
+ var _a, _b, _c;
69
+ if (props.itfInfo && column.value) {
70
+ column.value.componentProps = {
71
+ itfInfo: props.itfInfo,
72
+ labelAttr: props.labelAttr,
73
+ valueAttr: props.valueAttr,
74
+ searchAttr: props.searchAttr,
75
+ showLetterAvatar: props.showLetterAvatar
76
+ };
77
+ }
78
+ if (!((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo)) {
79
+ data.value = (_c = props.options) != null ? _c : [];
80
+ }
81
+ });
82
+ const placeholderStr = vue.computed(
83
+ () => {
84
+ var _a;
85
+ return showTitle.value ? props.placeholder : (_a = column.value) == null ? void 0 : _a.title;
86
+ }
87
+ );
88
+ const labelPropStr = vue.computed(
89
+ () => {
90
+ var _a, _b;
91
+ return ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.labelAttr) || props.labelProp;
92
+ }
93
+ );
94
+ const valuePropStr = vue.computed(
95
+ () => {
96
+ var _a, _b;
97
+ return ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.valueAttr) || props.valueProp;
98
+ }
99
+ );
100
+ const showLetterAvatarStatus = vue.computed(
101
+ () => {
102
+ var _a, _b;
103
+ return ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.showLetterAvatar) || props.showLetterAvatar;
104
+ }
105
+ );
106
+ const COLOR_POOL = ["#2DC86D", "#19BBFF", "#FFA901"];
107
+ function processLabel(label = "") {
108
+ const match = (label + "").match(/^(.*)\(/);
109
+ const txt = match ? match[1] : label;
110
+ const first = txt.charAt(0);
111
+ let letter = "#";
112
+ if (/[\u4e00-\u9fa5]/.test(first)) {
113
+ letter = pinyinPro.pinyin(first, { pattern: "first" }).toUpperCase();
114
+ } else if (/[a-zA-Z]/.test(first)) {
115
+ letter = first.toUpperCase();
116
+ }
117
+ let color = COLOR_POOL[0];
118
+ if (/[A-Z]/.test(letter)) {
119
+ color = COLOR_POOL[(letter.charCodeAt(0) - 65) % 3];
120
+ }
121
+ return { firstLetter: letter, color };
122
+ }
123
+ const getData = async (query = "") => {
124
+ var _a, _b, _c;
125
+ if (!((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo)) {
126
+ data.value = (_c = props.options) != null ? _c : [];
127
+ return;
128
+ }
84
129
  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;
130
+ try {
131
+ const { itfInfo, searchAttr } = column.value.componentProps;
132
+ const method = vue.unref(itfInfo).method || "POST";
133
+ const url = vue.unref(itfInfo).url;
134
+ const params = { ...vue.unref(itfInfo).params, [searchAttr]: query };
135
+ const res = await vue.unref(httpRequest)[method.toLowerCase()](url, params);
136
+ data.value = (res == null ? void 0 : res.data) || [];
137
+ } catch (err) {
138
+ console.error("\u8BF7\u6C42\u5931\u8D25:", err);
139
+ data.value = [];
140
+ } finally {
141
+ loading.value = false;
142
+ }
94
143
  };
95
- if ((_a = column.value) == null ? void 0 : _a.componentProps) {
96
- } else {
97
- data.value = (_b = props.options) != null ? _b : [];
98
- }
99
144
  const visibleChange = (val) => {
100
- if (!val || !column.value.componentProps)
101
- return;
102
- getData();
145
+ var _a, _b;
146
+ emit("visible-change", val);
147
+ if (val) {
148
+ if (props.isRequiredByVisibleChange) {
149
+ emit("search", "");
150
+ }
151
+ if ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo) {
152
+ getData("");
153
+ }
154
+ }
103
155
  };
104
- const remoteMethod = (query) => {
105
- if (column.value.componentProps) {
156
+ const handleFieldSearch = (query) => {
157
+ var _a, _b;
158
+ if ((_b = (_a = column.value) == null ? void 0 : _a.componentProps) == null ? void 0 : _b.itfInfo) {
106
159
  getData(query);
107
160
  } else {
108
161
  emit("search", query);
@@ -110,16 +163,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
110
163
  };
111
164
  const modelValue = vue.computed({
112
165
  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
- }
166
+ var _a;
167
+ return props.multiple ? Array.isArray(props.modelValue) ? props.modelValue : [] : (_a = props.modelValue) != null ? _a : "";
118
168
  },
119
169
  set: (v) => emit("update:modelValue", v)
120
170
  });
121
171
  return (_ctx, _cache) => {
122
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
172
+ return vue.openBlock(), vue.createElementBlock("div", {
173
+ class: vue.normalizeClass(vue.unref(ns).e("conditbox"))
174
+ }, [
123
175
  showTitle.value ? (vue.openBlock(), vue.createElementBlock("span", {
124
176
  key: 0,
125
177
  class: vue.normalizeClass(vue.unref(ns).e("title"))
@@ -134,7 +186,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
134
186
  loading: loading.value,
135
187
  onVisibleChange: visibleChange,
136
188
  remote: __props.remote,
137
- "remote-method": remoteMethod,
189
+ "remote-method": handleFieldSearch,
138
190
  size: __props.size,
139
191
  class: vue.normalizeClass(vue.unref(ns).e("multiple")),
140
192
  "collapse-tags": "",
@@ -142,20 +194,34 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
142
194
  "no-data-text": "\u6682\u65E0\u6570\u636E"
143
195
  }, {
144
196
  default: vue.withCtx(() => [
145
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.value, (item, index) => {
146
- 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"]);
151
- }), 128))
197
+ vue.renderSlot(_ctx.$slots, "default", {}, () => [
198
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(data.value, (item) => {
199
+ return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElOption), {
200
+ key: item[valuePropStr.value],
201
+ value: item[valuePropStr.value],
202
+ label: item[labelPropStr.value]
203
+ }, {
204
+ default: vue.withCtx(() => [
205
+ vue.createElementVNode("div", _hoisted_1, [
206
+ showLetterAvatarStatus.value ? (vue.openBlock(), vue.createElementBlock("div", {
207
+ key: 0,
208
+ class: "letter-circle",
209
+ style: vue.normalizeStyle({ backgroundColor: processLabel(item[labelPropStr.value]).color })
210
+ }, vue.toDisplayString(processLabel(item[labelPropStr.value]).firstLetter), 5)) : vue.createCommentVNode("v-if", true),
211
+ vue.createElementVNode("span", _hoisted_2, vue.toDisplayString(item[labelPropStr.value]), 1)
212
+ ])
213
+ ]),
214
+ _: 2
215
+ }, 1032, ["value", "label"]);
216
+ }), 128))
217
+ ], true)
152
218
  ]),
153
- _: 1
219
+ _: 3
154
220
  }, 8, ["modelValue", "multiple", "filterable", "placeholder", "loading", "remote", "size", "class"])
155
- ], 64);
221
+ ], 2);
156
222
  };
157
223
  }
158
224
  });
159
- var pctMultipleMenuCondition2 = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__file", "pct-multiple-menu-condition2.vue"]]);
225
+ var PctMultipleMenuCondition = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__scopeId", "data-v-c5c05287"], ["__file", "pct-multiple-menu-condition2.vue"]]);
160
226
 
161
- exports["default"] = pctMultipleMenuCondition2;
227
+ exports["default"] = PctMultipleMenuCondition;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ // Inject __name helper
6
+ if (typeof __name === 'undefined') {
7
+ function __name(obj, name) {
8
+ Object.defineProperty(obj, "name", {
9
+ value: name,
10
+ configurable: true
11
+ });
12
+ }
13
+ }
14
+
15
+ var undefined$1 = undefined;
16
+
17
+ exports["default"] = undefined$1;
@@ -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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzy-web-client/plugin-component-vue",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "exports": {
@@ -5,7 +5,7 @@
5
5
  <slot>
6
6
  <ElTooltip placement="top" append-to=".bwa-application" :disabled="currentLabel.length < 16">
7
7
  <div :class="ns.be('option', 'content-label')" ref="contentText">
8
-
8
+
9
9
  <div v-if="!showLetterAvatarStatus" :class="ns.be('option', 'content-label')" style="width: 100%;min-width: 178px;">{{ currentLabel }}</div>
10
10
  <div v-if="showLetterAvatarStatus" :class="ns.be('option', 'content-label')" style="width: 100%;min-width: 178px;display: flex;align-items: center;" >
11
11
  <div class="letter-circle" :style="{ backgroundColor: (processLabel(currentLabel).color) }">
@@ -64,7 +64,7 @@ export default {
64
64
  const show = ref(true)
65
65
  const clickFlag = ref(true)
66
66
  const showLetterAvatarStatus = computed(() => props.showLetterAvatar);
67
-
67
+
68
68
  // console.log(showLetterAvatarStatus.value,'下一级')
69
69
  const contentText = ref()
70
70
 
@@ -119,7 +119,7 @@ function processLabel(label) {
119
119
  }
120
120
 
121
121
  return {
122
-
122
+
123
123
  firstLetter: firstLetter, // 确保是大写
124
124
  color: color
125
125
  };
@@ -144,7 +144,7 @@ function processLabel(label) {
144
144
  show,
145
145
  ns,
146
146
  currentLabel,
147
-
147
+
148
148
  itemSelected,
149
149
  showSelectIcon,
150
150
  filterOptionClick,
@@ -1,6 +1,6 @@
1
1
 
2
2
  import {withInstall} from "element-plus/es/utils/vue/install";
3
- import PctMultipleMenuCondition from './pct-multiple-menu-condition.vue'
3
+ import PctMultipleMenuCondition from './pct-multiple-menu-condition2.vue'
4
4
  import PctInputCondition from './pct-Input-condition.vue'
5
5
  import PctDateRangeCondition from './pct-date-range-condition.vue'
6
6
 
@@ -50,7 +50,7 @@
50
50
  @mouseleave="isHoverIcon = false"
51
51
  @click.stop="handleIconClick"
52
52
  :class="ns.be('option', 'selected')"
53
- >
53
+ >
54
54
  <CircleClose
55
55
  v-if="isHoverIcon && selected.length > 0"
56
56
  class="delete-icon"
@@ -229,10 +229,10 @@ const handleClose = (val)=>{
229
229
  // 1. 空值兜底:避免 modelValue.value 为 null/undefined 时报错
230
230
  const currentModelValue = Array.isArray(modelValue.value) ? modelValue.value : [];
231
231
  // 2. 严格相等 + 类型统一:解决 1 vs "1" 不匹配,同时避免隐式类型转换
232
- modelValue.value = currentModelValue.filter(item =>
232
+ modelValue.value = currentModelValue.filter(item =>
233
233
  String(item) !== String(val.value)
234
234
  );
235
-
235
+
236
236
  }
237
237
  const handleIconClick = () => {
238
238
  if (isHoverIcon.value) {
@@ -308,4 +308,4 @@ const handleClearClick = () => {
308
308
  defineExpose({
309
309
  data
310
310
  })
311
- </script>
311
+ </script>