@plasmicpkgs/antd5 0.0.53 → 0.0.55
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 +257 -121
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +257 -121
- package/dist/index.js.map +1 -1
- package/dist/registerForm.d.ts +9 -1
- package/package.json +2 -2
- package/skinny/registerButton.cjs.js +1 -1
- package/skinny/registerButton.esm.js +1 -1
- package/skinny/registerCheckbox.cjs.js +1 -1
- package/skinny/registerCheckbox.esm.js +1 -1
- package/skinny/registerConfigProvider.cjs.js +1 -1
- package/skinny/registerConfigProvider.esm.js +1 -1
- package/skinny/registerDropdown.cjs.js +1 -1
- package/skinny/registerDropdown.esm.js +1 -1
- package/skinny/registerForm.cjs.js +234 -103
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.d.ts +9 -1
- package/skinny/registerForm.esm.js +234 -103
- package/skinny/registerForm.esm.js.map +1 -1
- package/skinny/registerInput.cjs.js +1 -1
- package/skinny/registerInput.esm.js +1 -1
- package/skinny/registerMenu.cjs.js +1 -1
- package/skinny/registerMenu.esm.js +1 -1
- package/skinny/registerModal.cjs.js +1 -1
- package/skinny/registerModal.esm.js +1 -1
- package/skinny/registerRadio.cjs.js +25 -8
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.esm.js +25 -8
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +1 -1
- package/skinny/registerSelect.esm.js +1 -1
- package/skinny/registerTable.cjs.js +1 -1
- package/skinny/registerTable.esm.js +1 -1
- package/skinny/registerUpload.cjs.js +1 -1
- package/skinny/registerUpload.esm.js +1 -1
- package/skinny/{utils-dff55ae0.cjs.js → utils-2d964db8.cjs.js} +1 -14
- package/skinny/{utils-dff55ae0.cjs.js.map → utils-2d964db8.cjs.js.map} +1 -1
- package/skinny/{utils-94b1c934.esm.js → utils-d0e80a56.esm.js} +2 -14
- package/skinny/{utils-94b1c934.esm.js.map → utils-d0e80a56.esm.js.map} +1 -1
package/dist/index.js
CHANGED
|
@@ -63,18 +63,6 @@ function asArray(x) {
|
|
|
63
63
|
return [x];
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function omit(obj, ...keys) {
|
|
67
|
-
if (Object.keys(obj).length === 0) {
|
|
68
|
-
return obj;
|
|
69
|
-
}
|
|
70
|
-
const res = {};
|
|
71
|
-
for (const key of Object.keys(obj)) {
|
|
72
|
-
if (!keys.includes(key)) {
|
|
73
|
-
res[key] = obj[key];
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return res;
|
|
77
|
-
}
|
|
78
66
|
function usePrevious(value) {
|
|
79
67
|
const prevValue = React__default.default.useRef(void 0);
|
|
80
68
|
React__default.default.useEffect(() => {
|
|
@@ -1160,8 +1148,9 @@ const FormItem = antd.Form.Item;
|
|
|
1160
1148
|
const FormList = antd.Form.List;
|
|
1161
1149
|
const PathContext = React__default.default.createContext({ relativePath: [], fullPath: [] });
|
|
1162
1150
|
const InternalFormInstanceContext = React__default.default.createContext(void 0);
|
|
1151
|
+
const FormLayoutContext = React__default.default.createContext(void 0);
|
|
1163
1152
|
const Internal = (props) => {
|
|
1164
|
-
var _b, _c;
|
|
1153
|
+
var _b, _c, _d;
|
|
1165
1154
|
const [form] = antd.Form.useForm();
|
|
1166
1155
|
const values = form.getFieldsValue(true);
|
|
1167
1156
|
const lastValue = React__default.default.useRef(values);
|
|
@@ -1177,15 +1166,26 @@ const Internal = (props) => {
|
|
|
1177
1166
|
React__default.default.useEffect(() => {
|
|
1178
1167
|
fireOnValuesChange();
|
|
1179
1168
|
}, []);
|
|
1169
|
+
const formLayout = React__default.default.useMemo(
|
|
1170
|
+
() => {
|
|
1171
|
+
var _a2;
|
|
1172
|
+
return {
|
|
1173
|
+
layout: props.layout,
|
|
1174
|
+
labelSpan: (_a2 = props.labelCol) == null ? void 0 : _a2.span
|
|
1175
|
+
};
|
|
1176
|
+
},
|
|
1177
|
+
[props.layout, (_b = props.labelCol) == null ? void 0 : _b.span]
|
|
1178
|
+
);
|
|
1180
1179
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
1181
1180
|
InternalFormInstanceContext.Provider,
|
|
1182
1181
|
{
|
|
1183
1182
|
value: {
|
|
1183
|
+
layout: formLayout,
|
|
1184
1184
|
fireOnValuesChange,
|
|
1185
1185
|
forceRemount: () => setRemountKey((k) => k + 1)
|
|
1186
1186
|
}
|
|
1187
1187
|
},
|
|
1188
|
-
/* @__PURE__ */ React__default.default.createElement(
|
|
1188
|
+
/* @__PURE__ */ React__default.default.createElement(FormLayoutContext.Provider, { value: formLayout }, /* @__PURE__ */ React__default.default.createElement(
|
|
1189
1189
|
antd.Form,
|
|
1190
1190
|
__spreadProps$5(__spreadValues$6({}, rest), {
|
|
1191
1191
|
key: props.initialValues ? JSON.stringify(props.initialValues) : void 0,
|
|
@@ -1195,16 +1195,16 @@ const Internal = (props) => {
|
|
|
1195
1195
|
extendedOnValuesChange == null ? void 0 : extendedOnValuesChange(args[1]);
|
|
1196
1196
|
},
|
|
1197
1197
|
form,
|
|
1198
|
-
labelCol: ((
|
|
1199
|
-
wrapperCol: ((
|
|
1198
|
+
labelCol: ((_c = props.labelCol) == null ? void 0 : _c.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
|
|
1199
|
+
wrapperCol: ((_d = props.wrapperCol) == null ? void 0 : _d.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
|
|
1200
1200
|
}),
|
|
1201
1201
|
/* @__PURE__ */ React__default.default.createElement("style", null, `
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1202
|
+
.ant-form-item-explain + div, .ant-form-item-margin-offset {
|
|
1203
|
+
display: none;
|
|
1204
|
+
}
|
|
1205
|
+
`),
|
|
1206
1206
|
childrenNode
|
|
1207
|
-
)
|
|
1207
|
+
))
|
|
1208
1208
|
);
|
|
1209
1209
|
};
|
|
1210
1210
|
function FormWrapper(props) {
|
|
@@ -1258,40 +1258,41 @@ const COMMON_ACTIONS = [
|
|
|
1258
1258
|
// },
|
|
1259
1259
|
// },
|
|
1260
1260
|
];
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
max: 24
|
|
1273
|
-
},
|
|
1274
|
-
offset: {
|
|
1275
|
-
type: "number",
|
|
1276
|
-
displayName: "Offset columns",
|
|
1277
|
-
description: "Number of grid columns to skip from the left",
|
|
1278
|
-
min: 0,
|
|
1279
|
-
max: 23
|
|
1280
|
-
},
|
|
1281
|
-
horizontalOnly: {
|
|
1282
|
-
type: "boolean",
|
|
1283
|
-
displayName: "Horizontal only",
|
|
1284
|
-
description: "Only apply to horizontal layout"
|
|
1285
|
-
}
|
|
1261
|
+
const colProp = (displayName, defaultValue, description) => ({
|
|
1262
|
+
type: "object",
|
|
1263
|
+
displayName,
|
|
1264
|
+
advanced: true,
|
|
1265
|
+
fields: {
|
|
1266
|
+
span: {
|
|
1267
|
+
type: "number",
|
|
1268
|
+
displayName: "Width",
|
|
1269
|
+
description: "The number of grid columns to span in width (out of 24 columns total)",
|
|
1270
|
+
min: 1,
|
|
1271
|
+
max: 24
|
|
1286
1272
|
},
|
|
1287
|
-
|
|
1288
|
-
|
|
1273
|
+
offset: {
|
|
1274
|
+
type: "number",
|
|
1275
|
+
displayName: "Offset",
|
|
1276
|
+
description: "Number of grid columns to skip from the left (out of 24 columns total)",
|
|
1277
|
+
min: 0,
|
|
1278
|
+
max: 23
|
|
1279
|
+
},
|
|
1280
|
+
horizontalOnly: {
|
|
1281
|
+
type: "boolean",
|
|
1282
|
+
displayName: "Horizontal only",
|
|
1283
|
+
description: "Only apply to horizontal layout"
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
description,
|
|
1287
|
+
defaultValue
|
|
1288
|
+
});
|
|
1289
|
+
function registerForm(loader) {
|
|
1289
1290
|
registerComponentHelper(loader, FormWrapper, {
|
|
1290
1291
|
name: "plasmic-antd5-form",
|
|
1291
1292
|
displayName: "Form",
|
|
1292
1293
|
defaultStyles: {
|
|
1293
|
-
|
|
1294
|
-
|
|
1294
|
+
layout: "vbox",
|
|
1295
|
+
alignItems: "flex-start"
|
|
1295
1296
|
},
|
|
1296
1297
|
props: {
|
|
1297
1298
|
children: {
|
|
@@ -1329,13 +1330,21 @@ function registerForm(loader) {
|
|
|
1329
1330
|
},
|
|
1330
1331
|
{
|
|
1331
1332
|
type: "component",
|
|
1332
|
-
name: "plasmic-antd5-
|
|
1333
|
+
name: "plasmic-antd5-form-item",
|
|
1333
1334
|
props: {
|
|
1335
|
+
noLabel: true,
|
|
1334
1336
|
children: {
|
|
1335
|
-
type: "
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1337
|
+
type: "component",
|
|
1338
|
+
name: "plasmic-antd5-button",
|
|
1339
|
+
props: {
|
|
1340
|
+
children: {
|
|
1341
|
+
type: "text",
|
|
1342
|
+
value: "Submit"
|
|
1343
|
+
},
|
|
1344
|
+
type: "primary",
|
|
1345
|
+
submitsForm: true
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1339
1348
|
}
|
|
1340
1349
|
}
|
|
1341
1350
|
]
|
|
@@ -1352,16 +1361,25 @@ function registerForm(loader) {
|
|
|
1352
1361
|
type: "choice",
|
|
1353
1362
|
options: ["left", "right"],
|
|
1354
1363
|
defaultValueHint: "right",
|
|
1355
|
-
advanced: true
|
|
1364
|
+
advanced: true,
|
|
1365
|
+
hidden: (ps) => ps.layout !== "horizontal"
|
|
1356
1366
|
},
|
|
1357
|
-
labelCol: colProp(
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1367
|
+
labelCol: colProp(
|
|
1368
|
+
"Label layout",
|
|
1369
|
+
{
|
|
1370
|
+
span: 8,
|
|
1371
|
+
horizontalOnly: true
|
|
1372
|
+
},
|
|
1373
|
+
"Set the width and offset of the labels"
|
|
1374
|
+
),
|
|
1375
|
+
wrapperCol: colProp(
|
|
1376
|
+
"Control layout",
|
|
1377
|
+
{
|
|
1378
|
+
span: 16,
|
|
1379
|
+
horizontalOnly: true
|
|
1380
|
+
},
|
|
1381
|
+
"Set the width and offset of the form controls"
|
|
1382
|
+
),
|
|
1365
1383
|
colon: {
|
|
1366
1384
|
type: "boolean",
|
|
1367
1385
|
description: `Show a colon after labels by default (only for horizontal layout)`,
|
|
@@ -1449,6 +1467,7 @@ function registerForm(loader) {
|
|
|
1449
1467
|
}
|
|
1450
1468
|
function plasmicRulesToAntdRules(plasmicRules, label) {
|
|
1451
1469
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1470
|
+
const effectiveLabel = label || "This field";
|
|
1452
1471
|
const rules = [];
|
|
1453
1472
|
for (const plasmicRule of plasmicRules) {
|
|
1454
1473
|
switch (plasmicRule.ruleType) {
|
|
@@ -1456,37 +1475,37 @@ function plasmicRulesToAntdRules(plasmicRules, label) {
|
|
|
1456
1475
|
rules.push({
|
|
1457
1476
|
type: "enum",
|
|
1458
1477
|
enum: (_b = (_a = plasmicRule.options) == null ? void 0 : _a.map((opt) => opt.value)) != null ? _b : [],
|
|
1459
|
-
message: (_c = plasmicRule.message) != null ? _c :
|
|
1478
|
+
message: (_c = plasmicRule.message) != null ? _c : `${effectiveLabel} must be a valid value`
|
|
1460
1479
|
});
|
|
1461
1480
|
break;
|
|
1462
1481
|
case "required":
|
|
1463
1482
|
rules.push({
|
|
1464
1483
|
required: true,
|
|
1465
|
-
message: (_d = plasmicRule.message) != null ? _d :
|
|
1484
|
+
message: (_d = plasmicRule.message) != null ? _d : `${effectiveLabel} is required`
|
|
1466
1485
|
});
|
|
1467
1486
|
break;
|
|
1468
1487
|
case "regex":
|
|
1469
1488
|
rules.push({
|
|
1470
1489
|
pattern: new RegExp((_e = plasmicRule.pattern) != null ? _e : ""),
|
|
1471
|
-
message: (_f = plasmicRule.message) != null ? _f :
|
|
1490
|
+
message: (_f = plasmicRule.message) != null ? _f : `${effectiveLabel} must be a valid value`
|
|
1472
1491
|
});
|
|
1473
1492
|
break;
|
|
1474
1493
|
case "whitespace":
|
|
1475
1494
|
rules.push({
|
|
1476
1495
|
whitespace: true,
|
|
1477
|
-
message: (_g = plasmicRule.message) != null ? _g :
|
|
1496
|
+
message: (_g = plasmicRule.message) != null ? _g : `${effectiveLabel} is required`
|
|
1478
1497
|
});
|
|
1479
1498
|
break;
|
|
1480
1499
|
case "min":
|
|
1481
1500
|
rules.push({
|
|
1482
1501
|
[plasmicRule.ruleType]: plasmicRule.length,
|
|
1483
|
-
message: (_h = plasmicRule.message) != null ? _h :
|
|
1502
|
+
message: (_h = plasmicRule.message) != null ? _h : `${effectiveLabel} must be at least ${plasmicRule.length} characters`
|
|
1484
1503
|
});
|
|
1485
1504
|
break;
|
|
1486
1505
|
case "max":
|
|
1487
1506
|
rules.push({
|
|
1488
1507
|
[plasmicRule.ruleType]: plasmicRule.length,
|
|
1489
|
-
message: (_i = plasmicRule.message) != null ? _i :
|
|
1508
|
+
message: (_i = plasmicRule.message) != null ? _i : `${effectiveLabel} must be at most ${plasmicRule.length} characters`
|
|
1490
1509
|
});
|
|
1491
1510
|
break;
|
|
1492
1511
|
case "advanced":
|
|
@@ -1513,14 +1532,34 @@ function useFormInstanceMaybe() {
|
|
|
1513
1532
|
return antd.Form.useFormInstance();
|
|
1514
1533
|
}
|
|
1515
1534
|
function FormItemWrapper(props) {
|
|
1516
|
-
var
|
|
1517
|
-
const
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1535
|
+
var _b;
|
|
1536
|
+
const _a = props, {
|
|
1537
|
+
rules: plasmicRules,
|
|
1538
|
+
description,
|
|
1539
|
+
noLabel,
|
|
1540
|
+
name,
|
|
1541
|
+
hideValidationMessage,
|
|
1542
|
+
customizeProps,
|
|
1543
|
+
setControlContextData,
|
|
1544
|
+
alignLabellessWithControls = true
|
|
1545
|
+
} = _a, rest = __objRest$5(_a, [
|
|
1546
|
+
"rules",
|
|
1547
|
+
"description",
|
|
1548
|
+
"noLabel",
|
|
1549
|
+
"name",
|
|
1550
|
+
"hideValidationMessage",
|
|
1551
|
+
"customizeProps",
|
|
1552
|
+
"setControlContextData",
|
|
1553
|
+
"alignLabellessWithControls"
|
|
1554
|
+
]);
|
|
1555
|
+
const relativeFormItemName = useFormItemRelativeName(name);
|
|
1556
|
+
const fullFormItemName = useFormItemFullName(name);
|
|
1557
|
+
const bestEffortLabel = !noLabel && reactNodeToString(props.label) || ensureArray(props.name).slice(-1)[0];
|
|
1558
|
+
const rules = plasmicRules ? plasmicRulesToAntdRules(
|
|
1559
|
+
plasmicRules,
|
|
1522
1560
|
typeof bestEffortLabel === "number" ? "" + bestEffortLabel : bestEffortLabel
|
|
1523
1561
|
) : void 0;
|
|
1562
|
+
const layoutContext = React__default.default.useContext(FormLayoutContext);
|
|
1524
1563
|
const inCanvas = !!host.usePlasmicCanvasContext();
|
|
1525
1564
|
if (inCanvas) {
|
|
1526
1565
|
const form = useFormInstanceMaybe();
|
|
@@ -1530,7 +1569,7 @@ function FormItemWrapper(props) {
|
|
|
1530
1569
|
});
|
|
1531
1570
|
const internalFormCtx = React__default.default.useContext(InternalFormInstanceContext);
|
|
1532
1571
|
const { fireOnValuesChange, forceRemount } = internalFormCtx != null ? internalFormCtx : {};
|
|
1533
|
-
(
|
|
1572
|
+
(_b = props.setControlContextData) == null ? void 0 : _b.call(props, {
|
|
1534
1573
|
internalFormCtx
|
|
1535
1574
|
});
|
|
1536
1575
|
React__default.default.useEffect(() => {
|
|
@@ -1547,14 +1586,15 @@ function FormItemWrapper(props) {
|
|
|
1547
1586
|
}
|
|
1548
1587
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
1549
1588
|
FormItem,
|
|
1550
|
-
|
|
1551
|
-
label:
|
|
1589
|
+
__spreadProps$5(__spreadValues$6({}, rest), {
|
|
1590
|
+
label: noLabel ? void 0 : props.label,
|
|
1552
1591
|
name: relativeFormItemName,
|
|
1553
|
-
rules
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1592
|
+
rules,
|
|
1593
|
+
extra: description,
|
|
1594
|
+
help: hideValidationMessage ? "" : props.help,
|
|
1595
|
+
colon: noLabel ? false : void 0,
|
|
1596
|
+
wrapperCol: (layoutContext == null ? void 0 : layoutContext.layout) === "horizontal" && noLabel && alignLabellessWithControls && layoutContext.labelSpan ? { offset: layoutContext.labelSpan } : void 0
|
|
1597
|
+
}),
|
|
1558
1598
|
props.customizeProps ? /* @__PURE__ */ React__default.default.createElement(FormItemForwarder, { formItemProps: props }) : props.children
|
|
1559
1599
|
);
|
|
1560
1600
|
}
|
|
@@ -1584,13 +1624,18 @@ function registerFormItem(loader) {
|
|
|
1584
1624
|
name: "plasmic-antd5-form-item",
|
|
1585
1625
|
displayName: "Form Item",
|
|
1586
1626
|
parentComponentName: "plasmic-antd5-form",
|
|
1627
|
+
defaultStyles: {
|
|
1628
|
+
marginBottom: "24px",
|
|
1629
|
+
width: "stretch"
|
|
1630
|
+
},
|
|
1587
1631
|
props: {
|
|
1588
1632
|
label: {
|
|
1589
1633
|
type: "slot",
|
|
1590
1634
|
defaultValue: {
|
|
1591
1635
|
type: "text",
|
|
1592
1636
|
value: "Label"
|
|
1593
|
-
}
|
|
1637
|
+
},
|
|
1638
|
+
hidden: (ps) => !!ps.noLabel
|
|
1594
1639
|
},
|
|
1595
1640
|
children: {
|
|
1596
1641
|
type: "slot",
|
|
@@ -1608,10 +1653,26 @@ function registerFormItem(loader) {
|
|
|
1608
1653
|
rules: {
|
|
1609
1654
|
type: "formValidationRules"
|
|
1610
1655
|
},
|
|
1656
|
+
valuePropName: {
|
|
1657
|
+
type: "string",
|
|
1658
|
+
advanced: true,
|
|
1659
|
+
defaultValueHint: "value",
|
|
1660
|
+
description: "The prop name for specifying the value of the form control component"
|
|
1661
|
+
},
|
|
1611
1662
|
noLabel: {
|
|
1612
1663
|
type: "boolean",
|
|
1613
1664
|
advanced: true
|
|
1614
1665
|
},
|
|
1666
|
+
alignLabellessWithControls: {
|
|
1667
|
+
type: "boolean",
|
|
1668
|
+
displayName: "Align with controls?",
|
|
1669
|
+
description: "Aligns the content with form controls in the grid",
|
|
1670
|
+
hidden: (ps, ctx) => {
|
|
1671
|
+
var _a;
|
|
1672
|
+
return !ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
1673
|
+
},
|
|
1674
|
+
defaultValueHint: true
|
|
1675
|
+
},
|
|
1615
1676
|
colon: {
|
|
1616
1677
|
type: "boolean",
|
|
1617
1678
|
defaultValueHint: true,
|
|
@@ -1621,7 +1682,11 @@ function registerFormItem(loader) {
|
|
|
1621
1682
|
labelAlign: {
|
|
1622
1683
|
type: "choice",
|
|
1623
1684
|
options: ["left", "right"],
|
|
1624
|
-
advanced: true
|
|
1685
|
+
advanced: true,
|
|
1686
|
+
hidden: (ps, ctx) => {
|
|
1687
|
+
var _a;
|
|
1688
|
+
return !!ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
1689
|
+
}
|
|
1625
1690
|
},
|
|
1626
1691
|
hidden: {
|
|
1627
1692
|
type: "boolean",
|
|
@@ -1645,34 +1710,16 @@ function registerFormItem(loader) {
|
|
|
1645
1710
|
displayName: "Dependencies",
|
|
1646
1711
|
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
1647
1712
|
},
|
|
1648
|
-
|
|
1649
|
-
type: "
|
|
1650
|
-
displayName: "
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
label: "Validation errors"
|
|
1655
|
-
},
|
|
1656
|
-
{
|
|
1657
|
-
value: "extra",
|
|
1658
|
-
label: "Custom help text and validation errors"
|
|
1659
|
-
},
|
|
1660
|
-
{
|
|
1661
|
-
value: "help",
|
|
1662
|
-
label: "Custom help text, no validation errors"
|
|
1663
|
-
}
|
|
1664
|
-
],
|
|
1665
|
-
defaultValueHint: "Show validation errors",
|
|
1666
|
-
description: "What to show in the help text. Edit help text by editing the 'help' slot in the outline."
|
|
1713
|
+
hideValidationMessage: {
|
|
1714
|
+
type: "boolean",
|
|
1715
|
+
displayName: "Hide validation message?",
|
|
1716
|
+
description: "If true, will hide the validation error message",
|
|
1717
|
+
defaultValueHint: false,
|
|
1718
|
+
advanced: true
|
|
1667
1719
|
},
|
|
1668
|
-
|
|
1720
|
+
description: {
|
|
1669
1721
|
type: "slot",
|
|
1670
|
-
hidden: (ps) => {
|
|
1671
|
-
var _a;
|
|
1672
|
-
return !["extra", "help"].includes((_a = ps.helpTextMode) != null ? _a : "");
|
|
1673
|
-
},
|
|
1674
1722
|
hidePlaceholder: true
|
|
1675
|
-
// advanced: true,
|
|
1676
1723
|
},
|
|
1677
1724
|
customizeProps: {
|
|
1678
1725
|
type: "function",
|
|
@@ -1690,13 +1737,85 @@ function registerFormItem(loader) {
|
|
|
1690
1737
|
},
|
|
1691
1738
|
noStyle: {
|
|
1692
1739
|
type: "boolean",
|
|
1693
|
-
displayName: "Field only",
|
|
1694
|
-
description: "Don't render anything but the
|
|
1740
|
+
displayName: "Field control only",
|
|
1741
|
+
description: "Don't render anything but the field control - so no label, help text, validation error, etc.",
|
|
1695
1742
|
advanced: true
|
|
1696
1743
|
}
|
|
1697
1744
|
},
|
|
1698
1745
|
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
1699
|
-
importName: "FormItemWrapper"
|
|
1746
|
+
importName: "FormItemWrapper",
|
|
1747
|
+
templates: {
|
|
1748
|
+
Text: {
|
|
1749
|
+
props: {
|
|
1750
|
+
children: {
|
|
1751
|
+
type: "component",
|
|
1752
|
+
name: "plasmic-antd5-input"
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
"Long Text": {
|
|
1757
|
+
props: {
|
|
1758
|
+
children: {
|
|
1759
|
+
type: "component",
|
|
1760
|
+
name: "plasmic-antd5-textarea"
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
},
|
|
1764
|
+
"Select dropdown": {
|
|
1765
|
+
props: {
|
|
1766
|
+
children: {
|
|
1767
|
+
type: "component",
|
|
1768
|
+
name: "plasmic-antd5-select"
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
},
|
|
1772
|
+
Number: {
|
|
1773
|
+
props: {
|
|
1774
|
+
children: {
|
|
1775
|
+
type: "component",
|
|
1776
|
+
name: "plasmic-antd5-input-number"
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
},
|
|
1780
|
+
Checkbox: {
|
|
1781
|
+
props: {
|
|
1782
|
+
children: {
|
|
1783
|
+
type: "component",
|
|
1784
|
+
name: "plasmic-antd5-checkbox"
|
|
1785
|
+
},
|
|
1786
|
+
valuePropName: "checked",
|
|
1787
|
+
noLabel: true
|
|
1788
|
+
}
|
|
1789
|
+
},
|
|
1790
|
+
Radios: {
|
|
1791
|
+
props: {
|
|
1792
|
+
children: {
|
|
1793
|
+
type: "component",
|
|
1794
|
+
name: "plasmic-antd5-radio-group"
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
},
|
|
1798
|
+
Password: {
|
|
1799
|
+
props: {
|
|
1800
|
+
children: {
|
|
1801
|
+
type: "component",
|
|
1802
|
+
name: "plasmic-antd5-input-password"
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1806
|
+
"Submit button": {
|
|
1807
|
+
props: {
|
|
1808
|
+
children: {
|
|
1809
|
+
type: "component",
|
|
1810
|
+
name: "plasmic-antd5-button",
|
|
1811
|
+
props: {
|
|
1812
|
+
type: "primary"
|
|
1813
|
+
}
|
|
1814
|
+
},
|
|
1815
|
+
noLabel: true
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1700
1819
|
});
|
|
1701
1820
|
}
|
|
1702
1821
|
function FormGroup(props) {
|
|
@@ -2658,14 +2777,31 @@ function registerRadio(loader) {
|
|
|
2658
2777
|
allowedComponents: [
|
|
2659
2778
|
"plasmic-antd5-radio",
|
|
2660
2779
|
"plasmic-antd5-radio-button"
|
|
2780
|
+
],
|
|
2781
|
+
defaultValue: [
|
|
2782
|
+
{
|
|
2783
|
+
type: "component",
|
|
2784
|
+
name: "plasmic-antd5-radio",
|
|
2785
|
+
props: {
|
|
2786
|
+
value: "op1",
|
|
2787
|
+
children: {
|
|
2788
|
+
type: "text",
|
|
2789
|
+
value: "Option 1"
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
},
|
|
2793
|
+
{
|
|
2794
|
+
type: "component",
|
|
2795
|
+
name: "plasmic-antd5-radio",
|
|
2796
|
+
props: {
|
|
2797
|
+
value: "op2",
|
|
2798
|
+
children: {
|
|
2799
|
+
type: "text",
|
|
2800
|
+
value: "Option 2"
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2661
2804
|
]
|
|
2662
|
-
// Error right now when using default slot content with stateful instances
|
|
2663
|
-
// defaultValue: [
|
|
2664
|
-
// {
|
|
2665
|
-
// type: "component",
|
|
2666
|
-
// name: "plasmic-antd5-radio",
|
|
2667
|
-
// },
|
|
2668
|
-
// ],
|
|
2669
2805
|
},
|
|
2670
2806
|
onChange: {
|
|
2671
2807
|
type: "eventHandler",
|