@plasmicpkgs/antd5 0.0.104 → 0.0.106
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/dist/.tsbuildinfo +1 -1
- package/dist/antd.esm.js +31 -10
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +31 -10
- package/dist/index.js.map +1 -1
- package/dist/registerForm.d.ts +1 -1
- package/package.json +2 -2
- package/skinny/registerForm.cjs.js +31 -10
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.d.ts +1 -1
- package/skinny/registerForm.esm.js +31 -10
- package/skinny/registerForm.esm.js.map +1 -1
package/dist/antd.esm.js
CHANGED
|
@@ -2563,7 +2563,7 @@ const Internal = React.forwardRef(
|
|
|
2563
2563
|
function useFormItemDefinitions(rawData, props, formRef) {
|
|
2564
2564
|
const { mode, formItems, setControlContextData } = props;
|
|
2565
2565
|
return React.useMemo(() => {
|
|
2566
|
-
if (mode !== "simplified" || !
|
|
2566
|
+
if (mode !== "simplified" || !rawData || rawData.isLoading || rawData.error) {
|
|
2567
2567
|
return void 0;
|
|
2568
2568
|
}
|
|
2569
2569
|
const data = normalizeData(rawData);
|
|
@@ -2592,7 +2592,7 @@ function useFormItemDefinitions(rawData, props, formRef) {
|
|
|
2592
2592
|
schema: data.schema,
|
|
2593
2593
|
minimalFullLengthFields,
|
|
2594
2594
|
mergedFields,
|
|
2595
|
-
formInstance: formRef.formInstance
|
|
2595
|
+
formInstance: formRef == null ? void 0 : formRef.formInstance
|
|
2596
2596
|
});
|
|
2597
2597
|
return mergedFields;
|
|
2598
2598
|
}, [mode, setControlContextData, formItems, rawData, formRef]);
|
|
@@ -2621,28 +2621,48 @@ const FormWrapper = React.forwardRef(
|
|
|
2621
2621
|
props,
|
|
2622
2622
|
wrapperRef.current
|
|
2623
2623
|
);
|
|
2624
|
-
const previousOpData = usePrevious(props.data);
|
|
2625
2624
|
React.useEffect(() => {
|
|
2626
|
-
|
|
2627
|
-
if ((previousOpData == null ? void 0 : previousOpData.opId) !== ((_a2 = props.data) == null ? void 0 : _a2.opId)) {
|
|
2625
|
+
if (rawData && !rawData.isLoading) {
|
|
2628
2626
|
setRemountKey((k) => k + 1);
|
|
2629
2627
|
}
|
|
2630
|
-
}, [
|
|
2628
|
+
}, [rawData]);
|
|
2631
2629
|
const _a = props, { formItems } = _a, rest = __objRest$7(_a, ["formItems"]);
|
|
2632
2630
|
const actualFormItems = props.mode === "simplified" && formItemDefinitions ? formItemDefinitions : formItems;
|
|
2631
|
+
const previousFormItems = React.useRef([]);
|
|
2632
|
+
React.useEffect(() => {
|
|
2633
|
+
if (!(rawData && rawData.isLoading)) {
|
|
2634
|
+
previousFormItems.current = actualFormItems;
|
|
2635
|
+
}
|
|
2636
|
+
}, [rawData, actualFormItems]);
|
|
2633
2637
|
if (props.mode === "simplified" && rawData && "error" in rawData) {
|
|
2634
2638
|
return /* @__PURE__ */ React.createElement("div", null, "Error when fetching data: ", rawData.error.message);
|
|
2635
2639
|
}
|
|
2636
|
-
|
|
2640
|
+
const isSchemaForm = props.mode === "simplified" && !!props.data;
|
|
2641
|
+
const isLoadingData = rawData == null ? void 0 : rawData.isLoading;
|
|
2642
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
2637
2643
|
Internal,
|
|
2638
2644
|
__spreadProps$7(__spreadValues$9({
|
|
2639
2645
|
key: remountKey
|
|
2640
2646
|
}, rest), {
|
|
2641
2647
|
setRemountKey,
|
|
2642
|
-
formItems: actualFormItems,
|
|
2643
|
-
ref: wrapperRef
|
|
2648
|
+
formItems: rawData && rawData.isLoading ? previousFormItems.current : actualFormItems,
|
|
2649
|
+
ref: wrapperRef,
|
|
2650
|
+
style: isSchemaForm && isLoadingData ? {
|
|
2651
|
+
opacity: 0.5,
|
|
2652
|
+
transitionDelay: "250ms",
|
|
2653
|
+
transition: "1s"
|
|
2654
|
+
} : {}
|
|
2644
2655
|
})
|
|
2645
|
-
)
|
|
2656
|
+
), isSchemaForm && isLoadingData && /* @__PURE__ */ React.createElement(
|
|
2657
|
+
"div",
|
|
2658
|
+
{
|
|
2659
|
+
style: {
|
|
2660
|
+
position: "absolute",
|
|
2661
|
+
width: "100%",
|
|
2662
|
+
height: "100%"
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
));
|
|
2646
2666
|
}
|
|
2647
2667
|
);
|
|
2648
2668
|
const COMMON_ACTIONS = [
|
|
@@ -2712,6 +2732,7 @@ const colProp = (displayName, defaultValue, description) => ({
|
|
|
2712
2732
|
description: "Only apply when form layout is horizontal"
|
|
2713
2733
|
}
|
|
2714
2734
|
},
|
|
2735
|
+
nameFunc: () => `Edit ${displayName}`,
|
|
2715
2736
|
description,
|
|
2716
2737
|
defaultValue
|
|
2717
2738
|
});
|