@faasjs/ant-design 8.0.0-beta.12 → 8.0.0-beta.14
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/README.md +9 -5
- package/dist/index.cjs +88 -213
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +76 -196
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,11 +22,15 @@ In `@faasjs/ant-design`, we use `FaasItemProps` to provide data structures for c
|
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
24
|
type FaasItemType =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
| 'string'
|
|
26
|
+
| 'string[]'
|
|
27
|
+
| 'number'
|
|
28
|
+
| 'number[]'
|
|
29
|
+
| 'boolean'
|
|
30
|
+
| 'date'
|
|
31
|
+
| 'time'
|
|
32
|
+
| 'object'
|
|
33
|
+
| 'object[]'
|
|
30
34
|
|
|
31
35
|
type FaasItemProps = {
|
|
32
36
|
type: FaasItemTypes
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -7,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
20
16
|
}
|
|
21
17
|
return to;
|
|
22
18
|
};
|
|
@@ -24,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
20
|
value: mod,
|
|
25
21
|
enumerable: true
|
|
26
22
|
}) : target, mod));
|
|
27
|
-
|
|
28
23
|
//#endregion
|
|
29
24
|
let _faasjs_react = require("@faasjs/react");
|
|
30
25
|
let antd = require("antd");
|
|
@@ -35,7 +30,6 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
30
|
let _ant_design_icons = require("@ant-design/icons");
|
|
36
31
|
let dayjs = require("dayjs");
|
|
37
32
|
dayjs = __toESM(dayjs);
|
|
38
|
-
|
|
39
33
|
//#region src/Loading.tsx
|
|
40
34
|
/**
|
|
41
35
|
* Loading component based on Spin
|
|
@@ -62,7 +56,6 @@ function Loading(props) {
|
|
|
62
56
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Spin, { size: props.size || "large" })
|
|
63
57
|
});
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
//#endregion
|
|
67
60
|
//#region src/FaasDataWrapper.tsx
|
|
68
61
|
/**
|
|
@@ -101,7 +94,6 @@ function withFaasData(Component, faasProps) {
|
|
|
101
94
|
...faasProps
|
|
102
95
|
});
|
|
103
96
|
}
|
|
104
|
-
|
|
105
97
|
//#endregion
|
|
106
98
|
//#region src/Config.tsx
|
|
107
99
|
const zh = {
|
|
@@ -173,7 +165,6 @@ function ConfigProvider(props) {
|
|
|
173
165
|
function useConfigContext() {
|
|
174
166
|
return (0, react.useContext)(ConfigContext);
|
|
175
167
|
}
|
|
176
|
-
|
|
177
168
|
//#endregion
|
|
178
169
|
//#region src/Drawer.tsx
|
|
179
170
|
/**
|
|
@@ -216,7 +207,6 @@ function useDrawer(init) {
|
|
|
216
207
|
setDrawerProps
|
|
217
208
|
};
|
|
218
209
|
}
|
|
219
|
-
|
|
220
210
|
//#endregion
|
|
221
211
|
//#region src/ErrorBoundary.tsx
|
|
222
212
|
function ErrorChildren(props) {
|
|
@@ -241,7 +231,6 @@ function ErrorBoundary(props) {
|
|
|
241
231
|
...props
|
|
242
232
|
});
|
|
243
233
|
}
|
|
244
|
-
|
|
245
234
|
//#endregion
|
|
246
235
|
//#region src/Modal.tsx
|
|
247
236
|
/**
|
|
@@ -282,7 +271,6 @@ function useModal(init) {
|
|
|
282
271
|
setModalProps
|
|
283
272
|
};
|
|
284
273
|
}
|
|
285
|
-
|
|
286
274
|
//#endregion
|
|
287
275
|
//#region src/App.tsx
|
|
288
276
|
const AppContext = (0, _faasjs_react.createSplittingContext)([
|
|
@@ -388,7 +376,6 @@ function App(props) {
|
|
|
388
376
|
*/
|
|
389
377
|
const useApp = AppContext.use;
|
|
390
378
|
App.useApp = useApp;
|
|
391
|
-
|
|
392
379
|
//#endregion
|
|
393
380
|
//#region src/Blank.tsx
|
|
394
381
|
/**
|
|
@@ -410,7 +397,6 @@ function Blank(options) {
|
|
|
410
397
|
children: options?.text || theme.Blank.text
|
|
411
398
|
}) : options.value;
|
|
412
399
|
}
|
|
413
|
-
|
|
414
400
|
//#endregion
|
|
415
401
|
//#region src/data.ts
|
|
416
402
|
/**
|
|
@@ -480,7 +466,6 @@ function transferValue(type, value) {
|
|
|
480
466
|
function cloneUnionFaasItemElement(element, props) {
|
|
481
467
|
return (0, react.cloneElement)((0, react.isValidElement)(element) ? element : (0, react.createElement)(element), props);
|
|
482
468
|
}
|
|
483
|
-
|
|
484
469
|
//#endregion
|
|
485
470
|
//#region src/Description.tsx
|
|
486
471
|
function DescriptionItemContent(props) {
|
|
@@ -607,7 +592,6 @@ function Description({ faasData, dataSource, renderTitle, extendTypes, ...props
|
|
|
607
592
|
});
|
|
608
593
|
}
|
|
609
594
|
Description.displayName = "Description";
|
|
610
|
-
|
|
611
595
|
//#endregion
|
|
612
596
|
//#region src/FormItem.tsx
|
|
613
597
|
function isOptionsProps(item) {
|
|
@@ -716,6 +700,59 @@ function FormItem(props) {
|
|
|
716
700
|
id: computedProps.id.toString(),
|
|
717
701
|
children: cloneUnionFaasItemElement(extendType.children, { scene: "form" })
|
|
718
702
|
});
|
|
703
|
+
const renderFormItemList = (inputElement) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.List, {
|
|
704
|
+
name: computedProps.name,
|
|
705
|
+
rules: computedProps.rules,
|
|
706
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
707
|
+
computedProps.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
708
|
+
className: "ant-form-item-label",
|
|
709
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
710
|
+
className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
|
|
711
|
+
children: computedProps.label
|
|
712
|
+
})
|
|
713
|
+
}),
|
|
714
|
+
fields.map((field) => {
|
|
715
|
+
const { key, ...fieldProps } = field;
|
|
716
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
717
|
+
id: key.toString(),
|
|
718
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Row, {
|
|
719
|
+
gutter: 24,
|
|
720
|
+
style: { flexFlow: "row nowrap" },
|
|
721
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
|
|
722
|
+
span: 23,
|
|
723
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
724
|
+
...fieldProps,
|
|
725
|
+
noStyle: true,
|
|
726
|
+
children: inputElement
|
|
727
|
+
})
|
|
728
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
|
|
729
|
+
span: 1,
|
|
730
|
+
children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
731
|
+
danger: true,
|
|
732
|
+
type: "link",
|
|
733
|
+
style: { float: "right" },
|
|
734
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusCircleOutlined, {}),
|
|
735
|
+
onClick: () => remove(field.name)
|
|
736
|
+
})
|
|
737
|
+
})]
|
|
738
|
+
})
|
|
739
|
+
}, key);
|
|
740
|
+
}),
|
|
741
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Form.Item, { children: [
|
|
742
|
+
!computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
743
|
+
type: "dashed",
|
|
744
|
+
block: true,
|
|
745
|
+
onClick: () => add(),
|
|
746
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {})
|
|
747
|
+
}),
|
|
748
|
+
computedProps.extra && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
749
|
+
className: "ant-form-item-extra",
|
|
750
|
+
children: computedProps.extra
|
|
751
|
+
}),
|
|
752
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.ErrorList, { errors })
|
|
753
|
+
] })
|
|
754
|
+
] })
|
|
755
|
+
});
|
|
719
756
|
switch (itemType) {
|
|
720
757
|
case "string":
|
|
721
758
|
if (isOptionsProps(computedProps)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
@@ -737,59 +774,7 @@ function FormItem(props) {
|
|
|
737
774
|
...computedProps.input
|
|
738
775
|
})
|
|
739
776
|
});
|
|
740
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.
|
|
741
|
-
name: computedProps.name,
|
|
742
|
-
rules: computedProps.rules,
|
|
743
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
744
|
-
computedProps.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
745
|
-
className: "ant-form-item-label",
|
|
746
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
747
|
-
className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
|
|
748
|
-
children: computedProps.label
|
|
749
|
-
})
|
|
750
|
-
}),
|
|
751
|
-
fields.map((field) => {
|
|
752
|
-
const { key, ...fieldProps } = field;
|
|
753
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
754
|
-
id: key.toString(),
|
|
755
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Row, {
|
|
756
|
-
gutter: 24,
|
|
757
|
-
style: { flexFlow: "row nowrap" },
|
|
758
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
|
|
759
|
-
span: 23,
|
|
760
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
761
|
-
...fieldProps,
|
|
762
|
-
noStyle: true,
|
|
763
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, { ...computedProps.input })
|
|
764
|
-
})
|
|
765
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
|
|
766
|
-
span: 1,
|
|
767
|
-
children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
768
|
-
danger: true,
|
|
769
|
-
type: "link",
|
|
770
|
-
style: { float: "right" },
|
|
771
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusCircleOutlined, {}),
|
|
772
|
-
onClick: () => remove(field.name)
|
|
773
|
-
})
|
|
774
|
-
})]
|
|
775
|
-
})
|
|
776
|
-
}, key);
|
|
777
|
-
}),
|
|
778
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Form.Item, { children: [
|
|
779
|
-
!computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
780
|
-
type: "dashed",
|
|
781
|
-
block: true,
|
|
782
|
-
onClick: () => add(),
|
|
783
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {})
|
|
784
|
-
}),
|
|
785
|
-
computedProps.extra && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
786
|
-
className: "ant-form-item-extra",
|
|
787
|
-
children: computedProps.extra
|
|
788
|
-
}),
|
|
789
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.ErrorList, { errors })
|
|
790
|
-
] })
|
|
791
|
-
] })
|
|
792
|
-
});
|
|
777
|
+
return renderFormItemList(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input, { ...computedProps.input }));
|
|
793
778
|
case "number":
|
|
794
779
|
if (isOptionsProps(computedProps)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
795
780
|
...computedProps,
|
|
@@ -813,62 +798,10 @@ function FormItem(props) {
|
|
|
813
798
|
...computedProps.input
|
|
814
799
|
})
|
|
815
800
|
});
|
|
816
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
computedProps.label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
821
|
-
className: "ant-form-item-label",
|
|
822
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
823
|
-
className: computedProps.rules?.find((r) => r.required) && "ant-form-item-required",
|
|
824
|
-
children: computedProps.label
|
|
825
|
-
})
|
|
826
|
-
}),
|
|
827
|
-
fields.map((field) => {
|
|
828
|
-
const { key, ...fieldProps } = field;
|
|
829
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
830
|
-
id: key.toString(),
|
|
831
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Row, {
|
|
832
|
-
gutter: 24,
|
|
833
|
-
style: { flexFlow: "row nowrap" },
|
|
834
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
|
|
835
|
-
span: 23,
|
|
836
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
837
|
-
...fieldProps,
|
|
838
|
-
noStyle: true,
|
|
839
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.InputNumber, {
|
|
840
|
-
style: { width: "100%" },
|
|
841
|
-
...computedProps.input
|
|
842
|
-
})
|
|
843
|
-
})
|
|
844
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Col, {
|
|
845
|
-
span: 1,
|
|
846
|
-
children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
847
|
-
danger: true,
|
|
848
|
-
type: "link",
|
|
849
|
-
style: { float: "right" },
|
|
850
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.MinusCircleOutlined, {}),
|
|
851
|
-
onClick: () => remove(field.name)
|
|
852
|
-
})
|
|
853
|
-
})]
|
|
854
|
-
})
|
|
855
|
-
}, key);
|
|
856
|
-
}),
|
|
857
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(antd.Form.Item, { children: [
|
|
858
|
-
!computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Button, {
|
|
859
|
-
type: "dashed",
|
|
860
|
-
block: true,
|
|
861
|
-
onClick: () => add(),
|
|
862
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ant_design_icons.PlusOutlined, {})
|
|
863
|
-
}),
|
|
864
|
-
computedProps.extra && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
865
|
-
className: "ant-form-item-extra",
|
|
866
|
-
children: computedProps.extra
|
|
867
|
-
}),
|
|
868
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.ErrorList, { errors })
|
|
869
|
-
] })
|
|
870
|
-
] })
|
|
871
|
-
});
|
|
801
|
+
return renderFormItemList(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.InputNumber, {
|
|
802
|
+
style: { width: "100%" },
|
|
803
|
+
...computedProps.input
|
|
804
|
+
}));
|
|
872
805
|
case "boolean": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Form.Item, {
|
|
873
806
|
...computedProps,
|
|
874
807
|
id: computedProps.id.toString(),
|
|
@@ -949,7 +882,6 @@ function FormItem(props) {
|
|
|
949
882
|
}
|
|
950
883
|
}
|
|
951
884
|
FormItem.useStatus = antd.Form.Item.useStatus;
|
|
952
|
-
|
|
953
885
|
//#endregion
|
|
954
886
|
//#region src/Form.tsx
|
|
955
887
|
function isFormItemProps(item) {
|
|
@@ -1066,7 +998,6 @@ Form.Item = FormItem;
|
|
|
1066
998
|
Form.List = antd.Form.List;
|
|
1067
999
|
Form.ErrorList = antd.Form.ErrorList;
|
|
1068
1000
|
Form.Provider = antd.Form.Provider;
|
|
1069
|
-
|
|
1070
1001
|
//#endregion
|
|
1071
1002
|
//#region src/Link.tsx
|
|
1072
1003
|
/**
|
|
@@ -1125,7 +1056,6 @@ function Link(props) {
|
|
|
1125
1056
|
children: props.children ?? props.text
|
|
1126
1057
|
});
|
|
1127
1058
|
}
|
|
1128
|
-
|
|
1129
1059
|
//#endregion
|
|
1130
1060
|
//#region src/Routers.tsx
|
|
1131
1061
|
function PageNotFound() {
|
|
@@ -1173,7 +1103,6 @@ function Routes(props) {
|
|
|
1173
1103
|
element: props.notFound || /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageNotFound, {})
|
|
1174
1104
|
}, "*")] });
|
|
1175
1105
|
}
|
|
1176
|
-
|
|
1177
1106
|
//#endregion
|
|
1178
1107
|
//#region src/Table.tsx
|
|
1179
1108
|
function processValue(item, value) {
|
|
@@ -1242,6 +1171,18 @@ function Table(props) {
|
|
|
1242
1171
|
};
|
|
1243
1172
|
(0, react.useEffect)(() => {
|
|
1244
1173
|
const items = (0, lodash_es.cloneDeep)(props.items).filter((item) => !(item.tableChildren === null || item.children === null || item.tableRender === null || item.render === null));
|
|
1174
|
+
const createTextSearchFilterDropdown = (item, transformValue) => ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.Input.Search, {
|
|
1175
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1176
|
+
allowClear: true,
|
|
1177
|
+
onSearch: (v) => {
|
|
1178
|
+
if (v) setSelectedKeys(transformValue ? [transformValue(v)] : [v]);
|
|
1179
|
+
else {
|
|
1180
|
+
setSelectedKeys([]);
|
|
1181
|
+
clearFilters?.();
|
|
1182
|
+
}
|
|
1183
|
+
confirm();
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1245
1186
|
for (const item of items) {
|
|
1246
1187
|
if (!item.key) item.key = item.id;
|
|
1247
1188
|
if (!item.dataIndex) item.dataIndex = item.id;
|
|
@@ -1302,18 +1243,7 @@ function Table(props) {
|
|
|
1302
1243
|
if ((0, lodash_es.isNil)(row[item.id])) return false;
|
|
1303
1244
|
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1304
1245
|
};
|
|
1305
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = (
|
|
1306
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1307
|
-
allowClear: true,
|
|
1308
|
-
onSearch: (v) => {
|
|
1309
|
-
if (v) setSelectedKeys([v]);
|
|
1310
|
-
else {
|
|
1311
|
-
setSelectedKeys([]);
|
|
1312
|
-
clearFilters?.();
|
|
1313
|
-
}
|
|
1314
|
-
confirm();
|
|
1315
|
-
}
|
|
1316
|
-
});
|
|
1246
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
|
|
1317
1247
|
}
|
|
1318
1248
|
break;
|
|
1319
1249
|
case "string[]":
|
|
@@ -1324,18 +1254,7 @@ function Table(props) {
|
|
|
1324
1254
|
if (!row[item.id] || !row[item.id].length || !value) return false;
|
|
1325
1255
|
return row[item.id].some((v) => v.trim().toLowerCase().includes(value.trim().toLowerCase()));
|
|
1326
1256
|
};
|
|
1327
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = (
|
|
1328
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1329
|
-
allowClear: true,
|
|
1330
|
-
onSearch: (v) => {
|
|
1331
|
-
if (v) setSelectedKeys([v]);
|
|
1332
|
-
else {
|
|
1333
|
-
setSelectedKeys([]);
|
|
1334
|
-
clearFilters?.();
|
|
1335
|
-
}
|
|
1336
|
-
confirm();
|
|
1337
|
-
}
|
|
1338
|
-
});
|
|
1257
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
|
|
1339
1258
|
}
|
|
1340
1259
|
break;
|
|
1341
1260
|
case "number":
|
|
@@ -1347,18 +1266,7 @@ function Table(props) {
|
|
|
1347
1266
|
if ((0, lodash_es.isNil)(row[item.id])) return false;
|
|
1348
1267
|
return value == row[item.id];
|
|
1349
1268
|
};
|
|
1350
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = (
|
|
1351
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1352
|
-
allowClear: true,
|
|
1353
|
-
onSearch: (v) => {
|
|
1354
|
-
if (v) setSelectedKeys([Number(v)]);
|
|
1355
|
-
else {
|
|
1356
|
-
setSelectedKeys([]);
|
|
1357
|
-
clearFilters?.();
|
|
1358
|
-
}
|
|
1359
|
-
confirm();
|
|
1360
|
-
}
|
|
1361
|
-
});
|
|
1269
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
|
|
1362
1270
|
}
|
|
1363
1271
|
break;
|
|
1364
1272
|
case "number[]":
|
|
@@ -1369,18 +1277,7 @@ function Table(props) {
|
|
|
1369
1277
|
if (!row[item.id] || !row[item.id].length) return false;
|
|
1370
1278
|
return row[item.id].includes(Number(value));
|
|
1371
1279
|
};
|
|
1372
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = (
|
|
1373
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1374
|
-
allowClear: true,
|
|
1375
|
-
onSearch: (v) => {
|
|
1376
|
-
if (v) setSelectedKeys([Number(v)]);
|
|
1377
|
-
else {
|
|
1378
|
-
setSelectedKeys([]);
|
|
1379
|
-
clearFilters?.();
|
|
1380
|
-
}
|
|
1381
|
-
confirm();
|
|
1382
|
-
}
|
|
1383
|
-
});
|
|
1280
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
|
|
1384
1281
|
}
|
|
1385
1282
|
break;
|
|
1386
1283
|
case "boolean":
|
|
@@ -1436,26 +1333,8 @@ function Table(props) {
|
|
|
1436
1333
|
}
|
|
1437
1334
|
break;
|
|
1438
1335
|
case "date":
|
|
1439
|
-
if (!item.render) item.render = (value) => processValue(item, value);
|
|
1440
|
-
if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
|
|
1441
|
-
if ((0, lodash_es.isNil)(a[item.id])) return order === "ascend" ? 1 : -1;
|
|
1442
|
-
if ((0, lodash_es.isNil)(b[item.id])) return order === "ascend" ? -1 : 1;
|
|
1443
|
-
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1444
|
-
};
|
|
1445
|
-
if (item.filterDropdown !== false) {
|
|
1446
|
-
if (typeof item.filterDropdown === "undefined") item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(antd.DatePicker.RangePicker, { onChange: (dates) => {
|
|
1447
|
-
setSelectedKeys(dates?.[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
|
|
1448
|
-
confirm();
|
|
1449
|
-
} });
|
|
1450
|
-
if (!item.onFilter && !props.faasData) item.onFilter = (value, row) => {
|
|
1451
|
-
if ((0, lodash_es.isNil)(value[0])) return true;
|
|
1452
|
-
if ((0, lodash_es.isNil)(row[item.id])) return false;
|
|
1453
|
-
return (0, dayjs.default)(row[item.id]) >= (0, dayjs.default)(value[0]) && (0, dayjs.default)(row[item.id]) <= (0, dayjs.default)(value[1]);
|
|
1454
|
-
};
|
|
1455
|
-
}
|
|
1456
|
-
break;
|
|
1457
1336
|
case "time":
|
|
1458
|
-
item.width = item.width ?? 200;
|
|
1337
|
+
if (itemType === "time") item.width = item.width ?? 200;
|
|
1459
1338
|
if (!item.render) item.render = (value) => processValue(item, value);
|
|
1460
1339
|
if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
|
|
1461
1340
|
if ((0, lodash_es.isNil)(a[item.id])) return order === "ascend" ? 1 : -1;
|
|
@@ -1615,7 +1494,6 @@ function FaasDataTable({ props, columns, data, params, reload, loading }) {
|
|
|
1615
1494
|
}
|
|
1616
1495
|
});
|
|
1617
1496
|
}
|
|
1618
|
-
|
|
1619
1497
|
//#endregion
|
|
1620
1498
|
//#region src/Tabs.tsx
|
|
1621
1499
|
/**
|
|
@@ -1653,7 +1531,6 @@ function Tabs(props) {
|
|
|
1653
1531
|
}))
|
|
1654
1532
|
});
|
|
1655
1533
|
}
|
|
1656
|
-
|
|
1657
1534
|
//#endregion
|
|
1658
1535
|
//#region src/Title.tsx
|
|
1659
1536
|
/**
|
|
@@ -1692,7 +1569,6 @@ function Title(props) {
|
|
|
1692
1569
|
if (props.children) return (0, react.cloneElement)(props.children, { title: props.title });
|
|
1693
1570
|
return null;
|
|
1694
1571
|
}
|
|
1695
|
-
|
|
1696
1572
|
//#endregion
|
|
1697
1573
|
//#region src/useThemeToken.ts
|
|
1698
1574
|
/**
|
|
@@ -1706,7 +1582,6 @@ function Title(props) {
|
|
|
1706
1582
|
function useThemeToken() {
|
|
1707
1583
|
return antd.theme.useToken().token;
|
|
1708
1584
|
}
|
|
1709
|
-
|
|
1710
1585
|
//#endregion
|
|
1711
1586
|
exports.App = App;
|
|
1712
1587
|
exports.Blank = Blank;
|
|
@@ -1730,11 +1605,11 @@ exports.Title = Title;
|
|
|
1730
1605
|
exports.cloneUnionFaasItemElement = cloneUnionFaasItemElement;
|
|
1731
1606
|
exports.faas = _faasjs_react.faas;
|
|
1732
1607
|
exports.idToTitle = idToTitle;
|
|
1733
|
-
Object.defineProperty(exports,
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1608
|
+
Object.defineProperty(exports, "lazy", {
|
|
1609
|
+
enumerable: true,
|
|
1610
|
+
get: function() {
|
|
1611
|
+
return react.lazy;
|
|
1612
|
+
}
|
|
1738
1613
|
});
|
|
1739
1614
|
exports.transferOptions = transferOptions;
|
|
1740
1615
|
exports.transferValue = transferValue;
|
|
@@ -1744,4 +1619,4 @@ exports.useDrawer = useDrawer;
|
|
|
1744
1619
|
exports.useFaas = _faasjs_react.useFaas;
|
|
1745
1620
|
exports.useModal = useModal;
|
|
1746
1621
|
exports.useThemeToken = useThemeToken;
|
|
1747
|
-
exports.withFaasData = withFaasData;
|
|
1622
|
+
exports.withFaasData = withFaasData;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ErrorBoundaryProps, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, FaasDataWrapperRef, FaasReactClient, FaasReactClientOptions, faas, useFaas } from "@faasjs/react";
|
|
2
2
|
import { ButtonProps, ConfigProviderProps as ConfigProviderProps$1, DatePickerProps, DescriptionsProps, Drawer, DrawerProps as DrawerProps$1, FormInstance, FormItemProps as FormItemProps$1, FormProps as FormProps$1, GlobalToken, InputNumberProps, InputProps, Modal, ModalProps as ModalProps$1, RadioProps, SelectProps, SwitchProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, TabsProps as TabsProps$1 } from "antd";
|
|
3
|
-
import { MessageInstance } from "antd/es/message/interface";
|
|
4
|
-
import { NotificationInstance } from "antd/es/notification/interface";
|
|
5
3
|
import { BrowserRouterProps, RouteProps } from "react-router-dom";
|
|
6
4
|
import * as react from "react";
|
|
7
5
|
import { CSSProperties, ComponentType, Dispatch, FC, JSX, LazyExoticComponent, ReactElement, ReactNode, SetStateAction, lazy } from "react";
|
|
8
|
-
import
|
|
6
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
9
7
|
import { Dayjs } from "dayjs";
|
|
8
|
+
import { MessageInstance } from "antd/es/message/interface";
|
|
9
|
+
import { NotificationInstance } from "antd/es/notification/interface";
|
|
10
10
|
import * as antd_es_form_FormItem0 from "antd/es/form/FormItem";
|
|
11
11
|
import * as antd_es_form0 from "antd/es/form";
|
|
12
12
|
import { RuleObject } from "antd/es/form";
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import { Suspense, cloneElement, createContext, createElement, isValidElement, l
|
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { CheckOutlined, CloseOutlined, MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
|
-
|
|
10
9
|
//#region src/Loading.tsx
|
|
11
10
|
/**
|
|
12
11
|
* Loading component based on Spin
|
|
@@ -33,7 +32,6 @@ function Loading(props) {
|
|
|
33
32
|
children: /* @__PURE__ */ jsx(Spin, { size: props.size || "large" })
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
//#endregion
|
|
38
36
|
//#region src/FaasDataWrapper.tsx
|
|
39
37
|
/**
|
|
@@ -72,7 +70,6 @@ function withFaasData(Component, faasProps) {
|
|
|
72
70
|
...faasProps
|
|
73
71
|
});
|
|
74
72
|
}
|
|
75
|
-
|
|
76
73
|
//#endregion
|
|
77
74
|
//#region src/Config.tsx
|
|
78
75
|
const zh = {
|
|
@@ -144,7 +141,6 @@ function ConfigProvider(props) {
|
|
|
144
141
|
function useConfigContext() {
|
|
145
142
|
return useContext(ConfigContext);
|
|
146
143
|
}
|
|
147
|
-
|
|
148
144
|
//#endregion
|
|
149
145
|
//#region src/Drawer.tsx
|
|
150
146
|
/**
|
|
@@ -187,7 +183,6 @@ function useDrawer(init) {
|
|
|
187
183
|
setDrawerProps
|
|
188
184
|
};
|
|
189
185
|
}
|
|
190
|
-
|
|
191
186
|
//#endregion
|
|
192
187
|
//#region src/ErrorBoundary.tsx
|
|
193
188
|
function ErrorChildren(props) {
|
|
@@ -212,7 +207,6 @@ function ErrorBoundary(props) {
|
|
|
212
207
|
...props
|
|
213
208
|
});
|
|
214
209
|
}
|
|
215
|
-
|
|
216
210
|
//#endregion
|
|
217
211
|
//#region src/Modal.tsx
|
|
218
212
|
/**
|
|
@@ -253,7 +247,6 @@ function useModal(init) {
|
|
|
253
247
|
setModalProps
|
|
254
248
|
};
|
|
255
249
|
}
|
|
256
|
-
|
|
257
250
|
//#endregion
|
|
258
251
|
//#region src/App.tsx
|
|
259
252
|
const AppContext = createSplittingContext([
|
|
@@ -359,7 +352,6 @@ function App(props) {
|
|
|
359
352
|
*/
|
|
360
353
|
const useApp = AppContext.use;
|
|
361
354
|
App.useApp = useApp;
|
|
362
|
-
|
|
363
355
|
//#endregion
|
|
364
356
|
//#region src/Blank.tsx
|
|
365
357
|
/**
|
|
@@ -381,7 +373,6 @@ function Blank(options) {
|
|
|
381
373
|
children: options?.text || theme.Blank.text
|
|
382
374
|
}) : options.value;
|
|
383
375
|
}
|
|
384
|
-
|
|
385
376
|
//#endregion
|
|
386
377
|
//#region src/data.ts
|
|
387
378
|
/**
|
|
@@ -451,7 +442,6 @@ function transferValue(type, value) {
|
|
|
451
442
|
function cloneUnionFaasItemElement(element, props) {
|
|
452
443
|
return cloneElement(isValidElement(element) ? element : createElement(element), props);
|
|
453
444
|
}
|
|
454
|
-
|
|
455
445
|
//#endregion
|
|
456
446
|
//#region src/Description.tsx
|
|
457
447
|
function DescriptionItemContent(props) {
|
|
@@ -578,7 +568,6 @@ function Description({ faasData, dataSource, renderTitle, extendTypes, ...props
|
|
|
578
568
|
});
|
|
579
569
|
}
|
|
580
570
|
Description.displayName = "Description";
|
|
581
|
-
|
|
582
571
|
//#endregion
|
|
583
572
|
//#region src/FormItem.tsx
|
|
584
573
|
function isOptionsProps(item) {
|
|
@@ -687,6 +676,59 @@ function FormItem(props) {
|
|
|
687
676
|
id: computedProps.id.toString(),
|
|
688
677
|
children: cloneUnionFaasItemElement(extendType.children, { scene: "form" })
|
|
689
678
|
});
|
|
679
|
+
const renderFormItemList = (inputElement) => /* @__PURE__ */ jsx(Form$1.List, {
|
|
680
|
+
name: computedProps.name,
|
|
681
|
+
rules: computedProps.rules,
|
|
682
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
683
|
+
computedProps.label && /* @__PURE__ */ jsx("div", {
|
|
684
|
+
className: "ant-form-item-label",
|
|
685
|
+
children: /* @__PURE__ */ jsx("label", {
|
|
686
|
+
className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
|
|
687
|
+
children: computedProps.label
|
|
688
|
+
})
|
|
689
|
+
}),
|
|
690
|
+
fields.map((field) => {
|
|
691
|
+
const { key, ...fieldProps } = field;
|
|
692
|
+
return /* @__PURE__ */ jsx(Form$1.Item, {
|
|
693
|
+
id: key.toString(),
|
|
694
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
695
|
+
gutter: 24,
|
|
696
|
+
style: { flexFlow: "row nowrap" },
|
|
697
|
+
children: [/* @__PURE__ */ jsx(Col, {
|
|
698
|
+
span: 23,
|
|
699
|
+
children: /* @__PURE__ */ jsx(Form$1.Item, {
|
|
700
|
+
...fieldProps,
|
|
701
|
+
noStyle: true,
|
|
702
|
+
children: inputElement
|
|
703
|
+
})
|
|
704
|
+
}), /* @__PURE__ */ jsx(Col, {
|
|
705
|
+
span: 1,
|
|
706
|
+
children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(Button, {
|
|
707
|
+
danger: true,
|
|
708
|
+
type: "link",
|
|
709
|
+
style: { float: "right" },
|
|
710
|
+
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
711
|
+
onClick: () => remove(field.name)
|
|
712
|
+
})
|
|
713
|
+
})]
|
|
714
|
+
})
|
|
715
|
+
}, key);
|
|
716
|
+
}),
|
|
717
|
+
/* @__PURE__ */ jsxs(Form$1.Item, { children: [
|
|
718
|
+
!computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(Button, {
|
|
719
|
+
type: "dashed",
|
|
720
|
+
block: true,
|
|
721
|
+
onClick: () => add(),
|
|
722
|
+
icon: /* @__PURE__ */ jsx(PlusOutlined, {})
|
|
723
|
+
}),
|
|
724
|
+
computedProps.extra && /* @__PURE__ */ jsx("div", {
|
|
725
|
+
className: "ant-form-item-extra",
|
|
726
|
+
children: computedProps.extra
|
|
727
|
+
}),
|
|
728
|
+
/* @__PURE__ */ jsx(Form$1.ErrorList, { errors })
|
|
729
|
+
] })
|
|
730
|
+
] })
|
|
731
|
+
});
|
|
690
732
|
switch (itemType) {
|
|
691
733
|
case "string":
|
|
692
734
|
if (isOptionsProps(computedProps)) return /* @__PURE__ */ jsx(Form$1.Item, {
|
|
@@ -708,59 +750,7 @@ function FormItem(props) {
|
|
|
708
750
|
...computedProps.input
|
|
709
751
|
})
|
|
710
752
|
});
|
|
711
|
-
return /* @__PURE__ */ jsx(
|
|
712
|
-
name: computedProps.name,
|
|
713
|
-
rules: computedProps.rules,
|
|
714
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
715
|
-
computedProps.label && /* @__PURE__ */ jsx("div", {
|
|
716
|
-
className: "ant-form-item-label",
|
|
717
|
-
children: /* @__PURE__ */ jsx("label", {
|
|
718
|
-
className: (computedProps.rules || []).find((r) => r.required) && "ant-form-item-required",
|
|
719
|
-
children: computedProps.label
|
|
720
|
-
})
|
|
721
|
-
}),
|
|
722
|
-
fields.map((field) => {
|
|
723
|
-
const { key, ...fieldProps } = field;
|
|
724
|
-
return /* @__PURE__ */ jsx(Form$1.Item, {
|
|
725
|
-
id: key.toString(),
|
|
726
|
-
children: /* @__PURE__ */ jsxs(Row, {
|
|
727
|
-
gutter: 24,
|
|
728
|
-
style: { flexFlow: "row nowrap" },
|
|
729
|
-
children: [/* @__PURE__ */ jsx(Col, {
|
|
730
|
-
span: 23,
|
|
731
|
-
children: /* @__PURE__ */ jsx(Form$1.Item, {
|
|
732
|
-
...fieldProps,
|
|
733
|
-
noStyle: true,
|
|
734
|
-
children: /* @__PURE__ */ jsx(Input, { ...computedProps.input })
|
|
735
|
-
})
|
|
736
|
-
}), /* @__PURE__ */ jsx(Col, {
|
|
737
|
-
span: 1,
|
|
738
|
-
children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(Button, {
|
|
739
|
-
danger: true,
|
|
740
|
-
type: "link",
|
|
741
|
-
style: { float: "right" },
|
|
742
|
-
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
743
|
-
onClick: () => remove(field.name)
|
|
744
|
-
})
|
|
745
|
-
})]
|
|
746
|
-
})
|
|
747
|
-
}, key);
|
|
748
|
-
}),
|
|
749
|
-
/* @__PURE__ */ jsxs(Form$1.Item, { children: [
|
|
750
|
-
!computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(Button, {
|
|
751
|
-
type: "dashed",
|
|
752
|
-
block: true,
|
|
753
|
-
onClick: () => add(),
|
|
754
|
-
icon: /* @__PURE__ */ jsx(PlusOutlined, {})
|
|
755
|
-
}),
|
|
756
|
-
computedProps.extra && /* @__PURE__ */ jsx("div", {
|
|
757
|
-
className: "ant-form-item-extra",
|
|
758
|
-
children: computedProps.extra
|
|
759
|
-
}),
|
|
760
|
-
/* @__PURE__ */ jsx(Form$1.ErrorList, { errors })
|
|
761
|
-
] })
|
|
762
|
-
] })
|
|
763
|
-
});
|
|
753
|
+
return renderFormItemList(/* @__PURE__ */ jsx(Input, { ...computedProps.input }));
|
|
764
754
|
case "number":
|
|
765
755
|
if (isOptionsProps(computedProps)) return /* @__PURE__ */ jsx(Form$1.Item, {
|
|
766
756
|
...computedProps,
|
|
@@ -784,62 +774,10 @@ function FormItem(props) {
|
|
|
784
774
|
...computedProps.input
|
|
785
775
|
})
|
|
786
776
|
});
|
|
787
|
-
return /* @__PURE__ */ jsx(
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
computedProps.label && /* @__PURE__ */ jsx("div", {
|
|
792
|
-
className: "ant-form-item-label",
|
|
793
|
-
children: /* @__PURE__ */ jsx("label", {
|
|
794
|
-
className: computedProps.rules?.find((r) => r.required) && "ant-form-item-required",
|
|
795
|
-
children: computedProps.label
|
|
796
|
-
})
|
|
797
|
-
}),
|
|
798
|
-
fields.map((field) => {
|
|
799
|
-
const { key, ...fieldProps } = field;
|
|
800
|
-
return /* @__PURE__ */ jsx(Form$1.Item, {
|
|
801
|
-
id: key.toString(),
|
|
802
|
-
children: /* @__PURE__ */ jsxs(Row, {
|
|
803
|
-
gutter: 24,
|
|
804
|
-
style: { flexFlow: "row nowrap" },
|
|
805
|
-
children: [/* @__PURE__ */ jsx(Col, {
|
|
806
|
-
span: 23,
|
|
807
|
-
children: /* @__PURE__ */ jsx(Form$1.Item, {
|
|
808
|
-
...fieldProps,
|
|
809
|
-
noStyle: true,
|
|
810
|
-
children: /* @__PURE__ */ jsx(InputNumber, {
|
|
811
|
-
style: { width: "100%" },
|
|
812
|
-
...computedProps.input
|
|
813
|
-
})
|
|
814
|
-
})
|
|
815
|
-
}), /* @__PURE__ */ jsx(Col, {
|
|
816
|
-
span: 1,
|
|
817
|
-
children: !computedProps.input?.disabled && (!(computedProps.rules || []).find((r) => r.required) || key > 0) && /* @__PURE__ */ jsx(Button, {
|
|
818
|
-
danger: true,
|
|
819
|
-
type: "link",
|
|
820
|
-
style: { float: "right" },
|
|
821
|
-
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
822
|
-
onClick: () => remove(field.name)
|
|
823
|
-
})
|
|
824
|
-
})]
|
|
825
|
-
})
|
|
826
|
-
}, key);
|
|
827
|
-
}),
|
|
828
|
-
/* @__PURE__ */ jsxs(Form$1.Item, { children: [
|
|
829
|
-
!computedProps.input?.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(Button, {
|
|
830
|
-
type: "dashed",
|
|
831
|
-
block: true,
|
|
832
|
-
onClick: () => add(),
|
|
833
|
-
icon: /* @__PURE__ */ jsx(PlusOutlined, {})
|
|
834
|
-
}),
|
|
835
|
-
computedProps.extra && /* @__PURE__ */ jsx("div", {
|
|
836
|
-
className: "ant-form-item-extra",
|
|
837
|
-
children: computedProps.extra
|
|
838
|
-
}),
|
|
839
|
-
/* @__PURE__ */ jsx(Form$1.ErrorList, { errors })
|
|
840
|
-
] })
|
|
841
|
-
] })
|
|
842
|
-
});
|
|
777
|
+
return renderFormItemList(/* @__PURE__ */ jsx(InputNumber, {
|
|
778
|
+
style: { width: "100%" },
|
|
779
|
+
...computedProps.input
|
|
780
|
+
}));
|
|
843
781
|
case "boolean": return /* @__PURE__ */ jsx(Form$1.Item, {
|
|
844
782
|
...computedProps,
|
|
845
783
|
id: computedProps.id.toString(),
|
|
@@ -920,7 +858,6 @@ function FormItem(props) {
|
|
|
920
858
|
}
|
|
921
859
|
}
|
|
922
860
|
FormItem.useStatus = Form$1.Item.useStatus;
|
|
923
|
-
|
|
924
861
|
//#endregion
|
|
925
862
|
//#region src/Form.tsx
|
|
926
863
|
function isFormItemProps(item) {
|
|
@@ -1037,7 +974,6 @@ Form.Item = FormItem;
|
|
|
1037
974
|
Form.List = Form$1.List;
|
|
1038
975
|
Form.ErrorList = Form$1.ErrorList;
|
|
1039
976
|
Form.Provider = Form$1.Provider;
|
|
1040
|
-
|
|
1041
977
|
//#endregion
|
|
1042
978
|
//#region src/Link.tsx
|
|
1043
979
|
/**
|
|
@@ -1096,7 +1032,6 @@ function Link(props) {
|
|
|
1096
1032
|
children: props.children ?? props.text
|
|
1097
1033
|
});
|
|
1098
1034
|
}
|
|
1099
|
-
|
|
1100
1035
|
//#endregion
|
|
1101
1036
|
//#region src/Routers.tsx
|
|
1102
1037
|
function PageNotFound() {
|
|
@@ -1144,7 +1079,6 @@ function Routes(props) {
|
|
|
1144
1079
|
element: props.notFound || /* @__PURE__ */ jsx(PageNotFound, {})
|
|
1145
1080
|
}, "*")] });
|
|
1146
1081
|
}
|
|
1147
|
-
|
|
1148
1082
|
//#endregion
|
|
1149
1083
|
//#region src/Table.tsx
|
|
1150
1084
|
function processValue(item, value) {
|
|
@@ -1213,6 +1147,18 @@ function Table(props) {
|
|
|
1213
1147
|
};
|
|
1214
1148
|
useEffect(() => {
|
|
1215
1149
|
const items = cloneDeep(props.items).filter((item) => !(item.tableChildren === null || item.children === null || item.tableRender === null || item.render === null));
|
|
1150
|
+
const createTextSearchFilterDropdown = (item, transformValue) => ({ setSelectedKeys, confirm, clearFilters }) => /* @__PURE__ */ jsx(Input.Search, {
|
|
1151
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1152
|
+
allowClear: true,
|
|
1153
|
+
onSearch: (v) => {
|
|
1154
|
+
if (v) setSelectedKeys(transformValue ? [transformValue(v)] : [v]);
|
|
1155
|
+
else {
|
|
1156
|
+
setSelectedKeys([]);
|
|
1157
|
+
clearFilters?.();
|
|
1158
|
+
}
|
|
1159
|
+
confirm();
|
|
1160
|
+
}
|
|
1161
|
+
});
|
|
1216
1162
|
for (const item of items) {
|
|
1217
1163
|
if (!item.key) item.key = item.id;
|
|
1218
1164
|
if (!item.dataIndex) item.dataIndex = item.id;
|
|
@@ -1273,18 +1219,7 @@ function Table(props) {
|
|
|
1273
1219
|
if (isNil(row[item.id])) return false;
|
|
1274
1220
|
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1275
1221
|
};
|
|
1276
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = (
|
|
1277
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1278
|
-
allowClear: true,
|
|
1279
|
-
onSearch: (v) => {
|
|
1280
|
-
if (v) setSelectedKeys([v]);
|
|
1281
|
-
else {
|
|
1282
|
-
setSelectedKeys([]);
|
|
1283
|
-
clearFilters?.();
|
|
1284
|
-
}
|
|
1285
|
-
confirm();
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1222
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
|
|
1288
1223
|
}
|
|
1289
1224
|
break;
|
|
1290
1225
|
case "string[]":
|
|
@@ -1295,18 +1230,7 @@ function Table(props) {
|
|
|
1295
1230
|
if (!row[item.id] || !row[item.id].length || !value) return false;
|
|
1296
1231
|
return row[item.id].some((v) => v.trim().toLowerCase().includes(value.trim().toLowerCase()));
|
|
1297
1232
|
};
|
|
1298
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = (
|
|
1299
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1300
|
-
allowClear: true,
|
|
1301
|
-
onSearch: (v) => {
|
|
1302
|
-
if (v) setSelectedKeys([v]);
|
|
1303
|
-
else {
|
|
1304
|
-
setSelectedKeys([]);
|
|
1305
|
-
clearFilters?.();
|
|
1306
|
-
}
|
|
1307
|
-
confirm();
|
|
1308
|
-
}
|
|
1309
|
-
});
|
|
1233
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto") item.filterDropdown = createTextSearchFilterDropdown(item);
|
|
1310
1234
|
}
|
|
1311
1235
|
break;
|
|
1312
1236
|
case "number":
|
|
@@ -1318,18 +1242,7 @@ function Table(props) {
|
|
|
1318
1242
|
if (isNil(row[item.id])) return false;
|
|
1319
1243
|
return value == row[item.id];
|
|
1320
1244
|
};
|
|
1321
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = (
|
|
1322
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1323
|
-
allowClear: true,
|
|
1324
|
-
onSearch: (v) => {
|
|
1325
|
-
if (v) setSelectedKeys([Number(v)]);
|
|
1326
|
-
else {
|
|
1327
|
-
setSelectedKeys([]);
|
|
1328
|
-
clearFilters?.();
|
|
1329
|
-
}
|
|
1330
|
-
confirm();
|
|
1331
|
-
}
|
|
1332
|
-
});
|
|
1245
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
|
|
1333
1246
|
}
|
|
1334
1247
|
break;
|
|
1335
1248
|
case "number[]":
|
|
@@ -1340,18 +1253,7 @@ function Table(props) {
|
|
|
1340
1253
|
if (!row[item.id] || !row[item.id].length) return false;
|
|
1341
1254
|
return row[item.id].includes(Number(value));
|
|
1342
1255
|
};
|
|
1343
|
-
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = (
|
|
1344
|
-
placeholder: `${theme.common.search} ${item.title}`,
|
|
1345
|
-
allowClear: true,
|
|
1346
|
-
onSearch: (v) => {
|
|
1347
|
-
if (v) setSelectedKeys([Number(v)]);
|
|
1348
|
-
else {
|
|
1349
|
-
setSelectedKeys([]);
|
|
1350
|
-
clearFilters?.();
|
|
1351
|
-
}
|
|
1352
|
-
confirm();
|
|
1353
|
-
}
|
|
1354
|
-
});
|
|
1256
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters) item.filterDropdown = createTextSearchFilterDropdown(item, Number);
|
|
1355
1257
|
}
|
|
1356
1258
|
break;
|
|
1357
1259
|
case "boolean":
|
|
@@ -1407,26 +1309,8 @@ function Table(props) {
|
|
|
1407
1309
|
}
|
|
1408
1310
|
break;
|
|
1409
1311
|
case "date":
|
|
1410
|
-
if (!item.render) item.render = (value) => processValue(item, value);
|
|
1411
|
-
if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
|
|
1412
|
-
if (isNil(a[item.id])) return order === "ascend" ? 1 : -1;
|
|
1413
|
-
if (isNil(b[item.id])) return order === "ascend" ? -1 : 1;
|
|
1414
|
-
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1415
|
-
};
|
|
1416
|
-
if (item.filterDropdown !== false) {
|
|
1417
|
-
if (typeof item.filterDropdown === "undefined") item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(DatePicker.RangePicker, { onChange: (dates) => {
|
|
1418
|
-
setSelectedKeys(dates?.[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
|
|
1419
|
-
confirm();
|
|
1420
|
-
} });
|
|
1421
|
-
if (!item.onFilter && !props.faasData) item.onFilter = (value, row) => {
|
|
1422
|
-
if (isNil(value[0])) return true;
|
|
1423
|
-
if (isNil(row[item.id])) return false;
|
|
1424
|
-
return dayjs(row[item.id]) >= dayjs(value[0]) && dayjs(row[item.id]) <= dayjs(value[1]);
|
|
1425
|
-
};
|
|
1426
|
-
}
|
|
1427
|
-
break;
|
|
1428
1312
|
case "time":
|
|
1429
|
-
item.width = item.width ?? 200;
|
|
1313
|
+
if (itemType === "time") item.width = item.width ?? 200;
|
|
1430
1314
|
if (!item.render) item.render = (value) => processValue(item, value);
|
|
1431
1315
|
if (typeof item.sorter === "undefined") item.sorter = (a, b, order) => {
|
|
1432
1316
|
if (isNil(a[item.id])) return order === "ascend" ? 1 : -1;
|
|
@@ -1586,7 +1470,6 @@ function FaasDataTable({ props, columns, data, params, reload, loading }) {
|
|
|
1586
1470
|
}
|
|
1587
1471
|
});
|
|
1588
1472
|
}
|
|
1589
|
-
|
|
1590
1473
|
//#endregion
|
|
1591
1474
|
//#region src/Tabs.tsx
|
|
1592
1475
|
/**
|
|
@@ -1624,7 +1507,6 @@ function Tabs(props) {
|
|
|
1624
1507
|
}))
|
|
1625
1508
|
});
|
|
1626
1509
|
}
|
|
1627
|
-
|
|
1628
1510
|
//#endregion
|
|
1629
1511
|
//#region src/Title.tsx
|
|
1630
1512
|
/**
|
|
@@ -1663,7 +1545,6 @@ function Title(props) {
|
|
|
1663
1545
|
if (props.children) return cloneElement(props.children, { title: props.title });
|
|
1664
1546
|
return null;
|
|
1665
1547
|
}
|
|
1666
|
-
|
|
1667
1548
|
//#endregion
|
|
1668
1549
|
//#region src/useThemeToken.ts
|
|
1669
1550
|
/**
|
|
@@ -1677,6 +1558,5 @@ function Title(props) {
|
|
|
1677
1558
|
function useThemeToken() {
|
|
1678
1559
|
return theme.useToken().token;
|
|
1679
1560
|
}
|
|
1680
|
-
|
|
1681
1561
|
//#endregion
|
|
1682
|
-
export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, FaasReactClient, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, cloneUnionFaasItemElement, faas, idToTitle, lazy, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|
|
1562
|
+
export { App, Blank, ConfigContext, ConfigProvider, Description, Drawer, ErrorBoundary, FaasDataWrapper, FaasReactClient, Form, FormItem, Link, Loading, Modal, PageNotFound, Routes, Table, Tabs, Title, cloneUnionFaasItemElement, faas, idToTitle, lazy, transferOptions, transferValue, useApp, useConfigContext, useDrawer, useFaas, useModal, useThemeToken, withFaasData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.14",
|
|
4
4
|
"homepage": "https://faasjs.com/doc/ant-design",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/faasjs/faasjs/issues"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@ant-design/icons": "*",
|
|
34
|
-
"@faasjs/react": ">=8.0.0-beta.
|
|
34
|
+
"@faasjs/react": ">=8.0.0-beta.14",
|
|
35
35
|
"@types/lodash-es": "*",
|
|
36
36
|
"@types/react": "^19.0.0",
|
|
37
37
|
"@types/react-dom": "^19.0.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@ant-design/icons": "*",
|
|
46
|
-
"@faasjs/react": ">=8.0.0-beta.
|
|
46
|
+
"@faasjs/react": ">=8.0.0-beta.14",
|
|
47
47
|
"antd": "^6.0.0",
|
|
48
48
|
"lodash-es": "*",
|
|
49
49
|
"react": "^19.0.0",
|