@qin-ui/element-plus-pro 1.4.2 → 1.4.3
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.
- package/api.json +2 -2
- package/es/components/form/components/BaseFormItem/index.vue.d.ts +60 -9
- package/es/components/form/components/BaseFormItem/index.vue.d.ts.map +1 -1
- package/es/components/form/components/BaseFormItems/index.vue.d.ts +13 -0
- package/es/components/form/components/BaseFormItems/index.vue.d.ts.map +1 -0
- package/es/components/form/components/index.d.ts +6 -6
- package/es/components/form/components/index.d.ts.map +1 -1
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts +10 -2
- package/es/components/form/hooks/useGroupFieldAttrs.d.ts.map +1 -1
- package/es/components/form/utils/fieldKey.d.ts +12 -0
- package/es/components/form/utils/fieldKey.d.ts.map +1 -1
- package/es/element-plus-pro.css +2 -1
- package/es/index.js +274 -149
- package/es/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/components/BaseFormItem/index.vue +145 -176
- package/src/components/form/components/BaseFormItems/index.vue +183 -0
- package/src/components/form/components/ProForm/index.vue +4 -4
- package/src/components/form/components/index.ts +6 -6
- package/src/components/form/hooks/useGroupFieldAttrs.ts +104 -79
- package/src/components/form/utils/fieldKey.ts +64 -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,
|
|
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,
|
|
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, normalizePathKey, toPath, isObjectItem, InjectionFormKey, createFormProxy, 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 || {};
|
|
@@ -216,7 +216,7 @@ const ensureInjectConfig = (key) => {
|
|
|
216
216
|
DYNAMIC_INJECT_CONFIG[key] = created;
|
|
217
217
|
return created;
|
|
218
218
|
};
|
|
219
|
-
const _sfc_main$
|
|
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$
|
|
236
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
237
237
|
...{ name: "SlotComponent", inheritAttrs: false },
|
|
238
238
|
__name: "index",
|
|
239
239
|
props: {
|
|
@@ -395,7 +395,7 @@ const useLocale = () => {
|
|
|
395
395
|
};
|
|
396
396
|
return { t, lang };
|
|
397
397
|
};
|
|
398
|
-
const _sfc_main$
|
|
398
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
399
399
|
...{ name: "BaseField", inheritAttrs: false },
|
|
400
400
|
__name: "index",
|
|
401
401
|
props: {
|
|
@@ -502,7 +502,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
502
502
|
getComponentComputedProps: () => groupedAttrs.value.attrs
|
|
503
503
|
});
|
|
504
504
|
return (_ctx, _cache) => {
|
|
505
|
-
return openBlock(), createBlock(_sfc_main$
|
|
505
|
+
return openBlock(), createBlock(_sfc_main$g, {
|
|
506
506
|
component: groupedAttrs.value.componentContainer,
|
|
507
507
|
path: props.path
|
|
508
508
|
}, {
|
|
@@ -518,7 +518,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
518
518
|
return {
|
|
519
519
|
name,
|
|
520
520
|
fn: withCtx((scoped) => [
|
|
521
|
-
createVNode(_sfc_main$
|
|
521
|
+
createVNode(_sfc_main$f, mergeProps({
|
|
522
522
|
path: props.path
|
|
523
523
|
}, scoped, { component: slot }), null, 16, ["path", "component"])
|
|
524
524
|
])
|
|
@@ -531,6 +531,191 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
531
531
|
};
|
|
532
532
|
}
|
|
533
533
|
});
|
|
534
|
+
const formItemPropKeys = Object.keys(formItemProps());
|
|
535
|
+
const gridItemPropKeys = Object.keys(gridItemProps());
|
|
536
|
+
const gridItemPropKeySet = new Set(gridItemPropKeys);
|
|
537
|
+
const formItemPropKeySet = new Set(formItemPropKeys);
|
|
538
|
+
const formItemSlotKeySet = new Set(FORM_ITEM_SLOT_KEYS);
|
|
539
|
+
const groupField = (field, rawInjectProps) => {
|
|
540
|
+
let gridItemProps2 = {};
|
|
541
|
+
let formItemProps2 = {};
|
|
542
|
+
const componentProps = { slots: {} };
|
|
543
|
+
const formItemSlots = {};
|
|
544
|
+
if (isPlainObject(field)) {
|
|
545
|
+
const { path: _path, prop: _prop, fields, formItemClass, formItemStyle, formItemContainer, hidden, span, getFormItemRef, getComponentRef, getFormItemComputedProps, getComponentComputedProps, slots = {}, formItemDataAttrs = {}, componentDataAttrs = {}, extraProps, ...rest } = field;
|
|
546
|
+
const { class: injectClassName, style: injectStyle, span: injectSpan, formItemContainer: injectFormItemContainer, xs, sm, md, lg, xl, ...injectRest } = rawInjectProps;
|
|
547
|
+
const initGridItemProps = span || span === 0 ? { span } : { xs, sm, md, lg, xl, span: injectSpan };
|
|
548
|
+
gridItemProps2 = fields ? { ...initGridItemProps, span: span ?? 24 } : initGridItemProps;
|
|
549
|
+
formItemProps2 = mergeProps(
|
|
550
|
+
injectRest,
|
|
551
|
+
{ class: injectClassName, style: injectStyle },
|
|
552
|
+
{ class: toValue(formItemClass), style: toValue(formItemStyle) },
|
|
553
|
+
formItemDataAttrs
|
|
554
|
+
);
|
|
555
|
+
const container = formItemContainer ?? injectFormItemContainer;
|
|
556
|
+
Object.keys(rest).forEach((k) => {
|
|
557
|
+
if (gridItemPropKeySet.has(k)) {
|
|
558
|
+
gridItemProps2[k] = rest[k];
|
|
559
|
+
} else if (formItemPropKeySet.has(k)) {
|
|
560
|
+
formItemProps2[k] = rest[k];
|
|
561
|
+
} else {
|
|
562
|
+
componentProps[k] = rest[k];
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
Object.assign(componentProps, componentDataAttrs);
|
|
566
|
+
Object.keys(slots).forEach((k) => {
|
|
567
|
+
if (formItemSlotKeySet.has(k)) {
|
|
568
|
+
formItemSlots[k] = slots[k];
|
|
569
|
+
} else {
|
|
570
|
+
componentProps.slots[k] = slots[k];
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
return {
|
|
574
|
+
path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
|
|
575
|
+
gridItemProps: gridItemProps2,
|
|
576
|
+
formItemProps: formItemProps2,
|
|
577
|
+
formItemSlots,
|
|
578
|
+
componentProps,
|
|
579
|
+
container,
|
|
580
|
+
rawField: field
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
return {
|
|
584
|
+
path: resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS),
|
|
585
|
+
gridItemProps: gridItemProps2,
|
|
586
|
+
formItemProps: formItemProps2,
|
|
587
|
+
formItemSlots,
|
|
588
|
+
componentProps,
|
|
589
|
+
rawField: field
|
|
590
|
+
};
|
|
591
|
+
};
|
|
592
|
+
function useGroupedField(field) {
|
|
593
|
+
const config = INJECT_CONFIG["pro-form-item"];
|
|
594
|
+
const injectFormItemProps = inject(config.injectionKey, config.default);
|
|
595
|
+
return computed(
|
|
596
|
+
() => groupField(toValue(field), toValue(injectFormItemProps) || {})
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
const _sfc_main$d = defineComponent({
|
|
600
|
+
name: "BaseFormItem",
|
|
601
|
+
inheritAttrs: false,
|
|
602
|
+
props: {
|
|
603
|
+
/** 字段配置 */
|
|
604
|
+
field: { type: Object, required: true },
|
|
605
|
+
/** 是否启用网格布局 */
|
|
606
|
+
grid: {
|
|
607
|
+
type: [Boolean, Object],
|
|
608
|
+
default: void 0
|
|
609
|
+
},
|
|
610
|
+
/** 上层下发的禁用状态 */
|
|
611
|
+
disabled: { type: Boolean, default: void 0 },
|
|
612
|
+
/** FormItem 实例登记回调 */
|
|
613
|
+
setFormItemRef: {
|
|
614
|
+
type: Function,
|
|
615
|
+
default: void 0
|
|
616
|
+
},
|
|
617
|
+
/** 控件实例登记回调 */
|
|
618
|
+
setComponentRef: {
|
|
619
|
+
type: Function,
|
|
620
|
+
default: void 0
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
setup(props) {
|
|
624
|
+
const grouped = useGroupedField(() => props.field);
|
|
625
|
+
const enableGrid = computed(() => !!props.grid);
|
|
626
|
+
const componentKey = computed(() => {
|
|
627
|
+
const field = props.field;
|
|
628
|
+
const component = toValue(field.component);
|
|
629
|
+
if (typeof component !== "string") return "component-object";
|
|
630
|
+
return `string:${component}:${toValue(field.type) ?? ""}`;
|
|
631
|
+
});
|
|
632
|
+
const effectiveDisabled = computed(
|
|
633
|
+
() => toValue(props.field.disabled) ?? props.disabled
|
|
634
|
+
);
|
|
635
|
+
const setItemRef = (el) => {
|
|
636
|
+
var _a;
|
|
637
|
+
(_a = props.setFormItemRef) == null ? void 0 : _a.call(
|
|
638
|
+
props,
|
|
639
|
+
props.field,
|
|
640
|
+
el,
|
|
641
|
+
() => grouped.value.formItemProps
|
|
642
|
+
);
|
|
643
|
+
};
|
|
644
|
+
const setFieldRef = (el) => {
|
|
645
|
+
var _a;
|
|
646
|
+
(_a = props.setComponentRef) == null ? void 0 : _a.call(props, props.field, el);
|
|
647
|
+
};
|
|
648
|
+
watch(
|
|
649
|
+
() => props.field,
|
|
650
|
+
(next, prev) => {
|
|
651
|
+
var _a, _b;
|
|
652
|
+
if (!prev || prev === next) return;
|
|
653
|
+
(_a = props.setFormItemRef) == null ? void 0 : _a.call(props, prev, null, () => grouped.value.formItemProps);
|
|
654
|
+
(_b = props.setComponentRef) == null ? void 0 : _b.call(props, prev, null);
|
|
655
|
+
},
|
|
656
|
+
{ flush: "pre" }
|
|
657
|
+
);
|
|
658
|
+
const withContainer = (node, component, containerProps) => component ? h(component, containerProps, { default: () => node }) : node;
|
|
659
|
+
const renderFormItemSlots = (groupedField) => {
|
|
660
|
+
const slots = {};
|
|
661
|
+
Object.entries(groupedField.formItemSlots).forEach(([name, slot]) => {
|
|
662
|
+
slots[name] = (scope) => h(_sfc_main$f, {
|
|
663
|
+
path: groupedField.path,
|
|
664
|
+
component: slot,
|
|
665
|
+
...scope || {}
|
|
666
|
+
});
|
|
667
|
+
});
|
|
668
|
+
slots.default = () => {
|
|
669
|
+
const field = props.field;
|
|
670
|
+
if (field.fields) {
|
|
671
|
+
return h(_sfc_main$c, {
|
|
672
|
+
grid: field.grid ?? props.grid,
|
|
673
|
+
fields: field.fields,
|
|
674
|
+
disabled: effectiveDisabled.value
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
return h(_sfc_main$e, {
|
|
678
|
+
key: componentKey.value,
|
|
679
|
+
ref: setFieldRef,
|
|
680
|
+
...groupedField.componentProps,
|
|
681
|
+
path: groupedField.path,
|
|
682
|
+
disabled: effectiveDisabled.value
|
|
683
|
+
});
|
|
684
|
+
};
|
|
685
|
+
return slots;
|
|
686
|
+
};
|
|
687
|
+
return () => {
|
|
688
|
+
const groupedField = grouped.value;
|
|
689
|
+
let node = h(
|
|
690
|
+
ElFormItem,
|
|
691
|
+
{
|
|
692
|
+
...groupedField.formItemProps,
|
|
693
|
+
ref: setItemRef,
|
|
694
|
+
prop: normalizePathKey(groupedField.path),
|
|
695
|
+
path: groupedField.path
|
|
696
|
+
},
|
|
697
|
+
renderFormItemSlots(groupedField)
|
|
698
|
+
);
|
|
699
|
+
node = withContainer(node, groupedField.container, {
|
|
700
|
+
path: groupedField.path
|
|
701
|
+
});
|
|
702
|
+
node = withContainer(
|
|
703
|
+
node,
|
|
704
|
+
enableGrid.value ? ElCol : void 0,
|
|
705
|
+
groupedField.gridItemProps
|
|
706
|
+
);
|
|
707
|
+
return node;
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
const _export_sfc = (sfc, props) => {
|
|
712
|
+
const target = sfc.__vccOpts || sfc;
|
|
713
|
+
for (const [key, val] of props) {
|
|
714
|
+
target[key] = val;
|
|
715
|
+
}
|
|
716
|
+
return target;
|
|
717
|
+
};
|
|
718
|
+
const BaseFormItem = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__scopeId", "data-v-6e6641b4"]]);
|
|
534
719
|
const fieldKeyMap = /* @__PURE__ */ new WeakMap();
|
|
535
720
|
let fieldKeySeed = 0;
|
|
536
721
|
const getFieldKey = (field) => {
|
|
@@ -544,75 +729,47 @@ const getFieldKey = (field) => {
|
|
|
544
729
|
}
|
|
545
730
|
return key;
|
|
546
731
|
};
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
const
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
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
|
-
}
|
|
732
|
+
const rowKeyMap = /* @__PURE__ */ new WeakMap();
|
|
733
|
+
let rowKeySeed = 0;
|
|
734
|
+
const getRowKey = (row) => {
|
|
735
|
+
const raw = toRaw(row);
|
|
736
|
+
let key = rowKeyMap.get(raw);
|
|
737
|
+
if (key === void 0) {
|
|
738
|
+
key = ++rowKeySeed;
|
|
739
|
+
rowKeyMap.set(raw, key);
|
|
740
|
+
}
|
|
741
|
+
return key;
|
|
742
|
+
};
|
|
743
|
+
const isIndexSegment = (segment) => /^(?:0|[1-9]\d*)$/.test(segment);
|
|
744
|
+
const getFieldDataKey = (field, rawFormData) => {
|
|
745
|
+
const path = resolveFieldIdentity(field, ELEMENT_FIELD_IDENTITY_KEYS);
|
|
746
|
+
if (!path || rawFormData === null || rawFormData === void 0) {
|
|
747
|
+
return getFieldKey(field);
|
|
748
|
+
}
|
|
749
|
+
const segments = toPath(path);
|
|
750
|
+
let node = rawFormData;
|
|
751
|
+
const rowIds = [];
|
|
752
|
+
let lastRowIndex = -1;
|
|
753
|
+
for (let i = 0; i < segments.length; i++) {
|
|
754
|
+
if (Array.isArray(node)) {
|
|
755
|
+
const segment = segments[i];
|
|
756
|
+
if (!isIndexSegment(segment)) break;
|
|
757
|
+
const element = node[Number(segment)];
|
|
758
|
+
if (element === null || typeof element !== "object") break;
|
|
759
|
+
rowIds.push(getRowKey(toRaw(element)));
|
|
760
|
+
lastRowIndex = i;
|
|
761
|
+
node = element;
|
|
762
|
+
continue;
|
|
763
|
+
}
|
|
764
|
+
if (node === null || typeof node !== "object") break;
|
|
765
|
+
node = node[segments[i]];
|
|
766
|
+
}
|
|
767
|
+
if (lastRowIndex === -1) return getFieldKey(field);
|
|
768
|
+
const rest = segments.slice(lastRowIndex + 1).join(".");
|
|
769
|
+
return `data:${rowIds.join("/")}:${rest}`;
|
|
770
|
+
};
|
|
614
771
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
615
|
-
...{ name: "
|
|
772
|
+
...{ name: "BaseFormItems", inheritAttrs: false },
|
|
616
773
|
__name: "index",
|
|
617
774
|
props: {
|
|
618
775
|
grid: { type: [Boolean, Object], default: void 0 },
|
|
@@ -630,6 +787,20 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
630
787
|
)
|
|
631
788
|
)
|
|
632
789
|
);
|
|
790
|
+
const injectedForm = inject(InjectionFormKey, void 0);
|
|
791
|
+
const renderedFields = computed(() => {
|
|
792
|
+
const rawFormData = (injectedForm == null ? void 0 : injectedForm.formData) ? toRaw(injectedForm.formData) : void 0;
|
|
793
|
+
const seen = /* @__PURE__ */ new Map();
|
|
794
|
+
return validFields.value.map((field) => {
|
|
795
|
+
const baseKey = getFieldDataKey(field, rawFormData);
|
|
796
|
+
const count = seen.get(baseKey) ?? 0;
|
|
797
|
+
seen.set(baseKey, count + 1);
|
|
798
|
+
return {
|
|
799
|
+
field,
|
|
800
|
+
key: count === 0 ? baseKey : `${String(baseKey)}#${count}`
|
|
801
|
+
};
|
|
802
|
+
});
|
|
803
|
+
});
|
|
633
804
|
const config = INJECT_CONFIG["pro-form"];
|
|
634
805
|
const injectFormConfig = inject(config.injectionKey, config.default);
|
|
635
806
|
const injectGrid = computed(() => {
|
|
@@ -662,14 +833,14 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
662
833
|
}
|
|
663
834
|
}
|
|
664
835
|
};
|
|
665
|
-
const setFormItemRef = (field, el,
|
|
836
|
+
const setFormItemRef = (field, el, getFormItemProps) => {
|
|
666
837
|
if (!field || typeof field !== "object") return;
|
|
667
838
|
const raw = toRaw(field);
|
|
668
839
|
if (el) {
|
|
669
840
|
formItemInstanceMap.set(raw, el);
|
|
670
841
|
defineFieldAccessors(raw, {
|
|
671
842
|
getFormItemRef: () => formItemInstanceMap.get(raw),
|
|
672
|
-
getFormItemComputedProps:
|
|
843
|
+
getFormItemComputedProps: getFormItemProps
|
|
673
844
|
});
|
|
674
845
|
} else {
|
|
675
846
|
formItemInstanceMap.delete(raw);
|
|
@@ -698,80 +869,34 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
698
869
|
delete raw.getComponentComputedProps;
|
|
699
870
|
}
|
|
700
871
|
};
|
|
701
|
-
const groupedFields = useGroupFieldAttrs(validFields);
|
|
702
872
|
return (_ctx, _cache) => {
|
|
703
|
-
|
|
704
|
-
return openBlock(), createBlock(_sfc_main$f, mergeProps({
|
|
705
|
-
component: enableGrid.value ? unref(ElRow) : void 0
|
|
706
|
-
}, computedGridProps.value, { style: { "width": "100%" } }), {
|
|
873
|
+
return enableGrid.value ? (openBlock(), createBlock(unref(ElRow), mergeProps({ key: 0 }, computedGridProps.value, { style: { "width": "100%" } }), {
|
|
707
874
|
default: withCtx(() => [
|
|
708
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
709
|
-
return openBlock(), createBlock(
|
|
710
|
-
key: item.
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
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"]);
|
|
875
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(renderedFields.value, (item) => {
|
|
876
|
+
return openBlock(), createBlock(BaseFormItem, {
|
|
877
|
+
key: item.key,
|
|
878
|
+
field: item.field,
|
|
879
|
+
grid: props.grid,
|
|
880
|
+
disabled: props.disabled,
|
|
881
|
+
"set-form-item-ref": setFormItemRef,
|
|
882
|
+
"set-component-ref": setComponentRef
|
|
883
|
+
}, null, 8, ["field", "grid", "disabled"]);
|
|
760
884
|
}), 128))
|
|
761
885
|
]),
|
|
762
886
|
_: 1
|
|
763
|
-
}, 16,
|
|
887
|
+
}, 16)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(renderedFields.value, (item) => {
|
|
888
|
+
return openBlock(), createBlock(BaseFormItem, {
|
|
889
|
+
key: item.key,
|
|
890
|
+
field: item.field,
|
|
891
|
+
grid: props.grid,
|
|
892
|
+
disabled: props.disabled,
|
|
893
|
+
"set-form-item-ref": setFormItemRef,
|
|
894
|
+
"set-component-ref": setComponentRef
|
|
895
|
+
}, null, 8, ["field", "grid", "disabled"]);
|
|
896
|
+
}), 128));
|
|
764
897
|
};
|
|
765
898
|
}
|
|
766
899
|
});
|
|
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
900
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
776
901
|
...{ name: "ProForm", inheritAttrs: false },
|
|
777
902
|
__name: "index",
|
|
@@ -845,7 +970,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
845
970
|
}, ["prevent"]))
|
|
846
971
|
}), {
|
|
847
972
|
default: withCtx(() => [
|
|
848
|
-
createVNode(
|
|
973
|
+
createVNode(_sfc_main$c, {
|
|
849
974
|
fields: fields.value,
|
|
850
975
|
grid: props.grid,
|
|
851
976
|
disabled: formDisabled.value
|
|
@@ -1354,7 +1479,7 @@ const renderColumn = (column, ancestors = /* @__PURE__ */ new Set()) => {
|
|
|
1354
1479
|
}
|
|
1355
1480
|
if (typeof column.render === "function") {
|
|
1356
1481
|
return h(ElTableColumn, vnodeProps, {
|
|
1357
|
-
default: (scope) => h(_sfc_main$
|
|
1482
|
+
default: (scope) => h(_sfc_main$f, {
|
|
1358
1483
|
component: column.render({
|
|
1359
1484
|
...scope,
|
|
1360
1485
|
column,
|
|
@@ -1701,7 +1826,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1701
1826
|
class: normalizeClass(["pro-table", unref(attrs).class]),
|
|
1702
1827
|
style: normalizeStyle(unref(attrs).style)
|
|
1703
1828
|
}, [
|
|
1704
|
-
searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$
|
|
1829
|
+
searchFormVisible.value || _ctx.$slots["search-form"] ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1705
1830
|
key: 0,
|
|
1706
1831
|
component: computedSearchFormConfig.value.container
|
|
1707
1832
|
}, {
|
|
@@ -1721,7 +1846,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1721
1846
|
]),
|
|
1722
1847
|
_: 3
|
|
1723
1848
|
}, 8, ["component"])) : createCommentVNode("", true),
|
|
1724
|
-
createVNode(_sfc_main$
|
|
1849
|
+
createVNode(_sfc_main$g, { component: computedTableContainer.value }, {
|
|
1725
1850
|
default: withCtx(() => [
|
|
1726
1851
|
createElementVNode("div", _hoisted_1, [
|
|
1727
1852
|
_ctx.$slots["button-bar"] ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
@@ -1890,12 +2015,12 @@ const index = {
|
|
|
1890
2015
|
}
|
|
1891
2016
|
};
|
|
1892
2017
|
export {
|
|
1893
|
-
_sfc_main$
|
|
2018
|
+
_sfc_main$g as ContainerFragment,
|
|
1894
2019
|
LOCALE_INJECT_KEY,
|
|
1895
2020
|
_sfc_main as ProComponentProvider,
|
|
1896
2021
|
_sfc_main$b as ProForm,
|
|
1897
2022
|
ProTable,
|
|
1898
|
-
_sfc_main$
|
|
2023
|
+
_sfc_main$f as SlotComponent,
|
|
1899
2024
|
index as default,
|
|
1900
2025
|
enUS,
|
|
1901
2026
|
useFields,
|