@plasmicpkgs/antd5 0.0.56 → 0.0.59
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 +2047 -1788
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.js +2053 -1786
- package/dist/index.js.map +1 -1
- package/dist/registerButton.d.ts +1 -0
- package/dist/registerCheckbox.d.ts +7 -0
- package/dist/registerForm.d.ts +34 -0
- package/dist/registerInput.d.ts +4 -0
- package/dist/registerMenu.d.ts +46 -0
- package/dist/registerRadio.d.ts +3 -0
- package/dist/registerSelect.d.ts +3 -0
- package/dist/registerSwitch.d.ts +11 -0
- package/package.json +3 -3
- package/skinny/registerButton.cjs.js +3 -1
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.d.ts +1 -0
- package/skinny/registerButton.esm.js +3 -2
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +11 -10
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +7 -0
- package/skinny/registerCheckbox.esm.js +10 -11
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerConfigProvider.cjs.js.map +1 -1
- package/skinny/registerConfigProvider.esm.js.map +1 -1
- package/skinny/registerDropdown.cjs.js +1 -1
- package/skinny/registerDropdown.cjs.js.map +1 -1
- package/skinny/registerDropdown.esm.js +2 -2
- package/skinny/registerDropdown.esm.js.map +1 -1
- package/skinny/registerForm.cjs.js +312 -153
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.d.ts +34 -0
- package/skinny/registerForm.esm.js +309 -155
- package/skinny/registerForm.esm.js.map +1 -1
- package/skinny/registerInput.cjs.js +23 -11
- package/skinny/registerInput.cjs.js.map +1 -1
- package/skinny/registerInput.d.ts +4 -0
- package/skinny/registerInput.esm.js +20 -12
- package/skinny/registerInput.esm.js.map +1 -1
- package/skinny/registerMenu.cjs.js +17 -0
- package/skinny/registerMenu.cjs.js.map +1 -1
- package/skinny/registerMenu.d.ts +46 -0
- package/skinny/registerMenu.esm.js +17 -1
- package/skinny/registerMenu.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +14 -7
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.d.ts +3 -0
- package/skinny/registerRadio.esm.js +12 -8
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +15 -8
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.d.ts +3 -0
- package/skinny/registerSelect.esm.js +13 -9
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSwitch.cjs.js +79 -0
- package/skinny/registerSwitch.cjs.js.map +1 -0
- package/skinny/registerSwitch.d.ts +11 -0
- package/skinny/registerSwitch.esm.js +71 -0
- package/skinny/registerSwitch.esm.js.map +1 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { usePlasmicCanvasContext, DataProvider, repeatedElement } from '@plasmicapp/host';
|
|
2
|
-
import { Form } from 'antd';
|
|
2
|
+
import { Form, Input, InputNumber, Checkbox, Select, Radio } from 'antd';
|
|
3
3
|
import equal from 'fast-deep-equal';
|
|
4
4
|
import React, { isValidElement, cloneElement } from 'react';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
|
+
import { buttonComponentName } from './registerButton.esm.js';
|
|
7
|
+
import { checkboxComponentName } from './registerCheckbox.esm.js';
|
|
8
|
+
import { inputComponentName, textAreaComponentName, inputNumberComponentName, passwordComponentName } from './registerInput.esm.js';
|
|
9
|
+
import { radioGroupComponentName } from './registerRadio.esm.js';
|
|
10
|
+
import { selectComponentName } from './registerSelect.esm.js';
|
|
11
|
+
import { switchComponentName } from './registerSwitch.esm.js';
|
|
6
12
|
import { u as usePrevious, r as registerComponentHelper } from './utils-d0e80a56.esm.js';
|
|
7
13
|
import '@plasmicapp/host/registerComponent';
|
|
8
14
|
import '@plasmicapp/host/registerGlobalContext';
|
|
@@ -139,16 +145,47 @@ function ensureArray(x) {
|
|
|
139
145
|
}
|
|
140
146
|
const FormItem = Form.Item;
|
|
141
147
|
const FormList = Form.List;
|
|
148
|
+
var InputType = /* @__PURE__ */ ((InputType2) => {
|
|
149
|
+
InputType2["Text"] = "Text";
|
|
150
|
+
InputType2["TextArea"] = "Text Area";
|
|
151
|
+
InputType2["Password"] = "Password";
|
|
152
|
+
InputType2["Number"] = "Number";
|
|
153
|
+
InputType2["Select"] = "Select";
|
|
154
|
+
InputType2["Option"] = "Option";
|
|
155
|
+
InputType2["OptionGroup"] = "Option Group";
|
|
156
|
+
InputType2["Radio"] = "Radio";
|
|
157
|
+
InputType2["RadioGroup"] = "Radio Group";
|
|
158
|
+
InputType2["Checkbox"] = "Checkbox";
|
|
159
|
+
return InputType2;
|
|
160
|
+
})(InputType || {});
|
|
142
161
|
const PathContext = React.createContext({ relativePath: [], fullPath: [] });
|
|
143
162
|
const InternalFormInstanceContext = React.createContext(void 0);
|
|
144
163
|
const FormLayoutContext = React.createContext(void 0);
|
|
145
164
|
const Internal = (props) => {
|
|
146
|
-
var _b, _c, _d;
|
|
165
|
+
var _b, _c, _d, _e;
|
|
147
166
|
const [form] = Form.useForm();
|
|
148
167
|
const values = form.getFieldsValue(true);
|
|
149
168
|
const lastValue = React.useRef(values);
|
|
150
169
|
const _a = props, { extendedOnValuesChange, setRemountKey } = _a, rest = __objRest(_a, ["extendedOnValuesChange", "setRemountKey"]);
|
|
151
|
-
|
|
170
|
+
let childrenNode;
|
|
171
|
+
if (props.mode !== "simplified") {
|
|
172
|
+
childrenNode = typeof props.children === "function" ? props.children(values, form) : props.children;
|
|
173
|
+
} else {
|
|
174
|
+
childrenNode = /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = props.formItems) != null ? _b : []).map((formItem) => /* @__PURE__ */ React.createElement(
|
|
175
|
+
FormItemWrapper,
|
|
176
|
+
__spreadProps(__spreadValues({}, formItem), {
|
|
177
|
+
noLabel: formItem.inputType === "Checkbox" /* Checkbox */ || formItem.noLabel,
|
|
178
|
+
style: { width: "100%" }
|
|
179
|
+
}),
|
|
180
|
+
formItem.inputType === "Text" /* Text */ ? /* @__PURE__ */ React.createElement(Input, null) : formItem.inputType === "Password" /* Password */ ? /* @__PURE__ */ React.createElement(Input.Password, null) : formItem.inputType === "Text Area" /* TextArea */ ? /* @__PURE__ */ React.createElement(Input.TextArea, null) : formItem.inputType === "Number" /* Number */ ? /* @__PURE__ */ React.createElement(InputNumber, null) : formItem.inputType === "Checkbox" /* Checkbox */ ? /* @__PURE__ */ React.createElement(Checkbox, null, formItem.label) : formItem.inputType === "Select" /* Select */ ? /* @__PURE__ */ React.createElement(Select, { options: formItem.options }) : formItem.inputType === "Radio" /* Radio */ ? /* @__PURE__ */ React.createElement(
|
|
181
|
+
Radio.Group,
|
|
182
|
+
{
|
|
183
|
+
options: formItem.options,
|
|
184
|
+
optionType: formItem.optionType
|
|
185
|
+
}
|
|
186
|
+
) : null
|
|
187
|
+
)), props.submitSlot);
|
|
188
|
+
}
|
|
152
189
|
const fireOnValuesChange = React.useCallback(() => {
|
|
153
190
|
const values2 = form.getFieldsValue(true);
|
|
154
191
|
if (!equal(values2, lastValue.current)) {
|
|
@@ -167,7 +204,7 @@ const Internal = (props) => {
|
|
|
167
204
|
labelSpan: (_a2 = props.labelCol) == null ? void 0 : _a2.span
|
|
168
205
|
};
|
|
169
206
|
},
|
|
170
|
-
[props.layout, (
|
|
207
|
+
[props.layout, (_c = props.labelCol) == null ? void 0 : _c.span]
|
|
171
208
|
);
|
|
172
209
|
return /* @__PURE__ */ React.createElement(
|
|
173
210
|
InternalFormInstanceContext.Provider,
|
|
@@ -188,8 +225,8 @@ const Internal = (props) => {
|
|
|
188
225
|
extendedOnValuesChange == null ? void 0 : extendedOnValuesChange(args[1]);
|
|
189
226
|
},
|
|
190
227
|
form,
|
|
191
|
-
labelCol: ((
|
|
192
|
-
wrapperCol: ((
|
|
228
|
+
labelCol: ((_d = props.labelCol) == null ? void 0 : _d.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
|
|
229
|
+
wrapperCol: ((_e = props.wrapperCol) == null ? void 0 : _e.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
|
|
193
230
|
}),
|
|
194
231
|
/* @__PURE__ */ React.createElement("style", null, `
|
|
195
232
|
.ant-form-item-explain + div, .ant-form-item-margin-offset {
|
|
@@ -213,7 +250,7 @@ function FormWrapper(props) {
|
|
|
213
250
|
const COMMON_ACTIONS = [
|
|
214
251
|
{
|
|
215
252
|
type: "button-action",
|
|
216
|
-
label: "Append new Form
|
|
253
|
+
label: "Append new Form Field",
|
|
217
254
|
onClick: ({ studioOps }) => {
|
|
218
255
|
studioOps.appendToSlot(
|
|
219
256
|
{
|
|
@@ -222,11 +259,12 @@ const COMMON_ACTIONS = [
|
|
|
222
259
|
},
|
|
223
260
|
"children"
|
|
224
261
|
);
|
|
225
|
-
}
|
|
262
|
+
},
|
|
263
|
+
hidden: (props) => props.mode !== "advanced"
|
|
226
264
|
}
|
|
227
265
|
// {
|
|
228
266
|
// type: "button-action" as const,
|
|
229
|
-
// label: "Append new Form Group",
|
|
267
|
+
// label: "Append new Form Field Group",
|
|
230
268
|
// onClick: ({ studioOps }: ActionProps<any>) => {
|
|
231
269
|
// studioOps.appendToSlot(
|
|
232
270
|
// {
|
|
@@ -279,21 +317,102 @@ const colProp = (displayName, defaultValue, description) => ({
|
|
|
279
317
|
description,
|
|
280
318
|
defaultValue
|
|
281
319
|
});
|
|
320
|
+
const formComponentName = "plasmic-antd5-form";
|
|
282
321
|
function registerForm(loader) {
|
|
283
322
|
registerComponentHelper(loader, FormWrapper, {
|
|
284
|
-
name:
|
|
323
|
+
name: formComponentName,
|
|
285
324
|
displayName: "Form",
|
|
286
325
|
defaultStyles: {
|
|
287
326
|
layout: "vbox",
|
|
288
327
|
alignItems: "flex-start"
|
|
289
328
|
},
|
|
290
329
|
props: {
|
|
330
|
+
mode: "controlMode",
|
|
331
|
+
formItems: {
|
|
332
|
+
type: "array",
|
|
333
|
+
itemType: {
|
|
334
|
+
type: "object",
|
|
335
|
+
fields: __spreadValues({
|
|
336
|
+
label: "string",
|
|
337
|
+
inputType: {
|
|
338
|
+
type: "choice",
|
|
339
|
+
options: Object.values(InputType),
|
|
340
|
+
defaultValue: "Text" /* Text */
|
|
341
|
+
},
|
|
342
|
+
options: {
|
|
343
|
+
type: "array",
|
|
344
|
+
itemType: {
|
|
345
|
+
type: "object",
|
|
346
|
+
fields: {
|
|
347
|
+
type: {
|
|
348
|
+
type: "choice",
|
|
349
|
+
options: [
|
|
350
|
+
{ value: "option", label: "Option" },
|
|
351
|
+
{ value: "option-group", label: "Option Group" }
|
|
352
|
+
],
|
|
353
|
+
defaultValue: "option"
|
|
354
|
+
},
|
|
355
|
+
label: "string",
|
|
356
|
+
value: {
|
|
357
|
+
type: "string",
|
|
358
|
+
hidden: (ps) => ps.type !== "option-group"
|
|
359
|
+
},
|
|
360
|
+
options: {
|
|
361
|
+
type: "array",
|
|
362
|
+
itemType: {
|
|
363
|
+
type: "object",
|
|
364
|
+
nameFunc: (item) => item.label || item.value,
|
|
365
|
+
fields: {
|
|
366
|
+
value: "string",
|
|
367
|
+
label: "string"
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
nameFunc: (item) => item == null ? void 0 : item.label
|
|
373
|
+
},
|
|
374
|
+
hidden: (ps) => !["Select" /* Select */, "Radio" /* Radio */].includes(ps.inputType)
|
|
375
|
+
},
|
|
376
|
+
optionType: {
|
|
377
|
+
type: "choice",
|
|
378
|
+
options: [
|
|
379
|
+
{ value: "default", label: "Radio" },
|
|
380
|
+
{ value: "button", label: "Button" }
|
|
381
|
+
],
|
|
382
|
+
hidden: (ps) => "Radio" /* Radio */ !== ps.inputType,
|
|
383
|
+
defaultValueHint: "Radio",
|
|
384
|
+
displayName: "Option Type"
|
|
385
|
+
}
|
|
386
|
+
}, commonFormItemProps),
|
|
387
|
+
nameFunc: (item) => item.label
|
|
388
|
+
},
|
|
389
|
+
hidden: (props) => props.mode === "advanced"
|
|
390
|
+
},
|
|
391
|
+
submitSlot: __spreadValues({
|
|
392
|
+
type: "slot",
|
|
393
|
+
hidden: () => true,
|
|
394
|
+
defaultValue: {
|
|
395
|
+
type: "component",
|
|
396
|
+
name: buttonComponentName,
|
|
397
|
+
props: {
|
|
398
|
+
type: "primary",
|
|
399
|
+
submitsForm: true,
|
|
400
|
+
children: {
|
|
401
|
+
type: "text",
|
|
402
|
+
value: "Submit"
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
mergeWithParent: () => true,
|
|
408
|
+
hiddenMergedProps: (ps) => !ps.mode
|
|
409
|
+
}),
|
|
291
410
|
children: {
|
|
292
411
|
type: "slot",
|
|
293
412
|
defaultValue: [
|
|
294
413
|
{
|
|
295
414
|
type: "component",
|
|
296
|
-
name:
|
|
415
|
+
name: formItemComponentName,
|
|
297
416
|
props: {
|
|
298
417
|
label: {
|
|
299
418
|
type: "text",
|
|
@@ -302,13 +421,13 @@ function registerForm(loader) {
|
|
|
302
421
|
name: "name",
|
|
303
422
|
children: {
|
|
304
423
|
type: "component",
|
|
305
|
-
name:
|
|
424
|
+
name: inputComponentName
|
|
306
425
|
}
|
|
307
426
|
}
|
|
308
427
|
},
|
|
309
428
|
{
|
|
310
429
|
type: "component",
|
|
311
|
-
name:
|
|
430
|
+
name: formItemComponentName,
|
|
312
431
|
props: {
|
|
313
432
|
label: {
|
|
314
433
|
type: "text",
|
|
@@ -317,30 +436,24 @@ function registerForm(loader) {
|
|
|
317
436
|
name: "message",
|
|
318
437
|
children: {
|
|
319
438
|
type: "component",
|
|
320
|
-
name:
|
|
439
|
+
name: textAreaComponentName
|
|
321
440
|
}
|
|
322
441
|
}
|
|
323
442
|
},
|
|
324
443
|
{
|
|
325
444
|
type: "component",
|
|
326
|
-
name:
|
|
445
|
+
name: buttonComponentName,
|
|
327
446
|
props: {
|
|
328
|
-
noLabel: true,
|
|
329
447
|
children: {
|
|
330
|
-
type: "
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
value: "Submit"
|
|
336
|
-
},
|
|
337
|
-
type: "primary",
|
|
338
|
-
submitsForm: true
|
|
339
|
-
}
|
|
340
|
-
}
|
|
448
|
+
type: "text",
|
|
449
|
+
value: "Submit"
|
|
450
|
+
},
|
|
451
|
+
type: "primary",
|
|
452
|
+
submitsForm: true
|
|
341
453
|
}
|
|
342
454
|
}
|
|
343
|
-
]
|
|
455
|
+
],
|
|
456
|
+
hidden: (props) => props.mode !== "advanced"
|
|
344
457
|
},
|
|
345
458
|
initialValues: {
|
|
346
459
|
type: "object"
|
|
@@ -586,11 +699,38 @@ function FormItemWrapper(props) {
|
|
|
586
699
|
extra: description,
|
|
587
700
|
help: hideValidationMessage ? "" : props.help,
|
|
588
701
|
colon: noLabel ? false : void 0,
|
|
702
|
+
valuePropName: deriveValuePropName(props),
|
|
589
703
|
wrapperCol: (layoutContext == null ? void 0 : layoutContext.layout) === "horizontal" && noLabel && alignLabellessWithControls && layoutContext.labelSpan ? { offset: layoutContext.labelSpan } : void 0
|
|
590
704
|
}),
|
|
591
|
-
|
|
705
|
+
/* @__PURE__ */ React.createElement(FormItemForwarder, { formItemProps: props })
|
|
592
706
|
);
|
|
593
707
|
}
|
|
708
|
+
function deriveValuePropName(props) {
|
|
709
|
+
if (props.valuePropName) {
|
|
710
|
+
return props.valuePropName;
|
|
711
|
+
}
|
|
712
|
+
const valueProps = React.Children.map(props.children, (child) => {
|
|
713
|
+
var _a;
|
|
714
|
+
if (React.isValidElement(child)) {
|
|
715
|
+
const childType = child.type;
|
|
716
|
+
if (childType) {
|
|
717
|
+
const x = (_a = childType.__plasmicFormFieldMeta) == null ? void 0 : _a.valueProp;
|
|
718
|
+
if (x) {
|
|
719
|
+
return x;
|
|
720
|
+
}
|
|
721
|
+
const plumeType = childType.__plumeType;
|
|
722
|
+
if (plumeType && (plumeType === "checkbox" || plumeType === "switch")) {
|
|
723
|
+
return "isChecked";
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return void 0;
|
|
728
|
+
}).filter((x) => !!x);
|
|
729
|
+
if (valueProps.length > 0) {
|
|
730
|
+
return valueProps[0];
|
|
731
|
+
}
|
|
732
|
+
return void 0;
|
|
733
|
+
}
|
|
594
734
|
function FormItemForwarder(_a) {
|
|
595
735
|
var _b = _a, { formItemProps } = _b, props = __objRest(_b, ["formItemProps"]);
|
|
596
736
|
var _a2;
|
|
@@ -605,23 +745,124 @@ function FormItemForwarder(_a) {
|
|
|
605
745
|
});
|
|
606
746
|
return React.Children.map(formItemProps.children, (child, i) => {
|
|
607
747
|
var _a3;
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
748
|
+
let newProps = __spreadProps(__spreadValues(__spreadValues({}, (_a3 = child.props) != null ? _a3 : {}), props), {
|
|
749
|
+
__plasmicFormField: true
|
|
750
|
+
});
|
|
751
|
+
if (formItemProps.customizeProps) {
|
|
752
|
+
newProps = mergeProps(
|
|
753
|
+
newProps,
|
|
754
|
+
formItemProps.customizeProps(data, newProps)
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
return i === 0 && isValidElement(child) ? cloneElement(child, newProps) : child;
|
|
613
758
|
});
|
|
614
759
|
}
|
|
760
|
+
const commonFormItemProps = {
|
|
761
|
+
name: {
|
|
762
|
+
type: "string"
|
|
763
|
+
},
|
|
764
|
+
initialValue: {
|
|
765
|
+
type: "string"
|
|
766
|
+
},
|
|
767
|
+
rules: {
|
|
768
|
+
type: "formValidationRules"
|
|
769
|
+
},
|
|
770
|
+
valuePropName: {
|
|
771
|
+
type: "string",
|
|
772
|
+
advanced: true,
|
|
773
|
+
defaultValueHint: "value",
|
|
774
|
+
description: "The prop name for specifying the value of the form control component"
|
|
775
|
+
},
|
|
776
|
+
noLabel: {
|
|
777
|
+
type: "boolean",
|
|
778
|
+
advanced: true
|
|
779
|
+
},
|
|
780
|
+
alignLabellessWithControls: {
|
|
781
|
+
type: "boolean",
|
|
782
|
+
displayName: "Align with controls?",
|
|
783
|
+
description: "Aligns the content with form controls in the grid",
|
|
784
|
+
hidden: (ps, ctx) => {
|
|
785
|
+
var _a;
|
|
786
|
+
return !ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
787
|
+
},
|
|
788
|
+
defaultValueHint: true
|
|
789
|
+
},
|
|
790
|
+
colon: {
|
|
791
|
+
type: "boolean",
|
|
792
|
+
defaultValueHint: true,
|
|
793
|
+
advanced: true,
|
|
794
|
+
hidden: () => true
|
|
795
|
+
},
|
|
796
|
+
labelAlign: {
|
|
797
|
+
type: "choice",
|
|
798
|
+
options: ["left", "right"],
|
|
799
|
+
advanced: true,
|
|
800
|
+
hidden: (ps, ctx) => {
|
|
801
|
+
var _a;
|
|
802
|
+
return !!ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
hidden: {
|
|
806
|
+
type: "boolean",
|
|
807
|
+
advanced: true
|
|
808
|
+
},
|
|
809
|
+
validateTrigger: {
|
|
810
|
+
type: "choice",
|
|
811
|
+
options: ["onSubmit", "onChange", "onBlur"],
|
|
812
|
+
multiSelect: true,
|
|
813
|
+
advanced: true
|
|
814
|
+
},
|
|
815
|
+
shouldUpdate: {
|
|
816
|
+
type: "boolean",
|
|
817
|
+
advanced: true,
|
|
818
|
+
displayName: "Always re-render",
|
|
819
|
+
description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
|
|
820
|
+
},
|
|
821
|
+
dependencies: {
|
|
822
|
+
type: "array",
|
|
823
|
+
advanced: true,
|
|
824
|
+
displayName: "Dependencies",
|
|
825
|
+
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
826
|
+
},
|
|
827
|
+
hideValidationMessage: {
|
|
828
|
+
type: "boolean",
|
|
829
|
+
displayName: "Hide validation message?",
|
|
830
|
+
description: "If true, will hide the validation error message",
|
|
831
|
+
defaultValueHint: false,
|
|
832
|
+
advanced: true
|
|
833
|
+
},
|
|
834
|
+
customizeProps: {
|
|
835
|
+
type: "function",
|
|
836
|
+
description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
|
|
837
|
+
argNames: ["fieldData"],
|
|
838
|
+
argValues: (_ps, ctx) => {
|
|
839
|
+
var _a;
|
|
840
|
+
return [
|
|
841
|
+
{
|
|
842
|
+
status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
|
|
843
|
+
}
|
|
844
|
+
];
|
|
845
|
+
},
|
|
846
|
+
advanced: true
|
|
847
|
+
},
|
|
848
|
+
noStyle: {
|
|
849
|
+
type: "boolean",
|
|
850
|
+
displayName: "Field control only",
|
|
851
|
+
description: "Don't render anything but the field control - so no label, help text, validation error, etc.",
|
|
852
|
+
advanced: true
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
const formItemComponentName = "plasmic-antd5-form-item";
|
|
615
856
|
function registerFormItem(loader) {
|
|
616
857
|
registerComponentHelper(loader, FormItemWrapper, __spreadValues({
|
|
617
|
-
name:
|
|
618
|
-
displayName: "Form
|
|
619
|
-
parentComponentName:
|
|
858
|
+
name: formItemComponentName,
|
|
859
|
+
displayName: "Form Field",
|
|
860
|
+
parentComponentName: formComponentName,
|
|
620
861
|
defaultStyles: {
|
|
621
862
|
marginBottom: "24px",
|
|
622
863
|
width: "stretch"
|
|
623
864
|
},
|
|
624
|
-
props: {
|
|
865
|
+
props: __spreadValues({
|
|
625
866
|
label: __spreadValues({
|
|
626
867
|
type: "slot",
|
|
627
868
|
defaultValue: {
|
|
@@ -634,107 +875,10 @@ function registerFormItem(loader) {
|
|
|
634
875
|
type: "slot",
|
|
635
876
|
defaultValue: {
|
|
636
877
|
type: "component",
|
|
637
|
-
name:
|
|
638
|
-
}
|
|
639
|
-
}, { mergeWithParent: true }),
|
|
640
|
-
name: {
|
|
641
|
-
type: "string"
|
|
642
|
-
},
|
|
643
|
-
initialValue: {
|
|
644
|
-
type: "string"
|
|
645
|
-
},
|
|
646
|
-
rules: {
|
|
647
|
-
type: "formValidationRules"
|
|
648
|
-
},
|
|
649
|
-
valuePropName: {
|
|
650
|
-
type: "string",
|
|
651
|
-
advanced: true,
|
|
652
|
-
defaultValueHint: "value",
|
|
653
|
-
description: "The prop name for specifying the value of the form control component"
|
|
654
|
-
},
|
|
655
|
-
noLabel: {
|
|
656
|
-
type: "boolean",
|
|
657
|
-
advanced: true
|
|
658
|
-
},
|
|
659
|
-
alignLabellessWithControls: {
|
|
660
|
-
type: "boolean",
|
|
661
|
-
displayName: "Align with controls?",
|
|
662
|
-
description: "Aligns the content with form controls in the grid",
|
|
663
|
-
hidden: (ps, ctx) => {
|
|
664
|
-
var _a;
|
|
665
|
-
return !ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
666
|
-
},
|
|
667
|
-
defaultValueHint: true
|
|
668
|
-
},
|
|
669
|
-
colon: {
|
|
670
|
-
type: "boolean",
|
|
671
|
-
defaultValueHint: true,
|
|
672
|
-
advanced: true,
|
|
673
|
-
hidden: () => true
|
|
674
|
-
},
|
|
675
|
-
labelAlign: {
|
|
676
|
-
type: "choice",
|
|
677
|
-
options: ["left", "right"],
|
|
678
|
-
advanced: true,
|
|
679
|
-
hidden: (ps, ctx) => {
|
|
680
|
-
var _a;
|
|
681
|
-
return !!ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
878
|
+
name: inputComponentName
|
|
682
879
|
}
|
|
683
|
-
},
|
|
684
|
-
|
|
685
|
-
type: "boolean",
|
|
686
|
-
advanced: true
|
|
687
|
-
},
|
|
688
|
-
validateTrigger: {
|
|
689
|
-
type: "choice",
|
|
690
|
-
options: ["onSubmit", "onChange", "onBlur"],
|
|
691
|
-
multiSelect: true,
|
|
692
|
-
advanced: true
|
|
693
|
-
},
|
|
694
|
-
shouldUpdate: {
|
|
695
|
-
type: "boolean",
|
|
696
|
-
advanced: true,
|
|
697
|
-
displayName: "Always re-render",
|
|
698
|
-
description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
|
|
699
|
-
},
|
|
700
|
-
dependencies: {
|
|
701
|
-
type: "array",
|
|
702
|
-
advanced: true,
|
|
703
|
-
displayName: "Dependencies",
|
|
704
|
-
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
705
|
-
},
|
|
706
|
-
hideValidationMessage: {
|
|
707
|
-
type: "boolean",
|
|
708
|
-
displayName: "Hide validation message?",
|
|
709
|
-
description: "If true, will hide the validation error message",
|
|
710
|
-
defaultValueHint: false,
|
|
711
|
-
advanced: true
|
|
712
|
-
},
|
|
713
|
-
description: {
|
|
714
|
-
type: "slot",
|
|
715
|
-
hidePlaceholder: true
|
|
716
|
-
},
|
|
717
|
-
customizeProps: {
|
|
718
|
-
type: "function",
|
|
719
|
-
description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
|
|
720
|
-
argNames: ["fieldData"],
|
|
721
|
-
argValues: (_ps, ctx) => {
|
|
722
|
-
var _a;
|
|
723
|
-
return [
|
|
724
|
-
{
|
|
725
|
-
status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
|
|
726
|
-
}
|
|
727
|
-
];
|
|
728
|
-
},
|
|
729
|
-
advanced: true
|
|
730
|
-
},
|
|
731
|
-
noStyle: {
|
|
732
|
-
type: "boolean",
|
|
733
|
-
displayName: "Field control only",
|
|
734
|
-
description: "Don't render anything but the field control - so no label, help text, validation error, etc.",
|
|
735
|
-
advanced: true
|
|
736
|
-
}
|
|
737
|
-
},
|
|
880
|
+
}, { mergeWithParent: true })
|
|
881
|
+
}, commonFormItemProps),
|
|
738
882
|
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
739
883
|
importName: "FormItemWrapper",
|
|
740
884
|
templates: {
|
|
@@ -742,7 +886,7 @@ function registerFormItem(loader) {
|
|
|
742
886
|
props: {
|
|
743
887
|
children: {
|
|
744
888
|
type: "component",
|
|
745
|
-
name:
|
|
889
|
+
name: inputComponentName
|
|
746
890
|
}
|
|
747
891
|
}
|
|
748
892
|
},
|
|
@@ -750,7 +894,7 @@ function registerFormItem(loader) {
|
|
|
750
894
|
props: {
|
|
751
895
|
children: {
|
|
752
896
|
type: "component",
|
|
753
|
-
name:
|
|
897
|
+
name: textAreaComponentName
|
|
754
898
|
}
|
|
755
899
|
}
|
|
756
900
|
},
|
|
@@ -758,7 +902,7 @@ function registerFormItem(loader) {
|
|
|
758
902
|
props: {
|
|
759
903
|
children: {
|
|
760
904
|
type: "component",
|
|
761
|
-
name:
|
|
905
|
+
name: selectComponentName
|
|
762
906
|
}
|
|
763
907
|
}
|
|
764
908
|
},
|
|
@@ -766,7 +910,7 @@ function registerFormItem(loader) {
|
|
|
766
910
|
props: {
|
|
767
911
|
children: {
|
|
768
912
|
type: "component",
|
|
769
|
-
name:
|
|
913
|
+
name: inputNumberComponentName
|
|
770
914
|
}
|
|
771
915
|
}
|
|
772
916
|
},
|
|
@@ -774,9 +918,17 @@ function registerFormItem(loader) {
|
|
|
774
918
|
props: {
|
|
775
919
|
children: {
|
|
776
920
|
type: "component",
|
|
777
|
-
name:
|
|
921
|
+
name: checkboxComponentName
|
|
922
|
+
},
|
|
923
|
+
noLabel: true
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
Switch: {
|
|
927
|
+
props: {
|
|
928
|
+
children: {
|
|
929
|
+
type: "component",
|
|
930
|
+
name: switchComponentName
|
|
778
931
|
},
|
|
779
|
-
valuePropName: "checked",
|
|
780
932
|
noLabel: true
|
|
781
933
|
}
|
|
782
934
|
},
|
|
@@ -784,7 +936,7 @@ function registerFormItem(loader) {
|
|
|
784
936
|
props: {
|
|
785
937
|
children: {
|
|
786
938
|
type: "component",
|
|
787
|
-
name:
|
|
939
|
+
name: radioGroupComponentName
|
|
788
940
|
}
|
|
789
941
|
}
|
|
790
942
|
},
|
|
@@ -792,7 +944,7 @@ function registerFormItem(loader) {
|
|
|
792
944
|
props: {
|
|
793
945
|
children: {
|
|
794
946
|
type: "component",
|
|
795
|
-
name:
|
|
947
|
+
name: passwordComponentName
|
|
796
948
|
}
|
|
797
949
|
}
|
|
798
950
|
},
|
|
@@ -800,7 +952,7 @@ function registerFormItem(loader) {
|
|
|
800
952
|
props: {
|
|
801
953
|
children: {
|
|
802
954
|
type: "component",
|
|
803
|
-
name:
|
|
955
|
+
name: buttonComponentName,
|
|
804
956
|
props: {
|
|
805
957
|
type: "primary"
|
|
806
958
|
}
|
|
@@ -824,11 +976,12 @@ function FormGroup(props) {
|
|
|
824
976
|
props.children
|
|
825
977
|
);
|
|
826
978
|
}
|
|
979
|
+
const formGroupComponentName = "plasmic-antd5-form-group";
|
|
827
980
|
function registerFormGroup(loader) {
|
|
828
981
|
registerComponentHelper(loader, FormGroup, {
|
|
829
|
-
name:
|
|
830
|
-
displayName: "Form Group",
|
|
831
|
-
parentComponentName:
|
|
982
|
+
name: formGroupComponentName,
|
|
983
|
+
displayName: "Form Field Group",
|
|
984
|
+
parentComponentName: formComponentName,
|
|
832
985
|
actions: COMMON_ACTIONS,
|
|
833
986
|
props: {
|
|
834
987
|
name: {
|
|
@@ -906,10 +1059,11 @@ const FormListWrapper = React.forwardRef(function FormListWrapper2(props, ref) {
|
|
|
906
1059
|
));
|
|
907
1060
|
});
|
|
908
1061
|
});
|
|
1062
|
+
const formListComponentName = "plasmic-antd5-form-list";
|
|
909
1063
|
function registerFormList(loader) {
|
|
910
1064
|
registerComponentHelper(loader, FormListWrapper, {
|
|
911
|
-
name:
|
|
912
|
-
parentComponentName:
|
|
1065
|
+
name: formListComponentName,
|
|
1066
|
+
parentComponentName: formComponentName,
|
|
913
1067
|
displayName: "Form List",
|
|
914
1068
|
actions: COMMON_ACTIONS,
|
|
915
1069
|
props: {
|
|
@@ -921,7 +1075,7 @@ function registerFormList(loader) {
|
|
|
921
1075
|
children: [
|
|
922
1076
|
{
|
|
923
1077
|
type: "component",
|
|
924
|
-
name:
|
|
1078
|
+
name: formItemComponentName,
|
|
925
1079
|
props: {
|
|
926
1080
|
name: "firstName",
|
|
927
1081
|
label: {
|
|
@@ -936,7 +1090,7 @@ function registerFormList(loader) {
|
|
|
936
1090
|
},
|
|
937
1091
|
{
|
|
938
1092
|
type: "component",
|
|
939
|
-
name:
|
|
1093
|
+
name: formItemComponentName,
|
|
940
1094
|
props: {
|
|
941
1095
|
name: "lastName",
|
|
942
1096
|
label: {
|
|
@@ -1018,5 +1172,5 @@ function registerFormList(loader) {
|
|
|
1018
1172
|
});
|
|
1019
1173
|
}
|
|
1020
1174
|
|
|
1021
|
-
export { FormGroup, FormItemWrapper, FormListWrapper, FormWrapper, registerForm, registerFormGroup, registerFormItem, registerFormList };
|
|
1175
|
+
export { FormGroup, FormItemWrapper, FormListWrapper, FormWrapper, InputType, formComponentName, formGroupComponentName, formItemComponentName, formListComponentName, registerForm, registerFormGroup, registerFormItem, registerFormList };
|
|
1022
1176
|
//# sourceMappingURL=registerForm.esm.js.map
|