yc-pro-components 0.0.56 → 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 (113) 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/hooks/useGetOptions.mjs +56 -34
  41. package/es/hooks/usePlusFormReset.d.ts +2 -1
  42. package/es/index.css +12 -11
  43. package/es/types/table.d.ts +2 -3
  44. package/index.css +15 -12
  45. package/index.js +440 -114
  46. package/index.min.css +3 -2
  47. package/index.min.js +11 -11
  48. package/index.min.mjs +11 -11
  49. package/index.mjs +440 -114
  50. package/lib/components/breadcrumb/index.d.ts +1 -1
  51. package/lib/components/breadcrumb/src/index.vue.d.ts +1 -1
  52. package/lib/components/check-card/index.d.ts +1 -1
  53. package/lib/components/check-card-group/index.d.ts +2 -1
  54. package/lib/components/check-card-group/src/index.vue.d.ts +1 -1
  55. package/lib/components/descriptions/index.d.ts +2 -1
  56. package/lib/components/dialog-form/index.d.ts +2 -1
  57. package/lib/components/display-item/index.d.ts +2 -1
  58. package/lib/components/drawer-form/index.d.ts +2 -1
  59. package/lib/components/form/index.d.ts +2 -1
  60. package/lib/components/form/src/form-content.vue.d.ts +2 -2
  61. package/lib/components/form-item/index.d.ts +2 -1
  62. package/lib/components/header/index.d.ts +1 -1
  63. package/lib/components/input-tag/index.d.ts +1 -1
  64. package/lib/components/layout/index.d.ts +2 -1
  65. package/lib/components/page/index.d.ts +2 -1
  66. package/lib/components/pagination/index.d.ts +1 -1
  67. package/lib/components/radio/index.d.ts +1 -1
  68. package/lib/components/render/index.d.ts +2 -1
  69. package/lib/components/search/index.d.ts +2 -1
  70. package/lib/components/sidebar/index.d.ts +1 -1
  71. package/lib/components/steps-form/index.d.ts +2 -1
  72. package/lib/components/table/index.d.ts +2 -1
  73. package/lib/components/virtual-table/index.d.ts +2 -1
  74. package/lib/components/yc-drawer/store.d.ts +1 -1
  75. package/lib/components/yc-plus-page/src/filter-strategies.d.ts +22 -0
  76. package/lib/components/yc-plus-page/src/filter-strategies.js +193 -0
  77. package/lib/components/yc-plus-page/src/filter-utils.d.ts +37 -0
  78. package/lib/components/yc-plus-page/src/filter-utils.js +36 -0
  79. package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +2 -0
  80. package/lib/components/yc-plus-page/src/header-filter-cell.vue.js +1 -1
  81. package/lib/components/yc-plus-page/src/header-filter-cell.vue2.js +135 -64
  82. package/lib/components/yc-plus-page/src/index.vue.d.ts +2 -1
  83. package/lib/components/yc-plus-page/src/index.vue.js +1 -1
  84. package/lib/components/yc-plus-page/src/index.vue2.js +15 -4
  85. package/lib/components/yc-plus-page/src/type.d.ts +8 -0
  86. package/lib/components/yc-plus-page/src/use-header-filter.js +17 -4
  87. package/lib/components/yc-select-v2/src/index.vue2.js +4 -2
  88. package/lib/components/yc-select-v2/src/type.d.ts +2 -0
  89. package/lib/hooks/useGetOptions.js +55 -33
  90. package/lib/hooks/usePlusFormReset.d.ts +2 -1
  91. package/lib/index.css +12 -11
  92. package/lib/types/table.d.ts +2 -3
  93. package/locale/en.js +1 -1
  94. package/locale/en.min.js +1 -1
  95. package/locale/en.min.mjs +1 -1
  96. package/locale/en.mjs +1 -1
  97. package/locale/ja.js +1 -1
  98. package/locale/ja.min.js +1 -1
  99. package/locale/ja.min.mjs +1 -1
  100. package/locale/ja.mjs +1 -1
  101. package/locale/ko.js +1 -1
  102. package/locale/ko.min.js +1 -1
  103. package/locale/ko.min.mjs +1 -1
  104. package/locale/ko.mjs +1 -1
  105. package/locale/zh-cn.js +1 -1
  106. package/locale/zh-cn.min.js +1 -1
  107. package/locale/zh-cn.min.mjs +1 -1
  108. package/locale/zh-cn.mjs +1 -1
  109. package/locale/zh-tw.js +1 -1
  110. package/locale/zh-tw.min.js +1 -1
  111. package/locale/zh-tw.min.mjs +1 -1
  112. package/locale/zh-tw.mjs +1 -1
  113. package/package.json +1 -1
@@ -8,12 +8,14 @@ var ElementPlusIconsVue = require('@element-plus/icons-vue');
8
8
  var constants = require('./constants.js');
9
9
  var index = require('../../utils/index.js');
10
10
  var index$1 = require('../../yc-svg-icon/src/index.vue.js');
11
+ var useGetOptions = require('../../../hooks/useGetOptions.js');
12
+ var filterUtils = require('./filter-utils.js');
13
+ var filterStrategies = require('./filter-strategies.js');
11
14
  var useYcConfig = require('../../yc-config-provider/src/useYcConfig.js');
12
15
 
13
16
  const _hoisted_1 = { class: "yc-header-filter-cell__label-text" };
14
17
  const _hoisted_2 = { class: "yc-header-filter-cell__label-text" };
15
- const _hoisted_3 = { style: { cursor: "pointer", display: "inline-flex", alignItems: "center" } };
16
- const _hoisted_4 = {
18
+ const _hoisted_3 = {
17
19
  class: "yc-header-filter-cell__content",
18
20
  style: {
19
21
  display: "flex",
@@ -23,10 +25,13 @@ const _hoisted_4 = {
23
25
  gap: "4px"
24
26
  }
25
27
  };
26
- const _hoisted_5 = { class: "yc-header-filter-cell__operators" };
27
- const _hoisted_6 = ["onClick"];
28
- const _hoisted_7 = { key: 0 };
29
- const _hoisted_8 = {
28
+ const _hoisted_4 = {
29
+ key: 0,
30
+ class: "yc-header-filter-cell__operators"
31
+ };
32
+ const _hoisted_5 = ["onClick"];
33
+ const _hoisted_6 = { key: 0 };
34
+ const _hoisted_7 = {
30
35
  class: "yc-header-filter-cell__actions",
31
36
  style: {
32
37
  display: "flex",
@@ -46,6 +51,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
46
51
  filters: { default: () => [] },
47
52
  orderBy: { default: () => [] },
48
53
  disableFilter: { type: Boolean, default: false },
54
+ fieldConfig: {},
49
55
  referenceRenderer: { type: Function, default: void 0 }
50
56
  },
51
57
  emits: ["confirm", "reset", "sortChange"],
@@ -77,6 +83,12 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
77
83
  var _a;
78
84
  return String(((_a = props.column) == null ? void 0 : _a.prop) || "");
79
85
  });
86
+ const getHeaderFilterObject = () => {
87
+ var _a;
88
+ const hf = (_a = props.column) == null ? void 0 : _a.headerFilter;
89
+ if (hf && typeof hf === "object") return hf;
90
+ return {};
91
+ };
80
92
  const isActive = vue.computed(() => {
81
93
  var _a, _b;
82
94
  const field = fieldRef.value;
@@ -94,35 +106,48 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
94
106
  return (_a = props.orderBy) == null ? void 0 : _a.some((i) => i.field === fieldRef.value && i.direction === "desc");
95
107
  }
96
108
  );
97
- const onDocPointerOrClick = (e) => {
109
+ const onDocPointerDown = (e) => {
110
+ var _a;
98
111
  if (!popVisible.value) return;
99
112
  const target = e.target;
100
- const wrapper = wrapperElRef.value;
101
- if (target && ((wrapper == null ? void 0 : wrapper.contains(target)) || target.closest(".yc-header-filter-pop"))) return;
113
+ if (!target) return;
114
+ if ((_a = wrapperElRef.value) == null ? void 0 : _a.contains(target)) return;
115
+ if (target.closest(".yc-header-filter-pop")) return;
116
+ const popoverTrigger = target.closest("[aria-describedby]");
117
+ if (popoverTrigger) return;
118
+ if (target.closest(`.${filterUtils.FILTER_INNER_DROPDOWN_CLASS}`)) return;
102
119
  popVisible.value = false;
103
120
  };
104
121
  vue.onMounted(() => {
105
- window.addEventListener("pointerdown", onDocPointerOrClick, true);
106
- window.addEventListener("click", onDocPointerOrClick, true);
122
+ window.addEventListener("pointerdown", onDocPointerDown, true);
107
123
  });
108
124
  vue.onBeforeUnmount(() => {
109
- window.removeEventListener("pointerdown", onDocPointerOrClick, true);
110
- window.removeEventListener("click", onDocPointerOrClick, true);
125
+ window.removeEventListener("pointerdown", onDocPointerDown, true);
111
126
  });
112
127
  const handleSelect = (op) => {
113
128
  state.selectedOp = op.code;
114
129
  };
115
130
  const handleReset = () => {
116
131
  state.inputVal = "";
117
- emit("reset", { column: props.column, op: state.selectedOp });
132
+ const payload = { column: props.column, op: state.selectedOp };
133
+ const customConfig = getHeaderFilterObject();
134
+ if (customConfig.onReset) {
135
+ customConfig.onReset(payload);
136
+ }
137
+ emit("reset", payload);
118
138
  popVisible.value = false;
119
139
  };
120
140
  const handleConfirm = () => {
121
- emit("confirm", {
141
+ const payload = {
122
142
  column: props.column,
123
143
  op: state.selectedOp,
124
144
  value: state.inputVal
125
- });
145
+ };
146
+ const customConfig = getHeaderFilterObject();
147
+ if (customConfig.onConfirm) {
148
+ customConfig.onConfirm(payload);
149
+ }
150
+ emit("confirm", payload);
126
151
  popVisible.value = false;
127
152
  };
128
153
  const cycleSort = () => {
@@ -154,51 +179,95 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
154
179
  var _a;
155
180
  return (_a = props.column) == null ? void 0 : _a.tooltip;
156
181
  });
157
- const renderValueField = () => {
158
- var _a, _b, _c, _d, _e;
159
- if (!needValueInput.value) return null;
182
+ const optionsSourceProps = vue.computed(() => {
183
+ const config = getHeaderFilterObject();
184
+ const col = props.column;
185
+ return {
186
+ options: config.options !== void 0 ? config.options : col.options,
187
+ autoDict: col.autoDict,
188
+ optionsMap: col.optionsMap,
189
+ prop: col.prop,
190
+ valueType: col.valueType
191
+ };
192
+ });
193
+ const { customOptions: resolvedOptions } = useGetOptions.useGetOptions(optionsSourceProps);
194
+ const fieldPropsForFilter = vue.computed(
195
+ () => {
196
+ var _a;
197
+ return ((_a = props.column) == null ? void 0 : _a.fieldProps) || {};
198
+ }
199
+ );
200
+ const resolvedInteractionType = vue.computed(() => {
201
+ var _a;
202
+ const customConfig = getHeaderFilterObject();
160
203
  const vt = String(((_a = props.column) == null ? void 0 : _a.valueType) || "").toLowerCase();
161
- const fp = ((_b = props.column) == null ? void 0 : _b.fieldProps) || {};
162
- if (vt === "time-picker") {
163
- return vue.h(elementPlus.ElTimePicker, {
164
- ...fp,
165
- format: (_c = fp == null ? void 0 : fp.format) != null ? _c : "HH:mm:ss",
166
- valueFormat: (_d = fp == null ? void 0 : fp.valueFormat) != null ? _d : "HH:mm:ss",
167
- modelValue: state.inputVal,
168
- "onUpdate:modelValue": (v) => state.inputVal = String(v != null ? v : ""),
169
- style: "margin-top: 4px; width: 100%"
170
- });
204
+ return filterStrategies.resolveInteractionType(customConfig.type, props.fieldConfig, vt);
205
+ });
206
+ const hideOperatorList = vue.computed(() => {
207
+ var _a;
208
+ const t = resolvedInteractionType.value;
209
+ const customConfig = getHeaderFilterObject();
210
+ const mult = (_a = customConfig.props) == null ? void 0 : _a.multiple;
211
+ if (t === "checkbox") return true;
212
+ if (t === "date-picker") return true;
213
+ if (t === "select" && mult) return true;
214
+ if (t === "tree-select" && mult) return true;
215
+ return false;
216
+ });
217
+ const popoverWidth = vue.computed(() => hideOperatorList.value ? 320 : 220);
218
+ vue.watch(popVisible, (visible) => {
219
+ var _a, _b;
220
+ if (!visible) return;
221
+ const t = resolvedInteractionType.value;
222
+ const customConfig = getHeaderFilterObject();
223
+ const fp = {
224
+ ...fieldPropsForFilter.value,
225
+ ...customConfig.props || {}
226
+ };
227
+ if (t === "date-picker" && filterUtils.isRangeType(fp.type)) {
228
+ if (state.selectedOp !== "between") state.selectedOp = "between";
229
+ if (!state.inputVal) {
230
+ const now = /* @__PURE__ */ new Date();
231
+ const y = now.getFullYear();
232
+ const m = String(now.getMonth() + 1).padStart(2, "0");
233
+ state.inputVal = `${y}-${m},${y}-${m}`;
234
+ }
235
+ } 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)) {
236
+ if (state.selectedOp !== "in") state.selectedOp = "in";
171
237
  }
172
- if (vt === "time-select") {
173
- return vue.h(elementPlus.ElTimeSelect, {
174
- ...fp,
175
- modelValue: state.inputVal,
176
- "onUpdate:modelValue": (v) => {
177
- const raw = String(v != null ? v : "");
178
- const nv = raw && /^\d{2}:\d{2}$/.test(raw) ? `${raw}:00` : raw;
179
- state.inputVal = nv;
180
- },
181
- style: "margin-top: 4px; width: 100%"
238
+ });
239
+ const renderValueField = () => {
240
+ var _a;
241
+ if (!needValueInput.value) return null;
242
+ const customConfig = getHeaderFilterObject();
243
+ const customProps = customConfig.props || {};
244
+ if (customConfig.renderField && typeof customConfig.renderField === "function") {
245
+ return customConfig.renderField(state.inputVal, (v) => {
246
+ state.inputVal = Array.isArray(v) ? v.join(",") : String(v != null ? v : "");
182
247
  });
183
248
  }
184
- if (vt === "date-picker") {
185
- return vue.h(elementPlus.ElDatePicker, {
186
- ...fp,
187
- valueFormat: (_e = fp == null ? void 0 : fp.valueFormat) != null ? _e : "YYYY-MM-DD HH:mm:ss",
188
- modelValue: state.inputVal,
189
- "onUpdate:modelValue": (v) => {
190
- const nv = Array.isArray(v) ? v.join(",") : String(v != null ? v : "");
191
- state.inputVal = nv;
192
- },
193
- style: "margin-top: 4px; width: 100%"
249
+ const interactionType = resolvedInteractionType.value;
250
+ const fp = {
251
+ ...((_a = props.column) == null ? void 0 : _a.fieldProps) || {},
252
+ ...customProps
253
+ };
254
+ const strategy = interactionType ? filterStrategies.FILTER_COMPONENT_STRATEGIES[interactionType] : void 0;
255
+ if (strategy) {
256
+ const finalOptions = filterUtils.resolveFilterOptions(resolvedOptions.value, customConfig.options);
257
+ return strategy.render({
258
+ fp,
259
+ inputVal: state.inputVal,
260
+ setInputVal: (v) => state.inputVal = v,
261
+ options: finalOptions
194
262
  });
195
263
  }
196
264
  return vue.h(elementPlus.ElInput, {
265
+ ...fp,
197
266
  modelValue: state.inputVal,
198
267
  "onUpdate:modelValue": (v) => state.inputVal = v,
199
- placeholder: "",
268
+ placeholder: fp.placeholder || "\u8BF7\u8F93\u5165",
200
269
  maxlength: 50,
201
- style: "margin-top: 4px; width: 100%"
270
+ style: filterUtils.FILTER_FIELD_STYLE
202
271
  });
203
272
  };
204
273
  return (_ctx, _cache) => {
@@ -360,16 +429,18 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
360
429
  vue.createCommentVNode(" \u7B5B\u9009\u56FE\u6807\u548C\u5F39\u7A97 "),
361
430
  !_ctx.disableFilter ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElPopover), {
362
431
  key: 1,
432
+ visible: popVisible.value,
363
433
  trigger: "click",
364
434
  placement: "bottom-start",
365
- width: 220,
366
- visible: popVisible.value,
367
- "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popVisible.value = $event),
435
+ width: popoverWidth.value,
368
436
  "popper-class": "yc-header-filter-pop",
369
437
  "popper-style": { zIndex: 4e3 }
370
438
  }, {
371
439
  reference: vue.withCtx(() => [
372
- vue.createElementVNode("span", _hoisted_3, [
440
+ vue.createElementVNode("span", {
441
+ style: { cursor: "pointer", display: "inline-flex", alignItems: "center" },
442
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
443
+ }, [
373
444
  vue.createVNode(vue.unref(index$1.default), {
374
445
  src: filterIconUrl.value,
375
446
  size: 14,
@@ -379,9 +450,9 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
379
450
  ])
380
451
  ]),
381
452
  default: vue.withCtx(() => [
382
- vue.createElementVNode("div", _hoisted_4, [
383
- vue.createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
384
- vue.createElementVNode("div", _hoisted_5, [
453
+ vue.createElementVNode("div", _hoisted_3, [
454
+ vue.createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868\uFF08\u591A\u9009/\u65E5\u671F\u533A\u95F4\u7B49\u7531 hideOperatorList \u9690\u85CF\uFF0C\u9ED8\u8BA4 in / between\uFF09 "),
455
+ !hideOperatorList.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4, [
385
456
  (vue.openBlock(true), vue.createElementBlock(
386
457
  vue.Fragment,
387
458
  null,
@@ -408,17 +479,17 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
408
479
  1
409
480
  /* TEXT */
410
481
  ),
411
- state.selectedOp === op.code ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7, "\u2713")) : vue.createCommentVNode("v-if", true)
412
- ], 12, _hoisted_6);
482
+ state.selectedOp === op.code ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6, "\u2713")) : vue.createCommentVNode("v-if", true)
483
+ ], 12, _hoisted_5);
413
484
  }),
414
485
  128
415
486
  /* KEYED_FRAGMENT */
416
487
  ))
417
- ]),
488
+ ])) : vue.createCommentVNode("v-if", true),
418
489
  vue.createCommentVNode(" \u503C\u8F93\u5165 "),
419
- needValueInput.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderValueField), { key: 0 })) : vue.createCommentVNode("v-if", true),
490
+ needValueInput.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderValueField), { key: 1 })) : vue.createCommentVNode("v-if", true),
420
491
  vue.createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
421
- vue.createElementVNode("div", _hoisted_8, [
492
+ vue.createElementVNode("div", _hoisted_7, [
422
493
  vue.createVNode(vue.unref(elementPlus.ElButton), { onClick: handleReset }, {
423
494
  default: vue.withCtx(() => [
424
495
  vue.createTextVNode("\u91CD\u7F6E")
@@ -441,7 +512,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
441
512
  ]),
442
513
  _: 1
443
514
  /* STABLE */
444
- }, 8, ["visible"])) : vue.createCommentVNode("v-if", true)
515
+ }, 8, ["visible", "width"])) : vue.createCommentVNode("v-if", true)
445
516
  ],
446
517
  544
447
518
  /* 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';
@@ -5,6 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var index_vue_vue_type_script_setup_true_lang = require('./index.vue2.js');
6
6
  var _pluginVue_exportHelper = require('../../../_virtual/_plugin-vue_export-helper.js');
7
7
 
8
- var YcPlusPageComponent = /* @__PURE__ */ _pluginVue_exportHelper.default(index_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-bc9aafd7"], ["__file", "index.vue"]]);
8
+ var YcPlusPageComponent = /* @__PURE__ */ _pluginVue_exportHelper.default(index_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-f0c3f2a9"], ["__file", "index.vue"]]);
9
9
 
10
10
  exports.default = YcPlusPageComponent;
@@ -127,11 +127,17 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
127
127
  );
128
128
  return (fieldConfig == null ? void 0 : fieldConfig.nullable) !== false;
129
129
  }) : cols;
130
- if (!isEnabled) return visibleCols;
130
+ if (!isEnabled) {
131
+ return visibleCols;
132
+ }
131
133
  return visibleCols.map((col) => {
132
134
  const colHideFilter = col.hideHeaderFilter === true;
133
- const fieldFilterable = isFieldFilterable(col.prop);
134
- if (colHideFilter || !fieldFilterable) {
135
+ const hasExplicitHeaderFilter = col.headerFilter && typeof col.headerFilter === "object" || col.headerFilter === true;
136
+ const fieldFilterable = hasExplicitHeaderFilter || isFieldFilterable(col.prop);
137
+ if (colHideFilter) {
138
+ return col;
139
+ }
140
+ if (!hasExplicitHeaderFilter && !fieldFilterable) {
135
141
  return col;
136
142
  }
137
143
  const operators = getOpsByProp(col.prop);
@@ -145,9 +151,13 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
145
151
  } else if (typeof originalWidth === "string") {
146
152
  const numWidth = parseInt(originalWidth, 10);
147
153
  if (!isNaN(numWidth)) {
148
- adjustedWidth = numWidth + EXTRA_WIDTH;
154
+ adjustedWidth = String(numWidth + EXTRA_WIDTH);
149
155
  }
150
156
  }
157
+ const propStr = String(col.prop || "");
158
+ const fieldConfig = catalog ? Object.values(catalog).find(
159
+ (val) => String((val == null ? void 0 : val.allowedField) || "") === propStr
160
+ ) : void 0;
151
161
  const userRenderHeader = col.renderHeader;
152
162
  return {
153
163
  ...col,
@@ -163,6 +173,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
163
173
  onConfirm: handleFilterConfirm,
164
174
  onReset: handleFilterReset,
165
175
  onSortChange: handleSortChange,
176
+ fieldConfig,
166
177
  // 如果用户定义了 renderHeader,传递给 referenceRenderer
167
178
  ...userRenderHeader && typeof userRenderHeader === "function" ? { referenceRenderer: () => userRenderHeader(label, col) } : {}
168
179
  });
@@ -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
  /** 确认回调 */
@@ -14,11 +14,11 @@ function useHeaderFilter(options = {}) {
14
14
  const isEnabled = vue.computed(() => {
15
15
  const hideHeaderFilter = getHideHeaderFilter();
16
16
  const headerFilterConfig = getHeaderFilterConfig();
17
- if (hideHeaderFilter === true) return false;
18
- if (typeof headerFilterConfig === "boolean") return headerFilterConfig;
19
17
  if (headerFilterConfig && typeof headerFilterConfig === "object") {
20
18
  return headerFilterConfig.enabled !== false;
21
19
  }
20
+ if (typeof headerFilterConfig === "boolean") return headerFilterConfig;
21
+ if (hideHeaderFilter === true) return false;
22
22
  return false;
23
23
  });
24
24
  const operatorCatalogState = vue.computed(() => {
@@ -129,21 +129,34 @@ function useHeaderFilter(options = {}) {
129
129
  }
130
130
  };
131
131
  const getMergedQuery = (baseQuery) => {
132
+ const normalizeFilters = (filters) => {
133
+ return filters.map((f) => {
134
+ if (f.op === "in" && typeof f.value === "string" && f.value) {
135
+ const arr = f.value.split(",").filter(Boolean).map((s) => {
136
+ const n = Number(s);
137
+ return Number.isNaN(n) ? s : n;
138
+ });
139
+ return { ...f, value: arr };
140
+ }
141
+ return f;
142
+ });
143
+ };
132
144
  let mergedFilters = baseQuery.filters;
133
145
  if (headerFiltersState.filters.length > 0) {
146
+ const normalized = normalizeFilters(headerFiltersState.filters);
134
147
  const baseFilters = baseQuery.filters;
135
148
  if (baseFilters && typeof baseFilters === "object" && Array.isArray(baseFilters.filters)) {
136
149
  mergedFilters = {
137
150
  logic: baseFilters.logic || "and",
138
151
  filters: [
139
152
  ...baseFilters.filters,
140
- ...headerFiltersState.filters
153
+ ...normalized
141
154
  ]
142
155
  };
143
156
  } else {
144
157
  mergedFilters = {
145
158
  logic: headerFiltersState.logic,
146
- filters: [...headerFiltersState.filters]
159
+ filters: [...normalized]
147
160
  };
148
161
  }
149
162
  }
@@ -38,7 +38,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
38
38
  collapseTags: { type: Boolean, default: false },
39
39
  maxCollapseTags: { default: 1 },
40
40
  initialOptions: { default: () => [] },
41
- allSelect: { type: Boolean, default: false }
41
+ allSelect: { type: Boolean, default: false },
42
+ popperClass: {}
42
43
  },
43
44
  emits: ["update:modelValue", "change"],
44
45
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -368,6 +369,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
368
369
  multiple: _ctx.multiple,
369
370
  "collapse-tags": _ctx.collapseTags,
370
371
  "max-collapse-tags": _ctx.maxCollapseTags,
372
+ "popper-class": _ctx.popperClass,
371
373
  onVisibleChange: handleVisibleChange,
372
374
  onChange: handleChange,
373
375
  onClear: handleClear,
@@ -392,7 +394,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
392
394
  ]),
393
395
  _: 1
394
396
  /* STABLE */
395
- }, 8, ["modelValue", "filterable", "remote", "reserve-keyword", "placeholder", "clearable", "disabled", "loading", "filter-method", "allow-create", "default-first-option", "multiple", "collapse-tags", "max-collapse-tags"])), [
397
+ }, 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"])), [
396
398
  [_directive_load_more, handleLoadMore]
397
399
  ]);
398
400
  };
@@ -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
  }
@@ -31,8 +31,16 @@ const useGetOptions = (props) => {
31
31
  const options = vue.ref([]);
32
32
  const optionsIsReady = vue.ref(false);
33
33
  const injectedDictStore = vue.inject(dict.DictStoreInjectionKey, null);
34
- const hasValidOptions = props.options && (!is.isArray(props.options) || props.options.length > 0);
35
- if (hasValidOptions) {
34
+ const hasValidOptions = () => {
35
+ const o = props.options;
36
+ if (!o) return false;
37
+ if (vue.isRef(o)) return true;
38
+ if (is.isPromise(o)) return true;
39
+ if (is.isFunction(o)) return true;
40
+ if (is.isArray(o)) return o.length > 0;
41
+ return false;
42
+ };
43
+ if (hasValidOptions()) {
36
44
  handleOptions();
37
45
  } else if (props.autoDict) {
38
46
  handleAutoDict();
@@ -40,28 +48,43 @@ const useGetOptions = (props) => {
40
48
  options.value = [];
41
49
  optionsIsReady.value = true;
42
50
  }
51
+ function getOptionsResolvedSnapshot() {
52
+ const o = props.options;
53
+ if (!o) return [];
54
+ if (is.isPromise(o)) return [];
55
+ if (vue.isRef(o)) {
56
+ const val = o.value;
57
+ return val || [];
58
+ }
59
+ if (is.isFunction(o)) {
60
+ const result = o(props);
61
+ if (is.isPromise(result)) return [];
62
+ return result || [];
63
+ }
64
+ if (is.isArray(o)) return o;
65
+ if (vue.isReactive(o)) {
66
+ return o || [];
67
+ }
68
+ return [];
69
+ }
43
70
  function handleOptions() {
44
71
  if (!props.options) {
45
72
  options.value = [];
46
73
  optionsIsReady.value = true;
47
74
  return;
48
75
  }
49
- if (vue.isRef(props.options) || vue.isReactive(props.options) || is.isArray(props.options)) {
50
- vue.watch(
51
- () => props.options,
52
- (val) => {
53
- const value = vue.isRef(val) ? val.value : val;
54
- options.value = getOptionsByOptionsMap(value, props);
55
- optionsIsReady.value = true;
56
- },
57
- {
58
- immediate: true,
59
- deep: true
60
- }
61
- );
62
- } else if (is.isFunction(props.options)) {
63
- const getValue = props.options;
64
- const result = getValue(props);
76
+ if (is.isPromise(props.options)) {
77
+ props.options.then((value) => {
78
+ options.value = getOptionsByOptionsMap(value, props);
79
+ optionsIsReady.value = true;
80
+ throwError(options.value);
81
+ }).catch((err) => {
82
+ throw err;
83
+ });
84
+ return;
85
+ }
86
+ if (is.isFunction(props.options)) {
87
+ const result = props.options(props);
65
88
  if (is.isPromise(result)) {
66
89
  result.then((value) => {
67
90
  options.value = getOptionsByOptionsMap(value, props);
@@ -70,23 +93,22 @@ const useGetOptions = (props) => {
70
93
  }).catch((err) => {
71
94
  throw err;
72
95
  });
73
- } else {
74
- options.value = getOptionsByOptionsMap(result, props);
75
- optionsIsReady.value = true;
96
+ return;
76
97
  }
77
- } else if (is.isPromise(props.options)) {
78
- const getValue = props.options;
79
- getValue.then((value) => {
80
- options.value = getOptionsByOptionsMap(value, props);
81
- optionsIsReady.value = true;
82
- throwError(options.value);
83
- }).catch((err) => {
84
- throw err;
85
- });
86
- } else {
87
- optionsIsReady.value = true;
88
- throwError(props.options);
89
98
  }
99
+ if (vue.isRef(props.options) || vue.isReactive(props.options) || is.isArray(props.options) || is.isFunction(props.options)) {
100
+ vue.watch(
101
+ () => getOptionsResolvedSnapshot(),
102
+ (val) => {
103
+ options.value = getOptionsByOptionsMap(val, props);
104
+ optionsIsReady.value = true;
105
+ },
106
+ { immediate: true, deep: true }
107
+ );
108
+ return;
109
+ }
110
+ optionsIsReady.value = true;
111
+ throwError(props.options);
90
112
  }
91
113
  function handleAutoDict() {
92
114
  if (is.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
  /**