@faasjs/ant-design 0.0.2-beta.406 → 0.0.2-beta.408

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/index.js CHANGED
@@ -32,10 +32,12 @@ __export(src_exports, {
32
32
  ConfigProvider: () => ConfigProvider,
33
33
  DatePicker: () => DatePicker,
34
34
  Description: () => Description,
35
- Drawer: () => import_antd3.Drawer,
35
+ Drawer: () => import_antd4.Drawer,
36
36
  Form: () => Form,
37
37
  FormItem: () => FormItem,
38
- Modal: () => import_antd6.Modal,
38
+ Link: () => Link,
39
+ Modal: () => import_antd8.Modal,
40
+ PageNotFound: () => PageNotFound,
39
41
  Routes: () => Routes,
40
42
  Table: () => Table,
41
43
  TimePicker: () => TimePicker,
@@ -51,14 +53,16 @@ module.exports = __toCommonJS(src_exports);
51
53
  var import_react = __toESM(require("react"));
52
54
 
53
55
  // src/Blank.tsx
54
- var import_antd = require("antd");
55
- var import_lodash = require("lodash");
56
+ var import_antd2 = require("antd");
57
+ var import_lodash2 = require("lodash");
56
58
 
57
59
  // src/Config.tsx
58
60
  var import_react2 = require("react");
61
+ var import_antd = require("antd");
62
+ var import_lodash = require("lodash");
59
63
  var import_jsx_runtime = require("react/jsx-runtime");
60
64
  var isZH = /^zh/i.test(navigator.language);
61
- var common = isZH ? {
65
+ var zh = {
62
66
  lang: "zh",
63
67
  blank: "\u7A7A",
64
68
  all: "\u5168\u90E8",
@@ -67,7 +71,8 @@ var common = isZH ? {
67
71
  add: "\u6DFB\u52A0",
68
72
  delete: "\u5220\u9664",
69
73
  required: "\u5FC5\u586B"
70
- } : {
74
+ };
75
+ var en = {
71
76
  lang: "en",
72
77
  blank: "Empty",
73
78
  all: "All",
@@ -77,7 +82,9 @@ var common = isZH ? {
77
82
  delete: "Delete",
78
83
  required: "is required"
79
84
  };
85
+ var common = isZH ? zh : en;
80
86
  var baseConfig = {
87
+ antd: {},
81
88
  lang: "en",
82
89
  common,
83
90
  Blank: { text: common.blank },
@@ -85,19 +92,32 @@ var baseConfig = {
85
92
  Title: {
86
93
  separator: " - ",
87
94
  suffix: ""
88
- }
95
+ },
96
+ Link: { style: {} }
89
97
  };
90
98
  var ConfigContext = (0, import_react2.createContext)(baseConfig);
91
99
  function ConfigProvider({
92
100
  config,
93
101
  children
94
102
  }) {
103
+ const [values, setValues] = (0, import_react2.useState)(baseConfig);
104
+ (0, import_react2.useEffect)(() => {
105
+ if (config.lang === "zh") {
106
+ setValues((0, import_lodash.defaultsDeep)(config, {
107
+ lang: "zh",
108
+ common: zh,
109
+ Blank: { text: zh.blank },
110
+ Form: { submit: { text: zh.submit } }
111
+ }, baseConfig));
112
+ } else
113
+ setValues(values);
114
+ }, []);
95
115
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
96
- value: {
97
- ...baseConfig,
98
- ...config
99
- },
100
- children
116
+ value: values,
117
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
118
+ ...config.antd,
119
+ children
120
+ })
101
121
  });
102
122
  }
103
123
  function useConfigContext() {
@@ -107,10 +127,10 @@ function useConfigContext() {
107
127
  // src/Blank.tsx
108
128
  var import_jsx_runtime = require("react/jsx-runtime");
109
129
  function Blank(options) {
110
- const config = useConfigContext();
111
- return !options || (0, import_lodash.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, {
130
+ const { Blank: Blank2 } = useConfigContext();
131
+ 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, {
112
132
  disabled: true,
113
- children: (options == null ? void 0 : options.text) || config.Blank.text
133
+ children: (options == null ? void 0 : options.text) || Blank2.text
114
134
  }) : options.value;
115
135
  }
116
136
 
@@ -121,12 +141,12 @@ var import_style = require("antd/es/calendar/style/index.js");
121
141
  var Calendar = (0, import_generateCalendar.default)(import_dayjs.default);
122
142
 
123
143
  // src/data.ts
124
- var import_lodash2 = require("lodash");
144
+ var import_lodash3 = require("lodash");
125
145
  function transferOptions(options) {
126
146
  if (!options)
127
147
  return [];
128
148
  return options.map((item) => typeof item === "object" ? item : {
129
- label: (0, import_lodash2.upperFirst)(item.toString()),
149
+ label: (0, import_lodash3.upperFirst)(item.toString()),
130
150
  value: item
131
151
  });
132
152
  }
@@ -139,8 +159,8 @@ var DatePicker = (0, import_generatePicker.default)(import_dayjs2.default);
139
159
 
140
160
  // src/Description.tsx
141
161
  var import_icons = require("@ant-design/icons");
142
- var import_antd2 = require("antd");
143
- var import_lodash3 = require("lodash");
162
+ var import_antd3 = require("antd");
163
+ var import_lodash4 = require("lodash");
144
164
  var import_react3 = require("react");
145
165
  var import_dayjs3 = __toESM(require("dayjs"));
146
166
  var import_react4 = require("@faasjs/react");
@@ -151,7 +171,7 @@ function DescriptionItemContent(props) {
151
171
  var _a, _b;
152
172
  const propsCopy = { ...props };
153
173
  if (!propsCopy.item.title)
154
- propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
174
+ propsCopy.item.title = (0, import_lodash4.upperFirst)(propsCopy.item.id);
155
175
  if (!propsCopy.item.type)
156
176
  propsCopy.item.type = "string";
157
177
  if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
@@ -234,10 +254,10 @@ function DescriptionItemContent(props) {
234
254
  }
235
255
  function Description(props) {
236
256
  if (!props.faasData)
237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
257
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
238
258
  ...props,
239
- children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
240
- label: item.title || (0, import_lodash3.upperFirst)(item.id),
259
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
260
+ label: item.title || (0, import_lodash4.upperFirst)(item.id),
241
261
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
242
262
  item,
243
263
  value: props.dataSource[item.id],
@@ -247,13 +267,13 @@ function Description(props) {
247
267
  }, item.id))
248
268
  });
249
269
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
250
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Skeleton, {
270
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
251
271
  active: true
252
272
  }),
253
- render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
273
+ render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
254
274
  ...props,
255
- children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
256
- label: item.title || (0, import_lodash3.upperFirst)(item.id),
275
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
276
+ label: item.title || (0, import_lodash4.upperFirst)(item.id),
257
277
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
258
278
  item,
259
279
  value: data[item.id],
@@ -267,7 +287,7 @@ function Description(props) {
267
287
  }
268
288
 
269
289
  // src/Drawer.tsx
270
- var import_antd3 = require("antd");
290
+ var import_antd4 = require("antd");
271
291
  var import_react5 = require("react");
272
292
  var import_jsx_runtime = require("react/jsx-runtime");
273
293
  function useDrawer(init) {
@@ -280,7 +300,7 @@ function useDrawer(init) {
280
300
  ...init
281
301
  });
282
302
  return {
283
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Drawer, {
303
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
284
304
  ...props
285
305
  }),
286
306
  drawerProps: props,
@@ -295,14 +315,14 @@ function useDrawer(init) {
295
315
 
296
316
  // src/Form.tsx
297
317
  var import_react8 = require("@faasjs/react");
298
- var import_antd5 = require("antd");
318
+ var import_antd6 = require("antd");
299
319
  var import_react9 = require("react");
300
320
 
301
321
  // src/FormItem.tsx
302
- var import_antd4 = require("antd");
322
+ var import_antd5 = require("antd");
303
323
  var import_icons2 = require("@ant-design/icons");
304
324
  var import_react7 = require("react");
305
- var import_lodash4 = require("lodash");
325
+ var import_lodash5 = require("lodash");
306
326
 
307
327
  // src/TimePicker.tsx
308
328
  var import_react6 = require("react");
@@ -322,7 +342,7 @@ var import_dayjs4 = __toESM(require("dayjs"));
322
342
  var import_jsx_runtime = require("react/jsx-runtime");
323
343
  function processProps(propsCopy, config) {
324
344
  if (!propsCopy.title)
325
- propsCopy.title = (0, import_lodash4.upperFirst)(propsCopy.id);
345
+ propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
326
346
  if (!propsCopy.label && propsCopy.label !== false)
327
347
  propsCopy.label = propsCopy.title;
328
348
  if (!propsCopy.name)
@@ -402,40 +422,40 @@ function FormItem(props) {
402
422
  if (!computedProps)
403
423
  return null;
404
424
  if (extendTypes && extendTypes[computedProps.type])
405
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
425
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
406
426
  ...computedProps,
407
427
  children: extendTypes[computedProps.type].children
408
428
  });
409
429
  if (computedProps.children)
410
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
430
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
411
431
  ...computedProps,
412
432
  children: computedProps.children
413
433
  });
414
434
  if (computedProps.render)
415
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
435
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
416
436
  ...computedProps,
417
437
  children: computedProps.render()
418
438
  });
419
439
  switch (computedProps.type) {
420
440
  case "string":
421
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
441
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
422
442
  ...computedProps,
423
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
443
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
424
444
  ...computedProps.input
425
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
445
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
426
446
  ...computedProps.input
427
447
  })
428
448
  });
429
449
  case "string[]":
430
450
  if (computedProps.options)
431
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
451
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
432
452
  ...computedProps,
433
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
453
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
434
454
  mode: "multiple",
435
455
  ...computedProps.input
436
456
  })
437
457
  });
438
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
458
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
439
459
  name: computedProps.name,
440
460
  rules: computedProps.rules,
441
461
  children: (fields, { add, remove }, { errors }) => {
@@ -451,24 +471,24 @@ function FormItem(props) {
451
471
  }),
452
472
  fields.map((field) => {
453
473
  var _a3;
454
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
455
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
474
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
475
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
456
476
  gutter: 24,
457
477
  style: { flexFlow: "row nowrap" },
458
478
  children: [
459
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
479
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
460
480
  span: 23,
461
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
481
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
462
482
  ...field,
463
483
  noStyle: true,
464
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
484
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
465
485
  ...computedProps.input
466
486
  })
467
487
  })
468
488
  }),
469
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
489
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
470
490
  span: 1,
471
- 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_antd4.Button, {
491
+ 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, {
472
492
  danger: true,
473
493
  type: "link",
474
494
  style: { float: "right" },
@@ -480,15 +500,15 @@ function FormItem(props) {
480
500
  })
481
501
  }, field.key);
482
502
  }),
483
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
503
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
484
504
  children: [
485
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
505
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
486
506
  type: "dashed",
487
507
  block: true,
488
508
  onClick: () => add(),
489
509
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
490
510
  }),
491
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
511
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
492
512
  errors
493
513
  })
494
514
  ]
@@ -498,25 +518,25 @@ function FormItem(props) {
498
518
  }
499
519
  });
500
520
  case "number":
501
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
521
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
502
522
  ...computedProps,
503
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
523
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
504
524
  ...computedProps.input
505
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
525
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
506
526
  style: { width: "100%" },
507
527
  ...computedProps.input
508
528
  })
509
529
  });
510
530
  case "number[]":
511
531
  if (computedProps.options)
512
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
532
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
513
533
  ...computedProps,
514
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
534
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
515
535
  mode: "multiple",
516
536
  ...computedProps.input
517
537
  })
518
538
  });
519
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
539
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
520
540
  name: computedProps.name,
521
541
  rules: computedProps.rules,
522
542
  children: (fields, { add, remove }, { errors }) => {
@@ -532,25 +552,25 @@ function FormItem(props) {
532
552
  }),
533
553
  fields.map((field) => {
534
554
  var _a3;
535
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
536
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
555
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
556
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
537
557
  gutter: 24,
538
558
  style: { flexFlow: "row nowrap" },
539
559
  children: [
540
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
560
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
541
561
  span: 23,
542
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
562
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
543
563
  ...field,
544
564
  noStyle: true,
545
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
565
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
546
566
  style: { width: "100%" },
547
567
  ...computedProps.input
548
568
  })
549
569
  })
550
570
  }),
551
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
571
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
552
572
  span: 1,
553
- 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_antd4.Button, {
573
+ 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, {
554
574
  danger: true,
555
575
  type: "link",
556
576
  style: { float: "right" },
@@ -562,15 +582,15 @@ function FormItem(props) {
562
582
  })
563
583
  }, field.key);
564
584
  }),
565
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
585
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
566
586
  children: [
567
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
587
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
568
588
  type: "dashed",
569
589
  block: true,
570
590
  onClick: () => add(),
571
591
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
572
592
  }),
573
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
593
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
574
594
  errors
575
595
  })
576
596
  ]
@@ -580,21 +600,21 @@ function FormItem(props) {
580
600
  }
581
601
  });
582
602
  case "boolean":
583
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
603
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
584
604
  ...computedProps,
585
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Switch, {
605
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
586
606
  ...computedProps.input
587
607
  })
588
608
  });
589
609
  case "date":
590
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
610
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
591
611
  ...computedProps,
592
612
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DateItem, {
593
613
  ...computedProps.input
594
614
  })
595
615
  });
596
616
  case "time":
597
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
617
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
598
618
  ...computedProps,
599
619
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimeItem, {
600
620
  ...computedProps.input
@@ -616,12 +636,12 @@ function FormItem(props) {
616
636
  ]
617
637
  });
618
638
  case "object[]":
619
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
639
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
620
640
  name: computedProps.name,
621
641
  rules: computedProps.rules,
622
642
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
623
643
  children: [
624
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
644
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
625
645
  style: { marginBottom: 0 },
626
646
  children: [
627
647
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -631,7 +651,7 @@ function FormItem(props) {
631
651
  computedProps.label,
632
652
  " ",
633
653
  field.name + 1,
634
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
654
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
635
655
  danger: true,
636
656
  type: "link",
637
657
  onClick: () => remove(field.name),
@@ -640,9 +660,9 @@ function FormItem(props) {
640
660
  ]
641
661
  })
642
662
  }),
643
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Row, {
663
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
644
664
  gutter: 24,
645
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
665
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
646
666
  span: o.col || 6,
647
667
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
648
668
  ...o,
@@ -652,9 +672,9 @@ function FormItem(props) {
652
672
  })
653
673
  ]
654
674
  }, field.key)),
655
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
675
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
656
676
  children: [
657
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Button, {
677
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
658
678
  type: "dashed",
659
679
  block: true,
660
680
  onClick: () => add(),
@@ -665,7 +685,7 @@ function FormItem(props) {
665
685
  computedProps.label
666
686
  ]
667
687
  }),
668
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
688
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
669
689
  errors
670
690
  })
671
691
  ]
@@ -708,10 +728,11 @@ function Form(props) {
708
728
  };
709
729
  } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
710
730
  propsCopy.onFinish = async (values) => {
711
- return await (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
731
+ setLoading(true);
732
+ return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
712
733
  ...values,
713
734
  ...propsCopy.submit.to.params
714
- } : values);
735
+ } : values).finally(() => setLoading(false));
715
736
  };
716
737
  }
717
738
  if (propsCopy.extendTypes) {
@@ -722,7 +743,7 @@ function Form(props) {
722
743
  }, []);
723
744
  if (!computedProps)
724
745
  return null;
725
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form, {
746
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
726
747
  ...computedProps,
727
748
  children: [
728
749
  computedProps.beforeItems,
@@ -731,7 +752,7 @@ function Form(props) {
731
752
  extendTypes
732
753
  }, item.id)),
733
754
  computedProps.children,
734
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
755
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
735
756
  htmlType: "submit",
736
757
  type: "primary",
737
758
  loading,
@@ -741,11 +762,49 @@ function Form(props) {
741
762
  ]
742
763
  });
743
764
  }
744
- Form.useForm = import_antd5.Form.useForm;
765
+ Form.useForm = import_antd6.Form.useForm;
745
766
  Form.Item = FormItem;
746
767
 
768
+ // src/Link.tsx
769
+ var import_react_router_dom = require("react-router-dom");
770
+ var import_antd7 = require("antd");
771
+ var import_jsx_runtime = require("react/jsx-runtime");
772
+ function Link({
773
+ href,
774
+ target,
775
+ text,
776
+ children,
777
+ style,
778
+ button
779
+ }) {
780
+ const { Link: Link2 } = useConfigContext();
781
+ style = Object.assign({ cursor: "pointer" }, style);
782
+ if (button)
783
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
784
+ ...button,
785
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
786
+ to: href,
787
+ target: target || (Link2 == null ? void 0 : Link2.target),
788
+ style: {
789
+ ...Link2.style,
790
+ ...style || {}
791
+ },
792
+ children: text || children
793
+ })
794
+ });
795
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
796
+ to: href,
797
+ target: target || (Link2 == null ? void 0 : Link2.target),
798
+ style: {
799
+ ...Link2.style,
800
+ ...style || {}
801
+ },
802
+ children: text || children
803
+ });
804
+ }
805
+
747
806
  // src/Modal.tsx
748
- var import_antd6 = require("antd");
807
+ var import_antd8 = require("antd");
749
808
  var import_react10 = require("react");
750
809
  var import_jsx_runtime = require("react/jsx-runtime");
751
810
  function useModal(init) {
@@ -758,7 +817,7 @@ function useModal(init) {
758
817
  ...init
759
818
  });
760
819
  return {
761
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Modal, {
820
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
762
821
  ...props
763
822
  }),
764
823
  modalProps: props,
@@ -772,35 +831,35 @@ function useModal(init) {
772
831
  }
773
832
 
774
833
  // src/Routers.tsx
775
- var import_antd7 = require("antd");
834
+ var import_antd9 = require("antd");
776
835
  var import_react11 = require("react");
777
- var import_react_router_dom = require("react-router-dom");
836
+ var import_react_router_dom2 = require("react-router-dom");
778
837
  var import_jsx_runtime = require("react/jsx-runtime");
779
- function NotFound() {
838
+ function PageNotFound() {
780
839
  const config = useConfigContext();
781
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Result, {
840
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
782
841
  status: "404",
783
842
  title: config.common.pageNotFound
784
843
  });
785
844
  }
786
845
  function Routes(props) {
787
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom.Routes, {
846
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
788
847
  children: [
789
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
848
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
790
849
  ...r,
791
850
  element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
792
851
  fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
793
852
  style: { padding: "24px" },
794
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Skeleton, {
853
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
795
854
  active: true
796
855
  })
797
856
  }),
798
857
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
799
858
  })
800
859
  }, r.path)),
801
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
860
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
802
861
  path: "*",
803
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotFound, {})
862
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
804
863
  }, "*")
805
864
  ]
806
865
  });
@@ -808,10 +867,10 @@ function Routes(props) {
808
867
 
809
868
  // src/Table.tsx
810
869
  var import_react12 = require("react");
811
- var import_antd8 = require("antd");
870
+ var import_antd10 = require("antd");
812
871
  var import_dayjs5 = __toESM(require("dayjs"));
813
872
  var import_icons3 = require("@ant-design/icons");
814
- var import_lodash5 = require("lodash");
873
+ var import_lodash6 = require("lodash");
815
874
  var import_react13 = require("@faasjs/react");
816
875
  var import_jsx_runtime = require("react/jsx-runtime");
817
876
  function processValue(item, value) {
@@ -854,7 +913,7 @@ function Table(props) {
854
913
  if (!item.dataIndex)
855
914
  item.dataIndex = item.id;
856
915
  if (!item.title)
857
- item.title = (0, import_lodash5.upperFirst)(item.id);
916
+ item.title = (0, import_lodash6.upperFirst)(item.id);
858
917
  if (!item.type)
859
918
  item.type = "string";
860
919
  if ((_a = item.options) == null ? void 0 : _a.length) {
@@ -918,7 +977,7 @@ function Table(props) {
918
977
  setSelectedKeys,
919
978
  selectedKeys,
920
979
  confirm
921
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Radio.Group, {
980
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
922
981
  style: { padding: 8 },
923
982
  buttonStyle: "solid",
924
983
  value: selectedKeys[0],
@@ -927,10 +986,10 @@ function Table(props) {
927
986
  confirm();
928
987
  },
929
988
  children: [
930
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
989
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
931
990
  children: config.common.all
932
991
  }),
933
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
992
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
934
993
  value: "true",
935
994
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
936
995
  style: {
@@ -939,7 +998,7 @@ function Table(props) {
939
998
  }
940
999
  })
941
1000
  }),
942
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
1001
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
943
1002
  value: "false",
944
1003
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
945
1004
  style: {
@@ -948,7 +1007,7 @@ function Table(props) {
948
1007
  }
949
1008
  })
950
1009
  }),
951
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
1010
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
952
1011
  value: "empty",
953
1012
  children: config.common.blank
954
1013
  })
@@ -958,11 +1017,11 @@ function Table(props) {
958
1017
  item.onFilter = (value, row) => {
959
1018
  switch (value) {
960
1019
  case "true":
961
- return !(0, import_lodash5.isNil)(row[item.id]) && !!row[item.id];
1020
+ return !(0, import_lodash6.isNil)(row[item.id]) && !!row[item.id];
962
1021
  case "false":
963
- return !(0, import_lodash5.isNil)(row[item.id]) && !row[item.id];
1022
+ return !(0, import_lodash6.isNil)(row[item.id]) && !row[item.id];
964
1023
  case "empty":
965
- return (0, import_lodash5.isNil)(row[item.id]);
1024
+ return (0, import_lodash6.isNil)(row[item.id]);
966
1025
  default:
967
1026
  return true;
968
1027
  }
@@ -990,14 +1049,14 @@ function Table(props) {
990
1049
  if (!columns)
991
1050
  return null;
992
1051
  if (!props.faasData)
993
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1052
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
994
1053
  ...props,
995
1054
  rowKey: props.rowKey || "id",
996
1055
  columns,
997
1056
  dataSource: props.dataSource
998
1057
  });
999
1058
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
1000
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
1059
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1001
1060
  active: true
1002
1061
  }),
1003
1062
  render: ({
@@ -1006,20 +1065,20 @@ function Table(props) {
1006
1065
  reload
1007
1066
  }) => {
1008
1067
  if (!data)
1009
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1068
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1010
1069
  ...props,
1011
1070
  rowKey: props.rowKey || "id",
1012
1071
  columns,
1013
1072
  dataSource: []
1014
1073
  });
1015
1074
  if (Array.isArray(data))
1016
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1075
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1017
1076
  ...props,
1018
1077
  rowKey: props.rowKey || "id",
1019
1078
  columns,
1020
1079
  dataSource: data
1021
1080
  });
1022
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1081
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1023
1082
  ...props,
1024
1083
  rowKey: props.rowKey || "id",
1025
1084
  columns,
@@ -1087,7 +1146,9 @@ function Title(props) {
1087
1146
  Drawer,
1088
1147
  Form,
1089
1148
  FormItem,
1149
+ Link,
1090
1150
  Modal,
1151
+ PageNotFound,
1091
1152
  Routes,
1092
1153
  Table,
1093
1154
  TimePicker,