yc-pro-components 0.0.53 → 0.0.57

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 (128) hide show
  1. package/es/components/breadcrumb/index.d.ts +1 -1
  2. package/es/components/breadcrumb/src/index.vue.d.ts +1 -1
  3. package/es/components/check-card/index.d.ts +1 -1
  4. package/es/components/check-card-group/index.d.ts +2 -1
  5. package/es/components/check-card-group/src/index.vue.d.ts +1 -1
  6. package/es/components/descriptions/index.d.ts +2 -1
  7. package/es/components/dialog-form/index.d.ts +2 -1
  8. package/es/components/display-item/index.d.ts +2 -1
  9. package/es/components/drawer-form/index.d.ts +2 -1
  10. package/es/components/form/index.d.ts +2 -1
  11. package/es/components/form/src/form-content.vue.d.ts +2 -2
  12. package/es/components/form-item/index.d.ts +2 -1
  13. package/es/components/header/index.d.ts +1 -1
  14. package/es/components/input-tag/index.d.ts +1 -1
  15. package/es/components/layout/index.d.ts +2 -1
  16. package/es/components/page/index.d.ts +2 -1
  17. package/es/components/pagination/index.d.ts +1 -1
  18. package/es/components/radio/index.d.ts +1 -1
  19. package/es/components/render/index.d.ts +2 -1
  20. package/es/components/search/index.d.ts +2 -1
  21. package/es/components/sidebar/index.d.ts +1 -1
  22. package/es/components/steps-form/index.d.ts +2 -1
  23. package/es/components/table/index.d.ts +2 -1
  24. package/es/components/virtual-table/index.d.ts +2 -1
  25. package/es/components/yc-drawer/store.d.ts +1 -1
  26. package/es/components/yc-plus-page/src/filter-strategies.d.ts +22 -0
  27. package/es/components/yc-plus-page/src/filter-strategies.mjs +189 -0
  28. package/es/components/yc-plus-page/src/filter-utils.d.ts +37 -0
  29. package/es/components/yc-plus-page/src/filter-utils.mjs +27 -0
  30. package/es/components/yc-plus-page/src/header-filter-cell.vue.d.ts +2 -0
  31. package/es/components/yc-plus-page/src/header-filter-cell.vue.mjs +1 -1
  32. package/es/components/yc-plus-page/src/header-filter-cell.vue2.mjs +136 -65
  33. package/es/components/yc-plus-page/src/index.vue.d.ts +2 -1
  34. package/es/components/yc-plus-page/src/index.vue.mjs +1 -1
  35. package/es/components/yc-plus-page/src/index.vue2.mjs +15 -4
  36. package/es/components/yc-plus-page/src/type.d.ts +8 -0
  37. package/es/components/yc-plus-page/src/use-header-filter.mjs +17 -4
  38. package/es/components/yc-select-v2/src/index.vue2.mjs +4 -2
  39. package/es/components/yc-select-v2/src/type.d.ts +2 -0
  40. package/es/directives/dist/fn-perm.mjs +2 -2
  41. package/es/hooks/useGetOptions.mjs +56 -34
  42. package/es/hooks/usePlusFormReset.d.ts +2 -1
  43. package/es/index.css +13 -12
  44. package/es/index.d.ts +1 -0
  45. package/es/index.mjs +1 -0
  46. package/es/types/table.d.ts +2 -3
  47. package/es/utils/dist/permission.mjs +2 -2
  48. package/es/version.d.ts +1 -1
  49. package/es/version.mjs +1 -1
  50. package/es/yc-components/index.d.ts +1 -0
  51. package/es/yc-components/version.d.ts +1 -1
  52. package/index.css +15 -12
  53. package/index.js +445 -117
  54. package/index.min.css +3 -2
  55. package/index.min.js +11 -11
  56. package/index.min.mjs +11 -11
  57. package/index.mjs +444 -118
  58. package/lib/components/breadcrumb/index.d.ts +1 -1
  59. package/lib/components/breadcrumb/src/index.vue.d.ts +1 -1
  60. package/lib/components/check-card/index.d.ts +1 -1
  61. package/lib/components/check-card-group/index.d.ts +2 -1
  62. package/lib/components/check-card-group/src/index.vue.d.ts +1 -1
  63. package/lib/components/descriptions/index.d.ts +2 -1
  64. package/lib/components/dialog-form/index.d.ts +2 -1
  65. package/lib/components/display-item/index.d.ts +2 -1
  66. package/lib/components/drawer-form/index.d.ts +2 -1
  67. package/lib/components/form/index.d.ts +2 -1
  68. package/lib/components/form/src/form-content.vue.d.ts +2 -2
  69. package/lib/components/form-item/index.d.ts +2 -1
  70. package/lib/components/header/index.d.ts +1 -1
  71. package/lib/components/input-tag/index.d.ts +1 -1
  72. package/lib/components/layout/index.d.ts +2 -1
  73. package/lib/components/page/index.d.ts +2 -1
  74. package/lib/components/pagination/index.d.ts +1 -1
  75. package/lib/components/radio/index.d.ts +1 -1
  76. package/lib/components/render/index.d.ts +2 -1
  77. package/lib/components/search/index.d.ts +2 -1
  78. package/lib/components/sidebar/index.d.ts +1 -1
  79. package/lib/components/steps-form/index.d.ts +2 -1
  80. package/lib/components/table/index.d.ts +2 -1
  81. package/lib/components/virtual-table/index.d.ts +2 -1
  82. package/lib/components/yc-drawer/store.d.ts +1 -1
  83. package/lib/components/yc-plus-page/src/filter-strategies.d.ts +22 -0
  84. package/lib/components/yc-plus-page/src/filter-strategies.js +193 -0
  85. package/lib/components/yc-plus-page/src/filter-utils.d.ts +37 -0
  86. package/lib/components/yc-plus-page/src/filter-utils.js +36 -0
  87. package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +2 -0
  88. package/lib/components/yc-plus-page/src/header-filter-cell.vue.js +1 -1
  89. package/lib/components/yc-plus-page/src/header-filter-cell.vue2.js +135 -64
  90. package/lib/components/yc-plus-page/src/index.vue.d.ts +2 -1
  91. package/lib/components/yc-plus-page/src/index.vue.js +1 -1
  92. package/lib/components/yc-plus-page/src/index.vue2.js +15 -4
  93. package/lib/components/yc-plus-page/src/type.d.ts +8 -0
  94. package/lib/components/yc-plus-page/src/use-header-filter.js +17 -4
  95. package/lib/components/yc-select-v2/src/index.vue2.js +4 -2
  96. package/lib/components/yc-select-v2/src/type.d.ts +2 -0
  97. package/lib/hooks/useGetOptions.js +55 -33
  98. package/lib/hooks/usePlusFormReset.d.ts +2 -1
  99. package/lib/index.css +14 -13
  100. package/lib/index.d.ts +1 -0
  101. package/lib/index.js +3 -0
  102. package/lib/types/table.d.ts +2 -3
  103. package/lib/utils/dist/permission.js +3 -2
  104. package/lib/version.d.ts +1 -1
  105. package/lib/version.js +1 -1
  106. package/lib/yc-components/index.d.ts +1 -0
  107. package/lib/yc-components/version.d.ts +1 -1
  108. package/locale/en.js +1 -1
  109. package/locale/en.min.js +1 -1
  110. package/locale/en.min.mjs +1 -1
  111. package/locale/en.mjs +1 -1
  112. package/locale/ja.js +1 -1
  113. package/locale/ja.min.js +1 -1
  114. package/locale/ja.min.mjs +1 -1
  115. package/locale/ja.mjs +1 -1
  116. package/locale/ko.js +1 -1
  117. package/locale/ko.min.js +1 -1
  118. package/locale/ko.min.mjs +1 -1
  119. package/locale/ko.mjs +1 -1
  120. package/locale/zh-cn.js +1 -1
  121. package/locale/zh-cn.min.js +1 -1
  122. package/locale/zh-cn.min.mjs +1 -1
  123. package/locale/zh-cn.mjs +1 -1
  124. package/locale/zh-tw.js +1 -1
  125. package/locale/zh-tw.min.js +1 -1
  126. package/locale/zh-tw.min.mjs +1 -1
  127. package/locale/zh-tw.mjs +1 -1
  128. package/package.json +1 -1
@@ -1,15 +1,17 @@
1
1
  import { defineComponent, computed, reactive, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, withModifiers, createCommentVNode, createElementVNode, normalizeClass, createBlock, resolveDynamicComponent, Fragment, unref, withCtx, toDisplayString, createTextVNode, mergeProps, createVNode, normalizeStyle, renderList, h } from 'vue';
2
- import { ElTooltip, ElIcon, ElPopover, ElButton, ElTimePicker, ElTimeSelect, ElDatePicker, ElInput } from 'element-plus';
2
+ import { ElTooltip, ElIcon, ElPopover, ElButton, ElInput } from 'element-plus';
3
3
  import { QuestionFilled, CaretTop, CaretBottom } from '@element-plus/icons-vue';
4
4
  import { NO_VALUE_OPERATORS } from './constants.mjs';
5
5
  import { getTooltip } from '../../utils/index.mjs';
6
6
  import YcSvgIcon from '../../yc-svg-icon/src/index.vue.mjs';
7
+ import { useGetOptions } from '../../../hooks/useGetOptions.mjs';
8
+ import { isRangeType, FILTER_INNER_DROPDOWN_CLASS, resolveFilterOptions, FILTER_FIELD_STYLE } from './filter-utils.mjs';
9
+ import { resolveInteractionType, FILTER_COMPONENT_STRATEGIES } from './filter-strategies.mjs';
7
10
  import { useYcCdnUrl } from '../../yc-config-provider/src/useYcConfig.mjs';
8
11
 
9
12
  const _hoisted_1 = { class: "yc-header-filter-cell__label-text" };
10
13
  const _hoisted_2 = { class: "yc-header-filter-cell__label-text" };
11
- const _hoisted_3 = { style: { cursor: "pointer", display: "inline-flex", alignItems: "center" } };
12
- const _hoisted_4 = {
14
+ const _hoisted_3 = {
13
15
  class: "yc-header-filter-cell__content",
14
16
  style: {
15
17
  display: "flex",
@@ -19,10 +21,13 @@ const _hoisted_4 = {
19
21
  gap: "4px"
20
22
  }
21
23
  };
22
- const _hoisted_5 = { class: "yc-header-filter-cell__operators" };
23
- const _hoisted_6 = ["onClick"];
24
- const _hoisted_7 = { key: 0 };
25
- const _hoisted_8 = {
24
+ const _hoisted_4 = {
25
+ key: 0,
26
+ class: "yc-header-filter-cell__operators"
27
+ };
28
+ const _hoisted_5 = ["onClick"];
29
+ const _hoisted_6 = { key: 0 };
30
+ const _hoisted_7 = {
26
31
  class: "yc-header-filter-cell__actions",
27
32
  style: {
28
33
  display: "flex",
@@ -42,6 +47,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
42
47
  filters: { default: () => [] },
43
48
  orderBy: { default: () => [] },
44
49
  disableFilter: { type: Boolean, default: false },
50
+ fieldConfig: {},
45
51
  referenceRenderer: { type: Function, default: void 0 }
46
52
  },
47
53
  emits: ["confirm", "reset", "sortChange"],
@@ -73,6 +79,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
73
79
  var _a;
74
80
  return String(((_a = props.column) == null ? void 0 : _a.prop) || "");
75
81
  });
82
+ const getHeaderFilterObject = () => {
83
+ var _a;
84
+ const hf = (_a = props.column) == null ? void 0 : _a.headerFilter;
85
+ if (hf && typeof hf === "object") return hf;
86
+ return {};
87
+ };
76
88
  const isActive = computed(() => {
77
89
  var _a, _b;
78
90
  const field = fieldRef.value;
@@ -90,35 +102,48 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
90
102
  return (_a = props.orderBy) == null ? void 0 : _a.some((i) => i.field === fieldRef.value && i.direction === "desc");
91
103
  }
92
104
  );
93
- const onDocPointerOrClick = (e) => {
105
+ const onDocPointerDown = (e) => {
106
+ var _a;
94
107
  if (!popVisible.value) return;
95
108
  const target = e.target;
96
- const wrapper = wrapperElRef.value;
97
- if (target && ((wrapper == null ? void 0 : wrapper.contains(target)) || target.closest(".yc-header-filter-pop"))) return;
109
+ if (!target) return;
110
+ if ((_a = wrapperElRef.value) == null ? void 0 : _a.contains(target)) return;
111
+ if (target.closest(".yc-header-filter-pop")) return;
112
+ const popoverTrigger = target.closest("[aria-describedby]");
113
+ if (popoverTrigger) return;
114
+ if (target.closest(`.${FILTER_INNER_DROPDOWN_CLASS}`)) return;
98
115
  popVisible.value = false;
99
116
  };
100
117
  onMounted(() => {
101
- window.addEventListener("pointerdown", onDocPointerOrClick, true);
102
- window.addEventListener("click", onDocPointerOrClick, true);
118
+ window.addEventListener("pointerdown", onDocPointerDown, true);
103
119
  });
104
120
  onBeforeUnmount(() => {
105
- window.removeEventListener("pointerdown", onDocPointerOrClick, true);
106
- window.removeEventListener("click", onDocPointerOrClick, true);
121
+ window.removeEventListener("pointerdown", onDocPointerDown, true);
107
122
  });
108
123
  const handleSelect = (op) => {
109
124
  state.selectedOp = op.code;
110
125
  };
111
126
  const handleReset = () => {
112
127
  state.inputVal = "";
113
- emit("reset", { column: props.column, op: state.selectedOp });
128
+ const payload = { column: props.column, op: state.selectedOp };
129
+ const customConfig = getHeaderFilterObject();
130
+ if (customConfig.onReset) {
131
+ customConfig.onReset(payload);
132
+ }
133
+ emit("reset", payload);
114
134
  popVisible.value = false;
115
135
  };
116
136
  const handleConfirm = () => {
117
- emit("confirm", {
137
+ const payload = {
118
138
  column: props.column,
119
139
  op: state.selectedOp,
120
140
  value: state.inputVal
121
- });
141
+ };
142
+ const customConfig = getHeaderFilterObject();
143
+ if (customConfig.onConfirm) {
144
+ customConfig.onConfirm(payload);
145
+ }
146
+ emit("confirm", payload);
122
147
  popVisible.value = false;
123
148
  };
124
149
  const cycleSort = () => {
@@ -150,51 +175,95 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
150
175
  var _a;
151
176
  return (_a = props.column) == null ? void 0 : _a.tooltip;
152
177
  });
153
- const renderValueField = () => {
154
- var _a, _b, _c, _d, _e;
155
- if (!needValueInput.value) return null;
178
+ const optionsSourceProps = computed(() => {
179
+ const config = getHeaderFilterObject();
180
+ const col = props.column;
181
+ return {
182
+ options: config.options !== void 0 ? config.options : col.options,
183
+ autoDict: col.autoDict,
184
+ optionsMap: col.optionsMap,
185
+ prop: col.prop,
186
+ valueType: col.valueType
187
+ };
188
+ });
189
+ const { customOptions: resolvedOptions } = useGetOptions(optionsSourceProps);
190
+ const fieldPropsForFilter = computed(
191
+ () => {
192
+ var _a;
193
+ return ((_a = props.column) == null ? void 0 : _a.fieldProps) || {};
194
+ }
195
+ );
196
+ const resolvedInteractionType = computed(() => {
197
+ var _a;
198
+ const customConfig = getHeaderFilterObject();
156
199
  const vt = String(((_a = props.column) == null ? void 0 : _a.valueType) || "").toLowerCase();
157
- const fp = ((_b = props.column) == null ? void 0 : _b.fieldProps) || {};
158
- if (vt === "time-picker") {
159
- return h(ElTimePicker, {
160
- ...fp,
161
- format: (_c = fp == null ? void 0 : fp.format) != null ? _c : "HH:mm:ss",
162
- valueFormat: (_d = fp == null ? void 0 : fp.valueFormat) != null ? _d : "HH:mm:ss",
163
- modelValue: state.inputVal,
164
- "onUpdate:modelValue": (v) => state.inputVal = String(v != null ? v : ""),
165
- style: "margin-top: 4px; width: 100%"
166
- });
200
+ return resolveInteractionType(customConfig.type, props.fieldConfig, vt);
201
+ });
202
+ const hideOperatorList = computed(() => {
203
+ var _a;
204
+ const t = resolvedInteractionType.value;
205
+ const customConfig = getHeaderFilterObject();
206
+ const mult = (_a = customConfig.props) == null ? void 0 : _a.multiple;
207
+ if (t === "checkbox") return true;
208
+ if (t === "date-picker") return true;
209
+ if (t === "select" && mult) return true;
210
+ if (t === "tree-select" && mult) return true;
211
+ return false;
212
+ });
213
+ const popoverWidth = computed(() => hideOperatorList.value ? 320 : 220);
214
+ watch(popVisible, (visible) => {
215
+ var _a, _b;
216
+ if (!visible) return;
217
+ const t = resolvedInteractionType.value;
218
+ const customConfig = getHeaderFilterObject();
219
+ const fp = {
220
+ ...fieldPropsForFilter.value,
221
+ ...customConfig.props || {}
222
+ };
223
+ if (t === "date-picker" && isRangeType(fp.type)) {
224
+ if (state.selectedOp !== "between") state.selectedOp = "between";
225
+ if (!state.inputVal) {
226
+ const now = /* @__PURE__ */ new Date();
227
+ const y = now.getFullYear();
228
+ const m = String(now.getMonth() + 1).padStart(2, "0");
229
+ state.inputVal = `${y}-${m},${y}-${m}`;
230
+ }
231
+ } else if (t === "checkbox" || t === "select" && ((_a = customConfig.props) == null ? void 0 : _a.multiple) || t === "tree-select" && ((_b = customConfig.props) == null ? void 0 : _b.multiple)) {
232
+ if (state.selectedOp !== "in") state.selectedOp = "in";
167
233
  }
168
- if (vt === "time-select") {
169
- return h(ElTimeSelect, {
170
- ...fp,
171
- modelValue: state.inputVal,
172
- "onUpdate:modelValue": (v) => {
173
- const raw = String(v != null ? v : "");
174
- const nv = raw && /^\d{2}:\d{2}$/.test(raw) ? `${raw}:00` : raw;
175
- state.inputVal = nv;
176
- },
177
- style: "margin-top: 4px; width: 100%"
234
+ });
235
+ const renderValueField = () => {
236
+ var _a;
237
+ if (!needValueInput.value) return null;
238
+ const customConfig = getHeaderFilterObject();
239
+ const customProps = customConfig.props || {};
240
+ if (customConfig.renderField && typeof customConfig.renderField === "function") {
241
+ return customConfig.renderField(state.inputVal, (v) => {
242
+ state.inputVal = Array.isArray(v) ? v.join(",") : String(v != null ? v : "");
178
243
  });
179
244
  }
180
- if (vt === "date-picker") {
181
- return h(ElDatePicker, {
182
- ...fp,
183
- valueFormat: (_e = fp == null ? void 0 : fp.valueFormat) != null ? _e : "YYYY-MM-DD HH:mm:ss",
184
- modelValue: state.inputVal,
185
- "onUpdate:modelValue": (v) => {
186
- const nv = Array.isArray(v) ? v.join(",") : String(v != null ? v : "");
187
- state.inputVal = nv;
188
- },
189
- style: "margin-top: 4px; width: 100%"
245
+ const interactionType = resolvedInteractionType.value;
246
+ const fp = {
247
+ ...((_a = props.column) == null ? void 0 : _a.fieldProps) || {},
248
+ ...customProps
249
+ };
250
+ const strategy = interactionType ? FILTER_COMPONENT_STRATEGIES[interactionType] : void 0;
251
+ if (strategy) {
252
+ const finalOptions = resolveFilterOptions(resolvedOptions.value, customConfig.options);
253
+ return strategy.render({
254
+ fp,
255
+ inputVal: state.inputVal,
256
+ setInputVal: (v) => state.inputVal = v,
257
+ options: finalOptions
190
258
  });
191
259
  }
192
260
  return h(ElInput, {
261
+ ...fp,
193
262
  modelValue: state.inputVal,
194
263
  "onUpdate:modelValue": (v) => state.inputVal = v,
195
- placeholder: "",
264
+ placeholder: fp.placeholder || "\u8BF7\u8F93\u5165",
196
265
  maxlength: 50,
197
- style: "margin-top: 4px; width: 100%"
266
+ style: FILTER_FIELD_STYLE
198
267
  });
199
268
  };
200
269
  return (_ctx, _cache) => {
@@ -356,16 +425,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
356
425
  createCommentVNode(" \u7B5B\u9009\u56FE\u6807\u548C\u5F39\u7A97 "),
357
426
  !_ctx.disableFilter ? (openBlock(), createBlock(unref(ElPopover), {
358
427
  key: 1,
428
+ visible: popVisible.value,
359
429
  trigger: "click",
360
430
  placement: "bottom-start",
361
- width: 220,
362
- visible: popVisible.value,
363
- "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popVisible.value = $event),
431
+ width: popoverWidth.value,
364
432
  "popper-class": "yc-header-filter-pop",
365
433
  "popper-style": { zIndex: 4e3 }
366
434
  }, {
367
435
  reference: withCtx(() => [
368
- createElementVNode("span", _hoisted_3, [
436
+ createElementVNode("span", {
437
+ style: { cursor: "pointer", display: "inline-flex", alignItems: "center" },
438
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
439
+ }, [
369
440
  createVNode(unref(YcSvgIcon), {
370
441
  src: filterIconUrl.value,
371
442
  size: 14,
@@ -375,9 +446,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
375
446
  ])
376
447
  ]),
377
448
  default: withCtx(() => [
378
- createElementVNode("div", _hoisted_4, [
379
- createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
380
- createElementVNode("div", _hoisted_5, [
449
+ createElementVNode("div", _hoisted_3, [
450
+ createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868\uFF08\u591A\u9009/\u65E5\u671F\u533A\u95F4\u7B49\u7531 hideOperatorList \u9690\u85CF\uFF0C\u9ED8\u8BA4 in / between\uFF09 "),
451
+ !hideOperatorList.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
381
452
  (openBlock(true), createElementBlock(
382
453
  Fragment,
383
454
  null,
@@ -404,17 +475,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
404
475
  1
405
476
  /* TEXT */
406
477
  ),
407
- state.selectedOp === op.code ? (openBlock(), createElementBlock("span", _hoisted_7, "\u2713")) : createCommentVNode("v-if", true)
408
- ], 12, _hoisted_6);
478
+ state.selectedOp === op.code ? (openBlock(), createElementBlock("span", _hoisted_6, "\u2713")) : createCommentVNode("v-if", true)
479
+ ], 12, _hoisted_5);
409
480
  }),
410
481
  128
411
482
  /* KEYED_FRAGMENT */
412
483
  ))
413
- ]),
484
+ ])) : createCommentVNode("v-if", true),
414
485
  createCommentVNode(" \u503C\u8F93\u5165 "),
415
- needValueInput.value ? (openBlock(), createBlock(resolveDynamicComponent(renderValueField), { key: 0 })) : createCommentVNode("v-if", true),
486
+ needValueInput.value ? (openBlock(), createBlock(resolveDynamicComponent(renderValueField), { key: 1 })) : createCommentVNode("v-if", true),
416
487
  createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
417
- createElementVNode("div", _hoisted_8, [
488
+ createElementVNode("div", _hoisted_7, [
418
489
  createVNode(unref(ElButton), { onClick: handleReset }, {
419
490
  default: withCtx(() => [
420
491
  createTextVNode("\u91CD\u7F6E")
@@ -437,7 +508,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
437
508
  ]),
438
509
  _: 1
439
510
  /* STABLE */
440
- }, 8, ["visible"])) : createCommentVNode("v-if", true)
511
+ }, 8, ["visible", "width"])) : createCommentVNode("v-if", true)
441
512
  ],
442
513
  544
443
514
  /* NEED_HYDRATION, NEED_PATCH */
@@ -2,7 +2,8 @@ import { Options } from 'sortablejs';
2
2
  import { LooseRequired } from '@vue/shared';
3
3
  import { Arrayable, EpPropMergeType } from 'element-plus/es/utils';
4
4
  import { TableProps, CardProps, RowProps, ColProps, FormItemRule, FormInstance, ElTooltipProps, FormItemProps, ProgressFn, CascaderNode, PopperEffect, InputAutoSize, AutocompleteProps, CheckboxGroupProps, ColorPickerProps, DatePickerProps, InputProps, InputNumberProps, RadioGroupProps, RateProps, SelectProps, SliderProps, SwitchProps, TimePickerDefaultProps, TimeSelectProps, TextProps, ImageProps, LinkProps, TagProps, ProgressProps, TableColumnCtx, TableInstance, TableV2Instance } from 'element-plus';
5
- import { PlusFormSelfProps, ElementPlusFormProps, RecordType, PlusTableSelfProps, PlusPaginationProps, Mutable, PlusFormGroupRow, PlusFormItemProps, PlusRadioProps, PlusDatePickerProps, PlusInputTagProps, TableValueType, ActionBarProps, ColumnSetting, ButtonsCallBackParams, FormChangeCallBackParams, FilterTableHeaderEventType, TableFormRefRow, VirtualTableColumn } from 'packages/yc-components';
5
+ import { RecordType, Mutable, TableValueType } from 'yc-pro-components';
6
+ import { PlusFormSelfProps, ElementPlusFormProps, PlusTableSelfProps, PlusPaginationProps, PlusFormGroupRow, PlusFormItemProps, PlusRadioProps, PlusDatePickerProps, PlusInputTagProps, ActionBarProps, ColumnSetting, ButtonsCallBackParams, FormChangeCallBackParams, FilterTableHeaderEventType, TableFormRefRow, VirtualTableColumn } from 'packages/yc-components';
6
7
  import { RequestResponse, HeaderFilterConfig, HeaderFilterPayload, HeaderFilterResetPayload, HeaderFiltersState, OrderByItem, FieldCatalog } from './type';
7
8
  import { FieldValues, OmitTypes, CascaderProps, FormItemValueType, FieldValueType } from 'yc-pro-components/es/types/form';
8
9
  import { PlusSearchSelfProps } from 'yc-pro-components/es/components/search';
@@ -1,6 +1,6 @@
1
1
  import _sfc_main from './index.vue2.mjs';
2
2
  import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
3
3
 
4
- var YcPlusPageComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bc9aafd7"], ["__file", "index.vue"]]);
4
+ var YcPlusPageComponent = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f0c3f2a9"], ["__file", "index.vue"]]);
5
5
 
6
6
  export { YcPlusPageComponent as default };
@@ -123,11 +123,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
123
123
  );
124
124
  return (fieldConfig == null ? void 0 : fieldConfig.nullable) !== false;
125
125
  }) : cols;
126
- if (!isEnabled) return visibleCols;
126
+ if (!isEnabled) {
127
+ return visibleCols;
128
+ }
127
129
  return visibleCols.map((col) => {
128
130
  const colHideFilter = col.hideHeaderFilter === true;
129
- const fieldFilterable = isFieldFilterable(col.prop);
130
- if (colHideFilter || !fieldFilterable) {
131
+ const hasExplicitHeaderFilter = col.headerFilter && typeof col.headerFilter === "object" || col.headerFilter === true;
132
+ const fieldFilterable = hasExplicitHeaderFilter || isFieldFilterable(col.prop);
133
+ if (colHideFilter) {
134
+ return col;
135
+ }
136
+ if (!hasExplicitHeaderFilter && !fieldFilterable) {
131
137
  return col;
132
138
  }
133
139
  const operators = getOpsByProp(col.prop);
@@ -141,9 +147,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
141
147
  } else if (typeof originalWidth === "string") {
142
148
  const numWidth = parseInt(originalWidth, 10);
143
149
  if (!isNaN(numWidth)) {
144
- adjustedWidth = numWidth + EXTRA_WIDTH;
150
+ adjustedWidth = String(numWidth + EXTRA_WIDTH);
145
151
  }
146
152
  }
153
+ const propStr = String(col.prop || "");
154
+ const fieldConfig = catalog ? Object.values(catalog).find(
155
+ (val) => String((val == null ? void 0 : val.allowedField) || "") === propStr
156
+ ) : void 0;
147
157
  const userRenderHeader = col.renderHeader;
148
158
  return {
149
159
  ...col,
@@ -159,6 +169,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
159
169
  onConfirm: handleFilterConfirm,
160
170
  onReset: handleFilterReset,
161
171
  onSortChange: handleSortChange,
172
+ fieldConfig,
162
173
  // 如果用户定义了 renderHeader,传递给 referenceRenderer
163
174
  ...userRenderHeader && typeof userRenderHeader === "function" ? { referenceRenderer: () => userRenderHeader(label, col) } : {}
164
175
  });
@@ -68,6 +68,14 @@ export interface HeaderFilterConfig {
68
68
  * 列级别的表头筛选配置
69
69
  */
70
70
  export interface ColumnHeaderFilterConfig {
71
+ /** 筛选交互组件类型,若未配置则根据 column.valueType 自动推断 */
72
+ type?: 'input' | 'select' | 'date-picker' | 'time-picker' | 'time-select' | 'cascader' | 'tree-select' | 'checkbox';
73
+ /** 极度自定义的渲染函数接管(如自定义业务弹窗或滑动条等),通过回调更新组件抛出的 filter 值 */
74
+ renderField?: <T = any>(value: T, onChange: (val: T) => void) => any;
75
+ /** 传递给筛选渲染组件的 props,例如 { multiple: true } */
76
+ props?: Record<string, unknown>;
77
+ /** 如果想独立设置筛选组件的 options 数据源,支持传入数组或 Promise。未设置则回退取 column.options 或 autoDict */
78
+ options?: any[] | Promise<any[]> | ((column: any) => any[]);
71
79
  /** 自定义操作符列表 */
72
80
  operators?: OperatorOption[];
73
81
  /** 确认回调 */
@@ -12,11 +12,11 @@ function useHeaderFilter(options = {}) {
12
12
  const isEnabled = computed(() => {
13
13
  const hideHeaderFilter = getHideHeaderFilter();
14
14
  const headerFilterConfig = getHeaderFilterConfig();
15
- if (hideHeaderFilter === true) return false;
16
- if (typeof headerFilterConfig === "boolean") return headerFilterConfig;
17
15
  if (headerFilterConfig && typeof headerFilterConfig === "object") {
18
16
  return headerFilterConfig.enabled !== false;
19
17
  }
18
+ if (typeof headerFilterConfig === "boolean") return headerFilterConfig;
19
+ if (hideHeaderFilter === true) return false;
20
20
  return false;
21
21
  });
22
22
  const operatorCatalogState = computed(() => {
@@ -127,21 +127,34 @@ function useHeaderFilter(options = {}) {
127
127
  }
128
128
  };
129
129
  const getMergedQuery = (baseQuery) => {
130
+ const normalizeFilters = (filters) => {
131
+ return filters.map((f) => {
132
+ if (f.op === "in" && typeof f.value === "string" && f.value) {
133
+ const arr = f.value.split(",").filter(Boolean).map((s) => {
134
+ const n = Number(s);
135
+ return Number.isNaN(n) ? s : n;
136
+ });
137
+ return { ...f, value: arr };
138
+ }
139
+ return f;
140
+ });
141
+ };
130
142
  let mergedFilters = baseQuery.filters;
131
143
  if (headerFiltersState.filters.length > 0) {
144
+ const normalized = normalizeFilters(headerFiltersState.filters);
132
145
  const baseFilters = baseQuery.filters;
133
146
  if (baseFilters && typeof baseFilters === "object" && Array.isArray(baseFilters.filters)) {
134
147
  mergedFilters = {
135
148
  logic: baseFilters.logic || "and",
136
149
  filters: [
137
150
  ...baseFilters.filters,
138
- ...headerFiltersState.filters
151
+ ...normalized
139
152
  ]
140
153
  };
141
154
  } else {
142
155
  mergedFilters = {
143
156
  logic: headerFiltersState.logic,
144
- filters: [...headerFiltersState.filters]
157
+ filters: [...normalized]
145
158
  };
146
159
  }
147
160
  }
@@ -34,7 +34,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
34
34
  collapseTags: { type: Boolean, default: false },
35
35
  maxCollapseTags: { default: 1 },
36
36
  initialOptions: { default: () => [] },
37
- allSelect: { type: Boolean, default: false }
37
+ allSelect: { type: Boolean, default: false },
38
+ popperClass: {}
38
39
  },
39
40
  emits: ["update:modelValue", "change"],
40
41
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -364,6 +365,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
364
365
  multiple: _ctx.multiple,
365
366
  "collapse-tags": _ctx.collapseTags,
366
367
  "max-collapse-tags": _ctx.maxCollapseTags,
368
+ "popper-class": _ctx.popperClass,
367
369
  onVisibleChange: handleVisibleChange,
368
370
  onChange: handleChange,
369
371
  onClear: handleClear,
@@ -388,7 +390,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
388
390
  ]),
389
391
  _: 1
390
392
  /* STABLE */
391
- }, 8, ["modelValue", "filterable", "remote", "reserve-keyword", "placeholder", "clearable", "disabled", "loading", "filter-method", "allow-create", "default-first-option", "multiple", "collapse-tags", "max-collapse-tags"])), [
393
+ }, 8, ["modelValue", "filterable", "remote", "reserve-keyword", "placeholder", "clearable", "disabled", "loading", "filter-method", "allow-create", "default-first-option", "multiple", "collapse-tags", "max-collapse-tags", "popper-class"])), [
392
394
  [_directive_load_more, handleLoadMore]
393
395
  ]);
394
396
  };
@@ -80,4 +80,6 @@ export interface YcSelectV2Props {
80
80
  initialOptions?: SelectOption[];
81
81
  /** 是否启用全选功能(仅多选时有效) */
82
82
  allSelect?: boolean;
83
+ /** 下拉弹层自定义类名,用于控制 z-index 等样式 */
84
+ popperClass?: string;
83
85
  }
@@ -5,8 +5,8 @@ import 'accounting';
5
5
  import 'good-storage';
6
6
  import 'crypto-js';
7
7
  import 'qs';
8
- import { hasFunctionPermission as c } from '../../utils/dist/permission.mjs';
8
+ import { hasFunctionPermission as n } from '../../utils/dist/permission.mjs';
9
9
 
10
- const m={mounted(e,r){const{value:o,modifiers:n}=r;if(!o)throw new Error(`[Directive: fn-perm]: \u9700\u8981\u4F20\u5165 functionCode\uFF01\u5982 v-fn-perm="'fn_editTaxRate'"`);const t=n.every?"every":"some";c(o,t)||e.parentNode?.removeChild(e);}};
10
+ const m={mounted(e,r){const{value:o,modifiers:n$1}=r;if(!o)throw new Error(`[Directive: fn-perm]: \u9700\u8981\u4F20\u5165 functionCode\uFF01\u5982 v-fn-perm="'fn_editTaxRate'"`);const t=n$1.every?"every":"some";n(o,t)||e.parentNode?.removeChild(e);}};
11
11
 
12
12
  export { m as fnPerm };
@@ -1,6 +1,6 @@
1
1
  import { ref, inject, isRef, isReactive, watch } from 'vue';
2
2
  import { DictStoreInjectionKey } from '../constants/dict.mjs';
3
- import { isPlainObject, isArray, isFunction, isPromise, toRawType } from '../components/utils/is.mjs';
3
+ import { isPlainObject, isPromise, isFunction, isArray, toRawType } from '../components/utils/is.mjs';
4
4
 
5
5
  const throwError = (data) => {
6
6
  if (!isArray(data)) {
@@ -29,8 +29,16 @@ const useGetOptions = (props) => {
29
29
  const options = ref([]);
30
30
  const optionsIsReady = ref(false);
31
31
  const injectedDictStore = inject(DictStoreInjectionKey, null);
32
- const hasValidOptions = props.options && (!isArray(props.options) || props.options.length > 0);
33
- if (hasValidOptions) {
32
+ const hasValidOptions = () => {
33
+ const o = props.options;
34
+ if (!o) return false;
35
+ if (isRef(o)) return true;
36
+ if (isPromise(o)) return true;
37
+ if (isFunction(o)) return true;
38
+ if (isArray(o)) return o.length > 0;
39
+ return false;
40
+ };
41
+ if (hasValidOptions()) {
34
42
  handleOptions();
35
43
  } else if (props.autoDict) {
36
44
  handleAutoDict();
@@ -38,28 +46,43 @@ const useGetOptions = (props) => {
38
46
  options.value = [];
39
47
  optionsIsReady.value = true;
40
48
  }
49
+ function getOptionsResolvedSnapshot() {
50
+ const o = props.options;
51
+ if (!o) return [];
52
+ if (isPromise(o)) return [];
53
+ if (isRef(o)) {
54
+ const val = o.value;
55
+ return val || [];
56
+ }
57
+ if (isFunction(o)) {
58
+ const result = o(props);
59
+ if (isPromise(result)) return [];
60
+ return result || [];
61
+ }
62
+ if (isArray(o)) return o;
63
+ if (isReactive(o)) {
64
+ return o || [];
65
+ }
66
+ return [];
67
+ }
41
68
  function handleOptions() {
42
69
  if (!props.options) {
43
70
  options.value = [];
44
71
  optionsIsReady.value = true;
45
72
  return;
46
73
  }
47
- if (isRef(props.options) || isReactive(props.options) || isArray(props.options)) {
48
- watch(
49
- () => props.options,
50
- (val) => {
51
- const value = isRef(val) ? val.value : val;
52
- options.value = getOptionsByOptionsMap(value, props);
53
- optionsIsReady.value = true;
54
- },
55
- {
56
- immediate: true,
57
- deep: true
58
- }
59
- );
60
- } else if (isFunction(props.options)) {
61
- const getValue = props.options;
62
- const result = getValue(props);
74
+ if (isPromise(props.options)) {
75
+ props.options.then((value) => {
76
+ options.value = getOptionsByOptionsMap(value, props);
77
+ optionsIsReady.value = true;
78
+ throwError(options.value);
79
+ }).catch((err) => {
80
+ throw err;
81
+ });
82
+ return;
83
+ }
84
+ if (isFunction(props.options)) {
85
+ const result = props.options(props);
63
86
  if (isPromise(result)) {
64
87
  result.then((value) => {
65
88
  options.value = getOptionsByOptionsMap(value, props);
@@ -68,23 +91,22 @@ const useGetOptions = (props) => {
68
91
  }).catch((err) => {
69
92
  throw err;
70
93
  });
71
- } else {
72
- options.value = getOptionsByOptionsMap(result, props);
73
- optionsIsReady.value = true;
94
+ return;
74
95
  }
75
- } else if (isPromise(props.options)) {
76
- const getValue = props.options;
77
- getValue.then((value) => {
78
- options.value = getOptionsByOptionsMap(value, props);
79
- optionsIsReady.value = true;
80
- throwError(options.value);
81
- }).catch((err) => {
82
- throw err;
83
- });
84
- } else {
85
- optionsIsReady.value = true;
86
- throwError(props.options);
87
96
  }
97
+ if (isRef(props.options) || isReactive(props.options) || isArray(props.options) || isFunction(props.options)) {
98
+ watch(
99
+ () => getOptionsResolvedSnapshot(),
100
+ (val) => {
101
+ options.value = getOptionsByOptionsMap(val, props);
102
+ optionsIsReady.value = true;
103
+ },
104
+ { immediate: true, deep: true }
105
+ );
106
+ return;
107
+ }
108
+ optionsIsReady.value = true;
109
+ throwError(props.options);
88
110
  }
89
111
  function handleAutoDict() {
90
112
  if (isFunction(props.autoDict)) {
@@ -1,7 +1,8 @@
1
1
  import { EpPropMergeType, EpPropFinalized } from 'element-plus/es/utils';
2
2
  import { LooseRequired } from '@vue/shared';
3
3
  import { FormInstance, ElTooltipProps, FormItemProps, ProgressFn, CascaderNode, PopperEffect, InputAutoSize, AutocompleteProps, CheckboxGroupProps, ColorPickerProps, DatePickerProps, InputProps, InputNumberProps, RadioGroupProps, RateProps, SelectProps, SliderProps, SwitchProps, TimePickerDefaultProps, TimeSelectProps, TextProps, ImageProps, LinkProps, TagProps, ProgressProps, DrawerProps, DialogTransition, DialogBeforeCloseFn } from 'element-plus';
4
- import { PlusDialogProps, PlusFormProps, FieldValues, PlusColumn, PlusFormItemProps, RecordType, Mutable, PropsItemType, OmitTypes, CascaderProps, PlusRadioProps, PlusDatePickerProps, PlusInputTagProps, OptionsType, RenderTypes, TableValueType, FormItemValueType, FieldValueType, OptionsRow } from 'yc-components';
4
+ import { FieldValues, PlusColumn, RecordType, Mutable, PropsItemType, OmitTypes, CascaderProps, OptionsType, RenderTypes, TableValueType, FormItemValueType, FieldValueType, OptionsRow } from 'yc-pro-components';
5
+ import { PlusDialogProps, PlusFormProps, PlusFormItemProps, PlusRadioProps, PlusDatePickerProps, PlusInputTagProps } from 'packages/components';
5
6
  import { nextTick, Ref, ComponentInternalInstance, VNodeProps, AllowedComponentProps, ComponentCustomProps, ExtractPropTypes, PropType, Slot, ComponentPublicInstance, ComponentOptionsBase, ComputedRef, ComponentOptionsMixin, DebuggerEvent, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, CSSProperties, Component, TransitionProps, ComputedOptions, MethodOptions } from 'vue';
6
7
 
7
8
  /**