@faasjs/ant-design 0.0.2-beta.453 → 0.0.2-beta.454

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.
Files changed (3) hide show
  1. package/dist/index.js +336 -288
  2. package/dist/index.mjs +225 -184
  3. package/package.json +3 -5
package/dist/index.js CHANGED
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
8
  var __export = (target, all) => {
26
9
  for (var name in all)
27
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -136,9 +119,10 @@ function ConfigProvider({
136
119
  }, []);
137
120
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
138
121
  value: values,
139
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, __spreadProps(__spreadValues({}, config.antd), {
122
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
123
+ ...config.antd,
140
124
  children
141
- }))
125
+ })
142
126
  });
143
127
  }
144
128
  function useConfigContext() {
@@ -146,10 +130,10 @@ function useConfigContext() {
146
130
  }
147
131
 
148
132
  // src/Blank.tsx
149
- var import_jsx_runtime2 = require("react/jsx-runtime");
133
+ var import_jsx_runtime = require("react/jsx-runtime");
150
134
  function Blank(options) {
151
135
  const { Blank: Blank2 } = useConfigContext();
152
- return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Typography.Text, {
136
+ return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Typography.Text, {
153
137
  disabled: true,
154
138
  children: (options == null ? void 0 : options.text) || Blank2.text
155
139
  }) : options.value;
@@ -198,40 +182,15 @@ var DatePicker = (0, import_generatePicker.default)(import_dayjs3.default);
198
182
  var import_icons = require("@ant-design/icons");
199
183
  var import_antd3 = require("antd");
200
184
  var import_lodash4 = require("lodash");
201
- var import_react4 = require("react");
202
-
203
- // ../react/src/index.tsx
204
185
  var import_react3 = require("react");
205
- var clients = {};
206
- function getClient(domain) {
207
- const client = clients[domain || Object.keys(clients)[0]];
208
- if (!client)
209
- throw Error("FaasReactClient is not initialized");
210
- return client;
211
- }
212
- async function faas(action, params) {
213
- return getClient().faas(action, params);
214
- }
215
- function FaasDataWrapper(props) {
216
- const [client, setClient] = (0, import_react3.useState)();
217
- (0, import_react3.useEffect)(() => {
218
- if (client)
219
- return;
220
- setClient(getClient());
221
- }, []);
222
- if (!client)
223
- return props.fallback || null;
224
- return (0, import_react3.createElement)(client.FaasDataWrapper, props);
225
- }
226
-
227
- // src/Description.tsx
228
- var import_jsx_runtime3 = require("react/jsx-runtime");
186
+ var import_react4 = require("@faasjs/react");
187
+ var import_jsx_runtime = require("react/jsx-runtime");
229
188
  function DescriptionItemContent(props) {
230
189
  var _a;
231
- const [computedProps, setComputedProps] = (0, import_react4.useState)();
232
- (0, import_react4.useEffect)(() => {
190
+ const [computedProps, setComputedProps] = (0, import_react3.useState)();
191
+ (0, import_react3.useEffect)(() => {
233
192
  var _a2, _b;
234
- const propsCopy = __spreadValues({}, props);
193
+ const propsCopy = { ...props };
235
194
  if (!propsCopy.item.title)
236
195
  propsCopy.item.title = (0, import_lodash4.upperFirst)(propsCopy.item.id);
237
196
  if (!propsCopy.item.type)
@@ -259,7 +218,7 @@ function DescriptionItemContent(props) {
259
218
  return null;
260
219
  if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
261
220
  if (computedProps.extendTypes[computedProps.item.type].children)
262
- return (0, import_react4.cloneElement)(
221
+ return (0, import_react3.cloneElement)(
263
222
  computedProps.extendTypes[computedProps.item.type].children,
264
223
  {
265
224
  value: computedProps.value,
@@ -267,62 +226,62 @@ function DescriptionItemContent(props) {
267
226
  }
268
227
  );
269
228
  else if (computedProps.extendTypes[computedProps.item.type].render)
270
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
229
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
271
230
  children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
272
231
  });
273
232
  else
274
233
  throw Error(computedProps.item.type + " requires children or render");
275
234
  if (computedProps.item.children)
276
- return (0, import_react4.cloneElement)(computedProps.item.children, { value: computedProps.value });
235
+ return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
277
236
  if (computedProps.item.render)
278
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
237
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
279
238
  children: computedProps.item.render(computedProps.value, computedProps.values)
280
239
  });
281
240
  if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
282
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blank, {});
241
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
283
242
  switch (computedProps.item.type) {
284
243
  case "string[]":
285
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
244
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
286
245
  children: computedProps.value.join(", ")
287
246
  });
288
247
  case "number":
289
248
  return computedProps.value || null;
290
249
  case "number[]":
291
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
250
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
292
251
  children: computedProps.value.join(", ")
293
252
  });
294
253
  case "boolean":
295
- return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CheckOutlined, {
254
+ return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {
296
255
  style: {
297
256
  marginTop: "4px",
298
257
  color: "#52c41a"
299
258
  }
300
- }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CloseOutlined, {
259
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {
301
260
  style: {
302
261
  marginTop: "4px",
303
262
  color: "#ff4d4f"
304
263
  }
305
264
  });
306
265
  case "time":
307
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
266
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
308
267
  children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
309
268
  });
310
269
  case "date":
311
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
270
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
312
271
  children: computedProps.value.format("YYYY-MM-DD")
313
272
  });
314
273
  case "object":
315
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Description, {
274
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
316
275
  items: computedProps.item.object,
317
276
  dataSource: computedProps.value,
318
277
  column: 1
319
278
  });
320
279
  case "object[]":
321
280
  if (!((_a = computedProps.value) == null ? void 0 : _a.length))
322
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blank, {});
323
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Space, {
281
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
282
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
324
283
  direction: "vertical",
325
- children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Description, {
284
+ children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
326
285
  items: computedProps.item.object,
327
286
  dataSource: value,
328
287
  column: 1
@@ -334,12 +293,13 @@ function DescriptionItemContent(props) {
334
293
  }
335
294
  function Description(props) {
336
295
  if (!props.faasData)
337
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, __spreadProps(__spreadValues({}, props), {
296
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
297
+ ...props,
338
298
  title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
339
299
  children: props.items.map((item) => {
340
- return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
300
+ return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
341
301
  label: item.title || (0, import_lodash4.upperFirst)(item.id),
342
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
302
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
343
303
  item,
344
304
  value: props.dataSource[item.id],
345
305
  values: props.dataSource,
@@ -347,18 +307,19 @@ function Description(props) {
347
307
  })
348
308
  }, item.id) : null;
349
309
  }).filter(Boolean)
350
- }));
351
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FaasDataWrapper, __spreadValues({
352
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Skeleton, {
310
+ });
311
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
312
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
353
313
  active: true
354
314
  }),
355
315
  render: ({ data }) => {
356
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, __spreadProps(__spreadValues({}, props), {
316
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
317
+ ...props,
357
318
  title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
358
319
  children: props.items.map((item) => {
359
- return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
320
+ return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
360
321
  label: item.title || (0, import_lodash4.upperFirst)(item.id),
361
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
322
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
362
323
  item,
363
324
  value: data[item.id],
364
325
  values: data,
@@ -366,55 +327,65 @@ function Description(props) {
366
327
  })
367
328
  }, item.id) : null;
368
329
  }).filter(Boolean)
369
- }));
370
- }
371
- }, props.faasData));
330
+ });
331
+ },
332
+ ...props.faasData
333
+ });
372
334
  }
373
335
 
374
336
  // src/Drawer.tsx
375
337
  var import_antd4 = require("antd");
376
- var import_react6 = require("react");
377
- var import_jsx_runtime4 = require("react/jsx-runtime");
338
+ var import_react5 = require("react");
339
+ var import_jsx_runtime = require("react/jsx-runtime");
378
340
  function useDrawer(init) {
379
- const [props, setProps] = (0, import_react6.useState)(__spreadValues({
341
+ const [props, setProps] = (0, import_react5.useState)({
380
342
  open: false,
381
- onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
343
+ onClose: () => setProps((prev) => ({
344
+ ...prev,
382
345
  open: false
383
- }))
384
- }, init));
346
+ })),
347
+ ...init
348
+ });
385
349
  return {
386
- drawer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Drawer, __spreadValues({}, props)),
350
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
351
+ ...props
352
+ }),
387
353
  drawerProps: props,
388
354
  setDrawerProps(changes) {
389
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
355
+ setProps((prev) => ({
356
+ ...prev,
357
+ ...changes
358
+ }));
390
359
  }
391
360
  };
392
361
  }
393
362
 
394
363
  // src/Form.tsx
364
+ var import_react8 = require("@faasjs/react");
395
365
  var import_antd6 = require("antd");
396
- var import_react10 = require("react");
366
+ var import_react9 = require("react");
397
367
 
398
368
  // src/FormItem.tsx
399
369
  var import_antd5 = require("antd");
400
370
  var import_icons2 = require("@ant-design/icons");
401
- var import_react8 = require("react");
371
+ var import_react7 = require("react");
402
372
  var import_lodash5 = require("lodash");
403
373
 
404
374
  // src/TimePicker.tsx
405
- var import_react7 = require("react");
406
- var import_jsx_runtime5 = require("react/jsx-runtime");
407
- var TimePicker = (0, import_react7.forwardRef)((props, ref) => {
408
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DatePicker, __spreadProps(__spreadValues({}, props), {
375
+ var import_react6 = require("react");
376
+ var import_jsx_runtime = require("react/jsx-runtime");
377
+ var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
378
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
379
+ ...props,
409
380
  picker: "time",
410
381
  mode: void 0,
411
382
  ref
412
- }));
383
+ });
413
384
  });
414
385
  TimePicker.displayName = "TimePicker";
415
386
 
416
387
  // src/FormItem.tsx
417
- var import_jsx_runtime6 = require("react/jsx-runtime");
388
+ var import_jsx_runtime = require("react/jsx-runtime");
418
389
  function processProps(propsCopy, config) {
419
390
  if (!propsCopy.title)
420
391
  propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
@@ -463,12 +434,12 @@ function processProps(propsCopy, config) {
463
434
  }
464
435
  function FormItem(props) {
465
436
  var _a;
466
- const [computedProps, setComputedProps] = (0, import_react8.useState)();
467
- const [extendTypes, setExtendTypes] = (0, import_react8.useState)();
437
+ const [computedProps, setComputedProps] = (0, import_react7.useState)();
438
+ const [extendTypes, setExtendTypes] = (0, import_react7.useState)();
468
439
  const config = useConfigContext();
469
- const [hidden, setHidden] = (0, import_react8.useState)(false);
470
- (0, import_react8.useEffect)(() => {
471
- const propsCopy = __spreadValues({}, props);
440
+ const [hidden, setHidden] = (0, import_react7.useState)(false);
441
+ (0, import_react7.useEffect)(() => {
442
+ const propsCopy = { ...props };
472
443
  if (propsCopy.extendTypes) {
473
444
  setExtendTypes(propsCopy.extendTypes);
474
445
  delete propsCopy.extendTypes;
@@ -487,71 +458,85 @@ function FormItem(props) {
487
458
  if (!computedProps)
488
459
  return null;
489
460
  if (hidden)
490
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
461
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
462
+ ...computedProps,
491
463
  noStyle: true,
492
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
464
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
493
465
  hidden: true
494
466
  })
495
- }));
467
+ });
496
468
  if (extendTypes && extendTypes[computedProps.type])
497
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
469
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
470
+ ...computedProps,
498
471
  children: extendTypes[computedProps.type].children
499
- }));
472
+ });
500
473
  if (computedProps.children)
501
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
474
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
475
+ ...computedProps,
502
476
  children: computedProps.children
503
- }));
477
+ });
504
478
  if (computedProps.render)
505
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
479
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
480
+ ...computedProps,
506
481
  children: computedProps.render()
507
- }));
482
+ });
508
483
  switch (computedProps.type) {
509
484
  case "string":
510
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
511
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, __spreadValues({}, computedProps.input))
512
- }));
485
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
486
+ ...computedProps,
487
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
488
+ ...computedProps.input
489
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
490
+ ...computedProps.input
491
+ })
492
+ });
513
493
  case "string[]":
514
494
  if (computedProps.options)
515
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
516
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, __spreadValues({
517
- mode: "multiple"
518
- }, computedProps.input))
519
- }));
520
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
495
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
496
+ ...computedProps,
497
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
498
+ mode: "multiple",
499
+ ...computedProps.input
500
+ })
501
+ });
502
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
521
503
  name: computedProps.name,
522
504
  rules: computedProps.rules,
523
505
  children: (fields, { add, remove }, { errors }) => {
524
506
  var _a2;
525
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
507
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
526
508
  children: [
527
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
509
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
528
510
  className: "ant-form-item-label",
529
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
511
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
530
512
  className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
531
513
  children: computedProps.label
532
514
  })
533
515
  }),
534
516
  fields.map((field) => {
535
517
  var _a3;
536
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
537
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
518
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
519
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
538
520
  gutter: 24,
539
521
  style: { flexFlow: "row nowrap" },
540
522
  children: [
541
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
523
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
542
524
  span: 23,
543
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, field), {
525
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
526
+ ...field,
544
527
  noStyle: true,
545
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, __spreadValues({}, computedProps.input))
546
- }))
528
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
529
+ ...computedProps.input
530
+ })
531
+ })
547
532
  }),
548
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
533
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
549
534
  span: 1,
550
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
535
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
551
536
  danger: true,
552
537
  type: "link",
553
538
  style: { float: "right" },
554
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
539
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
555
540
  onClick: () => remove(field.name)
556
541
  })
557
542
  })
@@ -559,15 +544,15 @@ function FormItem(props) {
559
544
  })
560
545
  }, field.key);
561
546
  }),
562
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
547
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
563
548
  children: [
564
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
549
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
565
550
  type: "dashed",
566
551
  block: true,
567
552
  onClick: () => add(),
568
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
553
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
569
554
  }),
570
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
555
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
571
556
  errors
572
557
  })
573
558
  ]
@@ -577,55 +562,63 @@ function FormItem(props) {
577
562
  }
578
563
  });
579
564
  case "number":
580
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
581
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, __spreadValues({
582
- style: { width: "100%" }
583
- }, computedProps.input))
584
- }));
565
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
566
+ ...computedProps,
567
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
568
+ ...computedProps.input
569
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
570
+ style: { width: "100%" },
571
+ ...computedProps.input
572
+ })
573
+ });
585
574
  case "number[]":
586
575
  if (computedProps.options)
587
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
588
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, __spreadValues({
589
- mode: "multiple"
590
- }, computedProps.input))
591
- }));
592
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
576
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
577
+ ...computedProps,
578
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
579
+ mode: "multiple",
580
+ ...computedProps.input
581
+ })
582
+ });
583
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
593
584
  name: computedProps.name,
594
585
  rules: computedProps.rules,
595
586
  children: (fields, { add, remove }, { errors }) => {
596
587
  var _a2, _b;
597
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
588
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
598
589
  children: [
599
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
590
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
600
591
  className: "ant-form-item-label",
601
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
592
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
602
593
  className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
603
594
  children: computedProps.label
604
595
  })
605
596
  }),
606
597
  fields.map((field) => {
607
598
  var _a3;
608
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
609
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
599
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
600
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
610
601
  gutter: 24,
611
602
  style: { flexFlow: "row nowrap" },
612
603
  children: [
613
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
604
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
614
605
  span: 23,
615
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, field), {
606
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
607
+ ...field,
616
608
  noStyle: true,
617
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, __spreadValues({
618
- style: { width: "100%" }
619
- }, computedProps.input))
620
- }))
609
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
610
+ style: { width: "100%" },
611
+ ...computedProps.input
612
+ })
613
+ })
621
614
  }),
622
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
615
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
623
616
  span: 1,
624
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
617
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
625
618
  danger: true,
626
619
  type: "link",
627
620
  style: { float: "right" },
628
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
621
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
629
622
  onClick: () => remove(field.name)
630
623
  })
631
624
  })
@@ -633,15 +626,15 @@ function FormItem(props) {
633
626
  })
634
627
  }, field.key);
635
628
  }),
636
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
629
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
637
630
  children: [
638
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
631
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
639
632
  type: "dashed",
640
633
  block: true,
641
634
  onClick: () => add(),
642
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
635
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
643
636
  }),
644
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
637
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
645
638
  errors
646
639
  })
647
640
  ]
@@ -651,47 +644,58 @@ function FormItem(props) {
651
644
  }
652
645
  });
653
646
  case "boolean":
654
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
655
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Switch, __spreadValues({}, computedProps.input))
656
- }));
647
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
648
+ ...computedProps,
649
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
650
+ ...computedProps.input
651
+ })
652
+ });
657
653
  case "date":
658
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
659
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DatePicker, __spreadValues({}, computedProps.input))
660
- }));
654
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
655
+ ...computedProps,
656
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
657
+ ...computedProps.input
658
+ })
659
+ });
661
660
  case "time":
662
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, __spreadProps(__spreadValues({}, computedProps), {
663
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimePicker, __spreadValues({}, computedProps.input))
664
- }));
661
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
662
+ ...computedProps,
663
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimePicker, {
664
+ ...computedProps.input
665
+ })
666
+ });
665
667
  case "object":
666
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
668
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
667
669
  children: [
668
- computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
670
+ computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
669
671
  className: "ant-form-item-label",
670
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
672
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
671
673
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
672
674
  children: computedProps.label
673
675
  })
674
676
  }),
675
- computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, __spreadValues({}, o), o.id))
677
+ computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
678
+ ...o
679
+ }, o.id))
676
680
  ]
677
681
  });
678
682
  case "object[]":
679
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
683
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
680
684
  name: computedProps.name,
681
685
  rules: computedProps.rules,
682
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
686
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
683
687
  children: [
684
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
688
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
685
689
  style: { marginBottom: 0 },
686
690
  children: [
687
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
691
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
688
692
  className: "ant-form-item-label",
689
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", {
693
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
690
694
  children: [
691
695
  computedProps.label,
692
696
  " ",
693
697
  field.name + 1,
694
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
698
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
695
699
  danger: true,
696
700
  type: "link",
697
701
  onClick: () => remove(field.name),
@@ -700,31 +704,32 @@ function FormItem(props) {
700
704
  ]
701
705
  })
702
706
  }),
703
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Row, {
707
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
704
708
  gutter: 24,
705
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
709
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
706
710
  span: o.col || 24,
707
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, __spreadProps(__spreadValues({}, o), {
711
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
712
+ ...o,
708
713
  name: [field.name, o.id]
709
- }))
714
+ })
710
715
  }, o.id))
711
716
  })
712
717
  ]
713
718
  }, field.key)),
714
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
719
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
715
720
  children: [
716
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Button, {
721
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
717
722
  type: "dashed",
718
723
  block: true,
719
724
  onClick: () => add(),
720
- icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {}),
725
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
721
726
  children: [
722
727
  config.common.add,
723
728
  " ",
724
729
  computedProps.label
725
730
  ]
726
731
  }),
727
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
732
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
728
733
  errors
729
734
  })
730
735
  ]
@@ -738,20 +743,21 @@ function FormItem(props) {
738
743
  }
739
744
 
740
745
  // src/Form.tsx
741
- var import_jsx_runtime7 = require("react/jsx-runtime");
746
+ var import_jsx_runtime = require("react/jsx-runtime");
742
747
  function Form(props) {
743
748
  var _a, _b;
744
- const [loading, setLoading] = (0, import_react10.useState)(false);
745
- const [computedProps, setComputedProps] = (0, import_react10.useState)();
749
+ const [loading, setLoading] = (0, import_react9.useState)(false);
750
+ const [computedProps, setComputedProps] = (0, import_react9.useState)();
746
751
  const config = useConfigContext();
747
- const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
752
+ const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
748
753
  const [form] = import_antd6.Form.useForm(props.form);
749
- const [initialValues, setInitialValues] = (0, import_react10.useState)(props.initialValues);
750
- (0, import_react10.useEffect)(() => {
754
+ const [initialValues, setInitialValues] = (0, import_react9.useState)(props.initialValues);
755
+ (0, import_react9.useEffect)(() => {
751
756
  var _a2, _b2;
752
- const propsCopy = __spreadProps(__spreadValues({}, props), {
757
+ const propsCopy = {
758
+ ...props,
753
759
  form
754
- });
760
+ };
755
761
  if (propsCopy.initialValues) {
756
762
  for (const key in propsCopy.initialValues)
757
763
  propsCopy.initialValues[key] = transferValue(
@@ -767,7 +773,10 @@ function Form(props) {
767
773
  setLoading(true);
768
774
  try {
769
775
  if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
770
- await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
776
+ await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
777
+ ...values2,
778
+ ...propsCopy.submit.to.params
779
+ } : values2));
771
780
  } else
772
781
  await props.onFinish(values);
773
782
  } catch (error) {
@@ -778,7 +787,10 @@ function Form(props) {
778
787
  } else if (propsCopy.submit && ((_b2 = propsCopy.submit.to) == null ? void 0 : _b2.action)) {
779
788
  propsCopy.onFinish = async (values) => {
780
789
  setLoading(true);
781
- return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).finally(() => setLoading(false));
790
+ return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
791
+ ...values,
792
+ ...propsCopy.submit.to.params
793
+ } : values).finally(() => setLoading(false));
782
794
  };
783
795
  }
784
796
  if (propsCopy.extendTypes) {
@@ -787,7 +799,7 @@ function Form(props) {
787
799
  }
788
800
  setComputedProps(propsCopy);
789
801
  }, [props]);
790
- const onValuesChange = (0, import_react10.useCallback)((changedValues, allValues) => {
802
+ const onValuesChange = (0, import_react9.useCallback)((changedValues, allValues) => {
791
803
  if (props.onValuesChange) {
792
804
  props.onValuesChange(changedValues, allValues);
793
805
  }
@@ -799,7 +811,7 @@ function Form(props) {
799
811
  item.onValueChange(changedValues[key], allValues, form);
800
812
  }
801
813
  }, [computedProps]);
802
- (0, import_react10.useEffect)(() => {
814
+ (0, import_react9.useEffect)(() => {
803
815
  if (!initialValues)
804
816
  return;
805
817
  form.setFieldsValue(initialValues);
@@ -807,15 +819,17 @@ function Form(props) {
807
819
  }, [computedProps]);
808
820
  if (!computedProps)
809
821
  return null;
810
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd6.Form, __spreadProps(__spreadValues({}, computedProps), {
822
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
823
+ ...computedProps,
811
824
  onValuesChange,
812
825
  children: [
813
826
  computedProps.beforeItems,
814
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FormItem, __spreadProps(__spreadValues({}, item), {
827
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
828
+ ...item,
815
829
  extendTypes
816
- }), item.id)),
830
+ }, item.id)),
817
831
  computedProps.children,
818
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_antd6.Button, {
832
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
819
833
  htmlType: "submit",
820
834
  type: "primary",
821
835
  loading,
@@ -823,14 +837,14 @@ function Form(props) {
823
837
  }),
824
838
  computedProps.footer
825
839
  ]
826
- }));
840
+ });
827
841
  }
828
842
  Form.useForm = import_antd6.Form.useForm;
829
843
 
830
844
  // src/Link.tsx
831
845
  var import_react_router_dom = require("react-router-dom");
832
846
  var import_antd7 = require("antd");
833
- var import_jsx_runtime8 = require("react/jsx-runtime");
847
+ var import_jsx_runtime = require("react/jsx-runtime");
834
848
  function Link({
835
849
  href,
836
850
  target,
@@ -843,104 +857,127 @@ function Link({
843
857
  style = Object.assign({ cursor: "pointer" }, style);
844
858
  if (href.startsWith("http")) {
845
859
  if (button)
846
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, __spreadProps(__spreadValues({}, button), {
847
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
860
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
861
+ ...button,
862
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
848
863
  href,
849
864
  target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
850
- style: __spreadValues(__spreadValues({}, Link2.style), style || {}),
865
+ style: {
866
+ ...Link2.style,
867
+ ...style || {}
868
+ },
851
869
  children: text || children
852
870
  })
853
- }));
854
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
871
+ });
872
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
855
873
  href,
856
874
  target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
857
- style: __spreadValues(__spreadValues({}, Link2.style), style || {}),
875
+ style: {
876
+ ...Link2.style,
877
+ ...style || {}
878
+ },
858
879
  children: text || children
859
880
  });
860
881
  }
861
882
  if (button)
862
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, __spreadProps(__spreadValues({}, button), {
863
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
883
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
884
+ ...button,
885
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
864
886
  to: href,
865
887
  target: target || (Link2 == null ? void 0 : Link2.target),
866
- style: __spreadValues(__spreadValues({}, Link2.style), style || {}),
888
+ style: {
889
+ ...Link2.style,
890
+ ...style || {}
891
+ },
867
892
  children: text || children
868
893
  })
869
- }));
870
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
894
+ });
895
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
871
896
  to: href,
872
897
  target: target || (Link2 == null ? void 0 : Link2.target),
873
- style: __spreadValues(__spreadValues({}, Link2.style), style || {}),
898
+ style: {
899
+ ...Link2.style,
900
+ ...style || {}
901
+ },
874
902
  children: text || children
875
903
  });
876
904
  }
877
905
 
878
906
  // src/Modal.tsx
879
907
  var import_antd8 = require("antd");
880
- var import_react11 = require("react");
881
- var import_jsx_runtime9 = require("react/jsx-runtime");
908
+ var import_react10 = require("react");
909
+ var import_jsx_runtime = require("react/jsx-runtime");
882
910
  function useModal(init) {
883
- const [props, setProps] = (0, import_react11.useState)(__spreadValues({
911
+ const [props, setProps] = (0, import_react10.useState)({
884
912
  open: false,
885
- onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
913
+ onCancel: () => setProps((prev) => ({
914
+ ...prev,
886
915
  open: false
887
- }))
888
- }, init));
916
+ })),
917
+ ...init
918
+ });
889
919
  return {
890
- modal: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd8.Modal, __spreadValues({}, props)),
920
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
921
+ ...props
922
+ }),
891
923
  modalProps: props,
892
924
  setModalProps(changes) {
893
- setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
925
+ setProps((prev) => ({
926
+ ...prev,
927
+ ...changes
928
+ }));
894
929
  }
895
930
  };
896
931
  }
897
932
 
898
933
  // src/Routers.tsx
899
934
  var import_antd9 = require("antd");
900
- var import_react12 = require("react");
935
+ var import_react11 = require("react");
901
936
  var import_react_router_dom2 = require("react-router-dom");
902
- var import_jsx_runtime10 = require("react/jsx-runtime");
937
+ var import_jsx_runtime = require("react/jsx-runtime");
903
938
  function PageNotFound() {
904
939
  const config = useConfigContext();
905
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Result, {
940
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
906
941
  status: "404",
907
942
  title: config.common.pageNotFound
908
943
  });
909
944
  }
910
945
  function Routes(props) {
911
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_router_dom2.Routes, {
946
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
912
947
  children: [
913
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, __spreadProps(__spreadValues({}, r), {
914
- element: r.element || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react12.Suspense, {
915
- fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
948
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
949
+ ...r,
950
+ element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
951
+ fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
916
952
  style: { padding: "24px" },
917
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Skeleton, {
953
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
918
954
  active: true
919
955
  })
920
956
  }),
921
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(r.page, {})
957
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
922
958
  })
923
- }), r.path)),
924
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
959
+ }, r.path)),
960
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
925
961
  path: "*",
926
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageNotFound, {})
962
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
927
963
  }, "*")
928
964
  ]
929
965
  });
930
966
  }
931
967
 
932
968
  // src/Table.tsx
933
- var import_react13 = require("react");
969
+ var import_react12 = require("react");
934
970
  var import_antd10 = require("antd");
935
971
  var import_dayjs4 = __toESM(require("dayjs"));
936
972
  var import_icons3 = require("@ant-design/icons");
937
973
  var import_lodash6 = require("lodash");
938
- var import_jsx_runtime11 = require("react/jsx-runtime");
974
+ var import_react13 = require("@faasjs/react");
975
+ var import_jsx_runtime = require("react/jsx-runtime");
939
976
  function processValue(item, value) {
940
977
  var _a;
941
978
  const transferred = transferValue(item.type, value);
942
979
  if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
943
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {});
980
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
944
981
  if (item.options) {
945
982
  if (item.type.endsWith("[]"))
946
983
  return transferred.map((v) => {
@@ -961,9 +998,9 @@ function processValue(item, value) {
961
998
  return value;
962
999
  }
963
1000
  function Table(props) {
964
- const [columns, setColumns] = (0, import_react13.useState)();
1001
+ const [columns, setColumns] = (0, import_react12.useState)();
965
1002
  const { common: common2 } = useConfigContext();
966
- (0, import_react13.useEffect)(() => {
1003
+ (0, import_react12.useEffect)(() => {
967
1004
  var _a;
968
1005
  for (const item of props.items) {
969
1006
  if (!item.key)
@@ -985,7 +1022,7 @@ function Table(props) {
985
1022
  delete item.children;
986
1023
  if (props.extendTypes && props.extendTypes[item.type]) {
987
1024
  if (props.extendTypes[item.type].children)
988
- item.render = (value, values) => (0, import_react13.cloneElement)(
1025
+ item.render = (value, values) => (0, import_react12.cloneElement)(
989
1026
  props.extendTypes[item.type].children,
990
1027
  {
991
1028
  value,
@@ -1013,7 +1050,7 @@ function Table(props) {
1013
1050
  setSelectedKeys,
1014
1051
  confirm,
1015
1052
  clearFilters
1016
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
1053
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1017
1054
  placeholder: `${common2.search} ${item.title}`,
1018
1055
  allowClear: true,
1019
1056
  onSearch: (v) => {
@@ -1041,7 +1078,7 @@ function Table(props) {
1041
1078
  setSelectedKeys,
1042
1079
  confirm,
1043
1080
  clearFilters
1044
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
1081
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1045
1082
  placeholder: `${common2.search} ${item.title}`,
1046
1083
  allowClear: true,
1047
1084
  onSearch: (v) => {
@@ -1067,7 +1104,7 @@ function Table(props) {
1067
1104
  setSelectedKeys,
1068
1105
  confirm,
1069
1106
  clearFilters
1070
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
1107
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1071
1108
  placeholder: `${common2.search} ${item.title}`,
1072
1109
  allowClear: true,
1073
1110
  onSearch: (v) => {
@@ -1091,7 +1128,7 @@ function Table(props) {
1091
1128
  setSelectedKeys,
1092
1129
  confirm,
1093
1130
  clearFilters
1094
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
1131
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
1095
1132
  placeholder: `${common2.search} ${item.title}`,
1096
1133
  allowClear: true,
1097
1134
  onSearch: (v) => {
@@ -1107,12 +1144,12 @@ function Table(props) {
1107
1144
  break;
1108
1145
  case "boolean":
1109
1146
  if (!item.render)
1110
- item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
1147
+ item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1111
1148
  style: {
1112
1149
  marginTop: "4px",
1113
1150
  color: "#52c41a"
1114
1151
  }
1115
- }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
1152
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1116
1153
  style: {
1117
1154
  marginTop: "4px",
1118
1155
  color: "#ff4d4f"
@@ -1123,7 +1160,7 @@ function Table(props) {
1123
1160
  setSelectedKeys,
1124
1161
  selectedKeys,
1125
1162
  confirm
1126
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd10.Radio.Group, {
1163
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
1127
1164
  style: { padding: 8 },
1128
1165
  buttonStyle: "solid",
1129
1166
  value: selectedKeys[0],
@@ -1132,28 +1169,28 @@ function Table(props) {
1132
1169
  confirm();
1133
1170
  },
1134
1171
  children: [
1135
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1136
1173
  children: common2.all
1137
1174
  }),
1138
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1175
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1139
1176
  value: "true",
1140
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
1177
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
1141
1178
  style: {
1142
1179
  color: "#52c41a",
1143
1180
  verticalAlign: "middle"
1144
1181
  }
1145
1182
  })
1146
1183
  }),
1147
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1148
1185
  value: "false",
1149
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
1186
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
1150
1187
  style: {
1151
1188
  verticalAlign: "middle",
1152
1189
  color: "#ff4d4f"
1153
1190
  }
1154
1191
  })
1155
1192
  }),
1156
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
1193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
1157
1194
  value: "empty",
1158
1195
  children: common2.blank
1159
1196
  })
@@ -1191,7 +1228,7 @@ function Table(props) {
1191
1228
  break;
1192
1229
  case "object":
1193
1230
  if (!item.render)
1194
- item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Description, {
1231
+ item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
1195
1232
  items: item.object,
1196
1233
  dataSource: value,
1197
1234
  column: 1
@@ -1199,7 +1236,7 @@ function Table(props) {
1199
1236
  break;
1200
1237
  case "object[]":
1201
1238
  if (!item.render)
1202
- item.render = (value) => value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Description, {
1239
+ item.render = (value) => value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
1203
1240
  items: item.object,
1204
1241
  dataSource: v,
1205
1242
  column: 1
@@ -1215,7 +1252,7 @@ function Table(props) {
1215
1252
  }
1216
1253
  setColumns(props.items);
1217
1254
  }, [props.items]);
1218
- (0, import_react13.useEffect)(() => {
1255
+ (0, import_react12.useEffect)(() => {
1219
1256
  if (!props.dataSource || !columns)
1220
1257
  return;
1221
1258
  for (const column of columns) {
@@ -1235,13 +1272,14 @@ function Table(props) {
1235
1272
  if (!columns)
1236
1273
  return null;
1237
1274
  if (!props.faasData)
1238
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, __spreadProps(__spreadValues({}, props), {
1275
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1276
+ ...props,
1239
1277
  rowKey: props.rowKey || "id",
1240
1278
  columns,
1241
1279
  dataSource: props.dataSource
1242
- }));
1243
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FaasDataWrapper, __spreadValues({
1244
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Skeleton, {
1280
+ });
1281
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
1282
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1245
1283
  active: true
1246
1284
  }),
1247
1285
  render: ({
@@ -1250,74 +1288,84 @@ function Table(props) {
1250
1288
  reload
1251
1289
  }) => {
1252
1290
  if (!data)
1253
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, __spreadProps(__spreadValues({}, props), {
1291
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1292
+ ...props,
1254
1293
  rowKey: props.rowKey || "id",
1255
1294
  columns,
1256
1295
  dataSource: []
1257
- }));
1296
+ });
1258
1297
  if (Array.isArray(data))
1259
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, __spreadProps(__spreadValues({}, props), {
1298
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1299
+ ...props,
1260
1300
  rowKey: props.rowKey || "id",
1261
1301
  columns,
1262
1302
  dataSource: data
1263
- }));
1264
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, __spreadProps(__spreadValues({}, props), {
1303
+ });
1304
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1305
+ ...props,
1265
1306
  rowKey: props.rowKey || "id",
1266
1307
  columns,
1267
1308
  dataSource: data.rows,
1268
- pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
1309
+ pagination: {
1310
+ ...props.pagination,
1311
+ ...data.pagination
1312
+ },
1269
1313
  onChange: (pagination, filters, sorter, extra) => {
1270
1314
  if (props.onChange) {
1271
1315
  const processed = props.onChange(pagination, filters, sorter, extra);
1272
- reload(__spreadProps(__spreadValues({}, params), {
1316
+ reload({
1317
+ ...params,
1273
1318
  pagination: processed.pagination,
1274
1319
  filters: processed.filters,
1275
1320
  sorter: processed.sorter
1276
- }));
1321
+ });
1277
1322
  return;
1278
1323
  }
1279
- reload(__spreadProps(__spreadValues({}, params), {
1324
+ reload({
1325
+ ...params,
1280
1326
  pagination,
1281
1327
  filters,
1282
1328
  sorter
1283
- }));
1329
+ });
1284
1330
  }
1285
- }));
1286
- }
1287
- }, props.faasData));
1331
+ });
1332
+ },
1333
+ ...props.faasData
1334
+ });
1288
1335
  }
1289
1336
 
1290
1337
  // src/Title.tsx
1291
- var import_react15 = require("react");
1338
+ var import_react14 = require("react");
1292
1339
  var import_antd11 = require("antd");
1293
- var import_jsx_runtime12 = require("react/jsx-runtime");
1340
+ var import_jsx_runtime = require("react/jsx-runtime");
1294
1341
  function Title(props) {
1295
1342
  const { Title: Title2 } = useConfigContext();
1296
- (0, import_react15.useEffect)(() => {
1343
+ (0, import_react14.useEffect)(() => {
1297
1344
  const title = Array.isArray(props.title) ? props.title : [props.title];
1298
1345
  document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
1299
1346
  }, [props]);
1300
1347
  if (props.h1) {
1301
1348
  if (typeof props.h1 === "boolean")
1302
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
1349
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1303
1350
  children: Array.isArray(props.title) ? props.title[0] : props.title
1304
1351
  });
1305
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
1352
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
1306
1353
  className: props.h1.className,
1307
1354
  style: props.h1.style,
1308
1355
  children: Array.isArray(props.title) ? props.title[0] : props.title
1309
1356
  });
1310
1357
  }
1311
1358
  if (props.plain)
1312
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, {
1359
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
1313
1360
  children: Array.isArray(props.title) ? props.title[0] : props.title
1314
1361
  });
1315
1362
  if (props.header)
1316
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_antd11.PageHeader, __spreadValues({
1317
- title: Array.isArray(props.title) ? props.title[0] : props.title
1318
- }, props.header));
1363
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.PageHeader, {
1364
+ title: Array.isArray(props.title) ? props.title[0] : props.title,
1365
+ ...props.header
1366
+ });
1319
1367
  if (props.children)
1320
- return (0, import_react15.cloneElement)(props.children, { title: props.title });
1368
+ return (0, import_react14.cloneElement)(props.children, { title: props.title });
1321
1369
  return null;
1322
1370
  }
1323
1371
  // Annotate the CommonJS export names for ESM import in node: