@faasjs/ant-design 0.0.2-beta.405 → 0.0.2-beta.407

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,11 @@ __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_antd7.Modal,
39
40
  Routes: () => Routes,
40
41
  Table: () => Table,
41
42
  TimePicker: () => TimePicker,
@@ -51,11 +52,13 @@ module.exports = __toCommonJS(src_exports);
51
52
  var import_react = __toESM(require("react"));
52
53
 
53
54
  // src/Blank.tsx
54
- var import_antd = require("antd");
55
- var import_lodash = require("lodash");
55
+ var import_antd2 = require("antd");
56
+ var import_lodash2 = require("lodash");
56
57
 
57
58
  // src/Config.tsx
58
59
  var import_react2 = require("react");
60
+ var import_antd = require("antd");
61
+ var import_lodash = require("lodash");
59
62
  var import_jsx_runtime = require("react/jsx-runtime");
60
63
  var isZH = /^zh/i.test(navigator.language);
61
64
  var common = isZH ? {
@@ -78,6 +81,7 @@ var common = isZH ? {
78
81
  required: "is required"
79
82
  };
80
83
  var baseConfig = {
84
+ antd: {},
81
85
  lang: "en",
82
86
  common,
83
87
  Blank: { text: common.blank },
@@ -85,7 +89,8 @@ var baseConfig = {
85
89
  Title: {
86
90
  separator: " - ",
87
91
  suffix: ""
88
- }
92
+ },
93
+ Link: { style: {} }
89
94
  };
90
95
  var ConfigContext = (0, import_react2.createContext)(baseConfig);
91
96
  function ConfigProvider({
@@ -93,11 +98,11 @@ function ConfigProvider({
93
98
  children
94
99
  }) {
95
100
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
96
- value: {
97
- ...baseConfig,
98
- ...config
99
- },
100
- children
101
+ value: (0, import_lodash.defaultsDeep)(config, baseConfig),
102
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
103
+ ...config.antd,
104
+ children
105
+ })
101
106
  });
102
107
  }
103
108
  function useConfigContext() {
@@ -107,10 +112,10 @@ function useConfigContext() {
107
112
  // src/Blank.tsx
108
113
  var import_jsx_runtime = require("react/jsx-runtime");
109
114
  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, {
115
+ const { Blank: Blank2 } = useConfigContext();
116
+ 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
117
  disabled: true,
113
- children: (options == null ? void 0 : options.text) || config.Blank.text
118
+ children: (options == null ? void 0 : options.text) || Blank2.text
114
119
  }) : options.value;
115
120
  }
116
121
 
@@ -121,12 +126,12 @@ var import_style = require("antd/es/calendar/style/index.js");
121
126
  var Calendar = (0, import_generateCalendar.default)(import_dayjs.default);
122
127
 
123
128
  // src/data.ts
124
- var import_lodash2 = require("lodash");
129
+ var import_lodash3 = require("lodash");
125
130
  function transferOptions(options) {
126
131
  if (!options)
127
132
  return [];
128
133
  return options.map((item) => typeof item === "object" ? item : {
129
- label: (0, import_lodash2.upperFirst)(item.toString()),
134
+ label: (0, import_lodash3.upperFirst)(item.toString()),
130
135
  value: item
131
136
  });
132
137
  }
@@ -139,8 +144,8 @@ var DatePicker = (0, import_generatePicker.default)(import_dayjs2.default);
139
144
 
140
145
  // src/Description.tsx
141
146
  var import_icons = require("@ant-design/icons");
142
- var import_antd2 = require("antd");
143
- var import_lodash3 = require("lodash");
147
+ var import_antd3 = require("antd");
148
+ var import_lodash4 = require("lodash");
144
149
  var import_react3 = require("react");
145
150
  var import_dayjs3 = __toESM(require("dayjs"));
146
151
  var import_react4 = require("@faasjs/react");
@@ -151,7 +156,7 @@ function DescriptionItemContent(props) {
151
156
  var _a, _b;
152
157
  const propsCopy = { ...props };
153
158
  if (!propsCopy.item.title)
154
- propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
159
+ propsCopy.item.title = (0, import_lodash4.upperFirst)(propsCopy.item.id);
155
160
  if (!propsCopy.item.type)
156
161
  propsCopy.item.type = "string";
157
162
  if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
@@ -234,10 +239,10 @@ function DescriptionItemContent(props) {
234
239
  }
235
240
  function Description(props) {
236
241
  if (!props.faasData)
237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
242
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
238
243
  ...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),
244
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
245
+ label: item.title || (0, import_lodash4.upperFirst)(item.id),
241
246
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
242
247
  item,
243
248
  value: props.dataSource[item.id],
@@ -247,13 +252,13 @@ function Description(props) {
247
252
  }, item.id))
248
253
  });
249
254
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
250
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Skeleton, {
255
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
251
256
  active: true
252
257
  }),
253
- render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
258
+ render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
254
259
  ...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),
260
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
261
+ label: item.title || (0, import_lodash4.upperFirst)(item.id),
257
262
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
258
263
  item,
259
264
  value: data[item.id],
@@ -267,7 +272,7 @@ function Description(props) {
267
272
  }
268
273
 
269
274
  // src/Drawer.tsx
270
- var import_antd3 = require("antd");
275
+ var import_antd4 = require("antd");
271
276
  var import_react5 = require("react");
272
277
  var import_jsx_runtime = require("react/jsx-runtime");
273
278
  function useDrawer(init) {
@@ -280,7 +285,7 @@ function useDrawer(init) {
280
285
  ...init
281
286
  });
282
287
  return {
283
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Drawer, {
288
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
284
289
  ...props
285
290
  }),
286
291
  drawerProps: props,
@@ -295,14 +300,14 @@ function useDrawer(init) {
295
300
 
296
301
  // src/Form.tsx
297
302
  var import_react8 = require("@faasjs/react");
298
- var import_antd5 = require("antd");
303
+ var import_antd6 = require("antd");
299
304
  var import_react9 = require("react");
300
305
 
301
306
  // src/FormItem.tsx
302
- var import_antd4 = require("antd");
307
+ var import_antd5 = require("antd");
303
308
  var import_icons2 = require("@ant-design/icons");
304
309
  var import_react7 = require("react");
305
- var import_lodash4 = require("lodash");
310
+ var import_lodash5 = require("lodash");
306
311
 
307
312
  // src/TimePicker.tsx
308
313
  var import_react6 = require("react");
@@ -318,10 +323,11 @@ var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
318
323
  TimePicker.displayName = "TimePicker";
319
324
 
320
325
  // src/FormItem.tsx
326
+ var import_dayjs4 = __toESM(require("dayjs"));
321
327
  var import_jsx_runtime = require("react/jsx-runtime");
322
328
  function processProps(propsCopy, config) {
323
329
  if (!propsCopy.title)
324
- propsCopy.title = (0, import_lodash4.upperFirst)(propsCopy.id);
330
+ propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
325
331
  if (!propsCopy.label && propsCopy.label !== false)
326
332
  propsCopy.label = propsCopy.title;
327
333
  if (!propsCopy.name)
@@ -365,50 +371,76 @@ function processProps(propsCopy, config) {
365
371
  }
366
372
  return propsCopy;
367
373
  }
374
+ function DateItem(options) {
375
+ const [value, setValue] = (0, import_react7.useState)();
376
+ (0, import_react7.useEffect)(() => {
377
+ setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
378
+ }, [options.value]);
379
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
380
+ ...options,
381
+ value
382
+ });
383
+ }
384
+ function TimeItem(options) {
385
+ const [value, setValue] = (0, import_react7.useState)();
386
+ (0, import_react7.useEffect)(() => {
387
+ setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
388
+ }, [options.value]);
389
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimePicker, {
390
+ ...options,
391
+ value
392
+ });
393
+ }
368
394
  function FormItem(props) {
369
395
  var _a;
370
396
  const [computedProps, setComputedProps] = (0, import_react7.useState)();
397
+ const [extendTypes, setExtendTypes] = (0, import_react7.useState)();
371
398
  const config = useConfigContext();
372
399
  (0, import_react7.useEffect)(() => {
373
- setComputedProps(processProps({ ...props }, config));
400
+ const propsCopy = { ...props };
401
+ if (propsCopy.extendTypes) {
402
+ setExtendTypes(propsCopy.extendTypes);
403
+ delete propsCopy.extendTypes;
404
+ }
405
+ setComputedProps(processProps(propsCopy, config));
374
406
  }, [props]);
375
407
  if (!computedProps)
376
408
  return null;
377
- if (computedProps.extendTypes && computedProps.extendTypes[computedProps.type])
378
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
409
+ if (extendTypes && extendTypes[computedProps.type])
410
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
379
411
  ...computedProps,
380
- children: computedProps.extendTypes[computedProps.type].children
412
+ children: extendTypes[computedProps.type].children
381
413
  });
382
414
  if (computedProps.children)
383
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
415
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
384
416
  ...computedProps,
385
417
  children: computedProps.children
386
418
  });
387
419
  if (computedProps.render)
388
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
420
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
389
421
  ...computedProps,
390
422
  children: computedProps.render()
391
423
  });
392
424
  switch (computedProps.type) {
393
425
  case "string":
394
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
426
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
395
427
  ...computedProps,
396
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
428
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
397
429
  ...computedProps.input
398
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
430
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
399
431
  ...computedProps.input
400
432
  })
401
433
  });
402
434
  case "string[]":
403
435
  if (computedProps.options)
404
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
436
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
405
437
  ...computedProps,
406
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
438
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
407
439
  mode: "multiple",
408
440
  ...computedProps.input
409
441
  })
410
442
  });
411
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
443
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
412
444
  name: computedProps.name,
413
445
  rules: computedProps.rules,
414
446
  children: (fields, { add, remove }, { errors }) => {
@@ -424,24 +456,24 @@ function FormItem(props) {
424
456
  }),
425
457
  fields.map((field) => {
426
458
  var _a3;
427
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
428
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
459
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
460
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
429
461
  gutter: 24,
430
462
  style: { flexFlow: "row nowrap" },
431
463
  children: [
432
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
464
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
433
465
  span: 23,
434
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
466
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
435
467
  ...field,
436
468
  noStyle: true,
437
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
469
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
438
470
  ...computedProps.input
439
471
  })
440
472
  })
441
473
  }),
442
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
474
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
443
475
  span: 1,
444
- 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, {
476
+ 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, {
445
477
  danger: true,
446
478
  type: "link",
447
479
  style: { float: "right" },
@@ -453,15 +485,15 @@ function FormItem(props) {
453
485
  })
454
486
  }, field.key);
455
487
  }),
456
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
488
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
457
489
  children: [
458
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
490
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
459
491
  type: "dashed",
460
492
  block: true,
461
493
  onClick: () => add(),
462
494
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
463
495
  }),
464
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
496
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
465
497
  errors
466
498
  })
467
499
  ]
@@ -471,25 +503,25 @@ function FormItem(props) {
471
503
  }
472
504
  });
473
505
  case "number":
474
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
506
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
475
507
  ...computedProps,
476
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
508
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
477
509
  ...computedProps.input
478
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
510
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
479
511
  style: { width: "100%" },
480
512
  ...computedProps.input
481
513
  })
482
514
  });
483
515
  case "number[]":
484
516
  if (computedProps.options)
485
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
517
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
486
518
  ...computedProps,
487
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
519
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
488
520
  mode: "multiple",
489
521
  ...computedProps.input
490
522
  })
491
523
  });
492
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
524
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
493
525
  name: computedProps.name,
494
526
  rules: computedProps.rules,
495
527
  children: (fields, { add, remove }, { errors }) => {
@@ -505,25 +537,25 @@ function FormItem(props) {
505
537
  }),
506
538
  fields.map((field) => {
507
539
  var _a3;
508
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
509
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
540
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
541
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
510
542
  gutter: 24,
511
543
  style: { flexFlow: "row nowrap" },
512
544
  children: [
513
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
545
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
514
546
  span: 23,
515
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
547
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
516
548
  ...field,
517
549
  noStyle: true,
518
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
550
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
519
551
  style: { width: "100%" },
520
552
  ...computedProps.input
521
553
  })
522
554
  })
523
555
  }),
524
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
556
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
525
557
  span: 1,
526
- 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, {
558
+ 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, {
527
559
  danger: true,
528
560
  type: "link",
529
561
  style: { float: "right" },
@@ -535,15 +567,15 @@ function FormItem(props) {
535
567
  })
536
568
  }, field.key);
537
569
  }),
538
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
570
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
539
571
  children: [
540
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
572
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
541
573
  type: "dashed",
542
574
  block: true,
543
575
  onClick: () => add(),
544
576
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
545
577
  }),
546
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
578
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
547
579
  errors
548
580
  })
549
581
  ]
@@ -553,23 +585,23 @@ function FormItem(props) {
553
585
  }
554
586
  });
555
587
  case "boolean":
556
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
588
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
557
589
  ...computedProps,
558
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Switch, {
590
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
559
591
  ...computedProps.input
560
592
  })
561
593
  });
562
594
  case "date":
563
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
595
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
564
596
  ...computedProps,
565
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
597
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DateItem, {
566
598
  ...computedProps.input
567
599
  })
568
600
  });
569
601
  case "time":
570
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
602
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
571
603
  ...computedProps,
572
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimePicker, {
604
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimeItem, {
573
605
  ...computedProps.input
574
606
  })
575
607
  });
@@ -589,12 +621,12 @@ function FormItem(props) {
589
621
  ]
590
622
  });
591
623
  case "object[]":
592
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
624
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
593
625
  name: computedProps.name,
594
626
  rules: computedProps.rules,
595
627
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
596
628
  children: [
597
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
629
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
598
630
  style: { marginBottom: 0 },
599
631
  children: [
600
632
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -604,7 +636,7 @@ function FormItem(props) {
604
636
  computedProps.label,
605
637
  " ",
606
638
  field.name + 1,
607
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
639
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
608
640
  danger: true,
609
641
  type: "link",
610
642
  onClick: () => remove(field.name),
@@ -613,9 +645,9 @@ function FormItem(props) {
613
645
  ]
614
646
  })
615
647
  }),
616
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Row, {
648
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
617
649
  gutter: 24,
618
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
650
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
619
651
  span: o.col || 6,
620
652
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
621
653
  ...o,
@@ -625,9 +657,9 @@ function FormItem(props) {
625
657
  })
626
658
  ]
627
659
  }, field.key)),
628
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
660
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
629
661
  children: [
630
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Button, {
662
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
631
663
  type: "dashed",
632
664
  block: true,
633
665
  onClick: () => add(),
@@ -638,7 +670,7 @@ function FormItem(props) {
638
670
  computedProps.label
639
671
  ]
640
672
  }),
641
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
673
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
642
674
  errors
643
675
  })
644
676
  ]
@@ -658,6 +690,7 @@ function Form(props) {
658
690
  const [loading, setLoading] = (0, import_react9.useState)(false);
659
691
  const [computedProps, setComputedProps] = (0, import_react9.useState)();
660
692
  const config = useConfigContext();
693
+ const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
661
694
  (0, import_react9.useEffect)(() => {
662
695
  var _a2;
663
696
  const propsCopy = { ...props };
@@ -686,20 +719,24 @@ function Form(props) {
686
719
  } : values);
687
720
  };
688
721
  }
722
+ if (propsCopy.extendTypes) {
723
+ setExtendTypes(propsCopy.extendTypes);
724
+ delete propsCopy.extendTypes;
725
+ }
689
726
  setComputedProps(propsCopy);
690
727
  }, []);
691
728
  if (!computedProps)
692
729
  return null;
693
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form, {
730
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
694
731
  ...computedProps,
695
732
  children: [
696
733
  computedProps.beforeItems,
697
734
  (_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
698
735
  ...item,
699
- extendTypes: computedProps.extendTypes
736
+ extendTypes
700
737
  }, item.id)),
701
738
  computedProps.children,
702
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
739
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
703
740
  htmlType: "submit",
704
741
  type: "primary",
705
742
  loading,
@@ -709,11 +746,34 @@ function Form(props) {
709
746
  ]
710
747
  });
711
748
  }
712
- Form.useForm = import_antd5.Form.useForm;
749
+ Form.useForm = import_antd6.Form.useForm;
713
750
  Form.Item = FormItem;
714
751
 
752
+ // src/Link.tsx
753
+ var import_react_router_dom = require("react-router-dom");
754
+ var import_jsx_runtime = require("react/jsx-runtime");
755
+ function Link({
756
+ href,
757
+ target,
758
+ text,
759
+ children,
760
+ style
761
+ }) {
762
+ const { Link: Link2 } = useConfigContext();
763
+ style = Object.assign({ cursor: "pointer" }, style);
764
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
765
+ to: href,
766
+ target: target || (Link2 == null ? void 0 : Link2.target),
767
+ style: {
768
+ ...Link2.style,
769
+ ...style || {}
770
+ },
771
+ children: text || children
772
+ });
773
+ }
774
+
715
775
  // src/Modal.tsx
716
- var import_antd6 = require("antd");
776
+ var import_antd7 = require("antd");
717
777
  var import_react10 = require("react");
718
778
  var import_jsx_runtime = require("react/jsx-runtime");
719
779
  function useModal(init) {
@@ -726,7 +786,7 @@ function useModal(init) {
726
786
  ...init
727
787
  });
728
788
  return {
729
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Modal, {
789
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Modal, {
730
790
  ...props
731
791
  }),
732
792
  modalProps: props,
@@ -740,33 +800,33 @@ function useModal(init) {
740
800
  }
741
801
 
742
802
  // src/Routers.tsx
743
- var import_antd7 = require("antd");
803
+ var import_antd8 = require("antd");
744
804
  var import_react11 = require("react");
745
- var import_react_router_dom = require("react-router-dom");
805
+ var import_react_router_dom2 = require("react-router-dom");
746
806
  var import_jsx_runtime = require("react/jsx-runtime");
747
807
  function NotFound() {
748
808
  const config = useConfigContext();
749
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Result, {
809
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Result, {
750
810
  status: "404",
751
811
  title: config.common.pageNotFound
752
812
  });
753
813
  }
754
814
  function Routes(props) {
755
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom.Routes, {
815
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
756
816
  children: [
757
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
817
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
758
818
  ...r,
759
819
  element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
760
820
  fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
761
821
  style: { padding: "24px" },
762
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Skeleton, {
822
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
763
823
  active: true
764
824
  })
765
825
  }),
766
826
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
767
827
  })
768
828
  }, r.path)),
769
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
829
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
770
830
  path: "*",
771
831
  element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotFound, {})
772
832
  }, "*")
@@ -776,10 +836,10 @@ function Routes(props) {
776
836
 
777
837
  // src/Table.tsx
778
838
  var import_react12 = require("react");
779
- var import_antd8 = require("antd");
780
- var import_dayjs4 = __toESM(require("dayjs"));
839
+ var import_antd9 = require("antd");
840
+ var import_dayjs5 = __toESM(require("dayjs"));
781
841
  var import_icons3 = require("@ant-design/icons");
782
- var import_lodash5 = require("lodash");
842
+ var import_lodash6 = require("lodash");
783
843
  var import_react13 = require("@faasjs/react");
784
844
  var import_jsx_runtime = require("react/jsx-runtime");
785
845
  function processValue(item, value) {
@@ -806,7 +866,7 @@ function processValue(item, value) {
806
866
  if (["date", "time"].includes(item.type)) {
807
867
  if (typeof value === "number" && value.toString().length === 10)
808
868
  value = value * 1e3;
809
- value = (0, import_dayjs4.default)(value).format(dayjsFormat);
869
+ value = (0, import_dayjs5.default)(value).format(dayjsFormat);
810
870
  }
811
871
  }
812
872
  return value;
@@ -822,7 +882,7 @@ function Table(props) {
822
882
  if (!item.dataIndex)
823
883
  item.dataIndex = item.id;
824
884
  if (!item.title)
825
- item.title = (0, import_lodash5.upperFirst)(item.id);
885
+ item.title = (0, import_lodash6.upperFirst)(item.id);
826
886
  if (!item.type)
827
887
  item.type = "string";
828
888
  if ((_a = item.options) == null ? void 0 : _a.length) {
@@ -886,7 +946,7 @@ function Table(props) {
886
946
  setSelectedKeys,
887
947
  selectedKeys,
888
948
  confirm
889
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Radio.Group, {
949
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd9.Radio.Group, {
890
950
  style: { padding: 8 },
891
951
  buttonStyle: "solid",
892
952
  value: selectedKeys[0],
@@ -895,10 +955,10 @@ function Table(props) {
895
955
  confirm();
896
956
  },
897
957
  children: [
898
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
958
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
899
959
  children: config.common.all
900
960
  }),
901
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
961
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
902
962
  value: "true",
903
963
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
904
964
  style: {
@@ -907,7 +967,7 @@ function Table(props) {
907
967
  }
908
968
  })
909
969
  }),
910
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
911
971
  value: "false",
912
972
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
913
973
  style: {
@@ -916,7 +976,7 @@ function Table(props) {
916
976
  }
917
977
  })
918
978
  }),
919
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
979
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
920
980
  value: "empty",
921
981
  children: config.common.blank
922
982
  })
@@ -926,11 +986,11 @@ function Table(props) {
926
986
  item.onFilter = (value, row) => {
927
987
  switch (value) {
928
988
  case "true":
929
- return !(0, import_lodash5.isNil)(row[item.id]) && !!row[item.id];
989
+ return !(0, import_lodash6.isNil)(row[item.id]) && !!row[item.id];
930
990
  case "false":
931
- return !(0, import_lodash5.isNil)(row[item.id]) && !row[item.id];
991
+ return !(0, import_lodash6.isNil)(row[item.id]) && !row[item.id];
932
992
  case "empty":
933
- return (0, import_lodash5.isNil)(row[item.id]);
993
+ return (0, import_lodash6.isNil)(row[item.id]);
934
994
  default:
935
995
  return true;
936
996
  }
@@ -939,12 +999,12 @@ function Table(props) {
939
999
  case "date":
940
1000
  item.render = (value) => processValue(item, value);
941
1001
  if (!item.onFilter)
942
- item.onFilter = (value, row) => (0, import_dayjs4.default)(row[item.id]).isSame((0, import_dayjs4.default)(value));
1002
+ item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
943
1003
  break;
944
1004
  case "time":
945
1005
  item.render = (value) => processValue(item, value);
946
1006
  if (!item.onFilter)
947
- item.onFilter = (value, row) => (0, import_dayjs4.default)(row[item.id]).isSame((0, import_dayjs4.default)(value));
1007
+ item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
948
1008
  break;
949
1009
  default:
950
1010
  item.render = (value) => processValue(item, value);
@@ -958,14 +1018,14 @@ function Table(props) {
958
1018
  if (!columns)
959
1019
  return null;
960
1020
  if (!props.faasData)
961
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1021
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
962
1022
  ...props,
963
1023
  rowKey: props.rowKey || "id",
964
1024
  columns,
965
1025
  dataSource: props.dataSource
966
1026
  });
967
1027
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
968
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
1028
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
969
1029
  active: true
970
1030
  }),
971
1031
  render: ({
@@ -974,20 +1034,20 @@ function Table(props) {
974
1034
  reload
975
1035
  }) => {
976
1036
  if (!data)
977
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1037
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
978
1038
  ...props,
979
1039
  rowKey: props.rowKey || "id",
980
1040
  columns,
981
1041
  dataSource: []
982
1042
  });
983
1043
  if (Array.isArray(data))
984
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1044
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
985
1045
  ...props,
986
1046
  rowKey: props.rowKey || "id",
987
1047
  columns,
988
1048
  dataSource: data
989
1049
  });
990
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1050
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
991
1051
  ...props,
992
1052
  rowKey: props.rowKey || "id",
993
1053
  columns,
@@ -1055,6 +1115,7 @@ function Title(props) {
1055
1115
  Drawer,
1056
1116
  Form,
1057
1117
  FormItem,
1118
+ Link,
1058
1119
  Modal,
1059
1120
  Routes,
1060
1121
  Table,