@ctzy-web-client/plugin-component-vue 1.0.36 → 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 (27) hide show
  1. package/es/advance-select/advance-option.mjs +2 -2
  2. package/es/data-table/data-table.mjs +4 -3
  3. package/es/index.css +1 -0
  4. package/es/pct-filter-panel/pct-compents/index.mjs +1 -1
  5. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +2 -2
  6. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +131 -77
  7. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.mjs +13 -0
  8. package/lib/advance-select/advance-option.js +2 -2
  9. package/lib/data-table/data-table.js +4 -3
  10. package/lib/index.css +1 -0
  11. package/lib/pct-filter-panel/pct-compents/index.js +2 -2
  12. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +2 -2
  13. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +130 -76
  14. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.js +17 -0
  15. package/package.json +1 -1
  16. package/src/advance-select/advance-option.vue +4 -4
  17. package/src/data-table/data-table.vue +4 -4
  18. package/src/pct-filter-panel/pct-compents/index.js +1 -1
  19. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +4 -4
  20. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +148 -96
  21. package/style/index.css +1 -1
  22. package/style/src/var.scss +2 -0
  23. package/style/var.css +1 -1
  24. package/es/components.css +0 -1
  25. package/lib/components.css +0 -1
  26. /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
  27. /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,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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzy-web-client/plugin-component-vue",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
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,10 +1,10 @@
1
1
  <template>
2
- <div :class="ns.b()" ref="dataTableEl" :style="{display: height === 'auto' ? 'flex' : 'block',
3
- flexDirection: height === 'auto' ? 'column' : 'unset'}">
2
+ <div :class="ns.b()" ref="dataTableEl" :style="{display: realHeight === 'auto' ? 'flex' : 'block',
3
+ flexDirection: realHeight === 'auto' ? 'column' : 'unset'}">
4
4
  <slot :dataTable="dataTable">
5
5
  <ElTable
6
6
  class="content"
7
- :height="height"
7
+ :height="realHeight"
8
8
 
9
9
  ref="elTable"
10
10
  :data="data"
@@ -200,7 +200,7 @@ const dataTable = props.dataTable;
200
200
  dataTable._userService = userService.value?.getUserList
201
201
 
202
202
  const dataTableEl = ref(null);
203
-
203
+ const realHeight = computed(() => props.height)
204
204
  const displayColumns = computed(
205
205
  () => unref(dataTable).getDisplayColumns() || []
206
206
  );
@@ -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>