@faasjs/ant-design 0.0.3-beta.32 → 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.d.ts +23 -5
- package/dist/index.js +127 -82
- package/dist/index.mjs +195 -151
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -154,16 +154,13 @@ function Loading(props) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/FaasDataWrapper.tsx
|
|
157
|
-
import { Alert } from "antd";
|
|
158
157
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
159
158
|
function FaasDataWrapper(props) {
|
|
160
|
-
return /* @__PURE__ */ jsx4(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
...props
|
|
166
|
-
})
|
|
159
|
+
return /* @__PURE__ */ jsx4(Origin, {
|
|
160
|
+
fallback: props.loading || /* @__PURE__ */ jsx4(Loading, {
|
|
161
|
+
...props.loadingProps
|
|
162
|
+
}),
|
|
163
|
+
...props
|
|
167
164
|
});
|
|
168
165
|
}
|
|
169
166
|
|
|
@@ -358,6 +355,53 @@ function useDrawer(init) {
|
|
|
358
355
|
};
|
|
359
356
|
}
|
|
360
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
|
+
|
|
361
405
|
// src/Form.tsx
|
|
362
406
|
import { faas } from "@faasjs/react";
|
|
363
407
|
import {
|
|
@@ -391,7 +435,7 @@ import {
|
|
|
391
435
|
useState as useState4
|
|
392
436
|
} from "react";
|
|
393
437
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
394
|
-
import { Fragment as Fragment3, jsx as
|
|
438
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
395
439
|
function processProps(propsCopy, config) {
|
|
396
440
|
if (!propsCopy.title)
|
|
397
441
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -468,100 +512,100 @@ function FormItem(props) {
|
|
|
468
512
|
if (!computedProps)
|
|
469
513
|
return null;
|
|
470
514
|
if (hidden)
|
|
471
|
-
return /* @__PURE__ */
|
|
515
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
472
516
|
...computedProps,
|
|
473
517
|
noStyle: true,
|
|
474
518
|
rules: [],
|
|
475
|
-
children: /* @__PURE__ */
|
|
519
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
476
520
|
hidden: true
|
|
477
521
|
})
|
|
478
522
|
});
|
|
479
523
|
if (extendTypes && extendTypes[computedProps.type])
|
|
480
|
-
return /* @__PURE__ */
|
|
524
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
481
525
|
...computedProps,
|
|
482
526
|
children: extendTypes[computedProps.type].children
|
|
483
527
|
});
|
|
484
528
|
if (computedProps.formChildren === null)
|
|
485
529
|
return null;
|
|
486
530
|
if (computedProps.formChildren)
|
|
487
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
488
532
|
...computedProps,
|
|
489
533
|
children: cloneElement2(computedProps.formChildren, { scene: "form" })
|
|
490
534
|
});
|
|
491
535
|
if (computedProps.children === null)
|
|
492
536
|
return null;
|
|
493
537
|
if (computedProps.children)
|
|
494
|
-
return /* @__PURE__ */
|
|
538
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
495
539
|
...computedProps,
|
|
496
540
|
children: cloneElement2(computedProps.children, { scene: "form" })
|
|
497
541
|
});
|
|
498
542
|
if (computedProps.formRender)
|
|
499
|
-
return /* @__PURE__ */
|
|
543
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
500
544
|
...computedProps,
|
|
501
545
|
children: computedProps.formRender(null, null, 0, "form")
|
|
502
546
|
});
|
|
503
547
|
if (computedProps.render)
|
|
504
|
-
return /* @__PURE__ */
|
|
548
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
505
549
|
...computedProps,
|
|
506
550
|
children: computedProps.render(null, null, 0, "form")
|
|
507
551
|
});
|
|
508
552
|
switch (computedProps.type) {
|
|
509
553
|
case "string":
|
|
510
|
-
return /* @__PURE__ */
|
|
554
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
511
555
|
...computedProps,
|
|
512
|
-
children: computedProps.options ? /* @__PURE__ */
|
|
556
|
+
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
513
557
|
...computedProps.input
|
|
514
|
-
}) : /* @__PURE__ */
|
|
558
|
+
}) : /* @__PURE__ */ jsx8(Input, {
|
|
515
559
|
...computedProps.input
|
|
516
560
|
})
|
|
517
561
|
});
|
|
518
562
|
case "string[]":
|
|
519
563
|
if (computedProps.options)
|
|
520
|
-
return /* @__PURE__ */
|
|
564
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
521
565
|
...computedProps,
|
|
522
|
-
children: /* @__PURE__ */
|
|
566
|
+
children: /* @__PURE__ */ jsx8(Select, {
|
|
523
567
|
mode: "multiple",
|
|
524
568
|
...computedProps.input
|
|
525
569
|
})
|
|
526
570
|
});
|
|
527
|
-
return /* @__PURE__ */
|
|
571
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
528
572
|
name: computedProps.name,
|
|
529
573
|
rules: computedProps.rules,
|
|
530
574
|
children: (fields, { add, remove }, { errors }) => {
|
|
531
575
|
var _a2;
|
|
532
576
|
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
533
577
|
children: [
|
|
534
|
-
computedProps.label && /* @__PURE__ */
|
|
578
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
535
579
|
className: "ant-form-item-label",
|
|
536
|
-
children: /* @__PURE__ */
|
|
580
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
537
581
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
538
582
|
children: computedProps.label
|
|
539
583
|
})
|
|
540
584
|
}),
|
|
541
585
|
fields.map((field) => {
|
|
542
586
|
var _a3;
|
|
543
|
-
return /* @__PURE__ */
|
|
587
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
544
588
|
children: /* @__PURE__ */ jsxs(Row, {
|
|
545
589
|
gutter: 24,
|
|
546
590
|
style: { flexFlow: "row nowrap" },
|
|
547
591
|
children: [
|
|
548
|
-
/* @__PURE__ */
|
|
592
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
549
593
|
span: 23,
|
|
550
|
-
children: /* @__PURE__ */
|
|
594
|
+
children: /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
551
595
|
...field,
|
|
552
596
|
noStyle: true,
|
|
553
|
-
children: /* @__PURE__ */
|
|
597
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
554
598
|
...computedProps.input
|
|
555
599
|
})
|
|
556
600
|
})
|
|
557
601
|
}),
|
|
558
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
559
603
|
span: 1,
|
|
560
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
604
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
561
605
|
danger: true,
|
|
562
606
|
type: "link",
|
|
563
607
|
style: { float: "right" },
|
|
564
|
-
icon: /* @__PURE__ */
|
|
608
|
+
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
565
609
|
onClick: () => remove(field.name)
|
|
566
610
|
})
|
|
567
611
|
})
|
|
@@ -571,13 +615,13 @@ function FormItem(props) {
|
|
|
571
615
|
}),
|
|
572
616
|
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
573
617
|
children: [
|
|
574
|
-
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
618
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
|
|
575
619
|
type: "dashed",
|
|
576
620
|
block: true,
|
|
577
621
|
onClick: () => add(),
|
|
578
|
-
icon: /* @__PURE__ */
|
|
622
|
+
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
579
623
|
}),
|
|
580
|
-
/* @__PURE__ */
|
|
624
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
581
625
|
errors
|
|
582
626
|
})
|
|
583
627
|
]
|
|
@@ -587,63 +631,63 @@ function FormItem(props) {
|
|
|
587
631
|
}
|
|
588
632
|
});
|
|
589
633
|
case "number":
|
|
590
|
-
return /* @__PURE__ */
|
|
634
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
591
635
|
...computedProps,
|
|
592
|
-
children: computedProps.options ? /* @__PURE__ */
|
|
636
|
+
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
593
637
|
...computedProps.input
|
|
594
|
-
}) : /* @__PURE__ */
|
|
638
|
+
}) : /* @__PURE__ */ jsx8(InputNumber, {
|
|
595
639
|
style: { width: "100%" },
|
|
596
640
|
...computedProps.input
|
|
597
641
|
})
|
|
598
642
|
});
|
|
599
643
|
case "number[]":
|
|
600
644
|
if (computedProps.options)
|
|
601
|
-
return /* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
602
646
|
...computedProps,
|
|
603
|
-
children: /* @__PURE__ */
|
|
647
|
+
children: /* @__PURE__ */ jsx8(Select, {
|
|
604
648
|
mode: "multiple",
|
|
605
649
|
...computedProps.input
|
|
606
650
|
})
|
|
607
651
|
});
|
|
608
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
609
653
|
name: computedProps.name,
|
|
610
654
|
rules: computedProps.rules,
|
|
611
655
|
children: (fields, { add, remove }, { errors }) => {
|
|
612
656
|
var _a2, _b;
|
|
613
657
|
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
614
658
|
children: [
|
|
615
|
-
computedProps.label && /* @__PURE__ */
|
|
659
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
616
660
|
className: "ant-form-item-label",
|
|
617
|
-
children: /* @__PURE__ */
|
|
661
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
618
662
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
619
663
|
children: computedProps.label
|
|
620
664
|
})
|
|
621
665
|
}),
|
|
622
666
|
fields.map((field) => {
|
|
623
667
|
var _a3;
|
|
624
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
625
669
|
children: /* @__PURE__ */ jsxs(Row, {
|
|
626
670
|
gutter: 24,
|
|
627
671
|
style: { flexFlow: "row nowrap" },
|
|
628
672
|
children: [
|
|
629
|
-
/* @__PURE__ */
|
|
673
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
630
674
|
span: 23,
|
|
631
|
-
children: /* @__PURE__ */
|
|
675
|
+
children: /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
632
676
|
...field,
|
|
633
677
|
noStyle: true,
|
|
634
|
-
children: /* @__PURE__ */
|
|
678
|
+
children: /* @__PURE__ */ jsx8(InputNumber, {
|
|
635
679
|
style: { width: "100%" },
|
|
636
680
|
...computedProps.input
|
|
637
681
|
})
|
|
638
682
|
})
|
|
639
683
|
}),
|
|
640
|
-
/* @__PURE__ */
|
|
684
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
641
685
|
span: 1,
|
|
642
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
686
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
643
687
|
danger: true,
|
|
644
688
|
type: "link",
|
|
645
689
|
style: { float: "right" },
|
|
646
|
-
icon: /* @__PURE__ */
|
|
690
|
+
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
647
691
|
onClick: () => remove(field.name)
|
|
648
692
|
})
|
|
649
693
|
})
|
|
@@ -653,13 +697,13 @@ function FormItem(props) {
|
|
|
653
697
|
}),
|
|
654
698
|
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
655
699
|
children: [
|
|
656
|
-
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
700
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
|
|
657
701
|
type: "dashed",
|
|
658
702
|
block: true,
|
|
659
703
|
onClick: () => add(),
|
|
660
|
-
icon: /* @__PURE__ */
|
|
704
|
+
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
661
705
|
}),
|
|
662
|
-
/* @__PURE__ */
|
|
706
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
663
707
|
errors
|
|
664
708
|
})
|
|
665
709
|
]
|
|
@@ -669,43 +713,43 @@ function FormItem(props) {
|
|
|
669
713
|
}
|
|
670
714
|
});
|
|
671
715
|
case "boolean":
|
|
672
|
-
return /* @__PURE__ */
|
|
716
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
673
717
|
...computedProps,
|
|
674
|
-
children: /* @__PURE__ */
|
|
718
|
+
children: /* @__PURE__ */ jsx8(Switch, {
|
|
675
719
|
...computedProps.input
|
|
676
720
|
})
|
|
677
721
|
});
|
|
678
722
|
case "date":
|
|
679
|
-
return /* @__PURE__ */
|
|
723
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
680
724
|
...computedProps,
|
|
681
|
-
children: /* @__PURE__ */
|
|
725
|
+
children: /* @__PURE__ */ jsx8(DatePicker, {
|
|
682
726
|
...computedProps.input
|
|
683
727
|
})
|
|
684
728
|
});
|
|
685
729
|
case "time":
|
|
686
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
687
731
|
...computedProps,
|
|
688
|
-
children: /* @__PURE__ */
|
|
732
|
+
children: /* @__PURE__ */ jsx8(TimePicker, {
|
|
689
733
|
...computedProps.input
|
|
690
734
|
})
|
|
691
735
|
});
|
|
692
736
|
case "object":
|
|
693
737
|
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
694
738
|
children: [
|
|
695
|
-
computedProps.label && /* @__PURE__ */
|
|
739
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
696
740
|
className: "ant-form-item-label",
|
|
697
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
698
742
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
699
743
|
children: computedProps.label
|
|
700
744
|
})
|
|
701
745
|
}),
|
|
702
|
-
computedProps.object.map((o) => /* @__PURE__ */
|
|
746
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx8(FormItem, {
|
|
703
747
|
...o
|
|
704
748
|
}, o.id))
|
|
705
749
|
]
|
|
706
750
|
});
|
|
707
751
|
case "object[]":
|
|
708
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
709
753
|
name: computedProps.name,
|
|
710
754
|
rules: computedProps.rules,
|
|
711
755
|
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment3, {
|
|
@@ -713,14 +757,14 @@ function FormItem(props) {
|
|
|
713
757
|
fields.map((field) => /* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
714
758
|
style: { marginBottom: 0 },
|
|
715
759
|
children: [
|
|
716
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ jsx8("div", {
|
|
717
761
|
className: "ant-form-item-label",
|
|
718
762
|
children: /* @__PURE__ */ jsxs("label", {
|
|
719
763
|
children: [
|
|
720
764
|
computedProps.label,
|
|
721
765
|
" ",
|
|
722
766
|
field.name + 1,
|
|
723
|
-
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
767
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
724
768
|
danger: true,
|
|
725
769
|
type: "link",
|
|
726
770
|
onClick: () => remove(field.name),
|
|
@@ -729,11 +773,11 @@ function FormItem(props) {
|
|
|
729
773
|
]
|
|
730
774
|
})
|
|
731
775
|
}),
|
|
732
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ jsx8(Row, {
|
|
733
777
|
gutter: 24,
|
|
734
|
-
children: computedProps.object.map((o) => /* @__PURE__ */
|
|
778
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ jsx8(Col, {
|
|
735
779
|
span: o.col || 24,
|
|
736
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ jsx8(FormItem, {
|
|
737
781
|
...o,
|
|
738
782
|
name: [field.name, o.id]
|
|
739
783
|
})
|
|
@@ -747,14 +791,14 @@ function FormItem(props) {
|
|
|
747
791
|
type: "dashed",
|
|
748
792
|
block: true,
|
|
749
793
|
onClick: () => add(),
|
|
750
|
-
icon: /* @__PURE__ */
|
|
794
|
+
icon: /* @__PURE__ */ jsx8(PlusOutlined, {}),
|
|
751
795
|
children: [
|
|
752
796
|
common2.add,
|
|
753
797
|
" ",
|
|
754
798
|
computedProps.label
|
|
755
799
|
]
|
|
756
800
|
}),
|
|
757
|
-
/* @__PURE__ */
|
|
801
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
758
802
|
errors
|
|
759
803
|
})
|
|
760
804
|
]
|
|
@@ -769,7 +813,7 @@ function FormItem(props) {
|
|
|
769
813
|
FormItem.useStatus = AntdForm.Item.useStatus;
|
|
770
814
|
|
|
771
815
|
// src/Form.tsx
|
|
772
|
-
import { jsx as
|
|
816
|
+
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
773
817
|
function Form(props) {
|
|
774
818
|
var _a, _b;
|
|
775
819
|
const [loading, setLoading] = useState5(false);
|
|
@@ -872,12 +916,12 @@ function Form(props) {
|
|
|
872
916
|
onValuesChange,
|
|
873
917
|
children: [
|
|
874
918
|
computedProps.beforeItems,
|
|
875
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */
|
|
919
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx9(FormItem, {
|
|
876
920
|
...item,
|
|
877
921
|
extendTypes
|
|
878
922
|
}, item.id)),
|
|
879
923
|
computedProps.children,
|
|
880
|
-
computedProps.submit !== false && /* @__PURE__ */
|
|
924
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx9(Button2, {
|
|
881
925
|
htmlType: "submit",
|
|
882
926
|
type: "primary",
|
|
883
927
|
loading,
|
|
@@ -898,67 +942,66 @@ Form.Provider = AntdForm2.Provider;
|
|
|
898
942
|
// src/Link.tsx
|
|
899
943
|
import { Link as RouterLink } from "react-router-dom";
|
|
900
944
|
import { Button as Button3 } from "antd";
|
|
901
|
-
import { jsx as
|
|
902
|
-
function Link({
|
|
903
|
-
|
|
904
|
-
target,
|
|
905
|
-
text,
|
|
906
|
-
children,
|
|
907
|
-
style,
|
|
908
|
-
button
|
|
909
|
-
}) {
|
|
945
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
946
|
+
function Link(props) {
|
|
947
|
+
var _a, _b, _c, _d;
|
|
910
948
|
const { Link: Link2 } = useConfigContext();
|
|
911
|
-
style = Object.assign({ cursor: "pointer" }, style);
|
|
912
|
-
if (
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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",
|
|
917
960
|
style: {
|
|
918
961
|
...Link2.style,
|
|
919
|
-
...style || {}
|
|
962
|
+
...props.style || {}
|
|
920
963
|
},
|
|
921
|
-
href,
|
|
922
|
-
children: text != null ?
|
|
964
|
+
href: props.href,
|
|
965
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
923
966
|
});
|
|
924
|
-
return /* @__PURE__ */
|
|
925
|
-
href,
|
|
926
|
-
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",
|
|
927
970
|
style: {
|
|
928
971
|
...Link2.style,
|
|
929
|
-
...style || {}
|
|
972
|
+
...props.style || {}
|
|
930
973
|
},
|
|
931
|
-
children: text != null ?
|
|
974
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
932
975
|
});
|
|
933
976
|
}
|
|
934
|
-
if (button)
|
|
935
|
-
return /* @__PURE__ */
|
|
936
|
-
to: href,
|
|
937
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
938
|
-
children: /* @__PURE__ */
|
|
939
|
-
...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,
|
|
940
983
|
style: {
|
|
941
984
|
...Link2.style,
|
|
942
|
-
...style || {}
|
|
985
|
+
...props.style || {}
|
|
943
986
|
},
|
|
944
|
-
children: text != null ?
|
|
987
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
945
988
|
})
|
|
946
989
|
});
|
|
947
|
-
return /* @__PURE__ */
|
|
948
|
-
to: href,
|
|
949
|
-
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),
|
|
950
993
|
style: {
|
|
951
994
|
...Link2.style,
|
|
952
|
-
...style || {}
|
|
995
|
+
...props.style || {}
|
|
953
996
|
},
|
|
954
|
-
children: text != null ?
|
|
997
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
955
998
|
});
|
|
956
999
|
}
|
|
957
1000
|
|
|
958
1001
|
// src/Modal.tsx
|
|
959
1002
|
import { Modal } from "antd";
|
|
960
1003
|
import { useState as useState6 } from "react";
|
|
961
|
-
import { jsx as
|
|
1004
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
962
1005
|
function useModal(init) {
|
|
963
1006
|
const [props, setProps] = useState6({
|
|
964
1007
|
open: false,
|
|
@@ -969,7 +1012,7 @@ function useModal(init) {
|
|
|
969
1012
|
...init
|
|
970
1013
|
});
|
|
971
1014
|
return {
|
|
972
|
-
modal: /* @__PURE__ */
|
|
1015
|
+
modal: /* @__PURE__ */ jsx11(Modal, {
|
|
973
1016
|
...props
|
|
974
1017
|
}),
|
|
975
1018
|
modalProps: props,
|
|
@@ -995,33 +1038,33 @@ import {
|
|
|
995
1038
|
Routes as OriginRoutes,
|
|
996
1039
|
Route
|
|
997
1040
|
} from "react-router-dom";
|
|
998
|
-
import { jsx as
|
|
1041
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
999
1042
|
function PageNotFound() {
|
|
1000
1043
|
const config = useConfigContext();
|
|
1001
|
-
return /* @__PURE__ */
|
|
1044
|
+
return /* @__PURE__ */ jsx12(Result, {
|
|
1002
1045
|
status: "404",
|
|
1003
1046
|
title: config.common.pageNotFound
|
|
1004
1047
|
});
|
|
1005
1048
|
}
|
|
1006
1049
|
function Routes(props) {
|
|
1007
|
-
return /* @__PURE__ */
|
|
1050
|
+
return /* @__PURE__ */ jsx12(Alert2.ErrorBoundary, {
|
|
1008
1051
|
children: /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
1009
1052
|
children: [
|
|
1010
|
-
props.routes.map((r) => /* @__PURE__ */
|
|
1053
|
+
props.routes.map((r) => /* @__PURE__ */ jsx12(Route, {
|
|
1011
1054
|
...r,
|
|
1012
|
-
element: r.element || /* @__PURE__ */
|
|
1013
|
-
fallback: props.fallback || /* @__PURE__ */
|
|
1055
|
+
element: r.element || /* @__PURE__ */ jsx12(Suspense, {
|
|
1056
|
+
fallback: props.fallback || /* @__PURE__ */ jsx12("div", {
|
|
1014
1057
|
style: { padding: "24px" },
|
|
1015
|
-
children: /* @__PURE__ */
|
|
1058
|
+
children: /* @__PURE__ */ jsx12(Skeleton, {
|
|
1016
1059
|
active: true
|
|
1017
1060
|
})
|
|
1018
1061
|
}),
|
|
1019
|
-
children: /* @__PURE__ */
|
|
1062
|
+
children: /* @__PURE__ */ jsx12(r.page, {})
|
|
1020
1063
|
})
|
|
1021
1064
|
}, r.path)),
|
|
1022
|
-
/* @__PURE__ */
|
|
1065
|
+
/* @__PURE__ */ jsx12(Route, {
|
|
1023
1066
|
path: "*",
|
|
1024
|
-
element: props.notFound || /* @__PURE__ */
|
|
1067
|
+
element: props.notFound || /* @__PURE__ */ jsx12(PageNotFound, {})
|
|
1025
1068
|
}, "*")
|
|
1026
1069
|
]
|
|
1027
1070
|
})
|
|
@@ -1046,12 +1089,12 @@ import {
|
|
|
1046
1089
|
uniqBy,
|
|
1047
1090
|
upperFirst as upperFirst4
|
|
1048
1091
|
} from "lodash-es";
|
|
1049
|
-
import { Fragment as Fragment4, jsx as
|
|
1092
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1050
1093
|
function processValue(item, value) {
|
|
1051
1094
|
var _a;
|
|
1052
1095
|
const transferred = transferValue(item.type, value);
|
|
1053
1096
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
1054
|
-
return /* @__PURE__ */
|
|
1097
|
+
return /* @__PURE__ */ jsx13(Blank, {});
|
|
1055
1098
|
if (item.options) {
|
|
1056
1099
|
if (item.type.endsWith("[]"))
|
|
1057
1100
|
return transferred.map((v) => {
|
|
@@ -1091,7 +1134,7 @@ function Table(props) {
|
|
|
1091
1134
|
text: o.label,
|
|
1092
1135
|
value: o.value
|
|
1093
1136
|
})).concat({
|
|
1094
|
-
text: /* @__PURE__ */
|
|
1137
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1095
1138
|
value: null
|
|
1096
1139
|
});
|
|
1097
1140
|
}
|
|
@@ -1150,7 +1193,7 @@ function Table(props) {
|
|
|
1150
1193
|
setSelectedKeys,
|
|
1151
1194
|
confirm,
|
|
1152
1195
|
clearFilters
|
|
1153
|
-
}) => /* @__PURE__ */
|
|
1196
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1154
1197
|
placeholder: `${common2.search} ${item.title}`,
|
|
1155
1198
|
allowClear: true,
|
|
1156
1199
|
onSearch: (v) => {
|
|
@@ -1180,7 +1223,7 @@ function Table(props) {
|
|
|
1180
1223
|
setSelectedKeys,
|
|
1181
1224
|
confirm,
|
|
1182
1225
|
clearFilters
|
|
1183
|
-
}) => /* @__PURE__ */
|
|
1226
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1184
1227
|
placeholder: `${common2.search} ${item.title}`,
|
|
1185
1228
|
allowClear: true,
|
|
1186
1229
|
onSearch: (v) => {
|
|
@@ -1210,7 +1253,7 @@ function Table(props) {
|
|
|
1210
1253
|
setSelectedKeys,
|
|
1211
1254
|
confirm,
|
|
1212
1255
|
clearFilters
|
|
1213
|
-
}) => /* @__PURE__ */
|
|
1256
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1214
1257
|
placeholder: `${common2.search} ${item.title}`,
|
|
1215
1258
|
allowClear: true,
|
|
1216
1259
|
onSearch: (v) => {
|
|
@@ -1240,7 +1283,7 @@ function Table(props) {
|
|
|
1240
1283
|
setSelectedKeys,
|
|
1241
1284
|
confirm,
|
|
1242
1285
|
clearFilters
|
|
1243
|
-
}) => /* @__PURE__ */
|
|
1286
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1244
1287
|
placeholder: `${common2.search} ${item.title}`,
|
|
1245
1288
|
allowClear: true,
|
|
1246
1289
|
onSearch: (v) => {
|
|
@@ -1256,12 +1299,12 @@ function Table(props) {
|
|
|
1256
1299
|
break;
|
|
1257
1300
|
case "boolean":
|
|
1258
1301
|
if (!item.render)
|
|
1259
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */
|
|
1302
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1260
1303
|
style: {
|
|
1261
1304
|
marginTop: "4px",
|
|
1262
1305
|
color: "#52c41a"
|
|
1263
1306
|
}
|
|
1264
|
-
}) : /* @__PURE__ */
|
|
1307
|
+
}) : /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1265
1308
|
style: {
|
|
1266
1309
|
marginTop: "4px",
|
|
1267
1310
|
color: "#ff4d4f"
|
|
@@ -1281,28 +1324,28 @@ function Table(props) {
|
|
|
1281
1324
|
confirm();
|
|
1282
1325
|
},
|
|
1283
1326
|
children: [
|
|
1284
|
-
/* @__PURE__ */
|
|
1327
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1285
1328
|
children: common2.all
|
|
1286
1329
|
}),
|
|
1287
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1288
1331
|
value: "true",
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1332
|
+
children: /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1290
1333
|
style: {
|
|
1291
1334
|
color: "#52c41a",
|
|
1292
1335
|
verticalAlign: "middle"
|
|
1293
1336
|
}
|
|
1294
1337
|
})
|
|
1295
1338
|
}),
|
|
1296
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1297
1340
|
value: "false",
|
|
1298
|
-
children: /* @__PURE__ */
|
|
1341
|
+
children: /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1299
1342
|
style: {
|
|
1300
1343
|
verticalAlign: "middle",
|
|
1301
1344
|
color: "#ff4d4f"
|
|
1302
1345
|
}
|
|
1303
1346
|
})
|
|
1304
1347
|
}),
|
|
1305
|
-
/* @__PURE__ */
|
|
1348
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1306
1349
|
value: "empty",
|
|
1307
1350
|
children: common2.blank
|
|
1308
1351
|
})
|
|
@@ -1340,7 +1383,7 @@ function Table(props) {
|
|
|
1340
1383
|
break;
|
|
1341
1384
|
case "object":
|
|
1342
1385
|
if (!item.render)
|
|
1343
|
-
item.render = (value) => /* @__PURE__ */
|
|
1386
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Description, {
|
|
1344
1387
|
items: item.object,
|
|
1345
1388
|
dataSource: value || {},
|
|
1346
1389
|
column: 1
|
|
@@ -1348,8 +1391,8 @@ function Table(props) {
|
|
|
1348
1391
|
break;
|
|
1349
1392
|
case "object[]":
|
|
1350
1393
|
if (!item.render)
|
|
1351
|
-
item.render = (value) => /* @__PURE__ */
|
|
1352
|
-
children: value.map((v, i) => /* @__PURE__ */
|
|
1394
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
|
|
1395
|
+
children: value.map((v, i) => /* @__PURE__ */ jsx13(Description, {
|
|
1353
1396
|
items: item.object,
|
|
1354
1397
|
dataSource: v || [],
|
|
1355
1398
|
column: 1
|
|
@@ -1384,7 +1427,7 @@ function Table(props) {
|
|
|
1384
1427
|
const newColumns = [...prev];
|
|
1385
1428
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1386
1429
|
newColumns[index].filters = filters.concat({
|
|
1387
|
-
text: /* @__PURE__ */
|
|
1430
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1388
1431
|
value: null
|
|
1389
1432
|
});
|
|
1390
1433
|
return newColumns;
|
|
@@ -1395,15 +1438,15 @@ function Table(props) {
|
|
|
1395
1438
|
if (!columns)
|
|
1396
1439
|
return null;
|
|
1397
1440
|
if (!props.faasData)
|
|
1398
|
-
return /* @__PURE__ */
|
|
1441
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1399
1442
|
...props,
|
|
1400
1443
|
rowKey: props.rowKey || "id",
|
|
1401
1444
|
columns,
|
|
1402
1445
|
dataSource: props.dataSource
|
|
1403
1446
|
});
|
|
1404
|
-
return /* @__PURE__ */
|
|
1447
|
+
return /* @__PURE__ */ jsx13(FaasDataWrapper, {
|
|
1405
1448
|
...props.faasData,
|
|
1406
|
-
children: /* @__PURE__ */
|
|
1449
|
+
children: /* @__PURE__ */ jsx13(FaasDataTable, {
|
|
1407
1450
|
props,
|
|
1408
1451
|
columns
|
|
1409
1452
|
})
|
|
@@ -1429,7 +1472,7 @@ function FaasDataTable({
|
|
|
1429
1472
|
text: v.label,
|
|
1430
1473
|
value: v.value
|
|
1431
1474
|
})).concat({
|
|
1432
|
-
text: /* @__PURE__ */
|
|
1475
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1433
1476
|
value: null
|
|
1434
1477
|
});
|
|
1435
1478
|
column.render = (value) => processValue(column, value);
|
|
@@ -1444,7 +1487,7 @@ function FaasDataTable({
|
|
|
1444
1487
|
}));
|
|
1445
1488
|
if (filters.length)
|
|
1446
1489
|
column.filters = filters.concat({
|
|
1447
|
-
text: /* @__PURE__ */
|
|
1490
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1448
1491
|
value: null
|
|
1449
1492
|
});
|
|
1450
1493
|
}
|
|
@@ -1453,20 +1496,20 @@ function FaasDataTable({
|
|
|
1453
1496
|
});
|
|
1454
1497
|
}, [columns, data]);
|
|
1455
1498
|
if (!data)
|
|
1456
|
-
return /* @__PURE__ */
|
|
1499
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1457
1500
|
...props,
|
|
1458
1501
|
rowKey: props.rowKey || "id",
|
|
1459
1502
|
columns: currentColumns,
|
|
1460
1503
|
dataSource: []
|
|
1461
1504
|
});
|
|
1462
1505
|
if (Array.isArray(data))
|
|
1463
|
-
return /* @__PURE__ */
|
|
1506
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1464
1507
|
...props,
|
|
1465
1508
|
rowKey: props.rowKey || "id",
|
|
1466
1509
|
columns: currentColumns,
|
|
1467
1510
|
dataSource: data
|
|
1468
1511
|
});
|
|
1469
|
-
return /* @__PURE__ */
|
|
1512
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1470
1513
|
...props,
|
|
1471
1514
|
rowKey: props.rowKey || "id",
|
|
1472
1515
|
columns: currentColumns,
|
|
@@ -1498,7 +1541,7 @@ function FaasDataTable({
|
|
|
1498
1541
|
|
|
1499
1542
|
// src/Title.tsx
|
|
1500
1543
|
import { useEffect as useEffect6, cloneElement as cloneElement4 } from "react";
|
|
1501
|
-
import { Fragment as Fragment5, jsx as
|
|
1544
|
+
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1502
1545
|
function Title(props) {
|
|
1503
1546
|
const { Title: Title2 } = useConfigContext();
|
|
1504
1547
|
useEffect6(() => {
|
|
@@ -1507,17 +1550,17 @@ function Title(props) {
|
|
|
1507
1550
|
}, [props]);
|
|
1508
1551
|
if (props.h1) {
|
|
1509
1552
|
if (typeof props.h1 === "boolean")
|
|
1510
|
-
return /* @__PURE__ */
|
|
1553
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1511
1554
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1512
1555
|
});
|
|
1513
|
-
return /* @__PURE__ */
|
|
1556
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1514
1557
|
className: props.h1.className,
|
|
1515
1558
|
style: props.h1.style,
|
|
1516
1559
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1517
1560
|
});
|
|
1518
1561
|
}
|
|
1519
1562
|
if (props.plain)
|
|
1520
|
-
return /* @__PURE__ */
|
|
1563
|
+
return /* @__PURE__ */ jsx14(Fragment5, {
|
|
1521
1564
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1522
1565
|
});
|
|
1523
1566
|
if (props.children)
|
|
@@ -1530,6 +1573,7 @@ export {
|
|
|
1530
1573
|
ConfigProvider,
|
|
1531
1574
|
Description,
|
|
1532
1575
|
Drawer,
|
|
1576
|
+
ErrorBoundary,
|
|
1533
1577
|
FaasDataWrapper,
|
|
1534
1578
|
Form,
|
|
1535
1579
|
FormItem,
|