@plasmicpkgs/antd5 0.0.98 → 0.0.99
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 +15 -54
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +15 -54
- package/dist/index.js.map +1 -1
- package/dist/registerForm.d.ts +1 -6
- package/package.json +2 -2
- package/skinny/registerForm.cjs.js +15 -54
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.d.ts +1 -6
- package/skinny/registerForm.esm.js +15 -54
- package/skinny/registerForm.esm.js.map +1 -1
package/dist/antd.esm.js
CHANGED
|
@@ -2595,13 +2595,9 @@ function useFormItemDefinitions(rawData, props, formRef) {
|
|
|
2595
2595
|
return mergedFields;
|
|
2596
2596
|
}, [mode, setControlContextData, formItems, rawData, formRef]);
|
|
2597
2597
|
}
|
|
2598
|
-
const useRawData = (
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2601
|
-
if (!connection) {
|
|
2602
|
-
return void 0;
|
|
2603
|
-
}
|
|
2604
|
-
return 0 /* NewEntry */ === connection.formType ? rawDataSchema : rawDataEntry;
|
|
2598
|
+
const useRawData = (props) => {
|
|
2599
|
+
const rawData = usePlasmicDataOp(props.data);
|
|
2600
|
+
return props.data ? rawData : void 0;
|
|
2605
2601
|
};
|
|
2606
2602
|
const FormWrapper = React.forwardRef(
|
|
2607
2603
|
(props, ref) => {
|
|
@@ -2617,12 +2613,19 @@ const FormWrapper = React.forwardRef(
|
|
|
2617
2613
|
ref,
|
|
2618
2614
|
() => wrapperRef.current ? __spreadValues$9({}, wrapperRef.current) : {}
|
|
2619
2615
|
);
|
|
2620
|
-
const rawData = useRawData(props
|
|
2616
|
+
const rawData = useRawData(props);
|
|
2621
2617
|
const formItemDefinitions = useFormItemDefinitions(
|
|
2622
2618
|
rawData,
|
|
2623
2619
|
props,
|
|
2624
2620
|
wrapperRef.current
|
|
2625
2621
|
);
|
|
2622
|
+
const previousOpData = usePrevious(props.data);
|
|
2623
|
+
React.useEffect(() => {
|
|
2624
|
+
var _a2;
|
|
2625
|
+
if ((previousOpData == null ? void 0 : previousOpData.opId) !== ((_a2 = props.data) == null ? void 0 : _a2.opId)) {
|
|
2626
|
+
setRemountKey((k) => k + 1);
|
|
2627
|
+
}
|
|
2628
|
+
}, [previousOpData, props.data]);
|
|
2626
2629
|
const _a = props, { formItems } = _a, rest = __objRest$7(_a, ["formItems"]);
|
|
2627
2630
|
const actualFormItems = props.mode === "simplified" && formItemDefinitions ? formItemDefinitions : formItems;
|
|
2628
2631
|
if (props.mode === "simplified" && rawData && "error" in rawData) {
|
|
@@ -2733,48 +2736,6 @@ const formTypeDescription = `
|
|
|
2733
2736
|
|
|
2734
2737
|
For both options, you can customize later.
|
|
2735
2738
|
`;
|
|
2736
|
-
const getConnectionDBPropRegistration = () => ({
|
|
2737
|
-
formType: {
|
|
2738
|
-
type: "choice",
|
|
2739
|
-
options: [
|
|
2740
|
-
{ label: "New entry", value: 0 /* NewEntry */ },
|
|
2741
|
-
{ label: "Update entry", value: 1 /* UpdateEntry */ }
|
|
2742
|
-
],
|
|
2743
|
-
displayName: "Form Type",
|
|
2744
|
-
disableDynamicValue: true,
|
|
2745
|
-
defaultValueHint: "Select the form type...",
|
|
2746
|
-
description: `
|
|
2747
|
-
You can create form with two different behaviors:
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
1. Create a new entry: The form will be created empty and it will create a new row when submitted.
|
|
2752
|
-
2. Update an entry: The form will be pre-filled with the row values and it will update the table entry when submitted.
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
For both options, you can customize later.
|
|
2757
|
-
`
|
|
2758
|
-
},
|
|
2759
|
-
dataSchema: {
|
|
2760
|
-
type: "dataSourceOp",
|
|
2761
|
-
description: "The data to generate the form",
|
|
2762
|
-
hidden: (_ps, _ctx, { item }) => item.formType !== 0 /* NewEntry */,
|
|
2763
|
-
displayName: "",
|
|
2764
|
-
disableDynamicValue: true,
|
|
2765
|
-
allowedOps: () => ["getTableSchema"],
|
|
2766
|
-
hideCacheKey: true
|
|
2767
|
-
},
|
|
2768
|
-
dataEntry: {
|
|
2769
|
-
type: "dataSourceOp",
|
|
2770
|
-
description: "The data to generate the form",
|
|
2771
|
-
hidden: (_ps, _ctx, { item }) => item.formType !== 1 /* UpdateEntry */,
|
|
2772
|
-
displayName: "",
|
|
2773
|
-
disableDynamicValue: true,
|
|
2774
|
-
allowedOps: () => ["getOne"],
|
|
2775
|
-
hideCacheKey: true
|
|
2776
|
-
}
|
|
2777
|
-
});
|
|
2778
2739
|
function registerForm(loader) {
|
|
2779
2740
|
registerComponentHelper(loader, FormWrapper, {
|
|
2780
2741
|
name: formComponentName,
|
|
@@ -2789,10 +2750,10 @@ function registerForm(loader) {
|
|
|
2789
2750
|
defaultValue: "simplified"
|
|
2790
2751
|
},
|
|
2791
2752
|
data: {
|
|
2792
|
-
type: "
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2753
|
+
type: "formDataConnection",
|
|
2754
|
+
disableDynamicValue: true,
|
|
2755
|
+
disableLinkToProp: true,
|
|
2756
|
+
hidden: (ps) => ps.mode !== "simplified" || !ps.data
|
|
2796
2757
|
},
|
|
2797
2758
|
formItems: {
|
|
2798
2759
|
displayName: "Fields",
|