@qin-ui/antd-vue-pro 2.0.14 → 2.0.16
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/es/form/index.js +11 -8
- package/package.json +1 -1
package/es/form/index.js
CHANGED
|
@@ -493,18 +493,14 @@ function useForm(...args) {
|
|
|
493
493
|
...useFormRef()
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
|
-
const initPropsMap = /* @__PURE__ */ new Map();
|
|
497
496
|
const getInitProps = (field) => {
|
|
498
497
|
const { component } = field;
|
|
499
498
|
const type = component === "input" ? "" : field.type;
|
|
500
499
|
if (COMPONENT_MAP.has(component)) {
|
|
501
500
|
const k = [component, type].filter(Boolean).join(".");
|
|
502
|
-
if (
|
|
503
|
-
return initPropsMap.get(k);
|
|
504
|
-
} else if (INJECT_CONFIG[k]) {
|
|
501
|
+
if (INJECT_CONFIG[k]) {
|
|
505
502
|
const config = INJECT_CONFIG[k];
|
|
506
503
|
const injectProps = inject(config.injectionKey, config.default);
|
|
507
|
-
initPropsMap.set(k, injectProps);
|
|
508
504
|
return injectProps;
|
|
509
505
|
}
|
|
510
506
|
}
|
|
@@ -527,13 +523,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
527
523
|
formItemContext.onFieldChange();
|
|
528
524
|
};
|
|
529
525
|
const attrs = useAttrs();
|
|
530
|
-
const { valueFormatter } = attrs;
|
|
531
526
|
function getOldValue() {
|
|
532
527
|
return cloneDeep(getFormData == null ? void 0 : getFormData(props.path));
|
|
533
528
|
}
|
|
534
529
|
const value = computed({
|
|
535
530
|
get() {
|
|
536
531
|
let val = getFormData == null ? void 0 : getFormData(props.path);
|
|
532
|
+
const { valueFormatter } = groupedAttrs.value;
|
|
537
533
|
if (typeof valueFormatter === "object" && typeof valueFormatter.get === "function") {
|
|
538
534
|
val = valueFormatter.get(val);
|
|
539
535
|
}
|
|
@@ -541,6 +537,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
541
537
|
},
|
|
542
538
|
set(val) {
|
|
543
539
|
let newVal = val;
|
|
540
|
+
const { valueFormatter } = groupedAttrs.value;
|
|
544
541
|
if (valueFormatter) {
|
|
545
542
|
if (typeof valueFormatter === "function") {
|
|
546
543
|
newVal = valueFormatter(val, getOldValue());
|
|
@@ -566,9 +563,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
566
563
|
{ disabled: attrs.disabled ?? parentDisabled.value ?? initProps.disabled },
|
|
567
564
|
{ modelName: attrs.modelName ?? initProps.modelName ?? "value" }
|
|
568
565
|
);
|
|
569
|
-
const { valueFormatter
|
|
566
|
+
const { valueFormatter, modelName, slots, componentClassName, componentStyle, componentContainer, ...rest } = mergedProps;
|
|
570
567
|
const bindAttrs = omit(rest, [modelName, `onUpdate:${modelName}`]);
|
|
571
|
-
return {
|
|
568
|
+
return {
|
|
569
|
+
attrs: bindAttrs,
|
|
570
|
+
slots,
|
|
571
|
+
componentContainer,
|
|
572
|
+
modelName,
|
|
573
|
+
valueFormatter
|
|
574
|
+
};
|
|
572
575
|
});
|
|
573
576
|
const teleportComponent = inject(
|
|
574
577
|
`${TeleportComponentNamePrefix}${props.path}`,
|