@plasmicpkgs/antd5 0.0.43 → 0.0.45
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/index.js +539 -384
- package/dist/index.js.map +1 -1
- package/dist/registerCheckbox.d.ts +1 -1
- package/dist/registerDropdown.d.ts +1 -1
- package/dist/registerForm.d.ts +3 -3
- package/dist/registerInput.d.ts +7 -7
- package/dist/registerMenu.d.ts +5 -5
- package/dist/registerModal.d.ts +1 -1
- package/dist/registerRadio.d.ts +4 -3
- package/dist/registerSelect.d.ts +1 -1
- package/dist/registerTable.d.ts +2 -2
- package/dist/registerUpload.d.ts +1 -1
- package/package.json +4 -5
- package/skinny/registerButton.js +2 -6
- package/skinny/registerButton.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +1 -1
- package/skinny/registerCheckbox.js +11 -9
- package/skinny/registerCheckbox.js.map +1 -1
- package/skinny/registerConfigProvider.js +268 -172
- package/skinny/registerConfigProvider.js.map +1 -1
- package/skinny/registerDropdown.d.ts +1 -1
- package/skinny/registerDropdown.js +13 -14
- package/skinny/registerDropdown.js.map +1 -1
- package/skinny/registerForm.d.ts +3 -3
- package/skinny/registerForm.js +130 -83
- package/skinny/registerForm.js.map +1 -1
- package/skinny/registerInput.d.ts +7 -7
- package/skinny/registerInput.js +7 -11
- package/skinny/registerInput.js.map +1 -1
- package/skinny/registerMenu.d.ts +5 -5
- package/skinny/registerMenu.js +6 -10
- package/skinny/registerMenu.js.map +1 -1
- package/skinny/registerModal.d.ts +1 -1
- package/skinny/registerModal.js +10 -8
- package/skinny/registerModal.js.map +1 -1
- package/skinny/registerRadio.d.ts +4 -3
- package/skinny/registerRadio.js +12 -11
- package/skinny/registerRadio.js.map +1 -1
- package/skinny/registerSelect.d.ts +1 -1
- package/skinny/registerSelect.js +11 -9
- package/skinny/registerSelect.js.map +1 -1
- package/skinny/registerTable.d.ts +2 -2
- package/skinny/registerTable.js +58 -48
- package/skinny/registerTable.js.map +1 -1
- package/skinny/registerUpload.d.ts +1 -1
- package/skinny/registerUpload.js +22 -17
- package/skinny/registerUpload.js.map +1 -1
- package/skinny/utils-9d88fffe.js.map +1 -1
- package/dist/antd.esm.js +0 -3188
- package/dist/antd.esm.js.map +0 -1
package/dist/antd.esm.js
DELETED
|
@@ -1,3188 +0,0 @@
|
|
|
1
|
-
import Button from 'antd/es/button';
|
|
2
|
-
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
3
|
-
import registerGlobalContext from '@plasmicapp/host/registerGlobalContext';
|
|
4
|
-
import Checkbox from 'antd/es/checkbox';
|
|
5
|
-
import CheckboxGroup from 'antd/es/checkbox/Group';
|
|
6
|
-
import React, { isValidElement, cloneElement } from 'react';
|
|
7
|
-
import { GlobalActionsProvider, usePlasmicCanvasContext, DataProvider, repeatedElement } from '@plasmicapp/host';
|
|
8
|
-
import registerToken from '@plasmicapp/host/registerToken';
|
|
9
|
-
import { addLoadingStateListener } from '@plasmicapp/query';
|
|
10
|
-
import ConfigProvider from 'antd/es/config-provider';
|
|
11
|
-
import enUS from 'antd/es/locale/en_US';
|
|
12
|
-
import useMessage from 'antd/es/message/useMessage';
|
|
13
|
-
import useNotification from 'antd/es/notification/useNotification';
|
|
14
|
-
import theme from 'antd/es/theme';
|
|
15
|
-
import Dropdown from 'antd/es/dropdown';
|
|
16
|
-
import Menu from 'antd/es/menu';
|
|
17
|
-
import Form from 'antd/es/form';
|
|
18
|
-
import FormItem from 'antd/es/form/FormItem';
|
|
19
|
-
import FormList from 'antd/es/form/FormList';
|
|
20
|
-
import equal from 'fast-deep-equal';
|
|
21
|
-
import classNames from 'classnames';
|
|
22
|
-
import Input from 'antd/es/input';
|
|
23
|
-
import InputNumber from 'antd/es/input-number';
|
|
24
|
-
import Modal from 'antd/es/modal';
|
|
25
|
-
import Radio from 'antd/es/radio';
|
|
26
|
-
import RadioGroup from 'antd/es/radio/group';
|
|
27
|
-
import 'antd/es/radio/radioButton';
|
|
28
|
-
import Select from 'antd/es/select';
|
|
29
|
-
import Table from 'antd/es/table';
|
|
30
|
-
import Upload from 'antd/es/upload';
|
|
31
|
-
|
|
32
|
-
function makeRegisterGlobalContext(component, meta) {
|
|
33
|
-
return function(loader) {
|
|
34
|
-
if (loader) {
|
|
35
|
-
loader.registerGlobalContext(component, meta);
|
|
36
|
-
} else {
|
|
37
|
-
registerGlobalContext(component, meta);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function registerComponentHelper(loader, component, meta) {
|
|
42
|
-
if (loader) {
|
|
43
|
-
loader.registerComponent(component, meta);
|
|
44
|
-
} else {
|
|
45
|
-
registerComponent(component, meta);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function traverseReactEltTree(children, callback) {
|
|
49
|
-
const rec = (elts) => {
|
|
50
|
-
(Array.isArray(elts) ? elts : [elts]).forEach((elt) => {
|
|
51
|
-
var _a;
|
|
52
|
-
if (elt) {
|
|
53
|
-
callback(elt);
|
|
54
|
-
if (elt.children) {
|
|
55
|
-
rec(elt.children);
|
|
56
|
-
}
|
|
57
|
-
if (((_a = elt.props) == null ? void 0 : _a.children) && elt.props.children !== elt.children) {
|
|
58
|
-
rec(elt.props.children);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
rec(children);
|
|
64
|
-
}
|
|
65
|
-
function asArray(x) {
|
|
66
|
-
if (Array.isArray(x)) {
|
|
67
|
-
return x;
|
|
68
|
-
} else if (x == null) {
|
|
69
|
-
return [];
|
|
70
|
-
} else {
|
|
71
|
-
return [x];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function omit(obj, ...keys) {
|
|
75
|
-
if (Object.keys(obj).length === 0) {
|
|
76
|
-
return obj;
|
|
77
|
-
}
|
|
78
|
-
const res = {};
|
|
79
|
-
for (const key of Object.keys(obj)) {
|
|
80
|
-
if (!keys.includes(key)) {
|
|
81
|
-
res[key] = obj[key];
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return res;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const AntdButton = Button;
|
|
88
|
-
function registerButton(loader) {
|
|
89
|
-
registerComponentHelper(loader, AntdButton, {
|
|
90
|
-
name: "plasmic-antd5-button",
|
|
91
|
-
displayName: "Button",
|
|
92
|
-
props: {
|
|
93
|
-
type: {
|
|
94
|
-
type: "choice",
|
|
95
|
-
options: ["default", "primary", "ghost", "dashed", "link", "text"],
|
|
96
|
-
description: "Can be set to primary, ghost, dashed, link, text, default",
|
|
97
|
-
defaultValueHint: "default"
|
|
98
|
-
},
|
|
99
|
-
size: {
|
|
100
|
-
type: "choice",
|
|
101
|
-
options: ["small", "medium", "large"],
|
|
102
|
-
description: "Set the size of button",
|
|
103
|
-
defaultValueHint: "medium"
|
|
104
|
-
},
|
|
105
|
-
shape: {
|
|
106
|
-
type: "choice",
|
|
107
|
-
options: ["default", "circle", "round"],
|
|
108
|
-
description: "Can be set button shape",
|
|
109
|
-
defaultValueHint: "default"
|
|
110
|
-
},
|
|
111
|
-
disabled: {
|
|
112
|
-
type: "boolean",
|
|
113
|
-
description: "Disabled state of button",
|
|
114
|
-
defaultValueHint: false
|
|
115
|
-
},
|
|
116
|
-
ghost: {
|
|
117
|
-
type: "boolean",
|
|
118
|
-
description: "Make background transparent and invert text and border colors",
|
|
119
|
-
defaultValueHint: false
|
|
120
|
-
},
|
|
121
|
-
danger: {
|
|
122
|
-
type: "boolean",
|
|
123
|
-
description: "Set the danger status of button",
|
|
124
|
-
defaultValueHint: false
|
|
125
|
-
},
|
|
126
|
-
loading: {
|
|
127
|
-
type: "boolean",
|
|
128
|
-
description: "Set the loading status of button",
|
|
129
|
-
defaultValueHint: false
|
|
130
|
-
},
|
|
131
|
-
href: {
|
|
132
|
-
type: "string",
|
|
133
|
-
description: "Redirect url of link button"
|
|
134
|
-
},
|
|
135
|
-
target: {
|
|
136
|
-
type: "choice",
|
|
137
|
-
options: ["_blank", "_self", "_parent", "_top"],
|
|
138
|
-
description: "Same as target attribute of a, works when href is specified",
|
|
139
|
-
hidden: (props) => !props.href,
|
|
140
|
-
defaultValueHint: "_self"
|
|
141
|
-
},
|
|
142
|
-
children: {
|
|
143
|
-
type: "slot",
|
|
144
|
-
defaultValue: [
|
|
145
|
-
{
|
|
146
|
-
type: "text",
|
|
147
|
-
value: "Button"
|
|
148
|
-
}
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
icon: {
|
|
152
|
-
type: "slot",
|
|
153
|
-
hidePlaceholder: true,
|
|
154
|
-
hidden: () => true
|
|
155
|
-
},
|
|
156
|
-
onClick: {
|
|
157
|
-
type: "eventHandler",
|
|
158
|
-
argTypes: []
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerButton",
|
|
162
|
-
importName: "AntdButton"
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
var __defProp$a = Object.defineProperty;
|
|
167
|
-
var __defProps$8 = Object.defineProperties;
|
|
168
|
-
var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
|
|
169
|
-
var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
|
|
170
|
-
var __hasOwnProp$a = Object.prototype.hasOwnProperty;
|
|
171
|
-
var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
|
|
172
|
-
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
173
|
-
var __spreadValues$a = (a, b) => {
|
|
174
|
-
for (var prop in b || (b = {}))
|
|
175
|
-
if (__hasOwnProp$a.call(b, prop))
|
|
176
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
177
|
-
if (__getOwnPropSymbols$a)
|
|
178
|
-
for (var prop of __getOwnPropSymbols$a(b)) {
|
|
179
|
-
if (__propIsEnum$a.call(b, prop))
|
|
180
|
-
__defNormalProp$a(a, prop, b[prop]);
|
|
181
|
-
}
|
|
182
|
-
return a;
|
|
183
|
-
};
|
|
184
|
-
var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
|
|
185
|
-
var __objRest$8 = (source, exclude) => {
|
|
186
|
-
var target = {};
|
|
187
|
-
for (var prop in source)
|
|
188
|
-
if (__hasOwnProp$a.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
189
|
-
target[prop] = source[prop];
|
|
190
|
-
if (source != null && __getOwnPropSymbols$a)
|
|
191
|
-
for (var prop of __getOwnPropSymbols$a(source)) {
|
|
192
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$a.call(source, prop))
|
|
193
|
-
target[prop] = source[prop];
|
|
194
|
-
}
|
|
195
|
-
return target;
|
|
196
|
-
};
|
|
197
|
-
function AntdCheckbox(props) {
|
|
198
|
-
const _a = props, { onChange } = _a, rest = __objRest$8(_a, ["onChange"]);
|
|
199
|
-
const wrappedOnChange = React.useMemo(() => {
|
|
200
|
-
if (onChange) {
|
|
201
|
-
return (event) => onChange(event.target.checked);
|
|
202
|
-
} else {
|
|
203
|
-
return void 0;
|
|
204
|
-
}
|
|
205
|
-
}, [onChange]);
|
|
206
|
-
return /* @__PURE__ */ React.createElement(Checkbox, __spreadProps$8(__spreadValues$a({}, rest), {
|
|
207
|
-
onChange: wrappedOnChange
|
|
208
|
-
}));
|
|
209
|
-
}
|
|
210
|
-
function registerCheckbox(loader) {
|
|
211
|
-
registerComponentHelper(loader, AntdCheckbox, {
|
|
212
|
-
name: "plasmic-antd5-checkbox",
|
|
213
|
-
displayName: "Checkbox",
|
|
214
|
-
props: {
|
|
215
|
-
checked: {
|
|
216
|
-
type: "boolean",
|
|
217
|
-
editOnly: true,
|
|
218
|
-
uncontrolledProp: "defaultChecked",
|
|
219
|
-
description: "Specifies the initial state: whether or not the checkbox is selected",
|
|
220
|
-
defaultValueHint: false
|
|
221
|
-
},
|
|
222
|
-
disabled: {
|
|
223
|
-
type: "boolean",
|
|
224
|
-
description: "If disable checkbox",
|
|
225
|
-
defaultValueHint: false
|
|
226
|
-
},
|
|
227
|
-
indeterminate: {
|
|
228
|
-
type: "boolean",
|
|
229
|
-
description: "The indeterminate checked state of checkbox",
|
|
230
|
-
defaultValueHint: false
|
|
231
|
-
},
|
|
232
|
-
value: {
|
|
233
|
-
type: "string",
|
|
234
|
-
description: "The checkbox value",
|
|
235
|
-
advanced: true
|
|
236
|
-
},
|
|
237
|
-
autoFocus: {
|
|
238
|
-
type: "boolean",
|
|
239
|
-
description: "If get focus when component mounted",
|
|
240
|
-
defaultValueHint: false,
|
|
241
|
-
advanced: true
|
|
242
|
-
},
|
|
243
|
-
children: {
|
|
244
|
-
type: "slot",
|
|
245
|
-
defaultValue: [
|
|
246
|
-
{
|
|
247
|
-
type: "text",
|
|
248
|
-
value: "Checkbox"
|
|
249
|
-
}
|
|
250
|
-
]
|
|
251
|
-
},
|
|
252
|
-
onChange: {
|
|
253
|
-
type: "eventHandler",
|
|
254
|
-
argTypes: [{ name: "checked", type: "boolean" }]
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
states: {
|
|
258
|
-
checked: {
|
|
259
|
-
type: "writable",
|
|
260
|
-
valueProp: "checked",
|
|
261
|
-
onChangeProp: "onChange",
|
|
262
|
-
variableType: "boolean"
|
|
263
|
-
}
|
|
264
|
-
},
|
|
265
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerCheckbox",
|
|
266
|
-
importName: "AntdCheckbox"
|
|
267
|
-
});
|
|
268
|
-
registerComponentHelper(loader, CheckboxGroup, {
|
|
269
|
-
name: "plasmic-antd5-checkbox-group",
|
|
270
|
-
displayName: "Checkbox Group",
|
|
271
|
-
props: {
|
|
272
|
-
value: {
|
|
273
|
-
type: "choice",
|
|
274
|
-
editOnly: true,
|
|
275
|
-
uncontrolledProp: "defaultValue",
|
|
276
|
-
description: "Default selected value",
|
|
277
|
-
multiSelect: true,
|
|
278
|
-
options: (ps) => {
|
|
279
|
-
const options = /* @__PURE__ */ new Set();
|
|
280
|
-
traverseReactEltTree(ps.children, (elt) => {
|
|
281
|
-
var _a;
|
|
282
|
-
if ((elt == null ? void 0 : elt.type) === AntdCheckbox && typeof ((_a = elt == null ? void 0 : elt.props) == null ? void 0 : _a.value) === "string") {
|
|
283
|
-
options.add(elt.props.value);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
return Array.from(options.keys());
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
disabled: {
|
|
290
|
-
type: "boolean",
|
|
291
|
-
description: "Disables all checkboxes",
|
|
292
|
-
defaultValueHint: false
|
|
293
|
-
},
|
|
294
|
-
children: {
|
|
295
|
-
type: "slot",
|
|
296
|
-
allowedComponents: ["plasmic-antd5-checkbox"]
|
|
297
|
-
},
|
|
298
|
-
onChange: {
|
|
299
|
-
type: "eventHandler",
|
|
300
|
-
argTypes: [{ name: "value", type: "object" }]
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
states: {
|
|
304
|
-
value: {
|
|
305
|
-
type: "writable",
|
|
306
|
-
valueProp: "value",
|
|
307
|
-
onChangeProp: "onChange",
|
|
308
|
-
variableType: "boolean"
|
|
309
|
-
}
|
|
310
|
-
},
|
|
311
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerCheckbox",
|
|
312
|
-
importName: "AntdCheckboxGroup",
|
|
313
|
-
parentComponentName: "plasmic-antd5-checkbox"
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
var __defProp$9 = Object.defineProperty;
|
|
318
|
-
var __defProps$7 = Object.defineProperties;
|
|
319
|
-
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
320
|
-
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
321
|
-
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
322
|
-
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
323
|
-
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
324
|
-
var __spreadValues$9 = (a, b) => {
|
|
325
|
-
for (var prop in b || (b = {}))
|
|
326
|
-
if (__hasOwnProp$9.call(b, prop))
|
|
327
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
328
|
-
if (__getOwnPropSymbols$9)
|
|
329
|
-
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
330
|
-
if (__propIsEnum$9.call(b, prop))
|
|
331
|
-
__defNormalProp$9(a, prop, b[prop]);
|
|
332
|
-
}
|
|
333
|
-
return a;
|
|
334
|
-
};
|
|
335
|
-
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
336
|
-
var __objRest$7 = (source, exclude) => {
|
|
337
|
-
var target = {};
|
|
338
|
-
for (var prop in source)
|
|
339
|
-
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
340
|
-
target[prop] = source[prop];
|
|
341
|
-
if (source != null && __getOwnPropSymbols$9)
|
|
342
|
-
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
343
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
344
|
-
target[prop] = source[prop];
|
|
345
|
-
}
|
|
346
|
-
return target;
|
|
347
|
-
};
|
|
348
|
-
function themeToAntdConfig(opts) {
|
|
349
|
-
const {
|
|
350
|
-
colorTextBase,
|
|
351
|
-
colorPrimary,
|
|
352
|
-
colorSuccess,
|
|
353
|
-
colorWarning,
|
|
354
|
-
colorInfo,
|
|
355
|
-
fontFamily,
|
|
356
|
-
fontSize,
|
|
357
|
-
lineWidth,
|
|
358
|
-
borderRadius,
|
|
359
|
-
controlHeight,
|
|
360
|
-
sizeUnit,
|
|
361
|
-
sizeStep,
|
|
362
|
-
wireframe
|
|
363
|
-
} = opts;
|
|
364
|
-
return {
|
|
365
|
-
theme: {
|
|
366
|
-
token: Object.fromEntries(Object.entries({
|
|
367
|
-
colorTextBase,
|
|
368
|
-
colorPrimary,
|
|
369
|
-
colorSuccess,
|
|
370
|
-
colorWarning,
|
|
371
|
-
colorInfo,
|
|
372
|
-
fontFamily,
|
|
373
|
-
fontSize,
|
|
374
|
-
lineWidth,
|
|
375
|
-
borderRadius,
|
|
376
|
-
controlHeight,
|
|
377
|
-
sizeUnit,
|
|
378
|
-
sizeStep,
|
|
379
|
-
wireframe
|
|
380
|
-
}).filter(([_key, val]) => !!val))
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
function AntdConfigProvider(props) {
|
|
385
|
-
const _a = props, { children, themeStyles } = _a, rest = __objRest$7(_a, ["children", "themeStyles"]);
|
|
386
|
-
return /* @__PURE__ */ React.createElement(ConfigProvider, __spreadValues$9({
|
|
387
|
-
locale: enUS
|
|
388
|
-
}, themeToAntdConfig(__spreadProps$7(__spreadValues$9({}, rest), {
|
|
389
|
-
fontFamily: themeStyles.fontFamily,
|
|
390
|
-
fontSize: themeStyles.fontSize ? parseInt(themeStyles.fontSize) : void 0,
|
|
391
|
-
lineHeight: themeStyles.lineHeight ? parseInt(themeStyles.lineHeight) : void 0,
|
|
392
|
-
colorTextBase: themeStyles.color
|
|
393
|
-
}))), /* @__PURE__ */ React.createElement(ForkedApp, null, /* @__PURE__ */ React.createElement(InnerConfigProvider, null, children)));
|
|
394
|
-
}
|
|
395
|
-
function normTokenValue(val) {
|
|
396
|
-
if (typeof val === "string") {
|
|
397
|
-
return val.trim();
|
|
398
|
-
} else if (typeof val === "number") {
|
|
399
|
-
return `${val}px`;
|
|
400
|
-
} else {
|
|
401
|
-
return val;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
function InnerConfigProvider(props) {
|
|
405
|
-
const { children } = props;
|
|
406
|
-
const { token } = theme.useToken();
|
|
407
|
-
const makeVarName = (name) => `--antd-${name}`;
|
|
408
|
-
const cssStyles = React.useMemo(() => `
|
|
409
|
-
:root {
|
|
410
|
-
${Object.entries(token).map(([key, val]) => `${makeVarName(key)}:${normTokenValue(val)};`).join("\n")}
|
|
411
|
-
}
|
|
412
|
-
`, [token]);
|
|
413
|
-
const app = useAppContext();
|
|
414
|
-
const actions = React.useMemo(() => ({
|
|
415
|
-
showNotification: (opts) => {
|
|
416
|
-
var _b;
|
|
417
|
-
const _a = opts, rest = __objRest$7(_a, ["type"]);
|
|
418
|
-
app.notification[(_b = opts.type) != null ? _b : "info"](__spreadValues$9({}, rest));
|
|
419
|
-
},
|
|
420
|
-
hideNotifications: () => {
|
|
421
|
-
app.notification.destroy();
|
|
422
|
-
}
|
|
423
|
-
}), [app]);
|
|
424
|
-
if (!GlobalActionsProvider) {
|
|
425
|
-
warnOutdatedDeps();
|
|
426
|
-
}
|
|
427
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", {
|
|
428
|
-
dangerouslySetInnerHTML: { __html: cssStyles }
|
|
429
|
-
}), GlobalActionsProvider ? /* @__PURE__ */ React.createElement(GlobalActionsProvider, {
|
|
430
|
-
contextName: "plasmic-antd5-config-provider",
|
|
431
|
-
actions
|
|
432
|
-
}, children) : children, /* @__PURE__ */ React.createElement(GlobalLoadingIndicator, null));
|
|
433
|
-
}
|
|
434
|
-
let warned = false;
|
|
435
|
-
function warnOutdatedDeps() {
|
|
436
|
-
if (!warned) {
|
|
437
|
-
console.log(`You are using a version of @plasmicapp/* that is too old. Please upgrade to the latest version.`);
|
|
438
|
-
warned = true;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
function GlobalLoadingIndicator() {
|
|
442
|
-
const app = useAppContext();
|
|
443
|
-
React.useEffect(() => {
|
|
444
|
-
if (addLoadingStateListener) {
|
|
445
|
-
return addLoadingStateListener((isLoading) => {
|
|
446
|
-
if (isLoading) {
|
|
447
|
-
app.message.open({
|
|
448
|
-
content: "Loading...",
|
|
449
|
-
duration: 0,
|
|
450
|
-
key: `plasmic-antd5-global-loading-indicator`
|
|
451
|
-
});
|
|
452
|
-
} else {
|
|
453
|
-
app.message.destroy(`plasmic-antd5-global-loading-indicator`);
|
|
454
|
-
}
|
|
455
|
-
}, { immediate: true });
|
|
456
|
-
} else {
|
|
457
|
-
warnOutdatedDeps();
|
|
458
|
-
return () => {
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
}, [app]);
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
const ForkedAppContext = React.createContext(void 0);
|
|
465
|
-
function useAppContext() {
|
|
466
|
-
const context = React.useContext(ForkedAppContext);
|
|
467
|
-
if (!context) {
|
|
468
|
-
throw new Error("Must call useAppContext from under ForkedApp");
|
|
469
|
-
}
|
|
470
|
-
return context;
|
|
471
|
-
}
|
|
472
|
-
function ForkedApp(props) {
|
|
473
|
-
const [messageApi, messageContextHolder] = useMessage();
|
|
474
|
-
const [notificationApi, notificationContextHolder] = useNotification();
|
|
475
|
-
const appContext = React.useMemo(() => ({
|
|
476
|
-
message: messageApi,
|
|
477
|
-
notification: notificationApi
|
|
478
|
-
}), [messageApi, notificationApi]);
|
|
479
|
-
return /* @__PURE__ */ React.createElement(ForkedAppContext.Provider, {
|
|
480
|
-
value: appContext
|
|
481
|
-
}, messageContextHolder, notificationContextHolder, props.children);
|
|
482
|
-
}
|
|
483
|
-
function registerTokens(loader) {
|
|
484
|
-
const regs = [];
|
|
485
|
-
const withoutPrefix = (name, prefix) => {
|
|
486
|
-
if (!prefix) {
|
|
487
|
-
return name;
|
|
488
|
-
}
|
|
489
|
-
const index = name.indexOf(prefix);
|
|
490
|
-
return index === 0 ? name.substring(prefix.length) : name;
|
|
491
|
-
};
|
|
492
|
-
function makeNiceName(name) {
|
|
493
|
-
name = name[0].toUpperCase() + name.substring(1);
|
|
494
|
-
return name.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
495
|
-
}
|
|
496
|
-
const makeGenericToken = (name, type, removePrefix) => {
|
|
497
|
-
const tokenName = Array.isArray(name) ? name[0] : name;
|
|
498
|
-
const displayName = Array.isArray(name) ? name[1] : makeNiceName(withoutPrefix(name, removePrefix));
|
|
499
|
-
return {
|
|
500
|
-
name: tokenName,
|
|
501
|
-
displayName: `System: ${displayName}`,
|
|
502
|
-
value: `var(--antd-${tokenName})`,
|
|
503
|
-
type
|
|
504
|
-
};
|
|
505
|
-
};
|
|
506
|
-
const colorTokens = [
|
|
507
|
-
"colorPrimary",
|
|
508
|
-
"colorSuccess",
|
|
509
|
-
"colorWarning",
|
|
510
|
-
"colorError",
|
|
511
|
-
"colorInfo",
|
|
512
|
-
"colorText",
|
|
513
|
-
"colorTextSecondary",
|
|
514
|
-
"colorTextTertiary",
|
|
515
|
-
"colorTextQuaternary",
|
|
516
|
-
"colorBorder",
|
|
517
|
-
"colorBorderSecondary",
|
|
518
|
-
"colorFill",
|
|
519
|
-
"colorFillSecondary",
|
|
520
|
-
"colorFillTertiary",
|
|
521
|
-
"colorFillQuaternary",
|
|
522
|
-
"colorBgLayout",
|
|
523
|
-
"colorBgContainer",
|
|
524
|
-
"colorBgElevated",
|
|
525
|
-
"colorBgSpotlight",
|
|
526
|
-
"colorPrimaryBg",
|
|
527
|
-
"colorPrimaryBgHover",
|
|
528
|
-
"colorPrimaryBorder",
|
|
529
|
-
"colorPrimaryBorderHover",
|
|
530
|
-
"colorPrimaryHover",
|
|
531
|
-
"colorPrimaryActive",
|
|
532
|
-
"colorPrimaryTextHover",
|
|
533
|
-
"colorPrimaryText",
|
|
534
|
-
"colorPrimaryTextActive",
|
|
535
|
-
"colorSuccessBg",
|
|
536
|
-
"colorSuccessBgHover",
|
|
537
|
-
"colorSuccessBorder",
|
|
538
|
-
"colorSuccessBorderHover",
|
|
539
|
-
"colorSuccessHover",
|
|
540
|
-
"colorSuccessActive",
|
|
541
|
-
"colorSuccessTextHover",
|
|
542
|
-
"colorSuccessText",
|
|
543
|
-
"colorSuccessTextActive",
|
|
544
|
-
"colorWarningBg",
|
|
545
|
-
"colorWarningBgHover",
|
|
546
|
-
"colorWarningBorder",
|
|
547
|
-
"colorWarningBorderHover",
|
|
548
|
-
"colorWarningHover",
|
|
549
|
-
"colorWarningActive",
|
|
550
|
-
"colorWarningTextHover",
|
|
551
|
-
"colorWarningText",
|
|
552
|
-
"colorWarningTextActive",
|
|
553
|
-
"colorInfoBg",
|
|
554
|
-
"colorInfoBgHover",
|
|
555
|
-
"colorInfoBorder",
|
|
556
|
-
"colorInfoBorderHover",
|
|
557
|
-
"colorInfoHover",
|
|
558
|
-
"colorInfoActive",
|
|
559
|
-
"colorInfoTextHover",
|
|
560
|
-
"colorInfoText",
|
|
561
|
-
"colorInfoTextActive",
|
|
562
|
-
"colorErrorBg",
|
|
563
|
-
"colorErrorBgHover",
|
|
564
|
-
"colorErrorBorder",
|
|
565
|
-
"colorErrorBorderHover",
|
|
566
|
-
"colorErrorHover",
|
|
567
|
-
"colorErrorActive",
|
|
568
|
-
"colorErrorTextHover",
|
|
569
|
-
"colorErrorText",
|
|
570
|
-
"colorErrorTextActive",
|
|
571
|
-
"colorWhite",
|
|
572
|
-
"colorBgMask",
|
|
573
|
-
"colorIcon",
|
|
574
|
-
"colorIconHover",
|
|
575
|
-
"colorLink",
|
|
576
|
-
"colorLinkHover"
|
|
577
|
-
];
|
|
578
|
-
colorTokens.forEach((name) => regs.push(makeGenericToken(name, "color", "color")));
|
|
579
|
-
const spacingTokens = [
|
|
580
|
-
"paddingXXS",
|
|
581
|
-
"paddingXS",
|
|
582
|
-
"paddingSM",
|
|
583
|
-
["padding", "Padding M"],
|
|
584
|
-
"paddingMD",
|
|
585
|
-
"paddingLG",
|
|
586
|
-
"paddingXL",
|
|
587
|
-
"marginXXS",
|
|
588
|
-
"marginXS",
|
|
589
|
-
"marginSM",
|
|
590
|
-
["margin", "Margin M"],
|
|
591
|
-
"marginMD",
|
|
592
|
-
"marginLG",
|
|
593
|
-
"marginXL",
|
|
594
|
-
"marginXXL"
|
|
595
|
-
];
|
|
596
|
-
spacingTokens.forEach((token) => regs.push(makeGenericToken(token, "spacing")));
|
|
597
|
-
const fontSizeTokens = [
|
|
598
|
-
["fontSize", "M"],
|
|
599
|
-
"fontSizeSM",
|
|
600
|
-
"fontSizeLG",
|
|
601
|
-
"fontSizeXL",
|
|
602
|
-
"fontSizeHeading1",
|
|
603
|
-
"fontSizeHeading2",
|
|
604
|
-
"fontSizeHeading3",
|
|
605
|
-
"fontSizeHeading4",
|
|
606
|
-
"fontSizeHeading5"
|
|
607
|
-
];
|
|
608
|
-
fontSizeTokens.forEach((token) => regs.push(makeGenericToken(token, "font-size", "fontSize")));
|
|
609
|
-
const lineHeightTokens = [
|
|
610
|
-
["lineHeight", "M"],
|
|
611
|
-
"lineHeightLG",
|
|
612
|
-
"lineHeightSM",
|
|
613
|
-
"lineHeightHeading1",
|
|
614
|
-
"lineHeightHeading2",
|
|
615
|
-
"lineHeightHeading3",
|
|
616
|
-
"lineHeightHeading4",
|
|
617
|
-
"lineHeightHeading5"
|
|
618
|
-
];
|
|
619
|
-
lineHeightTokens.forEach((token) => regs.push(makeGenericToken(token, "line-height", "lineHeight")));
|
|
620
|
-
if (loader) {
|
|
621
|
-
regs.forEach((t) => loader.registerToken(t));
|
|
622
|
-
} else {
|
|
623
|
-
regs.forEach((t) => registerToken(t));
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
const registerConfigProvider = makeRegisterGlobalContext(AntdConfigProvider, __spreadProps$7(__spreadValues$9({
|
|
627
|
-
name: "plasmic-antd5-config-provider",
|
|
628
|
-
displayName: "Ant Design System Settings",
|
|
629
|
-
props: {
|
|
630
|
-
colorPrimary: {
|
|
631
|
-
type: "color",
|
|
632
|
-
defaultValue: "#1677ff"
|
|
633
|
-
},
|
|
634
|
-
colorSuccess: {
|
|
635
|
-
type: "color",
|
|
636
|
-
defaultValue: "#52c41a"
|
|
637
|
-
},
|
|
638
|
-
colorWarning: {
|
|
639
|
-
type: "color",
|
|
640
|
-
defaultValue: "#faad14"
|
|
641
|
-
},
|
|
642
|
-
colorError: {
|
|
643
|
-
type: "color",
|
|
644
|
-
defaultValue: "#ff4d4f"
|
|
645
|
-
},
|
|
646
|
-
colorInfo: {
|
|
647
|
-
type: "color",
|
|
648
|
-
defaultValue: "#1677ff"
|
|
649
|
-
},
|
|
650
|
-
colorBgBase: {
|
|
651
|
-
type: "color",
|
|
652
|
-
defaultValue: "#ffffff"
|
|
653
|
-
},
|
|
654
|
-
lineWidth: {
|
|
655
|
-
type: "number",
|
|
656
|
-
defaultValue: 1
|
|
657
|
-
},
|
|
658
|
-
borderRadius: {
|
|
659
|
-
type: "number",
|
|
660
|
-
defaultValue: 6
|
|
661
|
-
},
|
|
662
|
-
controlHeight: {
|
|
663
|
-
type: "number",
|
|
664
|
-
defaultValue: 32
|
|
665
|
-
},
|
|
666
|
-
sizeUnit: {
|
|
667
|
-
type: "number",
|
|
668
|
-
defaultValue: 4
|
|
669
|
-
},
|
|
670
|
-
sizeStep: {
|
|
671
|
-
type: "number",
|
|
672
|
-
defaultValue: 4
|
|
673
|
-
},
|
|
674
|
-
wireframe: {
|
|
675
|
-
type: "boolean",
|
|
676
|
-
defaultValue: false
|
|
677
|
-
},
|
|
678
|
-
themeStyles: {
|
|
679
|
-
type: "themeStyles"
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}, {
|
|
683
|
-
unstable__globalActions: {
|
|
684
|
-
showNotification: {
|
|
685
|
-
displayName: "Show notification",
|
|
686
|
-
parameters: {
|
|
687
|
-
type: {
|
|
688
|
-
type: "choice",
|
|
689
|
-
options: ["success", "error", "info", "warning"],
|
|
690
|
-
defaultValue: "info"
|
|
691
|
-
},
|
|
692
|
-
message: {
|
|
693
|
-
type: "string",
|
|
694
|
-
defaultValue: "A message for you!"
|
|
695
|
-
},
|
|
696
|
-
description: {
|
|
697
|
-
type: "string",
|
|
698
|
-
defaultValue: "Would you like to learn more?"
|
|
699
|
-
},
|
|
700
|
-
duration: {
|
|
701
|
-
type: "number",
|
|
702
|
-
defaultValueHint: 5
|
|
703
|
-
},
|
|
704
|
-
placement: {
|
|
705
|
-
type: "choice",
|
|
706
|
-
options: [
|
|
707
|
-
"top",
|
|
708
|
-
"topLeft",
|
|
709
|
-
"topRight",
|
|
710
|
-
"bottom",
|
|
711
|
-
"bottomLeft",
|
|
712
|
-
"bottomRight"
|
|
713
|
-
],
|
|
714
|
-
defaultValueHint: "topRight"
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
},
|
|
718
|
-
hideNotifications: {
|
|
719
|
-
displayName: "Hide notifications"
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
}), {
|
|
723
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerConfigProvider",
|
|
724
|
-
importName: "AntdConfigProvider"
|
|
725
|
-
}));
|
|
726
|
-
|
|
727
|
-
var __defProp$8 = Object.defineProperty;
|
|
728
|
-
var __defProps$6 = Object.defineProperties;
|
|
729
|
-
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
730
|
-
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
731
|
-
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
732
|
-
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
733
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
734
|
-
var __spreadValues$8 = (a, b) => {
|
|
735
|
-
for (var prop in b || (b = {}))
|
|
736
|
-
if (__hasOwnProp$8.call(b, prop))
|
|
737
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
738
|
-
if (__getOwnPropSymbols$8)
|
|
739
|
-
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
740
|
-
if (__propIsEnum$8.call(b, prop))
|
|
741
|
-
__defNormalProp$8(a, prop, b[prop]);
|
|
742
|
-
}
|
|
743
|
-
return a;
|
|
744
|
-
};
|
|
745
|
-
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
746
|
-
var __objRest$6 = (source, exclude) => {
|
|
747
|
-
var target = {};
|
|
748
|
-
for (var prop in source)
|
|
749
|
-
if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
750
|
-
target[prop] = source[prop];
|
|
751
|
-
if (source != null && __getOwnPropSymbols$8)
|
|
752
|
-
for (var prop of __getOwnPropSymbols$8(source)) {
|
|
753
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
|
|
754
|
-
target[prop] = source[prop];
|
|
755
|
-
}
|
|
756
|
-
return target;
|
|
757
|
-
};
|
|
758
|
-
function AntdDropdown(props) {
|
|
759
|
-
const _a = props, { children, onAction, menuItems } = _a, rest = __objRest$6(_a, ["children", "onAction", "menuItems"]);
|
|
760
|
-
return /* @__PURE__ */ React.createElement(Dropdown, __spreadProps$6(__spreadValues$8({}, rest), {
|
|
761
|
-
overlay: () => {
|
|
762
|
-
var _a2;
|
|
763
|
-
const items = (_a2 = menuItems == null ? void 0 : menuItems()) != null ? _a2 : [];
|
|
764
|
-
return /* @__PURE__ */ React.createElement(Menu, {
|
|
765
|
-
onClick: (event) => onAction == null ? void 0 : onAction(event.key)
|
|
766
|
-
}, items);
|
|
767
|
-
}
|
|
768
|
-
}), typeof children === "string" ? /* @__PURE__ */ React.createElement("div", null, children) : children);
|
|
769
|
-
}
|
|
770
|
-
function registerDropdown(loader) {
|
|
771
|
-
registerComponentHelper(loader, AntdDropdown, {
|
|
772
|
-
name: "plasmic-antd5-dropdown",
|
|
773
|
-
displayName: "Dropdown",
|
|
774
|
-
props: {
|
|
775
|
-
open: {
|
|
776
|
-
type: "boolean",
|
|
777
|
-
description: "Toggle visibility of dropdown menu in Plasmic Editor",
|
|
778
|
-
editOnly: true,
|
|
779
|
-
uncontrolledProp: "fakeOpen",
|
|
780
|
-
defaultValueHint: false
|
|
781
|
-
},
|
|
782
|
-
disabled: {
|
|
783
|
-
type: "boolean",
|
|
784
|
-
description: "Whether the dropdown menu is disabled",
|
|
785
|
-
defaultValueHint: false
|
|
786
|
-
},
|
|
787
|
-
arrow: {
|
|
788
|
-
type: "boolean",
|
|
789
|
-
description: "Whether the dropdown arrow should be visible",
|
|
790
|
-
defaultValueHint: false,
|
|
791
|
-
advanced: true
|
|
792
|
-
},
|
|
793
|
-
placement: {
|
|
794
|
-
type: "choice",
|
|
795
|
-
options: [
|
|
796
|
-
"bottomLeft",
|
|
797
|
-
"bottomCenter",
|
|
798
|
-
"bottomRight",
|
|
799
|
-
"topLeft",
|
|
800
|
-
"topCenter",
|
|
801
|
-
"topRight"
|
|
802
|
-
],
|
|
803
|
-
description: "Placement of popup menu",
|
|
804
|
-
defaultValueHint: "bottomLeft",
|
|
805
|
-
advanced: true
|
|
806
|
-
},
|
|
807
|
-
menuItems: {
|
|
808
|
-
type: "slot",
|
|
809
|
-
allowedComponents: [
|
|
810
|
-
"plasmic-antd5-menu-item",
|
|
811
|
-
"plasmic-antd5-menu-item-group",
|
|
812
|
-
"plasmic-antd5-menu-divider",
|
|
813
|
-
"plasmic-antd5-submenu"
|
|
814
|
-
],
|
|
815
|
-
defaultValue: [
|
|
816
|
-
{
|
|
817
|
-
type: "component",
|
|
818
|
-
name: "plasmic-antd5-menu-item",
|
|
819
|
-
props: {
|
|
820
|
-
key: "menu-item-1"
|
|
821
|
-
}
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
type: "component",
|
|
825
|
-
name: "plasmic-antd5-menu-item",
|
|
826
|
-
props: {
|
|
827
|
-
key: "menu-item-2"
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
],
|
|
831
|
-
renderPropParams: []
|
|
832
|
-
},
|
|
833
|
-
trigger: {
|
|
834
|
-
type: "choice",
|
|
835
|
-
options: ["click", "hover", "contextMenu"],
|
|
836
|
-
description: "The trigger mode which executes the dropdown action",
|
|
837
|
-
defaultValueHint: "hover"
|
|
838
|
-
},
|
|
839
|
-
children: {
|
|
840
|
-
type: "slot",
|
|
841
|
-
defaultValue: [
|
|
842
|
-
{
|
|
843
|
-
type: "component",
|
|
844
|
-
name: "plasmic-antd5-button",
|
|
845
|
-
props: {
|
|
846
|
-
children: {
|
|
847
|
-
type: "text",
|
|
848
|
-
value: "Dropdown"
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
]
|
|
853
|
-
},
|
|
854
|
-
onAction: {
|
|
855
|
-
type: "eventHandler",
|
|
856
|
-
argTypes: [{ name: "key", type: "string" }]
|
|
857
|
-
}
|
|
858
|
-
},
|
|
859
|
-
importPath: "@plasmicpkgs/antd/skinny/registerDropdown",
|
|
860
|
-
importName: "AntdDropdown"
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
var __defProp$7 = Object.defineProperty;
|
|
865
|
-
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
866
|
-
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
867
|
-
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
868
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
869
|
-
var __spreadValues$7 = (a, b) => {
|
|
870
|
-
for (var prop in b || (b = {}))
|
|
871
|
-
if (__hasOwnProp$7.call(b, prop))
|
|
872
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
873
|
-
if (__getOwnPropSymbols$7)
|
|
874
|
-
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
875
|
-
if (__propIsEnum$7.call(b, prop))
|
|
876
|
-
__defNormalProp$7(a, prop, b[prop]);
|
|
877
|
-
}
|
|
878
|
-
return a;
|
|
879
|
-
};
|
|
880
|
-
const isBrowser = typeof window !== "undefined";
|
|
881
|
-
const NONE = Symbol("NONE");
|
|
882
|
-
isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
883
|
-
function mergeProps(props, ...restProps) {
|
|
884
|
-
if (restProps.every((rest) => Object.keys(rest).length === 0)) {
|
|
885
|
-
return props;
|
|
886
|
-
}
|
|
887
|
-
const result = __spreadValues$7({}, props);
|
|
888
|
-
for (const rest of restProps) {
|
|
889
|
-
for (const key of Object.keys(rest)) {
|
|
890
|
-
result[key] = mergePropVals(key, result[key], rest[key]);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
return result;
|
|
894
|
-
}
|
|
895
|
-
function updateRef(ref, value) {
|
|
896
|
-
if (!ref) {
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
if (typeof ref === "function") {
|
|
900
|
-
ref(value);
|
|
901
|
-
} else {
|
|
902
|
-
if (!Object.isFrozen(ref)) {
|
|
903
|
-
ref.current = value;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function mergeRefs(...refs) {
|
|
908
|
-
return (value) => {
|
|
909
|
-
for (const ref of refs) {
|
|
910
|
-
updateRef(ref, value);
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
}
|
|
914
|
-
function mergePropVals(name, val1, val2) {
|
|
915
|
-
if (val1 === NONE || val2 === NONE) {
|
|
916
|
-
return null;
|
|
917
|
-
} else if (val1 == null) {
|
|
918
|
-
return val2;
|
|
919
|
-
} else if (val2 == null) {
|
|
920
|
-
return val1;
|
|
921
|
-
} else if (name === "className") {
|
|
922
|
-
return classNames(val1, val2);
|
|
923
|
-
} else if (name === "style") {
|
|
924
|
-
return __spreadValues$7(__spreadValues$7({}, val1), val2);
|
|
925
|
-
} else if (name === "ref") {
|
|
926
|
-
return mergeRefs(val1, val2);
|
|
927
|
-
} else if (typeof val1 !== typeof val2) {
|
|
928
|
-
return val2;
|
|
929
|
-
} else if (name.startsWith("on") && typeof val1 === "function") {
|
|
930
|
-
return (...args) => {
|
|
931
|
-
let res;
|
|
932
|
-
if (typeof val1 === "function") {
|
|
933
|
-
res = val1(...args);
|
|
934
|
-
}
|
|
935
|
-
if (typeof val2 === "function") {
|
|
936
|
-
res = val2(...args);
|
|
937
|
-
}
|
|
938
|
-
return res;
|
|
939
|
-
};
|
|
940
|
-
} else {
|
|
941
|
-
return val2;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
var __defProp$6 = Object.defineProperty;
|
|
946
|
-
var __defProps$5 = Object.defineProperties;
|
|
947
|
-
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
948
|
-
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
949
|
-
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
950
|
-
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
951
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
952
|
-
var __spreadValues$6 = (a, b) => {
|
|
953
|
-
for (var prop in b || (b = {}))
|
|
954
|
-
if (__hasOwnProp$6.call(b, prop))
|
|
955
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
956
|
-
if (__getOwnPropSymbols$6)
|
|
957
|
-
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
958
|
-
if (__propIsEnum$6.call(b, prop))
|
|
959
|
-
__defNormalProp$6(a, prop, b[prop]);
|
|
960
|
-
}
|
|
961
|
-
return a;
|
|
962
|
-
};
|
|
963
|
-
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
964
|
-
var __objRest$5 = (source, exclude) => {
|
|
965
|
-
var target = {};
|
|
966
|
-
for (var prop in source)
|
|
967
|
-
if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
968
|
-
target[prop] = source[prop];
|
|
969
|
-
if (source != null && __getOwnPropSymbols$6)
|
|
970
|
-
for (var prop of __getOwnPropSymbols$6(source)) {
|
|
971
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
|
|
972
|
-
target[prop] = source[prop];
|
|
973
|
-
}
|
|
974
|
-
return target;
|
|
975
|
-
};
|
|
976
|
-
const PathContext = React.createContext({ relativePath: [], fullPath: [] });
|
|
977
|
-
const InternalFormInstanceContext = React.createContext(void 0);
|
|
978
|
-
const Internal = (props) => {
|
|
979
|
-
var _a, _b;
|
|
980
|
-
const [form] = Form.useForm();
|
|
981
|
-
const values = form.getFieldsValue(true);
|
|
982
|
-
const lastValue = React.useRef(values);
|
|
983
|
-
const childrenNode = typeof props.children === "function" ? props.children(values, form) : props.children;
|
|
984
|
-
const fireOnValuesChange = () => {
|
|
985
|
-
var _a2;
|
|
986
|
-
const values2 = form.getFieldsValue(true);
|
|
987
|
-
if (!equal(values2, lastValue.current)) {
|
|
988
|
-
(_a2 = props.extendedOnValuesChange) == null ? void 0 : _a2.call(props, values2);
|
|
989
|
-
lastValue.current = values2;
|
|
990
|
-
}
|
|
991
|
-
};
|
|
992
|
-
React.useEffect(() => {
|
|
993
|
-
fireOnValuesChange();
|
|
994
|
-
}, []);
|
|
995
|
-
return /* @__PURE__ */ React.createElement(InternalFormInstanceContext.Provider, {
|
|
996
|
-
value: {
|
|
997
|
-
fireOnValuesChange,
|
|
998
|
-
forceRemount: () => props.setRemountKey((k) => k + 1),
|
|
999
|
-
formProps: props
|
|
1000
|
-
}
|
|
1001
|
-
}, /* @__PURE__ */ React.createElement(Form, __spreadProps$5(__spreadValues$6({}, props), {
|
|
1002
|
-
onValuesChange: (...args) => {
|
|
1003
|
-
var _a2, _b2;
|
|
1004
|
-
(_a2 = props.onValuesChange) == null ? void 0 : _a2.call(props, ...args);
|
|
1005
|
-
(_b2 = props.extendedOnValuesChange) == null ? void 0 : _b2.call(props, args[1]);
|
|
1006
|
-
},
|
|
1007
|
-
form,
|
|
1008
|
-
labelCol: ((_a = props.labelCol) == null ? void 0 : _a.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.labelCol,
|
|
1009
|
-
wrapperCol: ((_b = props.wrapperCol) == null ? void 0 : _b.horizontalOnly) && props.layout !== "horizontal" ? void 0 : props.wrapperCol
|
|
1010
|
-
}), /* @__PURE__ */ React.createElement("style", null, `
|
|
1011
|
-
.ant-form-item-explain + div, .ant-form-item-margin-offset {
|
|
1012
|
-
display: none;
|
|
1013
|
-
}
|
|
1014
|
-
`), childrenNode));
|
|
1015
|
-
};
|
|
1016
|
-
function FormWrapper(props) {
|
|
1017
|
-
const [remountKey, setRemountKey] = React.useState(0);
|
|
1018
|
-
return /* @__PURE__ */ React.createElement(Internal, __spreadProps$5(__spreadValues$6({
|
|
1019
|
-
key: remountKey
|
|
1020
|
-
}, props), {
|
|
1021
|
-
setRemountKey
|
|
1022
|
-
}));
|
|
1023
|
-
}
|
|
1024
|
-
const COMMON_ACTIONS = [
|
|
1025
|
-
{
|
|
1026
|
-
type: "button-action",
|
|
1027
|
-
label: "Append new Form Item",
|
|
1028
|
-
onClick: ({ studioOps }) => {
|
|
1029
|
-
studioOps.appendToSlot({
|
|
1030
|
-
type: "component",
|
|
1031
|
-
name: "plasmic-antd5-form-item"
|
|
1032
|
-
}, "children");
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
];
|
|
1036
|
-
function registerForm(loader) {
|
|
1037
|
-
const colProp = (displayName, defaultValue) => ({
|
|
1038
|
-
type: "object",
|
|
1039
|
-
displayName,
|
|
1040
|
-
advanced: true,
|
|
1041
|
-
fields: {
|
|
1042
|
-
span: {
|
|
1043
|
-
type: "number",
|
|
1044
|
-
displayName: "Grid columns",
|
|
1045
|
-
description: "The number of grid columns to span (24 columns available)",
|
|
1046
|
-
min: 1,
|
|
1047
|
-
max: 24
|
|
1048
|
-
},
|
|
1049
|
-
offset: {
|
|
1050
|
-
type: "number",
|
|
1051
|
-
displayName: "Offset columns",
|
|
1052
|
-
description: "Number of grid columns to skip from the left",
|
|
1053
|
-
min: 0,
|
|
1054
|
-
max: 23
|
|
1055
|
-
},
|
|
1056
|
-
horizontalOnly: {
|
|
1057
|
-
type: "boolean",
|
|
1058
|
-
displayName: "Horizontal only",
|
|
1059
|
-
description: "Only apply to horizontal layout"
|
|
1060
|
-
}
|
|
1061
|
-
},
|
|
1062
|
-
defaultValue
|
|
1063
|
-
});
|
|
1064
|
-
registerComponentHelper(loader, FormWrapper, {
|
|
1065
|
-
name: "plasmic-antd5-form",
|
|
1066
|
-
displayName: "Form",
|
|
1067
|
-
defaultStyles: {
|
|
1068
|
-
display: "plasmic-content-layout",
|
|
1069
|
-
gridRowGap: "10px"
|
|
1070
|
-
},
|
|
1071
|
-
props: {
|
|
1072
|
-
children: {
|
|
1073
|
-
type: "slot",
|
|
1074
|
-
defaultValue: [
|
|
1075
|
-
{
|
|
1076
|
-
type: "component",
|
|
1077
|
-
name: "plasmic-antd5-form-item",
|
|
1078
|
-
props: {
|
|
1079
|
-
label: {
|
|
1080
|
-
type: "text",
|
|
1081
|
-
value: "Name"
|
|
1082
|
-
},
|
|
1083
|
-
name: "name",
|
|
1084
|
-
children: {
|
|
1085
|
-
type: "component",
|
|
1086
|
-
name: "plasmic-antd5-input"
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
},
|
|
1090
|
-
{
|
|
1091
|
-
type: "component",
|
|
1092
|
-
name: "plasmic-antd5-form-item",
|
|
1093
|
-
props: {
|
|
1094
|
-
label: {
|
|
1095
|
-
type: "text",
|
|
1096
|
-
value: "Message"
|
|
1097
|
-
},
|
|
1098
|
-
name: "message",
|
|
1099
|
-
children: {
|
|
1100
|
-
type: "component",
|
|
1101
|
-
name: "plasmic-antd5-textarea"
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
},
|
|
1105
|
-
{
|
|
1106
|
-
type: "component",
|
|
1107
|
-
name: "plasmic-antd5-button",
|
|
1108
|
-
props: {
|
|
1109
|
-
children: {
|
|
1110
|
-
type: "text",
|
|
1111
|
-
value: "Submit"
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
]
|
|
1116
|
-
},
|
|
1117
|
-
initialValues: {
|
|
1118
|
-
type: "object",
|
|
1119
|
-
forceRemount: true
|
|
1120
|
-
},
|
|
1121
|
-
layout: {
|
|
1122
|
-
type: "choice",
|
|
1123
|
-
options: ["horizontal", "vertical", "inline"],
|
|
1124
|
-
defaultValue: "vertical"
|
|
1125
|
-
},
|
|
1126
|
-
labelAlign: {
|
|
1127
|
-
type: "choice",
|
|
1128
|
-
options: ["left", "right"],
|
|
1129
|
-
defaultValueHint: "right",
|
|
1130
|
-
advanced: true
|
|
1131
|
-
},
|
|
1132
|
-
labelCol: colProp("Label layout", {
|
|
1133
|
-
span: 8,
|
|
1134
|
-
horizontalOnly: true
|
|
1135
|
-
}),
|
|
1136
|
-
wrapperCol: colProp("Field layout", {
|
|
1137
|
-
span: 16,
|
|
1138
|
-
horizontalOnly: true
|
|
1139
|
-
}),
|
|
1140
|
-
colon: {
|
|
1141
|
-
type: "boolean",
|
|
1142
|
-
description: `Show a colon after the label by default (only for horizontal layout)`,
|
|
1143
|
-
defaultValueHint: true,
|
|
1144
|
-
advanced: true
|
|
1145
|
-
},
|
|
1146
|
-
requiredMark: {
|
|
1147
|
-
displayName: "Required/optional mark",
|
|
1148
|
-
type: "choice",
|
|
1149
|
-
options: [
|
|
1150
|
-
{
|
|
1151
|
-
value: "optional",
|
|
1152
|
-
label: "Indicate optional fields"
|
|
1153
|
-
},
|
|
1154
|
-
{
|
|
1155
|
-
value: true,
|
|
1156
|
-
label: "Indicate required fields with asterisk"
|
|
1157
|
-
},
|
|
1158
|
-
{
|
|
1159
|
-
value: false,
|
|
1160
|
-
label: "Show no indicators"
|
|
1161
|
-
}
|
|
1162
|
-
],
|
|
1163
|
-
advanced: true,
|
|
1164
|
-
defaultValueHint: true
|
|
1165
|
-
},
|
|
1166
|
-
extendedOnValuesChange: {
|
|
1167
|
-
type: "eventHandler",
|
|
1168
|
-
displayName: "On values change",
|
|
1169
|
-
argTypes: [
|
|
1170
|
-
{
|
|
1171
|
-
name: "changedValues",
|
|
1172
|
-
type: "object"
|
|
1173
|
-
},
|
|
1174
|
-
{
|
|
1175
|
-
name: "allValues",
|
|
1176
|
-
type: "object"
|
|
1177
|
-
}
|
|
1178
|
-
]
|
|
1179
|
-
},
|
|
1180
|
-
onFinish: {
|
|
1181
|
-
type: "eventHandler",
|
|
1182
|
-
displayName: "On submit",
|
|
1183
|
-
argTypes: [
|
|
1184
|
-
{
|
|
1185
|
-
name: "values",
|
|
1186
|
-
type: "object"
|
|
1187
|
-
}
|
|
1188
|
-
]
|
|
1189
|
-
},
|
|
1190
|
-
onFinishFailed: {
|
|
1191
|
-
type: "eventHandler",
|
|
1192
|
-
displayName: "On invalid submit",
|
|
1193
|
-
argTypes: [
|
|
1194
|
-
{
|
|
1195
|
-
name: "data",
|
|
1196
|
-
type: "object"
|
|
1197
|
-
}
|
|
1198
|
-
]
|
|
1199
|
-
},
|
|
1200
|
-
validateTrigger: {
|
|
1201
|
-
type: "choice",
|
|
1202
|
-
options: ["onSubmit", "onChange", "onBlur"],
|
|
1203
|
-
multiSelect: true,
|
|
1204
|
-
defaultValueHint: ["onChange"],
|
|
1205
|
-
advanced: true
|
|
1206
|
-
}
|
|
1207
|
-
},
|
|
1208
|
-
actions: COMMON_ACTIONS,
|
|
1209
|
-
states: {
|
|
1210
|
-
value: {
|
|
1211
|
-
type: "readonly",
|
|
1212
|
-
variableType: "object",
|
|
1213
|
-
onChangeProp: "extendedOnValuesChange"
|
|
1214
|
-
}
|
|
1215
|
-
},
|
|
1216
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
1217
|
-
importName: "FormWrapper"
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
function plasmicRulesToAntdRules(plasmicRules) {
|
|
1221
|
-
var _a, _b, _c;
|
|
1222
|
-
const rules = [];
|
|
1223
|
-
for (const plasmicRule of plasmicRules) {
|
|
1224
|
-
switch (plasmicRule.ruleType) {
|
|
1225
|
-
case "enum":
|
|
1226
|
-
rules.push({
|
|
1227
|
-
type: "enum",
|
|
1228
|
-
enum: (_b = (_a = plasmicRule.options) == null ? void 0 : _a.map((opt) => opt.value)) != null ? _b : [],
|
|
1229
|
-
message: plasmicRule.message
|
|
1230
|
-
});
|
|
1231
|
-
break;
|
|
1232
|
-
case "required":
|
|
1233
|
-
rules.push({
|
|
1234
|
-
required: true,
|
|
1235
|
-
message: plasmicRule.message
|
|
1236
|
-
});
|
|
1237
|
-
break;
|
|
1238
|
-
case "regex":
|
|
1239
|
-
rules.push({
|
|
1240
|
-
pattern: new RegExp((_c = plasmicRule.pattern) != null ? _c : ""),
|
|
1241
|
-
message: plasmicRule.message
|
|
1242
|
-
});
|
|
1243
|
-
break;
|
|
1244
|
-
case "whitespace":
|
|
1245
|
-
rules.push({
|
|
1246
|
-
whitespace: true,
|
|
1247
|
-
message: plasmicRule.message
|
|
1248
|
-
});
|
|
1249
|
-
break;
|
|
1250
|
-
case "min":
|
|
1251
|
-
case "max":
|
|
1252
|
-
rules.push({
|
|
1253
|
-
[plasmicRule.ruleType]: plasmicRule.length,
|
|
1254
|
-
message: plasmicRule.message
|
|
1255
|
-
});
|
|
1256
|
-
break;
|
|
1257
|
-
case "advanced":
|
|
1258
|
-
rules.push({
|
|
1259
|
-
validator: (...args) => {
|
|
1260
|
-
var _a2;
|
|
1261
|
-
return ((_a2 = plasmicRule.custom) == null ? void 0 : _a2.apply(null, args)) ? Promise.resolve() : Promise.reject();
|
|
1262
|
-
},
|
|
1263
|
-
message: plasmicRule.message
|
|
1264
|
-
});
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
return rules;
|
|
1268
|
-
}
|
|
1269
|
-
const useFormItemRelativeName = (name) => {
|
|
1270
|
-
const pathCtx = React.useContext(PathContext);
|
|
1271
|
-
return typeof name === "object" ? [...pathCtx.relativePath, ...name] : typeof name === "string" ? [...pathCtx.relativePath, name] : void 0;
|
|
1272
|
-
};
|
|
1273
|
-
const useFormItemFullName = (name) => {
|
|
1274
|
-
const pathCtx = React.useContext(PathContext);
|
|
1275
|
-
return typeof name === "object" ? [...pathCtx.fullPath, ...name] : typeof name === "string" ? [...pathCtx.fullPath, name] : void 0;
|
|
1276
|
-
};
|
|
1277
|
-
function useFormInstanceMaybe() {
|
|
1278
|
-
return Form.useFormInstance();
|
|
1279
|
-
}
|
|
1280
|
-
function FormItemWrapper(props) {
|
|
1281
|
-
var _a, _b;
|
|
1282
|
-
const relativeFormItemName = useFormItemRelativeName(props.name);
|
|
1283
|
-
const fullFormItemName = useFormItemFullName(props.name);
|
|
1284
|
-
const rules = props.rules ? plasmicRulesToAntdRules(props.rules) : void 0;
|
|
1285
|
-
const inCanvas = !!usePlasmicCanvasContext();
|
|
1286
|
-
if (inCanvas) {
|
|
1287
|
-
const form = useFormInstanceMaybe();
|
|
1288
|
-
const prevPropValues = React.useRef({
|
|
1289
|
-
initialValue: props.initialValue,
|
|
1290
|
-
name: props.name
|
|
1291
|
-
});
|
|
1292
|
-
const internalFormCtx = React.useContext(InternalFormInstanceContext);
|
|
1293
|
-
const { fireOnValuesChange, forceRemount } = internalFormCtx != null ? internalFormCtx : {};
|
|
1294
|
-
(_a = props.setControlContextData) == null ? void 0 : _a.call(props, {
|
|
1295
|
-
internalFormCtx
|
|
1296
|
-
});
|
|
1297
|
-
React.useEffect(() => {
|
|
1298
|
-
if (prevPropValues.current.name !== props.name) {
|
|
1299
|
-
forceRemount == null ? void 0 : forceRemount();
|
|
1300
|
-
}
|
|
1301
|
-
if (!fullFormItemName || (form == null ? void 0 : form.getFieldValue(fullFormItemName)) !== prevPropValues.current.initialValue) {
|
|
1302
|
-
return;
|
|
1303
|
-
}
|
|
1304
|
-
form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
|
|
1305
|
-
prevPropValues.current.initialValue = props.initialValue;
|
|
1306
|
-
fireOnValuesChange == null ? void 0 : fireOnValuesChange();
|
|
1307
|
-
}, [form, props.initialValue, fullFormItemName]);
|
|
1308
|
-
}
|
|
1309
|
-
return /* @__PURE__ */ React.createElement(FormItem, __spreadValues$6(__spreadProps$5(__spreadValues$6({}, omit(props, "rules")), {
|
|
1310
|
-
label: props.noLabel ? void 0 : props.label,
|
|
1311
|
-
name: relativeFormItemName,
|
|
1312
|
-
rules
|
|
1313
|
-
}), props.helpTextMode === "extra" ? { extra: props.help } : props.helpTextMode === "help" ? { help: (_b = props.help) != null ? _b : "" } : {}), props.customizeProps ? /* @__PURE__ */ React.createElement(FormItemForwarder, {
|
|
1314
|
-
formItemProps: props
|
|
1315
|
-
}) : props.children);
|
|
1316
|
-
}
|
|
1317
|
-
function FormItemForwarder(_a) {
|
|
1318
|
-
var _b = _a, { formItemProps } = _b, props = __objRest$5(_b, ["formItemProps"]);
|
|
1319
|
-
var _a2;
|
|
1320
|
-
const status = Form.Item.useStatus();
|
|
1321
|
-
const internalFormCtx = React.useContext(InternalFormInstanceContext);
|
|
1322
|
-
const data = {
|
|
1323
|
-
status: status.status
|
|
1324
|
-
};
|
|
1325
|
-
(_a2 = props.setControlContextData) == null ? void 0 : _a2.call(props, {
|
|
1326
|
-
internalFormCtx,
|
|
1327
|
-
status
|
|
1328
|
-
});
|
|
1329
|
-
return React.Children.map(formItemProps.children, (child, i) => {
|
|
1330
|
-
var _a3;
|
|
1331
|
-
const baseProps = __spreadValues$6(__spreadValues$6({}, (_a3 = child.props) != null ? _a3 : {}), props);
|
|
1332
|
-
return i === 0 && isValidElement(child) ? cloneElement(child, mergeProps(baseProps, formItemProps.customizeProps(data, baseProps))) : child;
|
|
1333
|
-
});
|
|
1334
|
-
}
|
|
1335
|
-
function registerFormItem(loader) {
|
|
1336
|
-
registerComponentHelper(loader, FormItemWrapper, {
|
|
1337
|
-
name: "plasmic-antd5-form-item",
|
|
1338
|
-
displayName: "Form Item",
|
|
1339
|
-
parentComponentName: "plasmic-antd5-form",
|
|
1340
|
-
props: {
|
|
1341
|
-
label: {
|
|
1342
|
-
type: "slot",
|
|
1343
|
-
defaultValue: {
|
|
1344
|
-
type: "text",
|
|
1345
|
-
value: "Label"
|
|
1346
|
-
}
|
|
1347
|
-
},
|
|
1348
|
-
children: {
|
|
1349
|
-
type: "slot",
|
|
1350
|
-
defaultValue: {
|
|
1351
|
-
type: "component",
|
|
1352
|
-
name: "plasmic-antd5-input"
|
|
1353
|
-
}
|
|
1354
|
-
},
|
|
1355
|
-
name: {
|
|
1356
|
-
type: "string"
|
|
1357
|
-
},
|
|
1358
|
-
initialValue: {
|
|
1359
|
-
type: "string"
|
|
1360
|
-
},
|
|
1361
|
-
rules: {
|
|
1362
|
-
type: "formValidationRules"
|
|
1363
|
-
},
|
|
1364
|
-
noLabel: {
|
|
1365
|
-
type: "boolean",
|
|
1366
|
-
advanced: true
|
|
1367
|
-
},
|
|
1368
|
-
colon: {
|
|
1369
|
-
type: "boolean",
|
|
1370
|
-
defaultValueHint: (_ps, ctx) => {
|
|
1371
|
-
var _a, _b;
|
|
1372
|
-
return (_b = (_a = ctx == null ? void 0 : ctx.internalFormCtx) == null ? void 0 : _a.formProps.colon) != null ? _b : true;
|
|
1373
|
-
},
|
|
1374
|
-
advanced: true
|
|
1375
|
-
},
|
|
1376
|
-
labelAlign: {
|
|
1377
|
-
type: "choice",
|
|
1378
|
-
options: ["left", "right"],
|
|
1379
|
-
advanced: true
|
|
1380
|
-
},
|
|
1381
|
-
hidden: {
|
|
1382
|
-
type: "boolean",
|
|
1383
|
-
advanced: true
|
|
1384
|
-
},
|
|
1385
|
-
validateTrigger: {
|
|
1386
|
-
type: "choice",
|
|
1387
|
-
options: ["onSubmit", "onChange", "onBlur"],
|
|
1388
|
-
multiSelect: true,
|
|
1389
|
-
advanced: true
|
|
1390
|
-
},
|
|
1391
|
-
shouldUpdate: {
|
|
1392
|
-
type: "boolean",
|
|
1393
|
-
advanced: true,
|
|
1394
|
-
displayName: "Always re-render",
|
|
1395
|
-
description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
|
|
1396
|
-
},
|
|
1397
|
-
dependencies: {
|
|
1398
|
-
type: "array",
|
|
1399
|
-
advanced: true,
|
|
1400
|
-
displayName: "Dependencies",
|
|
1401
|
-
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
1402
|
-
},
|
|
1403
|
-
helpTextMode: {
|
|
1404
|
-
type: "choice",
|
|
1405
|
-
displayName: "Help text",
|
|
1406
|
-
options: [
|
|
1407
|
-
{
|
|
1408
|
-
value: "errors",
|
|
1409
|
-
label: "Validation errors"
|
|
1410
|
-
},
|
|
1411
|
-
{
|
|
1412
|
-
value: "extra",
|
|
1413
|
-
label: "Custom help text and validation errors"
|
|
1414
|
-
},
|
|
1415
|
-
{
|
|
1416
|
-
value: "help",
|
|
1417
|
-
label: "Custom help text, no validation errors"
|
|
1418
|
-
}
|
|
1419
|
-
],
|
|
1420
|
-
defaultValueHint: "Show validation errors",
|
|
1421
|
-
description: "What to show in the help text. Edit help text by editing the 'help' slot in the outline."
|
|
1422
|
-
},
|
|
1423
|
-
help: {
|
|
1424
|
-
type: "slot",
|
|
1425
|
-
hidden: (ps) => {
|
|
1426
|
-
var _a;
|
|
1427
|
-
return !["extra", "help"].includes((_a = ps.helpTextMode) != null ? _a : "");
|
|
1428
|
-
},
|
|
1429
|
-
hidePlaceholder: true
|
|
1430
|
-
},
|
|
1431
|
-
customizeProps: {
|
|
1432
|
-
type: "function",
|
|
1433
|
-
description: "Customize the props passed into the wrapped field component. Takes the current status ('success', 'warning', 'error', or 'validating').)",
|
|
1434
|
-
argNames: ["fieldData"],
|
|
1435
|
-
argValues: (_ps, ctx) => {
|
|
1436
|
-
var _a;
|
|
1437
|
-
return [
|
|
1438
|
-
{
|
|
1439
|
-
status: (_a = ctx == null ? void 0 : ctx.status) == null ? void 0 : _a.status
|
|
1440
|
-
}
|
|
1441
|
-
];
|
|
1442
|
-
},
|
|
1443
|
-
advanced: true
|
|
1444
|
-
},
|
|
1445
|
-
noStyle: {
|
|
1446
|
-
type: "boolean",
|
|
1447
|
-
displayName: "Field only",
|
|
1448
|
-
description: "Don't render anything but the wrapped field component - so no label, help text, validation error, etc.",
|
|
1449
|
-
advanced: true
|
|
1450
|
-
}
|
|
1451
|
-
},
|
|
1452
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
1453
|
-
importName: "FormItemWrapper"
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
function FormGroup(props) {
|
|
1457
|
-
const pathCtx = React.useContext(PathContext);
|
|
1458
|
-
return /* @__PURE__ */ React.createElement(PathContext.Provider, {
|
|
1459
|
-
value: {
|
|
1460
|
-
relativePath: [...pathCtx.relativePath, props.name],
|
|
1461
|
-
fullPath: [...pathCtx.fullPath, props.name]
|
|
1462
|
-
}
|
|
1463
|
-
}, props.children);
|
|
1464
|
-
}
|
|
1465
|
-
function registerFormGroup(loader) {
|
|
1466
|
-
registerComponentHelper(loader, FormGroup, {
|
|
1467
|
-
name: "plasmic-antd5-form-group",
|
|
1468
|
-
displayName: "Form Group",
|
|
1469
|
-
parentComponentName: "plasmic-antd5-form",
|
|
1470
|
-
actions: COMMON_ACTIONS,
|
|
1471
|
-
props: {
|
|
1472
|
-
name: {
|
|
1473
|
-
type: "string"
|
|
1474
|
-
},
|
|
1475
|
-
children: {
|
|
1476
|
-
type: "slot"
|
|
1477
|
-
}
|
|
1478
|
-
},
|
|
1479
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
1480
|
-
importName: "FormGroup"
|
|
1481
|
-
});
|
|
1482
|
-
}
|
|
1483
|
-
const FormListWrapper = React.forwardRef(function FormListWrapper2(props, ref) {
|
|
1484
|
-
var _a;
|
|
1485
|
-
const relativeFormItemName = useFormItemRelativeName(props.name);
|
|
1486
|
-
const fullFormItemName = useFormItemFullName(props.name);
|
|
1487
|
-
const operationsRef = React.useRef(void 0);
|
|
1488
|
-
React.useImperativeHandle(ref, () => ({
|
|
1489
|
-
add(defaultValue, insertIndex) {
|
|
1490
|
-
if (operationsRef.current) {
|
|
1491
|
-
const { add } = operationsRef.current[1];
|
|
1492
|
-
add(defaultValue, insertIndex);
|
|
1493
|
-
}
|
|
1494
|
-
},
|
|
1495
|
-
remove(index) {
|
|
1496
|
-
if (operationsRef.current) {
|
|
1497
|
-
const { remove } = operationsRef.current[1];
|
|
1498
|
-
remove(index);
|
|
1499
|
-
}
|
|
1500
|
-
},
|
|
1501
|
-
move(from, to) {
|
|
1502
|
-
if (operationsRef.current) {
|
|
1503
|
-
const { move } = operationsRef.current[1];
|
|
1504
|
-
move(from, to);
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
}), [operationsRef]);
|
|
1508
|
-
const inCanvas = !!usePlasmicCanvasContext();
|
|
1509
|
-
if (inCanvas) {
|
|
1510
|
-
const form = useFormInstanceMaybe();
|
|
1511
|
-
const prevPropValues = React.useRef({
|
|
1512
|
-
initialValue: props.initialValue,
|
|
1513
|
-
name: props.name
|
|
1514
|
-
});
|
|
1515
|
-
const { fireOnValuesChange, forceRemount } = (_a = React.useContext(InternalFormInstanceContext)) != null ? _a : {};
|
|
1516
|
-
React.useEffect(() => {
|
|
1517
|
-
if (prevPropValues.current.name !== props.name) {
|
|
1518
|
-
forceRemount == null ? void 0 : forceRemount();
|
|
1519
|
-
}
|
|
1520
|
-
if (fullFormItemName) {
|
|
1521
|
-
form == null ? void 0 : form.setFieldValue(fullFormItemName, props.initialValue);
|
|
1522
|
-
prevPropValues.current.initialValue = props.initialValue;
|
|
1523
|
-
fireOnValuesChange == null ? void 0 : fireOnValuesChange();
|
|
1524
|
-
}
|
|
1525
|
-
}, [props.initialValue, fullFormItemName]);
|
|
1526
|
-
}
|
|
1527
|
-
return /* @__PURE__ */ React.createElement(FormList, __spreadProps$5(__spreadValues$6({}, props), {
|
|
1528
|
-
name: relativeFormItemName != null ? relativeFormItemName : []
|
|
1529
|
-
}), (...args) => {
|
|
1530
|
-
operationsRef.current = args;
|
|
1531
|
-
return args[0].map((field, index) => /* @__PURE__ */ React.createElement(PathContext.Provider, {
|
|
1532
|
-
value: {
|
|
1533
|
-
relativePath: [field.name],
|
|
1534
|
-
fullPath: [...fullFormItemName != null ? fullFormItemName : [], field.name]
|
|
1535
|
-
}
|
|
1536
|
-
}, /* @__PURE__ */ React.createElement(DataProvider, {
|
|
1537
|
-
name: "currentField",
|
|
1538
|
-
data: field
|
|
1539
|
-
}, /* @__PURE__ */ React.createElement(DataProvider, {
|
|
1540
|
-
name: "currentFieldIndex",
|
|
1541
|
-
data: index
|
|
1542
|
-
}, repeatedElement(index, props.children)))));
|
|
1543
|
-
});
|
|
1544
|
-
});
|
|
1545
|
-
function registerFormList(loader) {
|
|
1546
|
-
registerComponentHelper(loader, FormListWrapper, {
|
|
1547
|
-
name: "plasmic-antd5-form-list",
|
|
1548
|
-
parentComponentName: "plasmic-antd5-form",
|
|
1549
|
-
displayName: "Form List",
|
|
1550
|
-
actions: COMMON_ACTIONS,
|
|
1551
|
-
props: {
|
|
1552
|
-
children: {
|
|
1553
|
-
type: "slot",
|
|
1554
|
-
defaultValue: [
|
|
1555
|
-
{
|
|
1556
|
-
type: "hbox",
|
|
1557
|
-
children: [
|
|
1558
|
-
{
|
|
1559
|
-
type: "component",
|
|
1560
|
-
name: "plasmic-antd5-form-item",
|
|
1561
|
-
props: {
|
|
1562
|
-
name: "firstName",
|
|
1563
|
-
label: {
|
|
1564
|
-
type: "text",
|
|
1565
|
-
value: "First name"
|
|
1566
|
-
},
|
|
1567
|
-
children: {
|
|
1568
|
-
type: "component",
|
|
1569
|
-
name: "plasmic-antd5-input"
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
},
|
|
1573
|
-
{
|
|
1574
|
-
type: "component",
|
|
1575
|
-
name: "plasmic-antd5-form-item",
|
|
1576
|
-
props: {
|
|
1577
|
-
name: "lastName",
|
|
1578
|
-
label: {
|
|
1579
|
-
type: "text",
|
|
1580
|
-
value: "Last name"
|
|
1581
|
-
},
|
|
1582
|
-
children: {
|
|
1583
|
-
type: "component",
|
|
1584
|
-
name: "plasmic-antd5-input"
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
]
|
|
1589
|
-
}
|
|
1590
|
-
]
|
|
1591
|
-
},
|
|
1592
|
-
name: {
|
|
1593
|
-
type: "string",
|
|
1594
|
-
defaultValue: "guests"
|
|
1595
|
-
},
|
|
1596
|
-
initialValue: {
|
|
1597
|
-
type: "array",
|
|
1598
|
-
defaultValue: [
|
|
1599
|
-
{
|
|
1600
|
-
firstName: "Jane",
|
|
1601
|
-
lastName: "Doe"
|
|
1602
|
-
},
|
|
1603
|
-
{
|
|
1604
|
-
firstName: "John",
|
|
1605
|
-
lastName: "Smith"
|
|
1606
|
-
}
|
|
1607
|
-
]
|
|
1608
|
-
}
|
|
1609
|
-
},
|
|
1610
|
-
unstable__refActions: {
|
|
1611
|
-
add: {
|
|
1612
|
-
displayName: "Add an item",
|
|
1613
|
-
parameters: [
|
|
1614
|
-
{
|
|
1615
|
-
name: "defaultValue",
|
|
1616
|
-
displayName: "Default value",
|
|
1617
|
-
type: "object"
|
|
1618
|
-
},
|
|
1619
|
-
{
|
|
1620
|
-
name: "insertIndex",
|
|
1621
|
-
displayName: "Insert index",
|
|
1622
|
-
type: "number"
|
|
1623
|
-
}
|
|
1624
|
-
]
|
|
1625
|
-
},
|
|
1626
|
-
remove: {
|
|
1627
|
-
displayName: "Remove an item",
|
|
1628
|
-
parameters: [
|
|
1629
|
-
{
|
|
1630
|
-
name: "index",
|
|
1631
|
-
displayName: "Index",
|
|
1632
|
-
type: "number"
|
|
1633
|
-
}
|
|
1634
|
-
]
|
|
1635
|
-
},
|
|
1636
|
-
move: {
|
|
1637
|
-
displayName: "Move field",
|
|
1638
|
-
parameters: [
|
|
1639
|
-
{
|
|
1640
|
-
name: "from",
|
|
1641
|
-
displayName: "From",
|
|
1642
|
-
type: "number"
|
|
1643
|
-
},
|
|
1644
|
-
{
|
|
1645
|
-
name: "to",
|
|
1646
|
-
displayName: "To",
|
|
1647
|
-
type: "number"
|
|
1648
|
-
}
|
|
1649
|
-
]
|
|
1650
|
-
}
|
|
1651
|
-
},
|
|
1652
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerForm",
|
|
1653
|
-
importName: "FormListWrapper"
|
|
1654
|
-
});
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
var __defProp$5 = Object.defineProperty;
|
|
1658
|
-
var __defProps$4 = Object.defineProperties;
|
|
1659
|
-
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
1660
|
-
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
1661
|
-
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
1662
|
-
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
1663
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1664
|
-
var __spreadValues$5 = (a, b) => {
|
|
1665
|
-
for (var prop in b || (b = {}))
|
|
1666
|
-
if (__hasOwnProp$5.call(b, prop))
|
|
1667
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1668
|
-
if (__getOwnPropSymbols$5)
|
|
1669
|
-
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
1670
|
-
if (__propIsEnum$5.call(b, prop))
|
|
1671
|
-
__defNormalProp$5(a, prop, b[prop]);
|
|
1672
|
-
}
|
|
1673
|
-
return a;
|
|
1674
|
-
};
|
|
1675
|
-
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
1676
|
-
const AntdInput = Input;
|
|
1677
|
-
const AntdTextArea = Input.TextArea;
|
|
1678
|
-
const AntdPassword = Input.Password;
|
|
1679
|
-
const AntdInputNumber = InputNumber;
|
|
1680
|
-
const inputHelpers = {
|
|
1681
|
-
states: {
|
|
1682
|
-
value: {
|
|
1683
|
-
onChangeArgsToValue: (e) => {
|
|
1684
|
-
return e.target.value;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
}
|
|
1688
|
-
};
|
|
1689
|
-
const COMMON_HELPERS_CONFIG = {
|
|
1690
|
-
helpers: inputHelpers,
|
|
1691
|
-
importName: "inputHelpers",
|
|
1692
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput"
|
|
1693
|
-
};
|
|
1694
|
-
const COMMON_STATES = {
|
|
1695
|
-
value: {
|
|
1696
|
-
type: "writable",
|
|
1697
|
-
valueProp: "value",
|
|
1698
|
-
variableType: "text",
|
|
1699
|
-
onChangeProp: "onChange"
|
|
1700
|
-
}
|
|
1701
|
-
};
|
|
1702
|
-
const COMMON_DECORATOR_PROPS = {
|
|
1703
|
-
prefix: {
|
|
1704
|
-
type: "slot",
|
|
1705
|
-
hidePlaceholder: true
|
|
1706
|
-
},
|
|
1707
|
-
suffix: {
|
|
1708
|
-
type: "slot",
|
|
1709
|
-
hidePlaceholder: true
|
|
1710
|
-
},
|
|
1711
|
-
addonAfter: {
|
|
1712
|
-
type: "slot",
|
|
1713
|
-
hidePlaceholder: true
|
|
1714
|
-
},
|
|
1715
|
-
addonBefore: {
|
|
1716
|
-
type: "slot",
|
|
1717
|
-
hidePlaceholder: true
|
|
1718
|
-
}
|
|
1719
|
-
};
|
|
1720
|
-
const COMMON_ADVANCED_PROPS = {
|
|
1721
|
-
maxLength: {
|
|
1722
|
-
type: "number",
|
|
1723
|
-
advanced: true
|
|
1724
|
-
},
|
|
1725
|
-
bordered: {
|
|
1726
|
-
type: "boolean",
|
|
1727
|
-
advanced: true,
|
|
1728
|
-
defaultValueHint: true
|
|
1729
|
-
},
|
|
1730
|
-
allowClear: {
|
|
1731
|
-
type: "boolean",
|
|
1732
|
-
advanced: true
|
|
1733
|
-
},
|
|
1734
|
-
autoFocus: {
|
|
1735
|
-
type: "boolean",
|
|
1736
|
-
advanced: true
|
|
1737
|
-
},
|
|
1738
|
-
readOnly: {
|
|
1739
|
-
type: "boolean",
|
|
1740
|
-
advanced: true
|
|
1741
|
-
}
|
|
1742
|
-
};
|
|
1743
|
-
const COMMON_EVENT_HANDLERS = {
|
|
1744
|
-
onChange: {
|
|
1745
|
-
type: "eventHandler",
|
|
1746
|
-
argTypes: [
|
|
1747
|
-
{
|
|
1748
|
-
name: "event",
|
|
1749
|
-
type: "object"
|
|
1750
|
-
}
|
|
1751
|
-
]
|
|
1752
|
-
},
|
|
1753
|
-
onPressEnter: {
|
|
1754
|
-
type: "eventHandler",
|
|
1755
|
-
argTypes: [
|
|
1756
|
-
{
|
|
1757
|
-
name: "event",
|
|
1758
|
-
type: "object"
|
|
1759
|
-
}
|
|
1760
|
-
]
|
|
1761
|
-
}
|
|
1762
|
-
};
|
|
1763
|
-
function registerInput(loader) {
|
|
1764
|
-
registerComponentHelper(loader, AntdInput, {
|
|
1765
|
-
name: "plasmic-antd5-input",
|
|
1766
|
-
displayName: "Input",
|
|
1767
|
-
props: __spreadValues$5(__spreadValues$5(__spreadValues$5({
|
|
1768
|
-
value: {
|
|
1769
|
-
type: "string"
|
|
1770
|
-
},
|
|
1771
|
-
placholder: {
|
|
1772
|
-
type: "string"
|
|
1773
|
-
},
|
|
1774
|
-
size: {
|
|
1775
|
-
type: "choice",
|
|
1776
|
-
options: ["large", "middle", "small"]
|
|
1777
|
-
},
|
|
1778
|
-
disabled: {
|
|
1779
|
-
type: "boolean"
|
|
1780
|
-
}
|
|
1781
|
-
}, COMMON_ADVANCED_PROPS), COMMON_DECORATOR_PROPS), COMMON_EVENT_HANDLERS),
|
|
1782
|
-
states: __spreadValues$5({}, COMMON_STATES),
|
|
1783
|
-
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
1784
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1785
|
-
importName: "AntdInput"
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
function registerTextArea(loader) {
|
|
1789
|
-
registerComponentHelper(loader, AntdTextArea, {
|
|
1790
|
-
name: "plasmic-antd5-textarea",
|
|
1791
|
-
parentComponentName: "plasmic-antd5-input",
|
|
1792
|
-
displayName: "Text Area",
|
|
1793
|
-
props: __spreadValues$5({
|
|
1794
|
-
value: {
|
|
1795
|
-
type: "string"
|
|
1796
|
-
},
|
|
1797
|
-
placholder: {
|
|
1798
|
-
type: "string"
|
|
1799
|
-
},
|
|
1800
|
-
disabled: {
|
|
1801
|
-
type: "boolean"
|
|
1802
|
-
},
|
|
1803
|
-
maxLength: {
|
|
1804
|
-
type: "number",
|
|
1805
|
-
advanced: true
|
|
1806
|
-
},
|
|
1807
|
-
bordered: {
|
|
1808
|
-
type: "boolean",
|
|
1809
|
-
advanced: true,
|
|
1810
|
-
defaultValueHint: true
|
|
1811
|
-
}
|
|
1812
|
-
}, COMMON_EVENT_HANDLERS),
|
|
1813
|
-
states: __spreadValues$5({}, COMMON_STATES),
|
|
1814
|
-
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
1815
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1816
|
-
importName: "AntdTextArea"
|
|
1817
|
-
});
|
|
1818
|
-
}
|
|
1819
|
-
function registerPasswordInput(loader) {
|
|
1820
|
-
registerComponentHelper(loader, AntdPassword, {
|
|
1821
|
-
name: "plasmic-antd5-input-password",
|
|
1822
|
-
parentComponentName: "plasmic-antd5-input",
|
|
1823
|
-
displayName: "Password Input",
|
|
1824
|
-
props: __spreadValues$5({
|
|
1825
|
-
value: {
|
|
1826
|
-
type: "string"
|
|
1827
|
-
},
|
|
1828
|
-
placholder: {
|
|
1829
|
-
type: "string"
|
|
1830
|
-
},
|
|
1831
|
-
disabled: {
|
|
1832
|
-
type: "boolean"
|
|
1833
|
-
},
|
|
1834
|
-
maxLength: {
|
|
1835
|
-
type: "number",
|
|
1836
|
-
advanced: true
|
|
1837
|
-
},
|
|
1838
|
-
bordered: {
|
|
1839
|
-
type: "boolean",
|
|
1840
|
-
advanced: true,
|
|
1841
|
-
defaultValueHint: true
|
|
1842
|
-
}
|
|
1843
|
-
}, COMMON_EVENT_HANDLERS),
|
|
1844
|
-
states: __spreadValues$5({}, COMMON_STATES),
|
|
1845
|
-
componentHelpers: COMMON_HELPERS_CONFIG,
|
|
1846
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1847
|
-
importName: "AntdPassword"
|
|
1848
|
-
});
|
|
1849
|
-
}
|
|
1850
|
-
function registerNumberInput(loader) {
|
|
1851
|
-
registerComponentHelper(loader, AntdInputNumber, {
|
|
1852
|
-
name: "plasmic-antd5-input-number",
|
|
1853
|
-
parentComponentName: "plasmic-antd5-input",
|
|
1854
|
-
displayName: "Number Input",
|
|
1855
|
-
props: __spreadProps$4(__spreadValues$5(__spreadValues$5(__spreadValues$5({
|
|
1856
|
-
value: {
|
|
1857
|
-
type: "number"
|
|
1858
|
-
},
|
|
1859
|
-
placholder: {
|
|
1860
|
-
type: "string"
|
|
1861
|
-
},
|
|
1862
|
-
disabled: {
|
|
1863
|
-
type: "boolean"
|
|
1864
|
-
},
|
|
1865
|
-
max: {
|
|
1866
|
-
type: "number"
|
|
1867
|
-
},
|
|
1868
|
-
min: {
|
|
1869
|
-
type: "number"
|
|
1870
|
-
},
|
|
1871
|
-
step: {
|
|
1872
|
-
type: "number",
|
|
1873
|
-
helpText: "Increment or decrement step"
|
|
1874
|
-
},
|
|
1875
|
-
controls: {
|
|
1876
|
-
type: "boolean",
|
|
1877
|
-
displayName: "Show add/minus controls?",
|
|
1878
|
-
advanced: true
|
|
1879
|
-
}
|
|
1880
|
-
}, COMMON_DECORATOR_PROPS), COMMON_ADVANCED_PROPS), COMMON_EVENT_HANDLERS), {
|
|
1881
|
-
onChange: {
|
|
1882
|
-
type: "eventHandler",
|
|
1883
|
-
argTypes: [
|
|
1884
|
-
{
|
|
1885
|
-
name: "value",
|
|
1886
|
-
type: "number"
|
|
1887
|
-
}
|
|
1888
|
-
]
|
|
1889
|
-
}
|
|
1890
|
-
}),
|
|
1891
|
-
states: __spreadValues$5({}, COMMON_STATES),
|
|
1892
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerInput",
|
|
1893
|
-
importName: "AntdInputNumber"
|
|
1894
|
-
});
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
const AntdMenu = Menu;
|
|
1898
|
-
const AntdMenuDivider = Menu.Divider;
|
|
1899
|
-
const AntdMenuItem = Menu.Item;
|
|
1900
|
-
const AntdMenuItemGroup = Menu.ItemGroup;
|
|
1901
|
-
const AntdSubMenu = Menu.SubMenu;
|
|
1902
|
-
const allowedMenuComponents = [
|
|
1903
|
-
"plasmic-antd5-menu-item",
|
|
1904
|
-
"plasmic-antd5-menu-divider",
|
|
1905
|
-
"plasmic-antd5-submenu",
|
|
1906
|
-
"plasmic-antd5-menu-item-group"
|
|
1907
|
-
];
|
|
1908
|
-
function registerMenu(loader) {
|
|
1909
|
-
registerComponentHelper(loader, AntdMenu, {
|
|
1910
|
-
name: "plasmic-antd5-menu",
|
|
1911
|
-
displayName: "Menu",
|
|
1912
|
-
props: {
|
|
1913
|
-
expandIcon: {
|
|
1914
|
-
type: "slot",
|
|
1915
|
-
hidePlaceholder: true
|
|
1916
|
-
},
|
|
1917
|
-
mode: {
|
|
1918
|
-
type: "choice",
|
|
1919
|
-
options: ["horizontal", "vertical", "inline"],
|
|
1920
|
-
description: "Type of menu",
|
|
1921
|
-
defaultValueHint: "vertical"
|
|
1922
|
-
},
|
|
1923
|
-
multiple: {
|
|
1924
|
-
type: "boolean",
|
|
1925
|
-
description: "Allows selection of multiple items",
|
|
1926
|
-
defaultValueHint: false
|
|
1927
|
-
},
|
|
1928
|
-
triggerSubMenuAction: {
|
|
1929
|
-
type: "choice",
|
|
1930
|
-
options: ["hover", "click"],
|
|
1931
|
-
description: "Which action can trigger submenu open/close",
|
|
1932
|
-
defaultValueHint: "hover",
|
|
1933
|
-
advanced: true
|
|
1934
|
-
},
|
|
1935
|
-
children: {
|
|
1936
|
-
type: "slot",
|
|
1937
|
-
allowedComponents: allowedMenuComponents,
|
|
1938
|
-
defaultValue: [
|
|
1939
|
-
{
|
|
1940
|
-
type: "component",
|
|
1941
|
-
name: "plasmic-antd5-menu-item",
|
|
1942
|
-
props: {
|
|
1943
|
-
key: "menuItemKey1"
|
|
1944
|
-
}
|
|
1945
|
-
},
|
|
1946
|
-
{
|
|
1947
|
-
type: "component",
|
|
1948
|
-
name: "plasmic-antd5-menu-item",
|
|
1949
|
-
props: {
|
|
1950
|
-
key: "menuItemKey2"
|
|
1951
|
-
}
|
|
1952
|
-
}
|
|
1953
|
-
]
|
|
1954
|
-
},
|
|
1955
|
-
onSelect: {
|
|
1956
|
-
type: "eventHandler",
|
|
1957
|
-
argTypes: [{ name: "key", type: "string" }]
|
|
1958
|
-
}
|
|
1959
|
-
},
|
|
1960
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerMenu",
|
|
1961
|
-
importName: "AntdMenu"
|
|
1962
|
-
});
|
|
1963
|
-
registerComponentHelper(loader, AntdMenuItem, {
|
|
1964
|
-
name: "plasmic-antd5-menu-item",
|
|
1965
|
-
displayName: "Menu Item",
|
|
1966
|
-
props: {
|
|
1967
|
-
danger: {
|
|
1968
|
-
type: "boolean",
|
|
1969
|
-
description: "Display the danger style",
|
|
1970
|
-
defaultValueHint: false
|
|
1971
|
-
},
|
|
1972
|
-
disabled: {
|
|
1973
|
-
type: "boolean",
|
|
1974
|
-
description: "Whether disabled select",
|
|
1975
|
-
defaultValueHint: false
|
|
1976
|
-
},
|
|
1977
|
-
key: {
|
|
1978
|
-
type: "string",
|
|
1979
|
-
displayName: "Unique key",
|
|
1980
|
-
description: "Unique ID of the menu item. Used to determine which item is selected.",
|
|
1981
|
-
defaultValue: "menuItemKey"
|
|
1982
|
-
},
|
|
1983
|
-
title: {
|
|
1984
|
-
type: "string",
|
|
1985
|
-
description: "Set display title for collapsed item"
|
|
1986
|
-
},
|
|
1987
|
-
children: {
|
|
1988
|
-
type: "slot",
|
|
1989
|
-
defaultValue: [
|
|
1990
|
-
{
|
|
1991
|
-
type: "text",
|
|
1992
|
-
value: "Menu item"
|
|
1993
|
-
}
|
|
1994
|
-
]
|
|
1995
|
-
},
|
|
1996
|
-
onClick: {
|
|
1997
|
-
type: "eventHandler",
|
|
1998
|
-
argTypes: []
|
|
1999
|
-
}
|
|
2000
|
-
},
|
|
2001
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerMenu",
|
|
2002
|
-
importName: "AntdMenuItem",
|
|
2003
|
-
parentComponentName: "plasmic-antd5-menu"
|
|
2004
|
-
});
|
|
2005
|
-
registerComponentHelper(loader, AntdMenuItemGroup, {
|
|
2006
|
-
name: "plasmic-antd5-menu-item-group",
|
|
2007
|
-
displayName: "Item Group",
|
|
2008
|
-
props: {
|
|
2009
|
-
title: {
|
|
2010
|
-
type: "slot",
|
|
2011
|
-
defaultValue: [
|
|
2012
|
-
{
|
|
2013
|
-
type: "text",
|
|
2014
|
-
value: "Group"
|
|
2015
|
-
}
|
|
2016
|
-
]
|
|
2017
|
-
},
|
|
2018
|
-
children: {
|
|
2019
|
-
type: "slot",
|
|
2020
|
-
allowedComponents: allowedMenuComponents,
|
|
2021
|
-
defaultValue: [
|
|
2022
|
-
{
|
|
2023
|
-
type: "component",
|
|
2024
|
-
name: "plasmic-antd5-menu-item"
|
|
2025
|
-
}
|
|
2026
|
-
]
|
|
2027
|
-
}
|
|
2028
|
-
},
|
|
2029
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerMenu",
|
|
2030
|
-
importName: "AntdMenuItemGroup",
|
|
2031
|
-
parentComponentName: "plasmic-antd5-menu"
|
|
2032
|
-
});
|
|
2033
|
-
registerComponentHelper(loader, AntdMenuDivider, {
|
|
2034
|
-
name: "plasmic-antd5-menu-divider",
|
|
2035
|
-
displayName: "Menu Divider",
|
|
2036
|
-
props: {
|
|
2037
|
-
dashed: {
|
|
2038
|
-
type: "boolean",
|
|
2039
|
-
description: "Whether line is dashed",
|
|
2040
|
-
defaultValueHint: false
|
|
2041
|
-
}
|
|
2042
|
-
},
|
|
2043
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerMenu",
|
|
2044
|
-
importName: "AntdMenuDivider",
|
|
2045
|
-
parentComponentName: "plasmic-antd5-menu"
|
|
2046
|
-
});
|
|
2047
|
-
registerComponentHelper(loader, AntdSubMenu, {
|
|
2048
|
-
name: "plasmic-antd5-submenu",
|
|
2049
|
-
displayName: "Sub Menu",
|
|
2050
|
-
props: {
|
|
2051
|
-
disabled: {
|
|
2052
|
-
type: "boolean",
|
|
2053
|
-
description: "Whether sub-menu is disabled",
|
|
2054
|
-
defaultValueHint: false
|
|
2055
|
-
},
|
|
2056
|
-
key: {
|
|
2057
|
-
type: "string",
|
|
2058
|
-
displayName: "Unique key",
|
|
2059
|
-
description: "Unique ID of the sub-menu. Used to determine which item is selected.",
|
|
2060
|
-
advanced: true
|
|
2061
|
-
},
|
|
2062
|
-
title: {
|
|
2063
|
-
type: "slot",
|
|
2064
|
-
defaultValue: [
|
|
2065
|
-
{
|
|
2066
|
-
type: "text",
|
|
2067
|
-
value: "Sub-menu"
|
|
2068
|
-
}
|
|
2069
|
-
]
|
|
2070
|
-
},
|
|
2071
|
-
children: {
|
|
2072
|
-
type: "slot",
|
|
2073
|
-
allowedComponents: allowedMenuComponents,
|
|
2074
|
-
defaultValue: [1, 2].map((i) => ({
|
|
2075
|
-
type: "component",
|
|
2076
|
-
name: "plasmic-antd5-menu-item",
|
|
2077
|
-
props: {
|
|
2078
|
-
key: `subMenuItemKey${i}`,
|
|
2079
|
-
children: [
|
|
2080
|
-
{
|
|
2081
|
-
type: "text",
|
|
2082
|
-
value: `Sub-menu item ${i}`
|
|
2083
|
-
}
|
|
2084
|
-
]
|
|
2085
|
-
}
|
|
2086
|
-
}))
|
|
2087
|
-
}
|
|
2088
|
-
},
|
|
2089
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerMenu",
|
|
2090
|
-
importName: "AntdSubMenu",
|
|
2091
|
-
parentComponentName: "plasmic-antd5-menu"
|
|
2092
|
-
});
|
|
2093
|
-
}
|
|
2094
|
-
|
|
2095
|
-
var __defProp$4 = Object.defineProperty;
|
|
2096
|
-
var __defProps$3 = Object.defineProperties;
|
|
2097
|
-
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
2098
|
-
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
2099
|
-
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
2100
|
-
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
2101
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2102
|
-
var __spreadValues$4 = (a, b) => {
|
|
2103
|
-
for (var prop in b || (b = {}))
|
|
2104
|
-
if (__hasOwnProp$4.call(b, prop))
|
|
2105
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
2106
|
-
if (__getOwnPropSymbols$4)
|
|
2107
|
-
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
2108
|
-
if (__propIsEnum$4.call(b, prop))
|
|
2109
|
-
__defNormalProp$4(a, prop, b[prop]);
|
|
2110
|
-
}
|
|
2111
|
-
return a;
|
|
2112
|
-
};
|
|
2113
|
-
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
2114
|
-
var __objRest$4 = (source, exclude) => {
|
|
2115
|
-
var target = {};
|
|
2116
|
-
for (var prop in source)
|
|
2117
|
-
if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2118
|
-
target[prop] = source[prop];
|
|
2119
|
-
if (source != null && __getOwnPropSymbols$4)
|
|
2120
|
-
for (var prop of __getOwnPropSymbols$4(source)) {
|
|
2121
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
|
|
2122
|
-
target[prop] = source[prop];
|
|
2123
|
-
}
|
|
2124
|
-
return target;
|
|
2125
|
-
};
|
|
2126
|
-
function AntdModal(props) {
|
|
2127
|
-
const _a = props, { onOpenChange, onOk, onCancel, open, footer } = _a, rest = __objRest$4(_a, ["onOpenChange", "onOk", "onCancel", "open", "footer"]);
|
|
2128
|
-
const memoOnOk = React.useMemo(() => {
|
|
2129
|
-
if (onOpenChange || onOk) {
|
|
2130
|
-
return (e) => {
|
|
2131
|
-
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
2132
|
-
onOk == null ? void 0 : onOk(e);
|
|
2133
|
-
};
|
|
2134
|
-
} else {
|
|
2135
|
-
return void 0;
|
|
2136
|
-
}
|
|
2137
|
-
}, [onOpenChange, onOk]);
|
|
2138
|
-
const memoOnCancel = React.useMemo(() => {
|
|
2139
|
-
if (onOpenChange || onCancel) {
|
|
2140
|
-
return (e) => {
|
|
2141
|
-
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
2142
|
-
onCancel == null ? void 0 : onCancel(e);
|
|
2143
|
-
};
|
|
2144
|
-
} else {
|
|
2145
|
-
return void 0;
|
|
2146
|
-
}
|
|
2147
|
-
}, [onOpenChange, onCancel]);
|
|
2148
|
-
return /* @__PURE__ */ React.createElement(Modal, __spreadProps$3(__spreadValues$4({}, rest), {
|
|
2149
|
-
onOk: memoOnOk,
|
|
2150
|
-
onCancel: memoOnCancel,
|
|
2151
|
-
open,
|
|
2152
|
-
footer: footer != null ? footer : void 0
|
|
2153
|
-
}));
|
|
2154
|
-
}
|
|
2155
|
-
function registerModal(loader) {
|
|
2156
|
-
registerComponentHelper(loader, AntdModal, {
|
|
2157
|
-
name: "plasmic-antd5-modal",
|
|
2158
|
-
displayName: "Modal",
|
|
2159
|
-
props: {
|
|
2160
|
-
open: {
|
|
2161
|
-
type: "boolean"
|
|
2162
|
-
},
|
|
2163
|
-
children: {
|
|
2164
|
-
type: "slot",
|
|
2165
|
-
defaultValue: {
|
|
2166
|
-
type: "vbox",
|
|
2167
|
-
children: ["Modal content"]
|
|
2168
|
-
}
|
|
2169
|
-
},
|
|
2170
|
-
title: {
|
|
2171
|
-
type: "slot",
|
|
2172
|
-
defaultValue: "Modal title"
|
|
2173
|
-
},
|
|
2174
|
-
footer: {
|
|
2175
|
-
type: "slot",
|
|
2176
|
-
hidePlaceholder: true
|
|
2177
|
-
},
|
|
2178
|
-
closeIcon: {
|
|
2179
|
-
type: "slot",
|
|
2180
|
-
hidePlaceholder: true
|
|
2181
|
-
},
|
|
2182
|
-
onOk: {
|
|
2183
|
-
type: "eventHandler",
|
|
2184
|
-
argTypes: []
|
|
2185
|
-
},
|
|
2186
|
-
onCancel: {
|
|
2187
|
-
type: "eventHandler",
|
|
2188
|
-
argTypes: []
|
|
2189
|
-
},
|
|
2190
|
-
okText: {
|
|
2191
|
-
type: "string",
|
|
2192
|
-
hidden: (ps) => !!ps.footer,
|
|
2193
|
-
advanced: true
|
|
2194
|
-
},
|
|
2195
|
-
cancelText: {
|
|
2196
|
-
type: "string",
|
|
2197
|
-
hidden: (ps) => !!ps.footer,
|
|
2198
|
-
advanced: true
|
|
2199
|
-
},
|
|
2200
|
-
onOpenChange: {
|
|
2201
|
-
type: "eventHandler",
|
|
2202
|
-
argTypes: [{ name: "open", type: "boolean" }]
|
|
2203
|
-
},
|
|
2204
|
-
modalScopeClassName: {
|
|
2205
|
-
type: "styleScopeClass",
|
|
2206
|
-
scopeName: "modal"
|
|
2207
|
-
},
|
|
2208
|
-
modalClassName: {
|
|
2209
|
-
type: "class",
|
|
2210
|
-
displayName: "Modal content styles",
|
|
2211
|
-
noSelf: true,
|
|
2212
|
-
selectors: [
|
|
2213
|
-
{
|
|
2214
|
-
selector: ":modal .ant-modal .ant-modal-content",
|
|
2215
|
-
label: "Base"
|
|
2216
|
-
}
|
|
2217
|
-
],
|
|
2218
|
-
advanced: true
|
|
2219
|
-
},
|
|
2220
|
-
closeButtonClassName: {
|
|
2221
|
-
type: "class",
|
|
2222
|
-
displayName: "Close button styles",
|
|
2223
|
-
noSelf: true,
|
|
2224
|
-
selectors: [
|
|
2225
|
-
{
|
|
2226
|
-
selector: ":modal .ant-modal .ant-modal-close",
|
|
2227
|
-
label: "Base"
|
|
2228
|
-
}
|
|
2229
|
-
],
|
|
2230
|
-
advanced: true
|
|
2231
|
-
},
|
|
2232
|
-
defaultStylesClassName: {
|
|
2233
|
-
type: "themeResetClass"
|
|
2234
|
-
}
|
|
2235
|
-
},
|
|
2236
|
-
states: {
|
|
2237
|
-
open: {
|
|
2238
|
-
type: "writable",
|
|
2239
|
-
valueProp: "open",
|
|
2240
|
-
onChangeProp: "onOpenChange",
|
|
2241
|
-
variableType: "boolean"
|
|
2242
|
-
}
|
|
2243
|
-
},
|
|
2244
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerModal",
|
|
2245
|
-
importName: "AntdModal"
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
|
|
2249
|
-
var __defProp$3 = Object.defineProperty;
|
|
2250
|
-
var __defProps$2 = Object.defineProperties;
|
|
2251
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
2252
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
2253
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
2254
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
2255
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2256
|
-
var __spreadValues$3 = (a, b) => {
|
|
2257
|
-
for (var prop in b || (b = {}))
|
|
2258
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
2259
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2260
|
-
if (__getOwnPropSymbols$3)
|
|
2261
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
2262
|
-
if (__propIsEnum$3.call(b, prop))
|
|
2263
|
-
__defNormalProp$3(a, prop, b[prop]);
|
|
2264
|
-
}
|
|
2265
|
-
return a;
|
|
2266
|
-
};
|
|
2267
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
2268
|
-
var __objRest$3 = (source, exclude) => {
|
|
2269
|
-
var target = {};
|
|
2270
|
-
for (var prop in source)
|
|
2271
|
-
if (__hasOwnProp$3.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2272
|
-
target[prop] = source[prop];
|
|
2273
|
-
if (source != null && __getOwnPropSymbols$3)
|
|
2274
|
-
for (var prop of __getOwnPropSymbols$3(source)) {
|
|
2275
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$3.call(source, prop))
|
|
2276
|
-
target[prop] = source[prop];
|
|
2277
|
-
}
|
|
2278
|
-
return target;
|
|
2279
|
-
};
|
|
2280
|
-
const AntdRadio = Radio;
|
|
2281
|
-
function AntdRadioGroup(props) {
|
|
2282
|
-
const _a = props, { onChange } = _a, rest = __objRest$3(_a, ["onChange"]);
|
|
2283
|
-
const wrappedOnChange = React.useMemo(() => {
|
|
2284
|
-
if (onChange) {
|
|
2285
|
-
return (event) => onChange(event.target.value);
|
|
2286
|
-
} else {
|
|
2287
|
-
return void 0;
|
|
2288
|
-
}
|
|
2289
|
-
}, [onChange]);
|
|
2290
|
-
return /* @__PURE__ */ React.createElement(RadioGroup, __spreadProps$2(__spreadValues$3({}, rest), {
|
|
2291
|
-
onChange: wrappedOnChange
|
|
2292
|
-
}));
|
|
2293
|
-
}
|
|
2294
|
-
function registerRadio(loader) {
|
|
2295
|
-
registerComponentHelper(loader, AntdRadio, {
|
|
2296
|
-
name: "plasmic-antd5-radio",
|
|
2297
|
-
displayName: "Radio",
|
|
2298
|
-
props: {
|
|
2299
|
-
value: {
|
|
2300
|
-
type: "string",
|
|
2301
|
-
description: "The radio option value"
|
|
2302
|
-
},
|
|
2303
|
-
disabled: {
|
|
2304
|
-
type: "boolean",
|
|
2305
|
-
defaultValueHint: false
|
|
2306
|
-
},
|
|
2307
|
-
autoFocus: {
|
|
2308
|
-
type: "boolean",
|
|
2309
|
-
description: "If focused when first shown",
|
|
2310
|
-
defaultValueHint: false,
|
|
2311
|
-
advanced: true
|
|
2312
|
-
},
|
|
2313
|
-
children: {
|
|
2314
|
-
type: "slot",
|
|
2315
|
-
defaultValue: [
|
|
2316
|
-
{
|
|
2317
|
-
type: "text",
|
|
2318
|
-
value: "Radio"
|
|
2319
|
-
}
|
|
2320
|
-
]
|
|
2321
|
-
}
|
|
2322
|
-
},
|
|
2323
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerRadio",
|
|
2324
|
-
importName: "AntdRadio",
|
|
2325
|
-
parentComponentName: "plasmic-antd5-radio-group"
|
|
2326
|
-
});
|
|
2327
|
-
registerComponentHelper(loader, AntdRadio, {
|
|
2328
|
-
name: "plasmic-antd5-radio-button",
|
|
2329
|
-
displayName: "Radio Button",
|
|
2330
|
-
props: {
|
|
2331
|
-
value: {
|
|
2332
|
-
type: "string",
|
|
2333
|
-
description: "The radio option value"
|
|
2334
|
-
},
|
|
2335
|
-
disabled: {
|
|
2336
|
-
type: "boolean",
|
|
2337
|
-
defaultValueHint: false
|
|
2338
|
-
},
|
|
2339
|
-
autoFocus: {
|
|
2340
|
-
type: "boolean",
|
|
2341
|
-
description: "If focused when first shown",
|
|
2342
|
-
defaultValueHint: false,
|
|
2343
|
-
advanced: true
|
|
2344
|
-
},
|
|
2345
|
-
children: {
|
|
2346
|
-
type: "slot",
|
|
2347
|
-
defaultValue: [
|
|
2348
|
-
{
|
|
2349
|
-
type: "text",
|
|
2350
|
-
value: "Radio"
|
|
2351
|
-
}
|
|
2352
|
-
]
|
|
2353
|
-
}
|
|
2354
|
-
},
|
|
2355
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerRadio",
|
|
2356
|
-
importName: "AntdRadioButton",
|
|
2357
|
-
parentComponentName: "plasmic-antd5-radio-group"
|
|
2358
|
-
});
|
|
2359
|
-
registerComponentHelper(loader, AntdRadioGroup, {
|
|
2360
|
-
name: "plasmic-antd5-radio-group",
|
|
2361
|
-
displayName: "Radio Group",
|
|
2362
|
-
props: {
|
|
2363
|
-
value: {
|
|
2364
|
-
type: "choice",
|
|
2365
|
-
editOnly: true,
|
|
2366
|
-
uncontrolledProp: "defaultValue",
|
|
2367
|
-
description: "Default selected value",
|
|
2368
|
-
options: (ps) => {
|
|
2369
|
-
const options = /* @__PURE__ */ new Set();
|
|
2370
|
-
traverseReactEltTree(ps.children, (elt) => {
|
|
2371
|
-
var _a;
|
|
2372
|
-
if (typeof ((_a = elt == null ? void 0 : elt.props) == null ? void 0 : _a.value) === "string") {
|
|
2373
|
-
options.add(elt.props.value);
|
|
2374
|
-
}
|
|
2375
|
-
});
|
|
2376
|
-
return Array.from(options.keys());
|
|
2377
|
-
}
|
|
2378
|
-
},
|
|
2379
|
-
disabled: {
|
|
2380
|
-
type: "boolean",
|
|
2381
|
-
description: "Disables all radios",
|
|
2382
|
-
defaultValueHint: false
|
|
2383
|
-
},
|
|
2384
|
-
children: {
|
|
2385
|
-
type: "slot",
|
|
2386
|
-
allowedComponents: [
|
|
2387
|
-
"plasmic-antd5-radio",
|
|
2388
|
-
"plasmic-antd5-radio-button"
|
|
2389
|
-
]
|
|
2390
|
-
},
|
|
2391
|
-
onChange: {
|
|
2392
|
-
type: "eventHandler",
|
|
2393
|
-
argTypes: [{ name: "value", type: "string" }]
|
|
2394
|
-
}
|
|
2395
|
-
},
|
|
2396
|
-
states: {
|
|
2397
|
-
value: {
|
|
2398
|
-
type: "writable",
|
|
2399
|
-
valueProp: "value",
|
|
2400
|
-
onChangeProp: "onChange",
|
|
2401
|
-
variableType: "text"
|
|
2402
|
-
}
|
|
2403
|
-
},
|
|
2404
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerRadio",
|
|
2405
|
-
importName: "AntdRadioGroup"
|
|
2406
|
-
});
|
|
2407
|
-
}
|
|
2408
|
-
|
|
2409
|
-
var __defProp$2 = Object.defineProperty;
|
|
2410
|
-
var __defProps$1 = Object.defineProperties;
|
|
2411
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
2412
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
2413
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
2414
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
2415
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2416
|
-
var __spreadValues$2 = (a, b) => {
|
|
2417
|
-
for (var prop in b || (b = {}))
|
|
2418
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
2419
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2420
|
-
if (__getOwnPropSymbols$2)
|
|
2421
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
2422
|
-
if (__propIsEnum$2.call(b, prop))
|
|
2423
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
2424
|
-
}
|
|
2425
|
-
return a;
|
|
2426
|
-
};
|
|
2427
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2428
|
-
var __objRest$2 = (source, exclude) => {
|
|
2429
|
-
var target = {};
|
|
2430
|
-
for (var prop in source)
|
|
2431
|
-
if (__hasOwnProp$2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2432
|
-
target[prop] = source[prop];
|
|
2433
|
-
if (source != null && __getOwnPropSymbols$2)
|
|
2434
|
-
for (var prop of __getOwnPropSymbols$2(source)) {
|
|
2435
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$2.call(source, prop))
|
|
2436
|
-
target[prop] = source[prop];
|
|
2437
|
-
}
|
|
2438
|
-
return target;
|
|
2439
|
-
};
|
|
2440
|
-
const AntdOption = Select.Option;
|
|
2441
|
-
const AntdOptionGroup = Select.OptGroup;
|
|
2442
|
-
function AntdSelect(props) {
|
|
2443
|
-
const _a = props, {
|
|
2444
|
-
popupClassName,
|
|
2445
|
-
popupScopeClassName,
|
|
2446
|
-
defaultStylesClassName,
|
|
2447
|
-
suffixIcon,
|
|
2448
|
-
mode,
|
|
2449
|
-
useChildren
|
|
2450
|
-
} = _a, rest = __objRest$2(_a, [
|
|
2451
|
-
"popupClassName",
|
|
2452
|
-
"popupScopeClassName",
|
|
2453
|
-
"defaultStylesClassName",
|
|
2454
|
-
"suffixIcon",
|
|
2455
|
-
"mode",
|
|
2456
|
-
"useChildren"
|
|
2457
|
-
]);
|
|
2458
|
-
const curated = __spreadValues$2({}, rest);
|
|
2459
|
-
if (useChildren) {
|
|
2460
|
-
curated.options = void 0;
|
|
2461
|
-
}
|
|
2462
|
-
return /* @__PURE__ */ React.createElement(Select, __spreadValues$2(__spreadProps$1(__spreadValues$2({}, curated), {
|
|
2463
|
-
mode: !mode || mode === "single" ? void 0 : mode,
|
|
2464
|
-
popupClassName: `${defaultStylesClassName} ${popupScopeClassName} ${popupClassName}`
|
|
2465
|
-
}), suffixIcon && { suffixIcon }));
|
|
2466
|
-
}
|
|
2467
|
-
function registerSelect(loader) {
|
|
2468
|
-
registerComponentHelper(loader, AntdSelect, {
|
|
2469
|
-
name: "plasmic-antd5-select",
|
|
2470
|
-
displayName: "Select",
|
|
2471
|
-
props: {
|
|
2472
|
-
options: {
|
|
2473
|
-
type: "array",
|
|
2474
|
-
hidden: (ps) => !!ps.useChildren,
|
|
2475
|
-
itemType: {
|
|
2476
|
-
type: "object",
|
|
2477
|
-
nameFunc: (item) => item.label,
|
|
2478
|
-
fields: {
|
|
2479
|
-
value: "string",
|
|
2480
|
-
label: "string"
|
|
2481
|
-
}
|
|
2482
|
-
},
|
|
2483
|
-
defaultValue: [
|
|
2484
|
-
{
|
|
2485
|
-
value: "option1",
|
|
2486
|
-
label: "Option 1"
|
|
2487
|
-
},
|
|
2488
|
-
{
|
|
2489
|
-
value: "option2",
|
|
2490
|
-
label: "Option 2"
|
|
2491
|
-
}
|
|
2492
|
-
]
|
|
2493
|
-
},
|
|
2494
|
-
useChildren: {
|
|
2495
|
-
displayName: "Use slot",
|
|
2496
|
-
type: "boolean",
|
|
2497
|
-
defaultValueHint: false,
|
|
2498
|
-
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."
|
|
2499
|
-
},
|
|
2500
|
-
children: {
|
|
2501
|
-
type: "slot",
|
|
2502
|
-
allowedComponents: [
|
|
2503
|
-
"plasmic-antd5-option",
|
|
2504
|
-
"plasmic-antd5-option-group"
|
|
2505
|
-
],
|
|
2506
|
-
hidden: (ps) => !ps.useChildren
|
|
2507
|
-
},
|
|
2508
|
-
placeholder: {
|
|
2509
|
-
type: "slot",
|
|
2510
|
-
defaultValue: "Select..."
|
|
2511
|
-
},
|
|
2512
|
-
suffixIcon: {
|
|
2513
|
-
type: "slot",
|
|
2514
|
-
hidePlaceholder: true
|
|
2515
|
-
},
|
|
2516
|
-
open: {
|
|
2517
|
-
type: "boolean",
|
|
2518
|
-
editOnly: true,
|
|
2519
|
-
uncontrolledProp: "defaultOpen"
|
|
2520
|
-
},
|
|
2521
|
-
value: {
|
|
2522
|
-
type: "choice",
|
|
2523
|
-
displayName: "Selected value",
|
|
2524
|
-
editOnly: true,
|
|
2525
|
-
uncontrolledProp: "defaultValue",
|
|
2526
|
-
description: "Initial selected option",
|
|
2527
|
-
multiSelect: (ps) => ps.mode === "multiple",
|
|
2528
|
-
options: (ps) => {
|
|
2529
|
-
var _a;
|
|
2530
|
-
const options = /* @__PURE__ */ new Set();
|
|
2531
|
-
if (!ps.useChildren) {
|
|
2532
|
-
return ((_a = ps.options) != null ? _a : []).map((o) => {
|
|
2533
|
-
var _a2;
|
|
2534
|
-
return {
|
|
2535
|
-
value: o.value || "",
|
|
2536
|
-
label: (_a2 = o.label) != null ? _a2 : o.value || ""
|
|
2537
|
-
};
|
|
2538
|
-
});
|
|
2539
|
-
} else {
|
|
2540
|
-
traverseReactEltTree(ps.children, (elt) => {
|
|
2541
|
-
var _a2;
|
|
2542
|
-
if ((elt == null ? void 0 : elt.type) === Select.Option && typeof ((_a2 = elt == null ? void 0 : elt.props) == null ? void 0 : _a2.value) === "string") {
|
|
2543
|
-
options.add(elt.props.value);
|
|
2544
|
-
}
|
|
2545
|
-
});
|
|
2546
|
-
}
|
|
2547
|
-
return Array.from(options.keys());
|
|
2548
|
-
}
|
|
2549
|
-
},
|
|
2550
|
-
mode: {
|
|
2551
|
-
type: "choice",
|
|
2552
|
-
options: ["single", "multiple"],
|
|
2553
|
-
defaultValueHint: "single"
|
|
2554
|
-
},
|
|
2555
|
-
size: {
|
|
2556
|
-
type: "choice",
|
|
2557
|
-
options: ["small", "middle", "large"]
|
|
2558
|
-
},
|
|
2559
|
-
disabled: {
|
|
2560
|
-
type: "boolean",
|
|
2561
|
-
defaultValueHint: false
|
|
2562
|
-
},
|
|
2563
|
-
showSearch: {
|
|
2564
|
-
type: "boolean",
|
|
2565
|
-
defaultValueHint: false,
|
|
2566
|
-
advanced: true
|
|
2567
|
-
},
|
|
2568
|
-
status: {
|
|
2569
|
-
type: "choice",
|
|
2570
|
-
options: ["error", "warning"],
|
|
2571
|
-
advanced: true
|
|
2572
|
-
},
|
|
2573
|
-
bordered: {
|
|
2574
|
-
type: "boolean",
|
|
2575
|
-
defaultValueHint: true
|
|
2576
|
-
},
|
|
2577
|
-
autoFocus: {
|
|
2578
|
-
type: "boolean",
|
|
2579
|
-
displayName: "Focus automatically",
|
|
2580
|
-
defaultValueHint: false,
|
|
2581
|
-
advanced: true
|
|
2582
|
-
},
|
|
2583
|
-
onChange: {
|
|
2584
|
-
type: "eventHandler",
|
|
2585
|
-
argTypes: [
|
|
2586
|
-
{ name: "value", type: "string" },
|
|
2587
|
-
{ name: "option", type: "object" }
|
|
2588
|
-
]
|
|
2589
|
-
},
|
|
2590
|
-
dropdownMatchSelectWidth: {
|
|
2591
|
-
type: "boolean",
|
|
2592
|
-
displayName: "Should dropdown match trigger button width?",
|
|
2593
|
-
defaultValueHint: true,
|
|
2594
|
-
advanced: true
|
|
2595
|
-
},
|
|
2596
|
-
triggerClassName: {
|
|
2597
|
-
type: "class",
|
|
2598
|
-
displayName: "Trigger styles",
|
|
2599
|
-
noSelf: true,
|
|
2600
|
-
selectors: [
|
|
2601
|
-
{
|
|
2602
|
-
selector: ":component .ant-select-selector.ant-select-selector",
|
|
2603
|
-
label: "Base"
|
|
2604
|
-
},
|
|
2605
|
-
{
|
|
2606
|
-
selector: ":component .ant-select-selector:hover",
|
|
2607
|
-
label: "Hovered"
|
|
2608
|
-
}
|
|
2609
|
-
],
|
|
2610
|
-
advanced: true
|
|
2611
|
-
},
|
|
2612
|
-
popupScopeClassName: {
|
|
2613
|
-
type: "styleScopeClass",
|
|
2614
|
-
scopeName: "popup"
|
|
2615
|
-
},
|
|
2616
|
-
popupClassName: {
|
|
2617
|
-
type: "class",
|
|
2618
|
-
displayName: "Popup styles",
|
|
2619
|
-
selectors: [],
|
|
2620
|
-
advanced: true
|
|
2621
|
-
},
|
|
2622
|
-
optionClassName: {
|
|
2623
|
-
type: "class",
|
|
2624
|
-
displayName: "Option styles",
|
|
2625
|
-
noSelf: true,
|
|
2626
|
-
selectors: [
|
|
2627
|
-
{
|
|
2628
|
-
selector: ":popup.ant-select-dropdown .ant-select-item-option",
|
|
2629
|
-
label: "Base"
|
|
2630
|
-
},
|
|
2631
|
-
{
|
|
2632
|
-
selector: ":popup.ant-select-dropdown .ant-select-item-option-active",
|
|
2633
|
-
label: "Focused"
|
|
2634
|
-
},
|
|
2635
|
-
{
|
|
2636
|
-
selector: ":popup.ant-select-dropdown .ant-select-item-option-selected",
|
|
2637
|
-
label: "Selected"
|
|
2638
|
-
}
|
|
2639
|
-
],
|
|
2640
|
-
advanced: true
|
|
2641
|
-
},
|
|
2642
|
-
placeholderClassName: {
|
|
2643
|
-
type: "class",
|
|
2644
|
-
displayName: "Placeholder styles",
|
|
2645
|
-
selectors: [
|
|
2646
|
-
{
|
|
2647
|
-
selector: ":component .ant-select-selector .ant-select-selection-placeholder",
|
|
2648
|
-
label: "Base"
|
|
2649
|
-
}
|
|
2650
|
-
],
|
|
2651
|
-
advanced: true
|
|
2652
|
-
},
|
|
2653
|
-
defaultStylesClassName: {
|
|
2654
|
-
type: "themeResetClass"
|
|
2655
|
-
},
|
|
2656
|
-
tagRender: {
|
|
2657
|
-
type: "slot",
|
|
2658
|
-
renderPropParams: ["tagProps"],
|
|
2659
|
-
hidePlaceholder: true
|
|
2660
|
-
}
|
|
2661
|
-
},
|
|
2662
|
-
states: {
|
|
2663
|
-
value: {
|
|
2664
|
-
type: "writable",
|
|
2665
|
-
valueProp: "value",
|
|
2666
|
-
onChangeProp: "onChange",
|
|
2667
|
-
variableType: "text"
|
|
2668
|
-
}
|
|
2669
|
-
},
|
|
2670
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
2671
|
-
importName: "AntdSelect"
|
|
2672
|
-
});
|
|
2673
|
-
registerComponentHelper(loader, AntdOption, {
|
|
2674
|
-
name: "plasmic-antd5-option",
|
|
2675
|
-
displayName: "Option",
|
|
2676
|
-
parentComponentName: "plasmic-antd5-select",
|
|
2677
|
-
props: {
|
|
2678
|
-
children: {
|
|
2679
|
-
type: "slot",
|
|
2680
|
-
defaultValue: "Option"
|
|
2681
|
-
},
|
|
2682
|
-
value: {
|
|
2683
|
-
type: "string"
|
|
2684
|
-
}
|
|
2685
|
-
},
|
|
2686
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
2687
|
-
importName: "AntdOption"
|
|
2688
|
-
});
|
|
2689
|
-
registerComponentHelper(loader, AntdOptionGroup, {
|
|
2690
|
-
name: "plasmic-antd5-option-group",
|
|
2691
|
-
displayName: "Option Group",
|
|
2692
|
-
parentComponentName: "plasmic-antd5-select",
|
|
2693
|
-
props: {
|
|
2694
|
-
children: {
|
|
2695
|
-
type: "slot",
|
|
2696
|
-
defaultValue: [
|
|
2697
|
-
{
|
|
2698
|
-
type: "component",
|
|
2699
|
-
name: "plasmic-antd5-option",
|
|
2700
|
-
props: {
|
|
2701
|
-
value: "option1",
|
|
2702
|
-
children: {
|
|
2703
|
-
type: "text",
|
|
2704
|
-
value: "Option 1"
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
},
|
|
2708
|
-
{
|
|
2709
|
-
type: "component",
|
|
2710
|
-
name: "plasmic-antd5-option",
|
|
2711
|
-
props: {
|
|
2712
|
-
value: "option2",
|
|
2713
|
-
children: {
|
|
2714
|
-
type: "text",
|
|
2715
|
-
value: "Option 1"
|
|
2716
|
-
}
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
]
|
|
2720
|
-
},
|
|
2721
|
-
label: {
|
|
2722
|
-
type: "slot",
|
|
2723
|
-
defaultValue: "Group label"
|
|
2724
|
-
}
|
|
2725
|
-
},
|
|
2726
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerSelect",
|
|
2727
|
-
importName: "AntdOptionGroup"
|
|
2728
|
-
});
|
|
2729
|
-
}
|
|
2730
|
-
|
|
2731
|
-
var __defProp$1 = Object.defineProperty;
|
|
2732
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2733
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2734
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2735
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2736
|
-
var __spreadValues$1 = (a, b) => {
|
|
2737
|
-
for (var prop in b || (b = {}))
|
|
2738
|
-
if (__hasOwnProp$1.call(b, prop))
|
|
2739
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2740
|
-
if (__getOwnPropSymbols$1)
|
|
2741
|
-
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
2742
|
-
if (__propIsEnum$1.call(b, prop))
|
|
2743
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2744
|
-
}
|
|
2745
|
-
return a;
|
|
2746
|
-
};
|
|
2747
|
-
var __objRest$1 = (source, exclude) => {
|
|
2748
|
-
var target = {};
|
|
2749
|
-
for (var prop in source)
|
|
2750
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2751
|
-
target[prop] = source[prop];
|
|
2752
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
2753
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
2754
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
2755
|
-
target[prop] = source[prop];
|
|
2756
|
-
}
|
|
2757
|
-
return target;
|
|
2758
|
-
};
|
|
2759
|
-
const AntdTable = React.forwardRef(function AntdTable2(props, ref) {
|
|
2760
|
-
const _a = props, {
|
|
2761
|
-
data,
|
|
2762
|
-
onSelectedRowKeysChange,
|
|
2763
|
-
onSelectedRowsChange,
|
|
2764
|
-
isSelectable,
|
|
2765
|
-
rowKey,
|
|
2766
|
-
setControlContextData,
|
|
2767
|
-
selectedRowKeys,
|
|
2768
|
-
defaultSelectedRowKeys
|
|
2769
|
-
} = _a, rest = __objRest$1(_a, [
|
|
2770
|
-
"data",
|
|
2771
|
-
"onSelectedRowKeysChange",
|
|
2772
|
-
"onSelectedRowsChange",
|
|
2773
|
-
"isSelectable",
|
|
2774
|
-
"rowKey",
|
|
2775
|
-
"setControlContextData",
|
|
2776
|
-
"selectedRowKeys",
|
|
2777
|
-
"defaultSelectedRowKeys"
|
|
2778
|
-
]);
|
|
2779
|
-
setControlContextData == null ? void 0 : setControlContextData(data);
|
|
2780
|
-
const isControlled = !!selectedRowKeys;
|
|
2781
|
-
const [
|
|
2782
|
-
uncontrolledSelectedRowKeys,
|
|
2783
|
-
setUncontrolledSelectedRowKeys
|
|
2784
|
-
] = React.useState(defaultSelectedRowKeys != null ? defaultSelectedRowKeys : []);
|
|
2785
|
-
const selection = isSelectable && rowKey ? {
|
|
2786
|
-
onChange: (rowKeys, rows) => {
|
|
2787
|
-
onSelectedRowsChange == null ? void 0 : onSelectedRowsChange(rows);
|
|
2788
|
-
onSelectedRowKeysChange == null ? void 0 : onSelectedRowKeysChange(rowKeys);
|
|
2789
|
-
},
|
|
2790
|
-
type: isSelectable === "single" ? "radio" : "checkbox",
|
|
2791
|
-
selectedRowKeys: isControlled ? asArray(selectedRowKeys) : uncontrolledSelectedRowKeys
|
|
2792
|
-
} : void 0;
|
|
2793
|
-
React.useImperativeHandle(ref, () => ({
|
|
2794
|
-
selectRowByIndex(index) {
|
|
2795
|
-
if (data.data && rowKey) {
|
|
2796
|
-
const row = data.data[index];
|
|
2797
|
-
const rows = row ? [row] : [];
|
|
2798
|
-
this._setSelectedRows(rows);
|
|
2799
|
-
}
|
|
2800
|
-
},
|
|
2801
|
-
selectRowsByIndexes(indexes) {
|
|
2802
|
-
if (data.data && rowKey) {
|
|
2803
|
-
const rows = indexes.map((x) => data.data[x]).filter((x) => !!x);
|
|
2804
|
-
this._setSelectedRows(rows);
|
|
2805
|
-
}
|
|
2806
|
-
},
|
|
2807
|
-
selectRowByKey(key) {
|
|
2808
|
-
if (data.data && rowKey) {
|
|
2809
|
-
const rows = data.data.filter((r) => r[rowKey] === key);
|
|
2810
|
-
this._setSelectedRows(rows);
|
|
2811
|
-
}
|
|
2812
|
-
},
|
|
2813
|
-
selectRowsByKeys(keys) {
|
|
2814
|
-
if (data.data && rowKey) {
|
|
2815
|
-
const rows = data.data.filter((r) => keys.includes(r[rowKey]));
|
|
2816
|
-
this._setSelectedRows(rows);
|
|
2817
|
-
}
|
|
2818
|
-
},
|
|
2819
|
-
clearSelection() {
|
|
2820
|
-
this._setSelectedRows([]);
|
|
2821
|
-
},
|
|
2822
|
-
_setSelectedRows(rows) {
|
|
2823
|
-
onSelectedRowsChange == null ? void 0 : onSelectedRowsChange(rows);
|
|
2824
|
-
if (rowKey) {
|
|
2825
|
-
onSelectedRowKeysChange == null ? void 0 : onSelectedRowKeysChange(rows.map((r) => r[rowKey]));
|
|
2826
|
-
}
|
|
2827
|
-
if (!isControlled) {
|
|
2828
|
-
setUncontrolledSelectedRowKeys(rows.map((r) => r[rowKey]));
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
}), [data, onSelectedRowKeysChange, onSelectedRowsChange, isSelectable, rowKey]);
|
|
2832
|
-
return /* @__PURE__ */ React.createElement(Table, __spreadValues$1({
|
|
2833
|
-
loading: data == null ? void 0 : data.isLoading,
|
|
2834
|
-
dataSource: data == null ? void 0 : data.data,
|
|
2835
|
-
rowSelection: selection,
|
|
2836
|
-
rowKey
|
|
2837
|
-
}, rest));
|
|
2838
|
-
});
|
|
2839
|
-
const AntdColumnGroup = Table.ColumnGroup;
|
|
2840
|
-
const AntdColumn = Table.Column;
|
|
2841
|
-
function registerTable(loader) {
|
|
2842
|
-
registerComponentHelper(loader, AntdTable, {
|
|
2843
|
-
name: "plasmic-antd5-table",
|
|
2844
|
-
displayName: "Table",
|
|
2845
|
-
props: {
|
|
2846
|
-
data: {
|
|
2847
|
-
type: "dataSourceOpData",
|
|
2848
|
-
displayName: "Data"
|
|
2849
|
-
},
|
|
2850
|
-
children: {
|
|
2851
|
-
type: "slot",
|
|
2852
|
-
allowedComponents: [
|
|
2853
|
-
"plasmic-antd5-table-column",
|
|
2854
|
-
"plasmic-antd5-table-column-group"
|
|
2855
|
-
]
|
|
2856
|
-
},
|
|
2857
|
-
bordered: {
|
|
2858
|
-
type: "boolean",
|
|
2859
|
-
defaultValueHint: false,
|
|
2860
|
-
advanced: true
|
|
2861
|
-
},
|
|
2862
|
-
isSelectable: {
|
|
2863
|
-
type: "choice",
|
|
2864
|
-
options: ["single", "multiple"],
|
|
2865
|
-
displayName: "Select rows?"
|
|
2866
|
-
},
|
|
2867
|
-
rowKey: {
|
|
2868
|
-
type: "choice",
|
|
2869
|
-
options: (ps, ctx) => {
|
|
2870
|
-
if (ctx.schema) {
|
|
2871
|
-
return ctx.schema.fields.map((f) => ({
|
|
2872
|
-
value: f.id,
|
|
2873
|
-
label: f.label || f.id
|
|
2874
|
-
}));
|
|
2875
|
-
}
|
|
2876
|
-
return [];
|
|
2877
|
-
},
|
|
2878
|
-
hidden: (ps) => !ps.isSelectable
|
|
2879
|
-
},
|
|
2880
|
-
selectedRowKeys: {
|
|
2881
|
-
type: "choice",
|
|
2882
|
-
multiSelect: (ps) => ps.isSelectable === "multiple",
|
|
2883
|
-
options: (ps, ctx) => {
|
|
2884
|
-
const key = ps.rowKey;
|
|
2885
|
-
if (key && ctx.data) {
|
|
2886
|
-
return ctx.data.map((r) => r[key]);
|
|
2887
|
-
}
|
|
2888
|
-
return [];
|
|
2889
|
-
},
|
|
2890
|
-
hidden: (ps) => !ps.rowKey
|
|
2891
|
-
},
|
|
2892
|
-
onSelectedRowKeysChange: {
|
|
2893
|
-
type: "eventHandler",
|
|
2894
|
-
argTypes: [{ name: "keys", type: "object" }],
|
|
2895
|
-
hidden: (ps) => !ps.isSelectable
|
|
2896
|
-
},
|
|
2897
|
-
onSelectedRowsChange: {
|
|
2898
|
-
type: "eventHandler",
|
|
2899
|
-
argTypes: [{ name: "rows", type: "object" }],
|
|
2900
|
-
hidden: (ps) => !ps.isSelectable
|
|
2901
|
-
}
|
|
2902
|
-
},
|
|
2903
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerTable",
|
|
2904
|
-
importName: "AntdTable",
|
|
2905
|
-
states: {
|
|
2906
|
-
selectedRowKeys: {
|
|
2907
|
-
type: "writable",
|
|
2908
|
-
valueProp: "selectedRowKeys",
|
|
2909
|
-
onChangeProp: "onSelectedRowKeysChange",
|
|
2910
|
-
variableType: "array"
|
|
2911
|
-
}
|
|
2912
|
-
},
|
|
2913
|
-
unstable__refActions: {
|
|
2914
|
-
selectRowByIndex: {
|
|
2915
|
-
displayName: "Select row by index",
|
|
2916
|
-
parameters: [
|
|
2917
|
-
{
|
|
2918
|
-
name: "index",
|
|
2919
|
-
displayName: "Index",
|
|
2920
|
-
type: "number"
|
|
2921
|
-
}
|
|
2922
|
-
]
|
|
2923
|
-
},
|
|
2924
|
-
selectRowByKey: {
|
|
2925
|
-
displayName: "Select row by key",
|
|
2926
|
-
parameters: [
|
|
2927
|
-
{
|
|
2928
|
-
name: "key",
|
|
2929
|
-
displayName: "Row key",
|
|
2930
|
-
type: "string"
|
|
2931
|
-
}
|
|
2932
|
-
]
|
|
2933
|
-
}
|
|
2934
|
-
}
|
|
2935
|
-
});
|
|
2936
|
-
registerComponentHelper(loader, AntdColumn, __spreadValues$1({
|
|
2937
|
-
name: "plasmic-antd5-table-column",
|
|
2938
|
-
displayName: "Column",
|
|
2939
|
-
parentComponentName: "plasmic-antd5-table",
|
|
2940
|
-
props: {
|
|
2941
|
-
title: {
|
|
2942
|
-
type: "slot",
|
|
2943
|
-
defaultValue: "Column Name"
|
|
2944
|
-
},
|
|
2945
|
-
dataIndex: {
|
|
2946
|
-
type: "string",
|
|
2947
|
-
displayName: "Column key"
|
|
2948
|
-
},
|
|
2949
|
-
render: {
|
|
2950
|
-
type: "slot",
|
|
2951
|
-
renderPropParams: ["cell", "row", "index"],
|
|
2952
|
-
hidePlaceholder: true,
|
|
2953
|
-
displayName: "Custom render"
|
|
2954
|
-
},
|
|
2955
|
-
align: {
|
|
2956
|
-
type: "choice",
|
|
2957
|
-
options: ["left", "right", "center"],
|
|
2958
|
-
defaultValueHint: "left"
|
|
2959
|
-
},
|
|
2960
|
-
fixed: {
|
|
2961
|
-
type: "choice",
|
|
2962
|
-
options: ["left", "right"],
|
|
2963
|
-
advanced: true
|
|
2964
|
-
},
|
|
2965
|
-
colSpan: {
|
|
2966
|
-
type: "number",
|
|
2967
|
-
advanced: true
|
|
2968
|
-
}
|
|
2969
|
-
},
|
|
2970
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerTable",
|
|
2971
|
-
importName: "AntdColumn"
|
|
2972
|
-
}, { isRenderless: true }));
|
|
2973
|
-
registerComponentHelper(loader, AntdColumnGroup, __spreadValues$1({
|
|
2974
|
-
name: "plasmic-antd5-table-column-group",
|
|
2975
|
-
displayName: "Column Group",
|
|
2976
|
-
parentComponentName: "plasmic-antd5-table",
|
|
2977
|
-
props: {
|
|
2978
|
-
title: {
|
|
2979
|
-
type: "slot",
|
|
2980
|
-
defaultValue: "Column Group Name"
|
|
2981
|
-
},
|
|
2982
|
-
children: {
|
|
2983
|
-
type: "slot",
|
|
2984
|
-
allowedComponents: ["plasmic-antd5-table-column"]
|
|
2985
|
-
}
|
|
2986
|
-
},
|
|
2987
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerTable",
|
|
2988
|
-
importName: "AntdColumnGroup"
|
|
2989
|
-
}, { isRenderless: true }));
|
|
2990
|
-
}
|
|
2991
|
-
|
|
2992
|
-
var __defProp = Object.defineProperty;
|
|
2993
|
-
var __defProps = Object.defineProperties;
|
|
2994
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2995
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2996
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2997
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2998
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2999
|
-
var __spreadValues = (a, b) => {
|
|
3000
|
-
for (var prop in b || (b = {}))
|
|
3001
|
-
if (__hasOwnProp.call(b, prop))
|
|
3002
|
-
__defNormalProp(a, prop, b[prop]);
|
|
3003
|
-
if (__getOwnPropSymbols)
|
|
3004
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
3005
|
-
if (__propIsEnum.call(b, prop))
|
|
3006
|
-
__defNormalProp(a, prop, b[prop]);
|
|
3007
|
-
}
|
|
3008
|
-
return a;
|
|
3009
|
-
};
|
|
3010
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
3011
|
-
var __objRest = (source, exclude) => {
|
|
3012
|
-
var target = {};
|
|
3013
|
-
for (var prop in source)
|
|
3014
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
3015
|
-
target[prop] = source[prop];
|
|
3016
|
-
if (source != null && __getOwnPropSymbols)
|
|
3017
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
3018
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
3019
|
-
target[prop] = source[prop];
|
|
3020
|
-
}
|
|
3021
|
-
return target;
|
|
3022
|
-
};
|
|
3023
|
-
function UploadWrapper(props) {
|
|
3024
|
-
const _a = props, { files, onFilesChange } = _a, rest = __objRest(_a, ["files", "onFilesChange"]);
|
|
3025
|
-
const handleChange = (info) => {
|
|
3026
|
-
const { file } = info;
|
|
3027
|
-
if (file.status === "removed") {
|
|
3028
|
-
return;
|
|
3029
|
-
}
|
|
3030
|
-
const metadata = {
|
|
3031
|
-
uid: file.uid,
|
|
3032
|
-
name: file.name,
|
|
3033
|
-
size: file.size,
|
|
3034
|
-
type: file.type,
|
|
3035
|
-
lastModified: file.lastModified
|
|
3036
|
-
};
|
|
3037
|
-
onFilesChange == null ? void 0 : onFilesChange([
|
|
3038
|
-
...files,
|
|
3039
|
-
__spreadProps(__spreadValues({}, metadata), {
|
|
3040
|
-
status: "uploading"
|
|
3041
|
-
})
|
|
3042
|
-
]);
|
|
3043
|
-
const reader = new FileReader();
|
|
3044
|
-
reader.onload = () => {
|
|
3045
|
-
onFilesChange == null ? void 0 : onFilesChange([
|
|
3046
|
-
...files.filter((f) => f.uid !== file.uid),
|
|
3047
|
-
__spreadProps(__spreadValues({}, metadata), {
|
|
3048
|
-
contents: reader.result.replace(/^data:[^;]+;base64,/, ""),
|
|
3049
|
-
status: "success"
|
|
3050
|
-
})
|
|
3051
|
-
]);
|
|
3052
|
-
};
|
|
3053
|
-
reader.onerror = (error) => {
|
|
3054
|
-
onFilesChange == null ? void 0 : onFilesChange([
|
|
3055
|
-
...files.filter((f) => f.uid !== file.uid),
|
|
3056
|
-
__spreadProps(__spreadValues({}, metadata), {
|
|
3057
|
-
status: "error"
|
|
3058
|
-
})
|
|
3059
|
-
]);
|
|
3060
|
-
};
|
|
3061
|
-
reader.readAsDataURL(info.file);
|
|
3062
|
-
};
|
|
3063
|
-
const handleRemove = (file) => {
|
|
3064
|
-
onFilesChange == null ? void 0 : onFilesChange(files.filter((f) => f.uid !== file.uid));
|
|
3065
|
-
};
|
|
3066
|
-
return /* @__PURE__ */ React.createElement(Upload, __spreadProps(__spreadValues({}, rest), {
|
|
3067
|
-
fileList: files,
|
|
3068
|
-
beforeUpload: () => {
|
|
3069
|
-
return false;
|
|
3070
|
-
},
|
|
3071
|
-
onChange: (info) => {
|
|
3072
|
-
handleChange(info);
|
|
3073
|
-
},
|
|
3074
|
-
onRemove: (file) => {
|
|
3075
|
-
handleRemove(file);
|
|
3076
|
-
}
|
|
3077
|
-
}));
|
|
3078
|
-
}
|
|
3079
|
-
function registerUpload(loader) {
|
|
3080
|
-
registerComponentHelper(loader, UploadWrapper, {
|
|
3081
|
-
name: "plasmic-antd5-upload",
|
|
3082
|
-
displayName: "Upload",
|
|
3083
|
-
props: {
|
|
3084
|
-
accept: {
|
|
3085
|
-
type: "choice",
|
|
3086
|
-
displayName: "Allowed types",
|
|
3087
|
-
options: [
|
|
3088
|
-
{
|
|
3089
|
-
value: "",
|
|
3090
|
-
label: "Any kind of file"
|
|
3091
|
-
},
|
|
3092
|
-
{
|
|
3093
|
-
value: "image/*",
|
|
3094
|
-
label: "Image"
|
|
3095
|
-
},
|
|
3096
|
-
{
|
|
3097
|
-
value: "video/*",
|
|
3098
|
-
label: "Video"
|
|
3099
|
-
},
|
|
3100
|
-
{
|
|
3101
|
-
value: "audio/*",
|
|
3102
|
-
label: "Audio"
|
|
3103
|
-
},
|
|
3104
|
-
{
|
|
3105
|
-
value: "application/pdf",
|
|
3106
|
-
label: "PDF"
|
|
3107
|
-
}
|
|
3108
|
-
],
|
|
3109
|
-
defaultValue: ""
|
|
3110
|
-
},
|
|
3111
|
-
files: {
|
|
3112
|
-
type: "object",
|
|
3113
|
-
displayName: "Files",
|
|
3114
|
-
defaultValue: []
|
|
3115
|
-
},
|
|
3116
|
-
children: {
|
|
3117
|
-
type: "slot",
|
|
3118
|
-
defaultValue: [
|
|
3119
|
-
{
|
|
3120
|
-
type: "default-component",
|
|
3121
|
-
kind: "button",
|
|
3122
|
-
props: {
|
|
3123
|
-
children: {
|
|
3124
|
-
type: "text",
|
|
3125
|
-
value: "Upload"
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
}
|
|
3129
|
-
]
|
|
3130
|
-
},
|
|
3131
|
-
maxCount: {
|
|
3132
|
-
type: "number",
|
|
3133
|
-
displayName: "Limit of files",
|
|
3134
|
-
advanced: true
|
|
3135
|
-
},
|
|
3136
|
-
onFilesChange: {
|
|
3137
|
-
type: "eventHandler",
|
|
3138
|
-
displayName: "On file uploaded",
|
|
3139
|
-
argTypes: [
|
|
3140
|
-
{
|
|
3141
|
-
name: "files",
|
|
3142
|
-
type: "object"
|
|
3143
|
-
}
|
|
3144
|
-
]
|
|
3145
|
-
},
|
|
3146
|
-
showUploadList: {
|
|
3147
|
-
type: "boolean",
|
|
3148
|
-
displayName: "List files",
|
|
3149
|
-
defaultValue: true
|
|
3150
|
-
}
|
|
3151
|
-
},
|
|
3152
|
-
states: {
|
|
3153
|
-
files: {
|
|
3154
|
-
type: "writable",
|
|
3155
|
-
valueProp: "files",
|
|
3156
|
-
variableType: "array",
|
|
3157
|
-
onChangeProp: "onFilesChange"
|
|
3158
|
-
}
|
|
3159
|
-
},
|
|
3160
|
-
importPath: "@plasmicpkgs/antd5/skinny/registerUpload",
|
|
3161
|
-
importName: "UploadWrapper"
|
|
3162
|
-
});
|
|
3163
|
-
}
|
|
3164
|
-
|
|
3165
|
-
function registerAll(loader) {
|
|
3166
|
-
registerConfigProvider(loader);
|
|
3167
|
-
registerTokens(loader);
|
|
3168
|
-
registerSelect(loader);
|
|
3169
|
-
registerTable(loader);
|
|
3170
|
-
registerCheckbox(loader);
|
|
3171
|
-
registerRadio(loader);
|
|
3172
|
-
registerModal(loader);
|
|
3173
|
-
registerButton(loader);
|
|
3174
|
-
registerMenu(loader);
|
|
3175
|
-
registerDropdown(loader);
|
|
3176
|
-
registerForm(loader);
|
|
3177
|
-
registerFormItem(loader);
|
|
3178
|
-
registerFormGroup(loader);
|
|
3179
|
-
registerFormList(loader);
|
|
3180
|
-
registerInput(loader);
|
|
3181
|
-
registerPasswordInput(loader);
|
|
3182
|
-
registerTextArea(loader);
|
|
3183
|
-
registerNumberInput(loader);
|
|
3184
|
-
registerUpload(loader);
|
|
3185
|
-
}
|
|
3186
|
-
|
|
3187
|
-
export { registerAll };
|
|
3188
|
-
//# sourceMappingURL=antd.esm.js.map
|