@faasjs/ant-design 0.0.3-beta.32 → 0.0.3-beta.34
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 -94
- package/dist/index.mjs +195 -163
- 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,54 @@ 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
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
949
|
+
let style = Object.assign(Link2.style || {}, { cursor: "pointer" }, props.style || {});
|
|
950
|
+
if (props.block)
|
|
951
|
+
style = Object.assign({
|
|
952
|
+
display: "block",
|
|
953
|
+
width: "100%"
|
|
954
|
+
}, 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",
|
|
960
|
+
style,
|
|
961
|
+
href: props.href,
|
|
962
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
923
963
|
});
|
|
924
|
-
return /* @__PURE__ */
|
|
925
|
-
href,
|
|
926
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
927
|
-
style
|
|
928
|
-
|
|
929
|
-
...style || {}
|
|
930
|
-
},
|
|
931
|
-
children: text != null ? text : children
|
|
964
|
+
return /* @__PURE__ */ jsx10("a", {
|
|
965
|
+
href: props.href,
|
|
966
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
967
|
+
style,
|
|
968
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
932
969
|
});
|
|
933
970
|
}
|
|
934
|
-
if (button)
|
|
935
|
-
return /* @__PURE__ */
|
|
936
|
-
to: href,
|
|
937
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
938
|
-
children: /* @__PURE__ */
|
|
939
|
-
...button,
|
|
940
|
-
style
|
|
941
|
-
|
|
942
|
-
...style || {}
|
|
943
|
-
},
|
|
944
|
-
children: text != null ? text : children
|
|
971
|
+
if (props.button)
|
|
972
|
+
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
973
|
+
to: props.href,
|
|
974
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
975
|
+
children: /* @__PURE__ */ jsx10(Button3, {
|
|
976
|
+
...props.button,
|
|
977
|
+
style,
|
|
978
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
945
979
|
})
|
|
946
980
|
});
|
|
947
|
-
return /* @__PURE__ */
|
|
948
|
-
to: href,
|
|
949
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
950
|
-
style
|
|
951
|
-
|
|
952
|
-
...style || {}
|
|
953
|
-
},
|
|
954
|
-
children: text != null ? text : children
|
|
981
|
+
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
982
|
+
to: props.href,
|
|
983
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
984
|
+
style,
|
|
985
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
955
986
|
});
|
|
956
987
|
}
|
|
957
988
|
|
|
958
989
|
// src/Modal.tsx
|
|
959
990
|
import { Modal } from "antd";
|
|
960
991
|
import { useState as useState6 } from "react";
|
|
961
|
-
import { jsx as
|
|
992
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
962
993
|
function useModal(init) {
|
|
963
994
|
const [props, setProps] = useState6({
|
|
964
995
|
open: false,
|
|
@@ -969,7 +1000,7 @@ function useModal(init) {
|
|
|
969
1000
|
...init
|
|
970
1001
|
});
|
|
971
1002
|
return {
|
|
972
|
-
modal: /* @__PURE__ */
|
|
1003
|
+
modal: /* @__PURE__ */ jsx11(Modal, {
|
|
973
1004
|
...props
|
|
974
1005
|
}),
|
|
975
1006
|
modalProps: props,
|
|
@@ -995,33 +1026,33 @@ import {
|
|
|
995
1026
|
Routes as OriginRoutes,
|
|
996
1027
|
Route
|
|
997
1028
|
} from "react-router-dom";
|
|
998
|
-
import { jsx as
|
|
1029
|
+
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
999
1030
|
function PageNotFound() {
|
|
1000
1031
|
const config = useConfigContext();
|
|
1001
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ jsx12(Result, {
|
|
1002
1033
|
status: "404",
|
|
1003
1034
|
title: config.common.pageNotFound
|
|
1004
1035
|
});
|
|
1005
1036
|
}
|
|
1006
1037
|
function Routes(props) {
|
|
1007
|
-
return /* @__PURE__ */
|
|
1038
|
+
return /* @__PURE__ */ jsx12(Alert2.ErrorBoundary, {
|
|
1008
1039
|
children: /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
1009
1040
|
children: [
|
|
1010
|
-
props.routes.map((r) => /* @__PURE__ */
|
|
1041
|
+
props.routes.map((r) => /* @__PURE__ */ jsx12(Route, {
|
|
1011
1042
|
...r,
|
|
1012
|
-
element: r.element || /* @__PURE__ */
|
|
1013
|
-
fallback: props.fallback || /* @__PURE__ */
|
|
1043
|
+
element: r.element || /* @__PURE__ */ jsx12(Suspense, {
|
|
1044
|
+
fallback: props.fallback || /* @__PURE__ */ jsx12("div", {
|
|
1014
1045
|
style: { padding: "24px" },
|
|
1015
|
-
children: /* @__PURE__ */
|
|
1046
|
+
children: /* @__PURE__ */ jsx12(Skeleton, {
|
|
1016
1047
|
active: true
|
|
1017
1048
|
})
|
|
1018
1049
|
}),
|
|
1019
|
-
children: /* @__PURE__ */
|
|
1050
|
+
children: /* @__PURE__ */ jsx12(r.page, {})
|
|
1020
1051
|
})
|
|
1021
1052
|
}, r.path)),
|
|
1022
|
-
/* @__PURE__ */
|
|
1053
|
+
/* @__PURE__ */ jsx12(Route, {
|
|
1023
1054
|
path: "*",
|
|
1024
|
-
element: props.notFound || /* @__PURE__ */
|
|
1055
|
+
element: props.notFound || /* @__PURE__ */ jsx12(PageNotFound, {})
|
|
1025
1056
|
}, "*")
|
|
1026
1057
|
]
|
|
1027
1058
|
})
|
|
@@ -1046,12 +1077,12 @@ import {
|
|
|
1046
1077
|
uniqBy,
|
|
1047
1078
|
upperFirst as upperFirst4
|
|
1048
1079
|
} from "lodash-es";
|
|
1049
|
-
import { Fragment as Fragment4, jsx as
|
|
1080
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1050
1081
|
function processValue(item, value) {
|
|
1051
1082
|
var _a;
|
|
1052
1083
|
const transferred = transferValue(item.type, value);
|
|
1053
1084
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
1054
|
-
return /* @__PURE__ */
|
|
1085
|
+
return /* @__PURE__ */ jsx13(Blank, {});
|
|
1055
1086
|
if (item.options) {
|
|
1056
1087
|
if (item.type.endsWith("[]"))
|
|
1057
1088
|
return transferred.map((v) => {
|
|
@@ -1091,7 +1122,7 @@ function Table(props) {
|
|
|
1091
1122
|
text: o.label,
|
|
1092
1123
|
value: o.value
|
|
1093
1124
|
})).concat({
|
|
1094
|
-
text: /* @__PURE__ */
|
|
1125
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1095
1126
|
value: null
|
|
1096
1127
|
});
|
|
1097
1128
|
}
|
|
@@ -1150,7 +1181,7 @@ function Table(props) {
|
|
|
1150
1181
|
setSelectedKeys,
|
|
1151
1182
|
confirm,
|
|
1152
1183
|
clearFilters
|
|
1153
|
-
}) => /* @__PURE__ */
|
|
1184
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1154
1185
|
placeholder: `${common2.search} ${item.title}`,
|
|
1155
1186
|
allowClear: true,
|
|
1156
1187
|
onSearch: (v) => {
|
|
@@ -1180,7 +1211,7 @@ function Table(props) {
|
|
|
1180
1211
|
setSelectedKeys,
|
|
1181
1212
|
confirm,
|
|
1182
1213
|
clearFilters
|
|
1183
|
-
}) => /* @__PURE__ */
|
|
1214
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1184
1215
|
placeholder: `${common2.search} ${item.title}`,
|
|
1185
1216
|
allowClear: true,
|
|
1186
1217
|
onSearch: (v) => {
|
|
@@ -1210,7 +1241,7 @@ function Table(props) {
|
|
|
1210
1241
|
setSelectedKeys,
|
|
1211
1242
|
confirm,
|
|
1212
1243
|
clearFilters
|
|
1213
|
-
}) => /* @__PURE__ */
|
|
1244
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1214
1245
|
placeholder: `${common2.search} ${item.title}`,
|
|
1215
1246
|
allowClear: true,
|
|
1216
1247
|
onSearch: (v) => {
|
|
@@ -1240,7 +1271,7 @@ function Table(props) {
|
|
|
1240
1271
|
setSelectedKeys,
|
|
1241
1272
|
confirm,
|
|
1242
1273
|
clearFilters
|
|
1243
|
-
}) => /* @__PURE__ */
|
|
1274
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1244
1275
|
placeholder: `${common2.search} ${item.title}`,
|
|
1245
1276
|
allowClear: true,
|
|
1246
1277
|
onSearch: (v) => {
|
|
@@ -1256,12 +1287,12 @@ function Table(props) {
|
|
|
1256
1287
|
break;
|
|
1257
1288
|
case "boolean":
|
|
1258
1289
|
if (!item.render)
|
|
1259
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */
|
|
1290
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1260
1291
|
style: {
|
|
1261
1292
|
marginTop: "4px",
|
|
1262
1293
|
color: "#52c41a"
|
|
1263
1294
|
}
|
|
1264
|
-
}) : /* @__PURE__ */
|
|
1295
|
+
}) : /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1265
1296
|
style: {
|
|
1266
1297
|
marginTop: "4px",
|
|
1267
1298
|
color: "#ff4d4f"
|
|
@@ -1281,28 +1312,28 @@ function Table(props) {
|
|
|
1281
1312
|
confirm();
|
|
1282
1313
|
},
|
|
1283
1314
|
children: [
|
|
1284
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1285
1316
|
children: common2.all
|
|
1286
1317
|
}),
|
|
1287
|
-
/* @__PURE__ */
|
|
1318
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1288
1319
|
value: "true",
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1320
|
+
children: /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1290
1321
|
style: {
|
|
1291
1322
|
color: "#52c41a",
|
|
1292
1323
|
verticalAlign: "middle"
|
|
1293
1324
|
}
|
|
1294
1325
|
})
|
|
1295
1326
|
}),
|
|
1296
|
-
/* @__PURE__ */
|
|
1327
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1297
1328
|
value: "false",
|
|
1298
|
-
children: /* @__PURE__ */
|
|
1329
|
+
children: /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1299
1330
|
style: {
|
|
1300
1331
|
verticalAlign: "middle",
|
|
1301
1332
|
color: "#ff4d4f"
|
|
1302
1333
|
}
|
|
1303
1334
|
})
|
|
1304
1335
|
}),
|
|
1305
|
-
/* @__PURE__ */
|
|
1336
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1306
1337
|
value: "empty",
|
|
1307
1338
|
children: common2.blank
|
|
1308
1339
|
})
|
|
@@ -1340,7 +1371,7 @@ function Table(props) {
|
|
|
1340
1371
|
break;
|
|
1341
1372
|
case "object":
|
|
1342
1373
|
if (!item.render)
|
|
1343
|
-
item.render = (value) => /* @__PURE__ */
|
|
1374
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Description, {
|
|
1344
1375
|
items: item.object,
|
|
1345
1376
|
dataSource: value || {},
|
|
1346
1377
|
column: 1
|
|
@@ -1348,8 +1379,8 @@ function Table(props) {
|
|
|
1348
1379
|
break;
|
|
1349
1380
|
case "object[]":
|
|
1350
1381
|
if (!item.render)
|
|
1351
|
-
item.render = (value) => /* @__PURE__ */
|
|
1352
|
-
children: value.map((v, i) => /* @__PURE__ */
|
|
1382
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
|
|
1383
|
+
children: value.map((v, i) => /* @__PURE__ */ jsx13(Description, {
|
|
1353
1384
|
items: item.object,
|
|
1354
1385
|
dataSource: v || [],
|
|
1355
1386
|
column: 1
|
|
@@ -1384,7 +1415,7 @@ function Table(props) {
|
|
|
1384
1415
|
const newColumns = [...prev];
|
|
1385
1416
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1386
1417
|
newColumns[index].filters = filters.concat({
|
|
1387
|
-
text: /* @__PURE__ */
|
|
1418
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1388
1419
|
value: null
|
|
1389
1420
|
});
|
|
1390
1421
|
return newColumns;
|
|
@@ -1395,15 +1426,15 @@ function Table(props) {
|
|
|
1395
1426
|
if (!columns)
|
|
1396
1427
|
return null;
|
|
1397
1428
|
if (!props.faasData)
|
|
1398
|
-
return /* @__PURE__ */
|
|
1429
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1399
1430
|
...props,
|
|
1400
1431
|
rowKey: props.rowKey || "id",
|
|
1401
1432
|
columns,
|
|
1402
1433
|
dataSource: props.dataSource
|
|
1403
1434
|
});
|
|
1404
|
-
return /* @__PURE__ */
|
|
1435
|
+
return /* @__PURE__ */ jsx13(FaasDataWrapper, {
|
|
1405
1436
|
...props.faasData,
|
|
1406
|
-
children: /* @__PURE__ */
|
|
1437
|
+
children: /* @__PURE__ */ jsx13(FaasDataTable, {
|
|
1407
1438
|
props,
|
|
1408
1439
|
columns
|
|
1409
1440
|
})
|
|
@@ -1429,7 +1460,7 @@ function FaasDataTable({
|
|
|
1429
1460
|
text: v.label,
|
|
1430
1461
|
value: v.value
|
|
1431
1462
|
})).concat({
|
|
1432
|
-
text: /* @__PURE__ */
|
|
1463
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1433
1464
|
value: null
|
|
1434
1465
|
});
|
|
1435
1466
|
column.render = (value) => processValue(column, value);
|
|
@@ -1444,7 +1475,7 @@ function FaasDataTable({
|
|
|
1444
1475
|
}));
|
|
1445
1476
|
if (filters.length)
|
|
1446
1477
|
column.filters = filters.concat({
|
|
1447
|
-
text: /* @__PURE__ */
|
|
1478
|
+
text: /* @__PURE__ */ jsx13(Blank, {}),
|
|
1448
1479
|
value: null
|
|
1449
1480
|
});
|
|
1450
1481
|
}
|
|
@@ -1453,20 +1484,20 @@ function FaasDataTable({
|
|
|
1453
1484
|
});
|
|
1454
1485
|
}, [columns, data]);
|
|
1455
1486
|
if (!data)
|
|
1456
|
-
return /* @__PURE__ */
|
|
1487
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1457
1488
|
...props,
|
|
1458
1489
|
rowKey: props.rowKey || "id",
|
|
1459
1490
|
columns: currentColumns,
|
|
1460
1491
|
dataSource: []
|
|
1461
1492
|
});
|
|
1462
1493
|
if (Array.isArray(data))
|
|
1463
|
-
return /* @__PURE__ */
|
|
1494
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1464
1495
|
...props,
|
|
1465
1496
|
rowKey: props.rowKey || "id",
|
|
1466
1497
|
columns: currentColumns,
|
|
1467
1498
|
dataSource: data
|
|
1468
1499
|
});
|
|
1469
|
-
return /* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1470
1501
|
...props,
|
|
1471
1502
|
rowKey: props.rowKey || "id",
|
|
1472
1503
|
columns: currentColumns,
|
|
@@ -1498,7 +1529,7 @@ function FaasDataTable({
|
|
|
1498
1529
|
|
|
1499
1530
|
// src/Title.tsx
|
|
1500
1531
|
import { useEffect as useEffect6, cloneElement as cloneElement4 } from "react";
|
|
1501
|
-
import { Fragment as Fragment5, jsx as
|
|
1532
|
+
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1502
1533
|
function Title(props) {
|
|
1503
1534
|
const { Title: Title2 } = useConfigContext();
|
|
1504
1535
|
useEffect6(() => {
|
|
@@ -1507,17 +1538,17 @@ function Title(props) {
|
|
|
1507
1538
|
}, [props]);
|
|
1508
1539
|
if (props.h1) {
|
|
1509
1540
|
if (typeof props.h1 === "boolean")
|
|
1510
|
-
return /* @__PURE__ */
|
|
1541
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1511
1542
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1512
1543
|
});
|
|
1513
|
-
return /* @__PURE__ */
|
|
1544
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1514
1545
|
className: props.h1.className,
|
|
1515
1546
|
style: props.h1.style,
|
|
1516
1547
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1517
1548
|
});
|
|
1518
1549
|
}
|
|
1519
1550
|
if (props.plain)
|
|
1520
|
-
return /* @__PURE__ */
|
|
1551
|
+
return /* @__PURE__ */ jsx14(Fragment5, {
|
|
1521
1552
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1522
1553
|
});
|
|
1523
1554
|
if (props.children)
|
|
@@ -1530,6 +1561,7 @@ export {
|
|
|
1530
1561
|
ConfigProvider,
|
|
1531
1562
|
Description,
|
|
1532
1563
|
Drawer,
|
|
1564
|
+
ErrorBoundary,
|
|
1533
1565
|
FaasDataWrapper,
|
|
1534
1566
|
Form,
|
|
1535
1567
|
FormItem,
|