@faasjs/ant-design 0.0.4-beta.8 → 0.0.5-beta.1
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 +61 -54
- package/dist/index.d.mts +70 -57
- package/dist/index.d.ts +70 -57
- package/dist/index.js +353 -340
- package/dist/index.mjs +356 -343
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -55,57 +55,28 @@ function useDrawer(init) {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
message: {},
|
|
60
|
-
notification: {},
|
|
61
|
-
setModalProps: () => void 0,
|
|
62
|
-
setDrawerProps: () => void 0
|
|
63
|
-
});
|
|
64
|
-
function RoutesApp(props) {
|
|
65
|
-
const location = reactRouterDom.useLocation();
|
|
66
|
-
const { setDrawerProps, setModalProps } = useApp();
|
|
67
|
-
react$1.useEffect(() => {
|
|
68
|
-
console.debug("location", location);
|
|
69
|
-
setDrawerProps({ open: false });
|
|
70
|
-
setModalProps({ open: false });
|
|
71
|
-
}, [location]);
|
|
72
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
73
|
-
}
|
|
74
|
-
function App(props) {
|
|
75
|
-
const [messageApi, messageContextHolder] = antd.message.useMessage();
|
|
76
|
-
const [notificationApi, notificationContextHolder] = antd.notification.useNotification();
|
|
77
|
-
const { modal, setModalProps } = useModal();
|
|
78
|
-
const { drawer, setDrawerProps } = useDrawer();
|
|
79
|
-
const memoizedContextValue = react$1.useMemo(
|
|
80
|
-
() => ({
|
|
81
|
-
message: messageApi,
|
|
82
|
-
notification: notificationApi,
|
|
83
|
-
setModalProps,
|
|
84
|
-
setDrawerProps
|
|
85
|
-
}),
|
|
86
|
-
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
87
|
-
);
|
|
58
|
+
function ErrorChildren(props) {
|
|
88
59
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
-
|
|
60
|
+
antd.Alert,
|
|
90
61
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
62
|
+
type: "error",
|
|
63
|
+
message: props.errorMessage,
|
|
64
|
+
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
"pre",
|
|
66
|
+
{
|
|
67
|
+
style: {
|
|
68
|
+
fontSize: "0.9em",
|
|
69
|
+
overflowX: "auto"
|
|
70
|
+
},
|
|
71
|
+
children: props.errorDescription
|
|
72
|
+
}
|
|
73
|
+
)
|
|
102
74
|
}
|
|
103
75
|
);
|
|
104
76
|
}
|
|
105
|
-
function
|
|
106
|
-
return react
|
|
77
|
+
function ErrorBoundary(props) {
|
|
78
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
107
79
|
}
|
|
108
|
-
App.useApp = useApp;
|
|
109
80
|
var isZH = /^zh/i.test(navigator.language);
|
|
110
81
|
var zh = {
|
|
111
82
|
lang: "zh",
|
|
@@ -132,8 +103,7 @@ var en = {
|
|
|
132
103
|
reset: "Reset"
|
|
133
104
|
};
|
|
134
105
|
var common = isZH ? zh : en;
|
|
135
|
-
var
|
|
136
|
-
antd: {},
|
|
106
|
+
var baseTheme = {
|
|
137
107
|
lang: "en",
|
|
138
108
|
common,
|
|
139
109
|
Blank: { text: common.blank },
|
|
@@ -144,37 +114,92 @@ var baseConfig = {
|
|
|
144
114
|
},
|
|
145
115
|
Link: { style: {} }
|
|
146
116
|
};
|
|
147
|
-
var ConfigContext = react$1.createContext(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const [values, setValues] = react$1.useState(baseConfig);
|
|
117
|
+
var ConfigContext = react$1.createContext({
|
|
118
|
+
theme: baseTheme
|
|
119
|
+
});
|
|
120
|
+
function ConfigProvider(props) {
|
|
121
|
+
const [theme, setTheme] = react$1.useState();
|
|
153
122
|
react$1.useEffect(() => {
|
|
154
|
-
|
|
155
|
-
|
|
123
|
+
var _a;
|
|
124
|
+
if (((_a = props.theme) == null ? void 0 : _a.lang) === "zh") {
|
|
125
|
+
setTheme(
|
|
156
126
|
lodashEs.defaultsDeep(
|
|
157
|
-
|
|
127
|
+
props.theme,
|
|
158
128
|
{
|
|
159
129
|
lang: "zh",
|
|
160
130
|
common: zh,
|
|
161
131
|
Blank: { text: zh.blank },
|
|
162
132
|
Form: { submit: { text: zh.submit } }
|
|
163
133
|
},
|
|
164
|
-
|
|
134
|
+
baseTheme
|
|
165
135
|
)
|
|
166
136
|
);
|
|
167
137
|
} else
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
138
|
+
setTheme(lodashEs.defaultsDeep(props.theme, baseTheme));
|
|
139
|
+
if (props.faasClientOptions)
|
|
140
|
+
react.FaasReactClient(props.faasClientOptions);
|
|
141
|
+
}, [JSON.stringify(props.theme)]);
|
|
142
|
+
if (!theme)
|
|
143
|
+
return null;
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ConfigContext.Provider, { value: { theme }, children: props.children });
|
|
171
145
|
}
|
|
172
146
|
function useConfigContext() {
|
|
173
147
|
return react$1.useContext(ConfigContext);
|
|
174
148
|
}
|
|
149
|
+
var AppContext = react$1.createContext({
|
|
150
|
+
message: {},
|
|
151
|
+
notification: {},
|
|
152
|
+
setModalProps: () => void 0,
|
|
153
|
+
setDrawerProps: () => void 0
|
|
154
|
+
});
|
|
155
|
+
function RoutesApp(props) {
|
|
156
|
+
const location = reactRouterDom.useLocation();
|
|
157
|
+
const { setDrawerProps, setModalProps } = useApp();
|
|
158
|
+
react$1.useEffect(() => {
|
|
159
|
+
console.debug("location", location);
|
|
160
|
+
setDrawerProps({ open: false });
|
|
161
|
+
setModalProps({ open: false });
|
|
162
|
+
}, [location]);
|
|
163
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
164
|
+
}
|
|
165
|
+
function App(props) {
|
|
166
|
+
const [messageApi, messageContextHolder] = antd.message.useMessage();
|
|
167
|
+
const [notificationApi, notificationContextHolder] = antd.notification.useNotification();
|
|
168
|
+
const { modal, setModalProps } = useModal();
|
|
169
|
+
const { drawer, setDrawerProps } = useDrawer();
|
|
170
|
+
const memoizedContextValue = react$1.useMemo(
|
|
171
|
+
() => ({
|
|
172
|
+
message: messageApi,
|
|
173
|
+
notification: notificationApi,
|
|
174
|
+
setModalProps,
|
|
175
|
+
setDrawerProps
|
|
176
|
+
}),
|
|
177
|
+
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
178
|
+
);
|
|
179
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
+
cssinjs.StyleProvider,
|
|
181
|
+
{
|
|
182
|
+
...Object.assign(props.styleProviderProps || {}, {
|
|
183
|
+
hashPriority: "high",
|
|
184
|
+
transformers: [cssinjs.legacyLogicalPropertiesTransformer]
|
|
185
|
+
}),
|
|
186
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { ...props.configProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(ConfigProvider, { ...props.faasConfigProviderProps, children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { ...props.errorBoundaryProps, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.BrowserRouter, { ...props.browserRouterProps, children: [
|
|
187
|
+
messageContextHolder,
|
|
188
|
+
notificationContextHolder,
|
|
189
|
+
modal,
|
|
190
|
+
drawer,
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx(RoutesApp, { children: props.children })
|
|
192
|
+
] }) }) }) }) })
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
function useApp() {
|
|
197
|
+
return react$1.useContext(AppContext);
|
|
198
|
+
}
|
|
199
|
+
App.useApp = useApp;
|
|
175
200
|
function Blank(options) {
|
|
176
|
-
const {
|
|
177
|
-
return !options || lodashEs.isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) ||
|
|
201
|
+
const { theme } = useConfigContext();
|
|
202
|
+
return !options || lodashEs.isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || theme.Blank.text }) : options.value;
|
|
178
203
|
}
|
|
179
204
|
function transferOptions(options) {
|
|
180
205
|
if (!options)
|
|
@@ -256,7 +281,7 @@ function DescriptionItemContent(props) {
|
|
|
256
281
|
}, [props]);
|
|
257
282
|
if (!computedProps)
|
|
258
283
|
return null;
|
|
259
|
-
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type])
|
|
284
|
+
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type]) {
|
|
260
285
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
261
286
|
return react$1.cloneElement(
|
|
262
287
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
@@ -266,15 +291,15 @@ function DescriptionItemContent(props) {
|
|
|
266
291
|
values: computedProps.values
|
|
267
292
|
}
|
|
268
293
|
);
|
|
269
|
-
|
|
294
|
+
if (computedProps.extendTypes[computedProps.item.type].render)
|
|
270
295
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
271
296
|
computedProps.value,
|
|
272
297
|
computedProps.values,
|
|
273
298
|
0,
|
|
274
299
|
"description"
|
|
275
300
|
) });
|
|
276
|
-
|
|
277
|
-
|
|
301
|
+
throw Error(`${computedProps.item.type} requires children or render`);
|
|
302
|
+
}
|
|
278
303
|
if (computedProps.item.descriptionChildren === null)
|
|
279
304
|
return null;
|
|
280
305
|
if (computedProps.item.descriptionChildren)
|
|
@@ -396,28 +421,6 @@ function Description(props) {
|
|
|
396
421
|
}
|
|
397
422
|
);
|
|
398
423
|
}
|
|
399
|
-
function ErrorChildren(props) {
|
|
400
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
401
|
-
antd.Alert,
|
|
402
|
-
{
|
|
403
|
-
type: "error",
|
|
404
|
-
message: props.errorMessage,
|
|
405
|
-
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
406
|
-
"pre",
|
|
407
|
-
{
|
|
408
|
-
style: {
|
|
409
|
-
fontSize: "0.9em",
|
|
410
|
-
overflowX: "auto"
|
|
411
|
-
},
|
|
412
|
-
children: props.errorDescription
|
|
413
|
-
}
|
|
414
|
-
)
|
|
415
|
-
}
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
function ErrorBoundary(props) {
|
|
419
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
420
|
-
}
|
|
421
424
|
function processProps(propsCopy, config) {
|
|
422
425
|
if (!propsCopy.title)
|
|
423
426
|
propsCopy.title = lodashEs.upperFirst(propsCopy.id);
|
|
@@ -472,7 +475,7 @@ function FormItem(props) {
|
|
|
472
475
|
var _a;
|
|
473
476
|
const [computedProps, setComputedProps] = react$1.useState();
|
|
474
477
|
const [extendTypes, setExtendTypes] = react$1.useState();
|
|
475
|
-
const {
|
|
478
|
+
const { theme } = useConfigContext();
|
|
476
479
|
const [hidden, setHidden] = react$1.useState(props.hidden || false);
|
|
477
480
|
react$1.useEffect(() => {
|
|
478
481
|
const propsCopy = { ...props };
|
|
@@ -493,7 +496,7 @@ function FormItem(props) {
|
|
|
493
496
|
delete propsCopy.if;
|
|
494
497
|
delete propsCopy.hidden;
|
|
495
498
|
}
|
|
496
|
-
setComputedProps(processProps(propsCopy,
|
|
499
|
+
setComputedProps(processProps(propsCopy, theme.common));
|
|
497
500
|
}, [props]);
|
|
498
501
|
if (!computedProps)
|
|
499
502
|
return null;
|
|
@@ -673,7 +676,7 @@ function FormItem(props) {
|
|
|
673
676
|
danger: true,
|
|
674
677
|
type: "link",
|
|
675
678
|
onClick: () => remove(field.name),
|
|
676
|
-
children:
|
|
679
|
+
children: theme.common.delete
|
|
677
680
|
}
|
|
678
681
|
)
|
|
679
682
|
] }) }),
|
|
@@ -688,7 +691,7 @@ function FormItem(props) {
|
|
|
688
691
|
onClick: () => add(),
|
|
689
692
|
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
|
|
690
693
|
children: [
|
|
691
|
-
|
|
694
|
+
theme.common.add,
|
|
692
695
|
" ",
|
|
693
696
|
computedProps.label
|
|
694
697
|
]
|
|
@@ -829,7 +832,7 @@ function Form(props) {
|
|
|
829
832
|
)
|
|
830
833
|
),
|
|
831
834
|
computedProps.children,
|
|
832
|
-
computedProps.submit !== false && /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { htmlType: "submit", type: "primary", loading, children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text }),
|
|
835
|
+
computedProps.submit !== false && /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { htmlType: "submit", type: "primary", loading, children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.theme.Form.submit.text }),
|
|
833
836
|
computedProps.footer
|
|
834
837
|
] });
|
|
835
838
|
}
|
|
@@ -841,11 +844,11 @@ Form.List = antd.Form.List;
|
|
|
841
844
|
Form.ErrorList = antd.Form.ErrorList;
|
|
842
845
|
Form.Provider = antd.Form.Provider;
|
|
843
846
|
function Link(props) {
|
|
844
|
-
var _a, _b;
|
|
845
|
-
const {
|
|
847
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
848
|
+
const { theme } = useConfigContext();
|
|
846
849
|
const navigate = reactRouterDom.useNavigate();
|
|
847
850
|
let computedStyle = {
|
|
848
|
-
...
|
|
851
|
+
...theme.Link.style || {},
|
|
849
852
|
cursor: "pointer",
|
|
850
853
|
...props.style
|
|
851
854
|
};
|
|
@@ -863,11 +866,11 @@ function Link(props) {
|
|
|
863
866
|
antd.Button,
|
|
864
867
|
{
|
|
865
868
|
...props.button,
|
|
866
|
-
target: props.target || (
|
|
869
|
+
target: props.target || ((_a = theme.Link) == null ? void 0 : _a.target) || "_blank",
|
|
867
870
|
style: computedStyle,
|
|
868
871
|
href: props.href,
|
|
869
872
|
onClick: props.onClick,
|
|
870
|
-
children: (
|
|
873
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
871
874
|
}
|
|
872
875
|
);
|
|
873
876
|
if (props.children)
|
|
@@ -877,7 +880,7 @@ function Link(props) {
|
|
|
877
880
|
"a",
|
|
878
881
|
{
|
|
879
882
|
href: props.href,
|
|
880
|
-
target: props.target || (
|
|
883
|
+
target: props.target || ((_c = theme.Link) == null ? void 0 : _c.target),
|
|
881
884
|
style: computedStyle,
|
|
882
885
|
onClick: props.onClick,
|
|
883
886
|
children: props.children
|
|
@@ -888,7 +891,7 @@ function Link(props) {
|
|
|
888
891
|
antd.Typography.Link,
|
|
889
892
|
{
|
|
890
893
|
href: props.href,
|
|
891
|
-
target: props.target || (
|
|
894
|
+
target: props.target || ((_d = theme.Link) == null ? void 0 : _d.target) || "_blank",
|
|
892
895
|
style: computedStyle,
|
|
893
896
|
copyable: props.copyable,
|
|
894
897
|
onClick: props.onClick,
|
|
@@ -902,8 +905,11 @@ function Link(props) {
|
|
|
902
905
|
{
|
|
903
906
|
...props.button,
|
|
904
907
|
style: computedStyle,
|
|
905
|
-
onClick: (e) =>
|
|
906
|
-
|
|
908
|
+
onClick: (e) => {
|
|
909
|
+
var _a2;
|
|
910
|
+
return props.onClick ? props.onClick(e) : (props.target || ((_a2 = theme.Link) == null ? void 0 : _a2.target)) === "_blank" ? window.open(props.href) : navigate(props.href);
|
|
911
|
+
},
|
|
912
|
+
children: (_e = props.text) != null ? _e : props.children
|
|
907
913
|
}
|
|
908
914
|
);
|
|
909
915
|
if (props.children)
|
|
@@ -911,7 +917,7 @@ function Link(props) {
|
|
|
911
917
|
reactRouterDom.Link,
|
|
912
918
|
{
|
|
913
919
|
to: props.href,
|
|
914
|
-
target: props.target || (
|
|
920
|
+
target: props.target || ((_f = theme.Link) == null ? void 0 : _f.target),
|
|
915
921
|
style: computedStyle,
|
|
916
922
|
onClick: props.onClick,
|
|
917
923
|
children: props.children
|
|
@@ -921,15 +927,16 @@ function Link(props) {
|
|
|
921
927
|
antd.Typography.Link,
|
|
922
928
|
{
|
|
923
929
|
href: props.href,
|
|
924
|
-
target: props.target || (
|
|
930
|
+
target: props.target || ((_g = theme.Link) == null ? void 0 : _g.target),
|
|
925
931
|
style: computedStyle,
|
|
926
932
|
copyable: props.copyable,
|
|
927
933
|
onClick: (e) => {
|
|
934
|
+
var _a2;
|
|
928
935
|
if (props.onClick) {
|
|
929
936
|
props.onClick(e);
|
|
930
937
|
return;
|
|
931
938
|
}
|
|
932
|
-
if ((props.target || (
|
|
939
|
+
if ((props.target || ((_a2 = theme.Link) == null ? void 0 : _a2.target)) !== "_blank") {
|
|
933
940
|
e.preventDefault();
|
|
934
941
|
navigate(props.href);
|
|
935
942
|
}
|
|
@@ -939,8 +946,8 @@ function Link(props) {
|
|
|
939
946
|
);
|
|
940
947
|
}
|
|
941
948
|
function PageNotFound() {
|
|
942
|
-
const
|
|
943
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "404", title:
|
|
949
|
+
const { theme } = useConfigContext();
|
|
950
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "404", title: theme.common.pageNotFound });
|
|
944
951
|
}
|
|
945
952
|
function Routes(props) {
|
|
946
953
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
@@ -987,9 +994,9 @@ function processValue(item, value) {
|
|
|
987
994
|
}
|
|
988
995
|
function Table(props) {
|
|
989
996
|
const [columns, setColumns] = react$1.useState();
|
|
990
|
-
const {
|
|
997
|
+
const { theme } = useConfigContext();
|
|
991
998
|
const generateFilterDropdown = (item) => {
|
|
992
|
-
if (
|
|
999
|
+
if (item.filterDropdown && item.filterDropdown !== true)
|
|
993
1000
|
return;
|
|
994
1001
|
if (item.options.length < 11) {
|
|
995
1002
|
if (!item.filters)
|
|
@@ -1014,7 +1021,7 @@ function Table(props) {
|
|
|
1014
1021
|
allowClear: true,
|
|
1015
1022
|
showSearch: true,
|
|
1016
1023
|
style: { width: "100%" },
|
|
1017
|
-
placeholder: `${
|
|
1024
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1018
1025
|
value: selectedKeys,
|
|
1019
1026
|
onChange: (v) => {
|
|
1020
1027
|
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
@@ -1088,146 +1095,146 @@ function Table(props) {
|
|
|
1088
1095
|
case "string":
|
|
1089
1096
|
if (!item.render)
|
|
1090
1097
|
item.render = (value) => processValue(item, value);
|
|
1091
|
-
if (
|
|
1092
|
-
item.onFilter
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1098
|
+
if (item.filterDropdown !== false) {
|
|
1099
|
+
if (!item.onFilter)
|
|
1100
|
+
item.onFilter = (value, row) => {
|
|
1101
|
+
if (!value || lodashEs.isNil(value))
|
|
1102
|
+
return true;
|
|
1103
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1104
|
+
return false;
|
|
1105
|
+
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1106
|
+
};
|
|
1107
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
|
|
1108
|
+
item.filterDropdown = ({
|
|
1109
|
+
setSelectedKeys,
|
|
1110
|
+
confirm,
|
|
1111
|
+
clearFilters
|
|
1112
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
|
+
antd.Input.Search,
|
|
1114
|
+
{
|
|
1115
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1116
|
+
allowClear: true,
|
|
1117
|
+
onSearch: (v) => {
|
|
1118
|
+
if (v) {
|
|
1119
|
+
setSelectedKeys([v]);
|
|
1120
|
+
} else {
|
|
1121
|
+
setSelectedKeys([]);
|
|
1122
|
+
clearFilters();
|
|
1123
|
+
}
|
|
1124
|
+
confirm();
|
|
1117
1125
|
}
|
|
1118
|
-
confirm();
|
|
1119
1126
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1122
1129
|
break;
|
|
1123
1130
|
case "string[]":
|
|
1124
1131
|
if (!item.render)
|
|
1125
1132
|
item.render = (value) => processValue(item, value);
|
|
1126
|
-
if (
|
|
1127
|
-
item.onFilter
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1133
|
+
if (item.filterDropdown !== false) {
|
|
1134
|
+
if (!item.onFilter)
|
|
1135
|
+
item.onFilter = (value, row) => {
|
|
1136
|
+
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
1137
|
+
return true;
|
|
1138
|
+
if (!row[item.id] || !row[item.id].length || !value)
|
|
1139
|
+
return false;
|
|
1140
|
+
return row[item.id].some(
|
|
1141
|
+
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1142
|
+
);
|
|
1143
|
+
};
|
|
1144
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters && item.optionsType !== "auto")
|
|
1145
|
+
item.filterDropdown = ({
|
|
1146
|
+
setSelectedKeys,
|
|
1147
|
+
confirm,
|
|
1148
|
+
clearFilters
|
|
1149
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1150
|
+
antd.Input.Search,
|
|
1151
|
+
{
|
|
1152
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1153
|
+
allowClear: true,
|
|
1154
|
+
onSearch: (v) => {
|
|
1155
|
+
if (v) {
|
|
1156
|
+
setSelectedKeys([v]);
|
|
1157
|
+
} else {
|
|
1158
|
+
setSelectedKeys([]);
|
|
1159
|
+
clearFilters();
|
|
1160
|
+
}
|
|
1161
|
+
confirm();
|
|
1154
1162
|
}
|
|
1155
|
-
confirm();
|
|
1156
1163
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1159
1166
|
break;
|
|
1160
1167
|
case "number":
|
|
1161
1168
|
if (!item.render)
|
|
1162
1169
|
item.render = (value) => processValue(item, value);
|
|
1163
|
-
if (
|
|
1170
|
+
if (typeof item.sorter === "undefined")
|
|
1164
1171
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1165
|
-
if (
|
|
1166
|
-
item.onFilter
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1172
|
+
if (item.filterDropdown !== false) {
|
|
1173
|
+
if (!item.onFilter)
|
|
1174
|
+
item.onFilter = (value, row) => {
|
|
1175
|
+
if (value === null)
|
|
1176
|
+
return true;
|
|
1177
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1178
|
+
return false;
|
|
1179
|
+
return value == row[item.id];
|
|
1180
|
+
};
|
|
1181
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters)
|
|
1182
|
+
item.filterDropdown = ({
|
|
1183
|
+
setSelectedKeys,
|
|
1184
|
+
confirm,
|
|
1185
|
+
clearFilters
|
|
1186
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1187
|
+
antd.Input.Search,
|
|
1188
|
+
{
|
|
1189
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1190
|
+
allowClear: true,
|
|
1191
|
+
onSearch: (v) => {
|
|
1192
|
+
if (v) {
|
|
1193
|
+
setSelectedKeys([Number(v)]);
|
|
1194
|
+
} else {
|
|
1195
|
+
setSelectedKeys([]);
|
|
1196
|
+
clearFilters();
|
|
1197
|
+
}
|
|
1198
|
+
confirm();
|
|
1191
1199
|
}
|
|
1192
|
-
confirm();
|
|
1193
1200
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1196
1203
|
break;
|
|
1197
1204
|
case "number[]":
|
|
1198
1205
|
if (!item.render)
|
|
1199
1206
|
item.render = (value) => processValue(item, value).join(", ");
|
|
1200
|
-
if (
|
|
1201
|
-
item.onFilter
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1207
|
+
if (item.filterDropdown !== false) {
|
|
1208
|
+
if (!item.onFilter)
|
|
1209
|
+
item.onFilter = (value, row) => {
|
|
1210
|
+
if (value === null && (!row[item.id] || !row[item.id].length))
|
|
1211
|
+
return true;
|
|
1212
|
+
if (!row[item.id] || !row[item.id].length)
|
|
1213
|
+
return false;
|
|
1214
|
+
return row[item.id].includes(Number(value));
|
|
1215
|
+
};
|
|
1216
|
+
if (typeof item.filterDropdown === "undefined" && !item.filters)
|
|
1217
|
+
item.filterDropdown = ({
|
|
1218
|
+
setSelectedKeys,
|
|
1219
|
+
confirm,
|
|
1220
|
+
clearFilters
|
|
1221
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1222
|
+
antd.Input.Search,
|
|
1223
|
+
{
|
|
1224
|
+
placeholder: `${theme.common.search} ${item.title}`,
|
|
1225
|
+
allowClear: true,
|
|
1226
|
+
onSearch: (v) => {
|
|
1227
|
+
if (v) {
|
|
1228
|
+
setSelectedKeys([Number(v)]);
|
|
1229
|
+
} else {
|
|
1230
|
+
setSelectedKeys([]);
|
|
1231
|
+
clearFilters();
|
|
1232
|
+
}
|
|
1233
|
+
confirm();
|
|
1226
1234
|
}
|
|
1227
|
-
confirm();
|
|
1228
1235
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1236
|
+
);
|
|
1237
|
+
}
|
|
1231
1238
|
break;
|
|
1232
1239
|
case "boolean":
|
|
1233
1240
|
if (!item.render)
|
|
@@ -1248,68 +1255,70 @@ function Table(props) {
|
|
|
1248
1255
|
}
|
|
1249
1256
|
}
|
|
1250
1257
|
);
|
|
1251
|
-
if (item.filterDropdown !== false)
|
|
1252
|
-
item.filterDropdown
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1258
|
+
if (item.filterDropdown !== false) {
|
|
1259
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1260
|
+
item.filterDropdown = ({
|
|
1261
|
+
setSelectedKeys,
|
|
1262
|
+
selectedKeys,
|
|
1263
|
+
confirm
|
|
1264
|
+
}) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1265
|
+
antd.Radio.Group,
|
|
1266
|
+
{
|
|
1267
|
+
style: { padding: 8 },
|
|
1268
|
+
buttonStyle: "solid",
|
|
1269
|
+
value: JSON.stringify(selectedKeys[0]),
|
|
1270
|
+
onChange: (e) => {
|
|
1271
|
+
const Values = {
|
|
1272
|
+
true: true,
|
|
1273
|
+
false: false,
|
|
1274
|
+
null: null
|
|
1275
|
+
};
|
|
1276
|
+
setSelectedKeys(
|
|
1277
|
+
e.target.value ? [Values[e.target.value]] : []
|
|
1278
|
+
);
|
|
1279
|
+
confirm();
|
|
1280
|
+
},
|
|
1281
|
+
children: [
|
|
1282
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { children: theme.common.all }),
|
|
1283
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1284
|
+
icons.CheckOutlined,
|
|
1285
|
+
{
|
|
1286
|
+
style: {
|
|
1287
|
+
color: "#52c41a",
|
|
1288
|
+
verticalAlign: "middle"
|
|
1289
|
+
}
|
|
1281
1290
|
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1291
|
+
) }),
|
|
1292
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "false", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1293
|
+
icons.CloseOutlined,
|
|
1294
|
+
{
|
|
1295
|
+
style: {
|
|
1296
|
+
verticalAlign: "middle",
|
|
1297
|
+
color: "#ff4d4f"
|
|
1298
|
+
}
|
|
1290
1299
|
}
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
)
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1300
|
+
) }),
|
|
1301
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "null", children: theme.common.blank })
|
|
1302
|
+
]
|
|
1303
|
+
}
|
|
1304
|
+
);
|
|
1305
|
+
if (!item.onFilter)
|
|
1306
|
+
item.onFilter = (value, row) => {
|
|
1307
|
+
switch (value) {
|
|
1308
|
+
case true:
|
|
1309
|
+
return !lodashEs.isNil(row[item.id]) && row[item.id] !== false;
|
|
1310
|
+
case false:
|
|
1311
|
+
return !lodashEs.isNil(row[item.id]) && !row[item.id];
|
|
1312
|
+
default:
|
|
1313
|
+
return lodashEs.isNil(row[item.id]);
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1308
1317
|
break;
|
|
1309
1318
|
case "date":
|
|
1310
1319
|
if (!item.render)
|
|
1311
1320
|
item.render = (value) => processValue(item, value);
|
|
1312
|
-
if (
|
|
1321
|
+
if (typeof item.sorter === "undefined")
|
|
1313
1322
|
item.sorter = (a, b, order) => {
|
|
1314
1323
|
if (lodashEs.isNil(a[item.id]))
|
|
1315
1324
|
return order === "ascend" ? 1 : -1;
|
|
@@ -1317,36 +1326,38 @@ function Table(props) {
|
|
|
1317
1326
|
return order === "ascend" ? -1 : 1;
|
|
1318
1327
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1319
1328
|
};
|
|
1320
|
-
if (
|
|
1321
|
-
item.filterDropdown
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
(
|
|
1327
|
-
[
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1329
|
+
if (item.filterDropdown !== false) {
|
|
1330
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1331
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1332
|
+
antd.DatePicker.RangePicker,
|
|
1333
|
+
{
|
|
1334
|
+
onChange: (dates) => {
|
|
1335
|
+
setSelectedKeys(
|
|
1336
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1337
|
+
[
|
|
1338
|
+
dates[0].startOf("day").toISOString(),
|
|
1339
|
+
dates[1].endOf("day").toISOString()
|
|
1340
|
+
]
|
|
1341
|
+
] : []
|
|
1342
|
+
);
|
|
1343
|
+
confirm();
|
|
1344
|
+
}
|
|
1334
1345
|
}
|
|
1335
|
-
|
|
1336
|
-
)
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
return
|
|
1343
|
-
|
|
1344
|
-
|
|
1346
|
+
);
|
|
1347
|
+
if (!item.onFilter)
|
|
1348
|
+
item.onFilter = (value, row) => {
|
|
1349
|
+
if (lodashEs.isNil(value[0]))
|
|
1350
|
+
return true;
|
|
1351
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1352
|
+
return false;
|
|
1353
|
+
return dayjs2__default.default(row[item.id]) >= dayjs2__default.default(value[0]) && dayjs2__default.default(row[item.id]) <= dayjs2__default.default(value[1]);
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1345
1356
|
break;
|
|
1346
1357
|
case "time":
|
|
1347
1358
|
if (!item.render)
|
|
1348
1359
|
item.render = (value) => processValue(item, value);
|
|
1349
|
-
if (
|
|
1360
|
+
if (typeof item.sorter === "undefined")
|
|
1350
1361
|
item.sorter = (a, b, order) => {
|
|
1351
1362
|
if (lodashEs.isNil(a[item.id]))
|
|
1352
1363
|
return order === "ascend" ? 1 : -1;
|
|
@@ -1354,31 +1365,33 @@ function Table(props) {
|
|
|
1354
1365
|
return order === "ascend" ? -1 : 1;
|
|
1355
1366
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1356
1367
|
};
|
|
1357
|
-
if (
|
|
1358
|
-
item.filterDropdown
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
(
|
|
1364
|
-
[
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1368
|
+
if (item.filterDropdown !== false) {
|
|
1369
|
+
if (typeof item.filterDropdown === "undefined")
|
|
1370
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1371
|
+
antd.DatePicker.RangePicker,
|
|
1372
|
+
{
|
|
1373
|
+
onChange: (dates) => {
|
|
1374
|
+
setSelectedKeys(
|
|
1375
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1376
|
+
[
|
|
1377
|
+
dates[0].startOf("day").toISOString(),
|
|
1378
|
+
dates[1].endOf("day").toISOString()
|
|
1379
|
+
]
|
|
1380
|
+
] : []
|
|
1381
|
+
);
|
|
1382
|
+
confirm();
|
|
1383
|
+
}
|
|
1371
1384
|
}
|
|
1372
|
-
|
|
1373
|
-
)
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
return
|
|
1380
|
-
|
|
1381
|
-
|
|
1385
|
+
);
|
|
1386
|
+
if (!item.onFilter)
|
|
1387
|
+
item.onFilter = (value, row) => {
|
|
1388
|
+
if (lodashEs.isNil(value[0]))
|
|
1389
|
+
return true;
|
|
1390
|
+
if (lodashEs.isNil(row[item.id]))
|
|
1391
|
+
return false;
|
|
1392
|
+
return dayjs2__default.default(row[item.id]) >= dayjs2__default.default(value[0]) && dayjs2__default.default(row[item.id]) <= dayjs2__default.default(value[1]);
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1382
1395
|
break;
|
|
1383
1396
|
case "object":
|
|
1384
1397
|
if (!item.render)
|
|
@@ -1406,7 +1419,7 @@ function Table(props) {
|
|
|
1406
1419
|
default:
|
|
1407
1420
|
if (!item.render)
|
|
1408
1421
|
item.render = (value) => processValue(item, value);
|
|
1409
|
-
if (!item.onFilter)
|
|
1422
|
+
if (item.filterDropdown !== false && !item.onFilter)
|
|
1410
1423
|
item.onFilter = (value, row) => {
|
|
1411
1424
|
if (value === null && lodashEs.isNil(row[item.id]))
|
|
1412
1425
|
return true;
|
|
@@ -1467,8 +1480,8 @@ function FaasDataTable({
|
|
|
1467
1480
|
const newColumns = [...prev];
|
|
1468
1481
|
for (const column of newColumns) {
|
|
1469
1482
|
if ((_a = data.options) == null ? void 0 : _a[column.id]) {
|
|
1470
|
-
column.options = data.options[column.id];
|
|
1471
|
-
column.filters =
|
|
1483
|
+
column.options = transferOptions(data.options[column.id]);
|
|
1484
|
+
column.filters = column.options.map((v) => ({
|
|
1472
1485
|
text: v.label,
|
|
1473
1486
|
value: v.value
|
|
1474
1487
|
})).concat({
|
|
@@ -1565,10 +1578,10 @@ function Tabs(props) {
|
|
|
1565
1578
|
);
|
|
1566
1579
|
}
|
|
1567
1580
|
function Title(props) {
|
|
1568
|
-
const {
|
|
1581
|
+
const { theme } = useConfigContext();
|
|
1569
1582
|
react$1.useEffect(() => {
|
|
1570
1583
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1571
|
-
document.title = title.concat(props.suffix ||
|
|
1584
|
+
document.title = title.concat(props.suffix || theme.Title.suffix).filter((t) => !!t).join(props.separator || theme.Title.separator);
|
|
1572
1585
|
}, [props]);
|
|
1573
1586
|
if (props.h1) {
|
|
1574
1587
|
if (typeof props.h1 === "boolean")
|
|
@@ -1605,7 +1618,7 @@ Object.defineProperty(exports, 'lazy', {
|
|
|
1605
1618
|
exports.App = App;
|
|
1606
1619
|
exports.Blank = Blank;
|
|
1607
1620
|
exports.ConfigContext = ConfigContext;
|
|
1608
|
-
exports.ConfigProvider =
|
|
1621
|
+
exports.ConfigProvider = ConfigProvider;
|
|
1609
1622
|
exports.Description = Description;
|
|
1610
1623
|
exports.ErrorBoundary = ErrorBoundary;
|
|
1611
1624
|
exports.FaasDataWrapper = FaasDataWrapper;
|