yc-pro-components 0.0.56 → 0.0.58

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 (115) 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 +7 -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 +170 -98
  33. package/es/components/yc-plus-page/src/index.vue.d.ts +3 -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 +24 -6
  36. package/es/components/yc-plus-page/src/type.d.ts +12 -0
  37. package/es/components/yc-plus-page/src/use-header-filter.d.ts +2 -0
  38. package/es/components/yc-plus-page/src/use-header-filter.mjs +23 -5
  39. package/es/components/yc-select-v2/src/index.vue2.mjs +4 -2
  40. package/es/components/yc-select-v2/src/type.d.ts +2 -0
  41. package/es/hooks/useGetOptions.mjs +56 -34
  42. package/es/hooks/usePlusFormReset.d.ts +2 -1
  43. package/es/index.css +11 -10
  44. package/es/types/table.d.ts +2 -3
  45. package/index.css +15 -12
  46. package/index.js +488 -149
  47. package/index.min.css +3 -2
  48. package/index.min.js +11 -11
  49. package/index.min.mjs +11 -11
  50. package/index.mjs +488 -149
  51. package/lib/components/breadcrumb/index.d.ts +1 -1
  52. package/lib/components/breadcrumb/src/index.vue.d.ts +1 -1
  53. package/lib/components/check-card/index.d.ts +1 -1
  54. package/lib/components/check-card-group/index.d.ts +2 -1
  55. package/lib/components/check-card-group/src/index.vue.d.ts +1 -1
  56. package/lib/components/descriptions/index.d.ts +2 -1
  57. package/lib/components/dialog-form/index.d.ts +2 -1
  58. package/lib/components/display-item/index.d.ts +2 -1
  59. package/lib/components/drawer-form/index.d.ts +2 -1
  60. package/lib/components/form/index.d.ts +2 -1
  61. package/lib/components/form/src/form-content.vue.d.ts +2 -2
  62. package/lib/components/form-item/index.d.ts +2 -1
  63. package/lib/components/header/index.d.ts +1 -1
  64. package/lib/components/input-tag/index.d.ts +1 -1
  65. package/lib/components/layout/index.d.ts +2 -1
  66. package/lib/components/page/index.d.ts +2 -1
  67. package/lib/components/pagination/index.d.ts +1 -1
  68. package/lib/components/radio/index.d.ts +1 -1
  69. package/lib/components/render/index.d.ts +2 -1
  70. package/lib/components/search/index.d.ts +2 -1
  71. package/lib/components/sidebar/index.d.ts +1 -1
  72. package/lib/components/steps-form/index.d.ts +2 -1
  73. package/lib/components/table/index.d.ts +2 -1
  74. package/lib/components/virtual-table/index.d.ts +2 -1
  75. package/lib/components/yc-drawer/store.d.ts +1 -1
  76. package/lib/components/yc-plus-page/src/filter-strategies.d.ts +22 -0
  77. package/lib/components/yc-plus-page/src/filter-strategies.js +193 -0
  78. package/lib/components/yc-plus-page/src/filter-utils.d.ts +37 -0
  79. package/lib/components/yc-plus-page/src/filter-utils.js +36 -0
  80. package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +7 -0
  81. package/lib/components/yc-plus-page/src/header-filter-cell.vue.js +1 -1
  82. package/lib/components/yc-plus-page/src/header-filter-cell.vue2.js +168 -96
  83. package/lib/components/yc-plus-page/src/index.vue.d.ts +3 -1
  84. package/lib/components/yc-plus-page/src/index.vue.js +1 -1
  85. package/lib/components/yc-plus-page/src/index.vue2.js +24 -6
  86. package/lib/components/yc-plus-page/src/type.d.ts +12 -0
  87. package/lib/components/yc-plus-page/src/use-header-filter.d.ts +2 -0
  88. package/lib/components/yc-plus-page/src/use-header-filter.js +23 -5
  89. package/lib/components/yc-select-v2/src/index.vue2.js +4 -2
  90. package/lib/components/yc-select-v2/src/type.d.ts +2 -0
  91. package/lib/hooks/useGetOptions.js +55 -33
  92. package/lib/hooks/usePlusFormReset.d.ts +2 -1
  93. package/lib/index.css +12 -11
  94. package/lib/types/table.d.ts +2 -3
  95. package/locale/en.js +1 -1
  96. package/locale/en.min.js +1 -1
  97. package/locale/en.min.mjs +1 -1
  98. package/locale/en.mjs +1 -1
  99. package/locale/ja.js +1 -1
  100. package/locale/ja.min.js +1 -1
  101. package/locale/ja.min.mjs +1 -1
  102. package/locale/ja.mjs +1 -1
  103. package/locale/ko.js +1 -1
  104. package/locale/ko.min.js +1 -1
  105. package/locale/ko.min.mjs +1 -1
  106. package/locale/ko.mjs +1 -1
  107. package/locale/zh-cn.js +1 -1
  108. package/locale/zh-cn.min.js +1 -1
  109. package/locale/zh-cn.min.mjs +1 -1
  110. package/locale/zh-cn.mjs +1 -1
  111. package/locale/zh-tw.js +1 -1
  112. package/locale/zh-tw.min.js +1 -1
  113. package/locale/zh-tw.min.mjs +1 -1
  114. package/locale/zh-tw.mjs +1 -1
  115. package/package.json +1 -1
@@ -1,15 +1,17 @@
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';
1
+ import { defineComponent, computed, reactive, ref, watch, onMounted, onBeforeUnmount, openBlock, createElementBlock, withModifiers, createCommentVNode, createElementVNode, normalizeClass, normalizeStyle, createBlock, resolveDynamicComponent, Fragment, unref, withCtx, toDisplayString, createTextVNode, mergeProps, createVNode, renderList, h } from 'vue';
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,17 +21,19 @@ 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 = {
26
25
  class: "yc-header-filter-cell__actions",
27
26
  style: {
28
27
  display: "flex",
29
- justifyContent: "space-between",
30
- marginTop: "4px"
28
+ justifyContent: "flex-end"
31
29
  }
32
30
  };
31
+ const _hoisted_5 = {
32
+ key: 0,
33
+ class: "yc-header-filter-cell__operators"
34
+ };
35
+ const _hoisted_6 = ["onClick"];
36
+ const _hoisted_7 = { key: 0 };
33
37
  var _sfc_main = /* @__PURE__ */ defineComponent({
34
38
  ...{
35
39
  name: "YcTableHeaderFilterCell"
@@ -42,6 +46,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
42
46
  filters: { default: () => [] },
43
47
  orderBy: { default: () => [] },
44
48
  disableFilter: { type: Boolean, default: false },
49
+ hideSort: { 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) => {
@@ -210,9 +279,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
210
279
  gap: "4px",
211
280
  cursor: "default"
212
281
  },
213
- onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
282
+ onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {
214
283
  }, ["stop"])),
215
- onClick: _cache[2] || (_cache[2] = withModifiers(() => {
284
+ onClick: _cache[3] || (_cache[3] = withModifiers(() => {
216
285
  }, ["stop"]))
217
286
  },
218
287
  [
@@ -223,13 +292,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
223
292
  {
224
293
  class: normalizeClass(["yc-header-filter-cell__label", {
225
294
  "yc-header-filter-cell__label--ellipsis": shouldShowEllipsis.value,
226
- "yc-header-filter-cell__label--active": isAscActive.value || isDescActive.value || isActive.value
295
+ "yc-header-filter-cell__label--active": !_ctx.hideSort && (isAscActive.value || isDescActive.value) || isActive.value
227
296
  }]),
228
- style: {
297
+ style: normalizeStyle({
229
298
  userSelect: "none",
230
- cursor: "pointer"
231
- },
232
- onClick: withModifiers(cycleSort, ["stop"])
299
+ cursor: _ctx.hideSort ? "default" : "pointer"
300
+ }),
301
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => !_ctx.hideSort && cycleSort(), ["stop"]))
233
302
  },
234
303
  [
235
304
  _ctx.referenceRenderer ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.referenceRenderer), { key: 0 })) : (openBlock(), createElementBlock(
@@ -288,8 +357,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
288
357
  /* STABLE_FRAGMENT */
289
358
  ))
290
359
  ],
291
- 2
292
- /* CLASS */
360
+ 6
361
+ /* CLASS, STYLE */
293
362
  ),
294
363
  createCommentVNode(" tooltip \u56FE\u6807\uFF08\u95EE\u53F7\uFF09- \u4EC5\u5728\u672A\u4F7F\u7528\u81EA\u5B9A\u4E49\u6E32\u67D3\u65F6\u663E\u793A "),
295
364
  columnTooltip.value && !_ctx.referenceRenderer ? (openBlock(), createBlock(
@@ -318,8 +387,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
318
387
  16
319
388
  /* FULL_PROPS */
320
389
  )) : createCommentVNode("v-if", true),
321
- createCommentVNode(" \u6392\u5E8F\u56FE\u6807 "),
322
- createElementVNode("span", {
390
+ createCommentVNode(" \u6392\u5E8F\u56FE\u6807\uFF0C\u5F53 hideSort \u4E3A true \u65F6\u9690\u85CF "),
391
+ !_ctx.hideSort ? (openBlock(), createElementBlock("span", {
392
+ key: 1,
323
393
  class: "yc-header-filter-cell__sort",
324
394
  style: {
325
395
  display: "inline-flex",
@@ -352,20 +422,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
352
422
  _: 1
353
423
  /* STABLE */
354
424
  }, 8, ["style"])
355
- ]),
425
+ ])) : createCommentVNode("v-if", true),
356
426
  createCommentVNode(" \u7B5B\u9009\u56FE\u6807\u548C\u5F39\u7A97 "),
357
427
  !_ctx.disableFilter ? (openBlock(), createBlock(unref(ElPopover), {
358
- key: 1,
428
+ key: 2,
429
+ visible: popVisible.value,
359
430
  trigger: "click",
360
431
  placement: "bottom-start",
361
- width: 220,
362
- visible: popVisible.value,
363
- "onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popVisible.value = $event),
432
+ width: popoverWidth.value,
364
433
  "popper-class": "yc-header-filter-pop",
365
434
  "popper-style": { zIndex: 4e3 }
366
435
  }, {
367
436
  reference: withCtx(() => [
368
- createElementVNode("span", _hoisted_3, [
437
+ createElementVNode("span", {
438
+ style: { cursor: "pointer", display: "inline-flex", alignItems: "center" },
439
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
440
+ }, [
369
441
  createVNode(unref(YcSvgIcon), {
370
442
  src: filterIconUrl.value,
371
443
  size: 14,
@@ -375,9 +447,29 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
375
447
  ])
376
448
  ]),
377
449
  default: withCtx(() => [
378
- createElementVNode("div", _hoisted_4, [
379
- createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
380
- createElementVNode("div", _hoisted_5, [
450
+ createElementVNode("div", _hoisted_3, [
451
+ createCommentVNode(" \u64CD\u4F5C\u6309\u94AE\uFF08\u7F6E\u9876\u53F3\u4FA7\uFF0C\u907F\u514D\u4E0B\u62C9\u9009\u62E9\u5668\u906E\u6321\uFF09 "),
452
+ createElementVNode("div", _hoisted_4, [
453
+ createVNode(unref(ElButton), { onClick: handleReset }, {
454
+ default: withCtx(() => [
455
+ createTextVNode("\u91CD\u7F6E")
456
+ ]),
457
+ _: 1
458
+ /* STABLE */
459
+ }),
460
+ createVNode(unref(ElButton), {
461
+ type: "primary",
462
+ onClick: handleConfirm
463
+ }, {
464
+ default: withCtx(() => [
465
+ createTextVNode("\u786E\u5B9A")
466
+ ]),
467
+ _: 1
468
+ /* STABLE */
469
+ })
470
+ ]),
471
+ createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868\uFF08\u591A\u9009/\u65E5\u671F\u533A\u95F4\u7B49\u7531 hideOperatorList \u9690\u85CF\uFF0C\u9ED8\u8BA4 in / between\uFF09 "),
472
+ !hideOperatorList.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
381
473
  (openBlock(true), createElementBlock(
382
474
  Fragment,
383
475
  null,
@@ -410,34 +502,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
410
502
  128
411
503
  /* KEYED_FRAGMENT */
412
504
  ))
413
- ]),
505
+ ])) : createCommentVNode("v-if", true),
414
506
  createCommentVNode(" \u503C\u8F93\u5165 "),
415
- needValueInput.value ? (openBlock(), createBlock(resolveDynamicComponent(renderValueField), { key: 0 })) : createCommentVNode("v-if", true),
416
- createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
417
- createElementVNode("div", _hoisted_8, [
418
- createVNode(unref(ElButton), { onClick: handleReset }, {
419
- default: withCtx(() => [
420
- createTextVNode("\u91CD\u7F6E")
421
- ]),
422
- _: 1
423
- /* STABLE */
424
- }),
425
- createVNode(unref(ElButton), {
426
- type: "primary",
427
- onClick: handleConfirm
428
- }, {
429
- default: withCtx(() => [
430
- createTextVNode("\u786E\u5B9A")
431
- ]),
432
- _: 1
433
- /* STABLE */
434
- })
435
- ])
507
+ needValueInput.value ? (openBlock(), createBlock(resolveDynamicComponent(renderValueField), { key: 1 })) : createCommentVNode("v-if", true)
436
508
  ])
437
509
  ]),
438
510
  _: 1
439
511
  /* STABLE */
440
- }, 8, ["visible"])) : createCommentVNode("v-if", true)
512
+ }, 8, ["visible", "width"])) : createCommentVNode("v-if", true)
441
513
  ],
442
514
  544
443
515
  /* 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';
@@ -8000,6 +8001,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
8000
8001
  upsertHeaderFilter: (field: string, op: string, value?: string | undefined) => void;
8001
8002
  removeHeaderFilter: (field: string) => void;
8002
8003
  setOrderBy: (field: string, direction?: "desc" | "asc" | undefined) => void;
8004
+ resetAllHeaderFilters: () => void;
8003
8005
  getList: () => Promise<void> | undefined;
8004
8006
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
8005
8007
  "header-filter-confirm": (payload: HeaderFilterPayload) => void;
@@ -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-8c4a287b"], ["__file", "index.vue"]]);
5
5
 
6
6
  export { YcPlusPageComponent as default };
@@ -78,7 +78,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
78
78
  getOpsByProp,
79
79
  getMergedQuery,
80
80
  updateCatalogs,
81
- isFieldFilterable
81
+ isFieldFilterable,
82
+ resetAllHeaderFilters
82
83
  // isFieldVisible 已在 enhancedColumns 中直接使用 fieldCatalogState 实现
83
84
  } = useHeaderFilter({
84
85
  headerFilterConfig: () => props.headerFilter,
@@ -123,17 +124,27 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
123
124
  );
124
125
  return (fieldConfig == null ? void 0 : fieldConfig.nullable) !== false;
125
126
  }) : cols;
126
- if (!isEnabled) return visibleCols;
127
+ if (!isEnabled) {
128
+ return visibleCols;
129
+ }
127
130
  return visibleCols.map((col) => {
131
+ var _a, _b;
128
132
  const colHideFilter = col.hideHeaderFilter === true;
129
- const fieldFilterable = isFieldFilterable(col.prop);
130
- if (colHideFilter || !fieldFilterable) {
133
+ const hasExplicitHeaderFilter = col.headerFilter && typeof col.headerFilter === "object" || col.headerFilter === true;
134
+ const fieldFilterable = hasExplicitHeaderFilter || isFieldFilterable(col.prop);
135
+ if (colHideFilter) {
136
+ return col;
137
+ }
138
+ if (!hasExplicitHeaderFilter && !fieldFilterable) {
131
139
  return col;
132
140
  }
133
141
  const operators = getOpsByProp(col.prop);
142
+ const colHeaderFilter = col.headerFilter && typeof col.headerFilter === "object" ? col.headerFilter : {};
143
+ const globalHeaderFilter = props.headerFilter && typeof props.headerFilter === "object" ? props.headerFilter : {};
144
+ const columnHideSort = (_b = (_a = colHeaderFilter.hideSort) != null ? _a : globalHeaderFilter.hideSort) != null ? _b : false;
134
145
  const FILTER_ICON_WIDTH = 24;
135
146
  const SORT_ICON_WIDTH = 16;
136
- const EXTRA_WIDTH = FILTER_ICON_WIDTH + SORT_ICON_WIDTH;
147
+ const EXTRA_WIDTH = FILTER_ICON_WIDTH + (columnHideSort ? 0 : SORT_ICON_WIDTH);
137
148
  const originalWidth = col.width || col.minWidth;
138
149
  let adjustedWidth = originalWidth;
139
150
  if (typeof originalWidth === "number") {
@@ -141,9 +152,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
141
152
  } else if (typeof originalWidth === "string") {
142
153
  const numWidth = parseInt(originalWidth, 10);
143
154
  if (!isNaN(numWidth)) {
144
- adjustedWidth = numWidth + EXTRA_WIDTH;
155
+ adjustedWidth = String(numWidth + EXTRA_WIDTH);
145
156
  }
146
157
  }
158
+ const propStr = String(col.prop || "");
159
+ const fieldConfig = catalog ? Object.values(catalog).find(
160
+ (val) => String((val == null ? void 0 : val.allowedField) || "") === propStr
161
+ ) : void 0;
147
162
  const userRenderHeader = col.renderHeader;
148
163
  return {
149
164
  ...col,
@@ -156,9 +171,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
156
171
  operators,
157
172
  filters: headerFiltersState.filters,
158
173
  orderBy: orderByState,
174
+ hideSort: columnHideSort,
159
175
  onConfirm: handleFilterConfirm,
160
176
  onReset: handleFilterReset,
161
177
  onSortChange: handleSortChange,
178
+ fieldConfig,
162
179
  // 如果用户定义了 renderHeader,传递给 referenceRenderer
163
180
  ...userRenderHeader && typeof userRenderHeader === "function" ? { referenceRenderer: () => userRenderHeader(label, col) } : {}
164
181
  });
@@ -446,6 +463,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
446
463
  upsertHeaderFilter,
447
464
  removeHeaderFilter,
448
465
  setOrderBy,
466
+ resetAllHeaderFilters,
449
467
  getList: () => {
450
468
  var _a, _b;
451
469
  return (_b = (_a = plusPageRef.value) == null ? void 0 : _a.getList) == null ? void 0 : _b.call(_a);
@@ -63,17 +63,29 @@ export interface HeaderFilterConfig {
63
63
  field: string;
64
64
  direction: 'asc' | 'desc';
65
65
  }>;
66
+ /** 是否隐藏所有列的排序图标(全局配置),默认 false。列级 headerFilter.hideSort 优先 */
67
+ hideSort?: boolean;
66
68
  }
67
69
  /**
68
70
  * 列级别的表头筛选配置
69
71
  */
70
72
  export interface ColumnHeaderFilterConfig {
73
+ /** 筛选交互组件类型,若未配置则根据 column.valueType 自动推断 */
74
+ type?: 'input' | 'select' | 'date-picker' | 'time-picker' | 'time-select' | 'cascader' | 'tree-select' | 'checkbox';
75
+ /** 极度自定义的渲染函数接管(如自定义业务弹窗或滑动条等),通过回调更新组件抛出的 filter 值 */
76
+ renderField?: <T = any>(value: T, onChange: (val: T) => void) => any;
77
+ /** 传递给筛选渲染组件的 props,例如 { multiple: true } */
78
+ props?: Record<string, unknown>;
79
+ /** 如果想独立设置筛选组件的 options 数据源,支持传入数组或 Promise。未设置则回退取 column.options 或 autoDict */
80
+ options?: any[] | Promise<any[]> | ((column: any) => any[]);
71
81
  /** 自定义操作符列表 */
72
82
  operators?: OperatorOption[];
73
83
  /** 确认回调 */
74
84
  onConfirm?: (payload: HeaderFilterPayload) => void;
75
85
  /** 重置回调 */
76
86
  onReset?: (payload: HeaderFilterResetPayload) => void;
87
+ /** 是否隐藏该列的排序图标,默认 false。优先级高于全局 HeaderFilterConfig.hideSort */
88
+ hideSort?: boolean;
77
89
  }
78
90
  /**
79
91
  * 表头筛选确认事件 payload
@@ -48,6 +48,8 @@ export interface UseHeaderFilterReturn {
48
48
  isFieldFilterable: (prop?: string) => boolean;
49
49
  /** 判断字段是否允许显示(基于 fieldCatalog 的 nullable 属性) */
50
50
  isFieldVisible: (prop?: string) => boolean;
51
+ /** 重置所有筛选条件和排序状态 */
52
+ resetAllHeaderFilters: () => void;
51
53
  }
52
54
  /**
53
55
  * 表头筛选 Hook
@@ -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(() => {
@@ -126,22 +126,39 @@ function useHeaderFilter(options = {}) {
126
126
  orderByState.push(next);
127
127
  }
128
128
  };
129
+ const resetAllHeaderFilters = () => {
130
+ headerFiltersState.filters.splice(0);
131
+ orderByState.splice(0);
132
+ };
129
133
  const getMergedQuery = (baseQuery) => {
134
+ const normalizeFilters = (filters) => {
135
+ return filters.map((f) => {
136
+ if (f.op === "in" && typeof f.value === "string" && f.value) {
137
+ const arr = f.value.split(",").filter(Boolean).map((s) => {
138
+ const n = Number(s);
139
+ return Number.isNaN(n) ? s : n;
140
+ });
141
+ return { ...f, value: arr };
142
+ }
143
+ return f;
144
+ });
145
+ };
130
146
  let mergedFilters = baseQuery.filters;
131
147
  if (headerFiltersState.filters.length > 0) {
148
+ const normalized = normalizeFilters(headerFiltersState.filters);
132
149
  const baseFilters = baseQuery.filters;
133
150
  if (baseFilters && typeof baseFilters === "object" && Array.isArray(baseFilters.filters)) {
134
151
  mergedFilters = {
135
152
  logic: baseFilters.logic || "and",
136
153
  filters: [
137
154
  ...baseFilters.filters,
138
- ...headerFiltersState.filters
155
+ ...normalized
139
156
  ]
140
157
  };
141
158
  } else {
142
159
  mergedFilters = {
143
160
  logic: headerFiltersState.logic,
144
- filters: [...headerFiltersState.filters]
161
+ filters: [...normalized]
145
162
  };
146
163
  }
147
164
  }
@@ -165,7 +182,8 @@ function useHeaderFilter(options = {}) {
165
182
  getMergedQuery,
166
183
  updateCatalogs,
167
184
  isFieldFilterable,
168
- isFieldVisible
185
+ isFieldVisible,
186
+ resetAllHeaderFilters
169
187
  };
170
188
  }
171
189
 
@@ -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
  }