@plasmicpkgs/antd5 0.0.191 → 0.0.192
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 +49 -5
- package/dist/antd.esm.js.map +1 -1
- package/dist/form/Form.d.ts +2 -0
- package/dist/index.js +49 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/skinny/Form.cjs.js +25 -5
- package/skinny/Form.cjs.js.map +1 -1
- package/skinny/Form.esm.js +25 -5
- package/skinny/Form.esm.js.map +1 -1
- package/skinny/registerForm.cjs.js +24 -0
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.esm.js +24 -0
- package/skinny/registerForm.esm.js.map +1 -1
package/dist/antd.esm.js
CHANGED
|
@@ -239,6 +239,7 @@ var FormType = /* @__PURE__ */ ((FormType2) => {
|
|
|
239
239
|
const Internal = React.forwardRef(
|
|
240
240
|
(props, ref) => {
|
|
241
241
|
var _b, _c, _d, _e;
|
|
242
|
+
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
|
242
243
|
const [form] = Form.useForm();
|
|
243
244
|
const values = form.getFieldsValue(true);
|
|
244
245
|
const lastValue = React.useRef(values);
|
|
@@ -247,13 +248,15 @@ const Internal = React.forwardRef(
|
|
|
247
248
|
forceRemount,
|
|
248
249
|
formLayout,
|
|
249
250
|
internalFieldCtx,
|
|
250
|
-
setInternalFieldCtx
|
|
251
|
+
setInternalFieldCtx,
|
|
252
|
+
autoDisableWhileSubmitting = true
|
|
251
253
|
} = _a, rest = __objRest$o(_a, [
|
|
252
254
|
"extendedOnValuesChange",
|
|
253
255
|
"forceRemount",
|
|
254
256
|
"formLayout",
|
|
255
257
|
"internalFieldCtx",
|
|
256
|
-
"setInternalFieldCtx"
|
|
258
|
+
"setInternalFieldCtx",
|
|
259
|
+
"autoDisableWhileSubmitting"
|
|
257
260
|
]);
|
|
258
261
|
const childrenNode = typeof props.children === "function" ? props.children(values, form) : props.children;
|
|
259
262
|
const fireOnValuesChange = React.useCallback(() => {
|
|
@@ -322,6 +325,14 @@ const Internal = React.forwardRef(
|
|
|
322
325
|
layout: formLayout,
|
|
323
326
|
internalFieldCtx
|
|
324
327
|
}, schemaFormCtx ? schemaFormCtx : {}));
|
|
328
|
+
const updateIsSubmitting = React.useCallback(
|
|
329
|
+
(newValue) => {
|
|
330
|
+
var _a2;
|
|
331
|
+
setIsSubmitting(newValue);
|
|
332
|
+
(_a2 = props.onIsSubmittingChange) == null ? void 0 : _a2.call(props, newValue);
|
|
333
|
+
},
|
|
334
|
+
[props.onIsSubmittingChange, setIsSubmitting]
|
|
335
|
+
);
|
|
325
336
|
return /* @__PURE__ */ React.createElement(
|
|
326
337
|
InternalFormInstanceContext.Provider,
|
|
327
338
|
{
|
|
@@ -343,9 +354,13 @@ const Internal = React.forwardRef(
|
|
|
343
354
|
(_a2 = props.onValuesChange) == null ? void 0 : _a2.call(props, ...args);
|
|
344
355
|
extendedOnValuesChange == null ? void 0 : extendedOnValuesChange(form.getFieldsValue(true));
|
|
345
356
|
},
|
|
346
|
-
onFinish: () => {
|
|
357
|
+
onFinish: async () => {
|
|
347
358
|
var _a2;
|
|
348
|
-
(
|
|
359
|
+
if (isSubmitting && autoDisableWhileSubmitting) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
updateIsSubmitting(true);
|
|
363
|
+
const submission = (_a2 = props.onFinish) == null ? void 0 : _a2.call(
|
|
349
364
|
props,
|
|
350
365
|
pick(
|
|
351
366
|
form.getFieldsValue(true),
|
|
@@ -354,10 +369,15 @@ const Internal = React.forwardRef(
|
|
|
354
369
|
)
|
|
355
370
|
)
|
|
356
371
|
);
|
|
372
|
+
if (typeof submission === "object" && typeof submission.then === "function") {
|
|
373
|
+
await submission;
|
|
374
|
+
}
|
|
375
|
+
updateIsSubmitting(false);
|
|
357
376
|
},
|
|
358
377
|
form,
|
|
359
378
|
labelCol: ((_d = props.labelCol) == null ? void 0 : _d.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
|
|
360
|
-
wrapperCol: ((_e = props.wrapperCol) == null ? void 0 : _e.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
|
|
379
|
+
wrapperCol: ((_e = props.wrapperCol) == null ? void 0 : _e.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol,
|
|
380
|
+
disabled: isSubmitting && autoDisableWhileSubmitting
|
|
361
381
|
}),
|
|
362
382
|
/* @__PURE__ */ React.createElement("style", null, `
|
|
363
383
|
.ant-form-item-explain + div, .ant-form-item-margin-offset {
|
|
@@ -2729,6 +2749,24 @@ function registerForm(loader) {
|
|
|
2729
2749
|
multiSelect: true,
|
|
2730
2750
|
defaultValueHint: ["onChange"],
|
|
2731
2751
|
advanced: true
|
|
2752
|
+
},
|
|
2753
|
+
autoDisableWhileSubmitting: {
|
|
2754
|
+
displayName: "Auto disable while submitting",
|
|
2755
|
+
type: "boolean",
|
|
2756
|
+
defaultValueHint: true,
|
|
2757
|
+
advanced: true,
|
|
2758
|
+
description: "When disabled, it allows the creation of new submissions even while existing submissions are in progress."
|
|
2759
|
+
},
|
|
2760
|
+
onIsSubmittingChange: {
|
|
2761
|
+
type: "eventHandler",
|
|
2762
|
+
displayName: "On Is Submitting Change",
|
|
2763
|
+
argTypes: [
|
|
2764
|
+
{
|
|
2765
|
+
name: "isSubmitting",
|
|
2766
|
+
type: "boolean"
|
|
2767
|
+
}
|
|
2768
|
+
],
|
|
2769
|
+
advanced: true
|
|
2732
2770
|
}
|
|
2733
2771
|
},
|
|
2734
2772
|
actions: [
|
|
@@ -2743,6 +2781,12 @@ function registerForm(loader) {
|
|
|
2743
2781
|
type: "readonly",
|
|
2744
2782
|
variableType: "object",
|
|
2745
2783
|
onChangeProp: "extendedOnValuesChange"
|
|
2784
|
+
},
|
|
2785
|
+
isSubmitting: {
|
|
2786
|
+
type: "readonly",
|
|
2787
|
+
variableType: "boolean",
|
|
2788
|
+
onChangeProp: "onIsSubmittingChange",
|
|
2789
|
+
initVal: false
|
|
2746
2790
|
}
|
|
2747
2791
|
},
|
|
2748
2792
|
componentHelpers: {
|