@faasjs/ant-design 0.0.3-beta.31 → 0.0.3-beta.33

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.mjs CHANGED
@@ -119,7 +119,6 @@ function transferValue(type, value) {
119
119
  import { CheckOutlined, CloseOutlined } from "@ant-design/icons";
120
120
  import {
121
121
  Descriptions,
122
- Skeleton,
123
122
  Space
124
123
  } from "antd";
125
124
  import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
@@ -134,8 +133,12 @@ import { FaasDataWrapper as Origin } from "@faasjs/react";
134
133
 
135
134
  // src/Loading.tsx
136
135
  import { Spin } from "antd";
137
- import { jsx as jsx3 } from "react/jsx-runtime";
136
+ import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
138
137
  function Loading(props) {
138
+ if (props.loading === false)
139
+ return /* @__PURE__ */ jsx3(Fragment, {
140
+ children: props.children
141
+ });
139
142
  return /* @__PURE__ */ jsx3("div", {
140
143
  style: {
141
144
  ...props.style || {},
@@ -151,19 +154,18 @@ function Loading(props) {
151
154
  }
152
155
 
153
156
  // src/FaasDataWrapper.tsx
154
- import { Alert } from "antd";
155
157
  import { jsx as jsx4 } from "react/jsx-runtime";
156
158
  function FaasDataWrapper(props) {
157
- return /* @__PURE__ */ jsx4(Alert.ErrorBoundary, {
158
- children: /* @__PURE__ */ jsx4(Origin, {
159
- fallback: /* @__PURE__ */ jsx4(Loading, {}),
160
- ...props
161
- })
159
+ return /* @__PURE__ */ jsx4(Origin, {
160
+ fallback: props.loading || /* @__PURE__ */ jsx4(Loading, {
161
+ ...props.loadingProps
162
+ }),
163
+ ...props
162
164
  });
163
165
  }
164
166
 
165
167
  // src/Description.tsx
166
- import { Fragment, jsx as jsx5 } from "react/jsx-runtime";
168
+ import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
167
169
  function DescriptionItemContent(props) {
168
170
  var _a;
169
171
  const [computedProps, setComputedProps] = useState2();
@@ -200,36 +202,48 @@ function DescriptionItemContent(props) {
200
202
  return cloneElement(
201
203
  computedProps.extendTypes[computedProps.item.type].children,
202
204
  {
205
+ scene: "description",
203
206
  value: computedProps.value,
204
207
  values: computedProps.values
205
208
  }
206
209
  );
207
210
  else if (computedProps.extendTypes[computedProps.item.type].render)
208
- return /* @__PURE__ */ jsx5(Fragment, {
209
- children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
211
+ return /* @__PURE__ */ jsx5(Fragment2, {
212
+ children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
210
213
  });
211
214
  else
212
215
  throw Error(computedProps.item.type + " requires children or render");
216
+ if (computedProps.item.descriptionChildren === null)
217
+ return null;
218
+ if (computedProps.item.descriptionChildren)
219
+ return cloneElement(computedProps.item.descriptionChildren, {
220
+ scene: "description",
221
+ value: computedProps.value,
222
+ values: computedProps.values
223
+ });
224
+ if (computedProps.item.children === null)
225
+ return null;
213
226
  if (computedProps.item.children)
214
227
  return cloneElement(computedProps.item.children, {
228
+ scene: "description",
215
229
  value: computedProps.value,
216
230
  values: computedProps.values
217
231
  });
232
+ if (computedProps.item.descriptionRender)
233
+ return computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description");
218
234
  if (computedProps.item.render)
219
- return /* @__PURE__ */ jsx5(Fragment, {
220
- children: computedProps.item.render(computedProps.value, computedProps.values)
221
- });
235
+ return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
222
236
  if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
223
237
  return /* @__PURE__ */ jsx5(Blank, {});
224
238
  switch (computedProps.item.type) {
225
239
  case "string[]":
226
- return /* @__PURE__ */ jsx5(Fragment, {
240
+ return /* @__PURE__ */ jsx5(Fragment2, {
227
241
  children: computedProps.value.join(", ")
228
242
  });
229
243
  case "number":
230
244
  return computedProps.value || null;
231
245
  case "number[]":
232
- return /* @__PURE__ */ jsx5(Fragment, {
246
+ return /* @__PURE__ */ jsx5(Fragment2, {
233
247
  children: computedProps.value.join(", ")
234
248
  });
235
249
  case "boolean":
@@ -245,11 +259,11 @@ function DescriptionItemContent(props) {
245
259
  }
246
260
  });
247
261
  case "time":
248
- return /* @__PURE__ */ jsx5(Fragment, {
262
+ return /* @__PURE__ */ jsx5(Fragment2, {
249
263
  children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
250
264
  });
251
265
  case "date":
252
- return /* @__PURE__ */ jsx5(Fragment, {
266
+ return /* @__PURE__ */ jsx5(Fragment2, {
253
267
  children: computedProps.value.format("YYYY-MM-DD")
254
268
  });
255
269
  case "object":
@@ -293,9 +307,6 @@ function Description(props) {
293
307
  }).filter(Boolean)
294
308
  });
295
309
  return /* @__PURE__ */ jsx5(FaasDataWrapper, {
296
- fallback: props.faasData.fallback || /* @__PURE__ */ jsx5(Skeleton, {
297
- active: true
298
- }),
299
310
  render: ({ data }) => {
300
311
  return /* @__PURE__ */ jsx5(Descriptions, {
301
312
  ...props,
@@ -344,6 +355,53 @@ function useDrawer(init) {
344
355
  };
345
356
  }
346
357
 
358
+ // src/ErrorBoundary.tsx
359
+ import { Component } from "react";
360
+ import { Alert } from "antd";
361
+ import { jsx as jsx7 } from "react/jsx-runtime";
362
+ var ErrorBoundary = class extends Component {
363
+ constructor(props) {
364
+ super(props);
365
+ this.state = {
366
+ error: void 0,
367
+ info: { componentStack: "" }
368
+ };
369
+ }
370
+ componentDidCatch(error, info) {
371
+ this.setState({
372
+ error,
373
+ info
374
+ });
375
+ }
376
+ render() {
377
+ const {
378
+ message,
379
+ description,
380
+ children
381
+ } = this.props;
382
+ const { error, info } = this.state;
383
+ const componentStack = info && info.componentStack ? info.componentStack : null;
384
+ const errorMessage = typeof message === "undefined" ? (error || "").toString() : message;
385
+ const errorDescription = typeof description === "undefined" ? componentStack : description;
386
+ if (error) {
387
+ if (this.props.onError)
388
+ return this.props.onError(error, info);
389
+ return /* @__PURE__ */ jsx7(Alert, {
390
+ type: "error",
391
+ message: errorMessage,
392
+ description: /* @__PURE__ */ jsx7("pre", {
393
+ style: {
394
+ fontSize: "0.9em",
395
+ overflowX: "auto"
396
+ },
397
+ children: errorDescription
398
+ })
399
+ });
400
+ }
401
+ return children;
402
+ }
403
+ };
404
+
347
405
  // src/Form.tsx
348
406
  import { faas } from "@faasjs/react";
349
407
  import {
@@ -372,11 +430,12 @@ import {
372
430
  } from "antd";
373
431
  import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
374
432
  import {
433
+ cloneElement as cloneElement2,
375
434
  useEffect as useEffect3,
376
435
  useState as useState4
377
436
  } from "react";
378
437
  import { upperFirst as upperFirst3 } from "lodash-es";
379
- import { Fragment as Fragment2, jsx as jsx7, jsxs } from "react/jsx-runtime";
438
+ import { Fragment as Fragment3, jsx as jsx8, jsxs } from "react/jsx-runtime";
380
439
  function processProps(propsCopy, config) {
381
440
  if (!propsCopy.title)
382
441
  propsCopy.title = upperFirst3(propsCopy.id);
@@ -453,86 +512,100 @@ function FormItem(props) {
453
512
  if (!computedProps)
454
513
  return null;
455
514
  if (hidden)
456
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
515
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
457
516
  ...computedProps,
458
517
  noStyle: true,
459
518
  rules: [],
460
- children: /* @__PURE__ */ jsx7(Input, {
519
+ children: /* @__PURE__ */ jsx8(Input, {
461
520
  hidden: true
462
521
  })
463
522
  });
464
523
  if (extendTypes && extendTypes[computedProps.type])
465
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
524
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
466
525
  ...computedProps,
467
526
  children: extendTypes[computedProps.type].children
468
527
  });
528
+ if (computedProps.formChildren === null)
529
+ return null;
530
+ if (computedProps.formChildren)
531
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
532
+ ...computedProps,
533
+ children: cloneElement2(computedProps.formChildren, { scene: "form" })
534
+ });
535
+ if (computedProps.children === null)
536
+ return null;
469
537
  if (computedProps.children)
470
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
538
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
471
539
  ...computedProps,
472
- children: computedProps.children
540
+ children: cloneElement2(computedProps.children, { scene: "form" })
541
+ });
542
+ if (computedProps.formRender)
543
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
544
+ ...computedProps,
545
+ children: computedProps.formRender(null, null, 0, "form")
473
546
  });
474
547
  if (computedProps.render)
475
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
548
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
476
549
  ...computedProps,
477
- children: computedProps.render()
550
+ children: computedProps.render(null, null, 0, "form")
478
551
  });
479
552
  switch (computedProps.type) {
480
553
  case "string":
481
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
554
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
482
555
  ...computedProps,
483
- children: computedProps.options ? /* @__PURE__ */ jsx7(Select, {
556
+ children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
484
557
  ...computedProps.input
485
- }) : /* @__PURE__ */ jsx7(Input, {
558
+ }) : /* @__PURE__ */ jsx8(Input, {
486
559
  ...computedProps.input
487
560
  })
488
561
  });
489
562
  case "string[]":
490
563
  if (computedProps.options)
491
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
564
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
492
565
  ...computedProps,
493
- children: /* @__PURE__ */ jsx7(Select, {
566
+ children: /* @__PURE__ */ jsx8(Select, {
494
567
  mode: "multiple",
495
568
  ...computedProps.input
496
569
  })
497
570
  });
498
- return /* @__PURE__ */ jsx7(AntdForm.List, {
571
+ return /* @__PURE__ */ jsx8(AntdForm.List, {
499
572
  name: computedProps.name,
500
573
  rules: computedProps.rules,
501
574
  children: (fields, { add, remove }, { errors }) => {
502
575
  var _a2;
503
- return /* @__PURE__ */ jsxs(Fragment2, {
576
+ return /* @__PURE__ */ jsxs(Fragment3, {
504
577
  children: [
505
- computedProps.label && /* @__PURE__ */ jsx7("div", {
578
+ computedProps.label && /* @__PURE__ */ jsx8("div", {
506
579
  className: "ant-form-item-label",
507
- children: /* @__PURE__ */ jsx7("label", {
580
+ children: /* @__PURE__ */ jsx8("label", {
508
581
  className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
509
582
  children: computedProps.label
510
583
  })
511
584
  }),
512
585
  fields.map((field) => {
513
586
  var _a3;
514
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
587
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
515
588
  children: /* @__PURE__ */ jsxs(Row, {
516
589
  gutter: 24,
517
590
  style: { flexFlow: "row nowrap" },
518
591
  children: [
519
- /* @__PURE__ */ jsx7(Col, {
592
+ /* @__PURE__ */ jsx8(Col, {
520
593
  span: 23,
521
- children: /* @__PURE__ */ jsx7(AntdForm.Item, {
594
+ children: /* @__PURE__ */ jsx8(AntdForm.Item, {
522
595
  ...field,
523
596
  noStyle: true,
524
- children: /* @__PURE__ */ jsx7(Input, {
597
+ children: /* @__PURE__ */ jsx8(Input, {
525
598
  ...computedProps.input
526
599
  })
527
600
  })
528
601
  }),
529
- /* @__PURE__ */ jsx7(Col, {
602
+ /* @__PURE__ */ jsx8(Col, {
530
603
  span: 1,
531
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx7(Button, {
604
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
532
605
  danger: true,
533
606
  type: "link",
534
607
  style: { float: "right" },
535
- icon: /* @__PURE__ */ jsx7(MinusCircleOutlined, {}),
608
+ icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
536
609
  onClick: () => remove(field.name)
537
610
  })
538
611
  })
@@ -542,13 +615,13 @@ function FormItem(props) {
542
615
  }),
543
616
  /* @__PURE__ */ jsxs(AntdForm.Item, {
544
617
  children: [
545
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx7(Button, {
618
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
546
619
  type: "dashed",
547
620
  block: true,
548
621
  onClick: () => add(),
549
- icon: /* @__PURE__ */ jsx7(PlusOutlined, {})
622
+ icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
550
623
  }),
551
- /* @__PURE__ */ jsx7(AntdForm.ErrorList, {
624
+ /* @__PURE__ */ jsx8(AntdForm.ErrorList, {
552
625
  errors
553
626
  })
554
627
  ]
@@ -558,63 +631,63 @@ function FormItem(props) {
558
631
  }
559
632
  });
560
633
  case "number":
561
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
634
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
562
635
  ...computedProps,
563
- children: computedProps.options ? /* @__PURE__ */ jsx7(Select, {
636
+ children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
564
637
  ...computedProps.input
565
- }) : /* @__PURE__ */ jsx7(InputNumber, {
638
+ }) : /* @__PURE__ */ jsx8(InputNumber, {
566
639
  style: { width: "100%" },
567
640
  ...computedProps.input
568
641
  })
569
642
  });
570
643
  case "number[]":
571
644
  if (computedProps.options)
572
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
645
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
573
646
  ...computedProps,
574
- children: /* @__PURE__ */ jsx7(Select, {
647
+ children: /* @__PURE__ */ jsx8(Select, {
575
648
  mode: "multiple",
576
649
  ...computedProps.input
577
650
  })
578
651
  });
579
- return /* @__PURE__ */ jsx7(AntdForm.List, {
652
+ return /* @__PURE__ */ jsx8(AntdForm.List, {
580
653
  name: computedProps.name,
581
654
  rules: computedProps.rules,
582
655
  children: (fields, { add, remove }, { errors }) => {
583
656
  var _a2, _b;
584
- return /* @__PURE__ */ jsxs(Fragment2, {
657
+ return /* @__PURE__ */ jsxs(Fragment3, {
585
658
  children: [
586
- computedProps.label && /* @__PURE__ */ jsx7("div", {
659
+ computedProps.label && /* @__PURE__ */ jsx8("div", {
587
660
  className: "ant-form-item-label",
588
- children: /* @__PURE__ */ jsx7("label", {
661
+ children: /* @__PURE__ */ jsx8("label", {
589
662
  className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
590
663
  children: computedProps.label
591
664
  })
592
665
  }),
593
666
  fields.map((field) => {
594
667
  var _a3;
595
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
668
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
596
669
  children: /* @__PURE__ */ jsxs(Row, {
597
670
  gutter: 24,
598
671
  style: { flexFlow: "row nowrap" },
599
672
  children: [
600
- /* @__PURE__ */ jsx7(Col, {
673
+ /* @__PURE__ */ jsx8(Col, {
601
674
  span: 23,
602
- children: /* @__PURE__ */ jsx7(AntdForm.Item, {
675
+ children: /* @__PURE__ */ jsx8(AntdForm.Item, {
603
676
  ...field,
604
677
  noStyle: true,
605
- children: /* @__PURE__ */ jsx7(InputNumber, {
678
+ children: /* @__PURE__ */ jsx8(InputNumber, {
606
679
  style: { width: "100%" },
607
680
  ...computedProps.input
608
681
  })
609
682
  })
610
683
  }),
611
- /* @__PURE__ */ jsx7(Col, {
684
+ /* @__PURE__ */ jsx8(Col, {
612
685
  span: 1,
613
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx7(Button, {
686
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
614
687
  danger: true,
615
688
  type: "link",
616
689
  style: { float: "right" },
617
- icon: /* @__PURE__ */ jsx7(MinusCircleOutlined, {}),
690
+ icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
618
691
  onClick: () => remove(field.name)
619
692
  })
620
693
  })
@@ -624,13 +697,13 @@ function FormItem(props) {
624
697
  }),
625
698
  /* @__PURE__ */ jsxs(AntdForm.Item, {
626
699
  children: [
627
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx7(Button, {
700
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
628
701
  type: "dashed",
629
702
  block: true,
630
703
  onClick: () => add(),
631
- icon: /* @__PURE__ */ jsx7(PlusOutlined, {})
704
+ icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
632
705
  }),
633
- /* @__PURE__ */ jsx7(AntdForm.ErrorList, {
706
+ /* @__PURE__ */ jsx8(AntdForm.ErrorList, {
634
707
  errors
635
708
  })
636
709
  ]
@@ -640,58 +713,58 @@ function FormItem(props) {
640
713
  }
641
714
  });
642
715
  case "boolean":
643
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
716
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
644
717
  ...computedProps,
645
- children: /* @__PURE__ */ jsx7(Switch, {
718
+ children: /* @__PURE__ */ jsx8(Switch, {
646
719
  ...computedProps.input
647
720
  })
648
721
  });
649
722
  case "date":
650
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
723
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
651
724
  ...computedProps,
652
- children: /* @__PURE__ */ jsx7(DatePicker, {
725
+ children: /* @__PURE__ */ jsx8(DatePicker, {
653
726
  ...computedProps.input
654
727
  })
655
728
  });
656
729
  case "time":
657
- return /* @__PURE__ */ jsx7(AntdForm.Item, {
730
+ return /* @__PURE__ */ jsx8(AntdForm.Item, {
658
731
  ...computedProps,
659
- children: /* @__PURE__ */ jsx7(TimePicker, {
732
+ children: /* @__PURE__ */ jsx8(TimePicker, {
660
733
  ...computedProps.input
661
734
  })
662
735
  });
663
736
  case "object":
664
- return /* @__PURE__ */ jsxs(Fragment2, {
737
+ return /* @__PURE__ */ jsxs(Fragment3, {
665
738
  children: [
666
- computedProps.label && /* @__PURE__ */ jsx7("div", {
739
+ computedProps.label && /* @__PURE__ */ jsx8("div", {
667
740
  className: "ant-form-item-label",
668
- children: /* @__PURE__ */ jsx7("label", {
741
+ children: /* @__PURE__ */ jsx8("label", {
669
742
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
670
743
  children: computedProps.label
671
744
  })
672
745
  }),
673
- computedProps.object.map((o) => /* @__PURE__ */ jsx7(FormItem, {
746
+ computedProps.object.map((o) => /* @__PURE__ */ jsx8(FormItem, {
674
747
  ...o
675
748
  }, o.id))
676
749
  ]
677
750
  });
678
751
  case "object[]":
679
- return /* @__PURE__ */ jsx7(AntdForm.List, {
752
+ return /* @__PURE__ */ jsx8(AntdForm.List, {
680
753
  name: computedProps.name,
681
754
  rules: computedProps.rules,
682
- children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment2, {
755
+ children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment3, {
683
756
  children: [
684
757
  fields.map((field) => /* @__PURE__ */ jsxs(AntdForm.Item, {
685
758
  style: { marginBottom: 0 },
686
759
  children: [
687
- /* @__PURE__ */ jsx7("div", {
760
+ /* @__PURE__ */ jsx8("div", {
688
761
  className: "ant-form-item-label",
689
762
  children: /* @__PURE__ */ jsxs("label", {
690
763
  children: [
691
764
  computedProps.label,
692
765
  " ",
693
766
  field.name + 1,
694
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx7(Button, {
767
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
695
768
  danger: true,
696
769
  type: "link",
697
770
  onClick: () => remove(field.name),
@@ -700,11 +773,11 @@ function FormItem(props) {
700
773
  ]
701
774
  })
702
775
  }),
703
- /* @__PURE__ */ jsx7(Row, {
776
+ /* @__PURE__ */ jsx8(Row, {
704
777
  gutter: 24,
705
- children: computedProps.object.map((o) => /* @__PURE__ */ jsx7(Col, {
778
+ children: computedProps.object.map((o) => /* @__PURE__ */ jsx8(Col, {
706
779
  span: o.col || 24,
707
- children: /* @__PURE__ */ jsx7(FormItem, {
780
+ children: /* @__PURE__ */ jsx8(FormItem, {
708
781
  ...o,
709
782
  name: [field.name, o.id]
710
783
  })
@@ -718,14 +791,14 @@ function FormItem(props) {
718
791
  type: "dashed",
719
792
  block: true,
720
793
  onClick: () => add(),
721
- icon: /* @__PURE__ */ jsx7(PlusOutlined, {}),
794
+ icon: /* @__PURE__ */ jsx8(PlusOutlined, {}),
722
795
  children: [
723
796
  common2.add,
724
797
  " ",
725
798
  computedProps.label
726
799
  ]
727
800
  }),
728
- /* @__PURE__ */ jsx7(AntdForm.ErrorList, {
801
+ /* @__PURE__ */ jsx8(AntdForm.ErrorList, {
729
802
  errors
730
803
  })
731
804
  ]
@@ -740,7 +813,7 @@ function FormItem(props) {
740
813
  FormItem.useStatus = AntdForm.Item.useStatus;
741
814
 
742
815
  // src/Form.tsx
743
- import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
816
+ import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
744
817
  function Form(props) {
745
818
  var _a, _b;
746
819
  const [loading, setLoading] = useState5(false);
@@ -843,12 +916,12 @@ function Form(props) {
843
916
  onValuesChange,
844
917
  children: [
845
918
  computedProps.beforeItems,
846
- (_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx8(FormItem, {
919
+ (_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx9(FormItem, {
847
920
  ...item,
848
921
  extendTypes
849
922
  }, item.id)),
850
923
  computedProps.children,
851
- computedProps.submit !== false && /* @__PURE__ */ jsx8(Button2, {
924
+ computedProps.submit !== false && /* @__PURE__ */ jsx9(Button2, {
852
925
  htmlType: "submit",
853
926
  type: "primary",
854
927
  loading,
@@ -869,67 +942,66 @@ Form.Provider = AntdForm2.Provider;
869
942
  // src/Link.tsx
870
943
  import { Link as RouterLink } from "react-router-dom";
871
944
  import { Button as Button3 } from "antd";
872
- import { jsx as jsx9 } from "react/jsx-runtime";
873
- function Link({
874
- href,
875
- target,
876
- text,
877
- children,
878
- style,
879
- button
880
- }) {
945
+ import { jsx as jsx10 } from "react/jsx-runtime";
946
+ function Link(props) {
947
+ var _a, _b, _c, _d;
881
948
  const { Link: Link2 } = useConfigContext();
882
- style = Object.assign({ cursor: "pointer" }, style);
883
- if (href.startsWith("http")) {
884
- if (button)
885
- return /* @__PURE__ */ jsx9(Button3, {
886
- ...button,
887
- target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
949
+ props.style = Object.assign({ cursor: "pointer" }, props.style);
950
+ if (props.block)
951
+ props.style = Object.assign({
952
+ display: "block",
953
+ width: "100%"
954
+ }, props.style);
955
+ if (props.href.startsWith("http")) {
956
+ if (props.button)
957
+ return /* @__PURE__ */ jsx10(Button3, {
958
+ ...props.button,
959
+ target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
888
960
  style: {
889
961
  ...Link2.style,
890
- ...style || {}
962
+ ...props.style || {}
891
963
  },
892
- href,
893
- children: text != null ? text : children
964
+ href: props.href,
965
+ children: (_a = props.text) != null ? _a : props.children
894
966
  });
895
- return /* @__PURE__ */ jsx9("a", {
896
- href,
897
- target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
967
+ return /* @__PURE__ */ jsx10("a", {
968
+ href: props.href,
969
+ target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
898
970
  style: {
899
971
  ...Link2.style,
900
- ...style || {}
972
+ ...props.style || {}
901
973
  },
902
- children: text != null ? text : children
974
+ children: (_b = props.text) != null ? _b : props.children
903
975
  });
904
976
  }
905
- if (button)
906
- return /* @__PURE__ */ jsx9(RouterLink, {
907
- to: href,
908
- target: target || (Link2 == null ? void 0 : Link2.target),
909
- children: /* @__PURE__ */ jsx9(Button3, {
910
- ...button,
977
+ if (props.button)
978
+ return /* @__PURE__ */ jsx10(RouterLink, {
979
+ to: props.href,
980
+ target: props.target || (Link2 == null ? void 0 : Link2.target),
981
+ children: /* @__PURE__ */ jsx10(Button3, {
982
+ ...props.button,
911
983
  style: {
912
984
  ...Link2.style,
913
- ...style || {}
985
+ ...props.style || {}
914
986
  },
915
- children: text != null ? text : children
987
+ children: (_c = props.text) != null ? _c : props.children
916
988
  })
917
989
  });
918
- return /* @__PURE__ */ jsx9(RouterLink, {
919
- to: href,
920
- target: target || (Link2 == null ? void 0 : Link2.target),
990
+ return /* @__PURE__ */ jsx10(RouterLink, {
991
+ to: props.href,
992
+ target: props.target || (Link2 == null ? void 0 : Link2.target),
921
993
  style: {
922
994
  ...Link2.style,
923
- ...style || {}
995
+ ...props.style || {}
924
996
  },
925
- children: text != null ? text : children
997
+ children: (_d = props.text) != null ? _d : props.children
926
998
  });
927
999
  }
928
1000
 
929
1001
  // src/Modal.tsx
930
1002
  import { Modal } from "antd";
931
1003
  import { useState as useState6 } from "react";
932
- import { jsx as jsx10 } from "react/jsx-runtime";
1004
+ import { jsx as jsx11 } from "react/jsx-runtime";
933
1005
  function useModal(init) {
934
1006
  const [props, setProps] = useState6({
935
1007
  open: false,
@@ -940,7 +1012,7 @@ function useModal(init) {
940
1012
  ...init
941
1013
  });
942
1014
  return {
943
- modal: /* @__PURE__ */ jsx10(Modal, {
1015
+ modal: /* @__PURE__ */ jsx11(Modal, {
944
1016
  ...props
945
1017
  }),
946
1018
  modalProps: props,
@@ -956,7 +1028,7 @@ function useModal(init) {
956
1028
  // src/Routers.tsx
957
1029
  import {
958
1030
  Result,
959
- Skeleton as Skeleton2,
1031
+ Skeleton,
960
1032
  Alert as Alert2
961
1033
  } from "antd";
962
1034
  import {
@@ -966,33 +1038,33 @@ import {
966
1038
  Routes as OriginRoutes,
967
1039
  Route
968
1040
  } from "react-router-dom";
969
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
1041
+ import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
970
1042
  function PageNotFound() {
971
1043
  const config = useConfigContext();
972
- return /* @__PURE__ */ jsx11(Result, {
1044
+ return /* @__PURE__ */ jsx12(Result, {
973
1045
  status: "404",
974
1046
  title: config.common.pageNotFound
975
1047
  });
976
1048
  }
977
1049
  function Routes(props) {
978
- return /* @__PURE__ */ jsx11(Alert2.ErrorBoundary, {
1050
+ return /* @__PURE__ */ jsx12(Alert2.ErrorBoundary, {
979
1051
  children: /* @__PURE__ */ jsxs3(OriginRoutes, {
980
1052
  children: [
981
- props.routes.map((r) => /* @__PURE__ */ jsx11(Route, {
1053
+ props.routes.map((r) => /* @__PURE__ */ jsx12(Route, {
982
1054
  ...r,
983
- element: r.element || /* @__PURE__ */ jsx11(Suspense, {
984
- fallback: props.fallback || /* @__PURE__ */ jsx11("div", {
1055
+ element: r.element || /* @__PURE__ */ jsx12(Suspense, {
1056
+ fallback: props.fallback || /* @__PURE__ */ jsx12("div", {
985
1057
  style: { padding: "24px" },
986
- children: /* @__PURE__ */ jsx11(Skeleton2, {
1058
+ children: /* @__PURE__ */ jsx12(Skeleton, {
987
1059
  active: true
988
1060
  })
989
1061
  }),
990
- children: /* @__PURE__ */ jsx11(r.page, {})
1062
+ children: /* @__PURE__ */ jsx12(r.page, {})
991
1063
  })
992
1064
  }, r.path)),
993
- /* @__PURE__ */ jsx11(Route, {
1065
+ /* @__PURE__ */ jsx12(Route, {
994
1066
  path: "*",
995
- element: props.notFound || /* @__PURE__ */ jsx11(PageNotFound, {})
1067
+ element: props.notFound || /* @__PURE__ */ jsx12(PageNotFound, {})
996
1068
  }, "*")
997
1069
  ]
998
1070
  })
@@ -1003,12 +1075,11 @@ function Routes(props) {
1003
1075
  import {
1004
1076
  useState as useState7,
1005
1077
  useEffect as useEffect5,
1006
- cloneElement as cloneElement2
1078
+ cloneElement as cloneElement3
1007
1079
  } from "react";
1008
1080
  import {
1009
1081
  Table as AntdTable,
1010
1082
  Radio,
1011
- Skeleton as Skeleton3,
1012
1083
  Input as Input2
1013
1084
  } from "antd";
1014
1085
  import dayjs2 from "dayjs";
@@ -1018,12 +1089,12 @@ import {
1018
1089
  uniqBy,
1019
1090
  upperFirst as upperFirst4
1020
1091
  } from "lodash-es";
1021
- import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
1092
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
1022
1093
  function processValue(item, value) {
1023
1094
  var _a;
1024
1095
  const transferred = transferValue(item.type, value);
1025
1096
  if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
1026
- return /* @__PURE__ */ jsx12(Blank, {});
1097
+ return /* @__PURE__ */ jsx13(Blank, {});
1027
1098
  if (item.options) {
1028
1099
  if (item.type.endsWith("[]"))
1029
1100
  return transferred.map((v) => {
@@ -1063,23 +1134,38 @@ function Table(props) {
1063
1134
  text: o.label,
1064
1135
  value: o.value
1065
1136
  })).concat({
1066
- text: /* @__PURE__ */ jsx12(Blank, {}),
1137
+ text: /* @__PURE__ */ jsx13(Blank, {}),
1067
1138
  value: null
1068
1139
  });
1069
1140
  }
1070
- if (item.children)
1071
- item.render = (value, values) => cloneElement2(
1141
+ if (item.tableChildren === null)
1142
+ item.render = () => null;
1143
+ else if (item.tableChildren)
1144
+ item.render = (value, values) => cloneElement3(
1145
+ item.tableChildren,
1146
+ {
1147
+ scene: "table",
1148
+ value,
1149
+ values
1150
+ }
1151
+ );
1152
+ else if (item.children === null)
1153
+ item.render = () => null;
1154
+ else if (item.children)
1155
+ item.render = (value, values) => cloneElement3(
1072
1156
  item.children,
1073
1157
  {
1158
+ scene: "table",
1074
1159
  value,
1075
1160
  values
1076
1161
  }
1077
1162
  );
1078
1163
  if (props.extendTypes && props.extendTypes[item.type]) {
1079
1164
  if (props.extendTypes[item.type].children)
1080
- item.render = (value, values) => cloneElement2(
1165
+ item.render = (value, values) => cloneElement3(
1081
1166
  props.extendTypes[item.type].children,
1082
1167
  {
1168
+ scene: "table",
1083
1169
  value,
1084
1170
  values
1085
1171
  }
@@ -1107,7 +1193,7 @@ function Table(props) {
1107
1193
  setSelectedKeys,
1108
1194
  confirm,
1109
1195
  clearFilters
1110
- }) => /* @__PURE__ */ jsx12(Input2.Search, {
1196
+ }) => /* @__PURE__ */ jsx13(Input2.Search, {
1111
1197
  placeholder: `${common2.search} ${item.title}`,
1112
1198
  allowClear: true,
1113
1199
  onSearch: (v) => {
@@ -1137,7 +1223,7 @@ function Table(props) {
1137
1223
  setSelectedKeys,
1138
1224
  confirm,
1139
1225
  clearFilters
1140
- }) => /* @__PURE__ */ jsx12(Input2.Search, {
1226
+ }) => /* @__PURE__ */ jsx13(Input2.Search, {
1141
1227
  placeholder: `${common2.search} ${item.title}`,
1142
1228
  allowClear: true,
1143
1229
  onSearch: (v) => {
@@ -1167,7 +1253,7 @@ function Table(props) {
1167
1253
  setSelectedKeys,
1168
1254
  confirm,
1169
1255
  clearFilters
1170
- }) => /* @__PURE__ */ jsx12(Input2.Search, {
1256
+ }) => /* @__PURE__ */ jsx13(Input2.Search, {
1171
1257
  placeholder: `${common2.search} ${item.title}`,
1172
1258
  allowClear: true,
1173
1259
  onSearch: (v) => {
@@ -1197,7 +1283,7 @@ function Table(props) {
1197
1283
  setSelectedKeys,
1198
1284
  confirm,
1199
1285
  clearFilters
1200
- }) => /* @__PURE__ */ jsx12(Input2.Search, {
1286
+ }) => /* @__PURE__ */ jsx13(Input2.Search, {
1201
1287
  placeholder: `${common2.search} ${item.title}`,
1202
1288
  allowClear: true,
1203
1289
  onSearch: (v) => {
@@ -1213,12 +1299,12 @@ function Table(props) {
1213
1299
  break;
1214
1300
  case "boolean":
1215
1301
  if (!item.render)
1216
- item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx12(Blank, {}) : value ? /* @__PURE__ */ jsx12(CheckOutlined2, {
1302
+ item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
1217
1303
  style: {
1218
1304
  marginTop: "4px",
1219
1305
  color: "#52c41a"
1220
1306
  }
1221
- }) : /* @__PURE__ */ jsx12(CloseOutlined2, {
1307
+ }) : /* @__PURE__ */ jsx13(CloseOutlined2, {
1222
1308
  style: {
1223
1309
  marginTop: "4px",
1224
1310
  color: "#ff4d4f"
@@ -1238,28 +1324,28 @@ function Table(props) {
1238
1324
  confirm();
1239
1325
  },
1240
1326
  children: [
1241
- /* @__PURE__ */ jsx12(Radio.Button, {
1327
+ /* @__PURE__ */ jsx13(Radio.Button, {
1242
1328
  children: common2.all
1243
1329
  }),
1244
- /* @__PURE__ */ jsx12(Radio.Button, {
1330
+ /* @__PURE__ */ jsx13(Radio.Button, {
1245
1331
  value: "true",
1246
- children: /* @__PURE__ */ jsx12(CheckOutlined2, {
1332
+ children: /* @__PURE__ */ jsx13(CheckOutlined2, {
1247
1333
  style: {
1248
1334
  color: "#52c41a",
1249
1335
  verticalAlign: "middle"
1250
1336
  }
1251
1337
  })
1252
1338
  }),
1253
- /* @__PURE__ */ jsx12(Radio.Button, {
1339
+ /* @__PURE__ */ jsx13(Radio.Button, {
1254
1340
  value: "false",
1255
- children: /* @__PURE__ */ jsx12(CloseOutlined2, {
1341
+ children: /* @__PURE__ */ jsx13(CloseOutlined2, {
1256
1342
  style: {
1257
1343
  verticalAlign: "middle",
1258
1344
  color: "#ff4d4f"
1259
1345
  }
1260
1346
  })
1261
1347
  }),
1262
- /* @__PURE__ */ jsx12(Radio.Button, {
1348
+ /* @__PURE__ */ jsx13(Radio.Button, {
1263
1349
  value: "empty",
1264
1350
  children: common2.blank
1265
1351
  })
@@ -1297,7 +1383,7 @@ function Table(props) {
1297
1383
  break;
1298
1384
  case "object":
1299
1385
  if (!item.render)
1300
- item.render = (value) => /* @__PURE__ */ jsx12(Description, {
1386
+ item.render = (value) => /* @__PURE__ */ jsx13(Description, {
1301
1387
  items: item.object,
1302
1388
  dataSource: value || {},
1303
1389
  column: 1
@@ -1305,11 +1391,13 @@ function Table(props) {
1305
1391
  break;
1306
1392
  case "object[]":
1307
1393
  if (!item.render)
1308
- item.render = (value) => value.map((v, i) => /* @__PURE__ */ jsx12(Description, {
1309
- items: item.object,
1310
- dataSource: v || [],
1311
- column: 1
1312
- }, i));
1394
+ item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
1395
+ children: value.map((v, i) => /* @__PURE__ */ jsx13(Description, {
1396
+ items: item.object,
1397
+ dataSource: v || [],
1398
+ column: 1
1399
+ }, i))
1400
+ });
1313
1401
  break;
1314
1402
  default:
1315
1403
  if (!item.render)
@@ -1339,7 +1427,7 @@ function Table(props) {
1339
1427
  const newColumns = [...prev];
1340
1428
  const index = newColumns.findIndex((item) => item.id === column.id);
1341
1429
  newColumns[index].filters = filters.concat({
1342
- text: /* @__PURE__ */ jsx12(Blank, {}),
1430
+ text: /* @__PURE__ */ jsx13(Blank, {}),
1343
1431
  value: null
1344
1432
  });
1345
1433
  return newColumns;
@@ -1350,18 +1438,15 @@ function Table(props) {
1350
1438
  if (!columns)
1351
1439
  return null;
1352
1440
  if (!props.faasData)
1353
- return /* @__PURE__ */ jsx12(AntdTable, {
1441
+ return /* @__PURE__ */ jsx13(AntdTable, {
1354
1442
  ...props,
1355
1443
  rowKey: props.rowKey || "id",
1356
1444
  columns,
1357
1445
  dataSource: props.dataSource
1358
1446
  });
1359
- return /* @__PURE__ */ jsx12(FaasDataWrapper, {
1360
- fallback: props.faasData.fallback || /* @__PURE__ */ jsx12(Skeleton3, {
1361
- active: true
1362
- }),
1447
+ return /* @__PURE__ */ jsx13(FaasDataWrapper, {
1363
1448
  ...props.faasData,
1364
- children: /* @__PURE__ */ jsx12(FaasDataTable, {
1449
+ children: /* @__PURE__ */ jsx13(FaasDataTable, {
1365
1450
  props,
1366
1451
  columns
1367
1452
  })
@@ -1387,7 +1472,7 @@ function FaasDataTable({
1387
1472
  text: v.label,
1388
1473
  value: v.value
1389
1474
  })).concat({
1390
- text: /* @__PURE__ */ jsx12(Blank, {}),
1475
+ text: /* @__PURE__ */ jsx13(Blank, {}),
1391
1476
  value: null
1392
1477
  });
1393
1478
  column.render = (value) => processValue(column, value);
@@ -1402,7 +1487,7 @@ function FaasDataTable({
1402
1487
  }));
1403
1488
  if (filters.length)
1404
1489
  column.filters = filters.concat({
1405
- text: /* @__PURE__ */ jsx12(Blank, {}),
1490
+ text: /* @__PURE__ */ jsx13(Blank, {}),
1406
1491
  value: null
1407
1492
  });
1408
1493
  }
@@ -1411,20 +1496,20 @@ function FaasDataTable({
1411
1496
  });
1412
1497
  }, [columns, data]);
1413
1498
  if (!data)
1414
- return /* @__PURE__ */ jsx12(AntdTable, {
1499
+ return /* @__PURE__ */ jsx13(AntdTable, {
1415
1500
  ...props,
1416
1501
  rowKey: props.rowKey || "id",
1417
1502
  columns: currentColumns,
1418
1503
  dataSource: []
1419
1504
  });
1420
1505
  if (Array.isArray(data))
1421
- return /* @__PURE__ */ jsx12(AntdTable, {
1506
+ return /* @__PURE__ */ jsx13(AntdTable, {
1422
1507
  ...props,
1423
1508
  rowKey: props.rowKey || "id",
1424
1509
  columns: currentColumns,
1425
1510
  dataSource: data
1426
1511
  });
1427
- return /* @__PURE__ */ jsx12(AntdTable, {
1512
+ return /* @__PURE__ */ jsx13(AntdTable, {
1428
1513
  ...props,
1429
1514
  rowKey: props.rowKey || "id",
1430
1515
  columns: currentColumns,
@@ -1455,8 +1540,8 @@ function FaasDataTable({
1455
1540
  }
1456
1541
 
1457
1542
  // src/Title.tsx
1458
- import { useEffect as useEffect6, cloneElement as cloneElement3 } from "react";
1459
- import { Fragment as Fragment3, jsx as jsx13 } from "react/jsx-runtime";
1543
+ import { useEffect as useEffect6, cloneElement as cloneElement4 } from "react";
1544
+ import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
1460
1545
  function Title(props) {
1461
1546
  const { Title: Title2 } = useConfigContext();
1462
1547
  useEffect6(() => {
@@ -1465,21 +1550,21 @@ function Title(props) {
1465
1550
  }, [props]);
1466
1551
  if (props.h1) {
1467
1552
  if (typeof props.h1 === "boolean")
1468
- return /* @__PURE__ */ jsx13("h1", {
1553
+ return /* @__PURE__ */ jsx14("h1", {
1469
1554
  children: Array.isArray(props.title) ? props.title[0] : props.title
1470
1555
  });
1471
- return /* @__PURE__ */ jsx13("h1", {
1556
+ return /* @__PURE__ */ jsx14("h1", {
1472
1557
  className: props.h1.className,
1473
1558
  style: props.h1.style,
1474
1559
  children: Array.isArray(props.title) ? props.title[0] : props.title
1475
1560
  });
1476
1561
  }
1477
1562
  if (props.plain)
1478
- return /* @__PURE__ */ jsx13(Fragment3, {
1563
+ return /* @__PURE__ */ jsx14(Fragment5, {
1479
1564
  children: Array.isArray(props.title) ? props.title[0] : props.title
1480
1565
  });
1481
1566
  if (props.children)
1482
- return cloneElement3(props.children, { title: props.title });
1567
+ return cloneElement4(props.children, { title: props.title });
1483
1568
  return null;
1484
1569
  }
1485
1570
  export {
@@ -1488,6 +1573,7 @@ export {
1488
1573
  ConfigProvider,
1489
1574
  Description,
1490
1575
  Drawer,
1576
+ ErrorBoundary,
1491
1577
  FaasDataWrapper,
1492
1578
  Form,
1493
1579
  FormItem,