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

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 (160) 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__/helpers/fixtures.d.ts +15 -0
  16. package/es/__tests__/helpers/fixtures.d.ts.map +1 -0
  17. package/es/__tests__/helpers/mount.d.ts +38 -0
  18. package/es/__tests__/helpers/mount.d.ts.map +1 -0
  19. package/es/__tests__/hooks-locale.spec.d.ts +2 -0
  20. package/es/__tests__/hooks-locale.spec.d.ts.map +1 -0
  21. package/es/__tests__/index.spec.d.ts +2 -0
  22. package/es/__tests__/index.spec.d.ts.map +1 -0
  23. package/es/__tests__/integration.spec.d.ts +2 -0
  24. package/es/__tests__/integration.spec.d.ts.map +1 -0
  25. package/es/__tests__/setup.d.ts +14 -0
  26. package/es/__tests__/setup.d.ts.map +1 -0
  27. package/es/antd-vue-pro.css +13 -13
  28. package/es/index.js +362 -225
  29. package/es/index.js.map +1 -1
  30. package/es/{components → src/components}/component-provider/components/index.vue.d.ts +5 -1
  31. package/es/src/components/component-provider/components/index.vue.d.ts.map +1 -0
  32. package/es/src/components/component-provider/constants/index.d.ts.map +1 -0
  33. package/es/src/components/component-provider/index.d.ts.map +1 -0
  34. package/es/src/components/component-provider/types/index.d.ts.map +1 -0
  35. package/es/{components → src/components}/form/components/BaseField/index.vue.d.ts +4 -1
  36. package/es/src/components/form/components/BaseField/index.vue.d.ts.map +1 -0
  37. package/es/src/components/form/components/BaseField/utils/index.d.ts +5 -0
  38. package/es/src/components/form/components/BaseField/utils/index.d.ts.map +1 -0
  39. package/es/{components → src/components}/form/components/BaseFormItem/index.vue.d.ts +5 -1
  40. package/es/src/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -0
  41. package/es/{components → src/components}/form/components/ContainerFragment/index.vue.d.ts +3 -1
  42. package/es/src/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -0
  43. package/es/src/components/form/components/ProForm/index.vue.d.ts.map +1 -0
  44. package/es/src/components/form/components/SlotComponent/index.vue.d.ts +11 -0
  45. package/es/src/components/form/components/SlotComponent/index.vue.d.ts.map +1 -0
  46. package/es/src/components/form/components/index.d.ts.map +1 -0
  47. package/es/src/components/form/constants/index.d.ts.map +1 -0
  48. package/es/src/components/form/hooks/index.d.ts.map +1 -0
  49. package/es/src/components/form/hooks/useFields.d.ts.map +1 -0
  50. package/es/src/components/form/hooks/useForm.d.ts.map +1 -0
  51. package/es/src/components/form/hooks/useFormRef.d.ts.map +1 -0
  52. package/es/{components → src/components}/form/hooks/useGroupFieldAttrs.d.ts +4 -0
  53. package/es/src/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -0
  54. package/es/src/components/form/index.d.ts.map +1 -0
  55. package/es/{components → src/components}/form/types/index.d.ts +26 -2
  56. package/es/src/components/form/types/index.d.ts.map +1 -0
  57. package/es/{components → src/components}/table/components/ColumnControl.vue.d.ts +4 -1
  58. package/es/src/components/table/components/ColumnControl.vue.d.ts.map +1 -0
  59. package/es/src/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +1 -0
  60. package/es/src/components/table/components/DefaultTableContainer.vue.d.ts.map +1 -0
  61. package/es/{components → src/components}/table/components/ProTable.vue.d.ts +0 -2
  62. package/es/src/components/table/components/ProTable.vue.d.ts.map +1 -0
  63. package/es/{components → src/components}/table/components/SearchForm.vue.d.ts +14 -4
  64. package/es/src/components/table/components/SearchForm.vue.d.ts.map +1 -0
  65. package/es/src/components/table/components/SizeControl.vue.d.ts.map +1 -0
  66. package/es/src/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +1 -0
  67. package/es/src/components/table/components/icons/DownOutlined.vue.d.ts.map +1 -0
  68. package/es/src/components/table/components/icons/FilterOutlined.vue.d.ts.map +1 -0
  69. package/es/src/components/table/components/index.d.ts.map +1 -0
  70. package/es/src/components/table/hooks/index.d.ts.map +1 -0
  71. package/es/src/components/table/hooks/useTable.d.ts.map +1 -0
  72. package/es/src/components/table/index.d.ts.map +1 -0
  73. package/es/src/components/table/types/index.d.ts.map +1 -0
  74. package/es/{index.d.ts → src/index.d.ts} +1 -1
  75. package/es/src/index.d.ts.map +1 -0
  76. package/es/src/locale/index.d.ts.map +1 -0
  77. package/es/src/shared/core/index.d.ts +6 -0
  78. package/es/src/shared/core/index.d.ts.map +1 -0
  79. package/es/src/shared/ui/index.d.ts.map +1 -0
  80. package/package.json +8 -3
  81. package/src/components/component-provider/components/index.vue +37 -8
  82. package/src/components/component-provider/constants/index.ts +2 -1
  83. package/src/components/form/components/BaseField/index.vue +61 -34
  84. package/src/components/form/components/BaseField/utils/index.ts +6 -11
  85. package/src/components/form/components/BaseFormItem/index.vue +46 -33
  86. package/src/components/form/components/ContainerFragment/index.vue +4 -2
  87. package/src/components/form/components/ProForm/index.vue +70 -18
  88. package/src/components/form/components/SlotComponent/index.vue +6 -4
  89. package/src/components/form/hooks/useGroupFieldAttrs.ts +7 -1
  90. package/src/components/form/types/index.ts +26 -2
  91. package/src/components/table/components/ColumnControl.vue +16 -15
  92. package/src/components/table/components/ProTable.vue +92 -65
  93. package/src/components/table/components/SearchForm.vue +80 -59
  94. package/src/components/table/components/SizeControl.vue +4 -2
  95. package/src/index.ts +1 -1
  96. package/src/shared/core/index.ts +4 -1
  97. package/es/components/component-provider/components/index.vue.d.ts.map +0 -1
  98. package/es/components/component-provider/constants/index.d.ts.map +0 -1
  99. package/es/components/component-provider/index.d.ts.map +0 -1
  100. package/es/components/component-provider/types/index.d.ts.map +0 -1
  101. package/es/components/form/components/BaseField/index.vue.d.ts.map +0 -1
  102. package/es/components/form/components/BaseField/utils/index.d.ts +0 -5
  103. package/es/components/form/components/BaseField/utils/index.d.ts.map +0 -1
  104. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +0 -1
  105. package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +0 -1
  106. package/es/components/form/components/ProForm/index.vue.d.ts.map +0 -1
  107. package/es/components/form/components/SlotComponent/index.vue.d.ts +0 -7
  108. package/es/components/form/components/SlotComponent/index.vue.d.ts.map +0 -1
  109. package/es/components/form/components/index.d.ts.map +0 -1
  110. package/es/components/form/constants/index.d.ts.map +0 -1
  111. package/es/components/form/hooks/index.d.ts.map +0 -1
  112. package/es/components/form/hooks/useFields.d.ts.map +0 -1
  113. package/es/components/form/hooks/useForm.d.ts.map +0 -1
  114. package/es/components/form/hooks/useFormRef.d.ts.map +0 -1
  115. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +0 -1
  116. package/es/components/form/index.d.ts.map +0 -1
  117. package/es/components/form/types/index.d.ts.map +0 -1
  118. package/es/components/table/components/ColumnControl.vue.d.ts.map +0 -1
  119. package/es/components/table/components/DefaultSearchFormContainer.vue.d.ts.map +0 -1
  120. package/es/components/table/components/DefaultTableContainer.vue.d.ts.map +0 -1
  121. package/es/components/table/components/ProTable.vue.d.ts.map +0 -1
  122. package/es/components/table/components/SearchForm.vue.d.ts.map +0 -1
  123. package/es/components/table/components/SizeControl.vue.d.ts.map +0 -1
  124. package/es/components/table/components/icons/ColumnHeightOutlined.vue.d.ts.map +0 -1
  125. package/es/components/table/components/icons/DownOutlined.vue.d.ts.map +0 -1
  126. package/es/components/table/components/icons/FilterOutlined.vue.d.ts.map +0 -1
  127. package/es/components/table/components/index.d.ts.map +0 -1
  128. package/es/components/table/hooks/index.d.ts.map +0 -1
  129. package/es/components/table/hooks/useTable.d.ts.map +0 -1
  130. package/es/components/table/index.d.ts.map +0 -1
  131. package/es/components/table/types/index.d.ts.map +0 -1
  132. package/es/index.d.ts.map +0 -1
  133. package/es/locale/index.d.ts.map +0 -1
  134. package/es/shared/core/index.d.ts +0 -6
  135. package/es/shared/core/index.d.ts.map +0 -1
  136. package/es/shared/ui/index.d.ts.map +0 -1
  137. /package/es/{components → src/components}/component-provider/constants/index.d.ts +0 -0
  138. /package/es/{components → src/components}/component-provider/index.d.ts +0 -0
  139. /package/es/{components → src/components}/component-provider/types/index.d.ts +0 -0
  140. /package/es/{components → src/components}/form/components/ProForm/index.vue.d.ts +0 -0
  141. /package/es/{components → src/components}/form/components/index.d.ts +0 -0
  142. /package/es/{components → src/components}/form/constants/index.d.ts +0 -0
  143. /package/es/{components → src/components}/form/hooks/index.d.ts +0 -0
  144. /package/es/{components → src/components}/form/hooks/useFields.d.ts +0 -0
  145. /package/es/{components → src/components}/form/hooks/useForm.d.ts +0 -0
  146. /package/es/{components → src/components}/form/hooks/useFormRef.d.ts +0 -0
  147. /package/es/{components → src/components}/form/index.d.ts +0 -0
  148. /package/es/{components → src/components}/table/components/DefaultSearchFormContainer.vue.d.ts +0 -0
  149. /package/es/{components → src/components}/table/components/DefaultTableContainer.vue.d.ts +0 -0
  150. /package/es/{components → src/components}/table/components/SizeControl.vue.d.ts +0 -0
  151. /package/es/{components → src/components}/table/components/icons/ColumnHeightOutlined.vue.d.ts +0 -0
  152. /package/es/{components → src/components}/table/components/icons/DownOutlined.vue.d.ts +0 -0
  153. /package/es/{components → src/components}/table/components/icons/FilterOutlined.vue.d.ts +0 -0
  154. /package/es/{components → src/components}/table/components/index.d.ts +0 -0
  155. /package/es/{components → src/components}/table/hooks/index.d.ts +0 -0
  156. /package/es/{components → src/components}/table/hooks/useTable.d.ts +0 -0
  157. /package/es/{components → src/components}/table/index.d.ts +0 -0
  158. /package/es/{components → src/components}/table/types/index.d.ts +0 -0
  159. /package/es/{locale → src/locale}/index.d.ts +0 -0
  160. /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, onBeforeUnmount, watch, watchEffect, normalizeStyle, useModel, onMounted, mergeModels, 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, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, 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": {
@@ -177,6 +180,7 @@ function useGroupFieldAttrs(validFields) {
177
180
  const config = INJECT_CONFIG["pro-form-item"];
178
181
  const injectFormItemProps = inject(config.injectionKey, config.default);
179
182
  return computed(() => {
183
+ const rawInject = toValue(injectFormItemProps) || {};
180
184
  return validFields.value.map((field) => {
181
185
  let gridItemProps2 = {};
182
186
  let formItemProps2 = {};
@@ -195,7 +199,7 @@ function useGroupFieldAttrs(validFields) {
195
199
  xl,
196
200
  xxl,
197
201
  ...injectRest
198
- } = injectFormItemProps;
202
+ } = rawInject;
199
203
  const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, xxl, span: injectSpan };
200
204
  gridItemProps2 = fields ? { span: span ?? 24 } : initGridItemProps;
201
205
  formItemProps2 = mergeProps(
@@ -248,46 +252,58 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
248
252
  ...{ name: "BaseFormItem", inheritAttrs: false },
249
253
  __name: "index",
250
254
  props: {
251
- grid: { type: [Boolean, Object], default: () => void 0 },
255
+ grid: { type: [Boolean, Object], default: void 0 },
252
256
  fields: { default: () => [] },
253
- disabled: { type: Boolean, default: () => void 0 }
257
+ disabled: { type: Boolean, default: void 0 }
254
258
  },
255
259
  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));
260
+ const props = __props;
261
+ const validFields = computed(
262
+ () => (props.fields ?? []).filter((field) => !field.hidden)
263
+ );
264
+ useProviderDisabled(computed(() => props.disabled));
261
265
  const config = INJECT_CONFIG["pro-form"];
262
- const { grid: injectGrid } = inject(config.injectionKey, config.default);
266
+ const injectFormConfig = inject(config.injectionKey, config.default);
267
+ const injectGrid = computed(() => {
268
+ var _a;
269
+ return (_a = toValue(injectFormConfig)) == null ? void 0 : _a.grid;
270
+ });
263
271
  const enableGrid = computed(() => {
264
- if (__props.grid !== void 0) return !!__props.grid;
265
- return !!injectGrid;
272
+ if (props.grid !== void 0) return !!props.grid;
273
+ return !!injectGrid.value;
266
274
  });
267
275
  const computedGridProps = computed(() => {
268
- return enableGrid.value ? { ...getObject(injectGrid), ...getObject(__props.grid) } : {};
276
+ return enableGrid.value ? { ...getObject(injectGrid.value), ...getObject(props.grid) } : {};
269
277
  });
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
- });
278
+ const formItemInstanceMap = /* @__PURE__ */ new WeakMap();
279
+ const componentInstanceMap = /* @__PURE__ */ new WeakMap();
280
+ const setFormItemRef = (field, el, formItemProps2) => {
281
+ if (!field || typeof field !== "object") return;
282
+ const raw = toRaw(field);
283
+ if (el) {
284
+ formItemInstanceMap.set(raw, el);
285
+ raw.getFormItemRef = () => formItemInstanceMap.get(raw);
286
+ raw.getFormItemComputedProps = () => formItemProps2;
287
+ } else {
288
+ formItemInstanceMap.delete(raw);
289
+ }
278
290
  };
279
- const onComponentMounted = (index2) => {
280
- const field = validFields.value[index2];
281
- Object.assign(field, {
282
- getComponentRef: () => {
291
+ const setComponentRef = (field, el) => {
292
+ if (!field || typeof field !== "object") return;
293
+ const raw = toRaw(field);
294
+ if (el) {
295
+ componentInstanceMap.set(raw, el);
296
+ raw.getComponentRef = () => {
283
297
  var _a;
284
- return (_a = componentRefs[index2]) == null ? void 0 : _a.getComponentRef();
285
- },
286
- getComponentComputedProps: () => {
298
+ return (_a = componentInstanceMap.get(raw)) == null ? void 0 : _a.getComponentRef();
299
+ };
300
+ raw.getComponentComputedProps = () => {
287
301
  var _a;
288
- return (_a = componentRefs[index2]) == null ? void 0 : _a.getComponentComputedProps();
289
- }
290
- });
302
+ return (_a = componentInstanceMap.get(raw)) == null ? void 0 : _a.getComponentComputedProps();
303
+ };
304
+ } else {
305
+ componentInstanceMap.delete(raw);
306
+ }
291
307
  };
292
308
  const groupedFields = useGroupFieldAttrs(validFields);
293
309
  return (_ctx, _cache) => {
@@ -309,25 +325,23 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
309
325
  default: withCtx(() => [
310
326
  createVNode(unref(FormItem), mergeProps({ ref_for: true }, item.formItemProps, {
311
327
  ref_for: true,
312
- ref: (el) => formItemRefs[index2] = el,
328
+ ref: (el) => setFormItemRef(item.rawField, el, item.formItemProps),
313
329
  name: unref(toPath)(item.path),
314
- path: item.path,
315
- onVnodeMounted: ($event) => onFormItemMounted(index2, item.formItemProps)
330
+ path: item.path
316
331
  }), createSlots({
317
332
  default: withCtx(() => [
318
333
  item.rawField.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
319
334
  key: 0,
320
- grid: item.rawField.grid ?? __props.grid,
335
+ grid: item.rawField.grid ?? props.grid,
321
336
  fields: item.rawField.fields,
322
337
  disabled: toValue(item.rawField.disabled)
323
338
  }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(unref(_sfc_main$d), mergeProps({
324
339
  key: 1,
325
340
  ref_for: true,
326
- ref: (el) => componentRefs[index2] = el
341
+ ref: (el) => setComponentRef(item.rawField, el)
327
342
  }, { ref_for: true }, item.componentProps, {
328
- path: item.path,
329
- onVnodeMounted: ($event) => onComponentMounted(index2)
330
- }), null, 16, ["path", "onVnodeMounted"]))
343
+ path: item.path
344
+ }), null, 16, ["path"]))
331
345
  ]),
332
346
  _: 2
333
347
  }, [
@@ -342,7 +356,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
342
356
  ])
343
357
  };
344
358
  })
345
- ]), 1040, ["name", "path", "onVnodeMounted"])
359
+ ]), 1040, ["name", "path"])
346
360
  ]),
347
361
  _: 2
348
362
  }, 1032, ["component", "path"])
@@ -372,14 +386,11 @@ const getPlaceholderProps = (key, injectProps, t) => {
372
386
  if (!placeholderKey || injectProps.placeholder !== void 0) return {};
373
387
  return { placeholder: t(placeholderKey) };
374
388
  };
375
- const getInitProps = (field, t) => {
389
+ const getInitProps = (field, injectProps = {}, t) => {
376
390
  const { component } = field;
377
391
  const picker = component === "date-picker" ? "" : field.picker;
378
392
  if (typeof component === "string") {
379
393
  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
394
  return { ...injectProps, ...getPlaceholderProps(k, injectProps, t) };
384
395
  }
385
396
  return {};
@@ -408,25 +419,27 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
408
419
  ...{ name: "BaseField", inheritAttrs: false },
409
420
  __name: "index",
410
421
  props: {
411
- component: { default: () => void 0 },
422
+ component: { default: void 0 },
412
423
  path: { default: "" }
413
424
  },
414
425
  setup(__props, { expose: __expose }) {
426
+ const props = __props;
415
427
  const { t } = useLocale();
416
428
  const form = useForm(false);
417
- const { getFormData, setFormData } = form;
418
429
  const componentRef = ref();
419
430
  const formItemContext = useInjectFormItemContext();
420
431
  const triggerFormItemChange = () => {
421
432
  formItemContext.onFieldChange();
422
433
  };
423
434
  const attrs = useAttrs();
424
- function getOldValue() {
425
- return cloneDeep(getFormData == null ? void 0 : getFormData(__props.path));
426
- }
435
+ const pickerVal = attrs.picker;
436
+ const injectConfigKey = typeof props.component === "string" ? [props.component, pickerVal].filter(Boolean).join(".") : "";
437
+ const componentInjectConfig = injectConfigKey ? getInjectConfig(injectConfigKey) : void 0;
438
+ const rawInjectComponentProps = componentInjectConfig ? inject(componentInjectConfig.injectionKey, componentInjectConfig.default) : void 0;
427
439
  const value = computed({
428
440
  get() {
429
- let val = getFormData == null ? void 0 : getFormData(__props.path);
441
+ var _a;
442
+ let val = (_a = form.getFormData) == null ? void 0 : _a.call(form, props.path);
430
443
  const { valueFormatter } = groupedAttrs.value;
431
444
  if (typeof valueFormatter === "object" && typeof valueFormatter.get === "function") {
432
445
  val = valueFormatter.get(val);
@@ -434,38 +447,36 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
434
447
  return val;
435
448
  },
436
449
  set(val) {
450
+ var _a, _b;
437
451
  let newVal = val;
438
452
  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
- }
453
+ const setFormatter = typeof valueFormatter === "function" ? valueFormatter : typeof valueFormatter === "object" && typeof (valueFormatter == null ? void 0 : valueFormatter.set) === "function" ? valueFormatter.set : void 0;
454
+ if (setFormatter) {
455
+ const oldVal = setFormatter.length > 1 ? cloneDeep((_a = form.getFormData) == null ? void 0 : _a.call(form, props.path)) : void 0;
456
+ newVal = setFormatter(val, oldVal);
445
457
  }
446
- setFormData == null ? void 0 : setFormData(__props.path, newVal);
458
+ (_b = form.setFormData) == null ? void 0 : _b.call(form, props.path, newVal);
447
459
  triggerFormItemChange();
448
460
  }
449
461
  });
450
462
  const parentDisabled = useInjectDisabled();
451
463
  const groupedAttrs = computed(() => {
464
+ const currentInjectProps = toValue(rawInjectComponentProps) || {};
452
465
  const initProps = getInitProps(
453
- {
454
- component: __props.component,
455
- picker: attrs.picker
456
- },
466
+ { component: props.component, picker: attrs.picker },
467
+ currentInjectProps,
457
468
  t
458
469
  );
470
+ const effectiveModelProp = attrs.modelProp ?? initProps.modelProp ?? "value";
459
471
  const mergedProps = mergeProps(
460
472
  initProps,
461
473
  attrs,
462
474
  { class: attrs.componentClass, style: attrs.componentStyle },
463
475
  { class: initProps.componentClass, style: initProps.componentStyle },
464
476
  { disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
465
- { modelProp: attrs.modelProp ?? initProps.modelProp ?? "value" }
477
+ { modelProp: effectiveModelProp }
466
478
  );
467
- const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, ...rest } = mergedProps;
468
- const bindAttrs = omit(rest, [modelProp, `onUpdate:${modelProp}`]);
479
+ const { valueFormatter, modelProp, slots, componentClass, componentStyle, componentContainer, [effectiveModelProp]: _modelVal, [`onUpdate:${effectiveModelProp}`]: _onUpdateModelVal, ...bindAttrs } = mergedProps;
469
480
  return {
470
481
  attrs: bindAttrs,
471
482
  slots,
@@ -477,12 +488,17 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
477
488
  const formSlots = inject(InjectionFormSlotsKey, void 0);
478
489
  const customComponents = inject(INJECT_COMPONENTS, {});
479
490
  const is = computed(() => {
480
- const teleportSlot = __props.path && (formSlots == null ? void 0 : formSlots[__props.path]);
491
+ const teleportSlot = props.path && (formSlots == null ? void 0 : formSlots[props.path]);
481
492
  if (teleportSlot) return teleportSlot;
482
- if (typeof __props.component === "string") {
483
- return customComponents[__props.component] || componentMap[__props.component] || __props.component;
493
+ if (typeof props.component === "string") {
494
+ const resolved = customComponents[props.component] || componentMap[props.component];
495
+ if (resolved) return resolved;
496
+ console.warn(
497
+ `[pro-components] 未识别的组件类型 "${props.component}",已降级为原生元素渲染。如为自定义组件请在 componentMap 或 ProComponentProvider 中注册。`
498
+ );
499
+ return props.component;
484
500
  }
485
- return __props.component;
501
+ return props.component;
486
502
  });
487
503
  __expose({
488
504
  getComponentRef: () => componentRef.value,
@@ -491,7 +507,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
491
507
  return (_ctx, _cache) => {
492
508
  return openBlock(), createBlock(unref(_sfc_main$c), {
493
509
  component: groupedAttrs.value.componentContainer,
494
- path: __props.path
510
+ path: props.path
495
511
  }, {
496
512
  default: withCtx(() => [
497
513
  is.value ? (openBlock(), createBlock(resolveDynamicComponent(is.value), mergeProps({ key: 0 }, groupedAttrs.value.attrs, {
@@ -499,13 +515,15 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
499
515
  ref: componentRef,
500
516
  [`${groupedAttrs.value.modelProp}`]: value.value,
501
517
  [`onUpdate:${groupedAttrs.value.modelProp}`]: _cache[0] || (_cache[0] = ($event) => value.value = $event),
502
- path: __props.path
518
+ path: props.path
503
519
  }), createSlots({ _: 2 }, [
504
520
  renderList(groupedAttrs.value.slots, (slot, name) => {
505
521
  return {
506
522
  name,
507
523
  fn: withCtx((scoped) => [
508
- createVNode(unref(_sfc_main$b), mergeProps({ path: __props.path }, scoped, { component: slot }), null, 16, ["path", "component"])
524
+ createVNode(unref(_sfc_main$b), mergeProps({
525
+ path: props.path
526
+ }, scoped, { component: slot }), null, 16, ["path", "component"])
509
527
  ])
510
528
  };
511
529
  })
@@ -520,11 +538,12 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
520
538
  ...{ name: "ContainerFragment", inheritAttrs: false },
521
539
  __name: "index",
522
540
  props: {
523
- component: { type: [Object, Function] }
541
+ component: { type: [Object, Function], default: void 0 }
524
542
  },
525
543
  setup(__props) {
544
+ const props = __props;
526
545
  return (_ctx, _cache) => {
527
- return __props.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), {
546
+ return props.component ? (openBlock(), createBlock(resolveDynamicComponent(props.component), normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), {
528
547
  default: withCtx(() => [
529
548
  renderSlot(_ctx.$slots, "default")
530
549
  ]),
@@ -537,12 +556,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
537
556
  ...{ name: "SlotComponent", inheritAttrs: false },
538
557
  __name: "index",
539
558
  props: {
540
- component: { type: [Object, Function, String, Number, Boolean, null] }
559
+ component: { type: [Object, Function, String, Number, Boolean, null], default: void 0 }
541
560
  },
542
561
  setup(__props) {
562
+ const props = __props;
543
563
  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)
564
+ 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 }, [
565
+ createTextVNode(toDisplayString(props.component), 1)
546
566
  ], 64));
547
567
  };
548
568
  }
@@ -552,30 +572,78 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
552
572
  __name: "index",
553
573
  props: {
554
574
  grid: { type: [Boolean, Object], default: false },
555
- form: { default: () => ({}) }
575
+ form: { default: void 0 }
556
576
  },
557
577
  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
578
+ const props = __props;
579
+ const fallbackForm = props.form ? void 0 : useForm();
580
+ const currentForm = computed(
581
+ () => props.form ?? fallbackForm
564
582
  );
583
+ const formProxy = new Proxy({}, {
584
+ get(_, prop) {
585
+ const target = currentForm.value;
586
+ const val = target == null ? void 0 : target[prop];
587
+ if (typeof val === "function") {
588
+ return (...args) => {
589
+ var _a, _b;
590
+ return (_b = (_a = currentForm.value) == null ? void 0 : _a[prop]) == null ? void 0 : _b.call(_a, ...args);
591
+ };
592
+ }
593
+ return val;
594
+ },
595
+ set(_, prop, value) {
596
+ if (currentForm.value) {
597
+ currentForm.value[prop] = value;
598
+ }
599
+ return true;
600
+ },
601
+ has(_, prop) {
602
+ return Boolean(currentForm.value && prop in currentForm.value);
603
+ }
604
+ });
605
+ provide(InjectionFormKey, formProxy);
606
+ const fields = computed(() => {
607
+ var _a;
608
+ const f = (_a = currentForm.value) == null ? void 0 : _a.fields;
609
+ return (Array.isArray(f) ? f : f == null ? void 0 : f.value) ?? [];
610
+ });
611
+ const formData = computed(() => {
612
+ var _a;
613
+ return (_a = currentForm.value) == null ? void 0 : _a.formData;
614
+ });
615
+ const setFormRef = (el) => {
616
+ var _a, _b;
617
+ return (_b = (_a = currentForm.value) == null ? void 0 : _a.setFormRef) == null ? void 0 : _b.call(_a, el);
618
+ };
619
+ let formInstanceCounter = 0;
620
+ const formInstanceKeyMap = /* @__PURE__ */ new WeakMap();
621
+ const getFormKey = (f) => {
622
+ if (!formInstanceKeyMap.has(f)) {
623
+ formInstanceKeyMap.set(f, ++formInstanceCounter);
624
+ }
625
+ return formInstanceKeyMap.get(f);
626
+ };
627
+ const formKey = computed(() => getFormKey(currentForm.value));
628
+ const config = INJECT_CONFIG["pro-form"];
629
+ const injectFormConfig = inject(config.injectionKey, config.default);
630
+ const injectAttrs = computed(() => {
631
+ const raw = toValue(injectFormConfig);
632
+ const { grid: _injectGrid, ...rest } = raw || {};
633
+ return rest;
634
+ });
565
635
  const slots = useSlots();
566
- provide(InjectionFormSlotsKey, reactive(slots));
636
+ provide(InjectionFormSlotsKey, slots);
567
637
  return (_ctx, _cache) => {
568
638
  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" }), {
639
+ key: formKey.value,
640
+ ref: setFormRef,
641
+ model: formData.value
642
+ }, mergeProps(injectAttrs.value, unref(camelizeProperties)(_ctx.$attrs)), { class: "pro-form" }), {
575
643
  default: withCtx(() => [
576
644
  createVNode(unref(_sfc_main$e), {
577
- fields: unref(fields),
578
- grid: __props.grid
645
+ fields: fields.value,
646
+ grid: props.grid
579
647
  }, null, 8, ["fields", "grid"]),
580
648
  renderSlot(_ctx.$slots, "default")
581
649
  ]),
@@ -617,7 +685,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
617
685
  ...{ name: "SearchForm" },
618
686
  __name: "SearchForm",
619
687
  props: {
620
- form: {},
688
+ form: { default: void 0 },
621
689
  layout: { default: "grid" },
622
690
  expand: { type: [Boolean, Object], default: true },
623
691
  searchButton: { type: [Object, Function, Boolean], default: void 0 },
@@ -631,6 +699,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
631
699
  emits: ["search", "reset"],
632
700
  setup(__props, { emit: __emit }) {
633
701
  const { t } = useLocale();
702
+ const props = __props;
634
703
  const emit = __emit;
635
704
  const proFormHeight = ref("unset");
636
705
  const collapseHeight = ref(0);
@@ -651,43 +720,43 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
651
720
  cleanupObservers();
652
721
  });
653
722
  const computedExpand = computed(() => {
654
- if (!__props.expand) return false;
655
- if (__props.expand === true) return { minExpandRows: 2, expandStatus: false };
723
+ if (!props.expand) return false;
724
+ if (props.expand === true) return { minExpandRows: 2, expandStatus: false };
656
725
  return {
657
- minExpandRows: Math.max(Math.floor(__props.expand.minExpandRows ?? 2), 1),
658
- expandStatus: __props.expand.expandStatus ?? false
726
+ minExpandRows: Math.max(Math.floor(props.expand.minExpandRows ?? 2), 1),
727
+ expandStatus: props.expand.expandStatus ?? false
659
728
  };
660
729
  });
661
730
  const showExpandToggle = ref(false);
662
731
  const expandStatus = ref(true);
663
- const { formRef, getFormData } = __props.form;
664
732
  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;
733
+ var _a, _b, _c, _d, _e, _f, _g, _h;
734
+ if (!props.expand || !((_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value)) return;
735
+ const proFormEl = (_c = props.form.formRef.value) == null ? void 0 : _c.$el;
668
736
  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;
737
+ const itemHeight = (_f = (_e = (_d = proFormEl == null ? void 0 : proFormEl.querySelector("[class*='-form-item']")) == null ? void 0 : _d.getBoundingClientRect) == null ? void 0 : _e.call(_d)) == null ? void 0 : _f.height;
670
738
  if (itemHeight && itemHeight > 0) {
671
739
  rowHeight.value = itemHeight;
672
740
  }
673
- const naturalHeight = proFormEl.scrollHeight || ((_f = (_e = proFormEl.getBoundingClientRect) == null ? void 0 : _e.call(proFormEl)) == null ? void 0 : _f.height) || 0;
741
+ const naturalHeight = proFormEl.scrollHeight || ((_h = (_g = proFormEl.getBoundingClientRect) == null ? void 0 : _g.call(proFormEl)) == null ? void 0 : _h.height) || 0;
674
742
  if (naturalHeight > 0) {
675
743
  proFormHeight.value = naturalHeight;
676
744
  }
677
745
  };
746
+ const isManualToggle = ref(false);
678
747
  const changeExpandStatus = () => {
748
+ isManualToggle.value = true;
679
749
  expandStatus.value = !expandStatus.value;
680
- nextTick(() => {
681
- updateHeights();
682
- });
683
750
  };
684
751
  const hasFieldValue = (val) => val !== null && val !== void 0 && val !== "" && !(Array.isArray(val) && val.length === 0) && !(typeof val === "object" && Object.keys(val).length === 0);
685
752
  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(
753
+ var _a, _b, _c;
754
+ if (isManualToggle.value) return;
755
+ const initStatus = computedExpand.value ? computedExpand.value.expandStatus : false;
756
+ expandStatus.value = initStatus;
757
+ if (((_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value) && computedExpand.value) {
758
+ const formEl = props.form.formRef.value.$el;
759
+ const formItemsEl = (_c = formEl == null ? void 0 : formEl.querySelectorAll) == null ? void 0 : _c.call(
691
760
  formEl,
692
761
  "[class*='-form-item'] > [path]"
693
762
  );
@@ -697,13 +766,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
697
766
  }
698
767
  intersectionObserver = new IntersectionObserver(
699
768
  (entries) => {
769
+ if (isManualToggle.value) return;
700
770
  expandStatus.value = entries.some((e) => {
771
+ var _a2, _b2;
701
772
  if (e.intersectionRatio === 0) {
702
773
  const path = e.target.getAttribute("path");
703
- const searchFieldValue = path ? getFormData == null ? void 0 : getFormData(path) : void 0;
774
+ const searchFieldValue = path ? (_b2 = (_a2 = props.form) == null ? void 0 : _a2.getFormData) == null ? void 0 : _b2.call(_a2, path) : void 0;
704
775
  return hasFieldValue(searchFieldValue);
705
776
  }
706
- return __props.expand.expandStatus;
777
+ return computedExpand.value ? computedExpand.value.expandStatus : false;
707
778
  });
708
779
  intersectionObserver == null ? void 0 : intersectionObserver.disconnect();
709
780
  },
@@ -718,10 +789,13 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
718
789
  [
719
790
  () => {
720
791
  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;
792
+ 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;
793
+ },
794
+ () => {
795
+ var _a, _b;
796
+ return (_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value;
722
797
  },
723
- () => formRef.value,
724
- () => __props.expand
798
+ () => props.expand
725
799
  ],
726
800
  () => {
727
801
  updateHeights();
@@ -729,7 +803,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
729
803
  { flush: "post", immediate: true }
730
804
  );
731
805
  watch(
732
- () => formRef.value,
806
+ () => {
807
+ var _a, _b;
808
+ return (_b = (_a = props.form) == null ? void 0 : _a.formRef) == null ? void 0 : _b.value;
809
+ },
733
810
  (val) => {
734
811
  if (resizeObserver) {
735
812
  resizeObserver.disconnect();
@@ -748,10 +825,10 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
748
825
  watchEffect(
749
826
  () => {
750
827
  if (typeof proFormHeight.value !== "number") return;
751
- if (__props.layout === "grid" && computedExpand.value) {
828
+ if (props.layout === "grid" && computedExpand.value) {
752
829
  const { minExpandRows } = computedExpand.value;
753
830
  collapseHeight.value = Math.min(
754
- minExpandRows * rowHeight.value + (minExpandRows - 1) * __props.rowGap,
831
+ minExpandRows * rowHeight.value + (minExpandRows - 1) * props.rowGap,
755
832
  +proFormHeight.value
756
833
  );
757
834
  showExpandToggle.value = +proFormHeight.value - collapseHeight.value > 1;
@@ -764,23 +841,21 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
764
841
  },
765
842
  { flush: "post" }
766
843
  );
767
- const layoutProps = computed(
768
- () => __props.layout === "grid" ? {
844
+ const layoutProps = computed(() => {
845
+ const currentHeight = expandStatus.value ? proFormHeight.value : collapseHeight.value;
846
+ const heightStyle = currentHeight !== "unset" && currentHeight !== void 0 ? `${currentHeight}px` : void 0;
847
+ return props.layout === "grid" ? {
769
848
  grid: {
770
- gutter: [__props.columnGap, __props.rowGap],
849
+ gutter: [props.columnGap, props.rowGap],
771
850
  style: { flex: 1, marginRight: "12px" }
772
851
  },
773
- style: {
774
- display: "flex",
775
- overflow: "hidden",
776
- height: `${expandStatus.value ? proFormHeight.value : collapseHeight.value}px`
777
- }
852
+ style: { display: "flex", overflow: "hidden", height: heightStyle }
778
853
  } : {
779
854
  layout: "inline",
780
- style: { gap: `${__props.rowGap}px ${__props.columnGap}px` },
855
+ style: { gap: `${props.rowGap}px ${props.columnGap}px` },
781
856
  grid: false
782
- }
783
- );
857
+ };
858
+ });
784
859
  const onReset = () => {
785
860
  emit("reset");
786
861
  };
@@ -789,7 +864,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
789
864
  };
790
865
  return (_ctx, _cache) => {
791
866
  return openBlock(), createBlock(unref(_sfc_main$a), mergeProps(layoutProps.value, {
792
- form: __props.form,
867
+ form: props.form,
793
868
  class: "pro-table_search-form transition"
794
869
  }), {
795
870
  default: withCtx(() => [
@@ -798,9 +873,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
798
873
  class: "pro-table_search-form_button-group"
799
874
  }, {
800
875
  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), {
876
+ renderSlot(_ctx.$slots, "reset-button", { onReset }, () => [
877
+ props.resetButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
878
+ props.resetButton ? (openBlock(), createBlock(resolveDynamicComponent(props.resetButton), {
804
879
  key: 0,
805
880
  onClick: onReset
806
881
  })) : (openBlock(), createBlock(unref(Button), {
@@ -815,9 +890,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
815
890
  }))
816
891
  ], 64)) : createCommentVNode("", true)
817
892
  ], 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), {
893
+ renderSlot(_ctx.$slots, "search-button", { onSearch }, () => [
894
+ props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
895
+ props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(props.searchButton), {
821
896
  key: 0,
822
897
  onClick: onSearch
823
898
  })) : (openBlock(), createBlock(unref(Button), {
@@ -834,9 +909,12 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
834
909
  }))
835
910
  ], 64)) : createCommentVNode("", true)
836
911
  ], 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), {
912
+ renderSlot(_ctx.$slots, "expand-button", {
913
+ expandStatus: expandStatus.value,
914
+ changeExpandStatus
915
+ }, () => [
916
+ props.expandButton !== false && showExpandToggle.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
917
+ props.expandButton ? (openBlock(), createBlock(resolveDynamicComponent(props.expandButton), {
840
918
  key: 0,
841
919
  "expand-status": expandStatus.value,
842
920
  onClick: changeExpandStatus
@@ -866,7 +944,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
866
944
  };
867
945
  }
868
946
  });
869
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-7bd701e4"]]);
947
+ const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-9dca0a5d"]]);
870
948
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
871
949
  __name: "DefaultSearchFormContainer",
872
950
  setup(__props) {
@@ -921,11 +999,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
921
999
  },
922
1000
  emits: ["update:size"],
923
1001
  setup(__props) {
924
- var _a;
925
1002
  const { t } = useLocale();
926
1003
  const configContext = useConfigContextInject();
927
1004
  const size = useModel(__props, "size");
928
- size.value = size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
1005
+ const currentSize = computed(
1006
+ () => {
1007
+ var _a;
1008
+ return size.value ?? ((_a = configContext.componentSize) == null ? void 0 : _a.value) ?? "large";
1009
+ }
1010
+ );
929
1011
  const onSizeChange = (val) => {
930
1012
  size.value = val.key;
931
1013
  };
@@ -942,7 +1024,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
942
1024
  overlay: withCtx(() => [
943
1025
  createVNode(unref(Menu), {
944
1026
  style: { "width": "100px", "text-align": "center" },
945
- "selected-keys": size.value ? [size.value] : [],
1027
+ "selected-keys": [currentSize.value],
946
1028
  items: sizeOptions.value,
947
1029
  onClick: onSizeChange
948
1030
  }, null, 8, ["selected-keys", "items"])
@@ -963,7 +1045,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
963
1045
  };
964
1046
  }
965
1047
  });
966
- const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a718ce24"]]);
1048
+ const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2ac95d3b"]]);
967
1049
  const _sfc_main$3 = {};
968
1050
  const _hoisted_1$1 = {
969
1051
  focusable: "false",
@@ -984,23 +1066,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
984
1066
  __name: "ColumnControl",
985
1067
  props: {
986
1068
  columns: {},
987
- table: { default: () => void 0 },
988
- columnControl: { default: () => void 0 }
1069
+ table: { default: void 0 },
1070
+ columnControl: { default: void 0 }
989
1071
  },
990
1072
  setup(__props) {
1073
+ const props = __props;
991
1074
  const { t } = useLocale();
992
1075
  const open = ref(false);
993
1076
  const checkAll = ref(false);
994
1077
  const indeterminate = ref(false);
995
1078
  const checkedColumnsOptions = computed(
996
- () => __props.columns.flatMap((item) => {
1079
+ () => props.columns.flatMap((item) => {
997
1080
  var _a, _b, _c, _d, _e, _f;
998
1081
  const rawKey = item.key ?? (Array.isArray(item.dataIndex) ? item.dataIndex.join(".") : item.dataIndex);
999
1082
  if (!rawKey || !item.title) return [];
1000
1083
  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);
1084
+ if ((_b = (_a = props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key))
1085
+ return [];
1086
+ const disabled = ((_d = (_c = props.columnControl) == null ? void 0 : _c.disabledKeys) == null ? void 0 : _d.some((dk) => String(dk) === key)) ?? false;
1087
+ const label = ((_f = (_e = props.columnControl) == null ? void 0 : _e.labels) == null ? void 0 : _f[key]) ?? (typeof item.title === "string" ? item.title : key);
1004
1088
  return {
1005
1089
  label,
1006
1090
  value: key,
@@ -1022,7 +1106,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1022
1106
  checkedColumnsOptions.value.forEach((item) => {
1023
1107
  var _a, _b;
1024
1108
  if (item.disabled) return;
1025
- (_b = (_a = __props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, item.value, {
1109
+ (_b = (_a = props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, item.value, {
1026
1110
  hidden: !val.includes(item.value)
1027
1111
  });
1028
1112
  });
@@ -1056,20 +1140,20 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1056
1140
  );
1057
1141
  onMounted(() => {
1058
1142
  var _a, _b;
1059
- (_b = (_a = __props.columnControl) == null ? void 0 : _a.disabledKeys) == null ? void 0 : _b.forEach((key) => {
1143
+ (_b = (_a = props.columnControl) == null ? void 0 : _a.disabledKeys) == null ? void 0 : _b.forEach((key) => {
1060
1144
  var _a2, _b2;
1061
- (_b2 = (_a2 = __props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b2.call(_a2, String(key), { hidden: false });
1145
+ (_b2 = (_a2 = props.table) == null ? void 0 : _a2.setColumn) == null ? void 0 : _b2.call(_a2, String(key), { hidden: false });
1062
1146
  });
1063
1147
  });
1064
1148
  watch(
1065
1149
  () => {
1066
1150
  var _a;
1067
- return (_a = __props.columnControl) == null ? void 0 : _a.disabledKeys;
1151
+ return (_a = props.columnControl) == null ? void 0 : _a.disabledKeys;
1068
1152
  },
1069
1153
  (keys) => {
1070
1154
  keys == null ? void 0 : keys.forEach((key) => {
1071
1155
  var _a, _b;
1072
- (_b = (_a = __props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, String(key), { hidden: false });
1156
+ (_b = (_a = props.table) == null ? void 0 : _a.setColumn) == null ? void 0 : _b.call(_a, String(key), { hidden: false });
1073
1157
  });
1074
1158
  },
1075
1159
  { deep: true }
@@ -1089,7 +1173,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1089
1173
  default: withCtx(() => {
1090
1174
  var _a, _b;
1091
1175
  return [
1092
- !((_a = __props.columnControl) == null ? void 0 : _a.disableCheckAll) ? (openBlock(), createBlock(unref(MenuItem), {
1176
+ !((_a = props.columnControl) == null ? void 0 : _a.disableCheckAll) ? (openBlock(), createBlock(unref(MenuItem), {
1093
1177
  key: 0,
1094
1178
  onClick: onCheckAllChange
1095
1179
  }, {
@@ -1149,7 +1233,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1149
1233
  };
1150
1234
  }
1151
1235
  });
1152
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-9899456e"]]);
1236
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-04235d0e"]]);
1153
1237
  const _hoisted_1 = { class: "pro-table_header" };
1154
1238
  const _hoisted_2 = {
1155
1239
  key: 0,
@@ -1171,32 +1255,36 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1171
1255
  ...{ name: "ProTable", inheritAttrs: false },
1172
1256
  __name: "ProTable",
1173
1257
  props: /* @__PURE__ */ mergeModels({
1174
- table: { default: () => void 0 },
1258
+ table: { default: void 0 },
1175
1259
  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 },
1260
+ addIndexColumn: { type: Boolean, default: void 0 },
1261
+ immediateSearch: { type: Boolean, default: void 0 },
1262
+ control: { type: [Boolean, Object], default: void 0 },
1263
+ searchFormConfig: { default: void 0 },
1180
1264
  tableContainer: { type: [Object, Function, Boolean], default: void 0 }
1181
1265
  }, {
1182
1266
  "size": {},
1183
1267
  "sizeModifiers": {},
1184
- "loading": { type: Boolean },
1268
+ "loading": { type: Boolean, ...{ default: false } },
1185
1269
  "loadingModifiers": {}
1186
1270
  }),
1187
1271
  emits: ["update:size", "update:loading"],
1188
1272
  setup(__props) {
1273
+ const props = __props;
1189
1274
  const { t } = useLocale();
1190
1275
  const config = INJECT_CONFIG["pro-table"];
1191
- const injectProps = inject(config.injectionKey, config.default);
1276
+ const injectPropsRaw = inject(config.injectionKey, config.default);
1277
+ const injectProps = computed(() => toValue(injectPropsRaw) || {});
1192
1278
  const tableProperties = Object.keys(tableProps());
1193
- const injectAttrs = pick(injectProps, tableProperties);
1279
+ const injectAttrs = computed(
1280
+ () => pick(injectProps.value, tableProperties)
1281
+ );
1194
1282
  const computedSearchFormConfig = computed(() => {
1195
1283
  var _a, _b;
1196
- const container = ((_a = __props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
1284
+ const container = ((_a = props.searchFormConfig) == null ? void 0 : _a.container) ?? ((_b = injectProps.value.searchFormConfig) == null ? void 0 : _b.container) ?? DefaultSearchFormContainer;
1197
1285
  return {
1198
- ...injectProps.searchFormConfig,
1199
- ...getObject(__props.searchFormConfig),
1286
+ ...injectProps.value.searchFormConfig,
1287
+ ...getObject(props.searchFormConfig),
1200
1288
  container: container ? container : void 0
1201
1289
  };
1202
1290
  });
@@ -1204,21 +1292,23 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1204
1292
  const tableAttrs = computed(() => {
1205
1293
  return pick(camelizeProperties(attrs), tableProperties);
1206
1294
  });
1207
- const { columns, dataSource, searchForm, pageParam, setPageParam } = __props.table || {};
1208
1295
  const size = useModel(__props, "size");
1209
1296
  const loading = useModel(__props, "loading");
1210
1297
  const _search = async () => {
1211
1298
  var _a;
1212
- try {
1299
+ const searchPromise = (_a = props.search || attrs.onSearch) == null ? void 0 : _a();
1300
+ if (isPromise(searchPromise)) {
1213
1301
  loading.value = true;
1214
- await ((_a = __props.search) == null ? void 0 : _a.call(__props));
1215
- } finally {
1216
- loading.value = false;
1302
+ try {
1303
+ await searchPromise;
1304
+ } finally {
1305
+ loading.value = false;
1306
+ }
1217
1307
  }
1218
1308
  };
1219
1309
  const reset = () => {
1220
- var _a;
1221
- (_a = __props.table) == null ? void 0 : _a.resetQueryParams();
1310
+ var _a, _b;
1311
+ (_b = (_a = props.table) == null ? void 0 : _a.resetQueryParams) == null ? void 0 : _b.call(_a);
1222
1312
  nextTick(() => {
1223
1313
  _search();
1224
1314
  });
@@ -1233,75 +1323,93 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1233
1323
  ...tableSlots
1234
1324
  } = slots;
1235
1325
  const searchPage1st = () => {
1236
- setPageParam == null ? void 0 : setPageParam({ current: 1 });
1326
+ var _a, _b;
1327
+ (_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, { current: 1 });
1237
1328
  _search();
1238
1329
  };
1239
1330
  const computedTableProps = computed(() => {
1240
1331
  return {
1241
- ...injectAttrs,
1332
+ ...injectAttrs.value,
1242
1333
  ...tableAttrs.value,
1243
1334
  pagination: void 0,
1244
1335
  onChange: void 0
1245
1336
  };
1246
1337
  });
1247
1338
  const computedTableContainer = computed(() => {
1248
- const container = __props.tableContainer ?? injectProps.tableContainer ?? DefaultTableContainer;
1339
+ const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
1249
1340
  return container ? container : void 0;
1250
1341
  });
1251
- const indexColumn = () => ({
1342
+ const renderIndex = ({ index: index2 }) => index2 + 1;
1343
+ const indexColumn = computed(() => ({
1252
1344
  title: t("table.index"),
1253
1345
  dataIndex: "_index",
1346
+ key: "_index",
1254
1347
  width: 80,
1255
- customRender: ({ index: index2 }) => index2 + 1
1348
+ customRender: renderIndex
1349
+ }));
1350
+ const computedColumns = computed(() => {
1351
+ var _a;
1352
+ const cols = tableAttrs.value.columns ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? [];
1353
+ const needIndex = props.addIndexColumn ?? injectProps.value.addIndexColumn;
1354
+ return needIndex ? [indexColumn.value, ...cols] : cols;
1256
1355
  });
1257
- const computedColumns = computed(
1258
- () => [
1259
- ...__props.addIndexColumn ?? injectProps.addIndexColumn ? [indexColumn()] : [],
1260
- ...tableAttrs.value.columns ?? (columns == null ? void 0 : columns.value) ?? []
1261
- ]
1262
- );
1263
1356
  const visibleComputedColumns = computed(() => {
1264
1357
  return computedColumns.value.filter((item) => !item.hidden);
1265
1358
  });
1266
1359
  const computedDataSource = computed(() => {
1267
- return tableAttrs.value.dataSource ?? (dataSource == null ? void 0 : dataSource.value);
1360
+ var _a;
1361
+ return tableAttrs.value.dataSource ?? toValue((_a = props.table) == null ? void 0 : _a.dataSource) ?? [];
1268
1362
  });
1269
1363
  const computedPagination = computed(() => {
1270
- var _a, _b;
1364
+ var _a, _b, _c, _d;
1271
1365
  if (tableAttrs.value.pagination === false) return false;
1366
+ if (isPlainObject(tableAttrs.value.pagination)) {
1367
+ const globalPagination = injectAttrs.value.pagination === false ? {} : injectAttrs.value.pagination;
1368
+ return {
1369
+ ...globalPagination,
1370
+ ...(_a = props.table) == null ? void 0 : _a.pageParam,
1371
+ ...tableAttrs.value.pagination,
1372
+ showTotal: ((_b = tableAttrs.value.pagination) == null ? void 0 : _b.showTotal) ?? (globalPagination == null ? void 0 : globalPagination.showTotal) ?? ((total) => t("pagination.total", { total }))
1373
+ };
1374
+ }
1375
+ if (injectAttrs.value.pagination === false) return false;
1272
1376
  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 }))
1377
+ ...injectAttrs.value.pagination,
1378
+ ...(_c = props.table) == null ? void 0 : _c.pageParam,
1379
+ showTotal: ((_d = injectAttrs.value.pagination) == null ? void 0 : _d.showTotal) ?? ((total) => t("pagination.total", { total }))
1277
1380
  };
1278
1381
  });
1279
1382
  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);
1383
+ var _a, _b, _c;
1384
+ (_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, args[0]);
1385
+ (_c = attrs.onChange) == null ? void 0 : _c.call(attrs, ...args);
1283
1386
  _search();
1284
1387
  };
1285
1388
  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);
1389
+ var _a, _b, _c, _d;
1390
+ const searchFields = (_b = (_a = props.table) == null ? void 0 : _a.searchForm) == null ? void 0 : _b.fields;
1391
+ const fieldList = (Array.isArray(searchFields) ? searchFields : searchFields == null ? void 0 : searchFields.value) ?? [];
1392
+ return !!(searchFormSlot || ((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && fieldList.filter((item) => !item.hidden).length > 0);
1288
1393
  });
1289
1394
  const computedControl = computed(() => {
1290
- const mergedControl = __props.control ?? injectProps.control;
1291
- if (typeof mergedControl === "boolean") {
1292
- return { sizeControl: mergedControl, columnControl: mergedControl };
1395
+ const controlConfig = props.control ?? injectProps.value.control;
1396
+ if (controlConfig === true) {
1397
+ return { sizeControl: true, columnControl: true };
1398
+ }
1399
+ if (controlConfig === false) {
1400
+ return { sizeControl: false, columnControl: false };
1293
1401
  }
1294
- const c = mergedControl;
1295
- const sizeControl = c.sizeControl ?? true;
1296
- const columnControl = c.columnControl ?? true;
1297
- return { sizeControl: !!sizeControl, columnControl };
1402
+ return {
1403
+ sizeControl: !!(controlConfig == null ? void 0 : controlConfig.sizeControl),
1404
+ columnControl: (controlConfig == null ? void 0 : controlConfig.columnControl) ?? false
1405
+ };
1298
1406
  });
1299
1407
  const columnControlConfig = computed(() => {
1300
1408
  const cc = computedControl.value.columnControl;
1301
1409
  return typeof cc === "object" ? cc : void 0;
1302
1410
  });
1303
1411
  onMounted(() => {
1304
- if (__props.immediateSearch ?? injectProps.immediateSearch) {
1412
+ if (props.immediateSearch ?? injectProps.value.immediateSearch) {
1305
1413
  _search();
1306
1414
  }
1307
1415
  });
@@ -1315,15 +1423,18 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1315
1423
  component: computedSearchFormConfig.value.container
1316
1424
  }, {
1317
1425
  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)
1426
+ renderSlot(_ctx.$slots, "search-form", {}, () => {
1427
+ var _a;
1428
+ return [
1429
+ ((_a = props.table) == null ? void 0 : _a.searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
1430
+ key: 0,
1431
+ form: props.table.searchForm
1432
+ }, computedSearchFormConfig.value, {
1433
+ onSearch: searchPage1st,
1434
+ onReset: reset
1435
+ }), null, 16, ["form"])) : createCommentVNode("", true)
1436
+ ];
1437
+ }, true)
1327
1438
  ]),
1328
1439
  _: 3
1329
1440
  }, 8, ["component"])) : createCommentVNode("", true),
@@ -1345,7 +1456,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1345
1456
  computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
1346
1457
  createVNode(unref(ColumnControl), {
1347
1458
  columns: computedColumns.value,
1348
- table: __props.table,
1459
+ table: props.table,
1349
1460
  "column-control": columnControlConfig.value
1350
1461
  }, null, 8, ["columns", "table", "column-control"])
1351
1462
  ])) : createCommentVNode("", true)
@@ -1376,7 +1487,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1376
1487
  };
1377
1488
  }
1378
1489
  });
1379
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ff6f01f4"]]);
1490
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5ce28f7b"]]);
1380
1491
  function useTable(params) {
1381
1492
  return useTable$1(params);
1382
1493
  }
@@ -1387,16 +1498,42 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1387
1498
  },
1388
1499
  __name: "index",
1389
1500
  props: {
1390
- componentVars: {},
1391
- componentMap: {},
1392
- locale: {}
1501
+ componentVars: { default: void 0 },
1502
+ componentMap: { default: void 0 },
1503
+ locale: { default: void 0 }
1393
1504
  },
1394
1505
  setup(__props) {
1395
1506
  const props = __props;
1507
+ Object.keys(INJECT_CONFIG).forEach(
1508
+ (key) => {
1509
+ const config = INJECT_CONFIG[key];
1510
+ provide(
1511
+ config.injectionKey,
1512
+ computed(() => {
1513
+ var _a;
1514
+ return {
1515
+ ...config.default,
1516
+ ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1517
+ };
1518
+ })
1519
+ );
1520
+ }
1521
+ );
1396
1522
  if (props.componentVars) {
1397
- Object.entries(props.componentVars).forEach(([key, val]) => {
1398
- const config = ensureInjectConfig(key);
1399
- provide(config.injectionKey, { ...config.default, ...getObject(val) });
1523
+ Object.keys(props.componentVars).forEach((key) => {
1524
+ if (!(key in INJECT_CONFIG)) {
1525
+ const config = ensureInjectConfig(key);
1526
+ provide(
1527
+ config.injectionKey,
1528
+ computed(() => {
1529
+ var _a;
1530
+ return {
1531
+ ...config.default,
1532
+ ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1533
+ };
1534
+ })
1535
+ );
1536
+ }
1400
1537
  });
1401
1538
  }
1402
1539
  if (props.componentMap) {