@qin-ui/antd-vue-pro 2.3.4 → 2.4.1

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 (164) hide show
  1. package/README.md +7 -5
  2. package/api.json +1 -25
  3. package/es/__tests__/BaseField.spec.d.ts +2 -0
  4. package/es/__tests__/BaseField.spec.d.ts.map +1 -0
  5. package/es/__tests__/BaseFormItem.spec.d.ts +2 -0
  6. package/es/__tests__/BaseFormItem.spec.d.ts.map +1 -0
  7. package/es/__tests__/ProForm.spec.d.ts +2 -0
  8. package/es/__tests__/ProForm.spec.d.ts.map +1 -0
  9. package/es/__tests__/ProTable.spec.d.ts +2 -0
  10. package/es/__tests__/ProTable.spec.d.ts.map +1 -0
  11. package/es/__tests__/SearchForm.spec.d.ts +2 -0
  12. package/es/__tests__/SearchForm.spec.d.ts.map +1 -0
  13. package/es/__tests__/controls.spec.d.ts +2 -0
  14. package/es/__tests__/controls.spec.d.ts.map +1 -0
  15. package/es/__tests__/cross-package.spec.d.ts +2 -0
  16. package/es/__tests__/cross-package.spec.d.ts.map +1 -0
  17. package/es/__tests__/helpers/fixtures.d.ts +15 -0
  18. package/es/__tests__/helpers/fixtures.d.ts.map +1 -0
  19. package/es/__tests__/helpers/mount.d.ts +38 -0
  20. package/es/__tests__/helpers/mount.d.ts.map +1 -0
  21. package/es/__tests__/hooks-locale.spec.d.ts +2 -0
  22. package/es/__tests__/hooks-locale.spec.d.ts.map +1 -0
  23. package/es/__tests__/index.spec.d.ts +2 -0
  24. package/es/__tests__/index.spec.d.ts.map +1 -0
  25. package/es/__tests__/integration.spec.d.ts +2 -0
  26. package/es/__tests__/integration.spec.d.ts.map +1 -0
  27. package/es/__tests__/setup.d.ts +14 -0
  28. package/es/__tests__/setup.d.ts.map +1 -0
  29. package/es/antd-vue-pro.css +13 -13
  30. package/es/index.js +369 -362
  31. package/es/index.js.map +1 -1
  32. package/es/{components → src/components}/component-provider/components/index.vue.d.ts +5 -1
  33. package/es/src/components/component-provider/components/index.vue.d.ts.map +1 -0
  34. package/es/{components → src/components}/component-provider/constants/index.d.ts +2 -2
  35. package/es/src/components/component-provider/constants/index.d.ts.map +1 -0
  36. package/es/src/components/component-provider/index.d.ts.map +1 -0
  37. package/es/src/components/component-provider/types/index.d.ts.map +1 -0
  38. package/es/{components → src/components}/form/components/BaseField/index.vue.d.ts +4 -1
  39. package/es/src/components/form/components/BaseField/index.vue.d.ts.map +1 -0
  40. package/es/src/components/form/components/BaseField/utils/index.d.ts +6 -0
  41. package/es/src/components/form/components/BaseField/utils/index.d.ts.map +1 -0
  42. package/es/{components → src/components}/form/components/BaseFormItem/index.vue.d.ts +5 -1
  43. package/es/src/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -0
  44. package/es/{components → src/components}/form/components/ContainerFragment/index.vue.d.ts +3 -1
  45. package/es/src/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -0
  46. package/es/src/components/form/components/ProForm/index.vue.d.ts.map +1 -0
  47. package/es/src/components/form/components/SlotComponent/index.vue.d.ts +11 -0
  48. package/es/src/components/form/components/SlotComponent/index.vue.d.ts.map +1 -0
  49. package/es/src/components/form/components/index.d.ts.map +1 -0
  50. package/es/src/components/form/constants/index.d.ts.map +1 -0
  51. package/es/src/components/form/hooks/index.d.ts.map +1 -0
  52. package/es/src/components/form/hooks/useFields.d.ts.map +1 -0
  53. package/es/src/components/form/hooks/useForm.d.ts.map +1 -0
  54. package/es/src/components/form/hooks/useFormRef.d.ts.map +1 -0
  55. package/es/{components → src/components}/form/hooks/useGroupFieldAttrs.d.ts +4 -0
  56. package/es/src/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -0
  57. package/es/src/components/form/index.d.ts.map +1 -0
  58. package/es/{components → src/components}/form/types/index.d.ts +26 -2
  59. package/es/src/components/form/types/index.d.ts.map +1 -0
  60. package/es/{components → src/components}/table/components/ColumnControl.vue.d.ts +4 -1
  61. package/es/src/components/table/components/ColumnControl.vue.d.ts.map +1 -0
  62. package/es/src/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -0
  63. package/es/src/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -0
  64. package/es/{components → src/components}/table/components/ProTable.vue.d.ts +4 -3
  65. package/es/src/components/table/components/ProTable.vue.d.ts.map +1 -0
  66. package/es/{components → src/components}/table/components/SearchForm.vue.d.ts +14 -4
  67. package/es/src/components/table/components/SearchForm.vue.d.ts.map +1 -0
  68. package/es/src/components/table/components/SizeControl.vue.d.ts.map +1 -0
  69. package/es/src/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +1 -0
  70. package/es/src/components/table/components/icons/DownOutlined.vue.d.ts.map +1 -0
  71. package/es/src/components/table/components/icons/FilterOutlined.vue.d.ts.map +1 -0
  72. package/es/src/components/table/components/index.d.ts.map +1 -0
  73. package/es/src/components/table/hooks/index.d.ts.map +1 -0
  74. package/es/src/components/table/hooks/useTable.d.ts.map +1 -0
  75. package/es/src/components/table/index.d.ts.map +1 -0
  76. package/es/{components → src/components}/table/types/index.d.ts +1 -1
  77. package/es/src/components/table/types/index.d.ts.map +1 -0
  78. package/es/{index.d.ts → src/index.d.ts} +1 -1
  79. package/es/src/index.d.ts.map +1 -0
  80. package/es/{locale → src/locale}/index.d.ts +1 -1
  81. package/es/src/locale/index.d.ts.map +1 -0
  82. package/es/src/shared/core/index.d.ts +6 -0
  83. package/es/src/shared/core/index.d.ts.map +1 -0
  84. package/es/src/shared/ui/index.d.ts.map +1 -0
  85. package/package.json +8 -3
  86. package/src/components/component-provider/components/index.vue +41 -11
  87. package/src/components/component-provider/constants/index.ts +6 -4
  88. package/src/components/form/components/BaseField/index.vue +61 -37
  89. package/src/components/form/components/BaseField/utils/index.ts +17 -11
  90. package/src/components/form/components/BaseFormItem/index.vue +47 -33
  91. package/src/components/form/components/ContainerFragment/index.vue +4 -2
  92. package/src/components/form/components/ProForm/index.vue +72 -20
  93. package/src/components/form/components/SlotComponent/index.vue +6 -4
  94. package/src/components/form/hooks/useGroupFieldAttrs.ts +16 -4
  95. package/src/components/form/types/index.ts +26 -2
  96. package/src/components/table/components/ColumnControl.vue +17 -22
  97. package/src/components/table/components/ProTable.vue +129 -83
  98. package/src/components/table/components/SearchForm.vue +45 -198
  99. package/src/components/table/components/SizeControl.vue +4 -2
  100. package/src/components/table/types/index.ts +1 -1
  101. package/src/index.ts +1 -1
  102. package/src/locale/index.ts +1 -1
  103. package/src/shared/core/index.ts +15 -1
  104. package/es/components/component-provider/components/index.vue.d.ts.map +0 -1
  105. package/es/components/component-provider/constants/index.d.ts.map +0 -1
  106. package/es/components/component-provider/index.d.ts.map +0 -1
  107. package/es/components/component-provider/types/index.d.ts.map +0 -1
  108. package/es/components/form/components/BaseField/index.vue.d.ts.map +0 -1
  109. package/es/components/form/components/BaseField/utils/index.d.ts +0 -5
  110. package/es/components/form/components/BaseField/utils/index.d.ts.map +0 -1
  111. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +0 -1
  112. package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +0 -1
  113. package/es/components/form/components/ProForm/index.vue.d.ts.map +0 -1
  114. package/es/components/form/components/SlotComponent/index.vue.d.ts +0 -7
  115. package/es/components/form/components/SlotComponent/index.vue.d.ts.map +0 -1
  116. package/es/components/form/components/index.d.ts.map +0 -1
  117. package/es/components/form/constants/index.d.ts.map +0 -1
  118. package/es/components/form/hooks/index.d.ts.map +0 -1
  119. package/es/components/form/hooks/useFields.d.ts.map +0 -1
  120. package/es/components/form/hooks/useForm.d.ts.map +0 -1
  121. package/es/components/form/hooks/useFormRef.d.ts.map +0 -1
  122. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +0 -1
  123. package/es/components/form/index.d.ts.map +0 -1
  124. package/es/components/form/types/index.d.ts.map +0 -1
  125. package/es/components/table/components/ColumnControl.vue.d.ts.map +0 -1
  126. package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +0 -1
  127. package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +0 -1
  128. package/es/components/table/components/ProTable.vue.d.ts.map +0 -1
  129. package/es/components/table/components/SearchForm.vue.d.ts.map +0 -1
  130. package/es/components/table/components/SizeControl.vue.d.ts.map +0 -1
  131. package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +0 -1
  132. package/es/components/table/components/icons/DownOutlined.vue.d.ts.map +0 -1
  133. package/es/components/table/components/icons/FilterOutlined.vue.d.ts.map +0 -1
  134. package/es/components/table/components/index.d.ts.map +0 -1
  135. package/es/components/table/hooks/index.d.ts.map +0 -1
  136. package/es/components/table/hooks/useTable.d.ts.map +0 -1
  137. package/es/components/table/index.d.ts.map +0 -1
  138. package/es/components/table/types/index.d.ts.map +0 -1
  139. package/es/index.d.ts.map +0 -1
  140. package/es/locale/index.d.ts.map +0 -1
  141. package/es/shared/core/index.d.ts +0 -6
  142. package/es/shared/core/index.d.ts.map +0 -1
  143. package/es/shared/ui/index.d.ts.map +0 -1
  144. /package/es/{components → src/components}/component-provider/index.d.ts +0 -0
  145. /package/es/{components → src/components}/component-provider/types/index.d.ts +0 -0
  146. /package/es/{components → src/components}/form/components/ProForm/index.vue.d.ts +0 -0
  147. /package/es/{components → src/components}/form/components/index.d.ts +0 -0
  148. /package/es/{components → src/components}/form/constants/index.d.ts +0 -0
  149. /package/es/{components → src/components}/form/hooks/index.d.ts +0 -0
  150. /package/es/{components → src/components}/form/hooks/useFields.d.ts +0 -0
  151. /package/es/{components → src/components}/form/hooks/useForm.d.ts +0 -0
  152. /package/es/{components → src/components}/form/hooks/useFormRef.d.ts +0 -0
  153. /package/es/{components → src/components}/form/index.d.ts +0 -0
  154. /package/es/{components → src/components}/table/components/DefaultSearchFormContainer.vue.d.ts +0 -0
  155. /package/es/{components → src/components}/table/components/DefaultTableContainer.vue.d.ts +0 -0
  156. /package/es/{components → src/components}/table/components/SizeControl.vue.d.ts +0 -0
  157. /package/es/{components → src/components}/table/components/icons/ColumnHeightOutlined.vue.d.ts +0 -0
  158. /package/es/{components → src/components}/table/components/icons/DownOutlined.vue.d.ts +0 -0
  159. /package/es/{components → src/components}/table/components/icons/FilterOutlined.vue.d.ts +0 -0
  160. /package/es/{components → src/components}/table/components/index.d.ts +0 -0
  161. /package/es/{components → src/components}/table/hooks/index.d.ts +0 -0
  162. /package/es/{components → src/components}/table/hooks/useTable.d.ts +0 -0
  163. /package/es/{components → src/components}/table/index.d.ts +0 -0
  164. /package/es/{shared → src/shared}/ui/index.d.ts +0 -0
package/es/index.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import "./antd-vue-pro.css";
2
- import { inject, computed, mergeProps, toValue, defineComponent, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, ref, useAttrs, createCommentVNode, resolveDynamicComponent, renderSlot, normalizeProps, isVNode, createTextVNode, toDisplayString, provide, useSlots, reactive, createElementVNode, onBeforeUnmount, watch, watchEffect, normalizeStyle, nextTick, useModel, onMounted, mergeModels, normalizeClass, guardReactiveProps } from "vue";
2
+ import { inject, computed, toValue, mergeProps, defineComponent, resolveComponent, createBlock, openBlock, unref, withCtx, createElementBlock, Fragment, renderList, createVNode, createSlots, toRaw, ref, useAttrs, createCommentVNode, resolveDynamicComponent, renderSlot, normalizeProps, isVNode, createTextVNode, toDisplayString, provide, useSlots, createElementVNode, normalizeStyle, useModel, watch, mergeModels, onMounted, normalizeClass, guardReactiveProps, nextTick } from "vue";
3
3
  import { Transfer, TreeSelect, Slider, Switch, RadioGroup, CheckboxGroup, TimePicker, RangePicker, DatePicker, Cascader, Select, InputNumber, InputPassword, InputSearch, Textarea, Input, Row, Col, FormItem, Form, Space, Button, theme, Dropdown, Menu, MenuItem, Checkbox, MenuDivider, Table } from "ant-design-vue";
4
- import { isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, omit, InjectionFormSlotsKey, cloneDeep, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, pick, useTable as useTable$1 } from "@qin-ui/pro-components-core";
4
+ import { isPlainObject, getObject, toPath, useForm as useForm$1, resolveLocaleName, zhTW, enUS, zhCN, format, cloneDeep, InjectionFormSlotsKey, createFormProxy, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, pick, isPromise, useTable as useTable$1 } from "@qin-ui/pro-components-core";
5
5
  import { enUS as enUS2, useFormData, zhCN as zhCN2, zhTW as zhTW2 } from "@qin-ui/pro-components-core";
6
6
  import { colProps } from "ant-design-vue/es/grid/Col";
7
7
  import { formItemProps, useInjectFormItemContext } from "ant-design-vue/es/form";
8
8
  import { useConfigContextInject } from "ant-design-vue/es/config-provider/context";
9
9
  import { useProviderDisabled, useInjectDisabled } from "ant-design-vue/es/config-provider/DisabledContext";
10
10
  import { tableProps } from "ant-design-vue/es/table";
11
- const getPopupContainer = (triggerNode) => triggerNode.closest("form[class*='-form']");
11
+ const getPopupContainer = (triggerNode) => {
12
+ var _a;
13
+ return ((_a = triggerNode.closest) == null ? void 0 : _a.call(triggerNode, "form[class*='-form']")) || (typeof document !== "undefined" ? document.body : void 0);
14
+ };
12
15
  const INJECT_COMPONENTS = Symbol("INJECT_COMPONENTS");
13
16
  const INJECT_CONFIG = {
14
17
  "pro-table": {
@@ -61,7 +64,7 @@ const INJECT_CONFIG = {
61
64
  injectionKey: Symbol(""),
62
65
  default: {
63
66
  max: 10 ** 15 - 1,
64
- min: -1000000000000001,
67
+ min: -999999999999999,
65
68
  controls: false,
66
69
  style: { width: "100%" }
67
70
  }
@@ -173,10 +176,13 @@ const formItemPropKeys = Object.keys(formItemProps()).concat([
173
176
  "formItemContainer"
174
177
  ]);
175
178
  const gridItemPropKeys = Object.keys(colProps());
179
+ const gridItemPropKeySet = new Set(gridItemPropKeys);
180
+ const formItemPropKeySet = new Set(formItemPropKeys);
176
181
  function useGroupFieldAttrs(validFields) {
177
182
  const config = INJECT_CONFIG["pro-form-item"];
178
183
  const injectFormItemProps = inject(config.injectionKey, config.default);
179
184
  return computed(() => {
185
+ const rawInject = toValue(injectFormItemProps) || {};
180
186
  return validFields.value.map((field) => {
181
187
  let gridItemProps2 = {};
182
188
  let formItemProps2 = {};
@@ -194,10 +200,12 @@ function useGroupFieldAttrs(validFields) {
194
200
  lg,
195
201
  xl,
196
202
  xxl,
203
+ formItemContainer: injectFormItemContainer,
197
204
  ...injectRest
198
- } = injectFormItemProps;
205
+ } = rawInject;
199
206
  const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, xxl, span: injectSpan };
200
207
  gridItemProps2 = fields ? { span: span ?? 24 } : initGridItemProps;
208
+ const container = formItemContainer ?? injectFormItemContainer;
201
209
  formItemProps2 = mergeProps(
202
210
  injectRest,
203
211
  { class: injectClassName, style: injectStyle },
@@ -205,9 +213,9 @@ function useGroupFieldAttrs(validFields) {
205
213
  formItemDataAttrs
206
214
  );
207
215
  Object.keys(rest).forEach((k) => {
208
- if (gridItemPropKeys.includes(k)) {
216
+ if (gridItemPropKeySet.has(k)) {
209
217
  gridItemProps2[k] = rest[k];
210
- } else if (formItemPropKeys.includes(k)) {
218
+ } else if (formItemPropKeySet.has(k)) {
211
219
  formItemProps2[k] = rest[k];
212
220
  } else {
213
221
  componentProps[k] = rest[k];
@@ -228,7 +236,7 @@ function useGroupFieldAttrs(validFields) {
228
236
  formItemProps: formItemProps2,
229
237
  formItemSlots,
230
238
  componentProps,
231
- formItemContainer,
239
+ formItemContainer: container,
232
240
  rawField: field
233
241
  };
234
242
  }
@@ -248,46 +256,61 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
248
256
  ...{ name: "BaseFormItem", inheritAttrs: false },
249
257
  __name: "index",
250
258
  props: {
251
- grid: { type: [Boolean, Object], default: () => void 0 },
259
+ grid: { type: [Boolean, Object], default: void 0 },
252
260
  fields: { default: () => [] },
253
- disabled: { type: Boolean, default: () => void 0 }
261
+ disabled: { type: Boolean, default: void 0 }
254
262
  },
255
263
  setup(__props) {
256
- const validFields = computed(() => {
257
- var _a, _b;
258
- return (_b = (_a = __props.fields).filter) == null ? void 0 : _b.call(_a, (field) => !field.hidden);
259
- });
260
- useProviderDisabled(computed(() => __props.disabled));
264
+ const props = __props;
265
+ const validFields = computed(
266
+ () => (
267
+ // hidden 支持 Ref/ComputedRef/getter 等响应式形态(统一使用 toValue 取值)
268
+ (props.fields ?? []).filter((field) => !toValue(field.hidden))
269
+ )
270
+ );
271
+ useProviderDisabled(computed(() => props.disabled));
261
272
  const config = INJECT_CONFIG["pro-form"];
262
- const { grid: injectGrid } = inject(config.injectionKey, config.default);
273
+ const injectFormConfig = inject(config.injectionKey, config.default);
274
+ const injectGrid = computed(() => {
275
+ var _a;
276
+ return (_a = toValue(injectFormConfig)) == null ? void 0 : _a.grid;
277
+ });
263
278
  const enableGrid = computed(() => {
264
- if (__props.grid !== void 0) return !!__props.grid;
265
- return !!injectGrid;
279
+ if (props.grid !== void 0) return !!props.grid;
280
+ return !!injectGrid.value;
266
281
  });
267
282
  const computedGridProps = computed(() => {
268
- return enableGrid.value ? { ...getObject(injectGrid), ...getObject(__props.grid) } : {};
283
+ return enableGrid.value ? { ...getObject(injectGrid.value), ...getObject(props.grid) } : {};
269
284
  });
270
- const formItemRefs = [];
271
- const componentRefs = [];
272
- const onFormItemMounted = (index2, formItemProps2) => {
273
- const field = validFields.value[index2];
274
- Object.assign(field, {
275
- getFormItemRef: () => formItemRefs[index2],
276
- getFormItemComputedProps: () => formItemProps2
277
- });
285
+ const formItemInstanceMap = /* @__PURE__ */ new WeakMap();
286
+ const componentInstanceMap = /* @__PURE__ */ new WeakMap();
287
+ const setFormItemRef = (field, el, formItemProps2) => {
288
+ if (!field || typeof field !== "object") return;
289
+ const raw = toRaw(field);
290
+ if (el) {
291
+ formItemInstanceMap.set(raw, el);
292
+ raw.getFormItemRef = () => formItemInstanceMap.get(raw);
293
+ raw.getFormItemComputedProps = () => formItemProps2;
294
+ } else {
295
+ formItemInstanceMap.delete(raw);
296
+ }
278
297
  };
279
- const onComponentMounted = (index2) => {
280
- const field = validFields.value[index2];
281
- Object.assign(field, {
282
- getComponentRef: () => {
298
+ const setComponentRef = (field, el) => {
299
+ if (!field || typeof field !== "object") return;
300
+ const raw = toRaw(field);
301
+ if (el) {
302
+ componentInstanceMap.set(raw, el);
303
+ raw.getComponentRef = () => {
283
304
  var _a;
284
- return (_a = componentRefs[index2]) == null ? void 0 : _a.getComponentRef();
285
- },
286
- getComponentComputedProps: () => {
305
+ return (_a = componentInstanceMap.get(raw)) == null ? void 0 : _a.getComponentRef();
306
+ };
307
+ raw.getComponentComputedProps = () => {
287
308
  var _a;
288
- return (_a = componentRefs[index2]) == null ? void 0 : _a.getComponentComputedProps();
289
- }
290
- });
309
+ return (_a = componentInstanceMap.get(raw)) == null ? void 0 : _a.getComponentComputedProps();
310
+ };
311
+ } else {
312
+ componentInstanceMap.delete(raw);
313
+ }
291
314
  };
292
315
  const groupedFields = useGroupFieldAttrs(validFields);
293
316
  return (_ctx, _cache) => {
@@ -309,25 +332,23 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
309
332
  default: withCtx(() => [
310
333
  createVNode(unref(FormItem), mergeProps({ ref_for: true }, item.formItemProps, {
311
334
  ref_for: true,
312
- ref: (el) => formItemRefs[index2] = el,
335
+ ref: (el) => setFormItemRef(item.rawField, el, item.formItemProps),
313
336
  name: unref(toPath)(item.path),
314
- path: item.path,
315
- onVnodeMounted: ($event) => onFormItemMounted(index2, item.formItemProps)
337
+ path: item.path
316
338
  }), createSlots({
317
339
  default: withCtx(() => [
318
340
  item.rawField.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
319
341
  key: 0,
320
- grid: item.rawField.grid ?? __props.grid,
342
+ grid: item.rawField.grid ?? props.grid,
321
343
  fields: item.rawField.fields,
322
344
  disabled: toValue(item.rawField.disabled)
323
345
  }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
324
346
  key: 1,
325
347
  ref_for: true,
326
- ref: (el) => componentRefs[index2] = el
348
+ ref: (el) => setComponentRef(item.rawField, el)
327
349
  }, { ref_for: true }, item.componentProps, {
328
- path: item.path,
329
- onVnodeMounted: ($event) => onComponentMounted(index2)
330
- }), null, 16, ["path", "onVnodeMounted"]))
350
+ path: item.path
351
+ }), null, 16, ["path"]))
331
352
  ]),
332
353
  _: 2
333
354
  }, [
@@ -342,7 +363,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
342
363
  ])
343
364
  };
344
365
  })
345
- ]), 1040, ["name", "path", "onVnodeMounted"])
366
+ ]), 1040, ["name", "path"])
346
367
  ]),
347
368
  _: 2
348
369
  }, 1032, ["component", "path"])
@@ -372,18 +393,23 @@ const getPlaceholderProps = (key, injectProps, t) => {
372
393
  if (!placeholderKey || injectProps.placeholder !== void 0) return {};
373
394
  return { placeholder: t(placeholderKey) };
374
395
  };
375
- const getInitProps = (field, t) => {
396
+ const getInitProps = (field, injectProps = {}, t) => {
376
397
  const { component } = field;
377
398
  const picker = component === "date-picker" ? "" : field.picker;
378
399
  if (typeof component === "string") {
379
400
  const k = [component, picker].filter(Boolean).join(".");
380
- const config = getInjectConfig(k);
381
- if (!config) return getPlaceholderProps(k, {}, t);
382
- const injectProps = inject(config.injectionKey, config.default);
383
401
  return { ...injectProps, ...getPlaceholderProps(k, injectProps, t) };
384
402
  }
385
403
  return {};
386
404
  };
405
+ const warnedUnknownComponents = /* @__PURE__ */ new Set();
406
+ function warnUnknownComponent(name) {
407
+ if (warnedUnknownComponents.has(name)) return;
408
+ warnedUnknownComponents.add(name);
409
+ console.warn(
410
+ `[pro-components] 未识别的组件类型 "${name}",已降级为原生元素渲染。如为自定义组件请在 componentMap 或 ProComponentProvider 中注册。`
411
+ );
412
+ }
387
413
  const LOCALE_INJECT_KEY = Symbol("pro-locale");
388
414
  const useLocale = () => {
389
415
  const config = useConfigContextInject();
@@ -408,25 +434,27 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
408
434
  ...{ name: "BaseField", inheritAttrs: false },
409
435
  __name: "index",
410
436
  props: {
411
- component: { default: () => void 0 },
437
+ component: { default: void 0 },
412
438
  path: { default: "" }
413
439
  },
414
440
  setup(__props, { expose: __expose }) {
441
+ const props = __props;
415
442
  const { t } = useLocale();
416
443
  const form = useForm(false);
417
- const { getFormData, setFormData } = form;
418
444
  const componentRef = ref();
419
445
  const formItemContext = useInjectFormItemContext();
420
446
  const triggerFormItemChange = () => {
421
447
  formItemContext.onFieldChange();
422
448
  };
423
449
  const attrs = useAttrs();
424
- function getOldValue() {
425
- return cloneDeep(getFormData == null ? void 0 : getFormData(__props.path));
426
- }
450
+ const pickerVal = attrs.picker;
451
+ const injectConfigKey = typeof props.component === "string" ? [props.component, pickerVal].filter(Boolean).join(".") : "";
452
+ const componentInjectConfig = injectConfigKey ? getInjectConfig(injectConfigKey) : void 0;
453
+ const rawInjectComponentProps = componentInjectConfig ? inject(componentInjectConfig.injectionKey, componentInjectConfig.default) : void 0;
427
454
  const value = computed({
428
455
  get() {
429
- let val = getFormData == null ? void 0 : getFormData(__props.path);
456
+ var _a;
457
+ let val = (_a = form.getFormData) == null ? void 0 : _a.call(form, props.path);
430
458
  const { valueFormatter } = groupedAttrs.value;
431
459
  if (typeof valueFormatter === "object" && typeof valueFormatter.get === "function") {
432
460
  val = valueFormatter.get(val);
@@ -434,38 +462,35 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
434
462
  return val;
435
463
  },
436
464
  set(val) {
465
+ var _a, _b;
437
466
  let newVal = val;
438
467
  const { valueFormatter } = groupedAttrs.value;
439
- if (valueFormatter) {
440
- if (typeof valueFormatter === "function") {
441
- newVal = valueFormatter(val, getOldValue());
442
- } else if (typeof valueFormatter.set === "function") {
443
- newVal = valueFormatter.set(val, getOldValue());
444
- }
468
+ const setFormatter = typeof valueFormatter === "function" ? valueFormatter : typeof valueFormatter === "object" && typeof (valueFormatter == null ? void 0 : valueFormatter.set) === "function" ? valueFormatter.set : void 0;
469
+ if (setFormatter) {
470
+ const oldVal = setFormatter.length > 1 ? cloneDeep((_a = form.getFormData) == null ? void 0 : _a.call(form, props.path)) : void 0;
471
+ newVal = setFormatter(val, oldVal);
445
472
  }
446
- setFormData == null ? void 0 : setFormData(__props.path, newVal);
473
+ (_b = form.setFormData) == null ? void 0 : _b.call(form, props.path, newVal);
447
474
  triggerFormItemChange();
448
475
  }
449
476
  });
450
477
  const parentDisabled = useInjectDisabled();
451
478
  const groupedAttrs = computed(() => {
479
+ const currentInjectProps = toValue(rawInjectComponentProps) || {};
452
480
  const initProps = getInitProps(
453
- {
454
- component: __props.component,
455
- picker: attrs.picker
456
- },
481
+ { component: props.component, picker: attrs.picker },
482
+ currentInjectProps,
457
483
  t
458
484
  );
485
+ const effectiveModelProp = attrs.modelProp ?? initProps.modelProp ?? "value";
459
486
  const mergedProps = mergeProps(
460
487
  initProps,
461
488
  attrs,
462
489
  { class: attrs.componentClass, style: attrs.componentStyle },
463
- { class: initProps.componentClass, style: initProps.componentStyle },
464
490
  { disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
465
- { modelProp: attrs.modelProp ?? initProps.modelProp ?? "value" }
491
+ { modelProp: effectiveModelProp }
466
492
  );
467
- const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, ...rest } = mergedProps;
468
- const bindAttrs = omit(rest, [modelProp, `onUpdate:${modelProp}`]);
493
+ const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, [effectiveModelProp]: _modelVal, [`onUpdate:${effectiveModelProp}`]: _onUpdateModelVal, ...bindAttrs } = mergedProps;
469
494
  return {
470
495
  attrs: bindAttrs,
471
496
  slots,
@@ -477,12 +502,16 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
477
502
  const formSlots = inject(InjectionFormSlotsKey, void 0);
478
503
  const customComponents = inject(INJECT_COMPONENTS, {});
479
504
  const is = computed(() => {
480
- const teleportSlot = __props.path && (formSlots == null ? void 0 : formSlots[__props.path]);
505
+ var _a;
506
+ const teleportSlot = props.path && (formSlots == null ? void 0 : formSlots[props.path]);
481
507
  if (teleportSlot) return teleportSlot;
482
- if (typeof __props.component === "string") {
483
- return customComponents[__props.component] || componentMap[__props.component] || __props.component;
508
+ if (typeof props.component === "string") {
509
+ const resolved = ((_a = toValue(customComponents)) == null ? void 0 : _a[props.component]) || componentMap[props.component];
510
+ if (resolved) return resolved;
511
+ warnUnknownComponent(props.component);
512
+ return props.component;
484
513
  }
485
- return __props.component;
514
+ return props.component;
486
515
  });
487
516
  __expose({
488
517
  getComponentRef: () => componentRef.value,
@@ -491,7 +520,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
491
520
  return (_ctx, _cache) => {
492
521
  return openBlock(), createBlock(unref(_sfc_main$c), {
493
522
  component: groupedAttrs.value.componentContainer,
494
- path: __props.path
523
+ path: props.path
495
524
  }, {
496
525
  default: withCtx(() => [
497
526
  is.value ? (openBlock(), createBlock(resolveDynamicComponent(is.value), mergeProps({ key: 0 }, groupedAttrs.value.attrs, {
@@ -499,13 +528,15 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
499
528
  ref: componentRef,
500
529
  [`${groupedAttrs.value.modelProp}`]: value.value,
501
530
  [`onUpdate:${groupedAttrs.value.modelProp}`]: _cache[0] || (_cache[0] = ($event) => value.value = $event),
502
- path: __props.path
531
+ path: props.path
503
532
  }), createSlots({ _: 2 }, [
504
533
  renderList(groupedAttrs.value.slots, (slot, name) => {
505
534
  return {
506
535
  name,
507
536
  fn: withCtx((scoped) => [
508
- createVNode(unref(_sfc_main$b), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
537
+ createVNode(unref(_sfc_main$b), mergeProps({
538
+ path: props.path
539
+ }, scoped, { component: slot }), null, 16, ["path", "component"])
509
540
  ])
510
541
  };
511
542
  })
@@ -520,11 +551,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
520
551
  ...{ name: "ContainerFragment", inheritAttrs: false },
521
552
  __name: "index",
522
553
  props: {
523
- component: { type: [Object, Function] }
554
+ component: { type: [Object, Function], default: void 0 }
524
555
  },
525
556
  setup(__props) {
557
+ const props = __props;
526
558
  return (_ctx, _cache) => {
527
- return __props.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), {
559
+ return props.component ? (openBlock(), createBlock(resolveDynamicComponent(props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), {
528
560
  default: withCtx(() => [
529
561
  renderSlot(_ctx.$slots, "default")
530
562
  ]),
@@ -537,12 +569,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
537
569
  ...{ name: "SlotComponent", inheritAttrs: false },
538
570
  __name: "index",
539
571
  props: {
540
- component: { type: [Object, Function, String, Number, Boolean, null] }
572
+ component: { type: [Object, Function, String, Number, Boolean, null], default: void 0 }
541
573
  },
542
574
  setup(__props) {
575
+ const props = __props;
543
576
  return (_ctx, _cache) => {
544
- return isVNode(__props.component) || typeof __props.component === "function" ? (openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), null, 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
545
- createTextVNode(toDisplayString(__props.component), 1)
577
+ return isVNode(props.component) || typeof props.component === "function" ? (openBlock(), createBlock(resolveDynamicComponent(props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), null, 16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
578
+ createTextVNode(toDisplayString(props.component), 1)
546
579
  ], 64));
547
580
  };
548
581
  }
@@ -552,30 +585,61 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
552
585
  __name: "index",
553
586
  props: {
554
587
  grid: { type: [Boolean, Object], default: false },
555
- form: { default: () => ({}) }
588
+ form: { default: void 0 }
556
589
  },
557
590
  setup(__props) {
558
- provide(InjectionFormKey, __props.form);
559
- const { formData, fields, setFormRef } = __props.form;
560
- const config = INJECT_CONFIG["pro-form"];
561
- const { grid: _injectGrid, ...injectAttrs } = inject(
562
- config.injectionKey,
563
- config.default
591
+ const props = __props;
592
+ const fallbackForm = props.form ? void 0 : useForm();
593
+ const currentForm = computed(
594
+ () => props.form ?? fallbackForm
564
595
  );
596
+ const formProxy = createFormProxy(() => currentForm.value);
597
+ provide(InjectionFormKey, formProxy);
598
+ const fields = computed(() => {
599
+ var _a;
600
+ const f = (_a = currentForm.value) == null ? void 0 : _a.fields;
601
+ return (Array.isArray(f) ? f : f == null ? void 0 : f.value) ?? [];
602
+ });
603
+ const formData = computed(() => {
604
+ var _a;
605
+ return (_a = currentForm.value) == null ? void 0 : _a.formData;
606
+ });
607
+ const setFormRef = (el) => {
608
+ var _a, _b;
609
+ return (_b = (_a = currentForm.value) == null ? void 0 : _a.setFormRef) == null ? void 0 : _b.call(_a, el);
610
+ };
611
+ let formInstanceCounter = 0;
612
+ const formInstanceKeyMap = /* @__PURE__ */ new WeakMap();
613
+ const getFormKey = (f) => {
614
+ if (!formInstanceKeyMap.has(f)) {
615
+ formInstanceKeyMap.set(f, ++formInstanceCounter);
616
+ }
617
+ return formInstanceKeyMap.get(f);
618
+ };
619
+ const formKey = computed(() => getFormKey(currentForm.value));
620
+ const config = INJECT_CONFIG["pro-form"];
621
+ const injectFormConfig = inject(config.injectionKey, config.default);
622
+ const attrs = useAttrs();
623
+ const injectAttrs = computed(() => {
624
+ const raw = toValue(injectFormConfig);
625
+ const { grid: _injectGrid, ...rest } = raw || {};
626
+ return rest;
627
+ });
628
+ const formAttrs = computed(() => {
629
+ return mergeProps(injectAttrs.value, camelizeProperties(attrs));
630
+ });
565
631
  const slots = useSlots();
566
- provide(InjectionFormSlotsKey, reactive(slots));
632
+ provide(InjectionFormSlotsKey, slots);
567
633
  return (_ctx, _cache) => {
568
634
  return openBlock(), createBlock(unref(Form), mergeProps({
569
- ref: (el) => {
570
- var _a;
571
- return (_a = unref(setFormRef)) == null ? void 0 : _a(el);
572
- },
573
- model: unref(formData)
574
- }, mergeProps(injectAttrs, unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
635
+ key: formKey.value,
636
+ ref: setFormRef,
637
+ model: formData.value
638
+ }, formAttrs.value, { class: "pro-form" }), {
575
639
  default: withCtx(() => [
576
640
  createVNode(unref(_sfc_main$e), {
577
- fields: unref(fields),
578
- grid: __props.grid
641
+ fields: fields.value,
642
+ grid: props.grid
579
643
  }, null, 8, ["fields", "grid"]),
580
644
  renderSlot(_ctx.$slots, "default")
581
645
  ]),
@@ -617,7 +681,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
617
681
  ...{ name: "SearchForm" },
618
682
  __name: "SearchForm",
619
683
  props: {
620
- form: {},
684
+ form: { default: void 0 },
621
685
  layout: { default: "grid" },
622
686
  expand: { type: [Boolean, Object], default: true },
623
687
  searchButton: { type: [Object, Function, Boolean], default: void 0 },
@@ -631,156 +695,26 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
631
695
  emits: ["search", "reset"],
632
696
  setup(__props, { emit: __emit }) {
633
697
  const { t } = useLocale();
698
+ const props = __props;
634
699
  const emit = __emit;
635
- const proFormHeight = ref("unset");
636
- const collapseHeight = ref(0);
637
- const rowHeight = ref(32);
638
- let resizeObserver = null;
639
- let intersectionObserver = null;
640
- const cleanupObservers = () => {
641
- if (resizeObserver) {
642
- resizeObserver.disconnect();
643
- resizeObserver = null;
644
- }
645
- if (intersectionObserver) {
646
- intersectionObserver.disconnect();
647
- intersectionObserver = null;
648
- }
649
- };
650
- onBeforeUnmount(() => {
651
- cleanupObservers();
652
- });
653
- const computedExpand = computed(() => {
654
- if (!__props.expand) return false;
655
- if (__props.expand === true) return { minExpandRows: 2, expandStatus: false };
656
- return {
657
- minExpandRows: Math.max(Math.floor(__props.expand.minExpandRows ?? 2), 1),
658
- expandStatus: __props.expand.expandStatus ?? false
659
- };
660
- });
661
- const showExpandToggle = ref(false);
662
- const expandStatus = ref(true);
663
- const { formRef, getFormData } = __props.form;
664
- const updateHeights = () => {
665
- var _a, _b, _c, _d, _e, _f;
666
- if (!__props.expand || !formRef.value) return;
667
- const proFormEl = (_a = formRef.value) == null ? void 0 : _a.$el;
668
- if (!proFormEl) return;
669
- const itemHeight = (_d = (_c = (_b = proFormEl == null ? void 0 : proFormEl.querySelector("[class*='-form-item']")) == null ? void 0 : _b.getBoundingClientRect) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.height;
670
- if (itemHeight && itemHeight > 0) {
671
- rowHeight.value = itemHeight;
672
- }
673
- const naturalHeight = proFormEl.scrollHeight || ((_f = (_e = proFormEl.getBoundingClientRect) == null ? void 0 : _e.call(proFormEl)) == null ? void 0 : _f.height) || 0;
674
- if (naturalHeight > 0) {
675
- proFormHeight.value = naturalHeight;
676
- }
677
- };
678
- const changeExpandStatus = () => {
679
- expandStatus.value = !expandStatus.value;
680
- nextTick(() => {
681
- updateHeights();
682
- });
683
- };
684
- const hasFieldValue = (val) => val !== null && val !== void 0 && val !== "" && !(Array.isArray(val) && val.length === 0) && !(typeof val === "object" && Object.keys(val).length === 0);
685
- const setInitExpandStatus = () => {
686
- var _a;
687
- expandStatus.value = false;
688
- if (formRef.value && __props.expand) {
689
- const formEl = formRef.value.$el;
690
- const formItemsEl = (_a = formEl == null ? void 0 : formEl.querySelectorAll) == null ? void 0 : _a.call(
691
- formEl,
692
- "[class*='-form-item'] > [path]"
693
- );
694
- if (!formItemsEl || formItemsEl.length === 0) return;
695
- if (intersectionObserver) {
696
- intersectionObserver.disconnect();
697
- }
698
- intersectionObserver = new IntersectionObserver(
699
- (entries) => {
700
- expandStatus.value = entries.some((e) => {
701
- if (e.intersectionRatio === 0) {
702
- const path = e.target.getAttribute("path");
703
- const searchFieldValue = path ? getFormData == null ? void 0 : getFormData(path) : void 0;
704
- return hasFieldValue(searchFieldValue);
705
- }
706
- return __props.expand.expandStatus;
707
- });
708
- intersectionObserver == null ? void 0 : intersectionObserver.disconnect();
709
- },
710
- { root: formEl }
711
- );
712
- formItemsEl.forEach((element) => {
713
- intersectionObserver == null ? void 0 : intersectionObserver.observe(element);
714
- });
715
- }
716
- };
717
- watch(
718
- [
719
- () => {
720
- var _a, _b, _c;
721
- return (_c = (_b = (_a = __props.form) == null ? void 0 : _a.fields.value) == null ? void 0 : _b.filter((f) => !f.hidden)) == null ? void 0 : _c.length;
722
- },
723
- () => formRef.value,
724
- () => __props.expand
725
- ],
726
- () => {
727
- updateHeights();
728
- },
729
- { flush: "post", immediate: true }
730
- );
731
- watch(
732
- () => formRef.value,
733
- (val) => {
734
- if (resizeObserver) {
735
- resizeObserver.disconnect();
736
- resizeObserver = null;
737
- }
738
- const formEl = val == null ? void 0 : val.$el;
739
- if (formEl && typeof ResizeObserver !== "undefined") {
740
- resizeObserver = new ResizeObserver(() => {
741
- updateHeights();
742
- });
743
- resizeObserver.observe(formEl);
744
- }
745
- },
746
- { immediate: true }
747
- );
748
- watchEffect(
749
- () => {
750
- if (typeof proFormHeight.value !== "number") return;
751
- if (__props.layout === "grid" && computedExpand.value) {
752
- const { minExpandRows } = computedExpand.value;
753
- collapseHeight.value = Math.min(
754
- minExpandRows * rowHeight.value + (minExpandRows - 1) * __props.rowGap,
755
- +proFormHeight.value
756
- );
757
- showExpandToggle.value = +proFormHeight.value - collapseHeight.value > 1;
758
- if (showExpandToggle.value) {
759
- setInitExpandStatus();
760
- }
761
- } else {
762
- showExpandToggle.value = false;
763
- }
764
- },
765
- { flush: "post" }
766
- );
767
- const layoutProps = computed(
768
- () => __props.layout === "grid" ? {
700
+ const { showExpandToggle, expandStatus, changeExpandStatus, heightStyle } = useSearchFormExpand(props);
701
+ const layoutProps = computed(() => {
702
+ return props.layout === "grid" ? {
769
703
  grid: {
770
- gutter: [__props.columnGap, __props.rowGap],
704
+ gutter: [props.columnGap, props.rowGap],
771
705
  style: { flex: 1, marginRight: "12px" }
772
706
  },
773
707
  style: {
774
708
  display: "flex",
775
709
  overflow: "hidden",
776
- height: `${expandStatus.value ? proFormHeight.value : collapseHeight.value}px`
710
+ height: heightStyle.value
777
711
  }
778
712
  } : {
779
713
  layout: "inline",
780
- style: { gap: `${__props.rowGap}px ${__props.columnGap}px` },
714
+ style: { gap: `${props.rowGap}px ${props.columnGap}px` },
781
715
  grid: false
782
- }
783
- );
716
+ };
717
+ });
784
718
  const onReset = () => {
785
719
  emit("reset");
786
720
  };
@@ -789,7 +723,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
789
723
  };
790
724
  return (_ctx, _cache) => {
791
725
  return openBlock(), createBlock(unref(_sfc_main$a), mergeProps(layoutProps.value, {
792
- form: __props.form,
726
+ form: props.form,
793
727
  class: "pro-table_search-form transition"
794
728
  }), {
795
729
  default: withCtx(() => [
@@ -798,9 +732,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
798
732
  class: "pro-table_search-form_button-group"
799
733
  }, {
800
734
  default: withCtx(() => [
801
- renderSlot(_ctx.$slots, "reset-button", { onClick: onReset }, () => [
802
- __props.resetButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
803
- __props.resetButton ? (openBlock(), createBlock(resolveDynamicComponent(__props.resetButton), {
735
+ renderSlot(_ctx.$slots, "reset-button", { onReset }, () => [
736
+ props.resetButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
737
+ props.resetButton ? (openBlock(), createBlock(resolveDynamicComponent(props.resetButton), {
804
738
  key: 0,
805
739
  onClick: onReset
806
740
  })) : (openBlock(), createBlock(unref(Button), {
@@ -815,9 +749,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
815
749
  }))
816
750
  ], 64)) : createCommentVNode("", true)
817
751
  ], true),
818
- renderSlot(_ctx.$slots, "search-button", { onClick: onSearch }, () => [
819
- __props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
820
- __props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(__props.searchButton), {
752
+ renderSlot(_ctx.$slots, "search-button", { onSearch }, () => [
753
+ props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
754
+ props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(props.searchButton), {
821
755
  key: 0,
822
756
  onClick: onSearch
823
757
  })) : (openBlock(), createBlock(unref(Button), {
@@ -834,27 +768,30 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
834
768
  }))
835
769
  ], 64)) : createCommentVNode("", true)
836
770
  ], true),
837
- renderSlot(_ctx.$slots, "expand-button", { onClick: changeExpandStatus }, () => [
838
- __props.expandButton !== false && showExpandToggle.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
839
- __props.expandButton ? (openBlock(), createBlock(resolveDynamicComponent(__props.expandButton), {
771
+ renderSlot(_ctx.$slots, "expand-button", {
772
+ expandStatus: unref(expandStatus),
773
+ changeExpandStatus: unref(changeExpandStatus)
774
+ }, () => [
775
+ props.expandButton !== false && unref(showExpandToggle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
776
+ props.expandButton ? (openBlock(), createBlock(resolveDynamicComponent(props.expandButton), {
840
777
  key: 0,
841
- "expand-status": expandStatus.value,
842
- onClick: changeExpandStatus
843
- }, null, 8, ["expand-status"])) : (openBlock(), createBlock(unref(Button), {
778
+ "expand-status": unref(expandStatus),
779
+ onClick: unref(changeExpandStatus)
780
+ }, null, 8, ["expand-status", "onClick"])) : (openBlock(), createBlock(unref(Button), {
844
781
  key: 1,
845
782
  type: "link",
846
783
  class: "pro-table_search-form_expand-toggle-button",
847
- onClick: changeExpandStatus
784
+ onClick: unref(changeExpandStatus)
848
785
  }, {
849
786
  default: withCtx(() => [
850
- createTextVNode(toDisplayString(expandStatus.value ? unref(t)("table.collapse") : unref(t)("table.expand")) + " ", 1),
787
+ createTextVNode(toDisplayString(unref(expandStatus) ? unref(t)("table.collapse") : unref(t)("table.expand")) + " ", 1),
851
788
  createVNode(DownOutlined, {
852
789
  class: "transition",
853
- style: normalizeStyle([{ "margin-left": "4px" }, { transform: `rotate(${expandStatus.value ? -180 : 0}deg)` }])
790
+ style: normalizeStyle([{ "margin-left": "4px" }, { transform: `rotate(${unref(expandStatus) ? -180 : 0}deg)` }])
854
791
  }, null, 8, ["style"])
855
792
  ]),
856
793
  _: 1
857
- }))
794
+ }, 8, ["onClick"]))
858
795
  ], 64)) : createCommentVNode("", true)
859
796
  ], true)
860
797
  ]),
@@ -866,7 +803,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
866
803
  };
867
804
  }
868
805
  });
869
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-7bd701e4"]]);
806
+ const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-15688cc0"]]);
870
807
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
871
808
  __name: "DefaultSearchFormContainer",
872
809
  setup(__props) {
@@ -921,11 +858,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
921
858
  },
922
859
  emits: ["update:size"],
923
860
  setup(__props) {
924
- var _a;
925
861
  const { t } = useLocale();
926
862
  const configContext = useConfigContextInject();
927
863
  const size = useModel(__props, "size");
928
- size.value = size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
864
+ const currentSize = computed(
865
+ () => {
866
+ var _a;
867
+ return size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
868
+ }
869
+ );
929
870
  const onSizeChange = (val) => {
930
871
  size.value = val.key;
931
872
  };
@@ -942,7 +883,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
942
883
  overlay: withCtx(() => [
943
884
  createVNode(unref(Menu), {
944
885
  style: { "width": "100px", "text-align": "center" },
945
- "selected-keys": size.value ? [size.value] : [],
886
+ "selected-keys": [currentSize.value],
946
887
  items: sizeOptions.value,
947
888
  onClick: onSizeChange
948
889
  }, null, 8, ["selected-keys", "items"])
@@ -963,7 +904,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
963
904
  };
964
905
  }
965
906
  });
966
- const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a718ce24"]]);
907
+ const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2ac95d3b"]]);
967
908
  const _sfc_main$3 = {};
968
909
  const _hoisted_1$1 = {
969
910
  focusable: "false",
@@ -984,23 +925,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
984
925
  __name: "ColumnControl",
985
926
  props: {
986
927
  columns: {},
987
- table: { default: () => void 0 },
988
- columnControl: { default: () => void 0 }
928
+ table: { default: void 0 },
929
+ columnControl: { default: void 0 }
989
930
  },
990
931
  setup(__props) {
932
+ const props = __props;
991
933
  const { t } = useLocale();
992
934
  const open = ref(false);
993
935
  const checkAll = ref(false);
994
936
  const indeterminate = ref(false);
995
937
  const checkedColumnsOptions = computed(
996
- () => __props.columns.flatMap((item) => {
938
+ () => props.columns.flatMap((item) => {
997
939
  var _a, _b, _c, _d, _e, _f;
998
940
  const rawKey = item.key ?? (Array.isArray(item.dataIndex) ? item.dataIndex.join(".") : item.dataIndex);
999
941
  if (!rawKey || !item.title) return [];
1000
942
  const key = String(rawKey);
1001
- if ((_b = (_a = __props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key)) return [];
1002
- const disabled = ((_d = (_c = __props.columnControl) == null ? void 0 : _c.disabledKeys) == null ? void 0 : _d.some((dk) => String(dk) === key)) ?? false;
1003
- const label = ((_f = (_e = __props.columnControl) == null ? void 0 : _e.labels) == null ? void 0 : _f[key]) ?? (typeof item.title === "string" ? item.title : key);
943
+ if ((_b = (_a = props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key))
944
+ return [];
945
+ const disabled = ((_d = (_c = props.columnControl) == null ? void 0 : _c.disabledKeys) == null ? void 0 : _d.some((dk) => String(dk) === key)) ?? false;
946
+ const label = ((_f = (_e = props.columnControl) == null ? void 0 : _e.labels) == null ? void 0 : _f[key]) ?? (typeof item.title === "string" ? item.title : key);
1004
947
  return {
1005
948
  label,
1006
949
  value: key,
@@ -1022,7 +965,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1022
965
  checkedColumnsOptions.value.forEach((item) => {
1023
966
  var _a, _b;
1024
967
  if (item.disabled) return;
1025
- (_b = (_a = __props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, item.value, {
968
+ (_b = (_a = props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, item.value, {
1026
969
  hidden: !val.includes(item.value)
1027
970
  });
1028
971
  });
@@ -1054,25 +997,18 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1054
997
  },
1055
998
  { immediate: true }
1056
999
  );
1057
- onMounted(() => {
1058
- var _a, _b;
1059
- (_b = (_a = __props.columnControl) == null ? void 0 : _a.disabledKeys) == null ? void 0 : _b.forEach((key) => {
1060
- var _a2, _b2;
1061
- (_b2 = (_a2 = __props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b2.call(_a2, String(key), { hidden: false });
1062
- });
1063
- });
1064
1000
  watch(
1065
1001
  () => {
1066
1002
  var _a;
1067
- return (_a = __props.columnControl) == null ? void 0 : _a.disabledKeys;
1003
+ return (_a = props.columnControl) == null ? void 0 : _a.disabledKeys;
1068
1004
  },
1069
1005
  (keys) => {
1070
1006
  keys == null ? void 0 : keys.forEach((key) => {
1071
1007
  var _a, _b;
1072
- (_b = (_a = __props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, String(key), { hidden: false });
1008
+ (_b = (_a = props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, String(key), { hidden: false });
1073
1009
  });
1074
1010
  },
1075
- { deep: true }
1011
+ { immediate: true, deep: true }
1076
1012
  );
1077
1013
  return (_ctx, _cache) => {
1078
1014
  return openBlock(), createBlock(unref(Dropdown), {
@@ -1089,7 +1025,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1089
1025
  default: withCtx(() => {
1090
1026
  var _a, _b;
1091
1027
  return [
1092
- !((_a = __props.columnControl) == null ? void 0 : _a.disableCheckAll) ? (openBlock(), createBlock(unref(MenuItem), {
1028
+ !((_a = props.columnControl) == null ? void 0 : _a.disableCheckAll) ? (openBlock(), createBlock(unref(MenuItem), {
1093
1029
  key: 0,
1094
1030
  onClick: onCheckAllChange
1095
1031
  }, {
@@ -1149,7 +1085,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1149
1085
  };
1150
1086
  }
1151
1087
  });
1152
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9899456e"]]);
1088
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-a94297cd"]]);
1153
1089
  const _hoisted_1 = { class: "pro-table_header" };
1154
1090
  const _hoisted_2 = {
1155
1091
  key: 0,
@@ -1171,32 +1107,36 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1171
1107
  ...{ name: "ProTable", inheritAttrs: false },
1172
1108
  __name: "ProTable",
1173
1109
  props: /* @__PURE__ */ mergeModels({
1174
- table: { default: () => void 0 },
1110
+ table: { default: void 0 },
1175
1111
  search: { type: Function, default: void 0 },
1176
- addIndexColumn: { type: Boolean, default: () => void 0 },
1177
- immediateSearch: { type: Boolean, default: () => void 0 },
1178
- control: { type: [Boolean, Object], default: () => void 0 },
1179
- searchFormConfig: { default: () => void 0 },
1112
+ addIndexColumn: { type: Boolean, default: void 0 },
1113
+ immediateSearch: { type: Boolean, default: void 0 },
1114
+ control: { type: [Boolean, Object], default: void 0 },
1115
+ searchFormConfig: { default: void 0 },
1180
1116
  tableContainer: { type: [Object, Function, Boolean], default: void 0 }
1181
1117
  }, {
1182
1118
  "size": {},
1183
1119
  "sizeModifiers": {},
1184
- "loading": { type: Boolean },
1120
+ "loading": { type: Boolean, ...{ default: false } },
1185
1121
  "loadingModifiers": {}
1186
1122
  }),
1187
1123
  emits: ["update:size", "update:loading"],
1188
- setup(__props) {
1124
+ setup(__props, { expose: __expose }) {
1125
+ const tableProperties = Object.keys(tableProps());
1126
+ const props = __props;
1189
1127
  const { t } = useLocale();
1190
1128
  const config = INJECT_CONFIG["pro-table"];
1191
- const injectProps = inject(config.injectionKey, config.default);
1192
- const tableProperties = Object.keys(tableProps());
1193
- const injectAttrs = pick(injectProps, tableProperties);
1129
+ const injectPropsRaw = inject(config.injectionKey, config.default);
1130
+ const injectProps = computed(() => toValue(injectPropsRaw) || {});
1131
+ const injectAttrs = computed(
1132
+ () => pick(injectProps.value, tableProperties)
1133
+ );
1194
1134
  const computedSearchFormConfig = computed(() => {
1195
1135
  var _a, _b;
1196
- const container = ((_a = __props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
1136
+ const container = ((_a = props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.value.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
1197
1137
  return {
1198
- ...injectProps.searchFormConfig,
1199
- ...getObject(__props.searchFormConfig),
1138
+ ...injectProps.value.searchFormConfig,
1139
+ ...getObject(props.searchFormConfig),
1200
1140
  container: container ? container : void 0
1201
1141
  };
1202
1142
  });
@@ -1204,136 +1144,176 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1204
1144
  const tableAttrs = computed(() => {
1205
1145
  return pick(camelizeProperties(attrs), tableProperties);
1206
1146
  });
1207
- const { columns, dataSource, searchForm, pageParam, setPageParam } = __props.table || {};
1208
1147
  const size = useModel(__props, "size");
1209
1148
  const loading = useModel(__props, "loading");
1149
+ let searchSequence = 0;
1210
1150
  const _search = async () => {
1211
1151
  var _a;
1152
+ const seq = ++searchSequence;
1153
+ const searchPromise = (_a = props.search || attrs.onSearch) == null ? void 0 : _a();
1154
+ if (!isPromise(searchPromise)) return;
1155
+ loading.value = true;
1212
1156
  try {
1213
- loading.value = true;
1214
- await ((_a = __props.search) == null ? void 0 : _a.call(__props));
1157
+ await searchPromise;
1215
1158
  } finally {
1216
- loading.value = false;
1159
+ if (seq === searchSequence) {
1160
+ loading.value = false;
1161
+ }
1217
1162
  }
1218
1163
  };
1219
1164
  const reset = () => {
1220
- var _a;
1221
- (_a = __props.table) == null ? void 0 : _a.resetQueryParams();
1165
+ var _a, _b;
1166
+ (_b = (_a = props.table) == null ? void 0 : _a.resetQueryParams) == null ? void 0 : _b.call(_a);
1222
1167
  nextTick(() => {
1223
1168
  _search();
1224
1169
  });
1225
1170
  };
1171
+ const customSlotNames = [
1172
+ "search-form",
1173
+ "button-bar",
1174
+ "toolbar",
1175
+ "table"
1176
+ ];
1226
1177
  const slots = useSlots();
1227
- const {
1228
- "search-form": searchFormSlot,
1229
- "button-bar": buttonBarSlot,
1230
- toolbar: toolbarSlot,
1231
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1232
- table: tableSlot,
1233
- ...tableSlots
1234
- } = slots;
1178
+ const forwardedSlotNames = () => Object.keys(slots).filter(
1179
+ (name) => !customSlotNames.includes(name)
1180
+ );
1235
1181
  const searchPage1st = () => {
1236
- setPageParam == null ? void 0 : setPageParam({ current: 1 });
1182
+ var _a, _b;
1183
+ (_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, { current: 1 });
1237
1184
  _search();
1238
1185
  };
1239
1186
  const computedTableProps = computed(() => {
1240
1187
  return {
1241
- ...injectAttrs,
1188
+ ...injectAttrs.value,
1242
1189
  ...tableAttrs.value,
1243
1190
  pagination: void 0,
1244
1191
  onChange: void 0
1245
1192
  };
1246
1193
  });
1247
1194
  const computedTableContainer = computed(() => {
1248
- const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
1195
+ const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
1249
1196
  return container ? container : void 0;
1250
1197
  });
1251
- const indexColumn = () => ({
1198
+ const getIndex = (i) => {
1199
+ var _a;
1200
+ const pageParam = (_a = props.table) == null ? void 0 : _a.pageParam;
1201
+ if (pageParam && computedPagination.value !== false) {
1202
+ const current = pageParam.current ?? 1;
1203
+ const pageSize = pageParam.pageSize ?? 10;
1204
+ return (current - 1) * pageSize + i + 1;
1205
+ }
1206
+ return i + 1;
1207
+ };
1208
+ const indexColumn = computed(() => ({
1252
1209
  title: t("table.index"),
1253
1210
  dataIndex: "_index",
1211
+ key: "_index",
1254
1212
  width: 80,
1255
- customRender: ({ index: index2 }) => index2 + 1
1213
+ customRender: ({ index: index2 }) => getIndex(index2)
1214
+ }));
1215
+ const computedColumns = computed(() => {
1216
+ var _a;
1217
+ const cols = tableAttrs.value.columns ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? [];
1218
+ const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
1219
+ return needIndex ? [indexColumn.value, ...cols] : cols;
1256
1220
  });
1257
- const computedColumns = computed(
1258
- () => [
1259
- ...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn()] : [],
1260
- ...tableAttrs.value.columns ?? (columns == null ? void 0 : columns.value) ?? []
1261
- ]
1262
- );
1263
1221
  const visibleComputedColumns = computed(() => {
1264
1222
  return computedColumns.value.filter((item) => !item.hidden);
1265
1223
  });
1266
1224
  const computedDataSource = computed(() => {
1267
- return tableAttrs.value.dataSource ?? (dataSource == null ? void 0 : dataSource.value);
1225
+ var _a;
1226
+ return tableAttrs.value.dataSource ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
1268
1227
  });
1269
1228
  const computedPagination = computed(() => {
1270
- var _a, _b;
1229
+ var _a, _b, _c, _d;
1271
1230
  if (tableAttrs.value.pagination === false) return false;
1231
+ if (isPlainObject(tableAttrs.value.pagination)) {
1232
+ const globalPagination = injectAttrs.value.pagination === false ? {} : injectAttrs.value.pagination;
1233
+ return {
1234
+ ...globalPagination,
1235
+ ...(_a = props.table) == null ? void 0 : _a.pageParam,
1236
+ ...tableAttrs.value.pagination,
1237
+ showTotal: ((_b = tableAttrs.value.pagination) == null ? void 0 : _b.showTotal) ?? (globalPagination == null ? void 0 : globalPagination.showTotal) ?? ((total) => t("pagination.total", { total }))
1238
+ };
1239
+ }
1240
+ if (injectAttrs.value.pagination === false) return false;
1272
1241
  return {
1273
- ...injectAttrs.pagination,
1274
- ...pageParam,
1275
- ...tableAttrs.value.pagination,
1276
- showTotal: ((_a = tableAttrs.value.pagination) == null ? void 0 : _a.showTotal) ?? (injectAttrs.pagination === false ? void 0 : (_b = injectAttrs.pagination) == null ? void 0 : _b.showTotal) ?? ((total) => t("pagination.total", { total }))
1242
+ ...injectAttrs.value.pagination,
1243
+ ...(_c = props.table) == null ? void 0 : _c.pageParam,
1244
+ showTotal: ((_d = injectAttrs.value.pagination) == null ? void 0 : _d.showTotal) ?? ((total) => t("pagination.total", { total }))
1277
1245
  };
1278
1246
  });
1279
1247
  const onTableChange = (...args) => {
1280
- var _a;
1281
- setPageParam == null ? void 0 : setPageParam(args[0]);
1282
- (_a = attrs.onChange) == null ? void 0 : _a.call(attrs, ...args);
1248
+ var _a, _b, _c;
1249
+ (_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, args[0]);
1250
+ (_c = attrs.onChange) == null ? void 0 : _c.call(attrs, ...args);
1283
1251
  _search();
1284
1252
  };
1285
- const showSearch = computed(() => {
1286
- var _a, _b;
1287
- return !!(searchFormSlot || ((_a = computedSearchFormConfig.value) == null ? void 0 : _a.hidden) !== true && searchForm && ((_b = searchForm.fields.value.filter((item) => !item.hidden)) == null ? void 0 : _b.length) > 0);
1253
+ const searchFormVisible = computed(() => {
1254
+ var _a, _b, _c, _d;
1255
+ const searchFields = (_b = (_a = props.table) == null ? void 0 : _a.searchForm) == null ? void 0 : _b.fields;
1256
+ const fieldList = (Array.isArray(searchFields) ? searchFields : searchFields == null ? void 0 : searchFields.value) ?? [];
1257
+ return !!(((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && fieldList.filter((item) => !toValue(item.hidden)).length > 0);
1288
1258
  });
1289
1259
  const computedControl = computed(() => {
1290
- const mergedControl = __props.control ?? injectProps.control;
1291
- if (typeof mergedControl === "boolean") {
1292
- return { sizeControl: mergedControl, columnControl: mergedControl };
1260
+ const controlConfig = props.control ?? injectProps.value.control;
1261
+ if (controlConfig === true) {
1262
+ return { sizeControl: true, columnControl: true };
1293
1263
  }
1294
- const c = mergedControl;
1295
- const sizeControl = c.sizeControl ?? true;
1296
- const columnControl = c.columnControl ?? true;
1297
- return { sizeControl: !!sizeControl, columnControl };
1264
+ if (controlConfig === false) {
1265
+ return { sizeControl: false, columnControl: false };
1266
+ }
1267
+ return {
1268
+ sizeControl: !!(controlConfig == null ? void 0 : controlConfig.sizeControl),
1269
+ columnControl: (controlConfig == null ? void 0 : controlConfig.columnControl) ?? false
1270
+ };
1298
1271
  });
1299
1272
  const columnControlConfig = computed(() => {
1300
1273
  const cc = computedControl.value.columnControl;
1301
1274
  return typeof cc === "object" ? cc : void 0;
1302
1275
  });
1303
1276
  onMounted(() => {
1304
- if (__props.immediateSearch ?? injectProps.immediateSearch) {
1277
+ if (props.immediateSearch ?? injectProps.value.immediateSearch) {
1305
1278
  _search();
1306
1279
  }
1307
1280
  });
1281
+ __expose({
1282
+ /** 手动触发一次查询(与内部搜索共用 loading 竞态守卫),便于外部刷新列表 */
1283
+ search: _search
1284
+ });
1308
1285
  return (_ctx, _cache) => {
1309
1286
  return openBlock(), createElementBlock("div", {
1310
1287
  class: normalizeClass(["pro-table", unref(attrs).class]),
1311
1288
  style: normalizeStyle(unref(attrs).style)
1312
1289
  }, [
1313
- showSearch.value ? (openBlock(), createBlock(unref(_sfc_main$c), {
1290
+ searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(unref(_sfc_main$c), {
1314
1291
  key: 0,
1315
1292
  component: computedSearchFormConfig.value.container
1316
1293
  }, {
1317
1294
  default: withCtx(() => [
1318
- renderSlot(_ctx.$slots, "search-form", {}, () => [
1319
- unref(searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
1320
- key: 0,
1321
- form: unref(searchForm)
1322
- }, computedSearchFormConfig.value, {
1323
- onSearch: searchPage1st,
1324
- onReset: reset
1325
- }), null, 16, ["form"])) : createCommentVNode("", true)
1326
- ], true)
1295
+ renderSlot(_ctx.$slots, "search-form", {}, () => {
1296
+ var _a;
1297
+ return [
1298
+ ((_a = props.table) == null ? void 0 : _a.searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
1299
+ key: 0,
1300
+ form: props.table.searchForm
1301
+ }, computedSearchFormConfig.value, {
1302
+ onSearch: searchPage1st,
1303
+ onReset: reset
1304
+ }), null, 16, ["form"])) : createCommentVNode("", true)
1305
+ ];
1306
+ }, true)
1327
1307
  ]),
1328
1308
  _: 3
1329
1309
  }, 8, ["component"])) : createCommentVNode("", true),
1330
1310
  createVNode(unref(_sfc_main$c), { component: computedTableContainer.value }, {
1331
1311
  default: withCtx(() => [
1332
1312
  createElementVNode("div", _hoisted_1, [
1333
- unref(buttonBarSlot) ? (openBlock(), createElementBlock("div", _hoisted_2, [
1313
+ _ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
1334
1314
  renderSlot(_ctx.$slots, "button-bar", {}, void 0, true)
1335
1315
  ])) : createCommentVNode("", true),
1336
- unref(toolbarSlot) ? (openBlock(), createElementBlock("div", _hoisted_3, [
1316
+ _ctx.$slots["toolbar"] ? (openBlock(), createElementBlock("div", _hoisted_3, [
1337
1317
  renderSlot(_ctx.$slots, "toolbar", {}, void 0, true)
1338
1318
  ])) : createCommentVNode("", true),
1339
1319
  computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
@@ -1345,7 +1325,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1345
1325
  computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
1346
1326
  createVNode(unref(ColumnControl), {
1347
1327
  columns: computedColumns.value,
1348
- table: __props.table,
1328
+ table: props.table,
1349
1329
  "column-control": columnControlConfig.value
1350
1330
  }, null, 8, ["columns", "table", "column-control"])
1351
1331
  ])) : createCommentVNode("", true)
@@ -1359,7 +1339,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1359
1339
  pagination: computedPagination.value,
1360
1340
  onChange: onTableChange
1361
1341
  }), createSlots({ _: 2 }, [
1362
- renderList(tableSlots, (_, name) => {
1342
+ renderList(forwardedSlotNames(), (name) => {
1363
1343
  return {
1364
1344
  name,
1365
1345
  fn: withCtx((scoped) => [
@@ -1376,7 +1356,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1376
1356
  };
1377
1357
  }
1378
1358
  });
1379
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ff6f01f4"]]);
1359
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-41d09d2a"]]);
1380
1360
  function useTable(params) {
1381
1361
  return useTable$1(params);
1382
1362
  }
@@ -1387,21 +1367,48 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1387
1367
  },
1388
1368
  __name: "index",
1389
1369
  props: {
1390
- componentVars: {},
1391
- componentMap: {},
1392
- locale: {}
1370
+ componentVars: { default: void 0 },
1371
+ componentMap: { default: void 0 },
1372
+ locale: { default: void 0 }
1393
1373
  },
1394
1374
  setup(__props) {
1395
1375
  const props = __props;
1376
+ Object.keys(INJECT_CONFIG).forEach(
1377
+ (key) => {
1378
+ const config = INJECT_CONFIG[key];
1379
+ provide(
1380
+ config.injectionKey,
1381
+ computed(() => {
1382
+ var _a;
1383
+ return {
1384
+ ...config.default,
1385
+ ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1386
+ };
1387
+ })
1388
+ );
1389
+ }
1390
+ );
1396
1391
  if (props.componentVars) {
1397
- Object.entries(props.componentVars).forEach(([key, val]) => {
1398
- const config = ensureInjectConfig(key);
1399
- provide(config.injectionKey, { ...config.default, ...getObject(val) });
1392
+ Object.keys(props.componentVars).forEach((key) => {
1393
+ if (!(key in INJECT_CONFIG)) {
1394
+ const config = ensureInjectConfig(key);
1395
+ provide(
1396
+ config.injectionKey,
1397
+ computed(() => {
1398
+ var _a;
1399
+ return {
1400
+ ...config.default,
1401
+ ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1402
+ };
1403
+ })
1404
+ );
1405
+ }
1400
1406
  });
1401
1407
  }
1402
- if (props.componentMap) {
1403
- provide(INJECT_COMPONENTS, props.componentMap);
1404
- }
1408
+ provide(
1409
+ INJECT_COMPONENTS,
1410
+ computed(() => props.componentMap)
1411
+ );
1405
1412
  provide(
1406
1413
  LOCALE_INJECT_KEY,
1407
1414
  computed(() => props.locale)