@faasjs/ant-design 0.0.3-beta.68 → 0.0.3-beta.69
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 +19 -2
- package/dist/index.js +744 -748
- package/dist/index.mjs +722 -723
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
8
25
|
var __export = (target, all) => {
|
|
9
26
|
for (var name in all)
|
|
10
27
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,6 +35,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
35
|
return to;
|
|
19
36
|
};
|
|
20
37
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
42
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
43
|
mod
|
|
23
44
|
));
|
|
@@ -33,7 +54,7 @@ __export(src_exports, {
|
|
|
33
54
|
Description: () => Description,
|
|
34
55
|
Drawer: () => import_antd2.Drawer,
|
|
35
56
|
ErrorBoundary: () => ErrorBoundary,
|
|
36
|
-
FaasDataWrapper: () =>
|
|
57
|
+
FaasDataWrapper: () => FaasDataWrapper2,
|
|
37
58
|
Form: () => Form,
|
|
38
59
|
FormItem: () => FormItem,
|
|
39
60
|
Link: () => Link,
|
|
@@ -42,8 +63,9 @@ __export(src_exports, {
|
|
|
42
63
|
PageNotFound: () => PageNotFound,
|
|
43
64
|
Routes: () => Routes,
|
|
44
65
|
Table: () => Table,
|
|
66
|
+
Tabs: () => Tabs,
|
|
45
67
|
Title: () => Title,
|
|
46
|
-
lazy: () =>
|
|
68
|
+
lazy: () => import_react14.lazy,
|
|
47
69
|
transferOptions: () => transferOptions,
|
|
48
70
|
transferValue: () => transferValue,
|
|
49
71
|
useApp: () => useApp,
|
|
@@ -66,24 +88,17 @@ var import_antd = require("antd");
|
|
|
66
88
|
var import_react2 = require("react");
|
|
67
89
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
68
90
|
function useModal(init) {
|
|
69
|
-
const [props, setProps] = (0, import_react2.useState)({
|
|
91
|
+
const [props, setProps] = (0, import_react2.useState)(__spreadValues({
|
|
70
92
|
open: false,
|
|
71
|
-
onCancel: () => setProps((prev) => ({
|
|
72
|
-
...prev,
|
|
93
|
+
onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
73
94
|
open: false
|
|
74
|
-
}))
|
|
75
|
-
|
|
76
|
-
});
|
|
95
|
+
}))
|
|
96
|
+
}, init));
|
|
77
97
|
return {
|
|
78
|
-
modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Modal, {
|
|
79
|
-
...props
|
|
80
|
-
}),
|
|
98
|
+
modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Modal, __spreadValues({}, props)),
|
|
81
99
|
modalProps: props,
|
|
82
100
|
setModalProps(changes) {
|
|
83
|
-
setProps((prev) => ({
|
|
84
|
-
...prev,
|
|
85
|
-
...changes
|
|
86
|
-
}));
|
|
101
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
87
102
|
}
|
|
88
103
|
};
|
|
89
104
|
}
|
|
@@ -91,33 +106,26 @@ function useModal(init) {
|
|
|
91
106
|
// src/Drawer.tsx
|
|
92
107
|
var import_antd2 = require("antd");
|
|
93
108
|
var import_react3 = require("react");
|
|
94
|
-
var
|
|
109
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
95
110
|
function useDrawer(init) {
|
|
96
|
-
const [props, setProps] = (0, import_react3.useState)({
|
|
111
|
+
const [props, setProps] = (0, import_react3.useState)(__spreadValues({
|
|
97
112
|
open: false,
|
|
98
|
-
onClose: () => setProps((prev) => ({
|
|
99
|
-
...prev,
|
|
113
|
+
onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
100
114
|
open: false
|
|
101
|
-
}))
|
|
102
|
-
|
|
103
|
-
});
|
|
115
|
+
}))
|
|
116
|
+
}, init));
|
|
104
117
|
return {
|
|
105
|
-
drawer: /* @__PURE__ */ (0,
|
|
106
|
-
...props
|
|
107
|
-
}),
|
|
118
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Drawer, __spreadValues({}, props)),
|
|
108
119
|
drawerProps: props,
|
|
109
120
|
setDrawerProps(changes) {
|
|
110
|
-
setProps((prev) => ({
|
|
111
|
-
...prev,
|
|
112
|
-
...changes
|
|
113
|
-
}));
|
|
121
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
114
122
|
}
|
|
115
123
|
};
|
|
116
124
|
}
|
|
117
125
|
|
|
118
126
|
// src/App.tsx
|
|
119
127
|
var import_react_router_dom = require("react-router-dom");
|
|
120
|
-
var
|
|
128
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
121
129
|
var AppContext = (0, import_react4.createContext)({
|
|
122
130
|
message: {},
|
|
123
131
|
notification: {},
|
|
@@ -132,9 +140,7 @@ function RoutesApp(props) {
|
|
|
132
140
|
setDrawerProps({ open: false });
|
|
133
141
|
setModalProps({ open: false });
|
|
134
142
|
}, [location]);
|
|
135
|
-
return /* @__PURE__ */ (0,
|
|
136
|
-
children: props.children
|
|
137
|
-
});
|
|
143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: props.children });
|
|
138
144
|
}
|
|
139
145
|
function App(props) {
|
|
140
146
|
const [messageApi, messageContextHolder] = import_antd3.message.useMessage();
|
|
@@ -155,30 +161,21 @@ function App(props) {
|
|
|
155
161
|
setDrawerProps
|
|
156
162
|
]
|
|
157
163
|
);
|
|
158
|
-
return /* @__PURE__ */ (0,
|
|
159
|
-
|
|
164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
165
|
+
import_cssinjs.StyleProvider,
|
|
166
|
+
__spreadProps(__spreadValues({}, Object.assign(props.styleProviderProps || {}, {
|
|
160
167
|
hashPriority: "high",
|
|
161
168
|
transformers: [import_cssinjs.legacyLogicalPropertiesTransformer]
|
|
162
|
-
}),
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
messageContextHolder,
|
|
171
|
-
notificationContextHolder,
|
|
172
|
-
modal,
|
|
173
|
-
drawer,
|
|
174
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoutesApp, {
|
|
175
|
-
children: props.children
|
|
176
|
-
})
|
|
177
|
-
]
|
|
178
|
-
})
|
|
179
|
-
})
|
|
169
|
+
})), {
|
|
170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.ConfigProvider, __spreadProps(__spreadValues({}, props.configProviderProps), { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_router_dom.BrowserRouter, __spreadProps(__spreadValues({}, props.browserRouterProps), { children: [
|
|
171
|
+
messageContextHolder,
|
|
172
|
+
notificationContextHolder,
|
|
173
|
+
modal,
|
|
174
|
+
drawer,
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(RoutesApp, { children: props.children })
|
|
176
|
+
] })) }) }))
|
|
180
177
|
})
|
|
181
|
-
|
|
178
|
+
);
|
|
182
179
|
}
|
|
183
180
|
function useApp() {
|
|
184
181
|
return (0, import_react4.useContext)(AppContext);
|
|
@@ -192,7 +189,7 @@ var import_lodash_es2 = require("lodash-es");
|
|
|
192
189
|
// src/Config.tsx
|
|
193
190
|
var import_react5 = require("react");
|
|
194
191
|
var import_lodash_es = require("lodash-es");
|
|
195
|
-
var
|
|
192
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
196
193
|
var isZH = /^zh/i.test(navigator.language);
|
|
197
194
|
var zh = {
|
|
198
195
|
lang: "zh",
|
|
@@ -248,23 +245,17 @@ function ConfigProvider2({
|
|
|
248
245
|
} else
|
|
249
246
|
setValues((0, import_lodash_es.defaultsDeep)(config, values));
|
|
250
247
|
}, []);
|
|
251
|
-
return /* @__PURE__ */ (0,
|
|
252
|
-
value: values,
|
|
253
|
-
children
|
|
254
|
-
});
|
|
248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfigContext.Provider, { value: values, children });
|
|
255
249
|
}
|
|
256
250
|
function useConfigContext() {
|
|
257
251
|
return (0, import_react5.useContext)(ConfigContext);
|
|
258
252
|
}
|
|
259
253
|
|
|
260
254
|
// src/Blank.tsx
|
|
261
|
-
var
|
|
255
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
262
256
|
function Blank(options) {
|
|
263
257
|
const { Blank: Blank2 } = useConfigContext();
|
|
264
|
-
return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0,
|
|
265
|
-
disabled: true,
|
|
266
|
-
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
267
|
-
}) : options.value;
|
|
258
|
+
return !options || (0, import_lodash_es2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd4.Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
|
|
268
259
|
}
|
|
269
260
|
|
|
270
261
|
// src/data.ts
|
|
@@ -298,52 +289,63 @@ function transferValue(type, value) {
|
|
|
298
289
|
var import_icons = require("@ant-design/icons");
|
|
299
290
|
var import_antd6 = require("antd");
|
|
300
291
|
var import_lodash_es4 = require("lodash-es");
|
|
301
|
-
var
|
|
292
|
+
var import_react8 = require("react");
|
|
302
293
|
|
|
303
|
-
//
|
|
304
|
-
var import_react6 = require("
|
|
294
|
+
// ../react/dist/index.mjs
|
|
295
|
+
var import_react6 = require("react");
|
|
296
|
+
var clients = {};
|
|
297
|
+
function getClient(domain) {
|
|
298
|
+
const client = clients[domain || Object.keys(clients)[0]];
|
|
299
|
+
if (!client)
|
|
300
|
+
throw Error("FaasReactClient is not initialized");
|
|
301
|
+
return client;
|
|
302
|
+
}
|
|
303
|
+
async function faas(action, params) {
|
|
304
|
+
return getClient().faas(action, params);
|
|
305
|
+
}
|
|
306
|
+
function FaasDataWrapper(props) {
|
|
307
|
+
const [client, setClient] = (0, import_react6.useState)();
|
|
308
|
+
(0, import_react6.useEffect)(() => {
|
|
309
|
+
if (client)
|
|
310
|
+
return;
|
|
311
|
+
setClient(getClient());
|
|
312
|
+
}, []);
|
|
313
|
+
if (!client)
|
|
314
|
+
return props.fallback || null;
|
|
315
|
+
return (0, import_react6.createElement)(client.FaasDataWrapper, props);
|
|
316
|
+
}
|
|
305
317
|
|
|
306
318
|
// src/Loading.tsx
|
|
307
319
|
var import_antd5 = require("antd");
|
|
308
|
-
var
|
|
320
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
309
321
|
function Loading(props) {
|
|
310
322
|
if (props.loading === false)
|
|
311
|
-
return /* @__PURE__ */ (0,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
...props.style || {},
|
|
317
|
-
...!props.size || props.size === "large" ? {
|
|
318
|
-
margin: "20vh auto",
|
|
319
|
-
textAlign: "center"
|
|
320
|
-
} : {}
|
|
321
|
-
},
|
|
322
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Spin, {
|
|
323
|
-
size: props.size || "large"
|
|
324
|
-
})
|
|
325
|
-
});
|
|
323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: props.children });
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: __spreadValues(__spreadValues({}, props.style || {}), !props.size || props.size === "large" ? {
|
|
325
|
+
margin: "20vh auto",
|
|
326
|
+
textAlign: "center"
|
|
327
|
+
} : {}), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Spin, { size: props.size || "large" }) });
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
// src/FaasDataWrapper.tsx
|
|
329
|
-
var
|
|
330
|
-
function
|
|
331
|
-
return /* @__PURE__ */ (0,
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
331
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
332
|
+
function FaasDataWrapper2(props) {
|
|
333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
334
|
+
FaasDataWrapper,
|
|
335
|
+
__spreadValues({
|
|
336
|
+
fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loading, __spreadValues({}, props.loadingProps))
|
|
337
|
+
}, props)
|
|
338
|
+
);
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
// src/Description.tsx
|
|
340
|
-
var
|
|
342
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
341
343
|
function DescriptionItemContent(props) {
|
|
342
344
|
var _a;
|
|
343
|
-
const [computedProps, setComputedProps] = (0,
|
|
344
|
-
(0,
|
|
345
|
+
const [computedProps, setComputedProps] = (0, import_react8.useState)();
|
|
346
|
+
(0, import_react8.useEffect)(() => {
|
|
345
347
|
var _a2, _b;
|
|
346
|
-
const propsCopy = {
|
|
348
|
+
const propsCopy = __spreadValues({}, props);
|
|
347
349
|
if (!propsCopy.item.title)
|
|
348
350
|
propsCopy.item.title = (0, import_lodash_es4.upperFirst)(propsCopy.item.id);
|
|
349
351
|
if (!propsCopy.item.type)
|
|
@@ -371,7 +373,7 @@ function DescriptionItemContent(props) {
|
|
|
371
373
|
return null;
|
|
372
374
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
373
375
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
374
|
-
return (0,
|
|
376
|
+
return (0, import_react8.cloneElement)(
|
|
375
377
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
376
378
|
{
|
|
377
379
|
scene: "description",
|
|
@@ -380,15 +382,13 @@ function DescriptionItemContent(props) {
|
|
|
380
382
|
}
|
|
381
383
|
);
|
|
382
384
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
383
|
-
return /* @__PURE__ */ (0,
|
|
384
|
-
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
385
|
-
});
|
|
385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description") });
|
|
386
386
|
else
|
|
387
387
|
throw Error(computedProps.item.type + " requires children or render");
|
|
388
388
|
if (computedProps.item.descriptionChildren === null)
|
|
389
389
|
return null;
|
|
390
390
|
if (computedProps.item.descriptionChildren)
|
|
391
|
-
return (0,
|
|
391
|
+
return (0, import_react8.cloneElement)(computedProps.item.descriptionChildren, {
|
|
392
392
|
scene: "description",
|
|
393
393
|
value: computedProps.value,
|
|
394
394
|
values: computedProps.values
|
|
@@ -396,119 +396,127 @@ function DescriptionItemContent(props) {
|
|
|
396
396
|
if (computedProps.item.children === null)
|
|
397
397
|
return null;
|
|
398
398
|
if (computedProps.item.children)
|
|
399
|
-
return (0,
|
|
399
|
+
return (0, import_react8.cloneElement)(computedProps.item.children, {
|
|
400
400
|
scene: "description",
|
|
401
401
|
value: computedProps.value,
|
|
402
402
|
values: computedProps.values
|
|
403
403
|
});
|
|
404
404
|
if (computedProps.item.descriptionRender)
|
|
405
|
-
return /* @__PURE__ */ (0,
|
|
406
|
-
children: computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description")
|
|
407
|
-
});
|
|
405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description") });
|
|
408
406
|
if (computedProps.item.render)
|
|
409
|
-
return /* @__PURE__ */ (0,
|
|
410
|
-
children: computedProps.item.render(computedProps.value, computedProps.values, 0, "description")
|
|
411
|
-
});
|
|
407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.item.render(computedProps.value, computedProps.values, 0, "description") });
|
|
412
408
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
413
|
-
return /* @__PURE__ */ (0,
|
|
409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Blank, {});
|
|
414
410
|
switch (computedProps.item.type) {
|
|
415
411
|
case "string[]":
|
|
416
|
-
return /* @__PURE__ */ (0,
|
|
417
|
-
children: computedProps.value.join(", ")
|
|
418
|
-
});
|
|
412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.join(", ") });
|
|
419
413
|
case "number":
|
|
420
414
|
return computedProps.value || null;
|
|
421
415
|
case "number[]":
|
|
422
|
-
return /* @__PURE__ */ (0,
|
|
423
|
-
children: computedProps.value.join(", ")
|
|
424
|
-
});
|
|
416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.join(", ") });
|
|
425
417
|
case "boolean":
|
|
426
|
-
return computedProps.value ? /* @__PURE__ */ (0,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
marginTop: "4px",
|
|
434
|
-
color: "#ff4d4f"
|
|
435
|
-
}
|
|
436
|
-
});
|
|
418
|
+
return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.CheckOutlined, { style: {
|
|
419
|
+
marginTop: "4px",
|
|
420
|
+
color: "#52c41a"
|
|
421
|
+
} }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.CloseOutlined, { style: {
|
|
422
|
+
marginTop: "4px",
|
|
423
|
+
color: "#ff4d4f"
|
|
424
|
+
} });
|
|
437
425
|
case "time":
|
|
438
|
-
return /* @__PURE__ */ (0,
|
|
439
|
-
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
440
|
-
});
|
|
426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
|
|
441
427
|
case "date":
|
|
442
|
-
return /* @__PURE__ */ (0,
|
|
443
|
-
children: computedProps.value.format("YYYY-MM-DD")
|
|
444
|
-
});
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: computedProps.value.format("YYYY-MM-DD") });
|
|
445
429
|
case "object":
|
|
446
430
|
if (!computedProps.value)
|
|
447
|
-
return /* @__PURE__ */ (0,
|
|
448
|
-
return /* @__PURE__ */ (0,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Blank, {});
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
433
|
+
Description,
|
|
434
|
+
{
|
|
435
|
+
items: computedProps.item.object,
|
|
436
|
+
dataSource: computedProps.value,
|
|
437
|
+
column: 1
|
|
438
|
+
}
|
|
439
|
+
);
|
|
453
440
|
case "object[]":
|
|
454
441
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
455
|
-
return /* @__PURE__ */ (0,
|
|
456
|
-
return /* @__PURE__ */ (0,
|
|
457
|
-
|
|
458
|
-
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Blank, {});
|
|
443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd6.Space, { direction: "vertical", children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
444
|
+
Description,
|
|
445
|
+
{
|
|
459
446
|
items: computedProps.item.object,
|
|
460
447
|
dataSource: value,
|
|
461
448
|
column: 1
|
|
462
|
-
},
|
|
463
|
-
|
|
449
|
+
},
|
|
450
|
+
index
|
|
451
|
+
)) });
|
|
464
452
|
default:
|
|
465
453
|
return computedProps.value || null;
|
|
466
454
|
}
|
|
467
455
|
}
|
|
468
456
|
function Description(props) {
|
|
469
457
|
if (props.dataSource)
|
|
470
|
-
return /* @__PURE__ */ (0,
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Descriptions.Item, {
|
|
475
|
-
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
476
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
477
|
-
item,
|
|
478
|
-
value: props.dataSource[item.id],
|
|
479
|
-
values: props.dataSource,
|
|
480
|
-
extendTypes: props.extendTypes
|
|
481
|
-
})
|
|
482
|
-
}, item.id) : null;
|
|
483
|
-
}).filter(Boolean)
|
|
484
|
-
});
|
|
485
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
|
|
486
|
-
render: ({ data }) => {
|
|
487
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Descriptions, {
|
|
488
|
-
...props,
|
|
489
|
-
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
459
|
+
import_antd6.Descriptions,
|
|
460
|
+
__spreadProps(__spreadValues({}, props), {
|
|
461
|
+
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
490
462
|
children: props.items.map((item) => {
|
|
491
|
-
return !item.if || item.if(
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
item,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
463
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
464
|
+
import_antd6.Descriptions.Item,
|
|
465
|
+
{
|
|
466
|
+
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
467
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
468
|
+
DescriptionItemContent,
|
|
469
|
+
{
|
|
470
|
+
item,
|
|
471
|
+
value: props.dataSource[item.id],
|
|
472
|
+
values: props.dataSource,
|
|
473
|
+
extendTypes: props.extendTypes
|
|
474
|
+
}
|
|
475
|
+
)
|
|
476
|
+
},
|
|
477
|
+
item.id
|
|
478
|
+
) : null;
|
|
500
479
|
}).filter(Boolean)
|
|
501
|
-
})
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
480
|
+
})
|
|
481
|
+
);
|
|
482
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
483
|
+
FaasDataWrapper2,
|
|
484
|
+
__spreadValues({
|
|
485
|
+
render: ({ data }) => {
|
|
486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
487
|
+
import_antd6.Descriptions,
|
|
488
|
+
__spreadProps(__spreadValues({}, props), {
|
|
489
|
+
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
490
|
+
children: props.items.map((item) => {
|
|
491
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
492
|
+
import_antd6.Descriptions.Item,
|
|
493
|
+
{
|
|
494
|
+
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
495
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
496
|
+
DescriptionItemContent,
|
|
497
|
+
{
|
|
498
|
+
item,
|
|
499
|
+
value: data[item.id],
|
|
500
|
+
values: data,
|
|
501
|
+
extendTypes: props.extendTypes
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
},
|
|
505
|
+
item.id
|
|
506
|
+
) : null;
|
|
507
|
+
}).filter(Boolean)
|
|
508
|
+
})
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
}, props.faasData)
|
|
512
|
+
);
|
|
505
513
|
}
|
|
506
514
|
|
|
507
515
|
// src/ErrorBoundary.tsx
|
|
508
|
-
var
|
|
516
|
+
var import_react9 = require("react");
|
|
509
517
|
var import_antd7 = require("antd");
|
|
510
|
-
var
|
|
511
|
-
var ErrorBoundary = class extends
|
|
518
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
519
|
+
var ErrorBoundary = class extends import_react9.Component {
|
|
512
520
|
constructor(props) {
|
|
513
521
|
super(props);
|
|
514
522
|
this.state = {
|
|
@@ -535,33 +543,32 @@ var ErrorBoundary = class extends import_react8.Component {
|
|
|
535
543
|
if (error) {
|
|
536
544
|
if (this.props.onError)
|
|
537
545
|
return this.props.onError(error, info);
|
|
538
|
-
return /* @__PURE__ */ (0,
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
547
|
+
import_antd7.Alert,
|
|
548
|
+
{
|
|
549
|
+
type: "error",
|
|
550
|
+
message: errorMessage,
|
|
551
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("pre", { style: {
|
|
543
552
|
fontSize: "0.9em",
|
|
544
553
|
overflowX: "auto"
|
|
545
|
-
},
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
});
|
|
554
|
+
}, children: errorDescription })
|
|
555
|
+
}
|
|
556
|
+
);
|
|
549
557
|
}
|
|
550
558
|
return children;
|
|
551
559
|
}
|
|
552
560
|
};
|
|
553
561
|
|
|
554
562
|
// src/Form.tsx
|
|
555
|
-
var import_react10 = require("@faasjs/react");
|
|
556
563
|
var import_antd9 = require("antd");
|
|
557
|
-
var
|
|
564
|
+
var import_react12 = require("react");
|
|
558
565
|
|
|
559
566
|
// src/FormItem.tsx
|
|
560
567
|
var import_antd8 = require("antd");
|
|
561
568
|
var import_icons2 = require("@ant-design/icons");
|
|
562
|
-
var
|
|
569
|
+
var import_react10 = require("react");
|
|
563
570
|
var import_lodash_es5 = require("lodash-es");
|
|
564
|
-
var
|
|
571
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
565
572
|
function processProps(propsCopy, config) {
|
|
566
573
|
if (!propsCopy.title)
|
|
567
574
|
propsCopy.title = (0, import_lodash_es5.upperFirst)(propsCopy.id);
|
|
@@ -610,12 +617,12 @@ function processProps(propsCopy, config) {
|
|
|
610
617
|
}
|
|
611
618
|
function FormItem(props) {
|
|
612
619
|
var _a;
|
|
613
|
-
const [computedProps, setComputedProps] = (0,
|
|
614
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
620
|
+
const [computedProps, setComputedProps] = (0, import_react10.useState)();
|
|
621
|
+
const [extendTypes, setExtendTypes] = (0, import_react10.useState)();
|
|
615
622
|
const { common: common2 } = useConfigContext();
|
|
616
|
-
const [hidden, setHidden] = (0,
|
|
617
|
-
(0,
|
|
618
|
-
const propsCopy = {
|
|
623
|
+
const [hidden, setHidden] = (0, import_react10.useState)(props.hidden || false);
|
|
624
|
+
(0, import_react10.useEffect)(() => {
|
|
625
|
+
const propsCopy = __spreadValues({}, props);
|
|
619
626
|
if (propsCopy.extendTypes) {
|
|
620
627
|
setExtendTypes(propsCopy.extendTypes);
|
|
621
628
|
delete propsCopy.extendTypes;
|
|
@@ -638,312 +645,248 @@ function FormItem(props) {
|
|
|
638
645
|
if (!computedProps)
|
|
639
646
|
return null;
|
|
640
647
|
if (hidden)
|
|
641
|
-
return /* @__PURE__ */ (0,
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
hidden: true
|
|
648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
649
|
+
import_antd8.Form.Item,
|
|
650
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
651
|
+
noStyle: true,
|
|
652
|
+
rules: [],
|
|
653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Input, { hidden: true })
|
|
647
654
|
})
|
|
648
|
-
|
|
655
|
+
);
|
|
649
656
|
if (extendTypes && extendTypes[computedProps.type])
|
|
650
|
-
return /* @__PURE__ */ (0,
|
|
651
|
-
...computedProps,
|
|
652
|
-
children: extendTypes[computedProps.type].children
|
|
653
|
-
});
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: extendTypes[computedProps.type].children }));
|
|
654
658
|
if (computedProps.formChildren === null)
|
|
655
659
|
return null;
|
|
656
660
|
if (computedProps.formChildren)
|
|
657
|
-
return /* @__PURE__ */ (0,
|
|
658
|
-
...computedProps,
|
|
659
|
-
children: (0, import_react9.cloneElement)(computedProps.formChildren, { scene: "form" })
|
|
660
|
-
});
|
|
661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react10.cloneElement)(computedProps.formChildren, { scene: "form" }) }));
|
|
661
662
|
if (computedProps.children === null)
|
|
662
663
|
return null;
|
|
663
664
|
if (computedProps.children)
|
|
664
|
-
return /* @__PURE__ */ (0,
|
|
665
|
-
...computedProps,
|
|
666
|
-
children: (0, import_react9.cloneElement)(computedProps.children, { scene: "form" })
|
|
667
|
-
});
|
|
665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: (0, import_react10.cloneElement)(computedProps.children, { scene: "form" }) }));
|
|
668
666
|
if (computedProps.formRender)
|
|
669
|
-
return /* @__PURE__ */ (0,
|
|
670
|
-
...computedProps,
|
|
671
|
-
children: computedProps.formRender(null, null, 0, "form")
|
|
672
|
-
});
|
|
667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
|
|
673
668
|
if (computedProps.render)
|
|
674
|
-
return /* @__PURE__ */ (0,
|
|
675
|
-
...computedProps,
|
|
676
|
-
children: computedProps.render(null, null, 0, "form")
|
|
677
|
-
});
|
|
669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.render(null, null, 0, "form") }));
|
|
678
670
|
switch (computedProps.type) {
|
|
679
671
|
case "string":
|
|
680
|
-
return /* @__PURE__ */ (0,
|
|
681
|
-
...computedProps,
|
|
682
|
-
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Select, {
|
|
683
|
-
...computedProps.input
|
|
684
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Input, {
|
|
685
|
-
...computedProps.input
|
|
686
|
-
})
|
|
687
|
-
});
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Input, __spreadValues({}, computedProps.input)) }));
|
|
688
673
|
case "string[]":
|
|
689
674
|
if (computedProps.options)
|
|
690
|
-
return /* @__PURE__ */ (0,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
mode: "multiple"
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
children: [
|
|
704
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
705
|
-
className: "ant-form-item-label",
|
|
706
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
707
|
-
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
708
|
-
children: computedProps.label
|
|
709
|
-
})
|
|
710
|
-
}),
|
|
675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
676
|
+
import_antd8.Select,
|
|
677
|
+
__spreadValues({
|
|
678
|
+
mode: "multiple"
|
|
679
|
+
}, computedProps.input)
|
|
680
|
+
) }));
|
|
681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
682
|
+
import_antd8.Form.List,
|
|
683
|
+
{
|
|
684
|
+
name: computedProps.name,
|
|
685
|
+
rules: computedProps.rules,
|
|
686
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
687
|
+
var _a2;
|
|
688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
689
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: computedProps.rules.find((r) => r.required) && "ant-form-item-required", children: computedProps.label }) }),
|
|
711
690
|
fields.map((field) => {
|
|
712
691
|
var _a3;
|
|
713
|
-
return /* @__PURE__ */ (0,
|
|
714
|
-
|
|
692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
693
|
+
import_antd8.Row,
|
|
694
|
+
{
|
|
715
695
|
gutter: 24,
|
|
716
696
|
style: { flexFlow: "row nowrap" },
|
|
717
697
|
children: [
|
|
718
|
-
/* @__PURE__ */ (0,
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
...field,
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
699
|
+
import_antd8.Form.Item,
|
|
700
|
+
__spreadProps(__spreadValues({}, field), {
|
|
722
701
|
noStyle: true,
|
|
723
|
-
children: /* @__PURE__ */ (0,
|
|
724
|
-
...computedProps.input
|
|
725
|
-
})
|
|
702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Input, __spreadValues({}, computedProps.input))
|
|
726
703
|
})
|
|
727
|
-
}),
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
729
|
-
|
|
730
|
-
|
|
704
|
+
) }),
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
706
|
+
import_antd8.Button,
|
|
707
|
+
{
|
|
731
708
|
danger: true,
|
|
732
709
|
type: "link",
|
|
733
710
|
style: { float: "right" },
|
|
734
|
-
icon: /* @__PURE__ */ (0,
|
|
711
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
735
712
|
onClick: () => remove(field.name)
|
|
736
|
-
}
|
|
737
|
-
})
|
|
713
|
+
}
|
|
714
|
+
) })
|
|
738
715
|
]
|
|
739
|
-
}
|
|
740
|
-
}, field.key);
|
|
716
|
+
}
|
|
717
|
+
) }, field.key);
|
|
741
718
|
}),
|
|
742
|
-
/* @__PURE__ */ (0,
|
|
743
|
-
|
|
744
|
-
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd8.Form.Item, { children: [
|
|
720
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
721
|
+
import_antd8.Button,
|
|
722
|
+
{
|
|
745
723
|
type: "dashed",
|
|
746
724
|
block: true,
|
|
747
725
|
onClick: () => add(),
|
|
748
|
-
icon: /* @__PURE__ */ (0,
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
})
|
|
757
|
-
]
|
|
758
|
-
})
|
|
759
|
-
]
|
|
760
|
-
});
|
|
726
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.PlusOutlined, {})
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-extra", children: computedProps.extra }),
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.ErrorList, { errors })
|
|
731
|
+
] })
|
|
732
|
+
] });
|
|
733
|
+
}
|
|
761
734
|
}
|
|
762
|
-
|
|
735
|
+
);
|
|
763
736
|
case "number":
|
|
764
|
-
return /* @__PURE__ */ (0,
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
...computedProps.input
|
|
771
|
-
})
|
|
772
|
-
});
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
738
|
+
import_antd8.InputNumber,
|
|
739
|
+
__spreadValues({
|
|
740
|
+
style: { width: "100%" }
|
|
741
|
+
}, computedProps.input)
|
|
742
|
+
) }));
|
|
773
743
|
case "number[]":
|
|
774
744
|
if (computedProps.options)
|
|
775
|
-
return /* @__PURE__ */ (0,
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
mode: "multiple"
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
children: [
|
|
789
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
790
|
-
className: "ant-form-item-label",
|
|
791
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
792
|
-
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
793
|
-
children: computedProps.label
|
|
794
|
-
})
|
|
795
|
-
}),
|
|
745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
746
|
+
import_antd8.Select,
|
|
747
|
+
__spreadValues({
|
|
748
|
+
mode: "multiple"
|
|
749
|
+
}, computedProps.input)
|
|
750
|
+
) }));
|
|
751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
752
|
+
import_antd8.Form.List,
|
|
753
|
+
{
|
|
754
|
+
name: computedProps.name,
|
|
755
|
+
rules: computedProps.rules,
|
|
756
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
757
|
+
var _a2, _b;
|
|
758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
759
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
796
760
|
fields.map((field) => {
|
|
797
761
|
var _a3;
|
|
798
|
-
return /* @__PURE__ */ (0,
|
|
799
|
-
|
|
762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
763
|
+
import_antd8.Row,
|
|
764
|
+
{
|
|
800
765
|
gutter: 24,
|
|
801
766
|
style: { flexFlow: "row nowrap" },
|
|
802
767
|
children: [
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
...field,
|
|
768
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Col, { span: 23, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
769
|
+
import_antd8.Form.Item,
|
|
770
|
+
__spreadProps(__spreadValues({}, field), {
|
|
807
771
|
noStyle: true,
|
|
808
|
-
children: /* @__PURE__ */ (0,
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
773
|
+
import_antd8.InputNumber,
|
|
774
|
+
__spreadValues({
|
|
775
|
+
style: { width: "100%" }
|
|
776
|
+
}, computedProps.input)
|
|
777
|
+
)
|
|
812
778
|
})
|
|
813
|
-
}),
|
|
814
|
-
/* @__PURE__ */ (0,
|
|
815
|
-
|
|
816
|
-
|
|
779
|
+
) }),
|
|
780
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
781
|
+
import_antd8.Button,
|
|
782
|
+
{
|
|
817
783
|
danger: true,
|
|
818
784
|
type: "link",
|
|
819
785
|
style: { float: "right" },
|
|
820
|
-
icon: /* @__PURE__ */ (0,
|
|
786
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
821
787
|
onClick: () => remove(field.name)
|
|
822
|
-
}
|
|
823
|
-
})
|
|
788
|
+
}
|
|
789
|
+
) })
|
|
824
790
|
]
|
|
825
|
-
}
|
|
826
|
-
}, field.key);
|
|
791
|
+
}
|
|
792
|
+
) }, field.key);
|
|
827
793
|
}),
|
|
828
|
-
/* @__PURE__ */ (0,
|
|
829
|
-
|
|
830
|
-
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd8.Form.Item, { children: [
|
|
795
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
796
|
+
import_antd8.Button,
|
|
797
|
+
{
|
|
831
798
|
type: "dashed",
|
|
832
799
|
block: true,
|
|
833
800
|
onClick: () => add(),
|
|
834
|
-
icon: /* @__PURE__ */ (0,
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
})
|
|
843
|
-
]
|
|
844
|
-
})
|
|
845
|
-
]
|
|
846
|
-
});
|
|
801
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.PlusOutlined, {})
|
|
802
|
+
}
|
|
803
|
+
),
|
|
804
|
+
computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-extra", children: computedProps.extra }),
|
|
805
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.ErrorList, { errors })
|
|
806
|
+
] })
|
|
807
|
+
] });
|
|
808
|
+
}
|
|
847
809
|
}
|
|
848
|
-
|
|
810
|
+
);
|
|
849
811
|
case "boolean":
|
|
850
|
-
return /* @__PURE__ */ (0,
|
|
851
|
-
...computedProps,
|
|
852
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Switch, {
|
|
853
|
-
...computedProps.input
|
|
854
|
-
})
|
|
855
|
-
});
|
|
812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Switch, __spreadValues({}, computedProps.input)) }));
|
|
856
813
|
case "date":
|
|
857
|
-
return /* @__PURE__ */ (0,
|
|
858
|
-
...computedProps,
|
|
859
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.DatePicker, {
|
|
860
|
-
...computedProps.input
|
|
861
|
-
})
|
|
862
|
-
});
|
|
814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.DatePicker, __spreadValues({}, computedProps.input)) }));
|
|
863
815
|
case "time":
|
|
864
|
-
return /* @__PURE__ */ (0,
|
|
865
|
-
...computedProps,
|
|
866
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.TimePicker, {
|
|
867
|
-
...computedProps.input
|
|
868
|
-
})
|
|
869
|
-
});
|
|
816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.TimePicker, __spreadValues({}, computedProps.input)) }));
|
|
870
817
|
case "object":
|
|
871
|
-
return /* @__PURE__ */ (0,
|
|
872
|
-
children:
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
}),
|
|
880
|
-
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
881
|
-
...o
|
|
882
|
-
}, o.id))
|
|
883
|
-
]
|
|
884
|
-
});
|
|
818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
819
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
820
|
+
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
821
|
+
FormItem,
|
|
822
|
+
__spreadValues({}, o),
|
|
823
|
+
o.id
|
|
824
|
+
))
|
|
825
|
+
] });
|
|
885
826
|
case "object[]":
|
|
886
|
-
return /* @__PURE__ */ (0,
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
828
|
+
import_antd8.Form.List,
|
|
829
|
+
{
|
|
830
|
+
name: computedProps.name,
|
|
831
|
+
rules: computedProps.rules,
|
|
832
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
833
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
834
|
+
import_antd8.Form.Item,
|
|
835
|
+
{
|
|
836
|
+
style: { marginBottom: 0 },
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-label", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { children: [
|
|
839
|
+
computedProps.label,
|
|
840
|
+
" ",
|
|
841
|
+
field.name + 1,
|
|
842
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
843
|
+
import_antd8.Button,
|
|
844
|
+
{
|
|
902
845
|
danger: true,
|
|
903
846
|
type: "link",
|
|
904
847
|
onClick: () => remove(field.name),
|
|
905
848
|
children: common2.delete
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
})
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
849
|
+
}
|
|
850
|
+
)
|
|
851
|
+
] }) }),
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
853
|
+
import_antd8.Col,
|
|
854
|
+
{
|
|
855
|
+
span: o.col || 24,
|
|
856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
857
|
+
FormItem,
|
|
858
|
+
__spreadProps(__spreadValues({}, o), {
|
|
859
|
+
name: [field.name, o.id]
|
|
860
|
+
})
|
|
861
|
+
)
|
|
862
|
+
},
|
|
863
|
+
o.id
|
|
864
|
+
)) })
|
|
865
|
+
]
|
|
866
|
+
},
|
|
867
|
+
field.key
|
|
868
|
+
)),
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_antd8.Form.Item, { children: [
|
|
870
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
871
|
+
import_antd8.Button,
|
|
872
|
+
{
|
|
925
873
|
type: "dashed",
|
|
926
874
|
block: true,
|
|
927
875
|
onClick: () => add(),
|
|
928
|
-
icon: /* @__PURE__ */ (0,
|
|
876
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_icons2.PlusOutlined, {}),
|
|
929
877
|
children: [
|
|
930
878
|
common2.add,
|
|
931
879
|
" ",
|
|
932
880
|
computedProps.label
|
|
933
881
|
]
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
]
|
|
943
|
-
})
|
|
944
|
-
]
|
|
945
|
-
})
|
|
946
|
-
});
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
computedProps.extra && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "ant-form-item-extra", children: computedProps.extra }),
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd8.Form.ErrorList, { errors })
|
|
886
|
+
] })
|
|
887
|
+
] })
|
|
888
|
+
}
|
|
889
|
+
);
|
|
947
890
|
default:
|
|
948
891
|
return null;
|
|
949
892
|
}
|
|
@@ -951,21 +894,20 @@ function FormItem(props) {
|
|
|
951
894
|
FormItem.useStatus = import_antd8.Form.Item.useStatus;
|
|
952
895
|
|
|
953
896
|
// src/Form.tsx
|
|
954
|
-
var
|
|
897
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
955
898
|
function Form(props) {
|
|
956
899
|
var _a, _b;
|
|
957
|
-
const [loading, setLoading] = (0,
|
|
958
|
-
const [computedProps, setComputedProps] = (0,
|
|
900
|
+
const [loading, setLoading] = (0, import_react12.useState)(false);
|
|
901
|
+
const [computedProps, setComputedProps] = (0, import_react12.useState)();
|
|
959
902
|
const config = useConfigContext();
|
|
960
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
903
|
+
const [extendTypes, setExtendTypes] = (0, import_react12.useState)();
|
|
961
904
|
const [form] = import_antd9.Form.useForm(props.form);
|
|
962
|
-
const [initialValues, setInitialValues] = (0,
|
|
963
|
-
(0,
|
|
905
|
+
const [initialValues, setInitialValues] = (0, import_react12.useState)(props.initialValues);
|
|
906
|
+
(0, import_react12.useEffect)(() => {
|
|
964
907
|
var _a2, _b2, _c;
|
|
965
|
-
const propsCopy = {
|
|
966
|
-
...props,
|
|
908
|
+
const propsCopy = __spreadProps(__spreadValues({}, props), {
|
|
967
909
|
form
|
|
968
|
-
};
|
|
910
|
+
});
|
|
969
911
|
if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
|
|
970
912
|
for (const key in propsCopy.initialValues) {
|
|
971
913
|
propsCopy.initialValues[key] = transferValue(
|
|
@@ -989,10 +931,7 @@ function Form(props) {
|
|
|
989
931
|
setLoading(true);
|
|
990
932
|
try {
|
|
991
933
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
992
|
-
await props.onFinish(values, async (values2) =>
|
|
993
|
-
...values2,
|
|
994
|
-
...propsCopy.submit.to.params
|
|
995
|
-
} : values2));
|
|
934
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
|
|
996
935
|
} else
|
|
997
936
|
await props.onFinish(values);
|
|
998
937
|
} catch (error) {
|
|
@@ -1003,10 +942,7 @@ function Form(props) {
|
|
|
1003
942
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
1004
943
|
propsCopy.onFinish = async (values) => {
|
|
1005
944
|
setLoading(true);
|
|
1006
|
-
return
|
|
1007
|
-
...values,
|
|
1008
|
-
...propsCopy.submit.to.params
|
|
1009
|
-
} : values).then((result) => {
|
|
945
|
+
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
|
|
1010
946
|
if (propsCopy.submit.to.then)
|
|
1011
947
|
propsCopy.submit.to.then(result);
|
|
1012
948
|
return result;
|
|
@@ -1027,7 +963,7 @@ function Form(props) {
|
|
|
1027
963
|
}
|
|
1028
964
|
setComputedProps(propsCopy);
|
|
1029
965
|
}, [props]);
|
|
1030
|
-
const onValuesChange = (0,
|
|
966
|
+
const onValuesChange = (0, import_react12.useCallback)((changedValues, allValues) => {
|
|
1031
967
|
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
1032
968
|
if (props.onValuesChange) {
|
|
1033
969
|
props.onValuesChange(changedValues, allValues);
|
|
@@ -1040,7 +976,7 @@ function Form(props) {
|
|
|
1040
976
|
item.onValueChange(changedValues[key], allValues, form);
|
|
1041
977
|
}
|
|
1042
978
|
}, [computedProps]);
|
|
1043
|
-
(0,
|
|
979
|
+
(0, import_react12.useEffect)(() => {
|
|
1044
980
|
if (!initialValues)
|
|
1045
981
|
return;
|
|
1046
982
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -1049,25 +985,33 @@ function Form(props) {
|
|
|
1049
985
|
}, [computedProps]);
|
|
1050
986
|
if (!computedProps)
|
|
1051
987
|
return null;
|
|
1052
|
-
return /* @__PURE__ */ (0,
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
989
|
+
import_antd9.Form,
|
|
990
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
991
|
+
onValuesChange,
|
|
992
|
+
children: [
|
|
993
|
+
computedProps.beforeItems,
|
|
994
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react12.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
995
|
+
FormItem,
|
|
996
|
+
__spreadProps(__spreadValues({}, item), {
|
|
997
|
+
extendTypes
|
|
998
|
+
}),
|
|
999
|
+
item.id
|
|
1000
|
+
)),
|
|
1001
|
+
computedProps.children,
|
|
1002
|
+
computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1003
|
+
import_antd9.Button,
|
|
1004
|
+
{
|
|
1005
|
+
htmlType: "submit",
|
|
1006
|
+
type: "primary",
|
|
1007
|
+
loading,
|
|
1008
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
1009
|
+
}
|
|
1010
|
+
),
|
|
1011
|
+
computedProps.footer
|
|
1012
|
+
]
|
|
1013
|
+
})
|
|
1014
|
+
);
|
|
1071
1015
|
}
|
|
1072
1016
|
Form.useForm = import_antd9.Form.useForm;
|
|
1073
1017
|
Form.useFormInstance = import_antd9.Form.useFormInstance;
|
|
@@ -1080,15 +1024,13 @@ Form.Provider = import_antd9.Form.Provider;
|
|
|
1080
1024
|
// src/Link.tsx
|
|
1081
1025
|
var import_react_router_dom2 = require("react-router-dom");
|
|
1082
1026
|
var import_antd10 = require("antd");
|
|
1083
|
-
var
|
|
1027
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1084
1028
|
function Link(props) {
|
|
1085
1029
|
var _a, _b, _c, _d;
|
|
1086
1030
|
const { Link: Link2 } = useConfigContext();
|
|
1087
|
-
let style = {
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
...props.style
|
|
1091
|
-
};
|
|
1031
|
+
let style = __spreadValues(__spreadProps(__spreadValues({}, Link2.style || {}), {
|
|
1032
|
+
cursor: "pointer"
|
|
1033
|
+
}), props.style);
|
|
1092
1034
|
if (props.block)
|
|
1093
1035
|
style = Object.assign({
|
|
1094
1036
|
display: "block",
|
|
@@ -1096,86 +1038,99 @@ function Link(props) {
|
|
|
1096
1038
|
}, style);
|
|
1097
1039
|
if (props.href.startsWith("http")) {
|
|
1098
1040
|
if (props.button)
|
|
1099
|
-
return /* @__PURE__ */ (0,
|
|
1100
|
-
|
|
1041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1042
|
+
import_antd10.Button,
|
|
1043
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
1044
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
1045
|
+
style,
|
|
1046
|
+
href: props.href,
|
|
1047
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
1048
|
+
})
|
|
1049
|
+
);
|
|
1050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1051
|
+
"a",
|
|
1052
|
+
{
|
|
1053
|
+
href: props.href,
|
|
1101
1054
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
1102
1055
|
style,
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
1107
|
-
href: props.href,
|
|
1108
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
1109
|
-
style,
|
|
1110
|
-
children: (_b = props.text) != null ? _b : props.children
|
|
1111
|
-
});
|
|
1056
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
1057
|
+
}
|
|
1058
|
+
);
|
|
1112
1059
|
}
|
|
1113
1060
|
if (props.button)
|
|
1114
|
-
return /* @__PURE__ */ (0,
|
|
1061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1062
|
+
import_react_router_dom2.Link,
|
|
1063
|
+
{
|
|
1064
|
+
to: props.href,
|
|
1065
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1066
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1067
|
+
import_antd10.Button,
|
|
1068
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
1069
|
+
style,
|
|
1070
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
1071
|
+
})
|
|
1072
|
+
)
|
|
1073
|
+
}
|
|
1074
|
+
);
|
|
1075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1076
|
+
import_react_router_dom2.Link,
|
|
1077
|
+
{
|
|
1115
1078
|
to: props.href,
|
|
1116
1079
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
})
|
|
1122
|
-
});
|
|
1123
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Link, {
|
|
1124
|
-
to: props.href,
|
|
1125
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1126
|
-
style,
|
|
1127
|
-
children: (_d = props.text) != null ? _d : props.children
|
|
1128
|
-
});
|
|
1080
|
+
style,
|
|
1081
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
1082
|
+
}
|
|
1083
|
+
);
|
|
1129
1084
|
}
|
|
1130
1085
|
|
|
1131
1086
|
// src/Routers.tsx
|
|
1132
1087
|
var import_antd11 = require("antd");
|
|
1133
|
-
var import_react12 = require("react");
|
|
1134
|
-
var import_react_router_dom3 = require("react-router-dom");
|
|
1135
1088
|
var import_react13 = require("react");
|
|
1136
|
-
var
|
|
1089
|
+
var import_react_router_dom3 = require("react-router-dom");
|
|
1090
|
+
var import_react14 = require("react");
|
|
1091
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1137
1092
|
function PageNotFound() {
|
|
1138
1093
|
const config = useConfigContext();
|
|
1139
|
-
return /* @__PURE__ */ (0,
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1095
|
+
import_antd11.Result,
|
|
1096
|
+
{
|
|
1097
|
+
status: "404",
|
|
1098
|
+
title: config.common.pageNotFound
|
|
1099
|
+
}
|
|
1100
|
+
);
|
|
1143
1101
|
}
|
|
1144
1102
|
function Routes(props) {
|
|
1145
|
-
return /* @__PURE__ */ (0,
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
element: r.element || /* @__PURE__ */ (0,
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
|
|
1157
|
-
})
|
|
1158
|
-
}, r.path)),
|
|
1159
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom3.Route, {
|
|
1103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_react_router_dom3.Routes, { children: [
|
|
1104
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1105
|
+
import_react_router_dom3.Route,
|
|
1106
|
+
__spreadProps(__spreadValues({}, r), {
|
|
1107
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react13.Suspense, { fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { style: { padding: "24px" }, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_antd11.Skeleton, { active: true }) }), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(r.page, {}) })
|
|
1108
|
+
}),
|
|
1109
|
+
r.path
|
|
1110
|
+
)),
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1112
|
+
import_react_router_dom3.Route,
|
|
1113
|
+
{
|
|
1160
1114
|
path: "*",
|
|
1161
|
-
element: props.notFound || /* @__PURE__ */ (0,
|
|
1162
|
-
},
|
|
1163
|
-
|
|
1164
|
-
|
|
1115
|
+
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PageNotFound, {})
|
|
1116
|
+
},
|
|
1117
|
+
"*"
|
|
1118
|
+
)
|
|
1119
|
+
] });
|
|
1165
1120
|
}
|
|
1166
1121
|
|
|
1167
1122
|
// src/Table.tsx
|
|
1168
|
-
var
|
|
1123
|
+
var import_react15 = require("react");
|
|
1169
1124
|
var import_antd12 = require("antd");
|
|
1170
1125
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1171
1126
|
var import_icons3 = require("@ant-design/icons");
|
|
1172
1127
|
var import_lodash_es6 = require("lodash-es");
|
|
1173
|
-
var
|
|
1128
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1174
1129
|
function processValue(item, value) {
|
|
1175
1130
|
var _a;
|
|
1176
1131
|
const transferred = transferValue(item.type, value);
|
|
1177
1132
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
1178
|
-
return /* @__PURE__ */ (0,
|
|
1133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {});
|
|
1179
1134
|
if (item.options) {
|
|
1180
1135
|
if (item.type.endsWith("[]"))
|
|
1181
1136
|
return transferred.map((v) => {
|
|
@@ -1196,7 +1151,7 @@ function processValue(item, value) {
|
|
|
1196
1151
|
return value;
|
|
1197
1152
|
}
|
|
1198
1153
|
function Table(props) {
|
|
1199
|
-
const [columns, setColumns] = (0,
|
|
1154
|
+
const [columns, setColumns] = (0, import_react15.useState)();
|
|
1200
1155
|
const { common: common2 } = useConfigContext();
|
|
1201
1156
|
const generateFilterDropdown = (item) => {
|
|
1202
1157
|
if (typeof item.filterDropdown !== "undefined")
|
|
@@ -1213,35 +1168,41 @@ function Table(props) {
|
|
|
1213
1168
|
setSelectedKeys,
|
|
1214
1169
|
selectedKeys,
|
|
1215
1170
|
confirm
|
|
1216
|
-
}) => /* @__PURE__ */ (0,
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Select, {
|
|
1223
|
-
options: item.options,
|
|
1224
|
-
allowClear: true,
|
|
1225
|
-
showSearch: true,
|
|
1226
|
-
style: { width: "100%" },
|
|
1227
|
-
placeholder: `${common2.search} ${item.title}`,
|
|
1228
|
-
value: selectedKeys,
|
|
1229
|
-
onChange: (v) => {
|
|
1230
|
-
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1231
|
-
confirm();
|
|
1171
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1172
|
+
"div",
|
|
1173
|
+
{
|
|
1174
|
+
style: {
|
|
1175
|
+
padding: 8,
|
|
1176
|
+
width: "200px"
|
|
1232
1177
|
},
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1178
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1179
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1180
|
+
import_antd12.Select,
|
|
1181
|
+
{
|
|
1182
|
+
options: item.options,
|
|
1183
|
+
allowClear: true,
|
|
1184
|
+
showSearch: true,
|
|
1185
|
+
style: { width: "100%" },
|
|
1186
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1187
|
+
value: selectedKeys,
|
|
1188
|
+
onChange: (v) => {
|
|
1189
|
+
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1190
|
+
confirm();
|
|
1191
|
+
},
|
|
1192
|
+
mode: "multiple",
|
|
1193
|
+
filterOption: (input, option) => {
|
|
1194
|
+
if (!input || !option || !option.label)
|
|
1195
|
+
return true;
|
|
1196
|
+
input = input.trim();
|
|
1197
|
+
return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
)
|
|
1201
|
+
}
|
|
1202
|
+
);
|
|
1242
1203
|
return item;
|
|
1243
1204
|
};
|
|
1244
|
-
(0,
|
|
1205
|
+
(0, import_react15.useEffect)(() => {
|
|
1245
1206
|
var _a;
|
|
1246
1207
|
for (const item of props.items) {
|
|
1247
1208
|
if (!item.key)
|
|
@@ -1258,7 +1219,7 @@ function Table(props) {
|
|
|
1258
1219
|
text: o.label,
|
|
1259
1220
|
value: o.value
|
|
1260
1221
|
})).concat({
|
|
1261
|
-
text: /* @__PURE__ */ (0,
|
|
1222
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
|
|
1262
1223
|
value: null
|
|
1263
1224
|
});
|
|
1264
1225
|
generateFilterDropdown(item);
|
|
@@ -1266,7 +1227,7 @@ function Table(props) {
|
|
|
1266
1227
|
if (item.tableChildren === null)
|
|
1267
1228
|
item.render = () => null;
|
|
1268
1229
|
else if (item.tableChildren)
|
|
1269
|
-
item.render = (value, values) => (0,
|
|
1230
|
+
item.render = (value, values) => (0, import_react15.cloneElement)(
|
|
1270
1231
|
item.tableChildren,
|
|
1271
1232
|
{
|
|
1272
1233
|
scene: "table",
|
|
@@ -1277,7 +1238,7 @@ function Table(props) {
|
|
|
1277
1238
|
else if (item.children === null)
|
|
1278
1239
|
item.render = () => null;
|
|
1279
1240
|
else if (item.children)
|
|
1280
|
-
item.render = (value, values) => (0,
|
|
1241
|
+
item.render = (value, values) => (0, import_react15.cloneElement)(
|
|
1281
1242
|
item.children,
|
|
1282
1243
|
{
|
|
1283
1244
|
scene: "table",
|
|
@@ -1287,7 +1248,7 @@ function Table(props) {
|
|
|
1287
1248
|
);
|
|
1288
1249
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1289
1250
|
if (props.extendTypes[item.type].children)
|
|
1290
|
-
item.render = (value, values) => (0,
|
|
1251
|
+
item.render = (value, values) => (0, import_react15.cloneElement)(
|
|
1291
1252
|
props.extendTypes[item.type].children,
|
|
1292
1253
|
{
|
|
1293
1254
|
scene: "table",
|
|
@@ -1320,19 +1281,22 @@ function Table(props) {
|
|
|
1320
1281
|
setSelectedKeys,
|
|
1321
1282
|
confirm,
|
|
1322
1283
|
clearFilters
|
|
1323
|
-
}) => /* @__PURE__ */ (0,
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1284
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1285
|
+
import_antd12.Input.Search,
|
|
1286
|
+
{
|
|
1287
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1288
|
+
allowClear: true,
|
|
1289
|
+
onSearch: (v) => {
|
|
1290
|
+
if (v) {
|
|
1291
|
+
setSelectedKeys([v]);
|
|
1292
|
+
} else {
|
|
1293
|
+
setSelectedKeys([]);
|
|
1294
|
+
clearFilters();
|
|
1295
|
+
}
|
|
1296
|
+
confirm();
|
|
1332
1297
|
}
|
|
1333
|
-
confirm();
|
|
1334
1298
|
}
|
|
1335
|
-
|
|
1299
|
+
);
|
|
1336
1300
|
break;
|
|
1337
1301
|
case "string[]":
|
|
1338
1302
|
if (!item.render)
|
|
@@ -1352,19 +1316,22 @@ function Table(props) {
|
|
|
1352
1316
|
setSelectedKeys,
|
|
1353
1317
|
confirm,
|
|
1354
1318
|
clearFilters
|
|
1355
|
-
}) => /* @__PURE__ */ (0,
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1319
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1320
|
+
import_antd12.Input.Search,
|
|
1321
|
+
{
|
|
1322
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1323
|
+
allowClear: true,
|
|
1324
|
+
onSearch: (v) => {
|
|
1325
|
+
if (v) {
|
|
1326
|
+
setSelectedKeys([v]);
|
|
1327
|
+
} else {
|
|
1328
|
+
setSelectedKeys([]);
|
|
1329
|
+
clearFilters();
|
|
1330
|
+
}
|
|
1331
|
+
confirm();
|
|
1364
1332
|
}
|
|
1365
|
-
confirm();
|
|
1366
1333
|
}
|
|
1367
|
-
|
|
1334
|
+
);
|
|
1368
1335
|
break;
|
|
1369
1336
|
case "number":
|
|
1370
1337
|
if (!item.render)
|
|
@@ -1386,19 +1353,22 @@ function Table(props) {
|
|
|
1386
1353
|
setSelectedKeys,
|
|
1387
1354
|
confirm,
|
|
1388
1355
|
clearFilters
|
|
1389
|
-
}) => /* @__PURE__ */ (0,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1356
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1357
|
+
import_antd12.Input.Search,
|
|
1358
|
+
{
|
|
1359
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1360
|
+
allowClear: true,
|
|
1361
|
+
onSearch: (v) => {
|
|
1362
|
+
if (v) {
|
|
1363
|
+
setSelectedKeys([Number(v)]);
|
|
1364
|
+
} else {
|
|
1365
|
+
setSelectedKeys([]);
|
|
1366
|
+
clearFilters();
|
|
1367
|
+
}
|
|
1368
|
+
confirm();
|
|
1398
1369
|
}
|
|
1399
|
-
confirm();
|
|
1400
1370
|
}
|
|
1401
|
-
|
|
1371
|
+
);
|
|
1402
1372
|
break;
|
|
1403
1373
|
case "number[]":
|
|
1404
1374
|
if (!item.render)
|
|
@@ -1418,79 +1388,66 @@ function Table(props) {
|
|
|
1418
1388
|
setSelectedKeys,
|
|
1419
1389
|
confirm,
|
|
1420
1390
|
clearFilters
|
|
1421
|
-
}) => /* @__PURE__ */ (0,
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1391
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1392
|
+
import_antd12.Input.Search,
|
|
1393
|
+
{
|
|
1394
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1395
|
+
allowClear: true,
|
|
1396
|
+
onSearch: (v) => {
|
|
1397
|
+
if (v) {
|
|
1398
|
+
setSelectedKeys([Number(v)]);
|
|
1399
|
+
} else {
|
|
1400
|
+
setSelectedKeys([]);
|
|
1401
|
+
clearFilters();
|
|
1402
|
+
}
|
|
1403
|
+
confirm();
|
|
1430
1404
|
}
|
|
1431
|
-
confirm();
|
|
1432
1405
|
}
|
|
1433
|
-
|
|
1406
|
+
);
|
|
1434
1407
|
break;
|
|
1435
1408
|
case "boolean":
|
|
1436
1409
|
if (!item.render)
|
|
1437
|
-
item.render = (value) => (0, import_lodash_es6.isNil)(value) ? /* @__PURE__ */ (0,
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
marginTop: "4px",
|
|
1445
|
-
color: "#ff4d4f"
|
|
1446
|
-
}
|
|
1447
|
-
});
|
|
1410
|
+
item.render = (value) => (0, import_lodash_es6.isNil)(value) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CheckOutlined, { style: {
|
|
1411
|
+
marginTop: "4px",
|
|
1412
|
+
color: "#52c41a"
|
|
1413
|
+
} }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CloseOutlined, { style: {
|
|
1414
|
+
marginTop: "4px",
|
|
1415
|
+
color: "#ff4d4f"
|
|
1416
|
+
} });
|
|
1448
1417
|
if (item.filterDropdown !== false)
|
|
1449
1418
|
item.filterDropdown = ({
|
|
1450
1419
|
setSelectedKeys,
|
|
1451
1420
|
selectedKeys,
|
|
1452
1421
|
confirm
|
|
1453
|
-
}) => /* @__PURE__ */ (0,
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
})
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
style: {
|
|
1483
|
-
verticalAlign: "middle",
|
|
1484
|
-
color: "#ff4d4f"
|
|
1485
|
-
}
|
|
1486
|
-
})
|
|
1487
|
-
}),
|
|
1488
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd12.Radio.Button, {
|
|
1489
|
-
value: "null",
|
|
1490
|
-
children: common2.blank
|
|
1491
|
-
})
|
|
1492
|
-
]
|
|
1493
|
-
});
|
|
1422
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1423
|
+
import_antd12.Radio.Group,
|
|
1424
|
+
{
|
|
1425
|
+
style: { padding: 8 },
|
|
1426
|
+
buttonStyle: "solid",
|
|
1427
|
+
value: JSON.stringify(selectedKeys[0]),
|
|
1428
|
+
onChange: (e) => {
|
|
1429
|
+
const Values = {
|
|
1430
|
+
true: true,
|
|
1431
|
+
false: false,
|
|
1432
|
+
null: null
|
|
1433
|
+
};
|
|
1434
|
+
setSelectedKeys(e.target.value ? [Values[e.target.value]] : []);
|
|
1435
|
+
confirm();
|
|
1436
|
+
},
|
|
1437
|
+
children: [
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { children: common2.all }),
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { value: "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CheckOutlined, { style: {
|
|
1440
|
+
color: "#52c41a",
|
|
1441
|
+
verticalAlign: "middle"
|
|
1442
|
+
} }) }),
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { value: "false", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_icons3.CloseOutlined, { style: {
|
|
1444
|
+
verticalAlign: "middle",
|
|
1445
|
+
color: "#ff4d4f"
|
|
1446
|
+
} }) }),
|
|
1447
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_antd12.Radio.Button, { value: "null", children: common2.blank })
|
|
1448
|
+
]
|
|
1449
|
+
}
|
|
1450
|
+
);
|
|
1494
1451
|
if (!item.onFilter)
|
|
1495
1452
|
item.onFilter = (value, row) => {
|
|
1496
1453
|
switch (value) {
|
|
@@ -1518,12 +1475,15 @@ function Table(props) {
|
|
|
1518
1475
|
item.filterDropdown = ({
|
|
1519
1476
|
setSelectedKeys,
|
|
1520
1477
|
confirm
|
|
1521
|
-
}) => /* @__PURE__ */ (0,
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1478
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1479
|
+
import_antd12.DatePicker.RangePicker,
|
|
1480
|
+
{
|
|
1481
|
+
onChange: (dates) => {
|
|
1482
|
+
setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
|
|
1483
|
+
confirm();
|
|
1484
|
+
}
|
|
1525
1485
|
}
|
|
1526
|
-
|
|
1486
|
+
);
|
|
1527
1487
|
if (!item.onFilter)
|
|
1528
1488
|
item.onFilter = (value, row) => {
|
|
1529
1489
|
if ((0, import_lodash_es6.isNil)(value[0]))
|
|
@@ -1548,12 +1508,15 @@ function Table(props) {
|
|
|
1548
1508
|
item.filterDropdown = ({
|
|
1549
1509
|
setSelectedKeys,
|
|
1550
1510
|
confirm
|
|
1551
|
-
}) => /* @__PURE__ */ (0,
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1511
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1512
|
+
import_antd12.DatePicker.RangePicker,
|
|
1513
|
+
{
|
|
1514
|
+
onChange: (dates) => {
|
|
1515
|
+
setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
|
|
1516
|
+
confirm();
|
|
1517
|
+
}
|
|
1555
1518
|
}
|
|
1556
|
-
|
|
1519
|
+
);
|
|
1557
1520
|
if (!item.onFilter)
|
|
1558
1521
|
item.onFilter = (value, row) => {
|
|
1559
1522
|
if ((0, import_lodash_es6.isNil)(value[0]))
|
|
@@ -1565,21 +1528,26 @@ function Table(props) {
|
|
|
1565
1528
|
break;
|
|
1566
1529
|
case "object":
|
|
1567
1530
|
if (!item.render)
|
|
1568
|
-
item.render = (value) => /* @__PURE__ */ (0,
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1531
|
+
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1532
|
+
Description,
|
|
1533
|
+
{
|
|
1534
|
+
items: item.object,
|
|
1535
|
+
dataSource: value || {},
|
|
1536
|
+
column: 1
|
|
1537
|
+
}
|
|
1538
|
+
);
|
|
1573
1539
|
break;
|
|
1574
1540
|
case "object[]":
|
|
1575
1541
|
if (!item.render)
|
|
1576
|
-
item.render = (value) => /* @__PURE__ */ (0,
|
|
1577
|
-
|
|
1542
|
+
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1543
|
+
Description,
|
|
1544
|
+
{
|
|
1578
1545
|
items: item.object,
|
|
1579
1546
|
dataSource: v || [],
|
|
1580
1547
|
column: 1
|
|
1581
|
-
},
|
|
1582
|
-
|
|
1548
|
+
},
|
|
1549
|
+
i
|
|
1550
|
+
)) });
|
|
1583
1551
|
break;
|
|
1584
1552
|
default:
|
|
1585
1553
|
if (!item.render)
|
|
@@ -1595,7 +1563,7 @@ function Table(props) {
|
|
|
1595
1563
|
}
|
|
1596
1564
|
setColumns(props.items);
|
|
1597
1565
|
}, [JSON.stringify(props.items)]);
|
|
1598
|
-
(0,
|
|
1566
|
+
(0, import_react15.useEffect)(() => {
|
|
1599
1567
|
if (!props.dataSource || !columns)
|
|
1600
1568
|
return;
|
|
1601
1569
|
for (const column of columns) {
|
|
@@ -1618,19 +1586,26 @@ function Table(props) {
|
|
|
1618
1586
|
if (!columns)
|
|
1619
1587
|
return null;
|
|
1620
1588
|
if (props.dataSource)
|
|
1621
|
-
return /* @__PURE__ */ (0,
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1590
|
+
import_antd12.Table,
|
|
1591
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1592
|
+
rowKey: props.rowKey || "id",
|
|
1593
|
+
columns,
|
|
1594
|
+
dataSource: props.dataSource
|
|
1595
|
+
})
|
|
1596
|
+
);
|
|
1597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1598
|
+
FaasDataWrapper2,
|
|
1599
|
+
__spreadProps(__spreadValues({}, props.faasData), {
|
|
1600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1601
|
+
FaasDataTable,
|
|
1602
|
+
{
|
|
1603
|
+
props,
|
|
1604
|
+
columns
|
|
1605
|
+
}
|
|
1606
|
+
)
|
|
1632
1607
|
})
|
|
1633
|
-
|
|
1608
|
+
);
|
|
1634
1609
|
}
|
|
1635
1610
|
function FaasDataTable({
|
|
1636
1611
|
props,
|
|
@@ -1639,8 +1614,8 @@ function FaasDataTable({
|
|
|
1639
1614
|
params,
|
|
1640
1615
|
reload
|
|
1641
1616
|
}) {
|
|
1642
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
1643
|
-
(0,
|
|
1617
|
+
const [currentColumns, setCurrentColumns] = (0, import_react15.useState)(columns);
|
|
1618
|
+
(0, import_react15.useEffect)(() => {
|
|
1644
1619
|
if (!data || Array.isArray(data))
|
|
1645
1620
|
return;
|
|
1646
1621
|
setCurrentColumns((prev) => {
|
|
@@ -1652,7 +1627,7 @@ function FaasDataTable({
|
|
|
1652
1627
|
text: v.label,
|
|
1653
1628
|
value: v.value
|
|
1654
1629
|
})).concat({
|
|
1655
|
-
text: /* @__PURE__ */ (0,
|
|
1630
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
|
|
1656
1631
|
value: null
|
|
1657
1632
|
});
|
|
1658
1633
|
column.render = (value) => processValue(column, value);
|
|
@@ -1667,7 +1642,7 @@ function FaasDataTable({
|
|
|
1667
1642
|
}));
|
|
1668
1643
|
if (filters.length)
|
|
1669
1644
|
column.filters = filters.concat({
|
|
1670
|
-
text: /* @__PURE__ */ (0,
|
|
1645
|
+
text: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Blank, {}),
|
|
1671
1646
|
value: null
|
|
1672
1647
|
});
|
|
1673
1648
|
}
|
|
@@ -1676,78 +1651,98 @@ function FaasDataTable({
|
|
|
1676
1651
|
});
|
|
1677
1652
|
}, [columns, data]);
|
|
1678
1653
|
if (!data)
|
|
1679
|
-
return /* @__PURE__ */ (0,
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1655
|
+
import_antd12.Table,
|
|
1656
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1657
|
+
loading: props.loading,
|
|
1658
|
+
rowKey: props.rowKey || "id",
|
|
1659
|
+
columns: currentColumns,
|
|
1660
|
+
dataSource: []
|
|
1661
|
+
})
|
|
1662
|
+
);
|
|
1686
1663
|
if (Array.isArray(data))
|
|
1687
|
-
return /* @__PURE__ */ (0,
|
|
1688
|
-
|
|
1664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1665
|
+
import_antd12.Table,
|
|
1666
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1667
|
+
loading: props.loading,
|
|
1668
|
+
rowKey: props.rowKey || "id",
|
|
1669
|
+
columns: currentColumns,
|
|
1670
|
+
dataSource: data
|
|
1671
|
+
})
|
|
1672
|
+
);
|
|
1673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1674
|
+
import_antd12.Table,
|
|
1675
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1689
1676
|
loading: props.loading,
|
|
1690
1677
|
rowKey: props.rowKey || "id",
|
|
1691
1678
|
columns: currentColumns,
|
|
1692
|
-
dataSource: data
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
pagination: processed.pagination,
|
|
1710
|
-
filters: processed.filters,
|
|
1711
|
-
sorter: processed.sorter
|
|
1712
|
-
});
|
|
1713
|
-
return;
|
|
1679
|
+
dataSource: data.rows,
|
|
1680
|
+
pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
|
|
1681
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1682
|
+
if (props.onChange) {
|
|
1683
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1684
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1685
|
+
pagination: processed.pagination,
|
|
1686
|
+
filters: processed.filters,
|
|
1687
|
+
sorter: processed.sorter
|
|
1688
|
+
}));
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1692
|
+
pagination,
|
|
1693
|
+
filters,
|
|
1694
|
+
sorter
|
|
1695
|
+
}));
|
|
1714
1696
|
}
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1697
|
+
})
|
|
1698
|
+
);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
// src/Tabs.tsx
|
|
1702
|
+
var import_antd13 = require("antd");
|
|
1703
|
+
var import_react16 = require("react");
|
|
1704
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1705
|
+
function Tabs(props) {
|
|
1706
|
+
const [items, setItems] = (0, import_react16.useState)([]);
|
|
1707
|
+
(0, import_react16.useEffect)(() => {
|
|
1708
|
+
setItems(props.items.filter(Boolean).map((item) => __spreadProps(__spreadValues({}, item), {
|
|
1709
|
+
key: item.id,
|
|
1710
|
+
label: item.title || item.id
|
|
1711
|
+
})));
|
|
1712
|
+
}, [props.items.filter(Boolean).map((i) => i.id).join("")]);
|
|
1713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1714
|
+
import_antd13.Tabs,
|
|
1715
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1716
|
+
items
|
|
1717
|
+
})
|
|
1718
|
+
);
|
|
1723
1719
|
}
|
|
1724
1720
|
|
|
1725
1721
|
// src/Title.tsx
|
|
1726
|
-
var
|
|
1727
|
-
var
|
|
1722
|
+
var import_react17 = require("react");
|
|
1723
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1728
1724
|
function Title(props) {
|
|
1729
1725
|
const { Title: Title2 } = useConfigContext();
|
|
1730
|
-
(0,
|
|
1726
|
+
(0, import_react17.useEffect)(() => {
|
|
1731
1727
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1732
1728
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1733
1729
|
}, [props]);
|
|
1734
1730
|
if (props.h1) {
|
|
1735
1731
|
if (typeof props.h1 === "boolean")
|
|
1736
|
-
return /* @__PURE__ */ (0,
|
|
1732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1734
|
+
"h1",
|
|
1735
|
+
{
|
|
1736
|
+
className: props.h1.className,
|
|
1737
|
+
style: props.h1.style,
|
|
1737
1738
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
className: props.h1.className,
|
|
1741
|
-
style: props.h1.style,
|
|
1742
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1743
|
-
});
|
|
1739
|
+
}
|
|
1740
|
+
);
|
|
1744
1741
|
}
|
|
1745
1742
|
if (props.plain)
|
|
1746
|
-
return /* @__PURE__ */ (0,
|
|
1747
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1748
|
-
});
|
|
1743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1749
1744
|
if (props.children)
|
|
1750
|
-
return (0,
|
|
1745
|
+
return (0, import_react17.cloneElement)(props.children, { title: props.title });
|
|
1751
1746
|
return null;
|
|
1752
1747
|
}
|
|
1753
1748
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1768,6 +1763,7 @@ function Title(props) {
|
|
|
1768
1763
|
PageNotFound,
|
|
1769
1764
|
Routes,
|
|
1770
1765
|
Table,
|
|
1766
|
+
Tabs,
|
|
1771
1767
|
Title,
|
|
1772
1768
|
lazy,
|
|
1773
1769
|
transferOptions,
|