@qin-ui/element-plus-pro 1.4.2 → 1.4.4

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 (37) hide show
  1. package/api.json +2 -2
  2. package/es/components/component-provider/components/index.vue.d.ts.map +1 -1
  3. package/es/components/form/components/BaseField/index.vue.d.ts.map +1 -1
  4. package/es/components/form/components/BaseField/utils/index.d.ts +2 -1
  5. package/es/components/form/components/BaseField/utils/index.d.ts.map +1 -1
  6. package/es/components/form/components/BaseFormItem/index.vue.d.ts +60 -9
  7. package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
  8. package/es/components/form/components/BaseFormItems/index.vue.d.ts +13 -0
  9. package/es/components/form/components/BaseFormItems/index.vue.d.ts.map +1 -0
  10. package/es/components/form/components/ProForm/index.vue.d.ts.map +1 -1
  11. package/es/components/form/components/index.d.ts +6 -6
  12. package/es/components/form/components/index.d.ts.map +1 -1
  13. package/es/components/form/hooks/useGroupFieldAttrs.d.ts +10 -2
  14. package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
  15. package/es/components/form/utils/fieldKey.d.ts +12 -0
  16. package/es/components/form/utils/fieldKey.d.ts.map +1 -1
  17. package/es/components/table/components/ProTable.vue.d.ts.map +1 -1
  18. package/es/components/table/types/index.d.ts +1 -0
  19. package/es/components/table/types/index.d.ts.map +1 -1
  20. package/es/element-plus-pro.css +8 -7
  21. package/es/index.js +327 -174
  22. package/es/index.js.map +1 -1
  23. package/es/shared/core/index.d.ts +1 -1
  24. package/es/shared/core/index.d.ts.map +1 -1
  25. package/package.json +2 -2
  26. package/src/components/component-provider/components/index.vue +25 -8
  27. package/src/components/form/components/BaseField/index.vue +20 -12
  28. package/src/components/form/components/BaseField/utils/index.ts +8 -3
  29. package/src/components/form/components/BaseFormItem/index.vue +145 -176
  30. package/src/components/form/components/BaseFormItems/index.vue +183 -0
  31. package/src/components/form/components/ProForm/index.vue +13 -6
  32. package/src/components/form/components/index.ts +6 -6
  33. package/src/components/form/hooks/useGroupFieldAttrs.ts +104 -79
  34. package/src/components/form/utils/fieldKey.ts +64 -0
  35. package/src/components/table/components/ProTable.vue +11 -5
  36. package/src/components/table/types/index.ts +1 -0
  37. package/src/shared/core/index.ts +2 -0
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./element-plus-pro.css";
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";
2
+ import { inject, computed, toValue, provide, defineComponent, createBlock, renderSlot, openBlock, resolveDynamicComponent, normalizeProps, mergeProps, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, ref, createCommentVNode, createSlots, renderList, createVNode, watch, h, toRaw, unref, useSlots, shallowRef, onUpdated, triggerRef, withModifiers, createElementVNode, normalizeStyle, nextTick, mergeModels, useModel, onMounted, resolveDirective, normalizeClass, withDirectives, guardReactiveProps, effect, stop, Comment, Text } from "vue";
3
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";
4
+ import { useForm as useForm$1, zhCN as zhCN$1, zhTW as zhTW$1, enUS as enUS$1, resolveLocaleName, format, useReactiveAttrs, cloneDeep, getObject, omitBy, InjectionFormSlotsKey, isPlainObject, resolveFieldIdentity, normalizePathKey, toPath, isObjectItem, InjectionFormKey, createFormProxy, camelizeProperties, useFields as useFields$1, useFormRef as useFormRef$1, useSearchFormExpand, get, pick, callListeners, isPromise, useTable as useTable$1, omit, mergeComponentVars } 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 || {};
@@ -216,7 +216,7 @@ const ensureInjectConfig = (key) => {
216
216
  DYNAMIC_INJECT_CONFIG[key] = created;
217
217
  return created;
218
218
  };
219
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
219
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
220
220
  ...{ name: "ContainerFragment", inheritAttrs: false },
221
221
  __name: "index",
222
222
  props: {
@@ -233,7 +233,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
233
233
  };
234
234
  }
235
235
  });
236
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
236
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
237
237
  ...{ name: "SlotComponent", inheritAttrs: false },
238
238
  __name: "index",
239
239
  props: {
@@ -321,8 +321,9 @@ const getPlaceholderProps = (key, injectProps, t) => {
321
321
  const getInitProps = (field, injectProps = {}, t) => {
322
322
  const { component, type } = field;
323
323
  if (typeof component === "string") {
324
- const k = [component, type].filter(Boolean).join(".");
325
- return { ...injectProps, ...getPlaceholderProps(k, injectProps, t) };
324
+ const subtypeKey = [component, type].filter(Boolean).join(".");
325
+ const key = PLACEHOLDER_KEYS[subtypeKey] || RANGE_PLACEHOLDER_KEYS[subtypeKey] ? subtypeKey : component;
326
+ return { ...injectProps, ...getPlaceholderProps(key, injectProps, t) };
326
327
  }
327
328
  return {};
328
329
  };
@@ -395,7 +396,7 @@ const useLocale = () => {
395
396
  };
396
397
  return { t, lang };
397
398
  };
398
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
399
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
399
400
  ...{ name: "BaseField", inheritAttrs: false },
400
401
  __name: "index",
401
402
  props: {
@@ -413,9 +414,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
413
414
  const componentRef = ref();
414
415
  const attrs = useReactiveAttrs();
415
416
  const typeVal = attrs.type;
416
- const injectConfigKey = typeof props.component === "string" ? [props.component, typeVal].filter(Boolean).join(".") : "";
417
- const componentInjectConfig = injectConfigKey ? getInjectConfig(injectConfigKey) : void 0;
418
- const rawInjectComponentProps = componentInjectConfig ? inject(componentInjectConfig.injectionKey, componentInjectConfig.default) : void 0;
417
+ const baseConfigKey = typeof props.component === "string" ? props.component : "";
418
+ const typeConfigKey = typeVal || (baseConfigKey === "date-picker" ? "date" : "");
419
+ const subtypeConfigKey = baseConfigKey && typeConfigKey ? `${baseConfigKey}.${typeConfigKey}` : "";
420
+ const baseInjectConfig = baseConfigKey ? getInjectConfig(baseConfigKey) : void 0;
421
+ const subtypeInjectConfig = subtypeConfigKey ? getInjectConfig(subtypeConfigKey) : void 0;
419
422
  const componentVars = inject(INJECT_COMPONENT_VARS, void 0);
420
423
  const value = computed({
421
424
  get() {
@@ -447,10 +450,12 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
447
450
  });
448
451
  const parentDisabled = useDisabledContext();
449
452
  const groupedAttrs = computed(() => {
450
- var _a;
453
+ var _a, _b;
451
454
  const currentInjectProps = {
452
- ...toValue(rawInjectComponentProps) || {},
453
- ...getObject((_a = toValue(componentVars)) == null ? void 0 : _a[injectConfigKey])
455
+ ...getObject(baseInjectConfig == null ? void 0 : baseInjectConfig.default),
456
+ ...getObject(subtypeInjectConfig == null ? void 0 : subtypeInjectConfig.default),
457
+ ...getObject((_a = toValue(componentVars)) == null ? void 0 : _a[baseConfigKey]),
458
+ ...getObject((_b = toValue(componentVars)) == null ? void 0 : _b[subtypeConfigKey])
454
459
  };
455
460
  const initProps = getInitProps(
456
461
  {
@@ -468,7 +473,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
468
473
  );
469
474
  const mergedProps = mergeProps(
470
475
  initProps,
471
- attrs,
476
+ // 未赋值(undefined)的键不作为显式值下发,保留注入默认值与占位符兜底
477
+ omitBy(attrs, (value2) => value2 === void 0),
472
478
  { class: attrs.componentClass, style: attrs.componentStyle },
473
479
  { disabled: effectiveDisabled },
474
480
  { modelProp: modelPropName }
@@ -502,7 +508,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
502
508
  getComponentComputedProps: () => groupedAttrs.value.attrs
503
509
  });
504
510
  return (_ctx, _cache) => {
505
- return openBlock(), createBlock(_sfc_main$f, {
511
+ return openBlock(), createBlock(_sfc_main$g, {
506
512
  component: groupedAttrs.value.componentContainer,
507
513
  path: props.path
508
514
  }, {
@@ -518,7 +524,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
518
524
  return {
519
525
  name,
520
526
  fn: withCtx((scoped) => [
521
- createVNode(_sfc_main$e, mergeProps({
527
+ createVNode(_sfc_main$f, mergeProps({
522
528
  path: props.path
523
529
  }, scoped, { component: slot }), null, 16, ["path", "component"])
524
530
  ])
@@ -531,6 +537,191 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
531
537
  };
532
538
  }
533
539
  });
540
+ const formItemPropKeys = Object.keys(formItemProps());
541
+ const gridItemPropKeys = Object.keys(gridItemProps());
542
+ const gridItemPropKeySet = new Set(gridItemPropKeys);
543
+ const formItemPropKeySet = new Set(formItemPropKeys);
544
+ const formItemSlotKeySet = new Set(FORM_ITEM_SLOT_KEYS);
545
+ const groupField = (field, rawInjectProps) => {
546
+ let gridItemProps2 = {};
547
+ let formItemProps2 = {};
548
+ const componentProps = { slots: {} };
549
+ const formItemSlots = {};
550
+ if (isPlainObject(field)) {
551
+ const { path: _path, prop: _prop, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = field;
552
+ const { class: injectClassName, style: injectStyle, span: injectSpan, formItemContainer: injectFormItemContainer, xs, sm, md, lg, xl, ...injectRest } = rawInjectProps;
553
+ const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, span: injectSpan };
554
+ gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
555
+ formItemProps2 = mergeProps(
556
+ injectRest,
557
+ { class: injectClassName, style: injectStyle },
558
+ { class: toValue(formItemClass), style: toValue(formItemStyle) },
559
+ formItemDataAttrs
560
+ );
561
+ const container = formItemContainer ?? injectFormItemContainer;
562
+ Object.keys(rest).forEach((k) => {
563
+ if (gridItemPropKeySet.has(k)) {
564
+ gridItemProps2[k] = rest[k];
565
+ } else if (formItemPropKeySet.has(k)) {
566
+ formItemProps2[k] = rest[k];
567
+ } else {
568
+ componentProps[k] = rest[k];
569
+ }
570
+ });
571
+ Object.assign(componentProps, componentDataAttrs);
572
+ Object.keys(slots).forEach((k) => {
573
+ if (formItemSlotKeySet.has(k)) {
574
+ formItemSlots[k] = slots[k];
575
+ } else {
576
+ componentProps.slots[k] = slots[k];
577
+ }
578
+ });
579
+ return {
580
+ path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
581
+ gridItemProps: gridItemProps2,
582
+ formItemProps: formItemProps2,
583
+ formItemSlots,
584
+ componentProps,
585
+ container,
586
+ rawField: field
587
+ };
588
+ }
589
+ return {
590
+ path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
591
+ gridItemProps: gridItemProps2,
592
+ formItemProps: formItemProps2,
593
+ formItemSlots,
594
+ componentProps,
595
+ rawField: field
596
+ };
597
+ };
598
+ function useGroupedField(field) {
599
+ const config = INJECT_CONFIG["pro-form-item"];
600
+ const injectFormItemProps = inject(config.injectionKey, config.default);
601
+ return computed(
602
+ () => groupField(toValue(field), toValue(injectFormItemProps) || {})
603
+ );
604
+ }
605
+ const _sfc_main$d = defineComponent({
606
+ name: "BaseFormItem",
607
+ inheritAttrs: false,
608
+ props: {
609
+ /** 字段配置 */
610
+ field: { type: Object, required: true },
611
+ /** 是否启用网格布局 */
612
+ grid: {
613
+ type: [Boolean, Object],
614
+ default: void 0
615
+ },
616
+ /** 上层下发的禁用状态 */
617
+ disabled: { type: Boolean, default: void 0 },
618
+ /** FormItem 实例登记回调 */
619
+ setFormItemRef: {
620
+ type: Function,
621
+ default: void 0
622
+ },
623
+ /** 控件实例登记回调 */
624
+ setComponentRef: {
625
+ type: Function,
626
+ default: void 0
627
+ }
628
+ },
629
+ setup(props) {
630
+ const grouped = useGroupedField(() => props.field);
631
+ const enableGrid = computed(() => !!props.grid);
632
+ const componentKey = computed(() => {
633
+ const field = props.field;
634
+ const component = toValue(field.component);
635
+ if (typeof component !== "string") return "component-object";
636
+ return `string:${component}:${toValue(field.type) ?? ""}`;
637
+ });
638
+ const effectiveDisabled = computed(
639
+ () => toValue(props.field.disabled) ?? props.disabled
640
+ );
641
+ const setItemRef = (el) => {
642
+ var _a;
643
+ (_a = props.setFormItemRef) == null ? void 0 : _a.call(
644
+ props,
645
+ props.field,
646
+ el,
647
+ () => grouped.value.formItemProps
648
+ );
649
+ };
650
+ const setFieldRef = (el) => {
651
+ var _a;
652
+ (_a = props.setComponentRef) == null ? void 0 : _a.call(props, props.field, el);
653
+ };
654
+ watch(
655
+ () => props.field,
656
+ (next, prev) => {
657
+ var _a, _b;
658
+ if (!prev || prev === next) return;
659
+ (_a = props.setFormItemRef) == null ? void 0 : _a.call(props, prev, null, () => grouped.value.formItemProps);
660
+ (_b = props.setComponentRef) == null ? void 0 : _b.call(props, prev, null);
661
+ },
662
+ { flush: "pre" }
663
+ );
664
+ const withContainer = (node, component, containerProps) => component ? h(component, containerProps, { default: () => node }) : node;
665
+ const renderFormItemSlots = (groupedField) => {
666
+ const slots = {};
667
+ Object.entries(groupedField.formItemSlots).forEach(([name, slot]) => {
668
+ slots[name] = (scope) => h(_sfc_main$f, {
669
+ path: groupedField.path,
670
+ component: slot,
671
+ ...scope || {}
672
+ });
673
+ });
674
+ slots.default = () => {
675
+ const field = props.field;
676
+ if (field.fields) {
677
+ return h(_sfc_main$c, {
678
+ grid: field.grid ?? props.grid,
679
+ fields: field.fields,
680
+ disabled: effectiveDisabled.value
681
+ });
682
+ }
683
+ return h(_sfc_main$e, {
684
+ key: componentKey.value,
685
+ ref: setFieldRef,
686
+ ...groupedField.componentProps,
687
+ path: groupedField.path,
688
+ disabled: effectiveDisabled.value
689
+ });
690
+ };
691
+ return slots;
692
+ };
693
+ return () => {
694
+ const groupedField = grouped.value;
695
+ let node = h(
696
+ ElFormItem,
697
+ {
698
+ ...groupedField.formItemProps,
699
+ ref: setItemRef,
700
+ prop: normalizePathKey(groupedField.path),
701
+ path: groupedField.path
702
+ },
703
+ renderFormItemSlots(groupedField)
704
+ );
705
+ node = withContainer(node, groupedField.container, {
706
+ path: groupedField.path
707
+ });
708
+ node = withContainer(
709
+ node,
710
+ enableGrid.value ? ElCol : void 0,
711
+ groupedField.gridItemProps
712
+ );
713
+ return node;
714
+ };
715
+ }
716
+ });
717
+ const _export_sfc = (sfc, props) => {
718
+ const target = sfc.__vccOpts || sfc;
719
+ for (const [key, val] of props) {
720
+ target[key] = val;
721
+ }
722
+ return target;
723
+ };
724
+ const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-6e6641b4"]]);
534
725
  const fieldKeyMap = /* @__PURE__ */ new WeakMap();
535
726
  let fieldKeySeed = 0;
536
727
  const getFieldKey = (field) => {
@@ -544,75 +735,47 @@ const getFieldKey = (field) => {
544
735
  }
545
736
  return key;
546
737
  };
547
- const formItemPropKeys = Object.keys(formItemProps());
548
- const gridItemPropKeys = Object.keys(gridItemProps());
549
- const gridItemPropKeySet = new Set(gridItemPropKeys);
550
- const formItemPropKeySet = new Set(formItemPropKeys);
551
- const formItemSlotKeySet = new Set(FORM_ITEM_SLOT_KEYS);
552
- function useGroupFieldAttrs(validFields) {
553
- const config = INJECT_CONFIG["pro-form-item"];
554
- const injectFormItemProps = inject(config.injectionKey, config.default);
555
- return computed(() => {
556
- const rawInjectProps = toValue(injectFormItemProps) || {};
557
- return validFields.value.map((field) => {
558
- let gridItemProps2 = {};
559
- let formItemProps2 = {};
560
- const componentProps = { slots: {} };
561
- const formItemSlots = {};
562
- if (isPlainObject(field)) {
563
- const { path: _path, prop: _prop, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = field;
564
- const { class: injectClassName, style: injectStyle, span: injectSpan, formItemContainer: injectFormItemContainer, xs, sm, md, lg, xl, ...injectRest } = rawInjectProps;
565
- const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, span: injectSpan };
566
- gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
567
- formItemProps2 = mergeProps(
568
- injectRest,
569
- { class: injectClassName, style: injectStyle },
570
- { class: toValue(formItemClass), style: toValue(formItemStyle) },
571
- formItemDataAttrs
572
- );
573
- const container = formItemContainer ?? injectFormItemContainer;
574
- Object.keys(rest).forEach((k) => {
575
- if (gridItemPropKeySet.has(k)) {
576
- gridItemProps2[k] = rest[k];
577
- } else if (formItemPropKeySet.has(k)) {
578
- formItemProps2[k] = rest[k];
579
- } else {
580
- componentProps[k] = rest[k];
581
- }
582
- });
583
- Object.assign(componentProps, componentDataAttrs);
584
- Object.keys(slots).forEach((k) => {
585
- if (formItemSlotKeySet.has(k)) {
586
- formItemSlots[k] = slots[k];
587
- } else {
588
- componentProps.slots[k] = slots[k];
589
- }
590
- });
591
- return {
592
- path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
593
- gridItemProps: gridItemProps2,
594
- formItemProps: formItemProps2,
595
- formItemSlots,
596
- componentProps,
597
- container,
598
- rawField: field,
599
- renderKey: getFieldKey(field)
600
- };
601
- }
602
- return {
603
- path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
604
- gridItemProps: gridItemProps2,
605
- formItemProps: formItemProps2,
606
- formItemSlots,
607
- componentProps,
608
- rawField: field,
609
- renderKey: getFieldKey(field)
610
- };
611
- });
612
- });
613
- }
738
+ const rowKeyMap = /* @__PURE__ */ new WeakMap();
739
+ let rowKeySeed = 0;
740
+ const getRowKey = (row) => {
741
+ const raw = toRaw(row);
742
+ let key = rowKeyMap.get(raw);
743
+ if (key === void 0) {
744
+ key = ++rowKeySeed;
745
+ rowKeyMap.set(raw, key);
746
+ }
747
+ return key;
748
+ };
749
+ const isIndexSegment = (segment) => /^(?:0|[1-9]\d*)$/.test(segment);
750
+ const getFieldDataKey = (field, rawFormData) => {
751
+ const path = resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS);
752
+ if (!path || rawFormData === null || rawFormData === void 0) {
753
+ return getFieldKey(field);
754
+ }
755
+ const segments = toPath(path);
756
+ let node = rawFormData;
757
+ const rowIds = [];
758
+ let lastRowIndex = -1;
759
+ for (let i = 0; i < segments.length; i++) {
760
+ if (Array.isArray(node)) {
761
+ const segment = segments[i];
762
+ if (!isIndexSegment(segment)) break;
763
+ const element = node[Number(segment)];
764
+ if (element === null || typeof element !== "object") break;
765
+ rowIds.push(getRowKey(toRaw(element)));
766
+ lastRowIndex = i;
767
+ node = element;
768
+ continue;
769
+ }
770
+ if (node === null || typeof node !== "object") break;
771
+ node = node[segments[i]];
772
+ }
773
+ if (lastRowIndex === -1) return getFieldKey(field);
774
+ const rest = segments.slice(lastRowIndex + 1).join(".");
775
+ return `data:${rowIds.join("/")}:${rest}`;
776
+ };
614
777
  const _sfc_main$c = /* @__PURE__ */ defineComponent({
615
- ...{ name: "BaseFormItem", inheritAttrs: false },
778
+ ...{ name: "BaseFormItems", inheritAttrs: false },
616
779
  __name: "index",
617
780
  props: {
618
781
  grid: { type: [Boolean, Object], default: void 0 },
@@ -630,6 +793,20 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
630
793
  )
631
794
  )
632
795
  );
796
+ const injectedForm = inject(InjectionFormKey, void 0);
797
+ const renderedFields = computed(() => {
798
+ const rawFormData = (injectedForm == null ? void 0 : injectedForm.formData) ? toRaw(injectedForm.formData) : void 0;
799
+ const seen = /* @__PURE__ */ new Map();
800
+ return validFields.value.map((field) => {
801
+ const baseKey = getFieldDataKey(field, rawFormData);
802
+ const count = seen.get(baseKey) ?? 0;
803
+ seen.set(baseKey, count + 1);
804
+ return {
805
+ field,
806
+ key: count === 0 ? baseKey : `${String(baseKey)}#${count}`
807
+ };
808
+ });
809
+ });
633
810
  const config = INJECT_CONFIG["pro-form"];
634
811
  const injectFormConfig = inject(config.injectionKey, config.default);
635
812
  const injectGrid = computed(() => {
@@ -662,14 +839,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
662
839
  }
663
840
  }
664
841
  };
665
- const setFormItemRef = (field, el, formItemProps2) => {
842
+ const setFormItemRef = (field, el, getFormItemProps) => {
666
843
  if (!field || typeof field !== "object") return;
667
844
  const raw = toRaw(field);
668
845
  if (el) {
669
846
  formItemInstanceMap.set(raw, el);
670
847
  defineFieldAccessors(raw, {
671
848
  getFormItemRef: () => formItemInstanceMap.get(raw),
672
- getFormItemComputedProps: () => formItemProps2
849
+ getFormItemComputedProps: getFormItemProps
673
850
  });
674
851
  } else {
675
852
  formItemInstanceMap.delete(raw);
@@ -698,80 +875,34 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
698
875
  delete raw.getComponentComputedProps;
699
876
  }
700
877
  };
701
- const groupedFields = useGroupFieldAttrs(validFields);
702
878
  return (_ctx, _cache) => {
703
- const _component_BaseFormItem = resolveComponent("BaseFormItem");
704
- return openBlock(), createBlock(_sfc_main$f, mergeProps({
705
- component: enableGrid.value ? unref(ElRow) : void 0
706
- }, computedGridProps.value, { style: { "width": "100%" } }), {
879
+ return enableGrid.value ? (openBlock(), createBlock(unref(ElRow), mergeProps({ key: 0 }, computedGridProps.value, { style: { "width": "100%" } }), {
707
880
  default: withCtx(() => [
708
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(groupedFields), (item) => {
709
- return openBlock(), createBlock(_sfc_main$f, mergeProps({
710
- key: item.renderKey,
711
- component: enableGrid.value ? unref(ElCol) : void 0
712
- }, { ref_for: true }, item.gridItemProps), {
713
- default: withCtx(() => [
714
- createVNode(_sfc_main$f, {
715
- component: item.container,
716
- path: item.path
717
- }, {
718
- default: withCtx(() => [
719
- createVNode(unref(ElFormItem), mergeProps({ ref_for: true }, item.formItemProps, {
720
- ref_for: true,
721
- ref: (el) => setFormItemRef(item.rawField, el, item.formItemProps),
722
- prop: unref(normalizePathKey)(item.path),
723
- path: item.path
724
- }), createSlots({
725
- default: withCtx(() => [
726
- item.rawField.fields ? (openBlock(), createBlock(_component_BaseFormItem, {
727
- key: 0,
728
- grid: item.rawField.grid ?? props.grid,
729
- fields: item.rawField.fields,
730
- disabled: toValue(item.rawField.disabled) ?? props.disabled
731
- }, null, 8, ["grid", "fields", "disabled"])) : (openBlock(), createBlock(_sfc_main$d, mergeProps({
732
- key: 1,
733
- ref_for: true,
734
- ref: (el) => setComponentRef(item.rawField, el)
735
- }, { ref_for: true }, item.componentProps, {
736
- path: item.path,
737
- disabled: toValue(item.rawField.disabled) ?? props.disabled
738
- }), null, 16, ["path", "disabled"]))
739
- ]),
740
- _: 2
741
- }, [
742
- renderList(item.formItemSlots, (slot, name) => {
743
- return {
744
- name,
745
- fn: withCtx((scoped) => [
746
- createVNode(_sfc_main$e, mergeProps({
747
- path: item.path,
748
- component: slot
749
- }, { ref_for: true }, scoped), null, 16, ["path", "component"])
750
- ])
751
- };
752
- })
753
- ]), 1040, ["prop", "path"])
754
- ]),
755
- _: 2
756
- }, 1032, ["component", "path"])
757
- ]),
758
- _: 2
759
- }, 1040, ["component"]);
881
+ (openBlock(true), createElementBlock(Fragment, null, renderList(renderedFields.value, (item) => {
882
+ return openBlock(), createBlock(BaseFormItem, {
883
+ key: item.key,
884
+ field: item.field,
885
+ grid: props.grid,
886
+ disabled: props.disabled,
887
+ "set-form-item-ref": setFormItemRef,
888
+ "set-component-ref": setComponentRef
889
+ }, null, 8, ["field", "grid", "disabled"]);
760
890
  }), 128))
761
891
  ]),
762
892
  _: 1
763
- }, 16, ["component"]);
893
+ }, 16)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(renderedFields.value, (item) => {
894
+ return openBlock(), createBlock(BaseFormItem, {
895
+ key: item.key,
896
+ field: item.field,
897
+ grid: props.grid,
898
+ disabled: props.disabled,
899
+ "set-form-item-ref": setFormItemRef,
900
+ "set-component-ref": setComponentRef
901
+ }, null, 8, ["field", "grid", "disabled"]);
902
+ }), 128));
764
903
  };
765
904
  }
766
905
  });
767
- const _export_sfc = (sfc, props) => {
768
- const target = sfc.__vccOpts || sfc;
769
- for (const [key, val] of props) {
770
- target[key] = val;
771
- }
772
- return target;
773
- };
774
- const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-a29a46c8"]]);
775
906
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
776
907
  ...{ name: "ProForm", inheritAttrs: false },
777
908
  __name: "index",
@@ -794,10 +925,13 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
794
925
  var _a;
795
926
  return (_a = currentForm.value) == null ? void 0 : _a.formData;
796
927
  });
797
- const setFormRef = (el) => {
798
- var _a, _b;
799
- return (_b = (_a = currentForm.value) == null ? void 0 : _a.setFormRef) == null ? void 0 : _b.call(_a, el);
800
- };
928
+ const formRefSetter = computed(() => {
929
+ const form = currentForm.value;
930
+ return (el) => {
931
+ var _a;
932
+ return (_a = form == null ? void 0 : form.setFormRef) == null ? void 0 : _a.call(form, el);
933
+ };
934
+ });
801
935
  let formInstanceCounter = 0;
802
936
  const formInstanceKeyMap = /* @__PURE__ */ new WeakMap();
803
937
  const getFormKey = (f) => {
@@ -837,7 +971,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
837
971
  return (_ctx, _cache) => {
838
972
  return openBlock(), createBlock(unref(ElForm), mergeProps({
839
973
  key: formKey.value,
840
- ref: setFormRef,
974
+ ref: formRefSetter.value,
841
975
  model: formData.value
842
976
  }, formAttrs.value, {
843
977
  class: "pro-form",
@@ -845,7 +979,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
845
979
  }, ["prevent"]))
846
980
  }), {
847
981
  default: withCtx(() => [
848
- createVNode(BaseFormItem, {
982
+ createVNode(_sfc_main$c, {
849
983
  fields: fields.value,
850
984
  grid: props.grid,
851
985
  disabled: formDisabled.value
@@ -1354,7 +1488,7 @@ const renderColumn = (column, ancestors = /* @__PURE__ */ new Set()) => {
1354
1488
  }
1355
1489
  if (typeof column.render === "function") {
1356
1490
  return h(ElTableColumn, vnodeProps, {
1357
- default: (scope) => h(_sfc_main$e, {
1491
+ default: (scope) => h(_sfc_main$f, {
1358
1492
  component: column.render({
1359
1493
  ...scope,
1360
1494
  column,
@@ -1480,16 +1614,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1480
1614
  if (props.search && attrs.onSearch) {
1481
1615
  warnSearchConfig("duplicate");
1482
1616
  }
1483
- if (!search) return;
1484
- const searchPromise = search();
1485
- if (!isPromise(searchPromise)) {
1617
+ const results = callListeners(search);
1618
+ if (!results.length) return;
1619
+ const promises = results.filter(isPromise);
1620
+ if (!promises.length) {
1486
1621
  warnSearchConfig("not-promise");
1487
1622
  return;
1488
1623
  }
1489
1624
  const seq = ++searchSequence;
1490
1625
  loading.value = true;
1491
1626
  try {
1492
- await searchPromise;
1627
+ const settled = await Promise.allSettled(promises);
1628
+ const rejected = settled.find((item) => item.status === "rejected");
1629
+ if (rejected) throw rejected.reason;
1493
1630
  } finally {
1494
1631
  if (seq === searchSequence) {
1495
1632
  loading.value = false;
@@ -1657,8 +1794,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1657
1794
  });
1658
1795
  };
1659
1796
  const onPaginationChange = (currentPage, pageSize) => {
1660
- var _a;
1661
- (_a = attrs.onChange) == null ? void 0 : _a.call(attrs, currentPage, pageSize);
1797
+ callListeners(attrs.onChange, currentPage, pageSize);
1662
1798
  };
1663
1799
  const searchFormVisible = computed(() => {
1664
1800
  var _a, _b, _c, _d;
@@ -1701,7 +1837,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1701
1837
  class: normalizeClass(["pro-table", unref(attrs).class]),
1702
1838
  style: normalizeStyle(unref(attrs).style)
1703
1839
  }, [
1704
- searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$f, {
1840
+ searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$g, {
1705
1841
  key: 0,
1706
1842
  component: computedSearchFormConfig.value.container
1707
1843
  }, {
@@ -1721,7 +1857,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1721
1857
  ]),
1722
1858
  _: 3
1723
1859
  }, 8, ["component"])) : createCommentVNode("", true),
1724
- createVNode(_sfc_main$f, { component: computedTableContainer.value }, {
1860
+ createVNode(_sfc_main$g, { component: computedTableContainer.value }, {
1725
1861
  default: withCtx(() => [
1726
1862
  createElementVNode("div", _hoisted_1, [
1727
1863
  _ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
@@ -1782,7 +1918,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1782
1918
  };
1783
1919
  }
1784
1920
  });
1785
- const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-9774f05e"]]);
1921
+ const ProTable = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-6a338bf0"]]);
1786
1922
  function useTable(params = {}) {
1787
1923
  const { data, columns, ...rest } = params;
1788
1924
  const coreTable = useTable$1({
@@ -1815,6 +1951,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1815
1951
  (key) => {
1816
1952
  const config = INJECT_CONFIG[key];
1817
1953
  const ignored = config.ignoreProps;
1954
+ const parentConfig = inject(config.injectionKey, void 0);
1818
1955
  provide(
1819
1956
  config.injectionKey,
1820
1957
  computed(
@@ -1823,6 +1960,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1823
1960
  return omit(
1824
1961
  {
1825
1962
  ...config.default,
1963
+ ...toValue(parentConfig) || {},
1826
1964
  ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1827
1965
  },
1828
1966
  ignored ?? []
@@ -1836,12 +1974,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1836
1974
  Object.keys(props.componentVars).forEach((key) => {
1837
1975
  if (!(key in INJECT_CONFIG)) {
1838
1976
  const config = ensureInjectConfig(key);
1977
+ const parentConfig = inject(config.injectionKey, void 0);
1839
1978
  provide(
1840
1979
  config.injectionKey,
1841
1980
  computed(() => {
1842
1981
  var _a;
1843
1982
  return {
1844
- ...config.default,
1983
+ ...toValue(parentConfig) || {},
1845
1984
  ...getObject((_a = props.componentVars) == null ? void 0 : _a[key])
1846
1985
  };
1847
1986
  })
@@ -1849,17 +1988,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1849
1988
  }
1850
1989
  });
1851
1990
  }
1991
+ const parentComponentVars = inject(INJECT_COMPONENT_VARS, void 0);
1852
1992
  provide(
1853
1993
  INJECT_COMPONENT_VARS,
1854
- computed(() => props.componentVars ?? {})
1994
+ computed(
1995
+ () => mergeComponentVars(
1996
+ toValue(parentComponentVars),
1997
+ props.componentVars
1998
+ )
1999
+ )
1855
2000
  );
2001
+ const parentComponents = inject(INJECT_COMPONENTS, void 0);
1856
2002
  provide(
1857
2003
  INJECT_COMPONENTS,
1858
- computed(() => props.componentMap)
2004
+ computed(() => ({
2005
+ ...toValue(parentComponents) || {},
2006
+ ...props.componentMap ?? {}
2007
+ }))
1859
2008
  );
2009
+ const parentLocale = inject(LOCALE_INJECT_KEY, void 0);
1860
2010
  provide(
1861
2011
  LOCALE_INJECT_KEY,
1862
- computed(() => props.locale)
2012
+ computed(() => ({
2013
+ ...toValue(parentLocale) || {},
2014
+ ...props.locale ?? {}
2015
+ }))
1863
2016
  );
1864
2017
  return (_ctx, _cache) => {
1865
2018
  return renderSlot(_ctx.$slots, "default");
@@ -1890,12 +2043,12 @@ const index = {
1890
2043
  }
1891
2044
  };
1892
2045
  export {
1893
- _sfc_main$f as ContainerFragment,
2046
+ _sfc_main$g as ContainerFragment,
1894
2047
  LOCALE_INJECT_KEY,
1895
2048
  _sfc_main as ProComponentProvider,
1896
2049
  _sfc_main$b as ProForm,
1897
2050
  ProTable,
1898
- _sfc_main$e as SlotComponent,
2051
+ _sfc_main$f as SlotComponent,
1899
2052
  index as default,
1900
2053
  enUS,
1901
2054
  useFields,