@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
package/dist/antd.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { isValidElement, cloneElement } from 'react';
|
|
2
|
-
import { Button, Checkbox, ConfigProvider, theme, message, notification, Menu, Dropdown,
|
|
2
|
+
import { Button, Checkbox, ConfigProvider, theme, message, notification, Menu, Dropdown, Input, InputNumber, Radio, Select, Switch, Form, Modal, Table, Upload } from 'antd';
|
|
3
3
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
4
4
|
import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
|
|
5
5
|
import { GlobalActionsProvider, usePlasmicCanvasContext, DataProvider, repeatedElement } from '@plasmicapp/host';
|
|
@@ -62,33 +62,33 @@ function usePrevious(value) {
|
|
|
62
62
|
return prevValue.current;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
var __defProp$
|
|
66
|
-
var __defProps$
|
|
67
|
-
var __getOwnPropDescs$
|
|
68
|
-
var __getOwnPropSymbols$
|
|
69
|
-
var __hasOwnProp$
|
|
70
|
-
var __propIsEnum$
|
|
71
|
-
var __defNormalProp$
|
|
72
|
-
var __spreadValues$
|
|
65
|
+
var __defProp$d = Object.defineProperty;
|
|
66
|
+
var __defProps$a = Object.defineProperties;
|
|
67
|
+
var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
|
|
68
|
+
var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
|
|
69
|
+
var __hasOwnProp$d = Object.prototype.hasOwnProperty;
|
|
70
|
+
var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
|
|
71
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
72
|
+
var __spreadValues$d = (a, b) => {
|
|
73
73
|
for (var prop in b || (b = {}))
|
|
74
|
-
if (__hasOwnProp$
|
|
75
|
-
__defNormalProp$
|
|
76
|
-
if (__getOwnPropSymbols$
|
|
77
|
-
for (var prop of __getOwnPropSymbols$
|
|
78
|
-
if (__propIsEnum$
|
|
79
|
-
__defNormalProp$
|
|
74
|
+
if (__hasOwnProp$d.call(b, prop))
|
|
75
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
76
|
+
if (__getOwnPropSymbols$d)
|
|
77
|
+
for (var prop of __getOwnPropSymbols$d(b)) {
|
|
78
|
+
if (__propIsEnum$d.call(b, prop))
|
|
79
|
+
__defNormalProp$d(a, prop, b[prop]);
|
|
80
80
|
}
|
|
81
81
|
return a;
|
|
82
82
|
};
|
|
83
|
-
var __spreadProps$
|
|
83
|
+
var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
|
|
84
84
|
var __objRest$9 = (source, exclude) => {
|
|
85
85
|
var target = {};
|
|
86
86
|
for (var prop in source)
|
|
87
|
-
if (__hasOwnProp$
|
|
87
|
+
if (__hasOwnProp$d.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
88
88
|
target[prop] = source[prop];
|
|
89
|
-
if (source != null && __getOwnPropSymbols$
|
|
90
|
-
for (var prop of __getOwnPropSymbols$
|
|
91
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
89
|
+
if (source != null && __getOwnPropSymbols$d)
|
|
90
|
+
for (var prop of __getOwnPropSymbols$d(source)) {
|
|
91
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$d.call(source, prop))
|
|
92
92
|
target[prop] = source[prop];
|
|
93
93
|
}
|
|
94
94
|
return target;
|
|
@@ -98,16 +98,17 @@ function AntdButton(props) {
|
|
|
98
98
|
const target = props.target === true ? "_blank" : props.target === false ? void 0 : props.target;
|
|
99
99
|
return /* @__PURE__ */ React.createElement(
|
|
100
100
|
Button,
|
|
101
|
-
__spreadProps$
|
|
101
|
+
__spreadProps$a(__spreadValues$d(__spreadProps$a(__spreadValues$d({}, rest), {
|
|
102
102
|
htmlType: submitsForm ? "submit" : "button"
|
|
103
103
|
}), rest), {
|
|
104
104
|
target
|
|
105
105
|
})
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
|
+
const buttonComponentName = "plasmic-antd5-button";
|
|
108
109
|
function registerButton(loader) {
|
|
109
110
|
registerComponentHelper(loader, AntdButton, {
|
|
110
|
-
name:
|
|
111
|
+
name: buttonComponentName,
|
|
111
112
|
displayName: "Button",
|
|
112
113
|
props: {
|
|
113
114
|
type: {
|
|
@@ -168,7 +169,7 @@ function registerButton(loader) {
|
|
|
168
169
|
hidden: (props) => !props.href,
|
|
169
170
|
defaultValueHint: false
|
|
170
171
|
},
|
|
171
|
-
children: __spreadValues$
|
|
172
|
+
children: __spreadValues$d({
|
|
172
173
|
type: "slot",
|
|
173
174
|
defaultValue: [
|
|
174
175
|
{
|
|
@@ -192,33 +193,33 @@ function registerButton(loader) {
|
|
|
192
193
|
});
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
var __defProp$
|
|
196
|
-
var __defProps$
|
|
197
|
-
var __getOwnPropDescs$
|
|
198
|
-
var __getOwnPropSymbols$
|
|
199
|
-
var __hasOwnProp$
|
|
200
|
-
var __propIsEnum$
|
|
201
|
-
var __defNormalProp$
|
|
202
|
-
var __spreadValues$
|
|
196
|
+
var __defProp$c = Object.defineProperty;
|
|
197
|
+
var __defProps$9 = Object.defineProperties;
|
|
198
|
+
var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
|
|
199
|
+
var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
|
|
200
|
+
var __hasOwnProp$c = Object.prototype.hasOwnProperty;
|
|
201
|
+
var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
|
|
202
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
203
|
+
var __spreadValues$c = (a, b) => {
|
|
203
204
|
for (var prop in b || (b = {}))
|
|
204
|
-
if (__hasOwnProp$
|
|
205
|
-
__defNormalProp$
|
|
206
|
-
if (__getOwnPropSymbols$
|
|
207
|
-
for (var prop of __getOwnPropSymbols$
|
|
208
|
-
if (__propIsEnum$
|
|
209
|
-
__defNormalProp$
|
|
205
|
+
if (__hasOwnProp$c.call(b, prop))
|
|
206
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
207
|
+
if (__getOwnPropSymbols$c)
|
|
208
|
+
for (var prop of __getOwnPropSymbols$c(b)) {
|
|
209
|
+
if (__propIsEnum$c.call(b, prop))
|
|
210
|
+
__defNormalProp$c(a, prop, b[prop]);
|
|
210
211
|
}
|
|
211
212
|
return a;
|
|
212
213
|
};
|
|
213
|
-
var __spreadProps$
|
|
214
|
+
var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
|
|
214
215
|
var __objRest$8 = (source, exclude) => {
|
|
215
216
|
var target = {};
|
|
216
217
|
for (var prop in source)
|
|
217
|
-
if (__hasOwnProp$
|
|
218
|
+
if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
218
219
|
target[prop] = source[prop];
|
|
219
|
-
if (source != null && __getOwnPropSymbols$
|
|
220
|
-
for (var prop of __getOwnPropSymbols$
|
|
221
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
220
|
+
if (source != null && __getOwnPropSymbols$c)
|
|
221
|
+
for (var prop of __getOwnPropSymbols$c(source)) {
|
|
222
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
|
|
222
223
|
target[prop] = source[prop];
|
|
223
224
|
}
|
|
224
225
|
return target;
|
|
@@ -232,12 +233,15 @@ function AntdCheckbox(props) {
|
|
|
232
233
|
return void 0;
|
|
233
234
|
}
|
|
234
235
|
}, [onChange]);
|
|
235
|
-
return /* @__PURE__ */ React.createElement(Checkbox, __spreadProps$
|
|
236
|
+
return /* @__PURE__ */ React.createElement(Checkbox, __spreadProps$9(__spreadValues$c({}, rest), { onChange: wrappedOnChange }));
|
|
236
237
|
}
|
|
238
|
+
AntdCheckbox.__plasmicFormFieldMeta = { valueProp: "checked" };
|
|
237
239
|
const AntdCheckboxGroup = Checkbox.Group;
|
|
240
|
+
const checkboxComponentName = "plasmic-antd5-checkbox";
|
|
241
|
+
const checkboxGroupComponentName = "plasmic-antd5-checkbox";
|
|
238
242
|
function registerCheckbox(loader) {
|
|
239
243
|
registerComponentHelper(loader, AntdCheckbox, {
|
|
240
|
-
name:
|
|
244
|
+
name: checkboxComponentName,
|
|
241
245
|
displayName: "Checkbox",
|
|
242
246
|
props: {
|
|
243
247
|
checked: {
|
|
@@ -245,11 +249,12 @@ function registerCheckbox(loader) {
|
|
|
245
249
|
editOnly: true,
|
|
246
250
|
uncontrolledProp: "defaultChecked",
|
|
247
251
|
description: "Specifies the initial state: whether or not the checkbox is selected",
|
|
248
|
-
defaultValueHint: false
|
|
252
|
+
defaultValueHint: false,
|
|
253
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
249
254
|
},
|
|
250
255
|
disabled: {
|
|
251
256
|
type: "boolean",
|
|
252
|
-
description: "If
|
|
257
|
+
description: "If checkbox is disabled",
|
|
253
258
|
defaultValueHint: false
|
|
254
259
|
},
|
|
255
260
|
indeterminate: {
|
|
@@ -257,18 +262,13 @@ function registerCheckbox(loader) {
|
|
|
257
262
|
description: "The indeterminate checked state of checkbox",
|
|
258
263
|
defaultValueHint: false
|
|
259
264
|
},
|
|
260
|
-
value: {
|
|
261
|
-
type: "string",
|
|
262
|
-
description: "The checkbox value",
|
|
263
|
-
advanced: true
|
|
264
|
-
},
|
|
265
265
|
autoFocus: {
|
|
266
266
|
type: "boolean",
|
|
267
267
|
description: "If get focus when component mounted",
|
|
268
268
|
defaultValueHint: false,
|
|
269
269
|
advanced: true
|
|
270
270
|
},
|
|
271
|
-
children: __spreadValues$
|
|
271
|
+
children: __spreadValues$c({
|
|
272
272
|
type: "slot",
|
|
273
273
|
defaultValue: [
|
|
274
274
|
{
|
|
@@ -294,7 +294,7 @@ function registerCheckbox(loader) {
|
|
|
294
294
|
importName: "AntdCheckbox"
|
|
295
295
|
});
|
|
296
296
|
registerComponentHelper(loader, AntdCheckboxGroup, {
|
|
297
|
-
name:
|
|
297
|
+
name: checkboxGroupComponentName,
|
|
298
298
|
displayName: "Checkbox Group",
|
|
299
299
|
props: {
|
|
300
300
|
value: {
|
|
@@ -345,37 +345,37 @@ function registerCheckbox(loader) {
|
|
|
345
345
|
},
|
|
346
346
|
importPath: "@plasmicpkgs/antd5/skinny/registerCheckbox",
|
|
347
347
|
importName: "AntdCheckboxGroup",
|
|
348
|
-
parentComponentName:
|
|
348
|
+
parentComponentName: checkboxComponentName
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
|
|
352
|
-
var __defProp$
|
|
353
|
-
var __defProps$
|
|
354
|
-
var __getOwnPropDescs$
|
|
355
|
-
var __getOwnPropSymbols$
|
|
356
|
-
var __hasOwnProp$
|
|
357
|
-
var __propIsEnum$
|
|
358
|
-
var __defNormalProp$
|
|
359
|
-
var __spreadValues$
|
|
352
|
+
var __defProp$b = Object.defineProperty;
|
|
353
|
+
var __defProps$8 = Object.defineProperties;
|
|
354
|
+
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
355
|
+
var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
|
|
356
|
+
var __hasOwnProp$b = Object.prototype.hasOwnProperty;
|
|
357
|
+
var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
|
|
358
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
359
|
+
var __spreadValues$b = (a, b) => {
|
|
360
360
|
for (var prop in b || (b = {}))
|
|
361
|
-
if (__hasOwnProp$
|
|
362
|
-
__defNormalProp$
|
|
363
|
-
if (__getOwnPropSymbols$
|
|
364
|
-
for (var prop of __getOwnPropSymbols$
|
|
365
|
-
if (__propIsEnum$
|
|
366
|
-
__defNormalProp$
|
|
361
|
+
if (__hasOwnProp$b.call(b, prop))
|
|
362
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
363
|
+
if (__getOwnPropSymbols$b)
|
|
364
|
+
for (var prop of __getOwnPropSymbols$b(b)) {
|
|
365
|
+
if (__propIsEnum$b.call(b, prop))
|
|
366
|
+
__defNormalProp$b(a, prop, b[prop]);
|
|
367
367
|
}
|
|
368
368
|
return a;
|
|
369
369
|
};
|
|
370
|
-
var __spreadProps$
|
|
370
|
+
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
371
371
|
var __objRest$7 = (source, exclude) => {
|
|
372
372
|
var target = {};
|
|
373
373
|
for (var prop in source)
|
|
374
|
-
if (__hasOwnProp$
|
|
374
|
+
if (__hasOwnProp$b.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
375
375
|
target[prop] = source[prop];
|
|
376
|
-
if (source != null && __getOwnPropSymbols$
|
|
377
|
-
for (var prop of __getOwnPropSymbols$
|
|
378
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
376
|
+
if (source != null && __getOwnPropSymbols$b)
|
|
377
|
+
for (var prop of __getOwnPropSymbols$b(source)) {
|
|
378
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$b.call(source, prop))
|
|
379
379
|
target[prop] = source[prop];
|
|
380
380
|
}
|
|
381
381
|
return target;
|
|
@@ -426,9 +426,9 @@ function AntdConfigProvider(props) {
|
|
|
426
426
|
const _a = props, { children, themeStyles } = _a, rest = __objRest$7(_a, ["children", "themeStyles"]);
|
|
427
427
|
return /* @__PURE__ */ React.createElement(
|
|
428
428
|
ConfigProvider,
|
|
429
|
-
__spreadValues$
|
|
429
|
+
__spreadValues$b({
|
|
430
430
|
locale: defaultLocale
|
|
431
|
-
}, themeToAntdConfig(__spreadProps$
|
|
431
|
+
}, themeToAntdConfig(__spreadProps$8(__spreadValues$b({}, rest), {
|
|
432
432
|
fontFamily: themeStyles.fontFamily,
|
|
433
433
|
fontSize: themeStyles.fontSize ? parseInt(themeStyles.fontSize) : void 0,
|
|
434
434
|
lineHeight: themeStyles.lineHeight ? parseInt(themeStyles.lineHeight) : void 0,
|
|
@@ -464,7 +464,7 @@ function InnerConfigProvider(props) {
|
|
|
464
464
|
showNotification: (opts) => {
|
|
465
465
|
var _b;
|
|
466
466
|
const _a = opts, rest = __objRest$7(_a, ["type"]);
|
|
467
|
-
app.notification[(_b = opts.type) != null ? _b : "info"](__spreadValues$
|
|
467
|
+
app.notification[(_b = opts.type) != null ? _b : "info"](__spreadValues$b({}, rest));
|
|
468
468
|
},
|
|
469
469
|
hideNotifications: () => {
|
|
470
470
|
app.notification.destroy();
|
|
@@ -761,7 +761,7 @@ function registerTokens(loader) {
|
|
|
761
761
|
}
|
|
762
762
|
const registerConfigProvider = makeRegisterGlobalContext(
|
|
763
763
|
AntdConfigProvider,
|
|
764
|
-
__spreadProps$
|
|
764
|
+
__spreadProps$8(__spreadValues$b({
|
|
765
765
|
name: "plasmic-antd5-config-provider",
|
|
766
766
|
displayName: "Ant Design System Settings",
|
|
767
767
|
props: {
|
|
@@ -863,22 +863,25 @@ const registerConfigProvider = makeRegisterGlobalContext(
|
|
|
863
863
|
})
|
|
864
864
|
);
|
|
865
865
|
|
|
866
|
-
var __defProp$
|
|
867
|
-
var
|
|
868
|
-
var
|
|
869
|
-
var
|
|
870
|
-
var
|
|
871
|
-
var
|
|
866
|
+
var __defProp$a = Object.defineProperty;
|
|
867
|
+
var __defProps$7 = Object.defineProperties;
|
|
868
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
869
|
+
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
870
|
+
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
871
|
+
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
872
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
873
|
+
var __spreadValues$a = (a, b) => {
|
|
872
874
|
for (var prop in b || (b = {}))
|
|
873
|
-
if (__hasOwnProp$
|
|
874
|
-
__defNormalProp$
|
|
875
|
-
if (__getOwnPropSymbols$
|
|
876
|
-
for (var prop of __getOwnPropSymbols$
|
|
877
|
-
if (__propIsEnum$
|
|
878
|
-
__defNormalProp$
|
|
875
|
+
if (__hasOwnProp$a.call(b, prop))
|
|
876
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
877
|
+
if (__getOwnPropSymbols$a)
|
|
878
|
+
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
879
|
+
if (__propIsEnum$a.call(b, prop))
|
|
880
|
+
__defNormalProp$a(a, prop, b[prop]);
|
|
879
881
|
}
|
|
880
882
|
return a;
|
|
881
883
|
};
|
|
884
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
882
885
|
const AntdMenu = Menu;
|
|
883
886
|
const AntdMenuDivider = Menu.Divider;
|
|
884
887
|
const AntdMenuItem = Menu.Item;
|
|
@@ -924,10 +927,23 @@ const MENU_ITEM_TYPE = {
|
|
|
924
927
|
type: "array",
|
|
925
928
|
displayName: "Menu items",
|
|
926
929
|
hidden: (ps) => ps.type !== "submenu" && ps.type !== "group"
|
|
930
|
+
},
|
|
931
|
+
onClick: {
|
|
932
|
+
type: "eventHandler",
|
|
933
|
+
displayName: "Action",
|
|
934
|
+
description: "Action to perform when this item is selected",
|
|
935
|
+
argTypes: [{ name: "info", type: "object" }],
|
|
936
|
+
hidden: (ps) => ps.type !== "item"
|
|
927
937
|
}
|
|
928
938
|
}
|
|
929
939
|
};
|
|
940
|
+
const UNKEYED_MENU_ITEM_TYPE = __spreadProps$7(__spreadValues$a({}, MENU_ITEM_TYPE), {
|
|
941
|
+
fields: Object.fromEntries(
|
|
942
|
+
Object.entries(MENU_ITEM_TYPE.fields).filter(([k]) => k !== "key")
|
|
943
|
+
)
|
|
944
|
+
});
|
|
930
945
|
MENU_ITEM_TYPE.fields.children.itemType = MENU_ITEM_TYPE;
|
|
946
|
+
UNKEYED_MENU_ITEM_TYPE.fields.children.itemType = UNKEYED_MENU_ITEM_TYPE;
|
|
931
947
|
function registerMenu(loader) {
|
|
932
948
|
registerComponentHelper(loader, AntdMenu, {
|
|
933
949
|
name: "plasmic-antd5-menu",
|
|
@@ -1007,7 +1023,7 @@ function registerMenu(loader) {
|
|
|
1007
1023
|
type: "string",
|
|
1008
1024
|
description: "Set display title for collapsed item"
|
|
1009
1025
|
},
|
|
1010
|
-
children: __spreadValues$
|
|
1026
|
+
children: __spreadValues$a({
|
|
1011
1027
|
type: "slot",
|
|
1012
1028
|
defaultValue: [
|
|
1013
1029
|
{
|
|
@@ -1115,21 +1131,21 @@ function registerMenu(loader) {
|
|
|
1115
1131
|
});
|
|
1116
1132
|
}
|
|
1117
1133
|
|
|
1118
|
-
var __defProp$
|
|
1134
|
+
var __defProp$9 = Object.defineProperty;
|
|
1119
1135
|
var __defProps$6 = Object.defineProperties;
|
|
1120
1136
|
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
1121
|
-
var __getOwnPropSymbols$
|
|
1122
|
-
var __hasOwnProp$
|
|
1123
|
-
var __propIsEnum$
|
|
1124
|
-
var __defNormalProp$
|
|
1125
|
-
var __spreadValues$
|
|
1137
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
1138
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
1139
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
1140
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1141
|
+
var __spreadValues$9 = (a, b) => {
|
|
1126
1142
|
for (var prop in b || (b = {}))
|
|
1127
|
-
if (__hasOwnProp$
|
|
1128
|
-
__defNormalProp$
|
|
1129
|
-
if (__getOwnPropSymbols$
|
|
1130
|
-
for (var prop of __getOwnPropSymbols$
|
|
1131
|
-
if (__propIsEnum$
|
|
1132
|
-
__defNormalProp$
|
|
1143
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
1144
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
1145
|
+
if (__getOwnPropSymbols$9)
|
|
1146
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
1147
|
+
if (__propIsEnum$9.call(b, prop))
|
|
1148
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
1133
1149
|
}
|
|
1134
1150
|
return a;
|
|
1135
1151
|
};
|
|
@@ -1137,11 +1153,11 @@ var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
|
1137
1153
|
var __objRest$6 = (source, exclude) => {
|
|
1138
1154
|
var target = {};
|
|
1139
1155
|
for (var prop in source)
|
|
1140
|
-
if (__hasOwnProp$
|
|
1156
|
+
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1141
1157
|
target[prop] = source[prop];
|
|
1142
|
-
if (source != null && __getOwnPropSymbols$
|
|
1143
|
-
for (var prop of __getOwnPropSymbols$
|
|
1144
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$
|
|
1158
|
+
if (source != null && __getOwnPropSymbols$9)
|
|
1159
|
+
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
1160
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
1145
1161
|
target[prop] = source[prop];
|
|
1146
1162
|
}
|
|
1147
1163
|
return target;
|
|
@@ -1164,7 +1180,7 @@ function AntdDropdown(props) {
|
|
|
1164
1180
|
]);
|
|
1165
1181
|
return /* @__PURE__ */ React.createElement(
|
|
1166
1182
|
Dropdown,
|
|
1167
|
-
__spreadProps$6(__spreadValues$
|
|
1183
|
+
__spreadProps$6(__spreadValues$9({}, rest), {
|
|
1168
1184
|
trigger: [trigger],
|
|
1169
1185
|
overlay: () => {
|
|
1170
1186
|
var _a2;
|
|
@@ -1213,7 +1229,7 @@ function registerDropdown(loader) {
|
|
|
1213
1229
|
type: "array",
|
|
1214
1230
|
displayName: "Menu Items",
|
|
1215
1231
|
hidden: (ps) => ps.useMenuItemsSlot,
|
|
1216
|
-
itemType:
|
|
1232
|
+
itemType: UNKEYED_MENU_ITEM_TYPE,
|
|
1217
1233
|
defaultValue: [
|
|
1218
1234
|
{
|
|
1219
1235
|
type: "item",
|
|
@@ -1269,7 +1285,7 @@ function registerDropdown(loader) {
|
|
|
1269
1285
|
advanced: true,
|
|
1270
1286
|
description: "Instead of configuring a list of menu items, build the menu items using MenuItem elements. This gives you greater control over item styling."
|
|
1271
1287
|
},
|
|
1272
|
-
children: __spreadValues$
|
|
1288
|
+
children: __spreadValues$9({
|
|
1273
1289
|
type: "slot",
|
|
1274
1290
|
defaultValue: [
|
|
1275
1291
|
{
|
|
@@ -1300,19 +1316,19 @@ function registerDropdown(loader) {
|
|
|
1300
1316
|
});
|
|
1301
1317
|
}
|
|
1302
1318
|
|
|
1303
|
-
var __defProp$
|
|
1304
|
-
var __getOwnPropSymbols$
|
|
1305
|
-
var __hasOwnProp$
|
|
1306
|
-
var __propIsEnum$
|
|
1307
|
-
var __defNormalProp$
|
|
1308
|
-
var __spreadValues$
|
|
1319
|
+
var __defProp$8 = Object.defineProperty;
|
|
1320
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
1321
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
1322
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
1323
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1324
|
+
var __spreadValues$8 = (a, b) => {
|
|
1309
1325
|
for (var prop in b || (b = {}))
|
|
1310
|
-
if (__hasOwnProp$
|
|
1311
|
-
__defNormalProp$
|
|
1312
|
-
if (__getOwnPropSymbols$
|
|
1313
|
-
for (var prop of __getOwnPropSymbols$
|
|
1314
|
-
if (__propIsEnum$
|
|
1315
|
-
__defNormalProp$
|
|
1326
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
1327
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
1328
|
+
if (__getOwnPropSymbols$8)
|
|
1329
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
1330
|
+
if (__propIsEnum$8.call(b, prop))
|
|
1331
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
1316
1332
|
}
|
|
1317
1333
|
return a;
|
|
1318
1334
|
};
|
|
@@ -1323,7 +1339,7 @@ function mergeProps(props, ...restProps) {
|
|
|
1323
1339
|
if (restProps.every((rest) => Object.keys(rest).length === 0)) {
|
|
1324
1340
|
return props;
|
|
1325
1341
|
}
|
|
1326
|
-
const result = __spreadValues$
|
|
1342
|
+
const result = __spreadValues$8({}, props);
|
|
1327
1343
|
for (const rest of restProps) {
|
|
1328
1344
|
for (const key of Object.keys(rest)) {
|
|
1329
1345
|
result[key] = mergePropVals(key, result[key], rest[key]);
|
|
@@ -1360,7 +1376,7 @@ function mergePropVals(name, val1, val2) {
|
|
|
1360
1376
|
} else if (name === "className") {
|
|
1361
1377
|
return classNames(val1, val2);
|
|
1362
1378
|
} else if (name === "style") {
|
|
1363
|
-
return __spreadValues$
|
|
1379
|
+
return __spreadValues$8(__spreadValues$8({}, val1), val2);
|
|
1364
1380
|
} else if (name === "ref") {
|
|
1365
1381
|
return mergeRefs(val1, val2);
|
|
1366
1382
|
} else if (typeof val1 !== typeof val2) {
|
|
@@ -1381,1588 +1397,2009 @@ function mergePropVals(name, val1, val2) {
|
|
|
1381
1397
|
}
|
|
1382
1398
|
}
|
|
1383
1399
|
|
|
1384
|
-
var __defProp$
|
|
1400
|
+
var __defProp$7 = Object.defineProperty;
|
|
1385
1401
|
var __defProps$5 = Object.defineProperties;
|
|
1386
1402
|
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
1387
|
-
var __getOwnPropSymbols$
|
|
1388
|
-
var __hasOwnProp$
|
|
1389
|
-
var __propIsEnum$
|
|
1390
|
-
var __defNormalProp$
|
|
1391
|
-
var __spreadValues$
|
|
1403
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
1404
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
1405
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
1406
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1407
|
+
var __spreadValues$7 = (a, b) => {
|
|
1392
1408
|
for (var prop in b || (b = {}))
|
|
1393
|
-
if (__hasOwnProp$
|
|
1394
|
-
__defNormalProp$
|
|
1395
|
-
if (__getOwnPropSymbols$
|
|
1396
|
-
for (var prop of __getOwnPropSymbols$
|
|
1397
|
-
if (__propIsEnum$
|
|
1398
|
-
__defNormalProp$
|
|
1409
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
1410
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1411
|
+
if (__getOwnPropSymbols$7)
|
|
1412
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
1413
|
+
if (__propIsEnum$7.call(b, prop))
|
|
1414
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
1399
1415
|
}
|
|
1400
1416
|
return a;
|
|
1401
1417
|
};
|
|
1402
1418
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
target
|
|
1419
|
+
const AntdInput = Input;
|
|
1420
|
+
const AntdTextArea = Input.TextArea;
|
|
1421
|
+
const AntdPassword = Input.Password;
|
|
1422
|
+
const AntdInputNumber = InputNumber;
|
|
1423
|
+
const inputHelpers = {
|
|
1424
|
+
states: {
|
|
1425
|
+
value: {
|
|
1426
|
+
onChangeArgsToValue: (e) => {
|
|
1427
|
+
return e.target.value;
|
|
1428
|
+
}
|
|
1412
1429
|
}
|
|
1413
|
-
|
|
1430
|
+
}
|
|
1414
1431
|
};
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
string += reactNodeToString(reactNode.props.children);
|
|
1432
|
+
const COMMON_HELPERS_CONFIG = {
|
|
1433
|
+
helpers: inputHelpers,
|
|
1434
|
+
importName: "inputHelpers",
|
|
1435
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerInput"
|
|
1436
|
+
};
|
|
1437
|
+
const COMMON_STATES = {
|
|
1438
|
+
value: {
|
|
1439
|
+
type: "writable",
|
|
1440
|
+
valueProp: "value",
|
|
1441
|
+
variableType: "text",
|
|
1442
|
+
onChangeProp: "onChange"
|
|
1427
1443
|
}
|
|
1428
|
-
return string;
|
|
1429
1444
|
};
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1445
|
+
const COMMON_DECORATOR_PROPS = {
|
|
1446
|
+
prefix: {
|
|
1447
|
+
type: "slot",
|
|
1448
|
+
hidePlaceholder: true
|
|
1449
|
+
},
|
|
1450
|
+
suffix: {
|
|
1451
|
+
type: "slot",
|
|
1452
|
+
hidePlaceholder: true
|
|
1453
|
+
},
|
|
1454
|
+
addonAfter: {
|
|
1455
|
+
type: "slot",
|
|
1456
|
+
hidePlaceholder: true
|
|
1457
|
+
},
|
|
1458
|
+
addonBefore: {
|
|
1459
|
+
type: "slot",
|
|
1460
|
+
hidePlaceholder: true
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
const COMMON_ADVANCED_PROPS = {
|
|
1464
|
+
maxLength: {
|
|
1465
|
+
type: "number",
|
|
1466
|
+
advanced: true
|
|
1467
|
+
},
|
|
1468
|
+
bordered: {
|
|
1469
|
+
type: "boolean",
|
|
1470
|
+
advanced: true,
|
|
1471
|
+
defaultValueHint: true
|
|
1472
|
+
},
|
|
1473
|
+
allowClear: {
|
|
1474
|
+
type: "boolean",
|
|
1475
|
+
advanced: true
|
|
1476
|
+
},
|
|
1477
|
+
autoFocus: {
|
|
1478
|
+
type: "boolean",
|
|
1479
|
+
advanced: true
|
|
1480
|
+
},
|
|
1481
|
+
readOnly: {
|
|
1482
|
+
type: "boolean",
|
|
1483
|
+
advanced: true
|
|
1484
|
+
}
|
|
1485
|
+
};
|
|
1486
|
+
const COMMON_EVENT_HANDLERS = {
|
|
1487
|
+
onChange: {
|
|
1488
|
+
type: "eventHandler",
|
|
1489
|
+
argTypes: [
|
|
1490
|
+
{
|
|
1491
|
+
name: "event",
|
|
1492
|
+
type: "object"
|
|
1493
|
+
}
|
|
1494
|
+
]
|
|
1495
|
+
},
|
|
1496
|
+
onPressEnter: {
|
|
1497
|
+
type: "eventHandler",
|
|
1498
|
+
argTypes: [
|
|
1499
|
+
{
|
|
1500
|
+
name: "event",
|
|
1501
|
+
type: "object"
|
|
1502
|
+
}
|
|
1503
|
+
]
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
const inputComponentName = "plasmic-antd5-input";
|
|
1507
|
+
function registerInput(loader) {
|
|
1508
|
+
registerComponentHelper(loader, AntdInput, __spreadProps$5(__spreadValues$7({
|
|
1509
|
+
name: inputComponentName,
|
|
1510
|
+
displayName: "Input",
|
|
1511
|
+
props: __spreadValues$7(__spreadValues$7(__spreadValues$7({
|
|
1468
1512
|
value: {
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1513
|
+
type: "string",
|
|
1514
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
1515
|
+
},
|
|
1516
|
+
placeholder: {
|
|
1517
|
+
type: "string"
|
|
1518
|
+
},
|
|
1519
|
+
size: {
|
|
1520
|
+
type: "choice",
|
|
1521
|
+
options: ["large", "middle", "small"]
|
|
1522
|
+
},
|
|
1523
|
+
disabled: {
|
|
1524
|
+
type: "boolean"
|
|
1525
|
+
},
|
|
1526
|
+
type: {
|
|
1527
|
+
type: "choice",
|
|
1528
|
+
options: [
|
|
1529
|
+
"text",
|
|
1530
|
+
"password",
|
|
1531
|
+
"number",
|
|
1532
|
+
"date",
|
|
1533
|
+
"datetime-local",
|
|
1534
|
+
"time",
|
|
1535
|
+
"email",
|
|
1536
|
+
"tel",
|
|
1537
|
+
"hidden"
|
|
1538
|
+
],
|
|
1539
|
+
defaultValueHint: "text"
|
|
1472
1540
|
}
|
|
1473
|
-
},
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1541
|
+
}, COMMON_ADVANCED_PROPS), COMMON_DECORATOR_PROPS), COMMON_EVENT_HANDLERS),
|
|
1542
|
+
states: __spreadValues$7({}, COMMON_STATES)
|
|
1543
|
+
}, { trapsSelection: true }), {
|
|
1544
|
+
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
1545
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1546
|
+
importName: "AntdInput"
|
|
1547
|
+
}));
|
|
1548
|
+
}
|
|
1549
|
+
const textAreaComponentName = "plasmic-antd5-textarea";
|
|
1550
|
+
function registerTextArea(loader) {
|
|
1551
|
+
registerComponentHelper(loader, AntdTextArea, {
|
|
1552
|
+
name: textAreaComponentName,
|
|
1553
|
+
parentComponentName: inputComponentName,
|
|
1554
|
+
displayName: "Text Area",
|
|
1555
|
+
props: __spreadValues$7({
|
|
1556
|
+
value: {
|
|
1557
|
+
type: "string",
|
|
1558
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
1559
|
+
},
|
|
1560
|
+
placeholder: {
|
|
1561
|
+
type: "string"
|
|
1562
|
+
},
|
|
1563
|
+
disabled: {
|
|
1564
|
+
type: "boolean"
|
|
1565
|
+
},
|
|
1566
|
+
maxLength: {
|
|
1567
|
+
type: "number",
|
|
1568
|
+
advanced: true
|
|
1569
|
+
},
|
|
1570
|
+
bordered: {
|
|
1571
|
+
type: "boolean",
|
|
1572
|
+
advanced: true,
|
|
1573
|
+
defaultValueHint: true
|
|
1574
|
+
}
|
|
1575
|
+
}, COMMON_EVENT_HANDLERS),
|
|
1576
|
+
states: __spreadValues$7({}, COMMON_STATES),
|
|
1577
|
+
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
1578
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1579
|
+
importName: "AntdTextArea"
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
const passwordComponentName = "plasmic-antd5-input-password";
|
|
1583
|
+
function registerPasswordInput(loader) {
|
|
1584
|
+
registerComponentHelper(loader, AntdPassword, {
|
|
1585
|
+
name: passwordComponentName,
|
|
1586
|
+
parentComponentName: inputComponentName,
|
|
1587
|
+
displayName: "Password Input",
|
|
1588
|
+
props: __spreadValues$7({
|
|
1589
|
+
value: {
|
|
1590
|
+
type: "string",
|
|
1591
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
1592
|
+
},
|
|
1593
|
+
placeholder: {
|
|
1594
|
+
type: "string"
|
|
1595
|
+
},
|
|
1596
|
+
disabled: {
|
|
1597
|
+
type: "boolean"
|
|
1598
|
+
},
|
|
1599
|
+
maxLength: {
|
|
1600
|
+
type: "number",
|
|
1601
|
+
advanced: true
|
|
1602
|
+
},
|
|
1603
|
+
bordered: {
|
|
1604
|
+
type: "boolean",
|
|
1605
|
+
advanced: true,
|
|
1606
|
+
defaultValueHint: true
|
|
1607
|
+
}
|
|
1608
|
+
}, COMMON_EVENT_HANDLERS),
|
|
1609
|
+
states: __spreadValues$7({}, COMMON_STATES),
|
|
1610
|
+
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
1611
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1612
|
+
importName: "AntdPassword"
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
const inputNumberComponentName = "plasmic-antd5-input-number";
|
|
1616
|
+
function registerNumberInput(loader) {
|
|
1617
|
+
registerComponentHelper(loader, AntdInputNumber, __spreadProps$5(__spreadValues$7({
|
|
1618
|
+
name: inputNumberComponentName,
|
|
1619
|
+
parentComponentName: inputComponentName,
|
|
1620
|
+
displayName: "Number Input",
|
|
1621
|
+
props: __spreadProps$5(__spreadValues$7(__spreadValues$7(__spreadValues$7({
|
|
1622
|
+
value: {
|
|
1623
|
+
type: "number",
|
|
1624
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
1625
|
+
},
|
|
1626
|
+
placeholder: {
|
|
1627
|
+
type: "string"
|
|
1628
|
+
},
|
|
1629
|
+
disabled: {
|
|
1630
|
+
type: "boolean"
|
|
1631
|
+
},
|
|
1632
|
+
max: {
|
|
1633
|
+
type: "number"
|
|
1634
|
+
},
|
|
1635
|
+
min: {
|
|
1636
|
+
type: "number"
|
|
1637
|
+
},
|
|
1638
|
+
step: {
|
|
1639
|
+
type: "number",
|
|
1640
|
+
helpText: "Increment or decrement step"
|
|
1641
|
+
},
|
|
1642
|
+
controls: {
|
|
1643
|
+
type: "boolean",
|
|
1644
|
+
displayName: "Show add/minus controls?",
|
|
1645
|
+
advanced: true
|
|
1646
|
+
}
|
|
1647
|
+
}, COMMON_DECORATOR_PROPS), COMMON_ADVANCED_PROPS), COMMON_EVENT_HANDLERS), {
|
|
1648
|
+
// onChange directly called with the number
|
|
1649
|
+
onChange: {
|
|
1650
|
+
type: "eventHandler",
|
|
1651
|
+
argTypes: [
|
|
1652
|
+
{
|
|
1653
|
+
name: "value",
|
|
1654
|
+
type: "number"
|
|
1490
1655
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
)
|
|
1494
|
-
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
if (previousInitialValues !== props.initialValues && JSON.stringify(previousInitialValues) !== JSON.stringify(props.initialValues)) {
|
|
1501
|
-
setRemountKey((k) => k + 1);
|
|
1502
|
-
}
|
|
1503
|
-
}, [previousInitialValues, props.initialValues]);
|
|
1504
|
-
return /* @__PURE__ */ React.createElement(Internal, __spreadProps$5(__spreadValues$6({ key: remountKey }, props), { setRemountKey }));
|
|
1656
|
+
]
|
|
1657
|
+
}
|
|
1658
|
+
}),
|
|
1659
|
+
states: __spreadValues$7({}, COMMON_STATES)
|
|
1660
|
+
}, { trapsSelection: true }), {
|
|
1661
|
+
// don't need component helpers
|
|
1662
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1663
|
+
importName: "AntdInputNumber"
|
|
1664
|
+
}));
|
|
1505
1665
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
);
|
|
1666
|
+
|
|
1667
|
+
var __defProp$6 = Object.defineProperty;
|
|
1668
|
+
var __defProps$4 = Object.defineProperties;
|
|
1669
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1670
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
1671
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
1672
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
1673
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1674
|
+
var __spreadValues$6 = (a, b) => {
|
|
1675
|
+
for (var prop in b || (b = {}))
|
|
1676
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
1677
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1678
|
+
if (__getOwnPropSymbols$6)
|
|
1679
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
1680
|
+
if (__propIsEnum$6.call(b, prop))
|
|
1681
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
1518
1682
|
}
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
// },
|
|
1532
|
-
// },
|
|
1533
|
-
// {
|
|
1534
|
-
// type: "button-action" as const,
|
|
1535
|
-
// label: "Append new Form List",
|
|
1536
|
-
// onClick: ({ studioOps }: ActionProps<any>) => {
|
|
1537
|
-
// studioOps.appendToSlot(
|
|
1538
|
-
// {
|
|
1539
|
-
// type: "component",
|
|
1540
|
-
// name: "plasmic-antd5-form-list",
|
|
1541
|
-
// },
|
|
1542
|
-
// "children"
|
|
1543
|
-
// );
|
|
1544
|
-
// },
|
|
1545
|
-
// },
|
|
1546
|
-
];
|
|
1547
|
-
const colProp = (displayName, defaultValue, description) => ({
|
|
1548
|
-
type: "object",
|
|
1549
|
-
displayName,
|
|
1550
|
-
advanced: true,
|
|
1551
|
-
fields: {
|
|
1552
|
-
span: {
|
|
1553
|
-
type: "number",
|
|
1554
|
-
displayName: "Width",
|
|
1555
|
-
description: "The number of grid columns to span in width (out of 24 columns total)",
|
|
1556
|
-
min: 1,
|
|
1557
|
-
max: 24
|
|
1558
|
-
},
|
|
1559
|
-
offset: {
|
|
1560
|
-
type: "number",
|
|
1561
|
-
displayName: "Offset",
|
|
1562
|
-
description: "Number of grid columns to skip from the left (out of 24 columns total)",
|
|
1563
|
-
min: 0,
|
|
1564
|
-
max: 23
|
|
1565
|
-
},
|
|
1566
|
-
horizontalOnly: {
|
|
1567
|
-
type: "boolean",
|
|
1568
|
-
displayName: "Horizontal only",
|
|
1569
|
-
description: "Only apply to horizontal layout"
|
|
1683
|
+
return a;
|
|
1684
|
+
};
|
|
1685
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1686
|
+
var __objRest$5 = (source, exclude) => {
|
|
1687
|
+
var target = {};
|
|
1688
|
+
for (var prop in source)
|
|
1689
|
+
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1690
|
+
target[prop] = source[prop];
|
|
1691
|
+
if (source != null && __getOwnPropSymbols$6)
|
|
1692
|
+
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
1693
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
1694
|
+
target[prop] = source[prop];
|
|
1570
1695
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1696
|
+
return target;
|
|
1697
|
+
};
|
|
1698
|
+
const RadioGroup = Radio.Group;
|
|
1699
|
+
const AntdRadio = Radio;
|
|
1700
|
+
const AntdRadioButton = Radio.Button;
|
|
1701
|
+
function AntdRadioGroup(props) {
|
|
1702
|
+
const _a = props, { onChange, useChildren } = _a, rest = __objRest$5(_a, ["onChange", "useChildren"]);
|
|
1703
|
+
const wrappedOnChange = React.useMemo(() => {
|
|
1704
|
+
if (onChange) {
|
|
1705
|
+
return (event) => onChange(event.target.value);
|
|
1706
|
+
} else {
|
|
1707
|
+
return void 0;
|
|
1708
|
+
}
|
|
1709
|
+
}, [onChange]);
|
|
1710
|
+
return /* @__PURE__ */ React.createElement(
|
|
1711
|
+
RadioGroup,
|
|
1712
|
+
__spreadProps$4(__spreadValues$6({}, rest), {
|
|
1713
|
+
onChange: wrappedOnChange,
|
|
1714
|
+
options: useChildren ? void 0 : rest.options
|
|
1715
|
+
})
|
|
1716
|
+
);
|
|
1717
|
+
}
|
|
1718
|
+
const radioComponentName = "plasmic-antd5-radio";
|
|
1719
|
+
const radioButtonComponentName = "plasmic-antd5-radio-button";
|
|
1720
|
+
const radioGroupComponentName = "plasmic-antd5-radio-group";
|
|
1721
|
+
function registerRadio(loader) {
|
|
1722
|
+
registerComponentHelper(loader, AntdRadio, {
|
|
1723
|
+
name: radioComponentName,
|
|
1724
|
+
displayName: "Radio",
|
|
1583
1725
|
props: {
|
|
1584
|
-
|
|
1726
|
+
value: {
|
|
1727
|
+
type: "string",
|
|
1728
|
+
description: "The radio option value"
|
|
1729
|
+
},
|
|
1730
|
+
disabled: {
|
|
1731
|
+
type: "boolean",
|
|
1732
|
+
defaultValueHint: false
|
|
1733
|
+
},
|
|
1734
|
+
autoFocus: {
|
|
1735
|
+
type: "boolean",
|
|
1736
|
+
description: "If focused when first shown",
|
|
1737
|
+
defaultValueHint: false,
|
|
1738
|
+
advanced: true
|
|
1739
|
+
},
|
|
1740
|
+
children: __spreadValues$6({
|
|
1585
1741
|
type: "slot",
|
|
1586
1742
|
defaultValue: [
|
|
1587
1743
|
{
|
|
1588
|
-
type: "
|
|
1589
|
-
|
|
1590
|
-
props: {
|
|
1591
|
-
label: {
|
|
1592
|
-
type: "text",
|
|
1593
|
-
value: "Name"
|
|
1594
|
-
},
|
|
1595
|
-
name: "name",
|
|
1596
|
-
children: {
|
|
1597
|
-
type: "component",
|
|
1598
|
-
name: "plasmic-antd5-input"
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
},
|
|
1602
|
-
{
|
|
1603
|
-
type: "component",
|
|
1604
|
-
name: "plasmic-antd5-form-item",
|
|
1605
|
-
props: {
|
|
1606
|
-
label: {
|
|
1607
|
-
type: "text",
|
|
1608
|
-
value: "Message"
|
|
1609
|
-
},
|
|
1610
|
-
name: "message",
|
|
1611
|
-
children: {
|
|
1612
|
-
type: "component",
|
|
1613
|
-
name: "plasmic-antd5-textarea"
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
},
|
|
1617
|
-
{
|
|
1618
|
-
type: "component",
|
|
1619
|
-
name: "plasmic-antd5-form-item",
|
|
1620
|
-
props: {
|
|
1621
|
-
noLabel: true,
|
|
1622
|
-
children: {
|
|
1623
|
-
type: "component",
|
|
1624
|
-
name: "plasmic-antd5-button",
|
|
1625
|
-
props: {
|
|
1626
|
-
children: {
|
|
1627
|
-
type: "text",
|
|
1628
|
-
value: "Submit"
|
|
1629
|
-
},
|
|
1630
|
-
type: "primary",
|
|
1631
|
-
submitsForm: true
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1744
|
+
type: "text",
|
|
1745
|
+
value: "Radio"
|
|
1635
1746
|
}
|
|
1636
1747
|
]
|
|
1748
|
+
}, { mergeWithParent: true })
|
|
1749
|
+
},
|
|
1750
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerRadio",
|
|
1751
|
+
importName: "AntdRadio",
|
|
1752
|
+
parentComponentName: radioGroupComponentName
|
|
1753
|
+
});
|
|
1754
|
+
registerComponentHelper(loader, AntdRadioButton, {
|
|
1755
|
+
name: radioButtonComponentName,
|
|
1756
|
+
displayName: "Radio Button",
|
|
1757
|
+
props: {
|
|
1758
|
+
value: {
|
|
1759
|
+
type: "string",
|
|
1760
|
+
description: "The radio option value"
|
|
1637
1761
|
},
|
|
1638
|
-
|
|
1639
|
-
type: "
|
|
1640
|
-
|
|
1641
|
-
layout: {
|
|
1642
|
-
type: "choice",
|
|
1643
|
-
options: ["horizontal", "vertical", "inline"],
|
|
1644
|
-
defaultValue: "vertical"
|
|
1645
|
-
},
|
|
1646
|
-
labelAlign: {
|
|
1647
|
-
type: "choice",
|
|
1648
|
-
options: ["left", "right"],
|
|
1649
|
-
defaultValueHint: "right",
|
|
1650
|
-
advanced: true,
|
|
1651
|
-
hidden: (ps) => ps.layout !== "horizontal"
|
|
1762
|
+
disabled: {
|
|
1763
|
+
type: "boolean",
|
|
1764
|
+
defaultValueHint: false
|
|
1652
1765
|
},
|
|
1653
|
-
|
|
1654
|
-
"Label layout",
|
|
1655
|
-
{
|
|
1656
|
-
span: 8,
|
|
1657
|
-
horizontalOnly: true
|
|
1658
|
-
},
|
|
1659
|
-
"Set the width and offset of the labels"
|
|
1660
|
-
),
|
|
1661
|
-
wrapperCol: colProp(
|
|
1662
|
-
"Control layout",
|
|
1663
|
-
{
|
|
1664
|
-
span: 16,
|
|
1665
|
-
horizontalOnly: true
|
|
1666
|
-
},
|
|
1667
|
-
"Set the width and offset of the form controls"
|
|
1668
|
-
),
|
|
1669
|
-
colon: {
|
|
1766
|
+
autoFocus: {
|
|
1670
1767
|
type: "boolean",
|
|
1671
|
-
description:
|
|
1672
|
-
defaultValueHint:
|
|
1673
|
-
advanced: true
|
|
1674
|
-
hidden: (props) => {
|
|
1675
|
-
var _a;
|
|
1676
|
-
return ((_a = props.layout) != null ? _a : "horizontal") !== "horizontal";
|
|
1677
|
-
}
|
|
1768
|
+
description: "If focused when first shown",
|
|
1769
|
+
defaultValueHint: false,
|
|
1770
|
+
advanced: true
|
|
1678
1771
|
},
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
options: [
|
|
1772
|
+
children: __spreadValues$6({
|
|
1773
|
+
type: "slot",
|
|
1774
|
+
defaultValue: [
|
|
1683
1775
|
{
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
}
|
|
1776
|
+
type: "text",
|
|
1777
|
+
value: "Radio"
|
|
1778
|
+
}
|
|
1779
|
+
]
|
|
1780
|
+
}, { mergeWithParent: true })
|
|
1781
|
+
},
|
|
1782
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerRadio",
|
|
1783
|
+
importName: "AntdRadioButton",
|
|
1784
|
+
parentComponentName: radioGroupComponentName
|
|
1785
|
+
});
|
|
1786
|
+
registerComponentHelper(loader, AntdRadioGroup, __spreadValues$6({
|
|
1787
|
+
name: radioGroupComponentName,
|
|
1788
|
+
displayName: "Radio Group",
|
|
1789
|
+
props: {
|
|
1790
|
+
options: {
|
|
1791
|
+
type: "array",
|
|
1792
|
+
hidden: (ps) => !!ps.useChildren,
|
|
1793
|
+
itemType: {
|
|
1794
|
+
type: "object",
|
|
1795
|
+
nameFunc: (item) => item.label || item.value,
|
|
1796
|
+
fields: {
|
|
1797
|
+
value: "string",
|
|
1798
|
+
label: "string"
|
|
1799
|
+
}
|
|
1800
|
+
},
|
|
1801
|
+
defaultValue: [
|
|
1687
1802
|
{
|
|
1688
|
-
value:
|
|
1689
|
-
label: "
|
|
1803
|
+
value: "option1",
|
|
1804
|
+
label: "Option 1"
|
|
1690
1805
|
},
|
|
1691
1806
|
{
|
|
1692
|
-
value:
|
|
1693
|
-
label: "
|
|
1807
|
+
value: "option2",
|
|
1808
|
+
label: "Option 2"
|
|
1694
1809
|
}
|
|
1810
|
+
]
|
|
1811
|
+
},
|
|
1812
|
+
optionType: {
|
|
1813
|
+
type: "choice",
|
|
1814
|
+
options: [
|
|
1815
|
+
{ value: "default", label: "Radio" },
|
|
1816
|
+
{ value: "button", label: "Button" }
|
|
1695
1817
|
],
|
|
1818
|
+
hidden: (ps) => !!ps.useChildren,
|
|
1819
|
+
defaultValueHint: "default"
|
|
1820
|
+
},
|
|
1821
|
+
value: {
|
|
1822
|
+
type: "choice",
|
|
1823
|
+
editOnly: true,
|
|
1824
|
+
uncontrolledProp: "defaultValue",
|
|
1825
|
+
description: "Default selected value",
|
|
1826
|
+
options: (ps) => {
|
|
1827
|
+
var _a;
|
|
1828
|
+
if (ps.useChildren) {
|
|
1829
|
+
const options = /* @__PURE__ */ new Set();
|
|
1830
|
+
traverseReactEltTree(ps.children, (elt) => {
|
|
1831
|
+
var _a2;
|
|
1832
|
+
if (typeof ((_a2 = elt == null ? void 0 : elt.props) == null ? void 0 : _a2.value) === "string") {
|
|
1833
|
+
options.add(elt.props.value);
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
return Array.from(options.keys());
|
|
1837
|
+
} else {
|
|
1838
|
+
return (_a = ps.options) != null ? _a : [];
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
1842
|
+
},
|
|
1843
|
+
disabled: {
|
|
1844
|
+
type: "boolean",
|
|
1845
|
+
description: "Disables all radios",
|
|
1846
|
+
defaultValueHint: false
|
|
1847
|
+
},
|
|
1848
|
+
useChildren: {
|
|
1849
|
+
displayName: "Use slot",
|
|
1850
|
+
type: "boolean",
|
|
1851
|
+
defaultValueHint: false,
|
|
1696
1852
|
advanced: true,
|
|
1697
|
-
|
|
1853
|
+
description: "Instead of configuring a list of options, customize the contents of the RadioGroup by dragging and dropping Radio in the outline/canvas, inside the 'children' slot. Lets you use any content or formatting within the Radio and RadioButton."
|
|
1698
1854
|
},
|
|
1699
|
-
|
|
1700
|
-
type: "
|
|
1701
|
-
|
|
1702
|
-
|
|
1855
|
+
children: {
|
|
1856
|
+
type: "slot",
|
|
1857
|
+
allowedComponents: [
|
|
1858
|
+
"plasmic-antd5-radio",
|
|
1859
|
+
"plasmic-antd5-radio-button"
|
|
1860
|
+
],
|
|
1861
|
+
defaultValue: [
|
|
1703
1862
|
{
|
|
1704
|
-
|
|
1705
|
-
|
|
1863
|
+
type: "component",
|
|
1864
|
+
name: "plasmic-antd5-radio",
|
|
1865
|
+
props: {
|
|
1866
|
+
value: "op1",
|
|
1867
|
+
children: {
|
|
1868
|
+
type: "text",
|
|
1869
|
+
value: "Option 1"
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1706
1872
|
},
|
|
1707
1873
|
{
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
{
|
|
1718
|
-
name: "values",
|
|
1719
|
-
type: "object"
|
|
1874
|
+
type: "component",
|
|
1875
|
+
name: "plasmic-antd5-radio",
|
|
1876
|
+
props: {
|
|
1877
|
+
value: "op2",
|
|
1878
|
+
children: {
|
|
1879
|
+
type: "text",
|
|
1880
|
+
value: "Option 2"
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1720
1883
|
}
|
|
1721
1884
|
]
|
|
1722
1885
|
},
|
|
1723
|
-
|
|
1724
|
-
// function({ values, errorFields, outOfDate })
|
|
1886
|
+
onChange: {
|
|
1725
1887
|
type: "eventHandler",
|
|
1726
|
-
|
|
1727
|
-
argTypes: [
|
|
1728
|
-
{
|
|
1729
|
-
name: "data",
|
|
1730
|
-
type: "object"
|
|
1731
|
-
}
|
|
1732
|
-
]
|
|
1733
|
-
},
|
|
1734
|
-
validateTrigger: {
|
|
1735
|
-
type: "choice",
|
|
1736
|
-
options: ["onSubmit", "onChange", "onBlur"],
|
|
1737
|
-
multiSelect: true,
|
|
1738
|
-
defaultValueHint: ["onChange"],
|
|
1739
|
-
advanced: true
|
|
1888
|
+
argTypes: [{ name: "value", type: "string" }]
|
|
1740
1889
|
}
|
|
1741
1890
|
},
|
|
1742
|
-
actions: COMMON_ACTIONS,
|
|
1743
1891
|
states: {
|
|
1744
1892
|
value: {
|
|
1745
|
-
type: "
|
|
1746
|
-
|
|
1747
|
-
onChangeProp: "
|
|
1893
|
+
type: "writable",
|
|
1894
|
+
valueProp: "value",
|
|
1895
|
+
onChangeProp: "onChange",
|
|
1896
|
+
variableType: "text"
|
|
1748
1897
|
}
|
|
1749
1898
|
},
|
|
1750
|
-
importPath: "@plasmicpkgs/antd5/skinny/
|
|
1751
|
-
importName: "
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
function plasmicRulesToAntdRules(plasmicRules, label) {
|
|
1755
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1756
|
-
const effectiveLabel = label || "This field";
|
|
1757
|
-
const rules = [];
|
|
1758
|
-
for (const plasmicRule of plasmicRules) {
|
|
1759
|
-
switch (plasmicRule.ruleType) {
|
|
1760
|
-
case "enum":
|
|
1761
|
-
rules.push({
|
|
1762
|
-
type: "enum",
|
|
1763
|
-
enum: (_b = (_a = plasmicRule.options) == null ? void 0 : _a.map((opt) => opt.value)) != null ? _b : [],
|
|
1764
|
-
message: (_c = plasmicRule.message) != null ? _c : `${effectiveLabel} must be a valid value`
|
|
1765
|
-
});
|
|
1766
|
-
break;
|
|
1767
|
-
case "required":
|
|
1768
|
-
rules.push({
|
|
1769
|
-
required: true,
|
|
1770
|
-
message: (_d = plasmicRule.message) != null ? _d : `${effectiveLabel} is required`
|
|
1771
|
-
});
|
|
1772
|
-
break;
|
|
1773
|
-
case "regex":
|
|
1774
|
-
rules.push({
|
|
1775
|
-
pattern: new RegExp((_e = plasmicRule.pattern) != null ? _e : ""),
|
|
1776
|
-
message: (_f = plasmicRule.message) != null ? _f : `${effectiveLabel} must be a valid value`
|
|
1777
|
-
});
|
|
1778
|
-
break;
|
|
1779
|
-
case "whitespace":
|
|
1780
|
-
rules.push({
|
|
1781
|
-
whitespace: true,
|
|
1782
|
-
message: (_g = plasmicRule.message) != null ? _g : `${effectiveLabel} is required`
|
|
1783
|
-
});
|
|
1784
|
-
break;
|
|
1785
|
-
case "min":
|
|
1786
|
-
rules.push({
|
|
1787
|
-
[plasmicRule.ruleType]: plasmicRule.length,
|
|
1788
|
-
message: (_h = plasmicRule.message) != null ? _h : `${effectiveLabel} must be at least ${plasmicRule.length} characters`
|
|
1789
|
-
});
|
|
1790
|
-
break;
|
|
1791
|
-
case "max":
|
|
1792
|
-
rules.push({
|
|
1793
|
-
[plasmicRule.ruleType]: plasmicRule.length,
|
|
1794
|
-
message: (_i = plasmicRule.message) != null ? _i : `${effectiveLabel} must be at most ${plasmicRule.length} characters`
|
|
1795
|
-
});
|
|
1796
|
-
break;
|
|
1797
|
-
case "advanced":
|
|
1798
|
-
rules.push({
|
|
1799
|
-
validator: (...args) => {
|
|
1800
|
-
var _a2;
|
|
1801
|
-
return ((_a2 = plasmicRule.custom) == null ? void 0 : _a2.apply(null, args)) ? Promise.resolve() : Promise.reject();
|
|
1802
|
-
},
|
|
1803
|
-
message: plasmicRule.message
|
|
1804
|
-
});
|
|
1899
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerRadio",
|
|
1900
|
+
importName: "AntdRadioGroup",
|
|
1901
|
+
defaultStyles: {
|
|
1902
|
+
layout: "hbox"
|
|
1805
1903
|
}
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1904
|
+
}, {
|
|
1905
|
+
trapsSelection: true
|
|
1906
|
+
}));
|
|
1808
1907
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1908
|
+
|
|
1909
|
+
var __defProp$5 = Object.defineProperty;
|
|
1910
|
+
var __defProps$3 = Object.defineProperties;
|
|
1911
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
1912
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1913
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1914
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1915
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1916
|
+
var __spreadValues$5 = (a, b) => {
|
|
1917
|
+
for (var prop in b || (b = {}))
|
|
1918
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
1919
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1920
|
+
if (__getOwnPropSymbols$5)
|
|
1921
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1922
|
+
if (__propIsEnum$5.call(b, prop))
|
|
1923
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
1924
|
+
}
|
|
1925
|
+
return a;
|
|
1812
1926
|
};
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1927
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
1928
|
+
var __objRest$4 = (source, exclude) => {
|
|
1929
|
+
var target = {};
|
|
1930
|
+
for (var prop in source)
|
|
1931
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
1932
|
+
target[prop] = source[prop];
|
|
1933
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
1934
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
1935
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
1936
|
+
target[prop] = source[prop];
|
|
1937
|
+
}
|
|
1938
|
+
return target;
|
|
1816
1939
|
};
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
function FormItemWrapper(props) {
|
|
1821
|
-
var _b;
|
|
1940
|
+
const AntdOption = Select.Option;
|
|
1941
|
+
const AntdOptionGroup = Select.OptGroup;
|
|
1942
|
+
function AntdSelect(props) {
|
|
1822
1943
|
const _a = props, {
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
"
|
|
1833
|
-
"
|
|
1834
|
-
"
|
|
1835
|
-
"
|
|
1836
|
-
"hideValidationMessage",
|
|
1837
|
-
"customizeProps",
|
|
1838
|
-
"setControlContextData",
|
|
1839
|
-
"alignLabellessWithControls"
|
|
1944
|
+
popupClassName,
|
|
1945
|
+
popupScopeClassName,
|
|
1946
|
+
defaultStylesClassName,
|
|
1947
|
+
suffixIcon,
|
|
1948
|
+
mode,
|
|
1949
|
+
useChildren
|
|
1950
|
+
} = _a, rest = __objRest$4(_a, [
|
|
1951
|
+
"popupClassName",
|
|
1952
|
+
"popupScopeClassName",
|
|
1953
|
+
"defaultStylesClassName",
|
|
1954
|
+
"suffixIcon",
|
|
1955
|
+
"mode",
|
|
1956
|
+
"useChildren"
|
|
1840
1957
|
]);
|
|
1841
|
-
const
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
const rules = plasmicRules ? plasmicRulesToAntdRules(
|
|
1845
|
-
plasmicRules,
|
|
1846
|
-
typeof bestEffortLabel === "number" ? "" + bestEffortLabel : bestEffortLabel
|
|
1847
|
-
) : void 0;
|
|
1848
|
-
const layoutContext = React.useContext(FormLayoutContext);
|
|
1849
|
-
const inCanvas = !!usePlasmicCanvasContext();
|
|
1850
|
-
if (inCanvas) {
|
|
1851
|
-
const form = useFormInstanceMaybe();
|
|
1852
|
-
const prevPropValues = React.useRef({
|
|
1853
|
-
initialValue: props.initialValue,
|
|
1854
|
-
name: props.name
|
|
1855
|
-
});
|
|
1856
|
-
const internalFormCtx = React.useContext(InternalFormInstanceContext);
|
|
1857
|
-
const { fireOnValuesChange, forceRemount } = internalFormCtx != null ? internalFormCtx : {};
|
|
1858
|
-
(_b = props.setControlContextData) == null ? void 0 : _b.call(props, {
|
|
1859
|
-
internalFormCtx
|
|
1860
|
-
});
|
|
1861
|
-
React.useEffect(() => {
|
|
1862
|
-
if (prevPropValues.current.name !== props.name) {
|
|
1863
|
-
forceRemount == null ? void 0 : forceRemount();
|
|
1864
|
-
}
|
|
1865
|
-
if (!fullFormItemName || (form == null ? void 0 : form.getFieldValue(fullFormItemName)) !== prevPropValues.current.initialValue) {
|
|
1866
|
-
return;
|
|
1867
|
-
}
|
|
1868
|
-
form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
|
|
1869
|
-
prevPropValues.current.initialValue = props.initialValue;
|
|
1870
|
-
fireOnValuesChange == null ? void 0 : fireOnValuesChange();
|
|
1871
|
-
}, [form, props.initialValue, fullFormItemName]);
|
|
1958
|
+
const curated = __spreadValues$5({}, rest);
|
|
1959
|
+
if (useChildren) {
|
|
1960
|
+
curated.options = void 0;
|
|
1872
1961
|
}
|
|
1873
1962
|
return /* @__PURE__ */ React.createElement(
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
extra: description,
|
|
1880
|
-
help: hideValidationMessage ? "" : props.help,
|
|
1881
|
-
colon: noLabel ? false : void 0,
|
|
1882
|
-
wrapperCol: (layoutContext == null ? void 0 : layoutContext.layout) === "horizontal" && noLabel && alignLabellessWithControls && layoutContext.labelSpan ? { offset: layoutContext.labelSpan } : void 0
|
|
1883
|
-
}),
|
|
1884
|
-
props.customizeProps ? /* @__PURE__ */ React.createElement(FormItemForwarder, { formItemProps: props }) : props.children
|
|
1963
|
+
Select,
|
|
1964
|
+
__spreadValues$5(__spreadProps$3(__spreadValues$5({}, curated), {
|
|
1965
|
+
mode: !mode || mode === "single" ? void 0 : mode,
|
|
1966
|
+
popupClassName: `${defaultStylesClassName} ${popupScopeClassName} ${popupClassName}`
|
|
1967
|
+
}), suffixIcon && { suffixIcon })
|
|
1885
1968
|
);
|
|
1886
1969
|
}
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
};
|
|
1895
|
-
(_a2 = props.setControlContextData) == null ? void 0 : _a2.call(props, {
|
|
1896
|
-
internalFormCtx,
|
|
1897
|
-
status
|
|
1898
|
-
});
|
|
1899
|
-
return React.Children.map(formItemProps.children, (child, i) => {
|
|
1900
|
-
var _a3;
|
|
1901
|
-
const baseProps = __spreadValues$6(__spreadValues$6({}, (_a3 = child.props) != null ? _a3 : {}), props);
|
|
1902
|
-
return i === 0 && isValidElement(child) ? cloneElement(
|
|
1903
|
-
child,
|
|
1904
|
-
mergeProps(baseProps, formItemProps.customizeProps(data, baseProps))
|
|
1905
|
-
) : child;
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
function registerFormItem(loader) {
|
|
1909
|
-
registerComponentHelper(loader, FormItemWrapper, __spreadValues$6({
|
|
1910
|
-
name: "plasmic-antd5-form-item",
|
|
1911
|
-
displayName: "Form Item",
|
|
1912
|
-
parentComponentName: "plasmic-antd5-form",
|
|
1913
|
-
defaultStyles: {
|
|
1914
|
-
marginBottom: "24px",
|
|
1915
|
-
width: "stretch"
|
|
1916
|
-
},
|
|
1970
|
+
const selectComponentName = "plasmic-antd5-select";
|
|
1971
|
+
const optionComponentName = "plasmic-antd5-option";
|
|
1972
|
+
const optionGroupComponentName = "plasmic-antd5-option-group";
|
|
1973
|
+
function registerSelect(loader) {
|
|
1974
|
+
registerComponentHelper(loader, AntdSelect, __spreadProps$3(__spreadValues$5({
|
|
1975
|
+
name: selectComponentName,
|
|
1976
|
+
displayName: "Select",
|
|
1917
1977
|
props: {
|
|
1918
|
-
|
|
1919
|
-
type: "
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1978
|
+
options: {
|
|
1979
|
+
type: "array",
|
|
1980
|
+
hidden: (ps) => !!ps.useChildren,
|
|
1981
|
+
itemType: {
|
|
1982
|
+
type: "object",
|
|
1983
|
+
nameFunc: (item) => item.label || item.value,
|
|
1984
|
+
fields: {
|
|
1985
|
+
type: {
|
|
1986
|
+
type: "choice",
|
|
1987
|
+
options: [
|
|
1988
|
+
{ value: "option", label: "Option" },
|
|
1989
|
+
{ value: "option-group", label: "Option Group" }
|
|
1990
|
+
],
|
|
1991
|
+
defaultValue: "option"
|
|
1992
|
+
},
|
|
1993
|
+
value: {
|
|
1994
|
+
type: "string",
|
|
1995
|
+
hidden: (ps) => ps.type !== "option"
|
|
1996
|
+
},
|
|
1997
|
+
label: "string",
|
|
1998
|
+
options: {
|
|
1999
|
+
type: "array",
|
|
2000
|
+
hidden: (ps) => {
|
|
2001
|
+
return ps.type !== "option-group";
|
|
2002
|
+
},
|
|
2003
|
+
itemType: {
|
|
2004
|
+
type: "object",
|
|
2005
|
+
nameFunc: (item) => item.label || item.value,
|
|
2006
|
+
fields: {
|
|
2007
|
+
value: "string",
|
|
2008
|
+
label: "string"
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
1923
2013
|
},
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
type: "string"
|
|
2014
|
+
defaultValue: [
|
|
2015
|
+
{
|
|
2016
|
+
value: "option1",
|
|
2017
|
+
label: "Option 1"
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
value: "option2",
|
|
2021
|
+
label: "Option 2"
|
|
2022
|
+
}
|
|
2023
|
+
]
|
|
1935
2024
|
},
|
|
1936
|
-
|
|
1937
|
-
|
|
2025
|
+
useChildren: {
|
|
2026
|
+
displayName: "Use slot",
|
|
2027
|
+
type: "boolean",
|
|
2028
|
+
defaultValueHint: false,
|
|
2029
|
+
advanced: true,
|
|
2030
|
+
description: "Instead of configuring a list of options, customize the contents of the Select by dragging and dropping options in the outline/canvas, inside the 'children' slot. Lets you use any content or formatting within the Options, and also use Option Groups."
|
|
1938
2031
|
},
|
|
1939
|
-
|
|
1940
|
-
type: "
|
|
2032
|
+
children: {
|
|
2033
|
+
type: "slot",
|
|
2034
|
+
allowedComponents: [
|
|
2035
|
+
optionComponentName,
|
|
2036
|
+
optionGroupComponentName
|
|
2037
|
+
],
|
|
2038
|
+
hidden: (ps) => !ps.useChildren
|
|
1941
2039
|
},
|
|
1942
|
-
|
|
1943
|
-
type: "
|
|
1944
|
-
|
|
1945
|
-
defaultValueHint: "value",
|
|
1946
|
-
description: "The prop name for specifying the value of the form control component"
|
|
2040
|
+
placeholder: {
|
|
2041
|
+
type: "slot",
|
|
2042
|
+
defaultValue: "Select..."
|
|
1947
2043
|
},
|
|
1948
|
-
|
|
1949
|
-
type: "
|
|
1950
|
-
|
|
2044
|
+
suffixIcon: {
|
|
2045
|
+
type: "slot",
|
|
2046
|
+
hidePlaceholder: true
|
|
1951
2047
|
},
|
|
1952
|
-
|
|
2048
|
+
open: {
|
|
1953
2049
|
type: "boolean",
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2050
|
+
editOnly: true,
|
|
2051
|
+
uncontrolledProp: "defaultOpen"
|
|
2052
|
+
},
|
|
2053
|
+
value: {
|
|
2054
|
+
type: "choice",
|
|
2055
|
+
displayName: "Selected value",
|
|
2056
|
+
editOnly: true,
|
|
2057
|
+
uncontrolledProp: "defaultValue",
|
|
2058
|
+
description: "Initial selected option",
|
|
2059
|
+
multiSelect: (ps) => ps.mode === "multiple",
|
|
2060
|
+
options: (ps) => {
|
|
1957
2061
|
var _a;
|
|
1958
|
-
|
|
2062
|
+
const options = /* @__PURE__ */ new Set();
|
|
2063
|
+
if (!ps.useChildren) {
|
|
2064
|
+
const rec = (op) => {
|
|
2065
|
+
var _a2;
|
|
2066
|
+
if (typeof op === "string") {
|
|
2067
|
+
return [{ value: op, label: op }];
|
|
2068
|
+
} else if ("options" in op) {
|
|
2069
|
+
return ((_a2 = op.options) != null ? _a2 : []).flatMap((sub) => rec(sub));
|
|
2070
|
+
} else {
|
|
2071
|
+
return [{ value: op.value, label: op.label || op.value }];
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
return ((_a = ps.options) != null ? _a : []).flatMap((o) => rec(o));
|
|
2075
|
+
} else {
|
|
2076
|
+
traverseReactEltTree(ps.children, (elt) => {
|
|
2077
|
+
var _a2;
|
|
2078
|
+
if ((elt == null ? void 0 : elt.type) === Select.Option && typeof ((_a2 = elt == null ? void 0 : elt.props) == null ? void 0 : _a2.value) === "string") {
|
|
2079
|
+
options.add(elt.props.value);
|
|
2080
|
+
}
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
return Array.from(options.keys());
|
|
1959
2084
|
},
|
|
1960
|
-
|
|
2085
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
1961
2086
|
},
|
|
1962
|
-
|
|
1963
|
-
type: "
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
hidden: () => true
|
|
2087
|
+
mode: {
|
|
2088
|
+
type: "choice",
|
|
2089
|
+
options: ["single", "multiple"],
|
|
2090
|
+
defaultValueHint: "single"
|
|
1967
2091
|
},
|
|
1968
|
-
|
|
2092
|
+
size: {
|
|
1969
2093
|
type: "choice",
|
|
1970
|
-
options: ["
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
}
|
|
2094
|
+
options: ["small", "middle", "large"]
|
|
2095
|
+
},
|
|
2096
|
+
disabled: {
|
|
2097
|
+
type: "boolean",
|
|
2098
|
+
defaultValueHint: false
|
|
1976
2099
|
},
|
|
1977
|
-
|
|
2100
|
+
showSearch: {
|
|
1978
2101
|
type: "boolean",
|
|
2102
|
+
defaultValueHint: false,
|
|
1979
2103
|
advanced: true
|
|
1980
2104
|
},
|
|
1981
|
-
|
|
2105
|
+
status: {
|
|
1982
2106
|
type: "choice",
|
|
1983
|
-
options: ["
|
|
1984
|
-
multiSelect: true,
|
|
2107
|
+
options: ["error", "warning"],
|
|
1985
2108
|
advanced: true
|
|
1986
2109
|
},
|
|
1987
|
-
|
|
2110
|
+
bordered: {
|
|
1988
2111
|
type: "boolean",
|
|
1989
|
-
|
|
1990
|
-
displayName: "Always re-render",
|
|
1991
|
-
description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
|
|
1992
|
-
},
|
|
1993
|
-
dependencies: {
|
|
1994
|
-
type: "array",
|
|
1995
|
-
advanced: true,
|
|
1996
|
-
displayName: "Dependencies",
|
|
1997
|
-
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
2112
|
+
defaultValueHint: true
|
|
1998
2113
|
},
|
|
1999
|
-
|
|
2114
|
+
autoFocus: {
|
|
2000
2115
|
type: "boolean",
|
|
2001
|
-
displayName: "
|
|
2002
|
-
description: "If true, will hide the validation error message",
|
|
2116
|
+
displayName: "Focus automatically",
|
|
2003
2117
|
defaultValueHint: false,
|
|
2004
2118
|
advanced: true
|
|
2005
2119
|
},
|
|
2006
|
-
|
|
2007
|
-
type: "
|
|
2008
|
-
|
|
2120
|
+
onChange: {
|
|
2121
|
+
type: "eventHandler",
|
|
2122
|
+
argTypes: [
|
|
2123
|
+
{ name: "value", type: "string" },
|
|
2124
|
+
{ name: "option", type: "object" }
|
|
2125
|
+
]
|
|
2126
|
+
},
|
|
2127
|
+
dropdownMatchSelectWidth: {
|
|
2128
|
+
type: "boolean",
|
|
2129
|
+
displayName: "Should dropdown match trigger button width?",
|
|
2130
|
+
defaultValueHint: true,
|
|
2131
|
+
advanced: true
|
|
2132
|
+
},
|
|
2133
|
+
triggerClassName: {
|
|
2134
|
+
type: "class",
|
|
2135
|
+
displayName: "Trigger styles",
|
|
2136
|
+
noSelf: true,
|
|
2137
|
+
selectors: [
|
|
2138
|
+
{
|
|
2139
|
+
selector: ":component .ant-select-selector.ant-select-selector",
|
|
2140
|
+
label: "Base"
|
|
2141
|
+
},
|
|
2142
|
+
{
|
|
2143
|
+
selector: ":component .ant-select-selector:hover",
|
|
2144
|
+
label: "Hovered"
|
|
2145
|
+
}
|
|
2146
|
+
],
|
|
2147
|
+
advanced: true
|
|
2148
|
+
},
|
|
2149
|
+
popupScopeClassName: {
|
|
2150
|
+
type: "styleScopeClass",
|
|
2151
|
+
scopeName: "popup"
|
|
2009
2152
|
},
|
|
2010
|
-
|
|
2011
|
-
type: "
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
argValues: (_ps, ctx) => {
|
|
2015
|
-
var _a;
|
|
2016
|
-
return [
|
|
2017
|
-
{
|
|
2018
|
-
status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
|
|
2019
|
-
}
|
|
2020
|
-
];
|
|
2021
|
-
},
|
|
2153
|
+
popupClassName: {
|
|
2154
|
+
type: "class",
|
|
2155
|
+
displayName: "Popup styles",
|
|
2156
|
+
selectors: [],
|
|
2022
2157
|
advanced: true
|
|
2023
2158
|
},
|
|
2024
|
-
|
|
2025
|
-
type: "
|
|
2026
|
-
displayName: "
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2159
|
+
optionClassName: {
|
|
2160
|
+
type: "class",
|
|
2161
|
+
displayName: "Option styles",
|
|
2162
|
+
noSelf: true,
|
|
2163
|
+
selectors: [
|
|
2164
|
+
{
|
|
2165
|
+
selector: ":popup.ant-select-dropdown .ant-select-item-option",
|
|
2166
|
+
label: "Base"
|
|
2167
|
+
},
|
|
2168
|
+
{
|
|
2169
|
+
selector: ":popup.ant-select-dropdown .ant-select-item-option-active",
|
|
2170
|
+
label: "Focused"
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
selector: ":popup.ant-select-dropdown .ant-select-item-option-selected",
|
|
2174
|
+
label: "Selected"
|
|
2039
2175
|
}
|
|
2040
|
-
|
|
2176
|
+
],
|
|
2177
|
+
advanced: true
|
|
2041
2178
|
},
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2179
|
+
placeholderClassName: {
|
|
2180
|
+
type: "class",
|
|
2181
|
+
displayName: "Placeholder styles",
|
|
2182
|
+
selectors: [
|
|
2183
|
+
{
|
|
2184
|
+
selector: ":component .ant-select-selector .ant-select-selection-placeholder",
|
|
2185
|
+
label: "Base"
|
|
2047
2186
|
}
|
|
2048
|
-
|
|
2187
|
+
],
|
|
2188
|
+
advanced: true
|
|
2049
2189
|
},
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2190
|
+
defaultStylesClassName: {
|
|
2191
|
+
type: "themeResetClass"
|
|
2192
|
+
}
|
|
2193
|
+
},
|
|
2194
|
+
states: {
|
|
2195
|
+
value: {
|
|
2196
|
+
type: "writable",
|
|
2197
|
+
valueProp: "value",
|
|
2198
|
+
onChangeProp: "onChange",
|
|
2199
|
+
variableType: "text"
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
}, { trapsSelection: true }), {
|
|
2203
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
2204
|
+
importName: "AntdSelect"
|
|
2205
|
+
}));
|
|
2206
|
+
registerComponentHelper(loader, AntdOption, {
|
|
2207
|
+
name: optionComponentName,
|
|
2208
|
+
displayName: "Option",
|
|
2209
|
+
parentComponentName: selectComponentName,
|
|
2210
|
+
props: {
|
|
2211
|
+
children: __spreadValues$5({
|
|
2212
|
+
type: "slot",
|
|
2213
|
+
defaultValue: "Option"
|
|
2214
|
+
}, { mergeWithParent: true }),
|
|
2215
|
+
value: {
|
|
2216
|
+
type: "string"
|
|
2217
|
+
}
|
|
2218
|
+
},
|
|
2219
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
2220
|
+
importName: "AntdOption"
|
|
2221
|
+
});
|
|
2222
|
+
registerComponentHelper(loader, AntdOptionGroup, {
|
|
2223
|
+
name: optionGroupComponentName,
|
|
2224
|
+
displayName: "Option Group",
|
|
2225
|
+
parentComponentName: selectComponentName,
|
|
2226
|
+
props: {
|
|
2227
|
+
children: {
|
|
2228
|
+
type: "slot",
|
|
2229
|
+
defaultValue: [
|
|
2230
|
+
{
|
|
2053
2231
|
type: "component",
|
|
2054
|
-
name: "plasmic-antd5-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2232
|
+
name: "plasmic-antd5-option",
|
|
2233
|
+
props: {
|
|
2234
|
+
value: "option1",
|
|
2235
|
+
children: {
|
|
2236
|
+
type: "text",
|
|
2237
|
+
value: "Option 1"
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
},
|
|
2241
|
+
{
|
|
2061
2242
|
type: "component",
|
|
2062
|
-
name: "plasmic-antd5-
|
|
2243
|
+
name: "plasmic-antd5-option",
|
|
2244
|
+
props: {
|
|
2245
|
+
value: "option2",
|
|
2246
|
+
children: {
|
|
2247
|
+
type: "text",
|
|
2248
|
+
value: "Option 1"
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2063
2251
|
}
|
|
2064
|
-
|
|
2252
|
+
]
|
|
2065
2253
|
},
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2254
|
+
label: {
|
|
2255
|
+
type: "slot",
|
|
2256
|
+
defaultValue: "Group label"
|
|
2257
|
+
}
|
|
2258
|
+
},
|
|
2259
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
2260
|
+
importName: "AntdOptionGroup"
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
var __defProp$4 = Object.defineProperty;
|
|
2265
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
2266
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
2267
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
2268
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2269
|
+
var __spreadValues$4 = (a, b) => {
|
|
2270
|
+
for (var prop in b || (b = {}))
|
|
2271
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
2272
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
2273
|
+
if (__getOwnPropSymbols$4)
|
|
2274
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
2275
|
+
if (__propIsEnum$4.call(b, prop))
|
|
2276
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
2277
|
+
}
|
|
2278
|
+
return a;
|
|
2279
|
+
};
|
|
2280
|
+
function AntdSwitch(props) {
|
|
2281
|
+
return /* @__PURE__ */ React.createElement(Switch, __spreadValues$4({}, props));
|
|
2282
|
+
}
|
|
2283
|
+
AntdSwitch.__plasmicFormFieldMeta = { valueProp: "checked" };
|
|
2284
|
+
const switchComponentName = "plasmic-antd5-switch";
|
|
2285
|
+
function registerSwitch(loader) {
|
|
2286
|
+
registerComponentHelper(loader, AntdSwitch, {
|
|
2287
|
+
name: switchComponentName,
|
|
2288
|
+
displayName: "Switch",
|
|
2289
|
+
props: {
|
|
2290
|
+
checked: {
|
|
2291
|
+
type: "boolean",
|
|
2292
|
+
editOnly: true,
|
|
2293
|
+
uncontrolledProp: "defaultChecked",
|
|
2294
|
+
description: "Whether the switch is toggled on",
|
|
2295
|
+
defaultValueHint: false,
|
|
2296
|
+
hidden: (ps) => !!ps.__plasmicFormField
|
|
2075
2297
|
},
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
name: "plasmic-antd5-radio-group"
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2298
|
+
disabled: {
|
|
2299
|
+
type: "boolean",
|
|
2300
|
+
description: "If switch is disabled",
|
|
2301
|
+
defaultValueHint: false
|
|
2083
2302
|
},
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
}
|
|
2090
|
-
}
|
|
2303
|
+
autoFocus: {
|
|
2304
|
+
type: "boolean",
|
|
2305
|
+
description: "If get focus when component mounted",
|
|
2306
|
+
defaultValueHint: false,
|
|
2307
|
+
advanced: true
|
|
2091
2308
|
},
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2309
|
+
onChange: {
|
|
2310
|
+
type: "eventHandler",
|
|
2311
|
+
argTypes: [{ name: "checked", type: "boolean" }]
|
|
2312
|
+
}
|
|
2313
|
+
},
|
|
2314
|
+
states: {
|
|
2315
|
+
checked: {
|
|
2316
|
+
type: "writable",
|
|
2317
|
+
valueProp: "checked",
|
|
2318
|
+
onChangeProp: "onChange",
|
|
2319
|
+
variableType: "boolean"
|
|
2320
|
+
}
|
|
2321
|
+
},
|
|
2322
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerSwitch",
|
|
2323
|
+
importName: "AntdSwitch"
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
var __defProp$3 = Object.defineProperty;
|
|
2328
|
+
var __defProps$2 = Object.defineProperties;
|
|
2329
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2330
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
2331
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
2332
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2333
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2334
|
+
var __spreadValues$3 = (a, b) => {
|
|
2335
|
+
for (var prop in b || (b = {}))
|
|
2336
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
2337
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
2338
|
+
if (__getOwnPropSymbols$3)
|
|
2339
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2340
|
+
if (__propIsEnum$3.call(b, prop))
|
|
2341
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
2342
|
+
}
|
|
2343
|
+
return a;
|
|
2344
|
+
};
|
|
2345
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2346
|
+
var __objRest$3 = (source, exclude) => {
|
|
2347
|
+
var target = {};
|
|
2348
|
+
for (var prop in source)
|
|
2349
|
+
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2350
|
+
target[prop] = source[prop];
|
|
2351
|
+
if (source != null && __getOwnPropSymbols$3)
|
|
2352
|
+
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
2353
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
2354
|
+
target[prop] = source[prop];
|
|
2355
|
+
}
|
|
2356
|
+
return target;
|
|
2357
|
+
};
|
|
2358
|
+
const reactNodeToString = function(reactNode) {
|
|
2359
|
+
let string = "";
|
|
2360
|
+
if (typeof reactNode === "string") {
|
|
2361
|
+
string = reactNode;
|
|
2362
|
+
} else if (typeof reactNode === "number") {
|
|
2363
|
+
string = reactNode.toString();
|
|
2364
|
+
} else if (reactNode instanceof Array) {
|
|
2365
|
+
reactNode.forEach(function(child) {
|
|
2366
|
+
string += reactNodeToString(child);
|
|
2367
|
+
});
|
|
2368
|
+
} else if (isValidElement(reactNode)) {
|
|
2369
|
+
string += reactNodeToString(reactNode.props.children);
|
|
2370
|
+
}
|
|
2371
|
+
return string;
|
|
2372
|
+
};
|
|
2373
|
+
function ensureArray(x) {
|
|
2374
|
+
return Array.isArray(x) ? x : [x];
|
|
2375
|
+
}
|
|
2376
|
+
const FormItem = Form.Item;
|
|
2377
|
+
const FormList = Form.List;
|
|
2378
|
+
var InputType = /* @__PURE__ */ ((InputType2) => {
|
|
2379
|
+
InputType2["Text"] = "Text";
|
|
2380
|
+
InputType2["TextArea"] = "Text Area";
|
|
2381
|
+
InputType2["Password"] = "Password";
|
|
2382
|
+
InputType2["Number"] = "Number";
|
|
2383
|
+
InputType2["Select"] = "Select";
|
|
2384
|
+
InputType2["Option"] = "Option";
|
|
2385
|
+
InputType2["OptionGroup"] = "Option Group";
|
|
2386
|
+
InputType2["Radio"] = "Radio";
|
|
2387
|
+
InputType2["RadioGroup"] = "Radio Group";
|
|
2388
|
+
InputType2["Checkbox"] = "Checkbox";
|
|
2389
|
+
return InputType2;
|
|
2390
|
+
})(InputType || {});
|
|
2391
|
+
const PathContext = React.createContext({ relativePath: [], fullPath: [] });
|
|
2392
|
+
const InternalFormInstanceContext = React.createContext(void 0);
|
|
2393
|
+
const FormLayoutContext = React.createContext(void 0);
|
|
2394
|
+
const Internal = (props) => {
|
|
2395
|
+
var _b, _c, _d, _e;
|
|
2396
|
+
const [form] = Form.useForm();
|
|
2397
|
+
const values = form.getFieldsValue(true);
|
|
2398
|
+
const lastValue = React.useRef(values);
|
|
2399
|
+
const _a = props, { extendedOnValuesChange, setRemountKey } = _a, rest = __objRest$3(_a, ["extendedOnValuesChange", "setRemountKey"]);
|
|
2400
|
+
let childrenNode;
|
|
2401
|
+
if (props.mode !== "simplified") {
|
|
2402
|
+
childrenNode = typeof props.children === "function" ? props.children(values, form) : props.children;
|
|
2403
|
+
} else {
|
|
2404
|
+
childrenNode = /* @__PURE__ */ React.createElement(React.Fragment, null, ((_b = props.formItems) != null ? _b : []).map((formItem) => /* @__PURE__ */ React.createElement(
|
|
2405
|
+
FormItemWrapper,
|
|
2406
|
+
__spreadProps$2(__spreadValues$3({}, formItem), {
|
|
2407
|
+
noLabel: formItem.inputType === "Checkbox" /* Checkbox */ || formItem.noLabel,
|
|
2408
|
+
style: { width: "100%" }
|
|
2409
|
+
}),
|
|
2410
|
+
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(
|
|
2411
|
+
Radio.Group,
|
|
2412
|
+
{
|
|
2413
|
+
options: formItem.options,
|
|
2414
|
+
optionType: formItem.optionType
|
|
2102
2415
|
}
|
|
2103
|
-
|
|
2416
|
+
) : null
|
|
2417
|
+
)), props.submitSlot);
|
|
2418
|
+
}
|
|
2419
|
+
const fireOnValuesChange = React.useCallback(() => {
|
|
2420
|
+
const values2 = form.getFieldsValue(true);
|
|
2421
|
+
if (!equal(values2, lastValue.current)) {
|
|
2422
|
+
extendedOnValuesChange == null ? void 0 : extendedOnValuesChange(values2);
|
|
2423
|
+
lastValue.current = values2;
|
|
2104
2424
|
}
|
|
2105
|
-
},
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2425
|
+
}, [form, lastValue]);
|
|
2426
|
+
React.useEffect(() => {
|
|
2427
|
+
fireOnValuesChange();
|
|
2428
|
+
}, []);
|
|
2429
|
+
const formLayout = React.useMemo(
|
|
2430
|
+
() => {
|
|
2431
|
+
var _a2;
|
|
2432
|
+
return {
|
|
2433
|
+
layout: props.layout,
|
|
2434
|
+
labelSpan: (_a2 = props.labelCol) == null ? void 0 : _a2.span
|
|
2435
|
+
};
|
|
2436
|
+
},
|
|
2437
|
+
[props.layout, (_c = props.labelCol) == null ? void 0 : _c.span]
|
|
2438
|
+
);
|
|
2109
2439
|
return /* @__PURE__ */ React.createElement(
|
|
2110
|
-
|
|
2440
|
+
InternalFormInstanceContext.Provider,
|
|
2111
2441
|
{
|
|
2112
2442
|
value: {
|
|
2113
|
-
|
|
2114
|
-
|
|
2443
|
+
layout: formLayout,
|
|
2444
|
+
fireOnValuesChange,
|
|
2445
|
+
forceRemount: () => setRemountKey((k) => k + 1)
|
|
2115
2446
|
}
|
|
2116
2447
|
},
|
|
2117
|
-
|
|
2448
|
+
/* @__PURE__ */ React.createElement(FormLayoutContext.Provider, { value: formLayout }, /* @__PURE__ */ React.createElement(
|
|
2449
|
+
Form,
|
|
2450
|
+
__spreadProps$2(__spreadValues$3({}, rest), {
|
|
2451
|
+
key: props.initialValues ? JSON.stringify(props.initialValues) : void 0,
|
|
2452
|
+
onValuesChange: (...args) => {
|
|
2453
|
+
var _a2;
|
|
2454
|
+
(_a2 = props.onValuesChange) == null ? void 0 : _a2.call(props, ...args);
|
|
2455
|
+
extendedOnValuesChange == null ? void 0 : extendedOnValuesChange(args[1]);
|
|
2456
|
+
},
|
|
2457
|
+
form,
|
|
2458
|
+
labelCol: ((_d = props.labelCol) == null ? void 0 : _d.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
|
|
2459
|
+
wrapperCol: ((_e = props.wrapperCol) == null ? void 0 : _e.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
|
|
2460
|
+
}),
|
|
2461
|
+
/* @__PURE__ */ React.createElement("style", null, `
|
|
2462
|
+
.ant-form-item-explain + div, .ant-form-item-margin-offset {
|
|
2463
|
+
display: none;
|
|
2464
|
+
}
|
|
2465
|
+
`),
|
|
2466
|
+
childrenNode
|
|
2467
|
+
))
|
|
2118
2468
|
);
|
|
2469
|
+
};
|
|
2470
|
+
function FormWrapper(props) {
|
|
2471
|
+
const [remountKey, setRemountKey] = React.useState(0);
|
|
2472
|
+
const previousInitialValues = usePrevious(props.initialValues);
|
|
2473
|
+
React.useEffect(() => {
|
|
2474
|
+
if (previousInitialValues !== props.initialValues && JSON.stringify(previousInitialValues) !== JSON.stringify(props.initialValues)) {
|
|
2475
|
+
setRemountKey((k) => k + 1);
|
|
2476
|
+
}
|
|
2477
|
+
}, [previousInitialValues, props.initialValues]);
|
|
2478
|
+
return /* @__PURE__ */ React.createElement(Internal, __spreadProps$2(__spreadValues$3({ key: remountKey }, props), { setRemountKey }));
|
|
2119
2479
|
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
}
|
|
2480
|
+
const COMMON_ACTIONS = [
|
|
2481
|
+
{
|
|
2482
|
+
type: "button-action",
|
|
2483
|
+
label: "Append new Form Field",
|
|
2484
|
+
onClick: ({ studioOps }) => {
|
|
2485
|
+
studioOps.appendToSlot(
|
|
2486
|
+
{
|
|
2487
|
+
type: "component",
|
|
2488
|
+
name: "plasmic-antd5-form-item"
|
|
2489
|
+
},
|
|
2490
|
+
"children"
|
|
2491
|
+
);
|
|
2133
2492
|
},
|
|
2134
|
-
|
|
2135
|
-
importName: "FormGroup"
|
|
2136
|
-
});
|
|
2137
|
-
}
|
|
2138
|
-
const FormListWrapper = React.forwardRef(function FormListWrapper2(props, ref) {
|
|
2139
|
-
var _a;
|
|
2140
|
-
const relativeFormItemName = useFormItemRelativeName(props.name);
|
|
2141
|
-
const fullFormItemName = useFormItemFullName(props.name);
|
|
2142
|
-
const operationsRef = React.useRef(
|
|
2143
|
-
void 0
|
|
2144
|
-
);
|
|
2145
|
-
React.useImperativeHandle(
|
|
2146
|
-
ref,
|
|
2147
|
-
() => ({
|
|
2148
|
-
add(defaultValue, insertIndex) {
|
|
2149
|
-
if (operationsRef.current) {
|
|
2150
|
-
const { add } = operationsRef.current[1];
|
|
2151
|
-
add(defaultValue, insertIndex);
|
|
2152
|
-
}
|
|
2153
|
-
},
|
|
2154
|
-
remove(index) {
|
|
2155
|
-
if (operationsRef.current) {
|
|
2156
|
-
const { remove } = operationsRef.current[1];
|
|
2157
|
-
remove(index);
|
|
2158
|
-
}
|
|
2159
|
-
},
|
|
2160
|
-
move(from, to) {
|
|
2161
|
-
if (operationsRef.current) {
|
|
2162
|
-
const { move } = operationsRef.current[1];
|
|
2163
|
-
move(from, to);
|
|
2164
|
-
}
|
|
2165
|
-
}
|
|
2166
|
-
}),
|
|
2167
|
-
[operationsRef]
|
|
2168
|
-
);
|
|
2169
|
-
const inCanvas = !!usePlasmicCanvasContext();
|
|
2170
|
-
if (inCanvas) {
|
|
2171
|
-
const form = useFormInstanceMaybe();
|
|
2172
|
-
const prevPropValues = React.useRef({
|
|
2173
|
-
initialValue: props.initialValue,
|
|
2174
|
-
name: props.name
|
|
2175
|
-
});
|
|
2176
|
-
const { fireOnValuesChange, forceRemount } = (_a = React.useContext(InternalFormInstanceContext)) != null ? _a : {};
|
|
2177
|
-
React.useEffect(() => {
|
|
2178
|
-
if (prevPropValues.current.name !== props.name) {
|
|
2179
|
-
forceRemount == null ? void 0 : forceRemount();
|
|
2180
|
-
}
|
|
2181
|
-
if (fullFormItemName) {
|
|
2182
|
-
form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
|
|
2183
|
-
prevPropValues.current.initialValue = props.initialValue;
|
|
2184
|
-
fireOnValuesChange == null ? void 0 : fireOnValuesChange();
|
|
2185
|
-
}
|
|
2186
|
-
}, [props.initialValue, fullFormItemName]);
|
|
2493
|
+
hidden: (props) => props.mode !== "advanced"
|
|
2187
2494
|
}
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
}
|
|
2495
|
+
// {
|
|
2496
|
+
// type: "button-action" as const,
|
|
2497
|
+
// label: "Append new Form Field Group",
|
|
2498
|
+
// onClick: ({ studioOps }: ActionProps<any>) => {
|
|
2499
|
+
// studioOps.appendToSlot(
|
|
2500
|
+
// {
|
|
2501
|
+
// type: "component",
|
|
2502
|
+
// name: "plasmic-antd5-form-group",
|
|
2503
|
+
// },
|
|
2504
|
+
// "children"
|
|
2505
|
+
// );
|
|
2506
|
+
// },
|
|
2507
|
+
// },
|
|
2508
|
+
// {
|
|
2509
|
+
// type: "button-action" as const,
|
|
2510
|
+
// label: "Append new Form List",
|
|
2511
|
+
// onClick: ({ studioOps }: ActionProps<any>) => {
|
|
2512
|
+
// studioOps.appendToSlot(
|
|
2513
|
+
// {
|
|
2514
|
+
// type: "component",
|
|
2515
|
+
// name: "plasmic-antd5-form-list",
|
|
2516
|
+
// },
|
|
2517
|
+
// "children"
|
|
2518
|
+
// );
|
|
2519
|
+
// },
|
|
2520
|
+
// },
|
|
2521
|
+
];
|
|
2522
|
+
const colProp = (displayName, defaultValue, description) => ({
|
|
2523
|
+
type: "object",
|
|
2524
|
+
displayName,
|
|
2525
|
+
advanced: true,
|
|
2526
|
+
fields: {
|
|
2527
|
+
span: {
|
|
2528
|
+
type: "number",
|
|
2529
|
+
displayName: "Width",
|
|
2530
|
+
description: "The number of grid columns to span in width (out of 24 columns total)",
|
|
2531
|
+
min: 1,
|
|
2532
|
+
max: 24
|
|
2533
|
+
},
|
|
2534
|
+
offset: {
|
|
2535
|
+
type: "number",
|
|
2536
|
+
displayName: "Offset",
|
|
2537
|
+
description: "Number of grid columns to skip from the left (out of 24 columns total)",
|
|
2538
|
+
min: 0,
|
|
2539
|
+
max: 23
|
|
2540
|
+
},
|
|
2541
|
+
horizontalOnly: {
|
|
2542
|
+
type: "boolean",
|
|
2543
|
+
displayName: "Horizontal only",
|
|
2544
|
+
description: "Only apply to horizontal layout"
|
|
2545
|
+
}
|
|
2546
|
+
},
|
|
2547
|
+
description,
|
|
2548
|
+
defaultValue
|
|
2201
2549
|
});
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
displayName: "Form
|
|
2207
|
-
|
|
2550
|
+
const formComponentName = "plasmic-antd5-form";
|
|
2551
|
+
function registerForm(loader) {
|
|
2552
|
+
registerComponentHelper(loader, FormWrapper, {
|
|
2553
|
+
name: formComponentName,
|
|
2554
|
+
displayName: "Form",
|
|
2555
|
+
defaultStyles: {
|
|
2556
|
+
layout: "vbox",
|
|
2557
|
+
alignItems: "flex-start"
|
|
2558
|
+
},
|
|
2208
2559
|
props: {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
props: {
|
|
2234
|
-
name: "lastName",
|
|
2235
|
-
label: {
|
|
2236
|
-
type: "text",
|
|
2237
|
-
value: "Last name"
|
|
2560
|
+
mode: "controlMode",
|
|
2561
|
+
formItems: {
|
|
2562
|
+
type: "array",
|
|
2563
|
+
itemType: {
|
|
2564
|
+
type: "object",
|
|
2565
|
+
fields: __spreadValues$3({
|
|
2566
|
+
label: "string",
|
|
2567
|
+
inputType: {
|
|
2568
|
+
type: "choice",
|
|
2569
|
+
options: Object.values(InputType),
|
|
2570
|
+
defaultValue: "Text" /* Text */
|
|
2571
|
+
},
|
|
2572
|
+
options: {
|
|
2573
|
+
type: "array",
|
|
2574
|
+
itemType: {
|
|
2575
|
+
type: "object",
|
|
2576
|
+
fields: {
|
|
2577
|
+
type: {
|
|
2578
|
+
type: "choice",
|
|
2579
|
+
options: [
|
|
2580
|
+
{ value: "option", label: "Option" },
|
|
2581
|
+
{ value: "option-group", label: "Option Group" }
|
|
2582
|
+
],
|
|
2583
|
+
defaultValue: "option"
|
|
2238
2584
|
},
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2585
|
+
label: "string",
|
|
2586
|
+
value: {
|
|
2587
|
+
type: "string",
|
|
2588
|
+
hidden: (ps) => ps.type !== "option-group"
|
|
2589
|
+
},
|
|
2590
|
+
options: {
|
|
2591
|
+
type: "array",
|
|
2592
|
+
itemType: {
|
|
2593
|
+
type: "object",
|
|
2594
|
+
nameFunc: (item) => item.label || item.value,
|
|
2595
|
+
fields: {
|
|
2596
|
+
value: "string",
|
|
2597
|
+
label: "string"
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2242
2600
|
}
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2601
|
+
},
|
|
2602
|
+
nameFunc: (item) => item == null ? void 0 : item.label
|
|
2603
|
+
},
|
|
2604
|
+
hidden: (ps) => !["Select" /* Select */, "Radio" /* Radio */].includes(ps.inputType)
|
|
2605
|
+
},
|
|
2606
|
+
optionType: {
|
|
2607
|
+
type: "choice",
|
|
2608
|
+
options: [
|
|
2609
|
+
{ value: "default", label: "Radio" },
|
|
2610
|
+
{ value: "button", label: "Button" }
|
|
2611
|
+
],
|
|
2612
|
+
hidden: (ps) => "Radio" /* Radio */ !== ps.inputType,
|
|
2613
|
+
defaultValueHint: "Radio",
|
|
2614
|
+
displayName: "Option Type"
|
|
2615
|
+
}
|
|
2616
|
+
}, commonFormItemProps),
|
|
2617
|
+
nameFunc: (item) => item.label
|
|
2618
|
+
},
|
|
2619
|
+
hidden: (props) => props.mode === "advanced"
|
|
2252
2620
|
},
|
|
2253
|
-
|
|
2254
|
-
type: "
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2621
|
+
submitSlot: __spreadValues$3({
|
|
2622
|
+
type: "slot",
|
|
2623
|
+
hidden: () => true,
|
|
2624
|
+
defaultValue: {
|
|
2625
|
+
type: "component",
|
|
2626
|
+
name: buttonComponentName,
|
|
2627
|
+
props: {
|
|
2628
|
+
type: "primary",
|
|
2629
|
+
submitsForm: true,
|
|
2630
|
+
children: {
|
|
2631
|
+
type: "text",
|
|
2632
|
+
value: "Submit"
|
|
2633
|
+
}
|
|
2263
2634
|
}
|
|
2264
|
-
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2635
|
+
}
|
|
2636
|
+
}, {
|
|
2637
|
+
mergeWithParent: () => true,
|
|
2638
|
+
hiddenMergedProps: (ps) => !ps.mode
|
|
2639
|
+
}),
|
|
2640
|
+
children: {
|
|
2641
|
+
type: "slot",
|
|
2642
|
+
defaultValue: [
|
|
2271
2643
|
{
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2644
|
+
type: "component",
|
|
2645
|
+
name: formItemComponentName,
|
|
2646
|
+
props: {
|
|
2647
|
+
label: {
|
|
2648
|
+
type: "text",
|
|
2649
|
+
value: "Name"
|
|
2650
|
+
},
|
|
2651
|
+
name: "name",
|
|
2652
|
+
children: {
|
|
2653
|
+
type: "component",
|
|
2654
|
+
name: inputComponentName
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2275
2657
|
},
|
|
2276
2658
|
{
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
}
|
|
2291
|
-
]
|
|
2292
|
-
},
|
|
2293
|
-
move: {
|
|
2294
|
-
displayName: "Move field",
|
|
2295
|
-
argTypes: [
|
|
2296
|
-
{
|
|
2297
|
-
name: "from",
|
|
2298
|
-
displayName: "From",
|
|
2299
|
-
type: "number"
|
|
2659
|
+
type: "component",
|
|
2660
|
+
name: formItemComponentName,
|
|
2661
|
+
props: {
|
|
2662
|
+
label: {
|
|
2663
|
+
type: "text",
|
|
2664
|
+
value: "Message"
|
|
2665
|
+
},
|
|
2666
|
+
name: "message",
|
|
2667
|
+
children: {
|
|
2668
|
+
type: "component",
|
|
2669
|
+
name: textAreaComponentName
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2300
2672
|
},
|
|
2301
2673
|
{
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2674
|
+
type: "component",
|
|
2675
|
+
name: buttonComponentName,
|
|
2676
|
+
props: {
|
|
2677
|
+
children: {
|
|
2678
|
+
type: "text",
|
|
2679
|
+
value: "Submit"
|
|
2680
|
+
},
|
|
2681
|
+
type: "primary",
|
|
2682
|
+
submitsForm: true
|
|
2683
|
+
}
|
|
2305
2684
|
}
|
|
2306
|
-
]
|
|
2307
|
-
}
|
|
2308
|
-
},
|
|
2309
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
2310
|
-
importName: "FormListWrapper"
|
|
2311
|
-
});
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
var __defProp$5 = Object.defineProperty;
|
|
2315
|
-
var __defProps$4 = Object.defineProperties;
|
|
2316
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
2317
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
2318
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
2319
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
2320
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2321
|
-
var __spreadValues$5 = (a, b) => {
|
|
2322
|
-
for (var prop in b || (b = {}))
|
|
2323
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
2324
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
2325
|
-
if (__getOwnPropSymbols$5)
|
|
2326
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
2327
|
-
if (__propIsEnum$5.call(b, prop))
|
|
2328
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
2329
|
-
}
|
|
2330
|
-
return a;
|
|
2331
|
-
};
|
|
2332
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
2333
|
-
const AntdInput = Input;
|
|
2334
|
-
const AntdTextArea = Input.TextArea;
|
|
2335
|
-
const AntdPassword = Input.Password;
|
|
2336
|
-
const AntdInputNumber = InputNumber;
|
|
2337
|
-
const inputHelpers = {
|
|
2338
|
-
states: {
|
|
2339
|
-
value: {
|
|
2340
|
-
onChangeArgsToValue: (e) => {
|
|
2341
|
-
return e.target.value;
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
};
|
|
2346
|
-
const COMMON_HELPERS_CONFIG = {
|
|
2347
|
-
helpers: inputHelpers,
|
|
2348
|
-
importName: "inputHelpers",
|
|
2349
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput"
|
|
2350
|
-
};
|
|
2351
|
-
const COMMON_STATES = {
|
|
2352
|
-
value: {
|
|
2353
|
-
type: "writable",
|
|
2354
|
-
valueProp: "value",
|
|
2355
|
-
variableType: "text",
|
|
2356
|
-
onChangeProp: "onChange"
|
|
2357
|
-
}
|
|
2358
|
-
};
|
|
2359
|
-
const COMMON_DECORATOR_PROPS = {
|
|
2360
|
-
prefix: {
|
|
2361
|
-
type: "slot",
|
|
2362
|
-
hidePlaceholder: true
|
|
2363
|
-
},
|
|
2364
|
-
suffix: {
|
|
2365
|
-
type: "slot",
|
|
2366
|
-
hidePlaceholder: true
|
|
2367
|
-
},
|
|
2368
|
-
addonAfter: {
|
|
2369
|
-
type: "slot",
|
|
2370
|
-
hidePlaceholder: true
|
|
2371
|
-
},
|
|
2372
|
-
addonBefore: {
|
|
2373
|
-
type: "slot",
|
|
2374
|
-
hidePlaceholder: true
|
|
2375
|
-
}
|
|
2376
|
-
};
|
|
2377
|
-
const COMMON_ADVANCED_PROPS = {
|
|
2378
|
-
maxLength: {
|
|
2379
|
-
type: "number",
|
|
2380
|
-
advanced: true
|
|
2381
|
-
},
|
|
2382
|
-
bordered: {
|
|
2383
|
-
type: "boolean",
|
|
2384
|
-
advanced: true,
|
|
2385
|
-
defaultValueHint: true
|
|
2386
|
-
},
|
|
2387
|
-
allowClear: {
|
|
2388
|
-
type: "boolean",
|
|
2389
|
-
advanced: true
|
|
2390
|
-
},
|
|
2391
|
-
autoFocus: {
|
|
2392
|
-
type: "boolean",
|
|
2393
|
-
advanced: true
|
|
2394
|
-
},
|
|
2395
|
-
readOnly: {
|
|
2396
|
-
type: "boolean",
|
|
2397
|
-
advanced: true
|
|
2398
|
-
}
|
|
2399
|
-
};
|
|
2400
|
-
const COMMON_EVENT_HANDLERS = {
|
|
2401
|
-
onChange: {
|
|
2402
|
-
type: "eventHandler",
|
|
2403
|
-
argTypes: [
|
|
2404
|
-
{
|
|
2405
|
-
name: "event",
|
|
2406
|
-
type: "object"
|
|
2407
|
-
}
|
|
2408
|
-
]
|
|
2409
|
-
},
|
|
2410
|
-
onPressEnter: {
|
|
2411
|
-
type: "eventHandler",
|
|
2412
|
-
argTypes: [
|
|
2413
|
-
{
|
|
2414
|
-
name: "event",
|
|
2415
|
-
type: "object"
|
|
2416
|
-
}
|
|
2417
|
-
]
|
|
2418
|
-
}
|
|
2419
|
-
};
|
|
2420
|
-
function registerInput(loader) {
|
|
2421
|
-
registerComponentHelper(loader, AntdInput, __spreadProps$4(__spreadValues$5({
|
|
2422
|
-
name: "plasmic-antd5-input",
|
|
2423
|
-
displayName: "Input",
|
|
2424
|
-
props: __spreadValues$5(__spreadValues$5(__spreadValues$5({
|
|
2425
|
-
value: {
|
|
2426
|
-
type: "string"
|
|
2427
|
-
},
|
|
2428
|
-
placeholder: {
|
|
2429
|
-
type: "string"
|
|
2430
|
-
},
|
|
2431
|
-
size: {
|
|
2432
|
-
type: "choice",
|
|
2433
|
-
options: ["large", "middle", "small"]
|
|
2434
|
-
},
|
|
2435
|
-
disabled: {
|
|
2436
|
-
type: "boolean"
|
|
2437
|
-
},
|
|
2438
|
-
type: {
|
|
2439
|
-
type: "choice",
|
|
2440
|
-
options: [
|
|
2441
|
-
"text",
|
|
2442
|
-
"password",
|
|
2443
|
-
"number",
|
|
2444
|
-
"date",
|
|
2445
|
-
"datetime-local",
|
|
2446
|
-
"time",
|
|
2447
|
-
"email",
|
|
2448
|
-
"tel",
|
|
2449
|
-
"hidden"
|
|
2450
2685
|
],
|
|
2451
|
-
|
|
2452
|
-
}
|
|
2453
|
-
}, COMMON_ADVANCED_PROPS), COMMON_DECORATOR_PROPS), COMMON_EVENT_HANDLERS),
|
|
2454
|
-
states: __spreadValues$5({}, COMMON_STATES)
|
|
2455
|
-
}, { trapsSelection: true }), {
|
|
2456
|
-
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
2457
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
2458
|
-
importName: "AntdInput"
|
|
2459
|
-
}));
|
|
2460
|
-
}
|
|
2461
|
-
function registerTextArea(loader) {
|
|
2462
|
-
registerComponentHelper(loader, AntdTextArea, {
|
|
2463
|
-
name: "plasmic-antd5-textarea",
|
|
2464
|
-
parentComponentName: "plasmic-antd5-input",
|
|
2465
|
-
displayName: "Text Area",
|
|
2466
|
-
props: __spreadValues$5({
|
|
2467
|
-
value: {
|
|
2468
|
-
type: "string"
|
|
2686
|
+
hidden: (props) => props.mode !== "advanced"
|
|
2469
2687
|
},
|
|
2470
|
-
|
|
2471
|
-
type: "
|
|
2688
|
+
initialValues: {
|
|
2689
|
+
type: "object"
|
|
2472
2690
|
},
|
|
2473
|
-
|
|
2474
|
-
type: "
|
|
2691
|
+
layout: {
|
|
2692
|
+
type: "choice",
|
|
2693
|
+
options: ["horizontal", "vertical", "inline"],
|
|
2694
|
+
defaultValue: "vertical"
|
|
2475
2695
|
},
|
|
2476
|
-
|
|
2477
|
-
type: "
|
|
2478
|
-
|
|
2696
|
+
labelAlign: {
|
|
2697
|
+
type: "choice",
|
|
2698
|
+
options: ["left", "right"],
|
|
2699
|
+
defaultValueHint: "right",
|
|
2700
|
+
advanced: true,
|
|
2701
|
+
hidden: (ps) => ps.layout !== "horizontal"
|
|
2479
2702
|
},
|
|
2480
|
-
|
|
2703
|
+
labelCol: colProp(
|
|
2704
|
+
"Label layout",
|
|
2705
|
+
{
|
|
2706
|
+
span: 8,
|
|
2707
|
+
horizontalOnly: true
|
|
2708
|
+
},
|
|
2709
|
+
"Set the width and offset of the labels"
|
|
2710
|
+
),
|
|
2711
|
+
wrapperCol: colProp(
|
|
2712
|
+
"Control layout",
|
|
2713
|
+
{
|
|
2714
|
+
span: 16,
|
|
2715
|
+
horizontalOnly: true
|
|
2716
|
+
},
|
|
2717
|
+
"Set the width and offset of the form controls"
|
|
2718
|
+
),
|
|
2719
|
+
colon: {
|
|
2481
2720
|
type: "boolean",
|
|
2721
|
+
description: `Show a colon after labels by default (only for horizontal layout)`,
|
|
2722
|
+
defaultValueHint: true,
|
|
2482
2723
|
advanced: true,
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
2488
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
2489
|
-
importName: "AntdTextArea"
|
|
2490
|
-
});
|
|
2491
|
-
}
|
|
2492
|
-
function registerPasswordInput(loader) {
|
|
2493
|
-
registerComponentHelper(loader, AntdPassword, {
|
|
2494
|
-
name: "plasmic-antd5-input-password",
|
|
2495
|
-
parentComponentName: "plasmic-antd5-input",
|
|
2496
|
-
displayName: "Password Input",
|
|
2497
|
-
props: __spreadValues$5({
|
|
2498
|
-
value: {
|
|
2499
|
-
type: "string"
|
|
2500
|
-
},
|
|
2501
|
-
placeholder: {
|
|
2502
|
-
type: "string"
|
|
2503
|
-
},
|
|
2504
|
-
disabled: {
|
|
2505
|
-
type: "boolean"
|
|
2506
|
-
},
|
|
2507
|
-
maxLength: {
|
|
2508
|
-
type: "number",
|
|
2509
|
-
advanced: true
|
|
2724
|
+
hidden: (props) => {
|
|
2725
|
+
var _a;
|
|
2726
|
+
return ((_a = props.layout) != null ? _a : "horizontal") !== "horizontal";
|
|
2727
|
+
}
|
|
2510
2728
|
},
|
|
2511
|
-
|
|
2512
|
-
|
|
2729
|
+
requiredMark: {
|
|
2730
|
+
displayName: "Required/optional mark",
|
|
2731
|
+
type: "choice",
|
|
2732
|
+
options: [
|
|
2733
|
+
{
|
|
2734
|
+
value: "optional",
|
|
2735
|
+
label: "Indicate optional fields"
|
|
2736
|
+
},
|
|
2737
|
+
{
|
|
2738
|
+
value: true,
|
|
2739
|
+
label: "Indicate required fields with asterisk"
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
value: false,
|
|
2743
|
+
label: "Show no indicators"
|
|
2744
|
+
}
|
|
2745
|
+
],
|
|
2513
2746
|
advanced: true,
|
|
2514
2747
|
defaultValueHint: true
|
|
2515
|
-
}
|
|
2516
|
-
}, COMMON_EVENT_HANDLERS),
|
|
2517
|
-
states: __spreadValues$5({}, COMMON_STATES),
|
|
2518
|
-
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
2519
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
2520
|
-
importName: "AntdPassword"
|
|
2521
|
-
});
|
|
2522
|
-
}
|
|
2523
|
-
function registerNumberInput(loader) {
|
|
2524
|
-
registerComponentHelper(loader, AntdInputNumber, __spreadProps$4(__spreadValues$5({
|
|
2525
|
-
name: "plasmic-antd5-input-number",
|
|
2526
|
-
parentComponentName: "plasmic-antd5-input",
|
|
2527
|
-
displayName: "Number Input",
|
|
2528
|
-
props: __spreadProps$4(__spreadValues$5(__spreadValues$5(__spreadValues$5({
|
|
2529
|
-
value: {
|
|
2530
|
-
type: "number"
|
|
2531
2748
|
},
|
|
2532
|
-
|
|
2533
|
-
type: "
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2749
|
+
extendedOnValuesChange: {
|
|
2750
|
+
type: "eventHandler",
|
|
2751
|
+
displayName: "On values change",
|
|
2752
|
+
argTypes: [
|
|
2753
|
+
{
|
|
2754
|
+
name: "changedValues",
|
|
2755
|
+
type: "object"
|
|
2756
|
+
},
|
|
2757
|
+
{
|
|
2758
|
+
name: "allValues",
|
|
2759
|
+
type: "object"
|
|
2760
|
+
}
|
|
2761
|
+
]
|
|
2540
2762
|
},
|
|
2541
|
-
|
|
2542
|
-
type: "
|
|
2763
|
+
onFinish: {
|
|
2764
|
+
type: "eventHandler",
|
|
2765
|
+
displayName: "On submit",
|
|
2766
|
+
argTypes: [
|
|
2767
|
+
{
|
|
2768
|
+
name: "values",
|
|
2769
|
+
type: "object"
|
|
2770
|
+
}
|
|
2771
|
+
]
|
|
2543
2772
|
},
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2773
|
+
onFinishFailed: {
|
|
2774
|
+
// function({ values, errorFields, outOfDate })
|
|
2775
|
+
type: "eventHandler",
|
|
2776
|
+
displayName: "On invalid submit",
|
|
2777
|
+
argTypes: [
|
|
2778
|
+
{
|
|
2779
|
+
name: "data",
|
|
2780
|
+
type: "object"
|
|
2781
|
+
}
|
|
2782
|
+
]
|
|
2547
2783
|
},
|
|
2548
|
-
|
|
2549
|
-
type: "
|
|
2550
|
-
|
|
2784
|
+
validateTrigger: {
|
|
2785
|
+
type: "choice",
|
|
2786
|
+
options: ["onSubmit", "onChange", "onBlur"],
|
|
2787
|
+
multiSelect: true,
|
|
2788
|
+
defaultValueHint: ["onChange"],
|
|
2551
2789
|
advanced: true
|
|
2552
2790
|
}
|
|
2553
|
-
},
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2791
|
+
},
|
|
2792
|
+
actions: COMMON_ACTIONS,
|
|
2793
|
+
states: {
|
|
2794
|
+
value: {
|
|
2795
|
+
type: "readonly",
|
|
2796
|
+
variableType: "object",
|
|
2797
|
+
onChangeProp: "extendedOnValuesChange"
|
|
2798
|
+
}
|
|
2799
|
+
},
|
|
2800
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
2801
|
+
importName: "FormWrapper"
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
function plasmicRulesToAntdRules(plasmicRules, label) {
|
|
2805
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2806
|
+
const effectiveLabel = label || "This field";
|
|
2807
|
+
const rules = [];
|
|
2808
|
+
for (const plasmicRule of plasmicRules) {
|
|
2809
|
+
switch (plasmicRule.ruleType) {
|
|
2810
|
+
case "enum":
|
|
2811
|
+
rules.push({
|
|
2812
|
+
type: "enum",
|
|
2813
|
+
enum: (_b = (_a = plasmicRule.options) == null ? void 0 : _a.map((opt) => opt.value)) != null ? _b : [],
|
|
2814
|
+
message: (_c = plasmicRule.message) != null ? _c : `${effectiveLabel} must be a valid value`
|
|
2815
|
+
});
|
|
2816
|
+
break;
|
|
2817
|
+
case "required":
|
|
2818
|
+
rules.push({
|
|
2819
|
+
required: true,
|
|
2820
|
+
message: (_d = plasmicRule.message) != null ? _d : `${effectiveLabel} is required`
|
|
2821
|
+
});
|
|
2822
|
+
break;
|
|
2823
|
+
case "regex":
|
|
2824
|
+
rules.push({
|
|
2825
|
+
pattern: new RegExp((_e = plasmicRule.pattern) != null ? _e : ""),
|
|
2826
|
+
message: (_f = plasmicRule.message) != null ? _f : `${effectiveLabel} must be a valid value`
|
|
2827
|
+
});
|
|
2828
|
+
break;
|
|
2829
|
+
case "whitespace":
|
|
2830
|
+
rules.push({
|
|
2831
|
+
whitespace: true,
|
|
2832
|
+
message: (_g = plasmicRule.message) != null ? _g : `${effectiveLabel} is required`
|
|
2833
|
+
});
|
|
2834
|
+
break;
|
|
2835
|
+
case "min":
|
|
2836
|
+
rules.push({
|
|
2837
|
+
[plasmicRule.ruleType]: plasmicRule.length,
|
|
2838
|
+
message: (_h = plasmicRule.message) != null ? _h : `${effectiveLabel} must be at least ${plasmicRule.length} characters`
|
|
2839
|
+
});
|
|
2840
|
+
break;
|
|
2841
|
+
case "max":
|
|
2842
|
+
rules.push({
|
|
2843
|
+
[plasmicRule.ruleType]: plasmicRule.length,
|
|
2844
|
+
message: (_i = plasmicRule.message) != null ? _i : `${effectiveLabel} must be at most ${plasmicRule.length} characters`
|
|
2845
|
+
});
|
|
2846
|
+
break;
|
|
2847
|
+
case "advanced":
|
|
2848
|
+
rules.push({
|
|
2849
|
+
validator: (...args) => {
|
|
2850
|
+
var _a2;
|
|
2851
|
+
return ((_a2 = plasmicRule.custom) == null ? void 0 : _a2.apply(null, args)) ? Promise.resolve() : Promise.reject();
|
|
2852
|
+
},
|
|
2853
|
+
message: plasmicRule.message
|
|
2854
|
+
});
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
return rules;
|
|
2858
|
+
}
|
|
2859
|
+
const useFormItemRelativeName = (name) => {
|
|
2860
|
+
const pathCtx = React.useContext(PathContext);
|
|
2861
|
+
return typeof name === "object" ? [...pathCtx.relativePath, ...name] : typeof name === "string" ? [...pathCtx.relativePath, name] : void 0;
|
|
2862
|
+
};
|
|
2863
|
+
const useFormItemFullName = (name) => {
|
|
2864
|
+
const pathCtx = React.useContext(PathContext);
|
|
2865
|
+
return typeof name === "object" ? [...pathCtx.fullPath, ...name] : typeof name === "string" ? [...pathCtx.fullPath, name] : void 0;
|
|
2866
|
+
};
|
|
2867
|
+
function useFormInstanceMaybe() {
|
|
2868
|
+
return Form.useFormInstance();
|
|
2869
|
+
}
|
|
2870
|
+
function FormItemWrapper(props) {
|
|
2871
|
+
var _b;
|
|
2872
|
+
const _a = props, {
|
|
2873
|
+
rules: plasmicRules,
|
|
2874
|
+
description,
|
|
2875
|
+
noLabel,
|
|
2876
|
+
name,
|
|
2877
|
+
hideValidationMessage,
|
|
2878
|
+
customizeProps,
|
|
2879
|
+
setControlContextData,
|
|
2880
|
+
alignLabellessWithControls = true
|
|
2881
|
+
} = _a, rest = __objRest$3(_a, [
|
|
2882
|
+
"rules",
|
|
2883
|
+
"description",
|
|
2884
|
+
"noLabel",
|
|
2885
|
+
"name",
|
|
2886
|
+
"hideValidationMessage",
|
|
2887
|
+
"customizeProps",
|
|
2888
|
+
"setControlContextData",
|
|
2889
|
+
"alignLabellessWithControls"
|
|
2890
|
+
]);
|
|
2891
|
+
const relativeFormItemName = useFormItemRelativeName(name);
|
|
2892
|
+
const fullFormItemName = useFormItemFullName(name);
|
|
2893
|
+
const bestEffortLabel = !noLabel && reactNodeToString(props.label) || ensureArray(props.name).slice(-1)[0];
|
|
2894
|
+
const rules = plasmicRules ? plasmicRulesToAntdRules(
|
|
2895
|
+
plasmicRules,
|
|
2896
|
+
typeof bestEffortLabel === "number" ? "" + bestEffortLabel : bestEffortLabel
|
|
2897
|
+
) : void 0;
|
|
2898
|
+
const layoutContext = React.useContext(FormLayoutContext);
|
|
2899
|
+
const inCanvas = !!usePlasmicCanvasContext();
|
|
2900
|
+
if (inCanvas) {
|
|
2901
|
+
const form = useFormInstanceMaybe();
|
|
2902
|
+
const prevPropValues = React.useRef({
|
|
2903
|
+
initialValue: props.initialValue,
|
|
2904
|
+
name: props.name
|
|
2905
|
+
});
|
|
2906
|
+
const internalFormCtx = React.useContext(InternalFormInstanceContext);
|
|
2907
|
+
const { fireOnValuesChange, forceRemount } = internalFormCtx != null ? internalFormCtx : {};
|
|
2908
|
+
(_b = props.setControlContextData) == null ? void 0 : _b.call(props, {
|
|
2909
|
+
internalFormCtx
|
|
2910
|
+
});
|
|
2911
|
+
React.useEffect(() => {
|
|
2912
|
+
if (prevPropValues.current.name !== props.name) {
|
|
2913
|
+
forceRemount == null ? void 0 : forceRemount();
|
|
2914
|
+
}
|
|
2915
|
+
if (!fullFormItemName || (form == null ? void 0 : form.getFieldValue(fullFormItemName)) !== prevPropValues.current.initialValue) {
|
|
2916
|
+
return;
|
|
2563
2917
|
}
|
|
2918
|
+
form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
|
|
2919
|
+
prevPropValues.current.initialValue = props.initialValue;
|
|
2920
|
+
fireOnValuesChange == null ? void 0 : fireOnValuesChange();
|
|
2921
|
+
}, [form, props.initialValue, fullFormItemName]);
|
|
2922
|
+
}
|
|
2923
|
+
return /* @__PURE__ */ React.createElement(
|
|
2924
|
+
FormItem,
|
|
2925
|
+
__spreadProps$2(__spreadValues$3({}, rest), {
|
|
2926
|
+
label: noLabel ? void 0 : props.label,
|
|
2927
|
+
name: relativeFormItemName,
|
|
2928
|
+
rules,
|
|
2929
|
+
extra: description,
|
|
2930
|
+
help: hideValidationMessage ? "" : props.help,
|
|
2931
|
+
colon: noLabel ? false : void 0,
|
|
2932
|
+
valuePropName: deriveValuePropName(props),
|
|
2933
|
+
wrapperCol: (layoutContext == null ? void 0 : layoutContext.layout) === "horizontal" && noLabel && alignLabellessWithControls && layoutContext.labelSpan ? { offset: layoutContext.labelSpan } : void 0
|
|
2564
2934
|
}),
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
// don't need component helpers
|
|
2568
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
2569
|
-
importName: "AntdInputNumber"
|
|
2570
|
-
}));
|
|
2935
|
+
/* @__PURE__ */ React.createElement(FormItemForwarder, { formItemProps: props })
|
|
2936
|
+
);
|
|
2571
2937
|
}
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
var
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
};
|
|
2591
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
2592
|
-
var __objRest$4 = (source, exclude) => {
|
|
2593
|
-
var target = {};
|
|
2594
|
-
for (var prop in source)
|
|
2595
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2596
|
-
target[prop] = source[prop];
|
|
2597
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
2598
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
2599
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
2600
|
-
target[prop] = source[prop];
|
|
2601
|
-
}
|
|
2602
|
-
return target;
|
|
2603
|
-
};
|
|
2604
|
-
function AntdModal(props) {
|
|
2605
|
-
const _a = props, { onOpenChange, onOk, onCancel, open, footer } = _a, rest = __objRest$4(_a, ["onOpenChange", "onOk", "onCancel", "open", "footer"]);
|
|
2606
|
-
const memoOnOk = React.useMemo(() => {
|
|
2607
|
-
if (onOpenChange || onOk) {
|
|
2608
|
-
return (e) => {
|
|
2609
|
-
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
2610
|
-
onOk == null ? void 0 : onOk(e);
|
|
2611
|
-
};
|
|
2612
|
-
} else {
|
|
2613
|
-
return void 0;
|
|
2938
|
+
function deriveValuePropName(props) {
|
|
2939
|
+
if (props.valuePropName) {
|
|
2940
|
+
return props.valuePropName;
|
|
2941
|
+
}
|
|
2942
|
+
const valueProps = React.Children.map(props.children, (child) => {
|
|
2943
|
+
var _a;
|
|
2944
|
+
if (React.isValidElement(child)) {
|
|
2945
|
+
const childType = child.type;
|
|
2946
|
+
if (childType) {
|
|
2947
|
+
const x = (_a = childType.__plasmicFormFieldMeta) == null ? void 0 : _a.valueProp;
|
|
2948
|
+
if (x) {
|
|
2949
|
+
return x;
|
|
2950
|
+
}
|
|
2951
|
+
const plumeType = childType.__plumeType;
|
|
2952
|
+
if (plumeType && (plumeType === "checkbox" || plumeType === "switch")) {
|
|
2953
|
+
return "isChecked";
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2614
2956
|
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2957
|
+
return void 0;
|
|
2958
|
+
}).filter((x) => !!x);
|
|
2959
|
+
if (valueProps.length > 0) {
|
|
2960
|
+
return valueProps[0];
|
|
2961
|
+
}
|
|
2962
|
+
return void 0;
|
|
2963
|
+
}
|
|
2964
|
+
function FormItemForwarder(_a) {
|
|
2965
|
+
var _b = _a, { formItemProps } = _b, props = __objRest$3(_b, ["formItemProps"]);
|
|
2966
|
+
var _a2;
|
|
2967
|
+
const status = Form.Item.useStatus();
|
|
2968
|
+
const internalFormCtx = React.useContext(InternalFormInstanceContext);
|
|
2969
|
+
const data = {
|
|
2970
|
+
status: status.status
|
|
2971
|
+
};
|
|
2972
|
+
(_a2 = props.setControlContextData) == null ? void 0 : _a2.call(props, {
|
|
2973
|
+
internalFormCtx,
|
|
2974
|
+
status
|
|
2975
|
+
});
|
|
2976
|
+
return React.Children.map(formItemProps.children, (child, i) => {
|
|
2977
|
+
var _a3;
|
|
2978
|
+
let newProps = __spreadProps$2(__spreadValues$3(__spreadValues$3({}, (_a3 = child.props) != null ? _a3 : {}), props), {
|
|
2979
|
+
__plasmicFormField: true
|
|
2980
|
+
});
|
|
2981
|
+
if (formItemProps.customizeProps) {
|
|
2982
|
+
newProps = mergeProps(
|
|
2983
|
+
newProps,
|
|
2984
|
+
formItemProps.customizeProps(data, newProps)
|
|
2985
|
+
);
|
|
2624
2986
|
}
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
Modal,
|
|
2628
|
-
__spreadProps$3(__spreadValues$4({}, rest), {
|
|
2629
|
-
onOk: memoOnOk,
|
|
2630
|
-
onCancel: memoOnCancel,
|
|
2631
|
-
open,
|
|
2632
|
-
footer: footer != null ? footer : void 0
|
|
2633
|
-
})
|
|
2634
|
-
);
|
|
2987
|
+
return i === 0 && isValidElement(child) ? cloneElement(child, newProps) : child;
|
|
2988
|
+
});
|
|
2635
2989
|
}
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2990
|
+
const commonFormItemProps = {
|
|
2991
|
+
name: {
|
|
2992
|
+
type: "string"
|
|
2993
|
+
},
|
|
2994
|
+
initialValue: {
|
|
2995
|
+
type: "string"
|
|
2996
|
+
},
|
|
2997
|
+
rules: {
|
|
2998
|
+
type: "formValidationRules"
|
|
2999
|
+
},
|
|
3000
|
+
valuePropName: {
|
|
3001
|
+
type: "string",
|
|
3002
|
+
advanced: true,
|
|
3003
|
+
defaultValueHint: "value",
|
|
3004
|
+
description: "The prop name for specifying the value of the form control component"
|
|
3005
|
+
},
|
|
3006
|
+
noLabel: {
|
|
3007
|
+
type: "boolean",
|
|
3008
|
+
advanced: true
|
|
3009
|
+
},
|
|
3010
|
+
alignLabellessWithControls: {
|
|
3011
|
+
type: "boolean",
|
|
3012
|
+
displayName: "Align with controls?",
|
|
3013
|
+
description: "Aligns the content with form controls in the grid",
|
|
3014
|
+
hidden: (ps, ctx) => {
|
|
3015
|
+
var _a;
|
|
3016
|
+
return !ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
3017
|
+
},
|
|
3018
|
+
defaultValueHint: true
|
|
3019
|
+
},
|
|
3020
|
+
colon: {
|
|
3021
|
+
type: "boolean",
|
|
3022
|
+
defaultValueHint: true,
|
|
3023
|
+
advanced: true,
|
|
3024
|
+
hidden: () => true
|
|
3025
|
+
},
|
|
3026
|
+
labelAlign: {
|
|
3027
|
+
type: "choice",
|
|
3028
|
+
options: ["left", "right"],
|
|
3029
|
+
advanced: true,
|
|
3030
|
+
hidden: (ps, ctx) => {
|
|
3031
|
+
var _a;
|
|
3032
|
+
return !!ps.noLabel || ((_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.layout.layout) !== "horizontal";
|
|
3033
|
+
}
|
|
3034
|
+
},
|
|
3035
|
+
hidden: {
|
|
3036
|
+
type: "boolean",
|
|
3037
|
+
advanced: true
|
|
3038
|
+
},
|
|
3039
|
+
validateTrigger: {
|
|
3040
|
+
type: "choice",
|
|
3041
|
+
options: ["onSubmit", "onChange", "onBlur"],
|
|
3042
|
+
multiSelect: true,
|
|
3043
|
+
advanced: true
|
|
3044
|
+
},
|
|
3045
|
+
shouldUpdate: {
|
|
3046
|
+
type: "boolean",
|
|
3047
|
+
advanced: true,
|
|
3048
|
+
displayName: "Always re-render",
|
|
3049
|
+
description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
|
|
3050
|
+
},
|
|
3051
|
+
dependencies: {
|
|
3052
|
+
type: "array",
|
|
3053
|
+
advanced: true,
|
|
3054
|
+
displayName: "Dependencies",
|
|
3055
|
+
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
3056
|
+
},
|
|
3057
|
+
hideValidationMessage: {
|
|
3058
|
+
type: "boolean",
|
|
3059
|
+
displayName: "Hide validation message?",
|
|
3060
|
+
description: "If true, will hide the validation error message",
|
|
3061
|
+
defaultValueHint: false,
|
|
3062
|
+
advanced: true
|
|
3063
|
+
},
|
|
3064
|
+
customizeProps: {
|
|
3065
|
+
type: "function",
|
|
3066
|
+
description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
|
|
3067
|
+
argNames: ["fieldData"],
|
|
3068
|
+
argValues: (_ps, ctx) => {
|
|
3069
|
+
var _a;
|
|
3070
|
+
return [
|
|
3071
|
+
{
|
|
3072
|
+
status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
|
|
2649
3073
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
3074
|
+
];
|
|
3075
|
+
},
|
|
3076
|
+
advanced: true
|
|
3077
|
+
},
|
|
3078
|
+
noStyle: {
|
|
3079
|
+
type: "boolean",
|
|
3080
|
+
displayName: "Field control only",
|
|
3081
|
+
description: "Don't render anything but the field control - so no label, help text, validation error, etc.",
|
|
3082
|
+
advanced: true
|
|
3083
|
+
}
|
|
3084
|
+
};
|
|
3085
|
+
const formItemComponentName = "plasmic-antd5-form-item";
|
|
3086
|
+
function registerFormItem(loader) {
|
|
3087
|
+
registerComponentHelper(loader, FormItemWrapper, __spreadValues$3({
|
|
3088
|
+
name: formItemComponentName,
|
|
3089
|
+
displayName: "Form Field",
|
|
3090
|
+
parentComponentName: formComponentName,
|
|
3091
|
+
defaultStyles: {
|
|
3092
|
+
marginBottom: "24px",
|
|
3093
|
+
width: "stretch"
|
|
3094
|
+
},
|
|
3095
|
+
props: __spreadValues$3({
|
|
3096
|
+
label: __spreadValues$3({
|
|
2656
3097
|
type: "slot",
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
3098
|
+
defaultValue: {
|
|
3099
|
+
type: "text",
|
|
3100
|
+
value: "Label"
|
|
3101
|
+
},
|
|
3102
|
+
hidden: (ps) => !!ps.noLabel
|
|
3103
|
+
}, { mergeWithParent: true }),
|
|
3104
|
+
children: __spreadValues$3({
|
|
2660
3105
|
type: "slot",
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
3106
|
+
defaultValue: {
|
|
3107
|
+
type: "component",
|
|
3108
|
+
name: inputComponentName
|
|
3109
|
+
}
|
|
3110
|
+
}, { mergeWithParent: true })
|
|
3111
|
+
}, commonFormItemProps),
|
|
3112
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
3113
|
+
importName: "FormItemWrapper",
|
|
3114
|
+
templates: {
|
|
3115
|
+
Text: {
|
|
3116
|
+
props: {
|
|
3117
|
+
children: {
|
|
3118
|
+
type: "component",
|
|
3119
|
+
name: inputComponentName
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
2666
3122
|
},
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
3123
|
+
"Long Text": {
|
|
3124
|
+
props: {
|
|
3125
|
+
children: {
|
|
3126
|
+
type: "component",
|
|
3127
|
+
name: textAreaComponentName
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
2670
3130
|
},
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
3131
|
+
"Select dropdown": {
|
|
3132
|
+
props: {
|
|
3133
|
+
children: {
|
|
3134
|
+
type: "component",
|
|
3135
|
+
name: selectComponentName
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
2675
3138
|
},
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
3139
|
+
Number: {
|
|
3140
|
+
props: {
|
|
3141
|
+
children: {
|
|
3142
|
+
type: "component",
|
|
3143
|
+
name: inputNumberComponentName
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
2680
3146
|
},
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
3147
|
+
Checkbox: {
|
|
3148
|
+
props: {
|
|
3149
|
+
children: {
|
|
3150
|
+
type: "component",
|
|
3151
|
+
name: checkboxComponentName
|
|
3152
|
+
},
|
|
3153
|
+
noLabel: true
|
|
3154
|
+
}
|
|
2684
3155
|
},
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
3156
|
+
Switch: {
|
|
3157
|
+
props: {
|
|
3158
|
+
children: {
|
|
3159
|
+
type: "component",
|
|
3160
|
+
name: switchComponentName
|
|
3161
|
+
},
|
|
3162
|
+
noLabel: true
|
|
3163
|
+
}
|
|
2688
3164
|
},
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
{
|
|
2695
|
-
selector: ":modal .ant-modal .ant-modal-content",
|
|
2696
|
-
label: "Base"
|
|
3165
|
+
Radios: {
|
|
3166
|
+
props: {
|
|
3167
|
+
children: {
|
|
3168
|
+
type: "component",
|
|
3169
|
+
name: radioGroupComponentName
|
|
2697
3170
|
}
|
|
2698
|
-
|
|
2699
|
-
advanced: true
|
|
3171
|
+
}
|
|
2700
3172
|
},
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
{
|
|
2707
|
-
selector: ":modal .ant-modal .ant-modal-close",
|
|
2708
|
-
label: "Base"
|
|
3173
|
+
Password: {
|
|
3174
|
+
props: {
|
|
3175
|
+
children: {
|
|
3176
|
+
type: "component",
|
|
3177
|
+
name: passwordComponentName
|
|
2709
3178
|
}
|
|
2710
|
-
|
|
2711
|
-
advanced: true
|
|
3179
|
+
}
|
|
2712
3180
|
},
|
|
2713
|
-
|
|
2714
|
-
|
|
3181
|
+
"Submit button": {
|
|
3182
|
+
props: {
|
|
3183
|
+
children: {
|
|
3184
|
+
type: "component",
|
|
3185
|
+
name: buttonComponentName,
|
|
3186
|
+
props: {
|
|
3187
|
+
type: "primary"
|
|
3188
|
+
}
|
|
3189
|
+
},
|
|
3190
|
+
noLabel: true
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
}, { trapsSelection: true }));
|
|
3195
|
+
}
|
|
3196
|
+
function FormGroup(props) {
|
|
3197
|
+
const pathCtx = React.useContext(PathContext);
|
|
3198
|
+
return /* @__PURE__ */ React.createElement(
|
|
3199
|
+
PathContext.Provider,
|
|
3200
|
+
{
|
|
3201
|
+
value: {
|
|
3202
|
+
relativePath: [...pathCtx.relativePath, props.name],
|
|
3203
|
+
fullPath: [...pathCtx.fullPath, props.name]
|
|
2715
3204
|
}
|
|
2716
3205
|
},
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
3206
|
+
props.children
|
|
3207
|
+
);
|
|
3208
|
+
}
|
|
3209
|
+
const formGroupComponentName = "plasmic-antd5-form-group";
|
|
3210
|
+
function registerFormGroup(loader) {
|
|
3211
|
+
registerComponentHelper(loader, FormGroup, {
|
|
3212
|
+
name: formGroupComponentName,
|
|
3213
|
+
displayName: "Form Field Group",
|
|
3214
|
+
parentComponentName: formComponentName,
|
|
3215
|
+
actions: COMMON_ACTIONS,
|
|
3216
|
+
props: {
|
|
3217
|
+
name: {
|
|
3218
|
+
type: "string"
|
|
3219
|
+
},
|
|
3220
|
+
children: {
|
|
3221
|
+
type: "slot"
|
|
2723
3222
|
}
|
|
2724
3223
|
},
|
|
2725
|
-
importPath: "@plasmicpkgs/antd5/skinny/
|
|
2726
|
-
importName: "
|
|
3224
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
3225
|
+
importName: "FormGroup"
|
|
2727
3226
|
});
|
|
2728
3227
|
}
|
|
2729
|
-
|
|
2730
|
-
var
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2736
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2737
|
-
var __spreadValues$3 = (a, b) => {
|
|
2738
|
-
for (var prop in b || (b = {}))
|
|
2739
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
2740
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2741
|
-
if (__getOwnPropSymbols$3)
|
|
2742
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2743
|
-
if (__propIsEnum$3.call(b, prop))
|
|
2744
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2745
|
-
}
|
|
2746
|
-
return a;
|
|
2747
|
-
};
|
|
2748
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2749
|
-
var __objRest$3 = (source, exclude) => {
|
|
2750
|
-
var target = {};
|
|
2751
|
-
for (var prop in source)
|
|
2752
|
-
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2753
|
-
target[prop] = source[prop];
|
|
2754
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
2755
|
-
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
2756
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
2757
|
-
target[prop] = source[prop];
|
|
2758
|
-
}
|
|
2759
|
-
return target;
|
|
2760
|
-
};
|
|
2761
|
-
const RadioGroup = Radio.Group;
|
|
2762
|
-
const AntdRadio = Radio;
|
|
2763
|
-
Radio.Button;
|
|
2764
|
-
function AntdRadioGroup(props) {
|
|
2765
|
-
const _a = props, { onChange, useChildren } = _a, rest = __objRest$3(_a, ["onChange", "useChildren"]);
|
|
2766
|
-
const wrappedOnChange = React.useMemo(() => {
|
|
2767
|
-
if (onChange) {
|
|
2768
|
-
return (event) => onChange(event.target.value);
|
|
2769
|
-
} else {
|
|
2770
|
-
return void 0;
|
|
2771
|
-
}
|
|
2772
|
-
}, [onChange]);
|
|
2773
|
-
return /* @__PURE__ */ React.createElement(
|
|
2774
|
-
RadioGroup,
|
|
2775
|
-
__spreadProps$2(__spreadValues$3({}, rest), {
|
|
2776
|
-
onChange: wrappedOnChange,
|
|
2777
|
-
options: useChildren ? void 0 : rest.options
|
|
2778
|
-
})
|
|
3228
|
+
const FormListWrapper = React.forwardRef(function FormListWrapper2(props, ref) {
|
|
3229
|
+
var _a;
|
|
3230
|
+
const relativeFormItemName = useFormItemRelativeName(props.name);
|
|
3231
|
+
const fullFormItemName = useFormItemFullName(props.name);
|
|
3232
|
+
const operationsRef = React.useRef(
|
|
3233
|
+
void 0
|
|
2779
3234
|
);
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
description: "The radio option value"
|
|
3235
|
+
React.useImperativeHandle(
|
|
3236
|
+
ref,
|
|
3237
|
+
() => ({
|
|
3238
|
+
add(defaultValue, insertIndex) {
|
|
3239
|
+
if (operationsRef.current) {
|
|
3240
|
+
const { add } = operationsRef.current[1];
|
|
3241
|
+
add(defaultValue, insertIndex);
|
|
3242
|
+
}
|
|
2789
3243
|
},
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
3244
|
+
remove(index) {
|
|
3245
|
+
if (operationsRef.current) {
|
|
3246
|
+
const { remove } = operationsRef.current[1];
|
|
3247
|
+
remove(index);
|
|
3248
|
+
}
|
|
2793
3249
|
},
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
3250
|
+
move(from, to) {
|
|
3251
|
+
if (operationsRef.current) {
|
|
3252
|
+
const { move } = operationsRef.current[1];
|
|
3253
|
+
move(from, to);
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
}),
|
|
3257
|
+
[operationsRef]
|
|
3258
|
+
);
|
|
3259
|
+
const inCanvas = !!usePlasmicCanvasContext();
|
|
3260
|
+
if (inCanvas) {
|
|
3261
|
+
const form = useFormInstanceMaybe();
|
|
3262
|
+
const prevPropValues = React.useRef({
|
|
3263
|
+
initialValue: props.initialValue,
|
|
3264
|
+
name: props.name
|
|
3265
|
+
});
|
|
3266
|
+
const { fireOnValuesChange, forceRemount } = (_a = React.useContext(InternalFormInstanceContext)) != null ? _a : {};
|
|
3267
|
+
React.useEffect(() => {
|
|
3268
|
+
if (prevPropValues.current.name !== props.name) {
|
|
3269
|
+
forceRemount == null ? void 0 : forceRemount();
|
|
3270
|
+
}
|
|
3271
|
+
if (fullFormItemName) {
|
|
3272
|
+
form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
|
|
3273
|
+
prevPropValues.current.initialValue = props.initialValue;
|
|
3274
|
+
fireOnValuesChange == null ? void 0 : fireOnValuesChange();
|
|
3275
|
+
}
|
|
3276
|
+
}, [props.initialValue, fullFormItemName]);
|
|
3277
|
+
}
|
|
3278
|
+
return /* @__PURE__ */ React.createElement(FormList, __spreadProps$2(__spreadValues$3({}, props), { name: relativeFormItemName != null ? relativeFormItemName : [] }), (...args) => {
|
|
3279
|
+
operationsRef.current = args;
|
|
3280
|
+
return args[0].map((field, index) => /* @__PURE__ */ React.createElement(
|
|
3281
|
+
PathContext.Provider,
|
|
3282
|
+
{
|
|
3283
|
+
value: {
|
|
3284
|
+
relativePath: [field.name],
|
|
3285
|
+
fullPath: [...fullFormItemName != null ? fullFormItemName : [], field.name]
|
|
3286
|
+
}
|
|
2799
3287
|
},
|
|
2800
|
-
|
|
3288
|
+
/* @__PURE__ */ React.createElement(DataProvider, { name: "currentField", data: field }, /* @__PURE__ */ React.createElement(DataProvider, { name: "currentFieldIndex", data: index }, repeatedElement(index, props.children)))
|
|
3289
|
+
));
|
|
3290
|
+
});
|
|
3291
|
+
});
|
|
3292
|
+
const formListComponentName = "plasmic-antd5-form-list";
|
|
3293
|
+
function registerFormList(loader) {
|
|
3294
|
+
registerComponentHelper(loader, FormListWrapper, {
|
|
3295
|
+
name: formListComponentName,
|
|
3296
|
+
parentComponentName: formComponentName,
|
|
3297
|
+
displayName: "Form List",
|
|
3298
|
+
actions: COMMON_ACTIONS,
|
|
3299
|
+
props: {
|
|
3300
|
+
children: {
|
|
2801
3301
|
type: "slot",
|
|
2802
3302
|
defaultValue: [
|
|
2803
3303
|
{
|
|
2804
|
-
type: "
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
3304
|
+
type: "hbox",
|
|
3305
|
+
children: [
|
|
3306
|
+
{
|
|
3307
|
+
type: "component",
|
|
3308
|
+
name: formItemComponentName,
|
|
3309
|
+
props: {
|
|
3310
|
+
name: "firstName",
|
|
3311
|
+
label: {
|
|
3312
|
+
type: "text",
|
|
3313
|
+
value: "First name"
|
|
3314
|
+
},
|
|
3315
|
+
children: {
|
|
3316
|
+
type: "component",
|
|
3317
|
+
name: "plasmic-antd5-input"
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
},
|
|
3321
|
+
{
|
|
3322
|
+
type: "component",
|
|
3323
|
+
name: formItemComponentName,
|
|
3324
|
+
props: {
|
|
3325
|
+
name: "lastName",
|
|
3326
|
+
label: {
|
|
3327
|
+
type: "text",
|
|
3328
|
+
value: "Last name"
|
|
3329
|
+
},
|
|
3330
|
+
children: {
|
|
3331
|
+
type: "component",
|
|
3332
|
+
name: "plasmic-antd5-input"
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
]
|
|
3337
|
+
}
|
|
3338
|
+
]
|
|
2825
3339
|
},
|
|
2826
|
-
|
|
2827
|
-
type: "
|
|
2828
|
-
|
|
2829
|
-
defaultValueHint: false,
|
|
2830
|
-
advanced: true
|
|
3340
|
+
name: {
|
|
3341
|
+
type: "string",
|
|
3342
|
+
defaultValue: "guests"
|
|
2831
3343
|
},
|
|
2832
|
-
|
|
2833
|
-
type: "
|
|
3344
|
+
initialValue: {
|
|
3345
|
+
type: "array",
|
|
2834
3346
|
defaultValue: [
|
|
2835
3347
|
{
|
|
2836
|
-
|
|
2837
|
-
|
|
3348
|
+
firstName: "Jane",
|
|
3349
|
+
lastName: "Doe"
|
|
3350
|
+
},
|
|
3351
|
+
{
|
|
3352
|
+
firstName: "John",
|
|
3353
|
+
lastName: "Smith"
|
|
2838
3354
|
}
|
|
2839
3355
|
]
|
|
2840
|
-
}
|
|
3356
|
+
}
|
|
2841
3357
|
},
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
registerComponentHelper(loader, AntdRadioGroup, __spreadValues$3({
|
|
2847
|
-
name: "plasmic-antd5-radio-group",
|
|
2848
|
-
displayName: "Radio Group",
|
|
2849
|
-
props: {
|
|
2850
|
-
options: {
|
|
2851
|
-
type: "array",
|
|
2852
|
-
hidden: (ps) => !!ps.useChildren,
|
|
2853
|
-
itemType: {
|
|
2854
|
-
type: "object",
|
|
2855
|
-
nameFunc: (item) => item.label || item.value,
|
|
2856
|
-
fields: {
|
|
2857
|
-
value: "string",
|
|
2858
|
-
label: "string"
|
|
2859
|
-
}
|
|
2860
|
-
},
|
|
2861
|
-
defaultValue: [
|
|
3358
|
+
refActions: {
|
|
3359
|
+
add: {
|
|
3360
|
+
displayName: "Add an item",
|
|
3361
|
+
argTypes: [
|
|
2862
3362
|
{
|
|
2863
|
-
|
|
2864
|
-
|
|
3363
|
+
name: "defaultValue",
|
|
3364
|
+
displayName: "Default value",
|
|
3365
|
+
type: "object"
|
|
2865
3366
|
},
|
|
2866
3367
|
{
|
|
2867
|
-
|
|
2868
|
-
|
|
3368
|
+
name: "insertIndex",
|
|
3369
|
+
displayName: "Insert index",
|
|
3370
|
+
type: "number"
|
|
2869
3371
|
}
|
|
2870
3372
|
]
|
|
2871
3373
|
},
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
{
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
defaultValueHint: "default"
|
|
2880
|
-
},
|
|
2881
|
-
value: {
|
|
2882
|
-
type: "choice",
|
|
2883
|
-
editOnly: true,
|
|
2884
|
-
uncontrolledProp: "defaultValue",
|
|
2885
|
-
description: "Default selected value",
|
|
2886
|
-
options: (ps) => {
|
|
2887
|
-
var _a;
|
|
2888
|
-
if (ps.useChildren) {
|
|
2889
|
-
const options = /* @__PURE__ */ new Set();
|
|
2890
|
-
traverseReactEltTree(ps.children, (elt) => {
|
|
2891
|
-
var _a2;
|
|
2892
|
-
if (typeof ((_a2 = elt == null ? void 0 : elt.props) == null ? void 0 : _a2.value) === "string") {
|
|
2893
|
-
options.add(elt.props.value);
|
|
2894
|
-
}
|
|
2895
|
-
});
|
|
2896
|
-
return Array.from(options.keys());
|
|
2897
|
-
} else {
|
|
2898
|
-
return (_a = ps.options) != null ? _a : [];
|
|
3374
|
+
remove: {
|
|
3375
|
+
displayName: "Remove an item",
|
|
3376
|
+
argTypes: [
|
|
3377
|
+
{
|
|
3378
|
+
name: "index",
|
|
3379
|
+
displayName: "Index",
|
|
3380
|
+
type: "number"
|
|
2899
3381
|
}
|
|
2900
|
-
|
|
2901
|
-
},
|
|
2902
|
-
disabled: {
|
|
2903
|
-
type: "boolean",
|
|
2904
|
-
description: "Disables all radios",
|
|
2905
|
-
defaultValueHint: false
|
|
2906
|
-
},
|
|
2907
|
-
useChildren: {
|
|
2908
|
-
displayName: "Use slot",
|
|
2909
|
-
type: "boolean",
|
|
2910
|
-
defaultValueHint: false,
|
|
2911
|
-
advanced: true,
|
|
2912
|
-
description: "Instead of configuring a list of options, customize the contents of the RadioGroup by dragging and dropping Radio in the outline/canvas, inside the 'children' slot. Lets you use any content or formatting within the Radio and RadioButton."
|
|
3382
|
+
]
|
|
2913
3383
|
},
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
"plasmic-antd5-radio",
|
|
2918
|
-
"plasmic-antd5-radio-button"
|
|
2919
|
-
],
|
|
2920
|
-
defaultValue: [
|
|
3384
|
+
move: {
|
|
3385
|
+
displayName: "Move field",
|
|
3386
|
+
argTypes: [
|
|
2921
3387
|
{
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
value: "op1",
|
|
2926
|
-
children: {
|
|
2927
|
-
type: "text",
|
|
2928
|
-
value: "Option 1"
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
3388
|
+
name: "from",
|
|
3389
|
+
displayName: "From",
|
|
3390
|
+
type: "number"
|
|
2931
3391
|
},
|
|
2932
3392
|
{
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
value: "op2",
|
|
2937
|
-
children: {
|
|
2938
|
-
type: "text",
|
|
2939
|
-
value: "Option 2"
|
|
2940
|
-
}
|
|
2941
|
-
}
|
|
3393
|
+
name: "to",
|
|
3394
|
+
displayName: "To",
|
|
3395
|
+
type: "number"
|
|
2942
3396
|
}
|
|
2943
3397
|
]
|
|
2944
|
-
},
|
|
2945
|
-
onChange: {
|
|
2946
|
-
type: "eventHandler",
|
|
2947
|
-
argTypes: [{ name: "value", type: "string" }]
|
|
2948
|
-
}
|
|
2949
|
-
},
|
|
2950
|
-
states: {
|
|
2951
|
-
value: {
|
|
2952
|
-
type: "writable",
|
|
2953
|
-
valueProp: "value",
|
|
2954
|
-
onChangeProp: "onChange",
|
|
2955
|
-
variableType: "text"
|
|
2956
3398
|
}
|
|
2957
3399
|
},
|
|
2958
|
-
importPath: "@plasmicpkgs/antd5/skinny/
|
|
2959
|
-
importName: "
|
|
2960
|
-
|
|
2961
|
-
layout: "hbox"
|
|
2962
|
-
}
|
|
2963
|
-
}, {
|
|
2964
|
-
trapsSelection: true
|
|
2965
|
-
}));
|
|
3400
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
3401
|
+
importName: "FormListWrapper"
|
|
3402
|
+
});
|
|
2966
3403
|
}
|
|
2967
3404
|
|
|
2968
3405
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -2995,248 +3432,111 @@ var __objRest$2 = (source, exclude) => {
|
|
|
2995
3432
|
target[prop] = source[prop];
|
|
2996
3433
|
}
|
|
2997
3434
|
return target;
|
|
2998
|
-
};
|
|
2999
|
-
|
|
3000
|
-
const
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
}
|
|
3021
|
-
return /* @__PURE__ */ React.createElement(
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
type: "object",
|
|
3039
|
-
nameFunc: (item) => item.label || item.value,
|
|
3040
|
-
fields: {
|
|
3041
|
-
type: {
|
|
3042
|
-
type: "choice",
|
|
3043
|
-
options: [
|
|
3044
|
-
{ value: "option", label: "Option" },
|
|
3045
|
-
{ value: "option-group", label: "Option Group" }
|
|
3046
|
-
],
|
|
3047
|
-
defaultValue: "option"
|
|
3048
|
-
},
|
|
3049
|
-
value: {
|
|
3050
|
-
type: "string",
|
|
3051
|
-
hidden: (ps) => ps.type !== "option"
|
|
3052
|
-
},
|
|
3053
|
-
label: "string",
|
|
3054
|
-
options: {
|
|
3055
|
-
type: "array",
|
|
3056
|
-
hidden: (ps) => {
|
|
3057
|
-
return ps.type !== "option-group";
|
|
3058
|
-
},
|
|
3059
|
-
itemType: {
|
|
3060
|
-
type: "object",
|
|
3061
|
-
nameFunc: (item) => item.label || item.value,
|
|
3062
|
-
fields: {
|
|
3063
|
-
value: "string",
|
|
3064
|
-
label: "string"
|
|
3065
|
-
}
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
},
|
|
3070
|
-
defaultValue: [
|
|
3071
|
-
{
|
|
3072
|
-
value: "option1",
|
|
3073
|
-
label: "Option 1"
|
|
3074
|
-
},
|
|
3075
|
-
{
|
|
3076
|
-
value: "option2",
|
|
3077
|
-
label: "Option 2"
|
|
3078
|
-
}
|
|
3079
|
-
]
|
|
3080
|
-
},
|
|
3081
|
-
useChildren: {
|
|
3082
|
-
displayName: "Use slot",
|
|
3083
|
-
type: "boolean",
|
|
3084
|
-
defaultValueHint: false,
|
|
3085
|
-
advanced: true,
|
|
3086
|
-
description: "Instead of configuring a list of options, customize the contents of the Select by dragging and dropping options in the outline/canvas, inside the 'children' slot. Lets you use any content or formatting within the Options, and also use Option Groups."
|
|
3435
|
+
};
|
|
3436
|
+
function AntdModal(props) {
|
|
3437
|
+
const _a = props, { onOpenChange, onOk, onCancel, open, footer } = _a, rest = __objRest$2(_a, ["onOpenChange", "onOk", "onCancel", "open", "footer"]);
|
|
3438
|
+
const memoOnOk = React.useMemo(() => {
|
|
3439
|
+
if (onOpenChange || onOk) {
|
|
3440
|
+
return (e) => {
|
|
3441
|
+
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
3442
|
+
onOk == null ? void 0 : onOk(e);
|
|
3443
|
+
};
|
|
3444
|
+
} else {
|
|
3445
|
+
return void 0;
|
|
3446
|
+
}
|
|
3447
|
+
}, [onOpenChange, onOk]);
|
|
3448
|
+
const memoOnCancel = React.useMemo(() => {
|
|
3449
|
+
if (onOpenChange || onCancel) {
|
|
3450
|
+
return (e) => {
|
|
3451
|
+
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
3452
|
+
onCancel == null ? void 0 : onCancel(e);
|
|
3453
|
+
};
|
|
3454
|
+
} else {
|
|
3455
|
+
return void 0;
|
|
3456
|
+
}
|
|
3457
|
+
}, [onOpenChange, onCancel]);
|
|
3458
|
+
return /* @__PURE__ */ React.createElement(
|
|
3459
|
+
Modal,
|
|
3460
|
+
__spreadProps$1(__spreadValues$2({}, rest), {
|
|
3461
|
+
onOk: memoOnOk,
|
|
3462
|
+
onCancel: memoOnCancel,
|
|
3463
|
+
open,
|
|
3464
|
+
footer: footer != null ? footer : void 0
|
|
3465
|
+
})
|
|
3466
|
+
);
|
|
3467
|
+
}
|
|
3468
|
+
function registerModal(loader) {
|
|
3469
|
+
registerComponentHelper(loader, AntdModal, {
|
|
3470
|
+
name: "plasmic-antd5-modal",
|
|
3471
|
+
displayName: "Modal",
|
|
3472
|
+
props: {
|
|
3473
|
+
open: {
|
|
3474
|
+
type: "boolean"
|
|
3087
3475
|
},
|
|
3088
3476
|
children: {
|
|
3089
3477
|
type: "slot",
|
|
3090
|
-
|
|
3091
|
-
"
|
|
3092
|
-
"
|
|
3093
|
-
|
|
3094
|
-
hidden: (ps) => !ps.useChildren
|
|
3478
|
+
defaultValue: {
|
|
3479
|
+
type: "vbox",
|
|
3480
|
+
children: ["Modal content"]
|
|
3481
|
+
}
|
|
3095
3482
|
},
|
|
3096
|
-
|
|
3483
|
+
title: {
|
|
3097
3484
|
type: "slot",
|
|
3098
|
-
defaultValue: "
|
|
3485
|
+
defaultValue: "Modal title"
|
|
3099
3486
|
},
|
|
3100
|
-
|
|
3487
|
+
footer: {
|
|
3101
3488
|
type: "slot",
|
|
3102
3489
|
hidePlaceholder: true
|
|
3103
3490
|
},
|
|
3104
|
-
|
|
3105
|
-
type: "
|
|
3106
|
-
|
|
3107
|
-
uncontrolledProp: "defaultOpen"
|
|
3108
|
-
},
|
|
3109
|
-
value: {
|
|
3110
|
-
type: "choice",
|
|
3111
|
-
displayName: "Selected value",
|
|
3112
|
-
editOnly: true,
|
|
3113
|
-
uncontrolledProp: "defaultValue",
|
|
3114
|
-
description: "Initial selected option",
|
|
3115
|
-
multiSelect: (ps) => ps.mode === "multiple",
|
|
3116
|
-
options: (ps) => {
|
|
3117
|
-
var _a;
|
|
3118
|
-
const options = /* @__PURE__ */ new Set();
|
|
3119
|
-
if (!ps.useChildren) {
|
|
3120
|
-
const rec = (op) => {
|
|
3121
|
-
var _a2;
|
|
3122
|
-
if (typeof op === "string") {
|
|
3123
|
-
return [{ value: op, label: op }];
|
|
3124
|
-
} else if ("options" in op) {
|
|
3125
|
-
return ((_a2 = op.options) != null ? _a2 : []).flatMap((sub) => rec(sub));
|
|
3126
|
-
} else {
|
|
3127
|
-
return [{ value: op.value, label: op.label || op.value }];
|
|
3128
|
-
}
|
|
3129
|
-
};
|
|
3130
|
-
return ((_a = ps.options) != null ? _a : []).flatMap((o) => rec(o));
|
|
3131
|
-
} else {
|
|
3132
|
-
traverseReactEltTree(ps.children, (elt) => {
|
|
3133
|
-
var _a2;
|
|
3134
|
-
if ((elt == null ? void 0 : elt.type) === Select.Option && typeof ((_a2 = elt == null ? void 0 : elt.props) == null ? void 0 : _a2.value) === "string") {
|
|
3135
|
-
options.add(elt.props.value);
|
|
3136
|
-
}
|
|
3137
|
-
});
|
|
3138
|
-
}
|
|
3139
|
-
return Array.from(options.keys());
|
|
3140
|
-
}
|
|
3141
|
-
},
|
|
3142
|
-
mode: {
|
|
3143
|
-
type: "choice",
|
|
3144
|
-
options: ["single", "multiple"],
|
|
3145
|
-
defaultValueHint: "single"
|
|
3146
|
-
},
|
|
3147
|
-
size: {
|
|
3148
|
-
type: "choice",
|
|
3149
|
-
options: ["small", "middle", "large"]
|
|
3491
|
+
closeIcon: {
|
|
3492
|
+
type: "slot",
|
|
3493
|
+
hidePlaceholder: true
|
|
3150
3494
|
},
|
|
3151
|
-
|
|
3152
|
-
type: "
|
|
3153
|
-
|
|
3495
|
+
onOk: {
|
|
3496
|
+
type: "eventHandler",
|
|
3497
|
+
argTypes: []
|
|
3154
3498
|
},
|
|
3155
|
-
|
|
3156
|
-
type: "
|
|
3157
|
-
|
|
3158
|
-
advanced: true
|
|
3499
|
+
onCancel: {
|
|
3500
|
+
type: "eventHandler",
|
|
3501
|
+
argTypes: []
|
|
3159
3502
|
},
|
|
3160
|
-
|
|
3161
|
-
type: "
|
|
3162
|
-
|
|
3503
|
+
okText: {
|
|
3504
|
+
type: "string",
|
|
3505
|
+
hidden: (ps) => !!ps.footer,
|
|
3163
3506
|
advanced: true
|
|
3164
3507
|
},
|
|
3165
|
-
|
|
3166
|
-
type: "
|
|
3167
|
-
|
|
3168
|
-
},
|
|
3169
|
-
autoFocus: {
|
|
3170
|
-
type: "boolean",
|
|
3171
|
-
displayName: "Focus automatically",
|
|
3172
|
-
defaultValueHint: false,
|
|
3508
|
+
cancelText: {
|
|
3509
|
+
type: "string",
|
|
3510
|
+
hidden: (ps) => !!ps.footer,
|
|
3173
3511
|
advanced: true
|
|
3174
3512
|
},
|
|
3175
|
-
|
|
3513
|
+
onOpenChange: {
|
|
3176
3514
|
type: "eventHandler",
|
|
3177
|
-
argTypes: [
|
|
3178
|
-
{ name: "value", type: "string" },
|
|
3179
|
-
{ name: "option", type: "object" }
|
|
3180
|
-
]
|
|
3181
|
-
},
|
|
3182
|
-
dropdownMatchSelectWidth: {
|
|
3183
|
-
type: "boolean",
|
|
3184
|
-
displayName: "Should dropdown match trigger button width?",
|
|
3185
|
-
defaultValueHint: true,
|
|
3186
|
-
advanced: true
|
|
3187
|
-
},
|
|
3188
|
-
triggerClassName: {
|
|
3189
|
-
type: "class",
|
|
3190
|
-
displayName: "Trigger styles",
|
|
3191
|
-
noSelf: true,
|
|
3192
|
-
selectors: [
|
|
3193
|
-
{
|
|
3194
|
-
selector: ":component .ant-select-selector.ant-select-selector",
|
|
3195
|
-
label: "Base"
|
|
3196
|
-
},
|
|
3197
|
-
{
|
|
3198
|
-
selector: ":component .ant-select-selector:hover",
|
|
3199
|
-
label: "Hovered"
|
|
3200
|
-
}
|
|
3201
|
-
],
|
|
3202
|
-
advanced: true
|
|
3515
|
+
argTypes: [{ name: "open", type: "boolean" }]
|
|
3203
3516
|
},
|
|
3204
|
-
|
|
3517
|
+
modalScopeClassName: {
|
|
3205
3518
|
type: "styleScopeClass",
|
|
3206
|
-
scopeName: "
|
|
3207
|
-
},
|
|
3208
|
-
popupClassName: {
|
|
3209
|
-
type: "class",
|
|
3210
|
-
displayName: "Popup styles",
|
|
3211
|
-
selectors: [],
|
|
3212
|
-
advanced: true
|
|
3519
|
+
scopeName: "modal"
|
|
3213
3520
|
},
|
|
3214
|
-
|
|
3521
|
+
modalClassName: {
|
|
3215
3522
|
type: "class",
|
|
3216
|
-
displayName: "
|
|
3523
|
+
displayName: "Modal content styles",
|
|
3217
3524
|
noSelf: true,
|
|
3218
3525
|
selectors: [
|
|
3219
3526
|
{
|
|
3220
|
-
selector: ":
|
|
3527
|
+
selector: ":modal .ant-modal .ant-modal-content",
|
|
3221
3528
|
label: "Base"
|
|
3222
|
-
},
|
|
3223
|
-
{
|
|
3224
|
-
selector: ":popup.ant-select-dropdown .ant-select-item-option-active",
|
|
3225
|
-
label: "Focused"
|
|
3226
|
-
},
|
|
3227
|
-
{
|
|
3228
|
-
selector: ":popup.ant-select-dropdown .ant-select-item-option-selected",
|
|
3229
|
-
label: "Selected"
|
|
3230
3529
|
}
|
|
3231
3530
|
],
|
|
3232
3531
|
advanced: true
|
|
3233
3532
|
},
|
|
3234
|
-
|
|
3533
|
+
closeButtonClassName: {
|
|
3235
3534
|
type: "class",
|
|
3236
|
-
displayName: "
|
|
3535
|
+
displayName: "Close button styles",
|
|
3536
|
+
noSelf: true,
|
|
3237
3537
|
selectors: [
|
|
3238
3538
|
{
|
|
3239
|
-
selector: ":
|
|
3539
|
+
selector: ":modal .ant-modal .ant-modal-close",
|
|
3240
3540
|
label: "Base"
|
|
3241
3541
|
}
|
|
3242
3542
|
],
|
|
@@ -3247,72 +3547,15 @@ function registerSelect(loader) {
|
|
|
3247
3547
|
}
|
|
3248
3548
|
},
|
|
3249
3549
|
states: {
|
|
3250
|
-
|
|
3550
|
+
open: {
|
|
3251
3551
|
type: "writable",
|
|
3252
|
-
valueProp: "
|
|
3253
|
-
onChangeProp: "
|
|
3254
|
-
variableType: "
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3257
|
-
}, { trapsSelection: true }), {
|
|
3258
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
3259
|
-
importName: "AntdSelect"
|
|
3260
|
-
}));
|
|
3261
|
-
registerComponentHelper(loader, AntdOption, {
|
|
3262
|
-
name: "plasmic-antd5-option",
|
|
3263
|
-
displayName: "Option",
|
|
3264
|
-
parentComponentName: "plasmic-antd5-select",
|
|
3265
|
-
props: {
|
|
3266
|
-
children: __spreadValues$2({
|
|
3267
|
-
type: "slot",
|
|
3268
|
-
defaultValue: "Option"
|
|
3269
|
-
}, { mergeWithParent: true }),
|
|
3270
|
-
value: {
|
|
3271
|
-
type: "string"
|
|
3272
|
-
}
|
|
3273
|
-
},
|
|
3274
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
3275
|
-
importName: "AntdOption"
|
|
3276
|
-
});
|
|
3277
|
-
registerComponentHelper(loader, AntdOptionGroup, {
|
|
3278
|
-
name: "plasmic-antd5-option-group",
|
|
3279
|
-
displayName: "Option Group",
|
|
3280
|
-
parentComponentName: "plasmic-antd5-select",
|
|
3281
|
-
props: {
|
|
3282
|
-
children: {
|
|
3283
|
-
type: "slot",
|
|
3284
|
-
defaultValue: [
|
|
3285
|
-
{
|
|
3286
|
-
type: "component",
|
|
3287
|
-
name: "plasmic-antd5-option",
|
|
3288
|
-
props: {
|
|
3289
|
-
value: "option1",
|
|
3290
|
-
children: {
|
|
3291
|
-
type: "text",
|
|
3292
|
-
value: "Option 1"
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
},
|
|
3296
|
-
{
|
|
3297
|
-
type: "component",
|
|
3298
|
-
name: "plasmic-antd5-option",
|
|
3299
|
-
props: {
|
|
3300
|
-
value: "option2",
|
|
3301
|
-
children: {
|
|
3302
|
-
type: "text",
|
|
3303
|
-
value: "Option 1"
|
|
3304
|
-
}
|
|
3305
|
-
}
|
|
3306
|
-
}
|
|
3307
|
-
]
|
|
3308
|
-
},
|
|
3309
|
-
label: {
|
|
3310
|
-
type: "slot",
|
|
3311
|
-
defaultValue: "Group label"
|
|
3552
|
+
valueProp: "open",
|
|
3553
|
+
onChangeProp: "onOpenChange",
|
|
3554
|
+
variableType: "boolean"
|
|
3312
3555
|
}
|
|
3313
3556
|
},
|
|
3314
|
-
importPath: "@plasmicpkgs/antd5/skinny/
|
|
3315
|
-
importName: "
|
|
3557
|
+
importPath: "@plasmicpkgs/antd5/skinny/registerModal",
|
|
3558
|
+
importName: "AntdModal"
|
|
3316
3559
|
});
|
|
3317
3560
|
}
|
|
3318
3561
|
|
|
@@ -3774,6 +4017,7 @@ function registerAll(loader) {
|
|
|
3774
4017
|
registerSelect(loader);
|
|
3775
4018
|
registerTable(loader);
|
|
3776
4019
|
registerCheckbox(loader);
|
|
4020
|
+
registerSwitch(loader);
|
|
3777
4021
|
registerRadio(loader);
|
|
3778
4022
|
registerModal(loader);
|
|
3779
4023
|
registerButton(loader);
|
|
@@ -3789,6 +4033,21 @@ function registerAll(loader) {
|
|
|
3789
4033
|
registerNumberInput(loader);
|
|
3790
4034
|
registerUpload(loader);
|
|
3791
4035
|
}
|
|
4036
|
+
const componentNameToInputType = {
|
|
4037
|
+
[inputComponentName]: InputType.Text,
|
|
4038
|
+
[textAreaComponentName]: InputType.TextArea,
|
|
4039
|
+
[passwordComponentName]: InputType.Password,
|
|
4040
|
+
[inputNumberComponentName]: InputType.Number,
|
|
4041
|
+
[selectComponentName]: InputType.Select,
|
|
4042
|
+
[optionComponentName]: InputType.Option,
|
|
4043
|
+
[optionGroupComponentName]: InputType.OptionGroup,
|
|
4044
|
+
[radioComponentName]: InputType.Radio,
|
|
4045
|
+
[radioGroupComponentName]: InputType.RadioGroup,
|
|
4046
|
+
[checkboxComponentName]: InputType.Checkbox
|
|
4047
|
+
};
|
|
4048
|
+
const inputTypeToComponentName = Object.fromEntries(
|
|
4049
|
+
Object.entries(componentNameToInputType).reverse()
|
|
4050
|
+
);
|
|
3792
4051
|
|
|
3793
|
-
export { registerAll };
|
|
4052
|
+
export { InputType, buttonComponentName, componentNameToInputType, formComponentName, formGroupComponentName, formItemComponentName, formListComponentName, inputTypeToComponentName, registerAll };
|
|
3794
4053
|
//# sourceMappingURL=antd.esm.js.map
|