@qin-ui/element-plus-pro 1.3.5 → 1.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 (93) hide show
  1. package/AI-CONTEXT.md +26 -2
  2. package/README.md +41 -30
  3. package/api.json +69 -38
  4. package/es/components/component-provider/components/index.vue.d.ts +10 -3
  5. package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
  6. package/es/components/component-provider/constants/index.d.ts +22 -4
  7. package/es/components/component-provider/constants/index.d.ts.map +1 -1
  8. package/es/components/component-provider/types/index.d.ts +15 -1
  9. package/es/components/component-provider/types/index.d.ts.map +1 -1
  10. package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  11. package/es/components/form/components/BaseField/utils/index.d.ts +15 -0
  12. package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
  13. package/es/components/form/components/BaseFormItem/index.vue.d.ts +3 -1
  14. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
  15. package/es/components/form/components/ContainerFragment/index.vue.d.ts.map +1 -1
  16. package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
  17. package/es/components/form/components/SlotComponent/index.vue.d.ts.map +1 -1
  18. package/es/components/form/components/index.d.ts +4 -0
  19. package/es/components/form/components/index.d.ts.map +1 -1
  20. package/es/components/form/constants/index.d.ts +8 -2
  21. package/es/components/form/constants/index.d.ts.map +1 -1
  22. package/es/components/form/hooks/useFields.d.ts.map +1 -1
  23. package/es/components/form/hooks/useForm.d.ts.map +1 -1
  24. package/es/components/form/hooks/useGroupFieldAttrs.d.ts +9 -0
  25. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
  26. package/es/components/form/index.d.ts +2 -2
  27. package/es/components/form/index.d.ts.map +1 -1
  28. package/es/components/form/types/index.d.ts +65 -50
  29. package/es/components/form/types/index.d.ts.map +1 -1
  30. package/es/components/form/utils/fieldKey.d.ts +13 -0
  31. package/es/components/form/utils/fieldKey.d.ts.map +1 -0
  32. package/es/components/table/components/ColumnControl.vue.d.ts +1 -1
  33. package/es/components/table/components/ColumnControl.vue.d.ts.map +1 -1
  34. package/es/components/table/components/ProTable.vue.d.ts +15 -1
  35. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  36. package/es/components/table/components/SearchForm.vue.d.ts +13 -1
  37. package/es/components/table/components/SearchForm.vue.d.ts.map +1 -1
  38. package/es/components/table/components/SizeControl.vue.d.ts +7 -2
  39. package/es/components/table/components/SizeControl.vue.d.ts.map +1 -1
  40. package/es/components/table/components/TableColumnRenderer.vue.d.ts +14 -14
  41. package/es/components/table/components/TableColumnRenderer.vue.d.ts.map +1 -1
  42. package/es/components/table/hooks/index.d.ts +2 -0
  43. package/es/components/table/hooks/index.d.ts.map +1 -0
  44. package/es/components/table/{useTable.d.ts → hooks/useTable.d.ts} +3 -3
  45. package/es/components/table/hooks/useTable.d.ts.map +1 -0
  46. package/es/components/table/index.d.ts +6 -2
  47. package/es/components/table/index.d.ts.map +1 -1
  48. package/es/components/table/types/index.d.ts +16 -12
  49. package/es/components/table/types/index.d.ts.map +1 -1
  50. package/es/element-plus-pro.css +14 -14
  51. package/es/index.d.ts +9 -6
  52. package/es/index.d.ts.map +1 -1
  53. package/es/index.js +307 -224
  54. package/es/index.js.map +1 -1
  55. package/es/locale/index.d.ts +2 -1
  56. package/es/locale/index.d.ts.map +1 -1
  57. package/es/shared/core/index.d.ts +1 -1
  58. package/es/shared/core/index.d.ts.map +1 -1
  59. package/es/shared/ui/index.d.ts +20 -2
  60. package/es/shared/ui/index.d.ts.map +1 -1
  61. package/package.json +6 -4
  62. package/src/components/component-provider/components/index.vue +48 -21
  63. package/src/components/component-provider/constants/index.ts +34 -6
  64. package/src/components/component-provider/types/index.ts +21 -7
  65. package/src/components/form/components/BaseField/index.vue +25 -12
  66. package/src/components/form/components/BaseField/utils/index.ts +16 -1
  67. package/src/components/form/components/BaseFormItem/index.vue +24 -28
  68. package/src/components/form/components/ContainerFragment/index.vue +3 -1
  69. package/src/components/form/components/ProForm/index.vue +42 -22
  70. package/src/components/form/components/SlotComponent/index.vue +4 -2
  71. package/src/components/form/components/index.ts +8 -1
  72. package/src/components/form/constants/index.ts +9 -2
  73. package/src/components/form/hooks/useFields.ts +5 -2
  74. package/src/components/form/hooks/useForm.ts +8 -1
  75. package/src/components/form/hooks/useGroupFieldAttrs.ts +24 -17
  76. package/src/components/form/index.ts +1 -3
  77. package/src/components/form/types/index.ts +71 -52
  78. package/src/components/form/utils/fieldKey.ts +27 -0
  79. package/src/components/table/components/ColumnControl.vue +16 -6
  80. package/src/components/table/components/ProTable.vue +183 -93
  81. package/src/components/table/components/SearchForm.vue +60 -22
  82. package/src/components/table/components/SizeControl.vue +23 -1
  83. package/src/components/table/components/TableColumnRenderer.vue +82 -63
  84. package/src/components/table/hooks/index.ts +1 -0
  85. package/src/components/table/{useTable.ts → hooks/useTable.ts} +6 -4
  86. package/src/components/table/index.ts +11 -2
  87. package/src/components/table/types/index.ts +17 -13
  88. package/src/index.ts +13 -7
  89. package/src/locale/index.ts +4 -2
  90. package/src/shared/core/index.ts +11 -0
  91. package/src/shared/ui/index.ts +29 -5
  92. package/tsconfig.json +0 -1
  93. package/es/components/table/useTable.d.ts.map +0 -1
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./element-plus-pro.css";
2
- import { inject, computed, toValue, defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, ref, useAttrs, createCommentVNode, createSlots, renderList, createVNode, resolveComponent, unref, toRaw, provide, useSlots, shallowRef, onUpdated, triggerRef, withModifiers, createElementVNode, normalizeStyle, useModel, watch, mergeModels, onMounted, resolveDirective, normalizeClass, withDirectives, guardReactiveProps, nextTick } from "vue";
3
- import { ElTable, ElPagination, ElCol, ElFormItem, useFormDisabled, ElTransfer, ElTreeSelect, ElSlider, ElSwitch, ElRadioGroup, ElCheckboxGroup, ElTimeSelect, ElTimePicker, ElDatePicker, ElCascader, ElSelect, ElAutocomplete, ElInputNumber, ElInput, localeContextKey, useLocale as useLocale$1, ElRow, ElForm, ElSpace, ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem, ElCheckbox, ElTableColumn, ElLoading } from "element-plus";
4
- import { useForm as useForm$1, zhCN as zhCN$1, zhTW as zhTW$1, enUS as enUS$1, resolveLocaleName, format, cloneDeep, InjectionFormSlotsKey, isPlainObject, getObject, normalizePathKey, createFormProxy, InjectionFormKey, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, get, pick, isPromise, useTable as useTable$1 } from "@qin-ui/pro-components-core";
2
+ import { inject, computed, toValue, provide, defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, ref, createCommentVNode, createSlots, renderList, createVNode, toRaw, resolveComponent, unref, useSlots, shallowRef, onUpdated, triggerRef, withModifiers, createElementVNode, normalizeStyle, nextTick, mergeModels, useModel, watch, h, onMounted, resolveDirective, normalizeClass, withDirectives, guardReactiveProps, effect, stop, Comment, Text } from "vue";
3
+ import { ElTable, ElPagination, ElCol, ElFormItem, useFormDisabled, ElTransfer, ElTreeSelect, ElSlider, ElSwitch, ElRadioGroup, ElCheckboxGroup, ElTimeSelect, ElTimePicker, ElDatePicker, ElCascader, ElSelect, ElAutocomplete, ElInputNumber, ElInput, localeContextKey, useLocale as useLocale$1, ElRow, ElForm, ElSpace, ElButton, useSize, ElDropdown, ElDropdownMenu, ElDropdownItem, ElCheckbox, ElTableColumn, ElLoading } from "element-plus";
4
+ import { useForm as useForm$1, zhCN as zhCN$1, zhTW as zhTW$1, enUS as enUS$1, resolveLocaleName, format, useReactiveAttrs, cloneDeep, getObject, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, isObjectItem, normalizePathKey, createFormProxy, InjectionFormKey, omitBy, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, get, pick, isPromise, useTable as useTable$1, omit } from "@qin-ui/pro-components-core";
5
5
  import { useFormData } from "@qin-ui/pro-components-core";
6
6
  const _tableProps = ElTable.props || {};
7
7
  const _paginationProps = ElPagination.props || {};
@@ -14,17 +14,30 @@ const formItemProps = () => _formItemProps;
14
14
  const DisabledContextKey = Symbol.for("pro-form-disabled-context");
15
15
  const useDisabledContext = () => {
16
16
  const formDisabled = useFormDisabled();
17
- const customDisabled = inject(DisabledContextKey, void 0);
17
+ const customDisabled = inject(
18
+ DisabledContextKey,
19
+ void 0
20
+ );
18
21
  return computed(() => {
19
- if (customDisabled !== void 0 && toValue(customDisabled) !== void 0) {
20
- return Boolean(toValue(customDisabled));
21
- }
22
+ const custom = toValue(customDisabled);
23
+ if (custom !== void 0) return Boolean(custom);
22
24
  return Boolean(formDisabled.value);
23
25
  });
24
26
  };
27
+ const useDisabledContextProvider = (disabled) => {
28
+ const parentDisabled = useDisabledContext();
29
+ provide(
30
+ DisabledContextKey,
31
+ computed(() => toValue(disabled) ?? parentDisabled.value)
32
+ );
33
+ };
34
+ const useProviderDisabled = useDisabledContextProvider;
35
+ const INJECT_COMPONENT_VARS = Symbol("COMPONENT_VARS");
25
36
  const INJECT_CONFIG = {
26
37
  "pro-table": {
27
38
  injectionKey: Symbol(""),
39
+ // 数据取自 `:table` 实例或显式 `:data`;列与加载态非类型面成员,同样在注入层忽略
40
+ ignoreProps: ["loading", "columns", "data"],
28
41
  default: {
29
42
  pagination: {
30
43
  layout: "total, sizes, prev, pager, next, jumper",
@@ -41,6 +54,8 @@ const INJECT_CONFIG = {
41
54
  },
42
55
  "pro-form": {
43
56
  injectionKey: Symbol(""),
57
+ // 表单实例由 `:form` 显式传入
58
+ ignoreProps: ["form"],
44
59
  default: { grid: { gutter: 24 } }
45
60
  },
46
61
  "pro-form-item": {
@@ -250,8 +265,14 @@ const componentMap = {
250
265
  "tree-select": ElTreeSelect,
251
266
  "transfer": ElTransfer
252
267
  };
268
+ const ELEMENT_FIELD_IDENTITY_KEYS = ["prop", "path"];
253
269
  function useForm(...args) {
254
- return useForm$1(...args);
270
+ if (args.length === 1 && typeof args[0] === "boolean") {
271
+ return useForm$1(args[0]);
272
+ }
273
+ return useForm$1(args[0], args[1], args[2], {
274
+ fieldIdentityKeys: ELEMENT_FIELD_IDENTITY_KEYS
275
+ });
255
276
  }
256
277
  const PLACEHOLDER_KEYS = {
257
278
  input: "input.placeholder",
@@ -355,7 +376,7 @@ const useLocale = () => {
355
376
  const { lang: elLang } = useLocale$1();
356
377
  const override = inject(LOCALE_INJECT_KEY, void 0);
357
378
  const lang = computed(() => {
358
- if (!elLocaleContext) return "zh-CN";
379
+ if (toValue(elLocaleContext) == null) return "zh-CN";
359
380
  return resolveLocaleName(elLang.value);
360
381
  });
361
382
  const pack = computed(
@@ -384,11 +405,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
384
405
  const { t } = useLocale();
385
406
  const form = useForm(false);
386
407
  const componentRef = ref();
387
- const attrs = useAttrs();
408
+ const attrs = useReactiveAttrs();
388
409
  const typeVal = attrs.type;
389
410
  const injectConfigKey = typeof props.component === "string" ? [props.component, typeVal].filter(Boolean).join(".") : "";
390
411
  const componentInjectConfig = injectConfigKey ? getInjectConfig(injectConfigKey) : void 0;
391
412
  const rawInjectComponentProps = componentInjectConfig ? inject(componentInjectConfig.injectionKey, componentInjectConfig.default) : void 0;
413
+ const componentVars = inject(INJECT_COMPONENT_VARS, void 0);
392
414
  const value = computed({
393
415
  get() {
394
416
  var _a;
@@ -419,7 +441,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
419
441
  });
420
442
  const parentDisabled = useDisabledContext();
421
443
  const groupedAttrs = computed(() => {
422
- const currentInjectProps = toValue(rawInjectComponentProps) || {};
444
+ var _a;
445
+ const currentInjectProps = {
446
+ ...toValue(rawInjectComponentProps) || {},
447
+ ...getObject((_a = toValue(componentVars)) == null ? void 0 : _a[injectConfigKey])
448
+ };
423
449
  const initProps = getInitProps(
424
450
  {
425
451
  component: props.component,
@@ -429,7 +455,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
429
455
  t
430
456
  );
431
457
  const modelPropName = attrs.modelProp ?? initProps.modelProp ?? "modelValue";
432
- const effectiveDisabled = attrs.disabled !== void 0 ? Boolean(attrs.disabled) : Boolean(parentDisabled.value || initProps.disabled);
458
+ const normalizeDisabled = (value2) => value2 === "" || value2 === "disabled" ? true : Boolean(value2);
459
+ const effectiveDisabled = attrs.disabled !== void 0 && attrs.disabled !== null ? normalizeDisabled(attrs.disabled) : normalizeDisabled(parentDisabled.value) || normalizeDisabled(initProps.disabled);
433
460
  const mergedProps = mergeProps(
434
461
  initProps,
435
462
  attrs,
@@ -495,9 +522,20 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
495
522
  };
496
523
  }
497
524
  });
498
- const formItemPropKeys = Object.keys(formItemProps()).filter(
499
- (k) => k !== "disabled"
500
- );
525
+ const fieldKeyMap = /* @__PURE__ */ new WeakMap();
526
+ let fieldKeySeed = 0;
527
+ const getFieldKey = (field) => {
528
+ if (field === null || typeof field !== "object")
529
+ return `raw_${String(field)}`;
530
+ const raw = toRaw(field);
531
+ let key = fieldKeyMap.get(raw);
532
+ if (key === void 0) {
533
+ key = ++fieldKeySeed;
534
+ fieldKeyMap.set(raw, key);
535
+ }
536
+ return key;
537
+ };
538
+ const formItemPropKeys = Object.keys(formItemProps());
501
539
  const gridItemPropKeys = Object.keys(gridItemProps());
502
540
  const gridItemPropKeySet = new Set(gridItemPropKeys);
503
541
  const formItemPropKeySet = new Set(formItemPropKeys);
@@ -513,7 +551,7 @@ function useGroupFieldAttrs(validFields) {
513
551
  const componentProps = { slots: {} };
514
552
  const formItemSlots = {};
515
553
  if (isPlainObject(field)) {
516
- const { path, name, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = field;
554
+ const { path: _path, prop: _prop, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = field;
517
555
  const { class: injectClassName, style: injectStyle, span: injectSpan, formItemContainer: injectFormItemContainer, xs, sm, md, lg, xl, ...injectRest } = rawInjectProps;
518
556
  const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, span: injectSpan };
519
557
  gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
@@ -541,25 +579,25 @@ function useGroupFieldAttrs(validFields) {
541
579
  componentProps.slots[k] = slots[k];
542
580
  }
543
581
  });
544
- const raw2 = toValue(name) ?? toValue(path);
545
582
  return {
546
- path: Array.isArray(raw2) ? raw2.join(".") : raw2 || "",
583
+ path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
547
584
  gridItemProps: gridItemProps2,
548
585
  formItemProps: formItemProps2,
549
586
  formItemSlots,
550
587
  componentProps,
551
588
  container,
552
- rawField: field
589
+ rawField: field,
590
+ renderKey: getFieldKey(field)
553
591
  };
554
592
  }
555
- const raw = toValue(field == null ? void 0 : field.name) ?? toValue(field == null ? void 0 : field.path);
556
593
  return {
557
- path: Array.isArray(raw) ? raw.join(".") : raw || "",
594
+ path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
558
595
  gridItemProps: gridItemProps2,
559
596
  formItemProps: formItemProps2,
560
597
  formItemSlots,
561
598
  componentProps,
562
- rawField: field
599
+ rawField: field,
600
+ renderKey: getFieldKey(field)
563
601
  };
564
602
  });
565
603
  });
@@ -569,25 +607,18 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
569
607
  __name: "index",
570
608
  props: {
571
609
  grid: { type: [Boolean, Object], default: void 0 },
572
- fields: { default: () => [] }
610
+ fields: { default: () => [] },
611
+ disabled: { type: Boolean, default: void 0 }
573
612
  },
574
613
  setup(__props) {
575
- let fieldKeySeed = 0;
576
- const fieldKeyMap = /* @__PURE__ */ new WeakMap();
577
- const getFieldKey = (field) => {
578
- const raw = toRaw(field);
579
- let key = fieldKeyMap.get(raw);
580
- if (key === void 0) {
581
- key = ++fieldKeySeed;
582
- fieldKeyMap.set(raw, key);
583
- }
584
- return key;
585
- };
586
614
  const props = __props;
615
+ useProviderDisabled(computed(() => props.disabled));
587
616
  const validFields = computed(
588
617
  () => (
589
- // hidden 支持 Ref/ComputedRef/getter 等响应式形态(统一使用 toValue 取值)
590
- (props.fields ?? []).filter((field) => !toValue(field.hidden))
618
+ // hidden 支持 Ref / ComputedRef 响应式形态(统一使用 toValue 取值)
619
+ (props.fields ?? []).filter(
620
+ (field) => isObjectItem(field) && !toValue(field.hidden)
621
+ )
591
622
  )
592
623
  );
593
624
  const config = INJECT_CONFIG["pro-form"];
@@ -670,7 +701,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
670
701
  default: withCtx(() => [
671
702
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(groupedFields), (item) => {
672
703
  return openBlock(), createBlock(_sfc_main$f, mergeProps({
673
- key: item.path || getFieldKey(item.rawField),
704
+ key: item.renderKey,
674
705
  component: enableGrid.value ? unref(ElCol) : void 0
675
706
  }, { ref_for: true }, item.gridItemProps), {
676
707
  default: withCtx(() => [
@@ -689,8 +720,9 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
689
720
  item.rawField.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
690
721
  key: 0,
691
722
  grid: item.rawField.grid ?? props.grid,
692
- fields: item.rawField.fields
693
- }, null, 8, ["grid", "fields"])) : (openBlock(), createBlock(_sfc_main$d, mergeProps({
723
+ fields: item.rawField.fields,
724
+ disabled: toValue(item.rawField.disabled)
725
+ }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(_sfc_main$d, mergeProps({
694
726
  key: 1,
695
727
  ref_for: true,
696
728
  ref: (el) => setComponentRef(item.rawField, el)
@@ -732,20 +764,18 @@ const _export_sfc = (sfc, props) => {
732
764
  }
733
765
  return target;
734
766
  };
735
- const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-6f664240"]]);
767
+ const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-237594c9"]]);
736
768
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
737
769
  ...{ name: "ProForm", inheritAttrs: false },
738
770
  __name: "index",
739
771
  props: {
740
- grid: { type: [Boolean, Object], default: false },
772
+ grid: { type: [Boolean, Object], default: void 0 },
741
773
  form: { default: void 0 }
742
774
  },
743
775
  setup(__props) {
744
776
  const props = __props;
745
- let fallbackForm;
746
- const currentForm = computed(
747
- () => props.form ?? (fallbackForm ?? (fallbackForm = useForm()))
748
- );
777
+ const fallbackForm = useForm();
778
+ const currentForm = computed(() => props.form ?? fallbackForm);
749
779
  const formProxy = createFormProxy(() => currentForm.value);
750
780
  provide(InjectionFormKey, formProxy);
751
781
  const fields = computed(() => {
@@ -773,14 +803,17 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
773
803
  const formKey = computed(() => getFormKey(currentForm.value));
774
804
  const config = INJECT_CONFIG["pro-form"];
775
805
  const injectFormConfig = inject(config.injectionKey, config.default);
776
- const attrs = useAttrs();
806
+ const attrs = useReactiveAttrs();
777
807
  const injectAttrs = computed(() => {
778
808
  const raw = toValue(injectFormConfig);
779
809
  const { grid: _injectGrid, ...rest } = raw || {};
780
810
  return rest;
781
811
  });
782
812
  const formAttrs = computed(() => {
783
- return mergeProps(injectAttrs.value, camelizeProperties(attrs));
813
+ return mergeProps(
814
+ injectAttrs.value,
815
+ omitBy(camelizeProperties(attrs), (value) => value === void 0)
816
+ );
784
817
  });
785
818
  const slots = useSlots();
786
819
  const formSlotsRef = shallowRef(slots);
@@ -811,7 +844,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
811
844
  }
812
845
  });
813
846
  function useFields(initFields) {
814
- return useFields$1(initFields);
847
+ return useFields$1(initFields, {
848
+ fieldIdentityKeys: ELEMENT_FIELD_IDENTITY_KEYS
849
+ });
815
850
  }
816
851
  function useFormRef() {
817
852
  return useFormRef$1();
@@ -836,7 +871,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
836
871
  ...{ name: "SearchForm" },
837
872
  __name: "SearchForm",
838
873
  props: {
839
- form: { default: void 0 },
874
+ form: {},
840
875
  layout: { default: "grid" },
841
876
  expand: { type: [Boolean, Object], default: true },
842
877
  searchButton: { type: [Object, Function, Boolean], default: void 0 },
@@ -878,14 +913,27 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
878
913
  const onReset = () => {
879
914
  emit("reset");
880
915
  };
881
- const onSearch = () => {
916
+ let searchTriggeredInTick = false;
917
+ const emitSearch = () => {
918
+ searchTriggeredInTick = true;
919
+ nextTick(() => {
920
+ searchTriggeredInTick = false;
921
+ });
882
922
  emit("search");
883
923
  };
924
+ const onSearchSubmit = () => {
925
+ if (searchTriggeredInTick) return;
926
+ emitSearch();
927
+ };
928
+ const onSearchClick = () => {
929
+ if (searchTriggeredInTick) return;
930
+ emitSearch();
931
+ };
884
932
  return (_ctx, _cache) => {
885
933
  return openBlock(), createBlock(_sfc_main$b, mergeProps(layoutProps.value, {
886
934
  form: props.form,
887
935
  class: "pro-table_search-form transition",
888
- onSubmit: withModifiers(onSearch, ["prevent"])
936
+ onSubmit: withModifiers(onSearchSubmit, ["prevent"])
889
937
  }), {
890
938
  default: withCtx(() => [
891
939
  createVNode(unref(ElSpace), {
@@ -910,11 +958,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
910
958
  }))
911
959
  ], 64)) : createCommentVNode("", true)
912
960
  ], true),
913
- renderSlot(_ctx.$slots, "search-button", { onSearch }, () => [
961
+ renderSlot(_ctx.$slots, "search-button", { onSearch: onSearchClick }, () => [
914
962
  props.searchButton !== false ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
915
963
  props.searchButton ? (openBlock(), createBlock(resolveDynamicComponent(props.searchButton), {
916
964
  key: 0,
917
- onClick: onSearch
965
+ onClick: onSearchClick
918
966
  })) : (openBlock(), createBlock(unref(ElButton), {
919
967
  key: 1,
920
968
  class: "pro-table_search-form_search-button",
@@ -963,7 +1011,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
963
1011
  };
964
1012
  }
965
1013
  });
966
- const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-746ff159"]]);
1014
+ const SearchForm = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-419025fd"]]);
967
1015
  const _sfc_main$8 = {};
968
1016
  const _hoisted_1$4 = { class: "pro-table_search-form-container" };
969
1017
  function _sfc_render$3(_ctx, _cache) {
@@ -998,15 +1046,21 @@ function _sfc_render$1(_ctx, _cache) {
998
1046
  const ColumnHeightOutlined = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$1]]);
999
1047
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1000
1048
  __name: "SizeControl",
1001
- props: {
1049
+ props: /* @__PURE__ */ mergeModels({
1050
+ effectiveSize: { default: void 0 }
1051
+ }, {
1002
1052
  "size": {},
1003
1053
  "sizeModifiers": {}
1004
- },
1054
+ }),
1005
1055
  emits: ["update:size"],
1006
1056
  setup(__props) {
1007
1057
  const { t } = useLocale();
1058
+ const props = __props;
1008
1059
  const size = useModel(__props, "size");
1009
- const currentSize = computed(() => size.value ?? "default");
1060
+ const hostSize = useSize();
1061
+ const currentSize = computed(
1062
+ () => (props.effectiveSize ?? size.value ?? hostSize.value) || "default"
1063
+ );
1010
1064
  const items = computed(() => [
1011
1065
  { label: t("table.sizeDefault"), key: "default" },
1012
1066
  { label: t("table.sizeMiddle"), key: "large" },
@@ -1052,7 +1106,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
1052
1106
  };
1053
1107
  }
1054
1108
  });
1055
- const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-e31e9c15"]]);
1109
+ const SizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-61d0ef11"]]);
1056
1110
  const _sfc_main$4 = {};
1057
1111
  const _hoisted_1$1 = {
1058
1112
  focusable: "false",
@@ -1081,16 +1135,16 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1081
1135
  const { t } = useLocale();
1082
1136
  const checkAll = ref(false);
1083
1137
  const indeterminate = ref(false);
1084
- const getColumnKey = (column) => {
1085
- const rawKey = column.key ?? column.prop;
1138
+ const getColumnKey2 = (column) => {
1139
+ const rawKey = column.key || column.prop;
1086
1140
  if (rawKey === void 0 || rawKey === null || rawKey === "")
1087
1141
  return void 0;
1088
1142
  return normalizePathKey(rawKey);
1089
1143
  };
1090
1144
  const checkedColumnsOptions = computed(
1091
- () => props.columns.flatMap((item) => {
1145
+ () => props.columns.filter(isObjectItem).flatMap((item) => {
1092
1146
  var _a, _b, _c, _d, _e, _f;
1093
- const key = getColumnKey(item);
1147
+ const key = getColumnKey2(item);
1094
1148
  if (key === void 0) return [];
1095
1149
  if (key === "__INDEX__" || item.type === "index" || ((_b = (_a = props.columnControl) == null ? void 0 : _a.excludedKeys) == null ? void 0 : _b.some((ek) => String(ek) === key)))
1096
1150
  return [];
@@ -1102,7 +1156,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1102
1156
  return {
1103
1157
  label,
1104
1158
  value: key,
1105
- checked: !item.hidden || !!disabled,
1159
+ checked: !toValue(item.hidden) || !!disabled,
1106
1160
  disabled: !!disabled,
1107
1161
  column: item
1108
1162
  };
@@ -1238,91 +1292,76 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1238
1292
  };
1239
1293
  }
1240
1294
  });
1241
- const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-55e837c0"]]);
1242
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1243
- ...{ name: "TableColumnRenderer" },
1244
- __name: "TableColumnRenderer",
1295
+ const ColumnControl = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-4d2b4f1c"]]);
1296
+ let columnKeySeed = 0;
1297
+ const columnKeyMap = /* @__PURE__ */ new WeakMap();
1298
+ const getStableColumnKey = (column) => {
1299
+ if (column === null || typeof column !== "object")
1300
+ return `raw_${String(column)}`;
1301
+ const raw = toRaw(column);
1302
+ let key = columnKeyMap.get(raw);
1303
+ if (key === void 0) {
1304
+ key = ++columnKeySeed;
1305
+ columnKeyMap.set(raw, key);
1306
+ }
1307
+ return key;
1308
+ };
1309
+ const getColumnKey = (column) => {
1310
+ const rawKey = column.key || column.prop;
1311
+ if (!rawKey) return getStableColumnKey(column);
1312
+ return normalizePathKey(rawKey);
1313
+ };
1314
+ const getCellValue = (row, column) => {
1315
+ const path = column.prop;
1316
+ if (!path) return void 0;
1317
+ return get(row, path);
1318
+ };
1319
+ const getColumnProps = (column) => {
1320
+ const { hidden, render, key, children, ...rest } = column;
1321
+ const prop = column.prop ? normalizePathKey(column.prop) : void 0;
1322
+ const columnKey = key ? normalizePathKey(key) : prop;
1323
+ return {
1324
+ ...rest,
1325
+ label: column.label ?? column.title,
1326
+ prop,
1327
+ columnKey
1328
+ };
1329
+ };
1330
+ const renderColumn = (column, ancestors = /* @__PURE__ */ new Set()) => {
1331
+ const hasChildren = Array.isArray(column.children) && column.children.length > 0;
1332
+ const vnodeProps = { key: getColumnKey(column), ...getColumnProps(column) };
1333
+ if (hasChildren) {
1334
+ const nextAncestors = new Set(ancestors).add(column);
1335
+ return h(ElTableColumn, vnodeProps, {
1336
+ default: () => column.children.filter(
1337
+ (child) => isObjectItem(child) && !nextAncestors.has(child) && !toValue(child.hidden)
1338
+ ).map((child) => renderColumn(child, nextAncestors))
1339
+ });
1340
+ }
1341
+ if (typeof column.render === "function") {
1342
+ return h(ElTableColumn, vnodeProps, {
1343
+ default: (scope) => h(_sfc_main$e, {
1344
+ component: column.render({
1345
+ ...scope,
1346
+ column,
1347
+ cellValue: getCellValue(scope.row, column)
1348
+ })
1349
+ })
1350
+ });
1351
+ }
1352
+ return h(ElTableColumn, vnodeProps);
1353
+ };
1354
+ const _sfc_main$2 = defineComponent({
1355
+ name: "TableColumnRenderer",
1356
+ inheritAttrs: false,
1245
1357
  props: {
1246
- columns: { default: () => [] }
1358
+ columns: {
1359
+ type: Array,
1360
+ default: () => []
1361
+ }
1247
1362
  },
1248
- setup(__props) {
1249
- const props = __props;
1250
- let columnKeySeed = 0;
1251
- const columnKeyMap = /* @__PURE__ */ new WeakMap();
1252
- const getStableColumnKey = (column) => {
1253
- const raw = toRaw(column);
1254
- let key = columnKeyMap.get(raw);
1255
- if (key === void 0) {
1256
- key = ++columnKeySeed;
1257
- columnKeyMap.set(raw, key);
1258
- }
1259
- return key;
1260
- };
1261
- const getColumnKey = (column) => {
1262
- const rawKey = column.key ?? column.prop;
1263
- if (rawKey === void 0 || rawKey === null)
1264
- return getStableColumnKey(column);
1265
- return normalizePathKey(rawKey);
1266
- };
1267
- const getCellValue = (row, column) => {
1268
- const path = column.prop;
1269
- if (!path) return void 0;
1270
- return get(row, path);
1271
- };
1272
- const normalizedColumns = computed(() => {
1273
- return props.columns.filter((column) => !column.hidden);
1274
- });
1275
- const getColumnProps = (column) => {
1276
- const { hidden, render, key, children, ...rest } = column;
1277
- const prop = column.prop ? normalizePathKey(column.prop) : void 0;
1278
- const columnKey = key ? normalizePathKey(key) : prop;
1279
- return {
1280
- ...rest,
1281
- label: column.label ?? column.title,
1282
- prop,
1283
- columnKey
1284
- };
1285
- };
1286
- return (_ctx, _cache) => {
1287
- const _component_TableColumnRenderer = resolveComponent("TableColumnRenderer", true);
1288
- return openBlock(true), createElementBlock(Fragment, null, renderList(normalizedColumns.value, (column) => {
1289
- return openBlock(), createElementBlock(Fragment, {
1290
- key: getColumnKey(column)
1291
- }, [
1292
- column.children && column.children.length > 0 ? (openBlock(), createBlock(unref(ElTableColumn), mergeProps({
1293
- key: 0,
1294
- ref_for: true
1295
- }, getColumnProps(column)), {
1296
- default: withCtx(() => [
1297
- createVNode(_component_TableColumnRenderer, {
1298
- columns: column.children
1299
- }, null, 8, ["columns"])
1300
- ]),
1301
- _: 2
1302
- }, 1040)) : typeof column.render === "function" ? (openBlock(), createBlock(unref(ElTableColumn), mergeProps({
1303
- key: 1,
1304
- ref_for: true
1305
- }, getColumnProps(column)), {
1306
- default: withCtx((scope) => {
1307
- var _a;
1308
- return [
1309
- createVNode(_sfc_main$e, {
1310
- component: (_a = column.render) == null ? void 0 : _a.call(column, {
1311
- ...scope,
1312
- column,
1313
- cellValue: getCellValue(scope.row, column)
1314
- })
1315
- }, null, 8, ["component"])
1316
- ];
1317
- }),
1318
- _: 2
1319
- }, 1040)) : (openBlock(), createBlock(unref(ElTableColumn), mergeProps({
1320
- key: 2,
1321
- ref_for: true
1322
- }, getColumnProps(column)), null, 16))
1323
- ], 64);
1324
- }), 128);
1325
- };
1363
+ setup(props) {
1364
+ return () => props.columns.filter((column) => isObjectItem(column) && !toValue(column.hidden)).map((column) => renderColumn(column));
1326
1365
  }
1327
1366
  });
1328
1367
  const _hoisted_1 = { class: "pro-table_header" };
@@ -1377,72 +1416,60 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1377
1416
  const config = INJECT_CONFIG["pro-table"];
1378
1417
  const injectPropsRaw = inject(config.injectionKey, config.default);
1379
1418
  const injectProps = computed(() => toValue(injectPropsRaw) || {});
1380
- const attrs = useAttrs();
1381
- const PRO_TABLE_EXCLUDED_ATTR_KEYS = /* @__PURE__ */ new Set([
1419
+ const attrs = useReactiveAttrs();
1420
+ const PRO_TABLE_CONSUMED_ATTR_KEYS = /* @__PURE__ */ new Set([
1382
1421
  "class",
1383
1422
  "style",
1384
1423
  "onSearch",
1385
- "onChange",
1386
- "onUpdate:size",
1387
- "onUpdate:loading",
1388
- "data",
1389
- "columns",
1390
- "size",
1391
- "pagination"
1392
- ]);
1393
- const PRO_TABLE_PROVIDER_KEYS = /* @__PURE__ */ new Set([
1394
- "pagination",
1395
- "searchFormConfig",
1396
- "control",
1397
- "immediateSearch",
1398
- "addIndexColumn",
1399
- "tableContainer"
1424
+ "onChange"
1400
1425
  ]);
1426
+ const PRO_TABLE_PROP_KEYS = new Set(Object.keys(props));
1401
1427
  const injectTableAttrs = computed(() => {
1402
1428
  const tableConfig = {};
1403
1429
  for (const [key, value] of Object.entries(injectProps.value)) {
1404
- if (!PRO_TABLE_PROVIDER_KEYS.has(key)) {
1430
+ if (!PRO_TABLE_PROP_KEYS.has(key)) {
1405
1431
  tableConfig[key] = value;
1406
1432
  }
1407
1433
  }
1408
1434
  return tableConfig;
1409
1435
  });
1410
1436
  const attrsTableProps = computed(() => {
1411
- return pick(
1412
- camelizeProperties(attrs),
1413
- tableProperties
1437
+ return omitBy(
1438
+ pick(camelizeProperties(attrs), tableProperties),
1439
+ (value) => value === void 0
1414
1440
  );
1415
1441
  });
1416
1442
  const restTableAttrs = computed(() => {
1417
1443
  const rest = {};
1418
1444
  for (const [key, value] of Object.entries(attrs)) {
1419
- if (!PRO_TABLE_EXCLUDED_ATTR_KEYS.has(key)) {
1445
+ if (!PRO_TABLE_CONSUMED_ATTR_KEYS.has(key)) {
1420
1446
  rest[key] = value;
1421
1447
  }
1422
1448
  }
1423
- return rest;
1449
+ return omitBy(rest, (value) => value === void 0);
1424
1450
  });
1425
1451
  const size = useModel(__props, "size");
1426
1452
  const loading = useModel(__props, "loading");
1427
1453
  let searchSequence = 0;
1428
- let warnedSearchConfig = false;
1454
+ const SEARCH_WARN_MESSAGES = {
1455
+ duplicate: "同时配置了 :search prop 与 @search 监听,@search 监听不会被执行,请仅保留其一。",
1456
+ "not-promise": "search 未返回 Promise,本次查询不参与 loading 竞态管理(在途请求的 loading 状态保持不变)。"
1457
+ };
1458
+ const warnedSearchReasons = /* @__PURE__ */ new Set();
1429
1459
  const warnSearchConfig = (reason) => {
1430
- if (warnedSearchConfig) return;
1431
- warnedSearchConfig = true;
1432
- console.warn(`[ProTable] ${reason}`);
1460
+ if (warnedSearchReasons.has(reason)) return;
1461
+ warnedSearchReasons.add(reason);
1462
+ console.warn(`[ProTable] ${SEARCH_WARN_MESSAGES[reason]}`);
1433
1463
  };
1434
1464
  const _search = async () => {
1435
- var _a;
1465
+ const search = props.search || attrs.onSearch;
1436
1466
  if (props.search && attrs.onSearch) {
1437
- warnSearchConfig(
1438
- "同时配置了 :search prop 与 @search 监听,@search 监听不会被执行,请仅保留其一。"
1439
- );
1467
+ warnSearchConfig("duplicate");
1440
1468
  }
1441
- const searchPromise = (_a = props.search || attrs.onSearch) == null ? void 0 : _a();
1469
+ if (!search) return;
1470
+ const searchPromise = search();
1442
1471
  if (!isPromise(searchPromise)) {
1443
- warnSearchConfig(
1444
- "search 未返回 Promise,本次查询不参与 loading 竞态管理(在途请求的 loading 状态保持不变)。"
1445
- );
1472
+ warnSearchConfig("not-promise");
1446
1473
  return;
1447
1474
  }
1448
1475
  const seq = ++searchSequence;
@@ -1469,7 +1496,47 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1469
1496
  "table"
1470
1497
  ];
1471
1498
  const slots = useSlots();
1472
- const forwardedSlotNames = () => Object.keys(slots).filter((name) => !customSlotNames.includes(name));
1499
+ const hasRenderableContent = (nodes) => {
1500
+ if (nodes === null || nodes === void 0 || nodes === false) return false;
1501
+ if (typeof nodes === "string") return nodes.trim() !== "";
1502
+ if (typeof nodes === "number") return true;
1503
+ if (Array.isArray(nodes)) return nodes.some(hasRenderableContent);
1504
+ const vnode = nodes;
1505
+ if (vnode.type === Comment) return false;
1506
+ if (vnode.type === Text) return String(vnode.children ?? "").trim() !== "";
1507
+ if (vnode.type === Fragment) return hasRenderableContent(vnode.children);
1508
+ return true;
1509
+ };
1510
+ const evaluateSlotContent = () => {
1511
+ let hasContent = false;
1512
+ const runner = effect(() => {
1513
+ var _a;
1514
+ try {
1515
+ hasContent = hasRenderableContent((_a = slots.default) == null ? void 0 : _a.call(slots));
1516
+ } catch {
1517
+ hasContent = true;
1518
+ }
1519
+ });
1520
+ stop(runner);
1521
+ return hasContent;
1522
+ };
1523
+ let defaultSlotChecked = false;
1524
+ const checkDefaultSlot = () => {
1525
+ if (defaultSlotChecked) return;
1526
+ if (!Object.prototype.hasOwnProperty.call(slots, "default")) return;
1527
+ defaultSlotChecked = true;
1528
+ if (evaluateSlotContent()) {
1529
+ console.warn(
1530
+ "[pro-components] ProTable 的 default 插槽保留用于列渲染,已忽略传入的 default 插槽内容;自定义区域请使用 search-form / button-bar / toolbar / table 具名插槽。"
1531
+ );
1532
+ }
1533
+ };
1534
+ const forwardedSlotNames = () => {
1535
+ checkDefaultSlot();
1536
+ return Object.keys(slots).filter(
1537
+ (name) => name !== "default" && !customSlotNames.includes(name)
1538
+ );
1539
+ };
1473
1540
  const searchPage1st = () => {
1474
1541
  var _a, _b;
1475
1542
  (_b = (_a = props.table) == null ? void 0 : _a.setPageParam) == null ? void 0 : _b.call(_a, { current: 1 });
@@ -1484,22 +1551,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1484
1551
  container: container ? container : void 0
1485
1552
  };
1486
1553
  });
1554
+ const searchFormProps = computed(() => {
1555
+ const {
1556
+ container: _container,
1557
+ hidden: _hidden,
1558
+ ...rest
1559
+ } = computedSearchFormConfig.value;
1560
+ return rest;
1561
+ });
1487
1562
  const computedTableContainer = computed(() => {
1488
1563
  const container = props.tableContainer ?? injectProps.value.tableContainer ?? DefaultTableContainer;
1489
1564
  return container ? container : void 0;
1490
1565
  });
1491
1566
  const getIndex = (i) => {
1492
1567
  var _a;
1493
- if (((_a = props.table) == null ? void 0 : _a.pageParam) && computedPagination.value !== false) {
1494
- const current = props.table.pageParam.current ?? 1;
1495
- const pageSize = props.table.pageParam.pageSize ?? 10;
1496
- return (current - 1) * pageSize + i + 1;
1497
- }
1498
- return i + 1;
1568
+ const pagination = computedPagination.value;
1569
+ if (pagination === false) return i + 1;
1570
+ const pageParam = (_a = props.table) == null ? void 0 : _a.pageParam;
1571
+ const current = pagination.currentPage ?? (pageParam == null ? void 0 : pageParam.current) ?? 1;
1572
+ const pageSize = pagination.pageSize ?? (pageParam == null ? void 0 : pageParam.pageSize) ?? 10;
1573
+ return (current - 1) * pageSize + i + 1;
1499
1574
  };
1575
+ const hasExplicitColumns = computed(() => props.columns !== void 0);
1500
1576
  const normalizedRawColumns = computed(() => {
1501
1577
  var _a;
1502
- const source = props.columns ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? [];
1578
+ const source = (props.columns ?? toValue((_a = props.table) == null ? void 0 : _a.columns) ?? []).filter(isObjectItem);
1503
1579
  if (props.addIndexColumn ?? injectProps.value.addIndexColumn) {
1504
1580
  return [
1505
1581
  {
@@ -1516,30 +1592,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1516
1592
  });
1517
1593
  const computedDataSource = computed(() => {
1518
1594
  var _a;
1519
- const attrsData = attrsTableProps.value.data;
1520
- return props.data ?? attrsData ?? toValue((_a = props.table) == null ? void 0 : _a.data) ?? [];
1595
+ return props.data ?? toValue((_a = props.table) == null ? void 0 : _a.data) ?? [];
1521
1596
  });
1522
1597
  const computedTableProps = computed(() => {
1523
- const merged = {
1598
+ return {
1524
1599
  ...injectTableAttrs.value,
1525
1600
  ...restTableAttrs.value,
1526
1601
  ...attrsTableProps.value
1527
1602
  };
1528
- delete merged.data;
1529
- delete merged.columns;
1530
- delete merged.size;
1531
- delete merged.pagination;
1532
- return merged;
1533
1603
  });
1534
1604
  const computedPagination = computed(() => {
1535
1605
  var _a, _b;
1536
- const attrsPagination = attrsTableProps.value.pagination;
1537
- if (props.pagination === false || attrsPagination === false) {
1538
- return false;
1539
- }
1540
- const hasUserPagination = isPlainObject(props.pagination) || isPlainObject(attrsPagination);
1541
- if (hasUserPagination) {
1542
- const pageConfig = props.pagination ?? attrsPagination ?? {};
1606
+ if (props.pagination === false) return false;
1607
+ if (isPlainObject(props.pagination)) {
1608
+ const pageConfig = props.pagination;
1543
1609
  const globalPagination = injectProps.value.pagination === false ? {} : injectProps.value.pagination || {};
1544
1610
  const pageParam2 = (_a = props.table) == null ? void 0 : _a.pageParam;
1545
1611
  return {
@@ -1575,12 +1641,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1575
1641
  (_a = attrs.onChange) == null ? void 0 : _a.call(attrs, currentPage, pageSize);
1576
1642
  };
1577
1643
  const searchFormVisible = computed(() => {
1578
- var _a, _b, _c, _d, _e;
1644
+ var _a, _b, _c, _d;
1579
1645
  const searchFields = (_b = (_a = props.table) == null ? void 0 : _a.searchForm) == null ? void 0 : _b.fields;
1580
1646
  const fieldList = (Array.isArray(searchFields) ? searchFields : searchFields == null ? void 0 : searchFields.value) ?? [];
1581
- return !!(((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && ((_e = fieldList.filter((item) => !toValue(item.hidden))) == null ? void 0 : _e.length) > 0);
1647
+ return !!(((_c = computedSearchFormConfig.value) == null ? void 0 : _c.hidden) !== true && ((_d = props.table) == null ? void 0 : _d.searchForm) && fieldList.filter((item) => isObjectItem(item) && !toValue(item.hidden)).length > 0);
1582
1648
  });
1583
- const computedControl = computed(() => {
1649
+ const resolvedControl = computed(() => {
1584
1650
  const mergedControl = props.control ?? injectProps.value.control;
1585
1651
  if (typeof mergedControl === "boolean") {
1586
1652
  return { sizeControl: mergedControl, columnControl: mergedControl };
@@ -1590,12 +1656,15 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1590
1656
  const columnControl = (c == null ? void 0 : c.columnControl) ?? false;
1591
1657
  return { sizeControl: !!sizeControl, columnControl };
1592
1658
  });
1659
+ const computedControl = computed(
1660
+ () => hasExplicitColumns.value && resolvedControl.value.columnControl ? { ...resolvedControl.value, columnControl: false } : resolvedControl.value
1661
+ );
1593
1662
  const columnControlConfig = computed(() => {
1594
1663
  const cc = computedControl.value.columnControl;
1595
1664
  return typeof cc === "object" ? cc : void 0;
1596
1665
  });
1597
1666
  const resolvedSize = computed(() => {
1598
- return size.value ?? attrsTableProps.value.size ?? injectTableAttrs.value.size;
1667
+ return size.value ?? injectProps.value.size;
1599
1668
  });
1600
1669
  onMounted(() => {
1601
1670
  if (props.immediateSearch ?? injectProps.value.immediateSearch) {
@@ -1623,7 +1692,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1623
1692
  ((_a = props.table) == null ? void 0 : _a.searchForm) ? (openBlock(), createBlock(SearchForm, mergeProps({
1624
1693
  key: 0,
1625
1694
  form: props.table.searchForm
1626
- }, computedSearchFormConfig.value, {
1695
+ }, searchFormProps.value, {
1627
1696
  onSearch: searchPage1st,
1628
1697
  onReset: reset
1629
1698
  }), null, 16, ["form"])) : createCommentVNode("", true)
@@ -1644,8 +1713,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1644
1713
  computedControl.value.sizeControl ? (openBlock(), createElementBlock("div", _hoisted_4, [
1645
1714
  createVNode(SizeControl, {
1646
1715
  size: size.value,
1647
- "onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event)
1648
- }, null, 8, ["size"])
1716
+ "onUpdate:size": _cache[0] || (_cache[0] = ($event) => size.value = $event),
1717
+ "effective-size": resolvedSize.value
1718
+ }, null, 8, ["size", "effective-size"])
1649
1719
  ])) : createCommentVNode("", true),
1650
1720
  computedControl.value.columnControl ? (openBlock(), createElementBlock("div", _hoisted_5, [
1651
1721
  createVNode(ColumnControl, {
@@ -1692,13 +1762,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1692
1762
  };
1693
1763
  }
1694
1764
  });
1695
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6ec2beda"]]);
1765
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d092780c"]]);
1696
1766
  function useTable(params = {}) {
1697
1767
  const { data, columns, ...rest } = params;
1698
1768
  const coreTable = useTable$1({
1699
1769
  ...rest,
1700
1770
  dataSource: data,
1701
- columns
1771
+ columns,
1772
+ fieldIdentityKeys: ELEMENT_FIELD_IDENTITY_KEYS
1702
1773
  });
1703
1774
  const { dataSource, ...tableWithoutDataSource } = coreTable;
1704
1775
  const table = {
@@ -1723,15 +1794,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1723
1794
  Object.keys(INJECT_CONFIG).forEach(
1724
1795
  (key) => {
1725
1796
  const config = INJECT_CONFIG[key];
1797
+ const ignored = config.ignoreProps;
1726
1798
  provide(
1727
1799
  config.injectionKey,
1728
- computed(() => {
1729
- var _a;
1730
- return {
1731
- ...config.default,
1732
- ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1733
- };
1734
- })
1800
+ computed(
1801
+ () => {
1802
+ var _a;
1803
+ return omit(
1804
+ {
1805
+ ...config.default,
1806
+ ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1807
+ },
1808
+ ignored ?? []
1809
+ );
1810
+ }
1811
+ )
1735
1812
  );
1736
1813
  }
1737
1814
  );
@@ -1752,6 +1829,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1752
1829
  }
1753
1830
  });
1754
1831
  }
1832
+ provide(
1833
+ INJECT_COMPONENT_VARS,
1834
+ computed(() => props.componentVars ?? {})
1835
+ );
1755
1836
  provide(
1756
1837
  INJECT_COMPONENTS,
1757
1838
  computed(() => props.componentMap)
@@ -1767,11 +1848,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1767
1848
  });
1768
1849
  const index = {
1769
1850
  /**
1770
- * @qin-ui/element-plus-pro 安装方法
1771
- * @description 全局注册所有组件(ProForm、ProTable、ProComponentProvider)
1851
+ * 安装方法:全局注册 ProForm / ProTable / ProComponentProvider
1772
1852
  *
1853
+ * @description 供 `app.use(ProComponents)` 调用
1773
1854
  * @param {App} app - Vue 应用实例
1774
- *
1775
1855
  * @example
1776
1856
  * ```ts
1777
1857
  * import { createApp } from 'vue'
@@ -1783,7 +1863,10 @@ const index = {
1783
1863
  install(app) {
1784
1864
  app.component(_sfc_main$b.name, _sfc_main$b);
1785
1865
  app.component(ProTable.name, ProTable);
1786
- app.component(_sfc_main.name, _sfc_main);
1866
+ app.component(
1867
+ _sfc_main.name ?? "ProComponentProvider",
1868
+ _sfc_main
1869
+ );
1787
1870
  }
1788
1871
  };
1789
1872
  export {