@faasjs/ant-design 0.0.3-beta.63 → 0.0.3-beta.64
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.js +755 -743
- package/dist/index.mjs +734 -717
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
1
21
|
// react-shim.js
|
|
2
22
|
import React from "react";
|
|
3
23
|
|
|
@@ -20,24 +40,17 @@ import { Modal } from "antd";
|
|
|
20
40
|
import { useState } from "react";
|
|
21
41
|
import { jsx } from "react/jsx-runtime";
|
|
22
42
|
function useModal(init) {
|
|
23
|
-
const [props, setProps] = useState({
|
|
43
|
+
const [props, setProps] = useState(__spreadValues({
|
|
24
44
|
open: false,
|
|
25
|
-
onCancel: () => setProps((prev) => ({
|
|
26
|
-
...prev,
|
|
45
|
+
onCancel: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
27
46
|
open: false
|
|
28
|
-
}))
|
|
29
|
-
|
|
30
|
-
});
|
|
47
|
+
}))
|
|
48
|
+
}, init));
|
|
31
49
|
return {
|
|
32
|
-
modal: /* @__PURE__ */ jsx(Modal, {
|
|
33
|
-
...props
|
|
34
|
-
}),
|
|
50
|
+
modal: /* @__PURE__ */ jsx(Modal, __spreadValues({}, props)),
|
|
35
51
|
modalProps: props,
|
|
36
52
|
setModalProps(changes) {
|
|
37
|
-
setProps((prev) => ({
|
|
38
|
-
...prev,
|
|
39
|
-
...changes
|
|
40
|
-
}));
|
|
53
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
41
54
|
}
|
|
42
55
|
};
|
|
43
56
|
}
|
|
@@ -47,24 +60,17 @@ import { Drawer } from "antd";
|
|
|
47
60
|
import { useState as useState2 } from "react";
|
|
48
61
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
49
62
|
function useDrawer(init) {
|
|
50
|
-
const [props, setProps] = useState2({
|
|
63
|
+
const [props, setProps] = useState2(__spreadValues({
|
|
51
64
|
open: false,
|
|
52
|
-
onClose: () => setProps((prev) => ({
|
|
53
|
-
...prev,
|
|
65
|
+
onClose: () => setProps((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
54
66
|
open: false
|
|
55
|
-
}))
|
|
56
|
-
|
|
57
|
-
});
|
|
67
|
+
}))
|
|
68
|
+
}, init));
|
|
58
69
|
return {
|
|
59
|
-
drawer: /* @__PURE__ */ jsx2(Drawer, {
|
|
60
|
-
...props
|
|
61
|
-
}),
|
|
70
|
+
drawer: /* @__PURE__ */ jsx2(Drawer, __spreadValues({}, props)),
|
|
62
71
|
drawerProps: props,
|
|
63
72
|
setDrawerProps(changes) {
|
|
64
|
-
setProps((prev) => ({
|
|
65
|
-
...prev,
|
|
66
|
-
...changes
|
|
67
|
-
}));
|
|
73
|
+
setProps((prev) => __spreadValues(__spreadValues({}, prev), changes));
|
|
68
74
|
}
|
|
69
75
|
};
|
|
70
76
|
}
|
|
@@ -86,9 +92,7 @@ function RoutesApp(props) {
|
|
|
86
92
|
setDrawerProps({ open: false });
|
|
87
93
|
setModalProps({ open: false });
|
|
88
94
|
}, [location]);
|
|
89
|
-
return /* @__PURE__ */ jsx3(Fragment, {
|
|
90
|
-
children: props.children
|
|
91
|
-
});
|
|
95
|
+
return /* @__PURE__ */ jsx3(Fragment, { children: props.children });
|
|
92
96
|
}
|
|
93
97
|
function App(props) {
|
|
94
98
|
const [messageApi, messageContextHolder] = message.useMessage();
|
|
@@ -109,30 +113,21 @@ function App(props) {
|
|
|
109
113
|
setDrawerProps
|
|
110
114
|
]
|
|
111
115
|
);
|
|
112
|
-
return /* @__PURE__ */ jsx3(
|
|
113
|
-
|
|
116
|
+
return /* @__PURE__ */ jsx3(
|
|
117
|
+
StyleProvider,
|
|
118
|
+
__spreadProps(__spreadValues({}, Object.assign(props.styleProviderProps || {}, {
|
|
114
119
|
hashPriority: "high",
|
|
115
120
|
transformers: [legacyLogicalPropertiesTransformer]
|
|
116
|
-
}),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
messageContextHolder,
|
|
125
|
-
notificationContextHolder,
|
|
126
|
-
modal,
|
|
127
|
-
drawer,
|
|
128
|
-
/* @__PURE__ */ jsx3(RoutesApp, {
|
|
129
|
-
children: props.children
|
|
130
|
-
})
|
|
131
|
-
]
|
|
132
|
-
})
|
|
133
|
-
})
|
|
121
|
+
})), {
|
|
122
|
+
children: /* @__PURE__ */ jsx3(ConfigProvider, __spreadProps(__spreadValues({}, props.configProviderProps), { children: /* @__PURE__ */ jsx3(AppContext.Provider, { value: memoizedContextValue, children: /* @__PURE__ */ jsxs(BrowserRouter, __spreadProps(__spreadValues({}, props.browserRouterProps), { children: [
|
|
123
|
+
messageContextHolder,
|
|
124
|
+
notificationContextHolder,
|
|
125
|
+
modal,
|
|
126
|
+
drawer,
|
|
127
|
+
/* @__PURE__ */ jsx3(RoutesApp, { children: props.children })
|
|
128
|
+
] })) }) }))
|
|
134
129
|
})
|
|
135
|
-
|
|
130
|
+
);
|
|
136
131
|
}
|
|
137
132
|
function useApp() {
|
|
138
133
|
return useContext(AppContext);
|
|
@@ -207,10 +202,7 @@ function ConfigProvider2({
|
|
|
207
202
|
} else
|
|
208
203
|
setValues(defaultsDeep(config, values));
|
|
209
204
|
}, []);
|
|
210
|
-
return /* @__PURE__ */ jsx4(ConfigContext.Provider, {
|
|
211
|
-
value: values,
|
|
212
|
-
children
|
|
213
|
-
});
|
|
205
|
+
return /* @__PURE__ */ jsx4(ConfigContext.Provider, { value: values, children });
|
|
214
206
|
}
|
|
215
207
|
function useConfigContext() {
|
|
216
208
|
return useContext2(ConfigContext);
|
|
@@ -220,10 +212,7 @@ function useConfigContext() {
|
|
|
220
212
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
221
213
|
function Blank(options) {
|
|
222
214
|
const { Blank: Blank2 } = useConfigContext();
|
|
223
|
-
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx5(Typography.Text, {
|
|
224
|
-
disabled: true,
|
|
225
|
-
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
226
|
-
}) : options.value;
|
|
215
|
+
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx5(Typography.Text, { disabled: true, children: (options == null ? void 0 : options.text) || Blank2.text }) : options.value;
|
|
227
216
|
}
|
|
228
217
|
|
|
229
218
|
// src/data.ts
|
|
@@ -261,55 +250,71 @@ import {
|
|
|
261
250
|
} from "antd";
|
|
262
251
|
import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
263
252
|
import {
|
|
264
|
-
cloneElement,
|
|
265
|
-
useEffect as
|
|
266
|
-
useState as
|
|
253
|
+
cloneElement as cloneElement2,
|
|
254
|
+
useEffect as useEffect4,
|
|
255
|
+
useState as useState5
|
|
267
256
|
} from "react";
|
|
268
257
|
|
|
269
|
-
// src/
|
|
270
|
-
import {
|
|
258
|
+
// ../react/src/index.tsx
|
|
259
|
+
import {
|
|
260
|
+
useState as useState4,
|
|
261
|
+
useEffect as useEffect3,
|
|
262
|
+
createElement,
|
|
263
|
+
cloneElement
|
|
264
|
+
} from "react";
|
|
265
|
+
var clients = {};
|
|
266
|
+
function getClient(domain) {
|
|
267
|
+
const client = clients[domain || Object.keys(clients)[0]];
|
|
268
|
+
if (!client)
|
|
269
|
+
throw Error("FaasReactClient is not initialized");
|
|
270
|
+
return client;
|
|
271
|
+
}
|
|
272
|
+
async function faas(action, params) {
|
|
273
|
+
return getClient().faas(action, params);
|
|
274
|
+
}
|
|
275
|
+
function FaasDataWrapper(props) {
|
|
276
|
+
const [client, setClient] = useState4();
|
|
277
|
+
useEffect3(() => {
|
|
278
|
+
if (client)
|
|
279
|
+
return;
|
|
280
|
+
setClient(getClient());
|
|
281
|
+
}, []);
|
|
282
|
+
if (!client)
|
|
283
|
+
return props.fallback || null;
|
|
284
|
+
return createElement(client.FaasDataWrapper, props);
|
|
285
|
+
}
|
|
271
286
|
|
|
272
287
|
// src/Loading.tsx
|
|
273
288
|
import { Spin } from "antd";
|
|
274
289
|
import { Fragment as Fragment2, jsx as jsx6 } from "react/jsx-runtime";
|
|
275
290
|
function Loading(props) {
|
|
276
291
|
if (props.loading === false)
|
|
277
|
-
return /* @__PURE__ */ jsx6(Fragment2, {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
...props.style || {},
|
|
283
|
-
...!props.size || props.size === "large" ? {
|
|
284
|
-
margin: "20vh auto",
|
|
285
|
-
textAlign: "center"
|
|
286
|
-
} : {}
|
|
287
|
-
},
|
|
288
|
-
children: /* @__PURE__ */ jsx6(Spin, {
|
|
289
|
-
size: props.size || "large"
|
|
290
|
-
})
|
|
291
|
-
});
|
|
292
|
+
return /* @__PURE__ */ jsx6(Fragment2, { children: props.children });
|
|
293
|
+
return /* @__PURE__ */ jsx6("div", { style: __spreadValues(__spreadValues({}, props.style || {}), !props.size || props.size === "large" ? {
|
|
294
|
+
margin: "20vh auto",
|
|
295
|
+
textAlign: "center"
|
|
296
|
+
} : {}), children: /* @__PURE__ */ jsx6(Spin, { size: props.size || "large" }) });
|
|
292
297
|
}
|
|
293
298
|
|
|
294
299
|
// src/FaasDataWrapper.tsx
|
|
295
300
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
296
|
-
function
|
|
297
|
-
return /* @__PURE__ */ jsx7(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
function FaasDataWrapper2(props) {
|
|
302
|
+
return /* @__PURE__ */ jsx7(
|
|
303
|
+
FaasDataWrapper,
|
|
304
|
+
__spreadValues({
|
|
305
|
+
fallback: props.loading || /* @__PURE__ */ jsx7(Loading, __spreadValues({}, props.loadingProps))
|
|
306
|
+
}, props)
|
|
307
|
+
);
|
|
303
308
|
}
|
|
304
309
|
|
|
305
310
|
// src/Description.tsx
|
|
306
311
|
import { Fragment as Fragment3, jsx as jsx8 } from "react/jsx-runtime";
|
|
307
312
|
function DescriptionItemContent(props) {
|
|
308
313
|
var _a;
|
|
309
|
-
const [computedProps, setComputedProps] =
|
|
310
|
-
|
|
314
|
+
const [computedProps, setComputedProps] = useState5();
|
|
315
|
+
useEffect4(() => {
|
|
311
316
|
var _a2, _b;
|
|
312
|
-
const propsCopy = {
|
|
317
|
+
const propsCopy = __spreadValues({}, props);
|
|
313
318
|
if (!propsCopy.item.title)
|
|
314
319
|
propsCopy.item.title = upperFirst2(propsCopy.item.id);
|
|
315
320
|
if (!propsCopy.item.type)
|
|
@@ -337,7 +342,7 @@ function DescriptionItemContent(props) {
|
|
|
337
342
|
return null;
|
|
338
343
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
339
344
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
340
|
-
return
|
|
345
|
+
return cloneElement2(
|
|
341
346
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
342
347
|
{
|
|
343
348
|
scene: "description",
|
|
@@ -346,15 +351,13 @@ function DescriptionItemContent(props) {
|
|
|
346
351
|
}
|
|
347
352
|
);
|
|
348
353
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
349
|
-
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
350
|
-
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
351
|
-
});
|
|
354
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description") });
|
|
352
355
|
else
|
|
353
356
|
throw Error(computedProps.item.type + " requires children or render");
|
|
354
357
|
if (computedProps.item.descriptionChildren === null)
|
|
355
358
|
return null;
|
|
356
359
|
if (computedProps.item.descriptionChildren)
|
|
357
|
-
return
|
|
360
|
+
return cloneElement2(computedProps.item.descriptionChildren, {
|
|
358
361
|
scene: "description",
|
|
359
362
|
value: computedProps.value,
|
|
360
363
|
values: computedProps.values
|
|
@@ -362,7 +365,7 @@ function DescriptionItemContent(props) {
|
|
|
362
365
|
if (computedProps.item.children === null)
|
|
363
366
|
return null;
|
|
364
367
|
if (computedProps.item.children)
|
|
365
|
-
return
|
|
368
|
+
return cloneElement2(computedProps.item.children, {
|
|
366
369
|
scene: "description",
|
|
367
370
|
value: computedProps.value,
|
|
368
371
|
values: computedProps.values
|
|
@@ -375,95 +378,107 @@ function DescriptionItemContent(props) {
|
|
|
375
378
|
return /* @__PURE__ */ jsx8(Blank, {});
|
|
376
379
|
switch (computedProps.item.type) {
|
|
377
380
|
case "string[]":
|
|
378
|
-
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
379
|
-
children: computedProps.value.join(", ")
|
|
380
|
-
});
|
|
381
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: computedProps.value.join(", ") });
|
|
381
382
|
case "number":
|
|
382
383
|
return computedProps.value || null;
|
|
383
384
|
case "number[]":
|
|
384
|
-
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
385
|
-
children: computedProps.value.join(", ")
|
|
386
|
-
});
|
|
385
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: computedProps.value.join(", ") });
|
|
387
386
|
case "boolean":
|
|
388
|
-
return computedProps.value ? /* @__PURE__ */ jsx8(CheckOutlined, {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
marginTop: "4px",
|
|
396
|
-
color: "#ff4d4f"
|
|
397
|
-
}
|
|
398
|
-
});
|
|
387
|
+
return computedProps.value ? /* @__PURE__ */ jsx8(CheckOutlined, { style: {
|
|
388
|
+
marginTop: "4px",
|
|
389
|
+
color: "#52c41a"
|
|
390
|
+
} }) : /* @__PURE__ */ jsx8(CloseOutlined, { style: {
|
|
391
|
+
marginTop: "4px",
|
|
392
|
+
color: "#ff4d4f"
|
|
393
|
+
} });
|
|
399
394
|
case "time":
|
|
400
|
-
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
401
|
-
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
402
|
-
});
|
|
395
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
|
|
403
396
|
case "date":
|
|
404
|
-
return /* @__PURE__ */ jsx8(Fragment3, {
|
|
405
|
-
children: computedProps.value.format("YYYY-MM-DD")
|
|
406
|
-
});
|
|
397
|
+
return /* @__PURE__ */ jsx8(Fragment3, { children: computedProps.value.format("YYYY-MM-DD") });
|
|
407
398
|
case "object":
|
|
408
399
|
if (!computedProps.value)
|
|
409
400
|
return /* @__PURE__ */ jsx8(Blank, {});
|
|
410
|
-
return /* @__PURE__ */ jsx8(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
401
|
+
return /* @__PURE__ */ jsx8(
|
|
402
|
+
Description,
|
|
403
|
+
{
|
|
404
|
+
items: computedProps.item.object,
|
|
405
|
+
dataSource: computedProps.value,
|
|
406
|
+
column: 1
|
|
407
|
+
}
|
|
408
|
+
);
|
|
415
409
|
case "object[]":
|
|
416
410
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
417
411
|
return /* @__PURE__ */ jsx8(Blank, {});
|
|
418
|
-
return /* @__PURE__ */ jsx8(Space, {
|
|
419
|
-
|
|
420
|
-
|
|
412
|
+
return /* @__PURE__ */ jsx8(Space, { direction: "vertical", children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx8(
|
|
413
|
+
Description,
|
|
414
|
+
{
|
|
421
415
|
items: computedProps.item.object,
|
|
422
416
|
dataSource: value,
|
|
423
417
|
column: 1
|
|
424
|
-
},
|
|
425
|
-
|
|
418
|
+
},
|
|
419
|
+
index
|
|
420
|
+
)) });
|
|
426
421
|
default:
|
|
427
422
|
return computedProps.value || null;
|
|
428
423
|
}
|
|
429
424
|
}
|
|
430
425
|
function Description(props) {
|
|
431
426
|
if (props.dataSource)
|
|
432
|
-
return /* @__PURE__ */ jsx8(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx8(Descriptions.Item, {
|
|
437
|
-
label: item.title || upperFirst2(item.id),
|
|
438
|
-
children: /* @__PURE__ */ jsx8(DescriptionItemContent, {
|
|
439
|
-
item,
|
|
440
|
-
value: props.dataSource[item.id],
|
|
441
|
-
values: props.dataSource,
|
|
442
|
-
extendTypes: props.extendTypes
|
|
443
|
-
})
|
|
444
|
-
}, item.id) : null;
|
|
445
|
-
}).filter(Boolean)
|
|
446
|
-
});
|
|
447
|
-
return /* @__PURE__ */ jsx8(FaasDataWrapper, {
|
|
448
|
-
render: ({ data }) => {
|
|
449
|
-
return /* @__PURE__ */ jsx8(Descriptions, {
|
|
450
|
-
...props,
|
|
451
|
-
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
427
|
+
return /* @__PURE__ */ jsx8(
|
|
428
|
+
Descriptions,
|
|
429
|
+
__spreadProps(__spreadValues({}, props), {
|
|
430
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
452
431
|
children: props.items.map((item) => {
|
|
453
|
-
return !item.if || item.if(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
item,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
432
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx8(
|
|
433
|
+
Descriptions.Item,
|
|
434
|
+
{
|
|
435
|
+
label: item.title || upperFirst2(item.id),
|
|
436
|
+
children: /* @__PURE__ */ jsx8(
|
|
437
|
+
DescriptionItemContent,
|
|
438
|
+
{
|
|
439
|
+
item,
|
|
440
|
+
value: props.dataSource[item.id],
|
|
441
|
+
values: props.dataSource,
|
|
442
|
+
extendTypes: props.extendTypes
|
|
443
|
+
}
|
|
444
|
+
)
|
|
445
|
+
},
|
|
446
|
+
item.id
|
|
447
|
+
) : null;
|
|
462
448
|
}).filter(Boolean)
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
449
|
+
})
|
|
450
|
+
);
|
|
451
|
+
return /* @__PURE__ */ jsx8(
|
|
452
|
+
FaasDataWrapper2,
|
|
453
|
+
__spreadValues({
|
|
454
|
+
render: ({ data }) => {
|
|
455
|
+
return /* @__PURE__ */ jsx8(
|
|
456
|
+
Descriptions,
|
|
457
|
+
__spreadProps(__spreadValues({}, props), {
|
|
458
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
459
|
+
children: props.items.map((item) => {
|
|
460
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ jsx8(
|
|
461
|
+
Descriptions.Item,
|
|
462
|
+
{
|
|
463
|
+
label: item.title || upperFirst2(item.id),
|
|
464
|
+
children: /* @__PURE__ */ jsx8(
|
|
465
|
+
DescriptionItemContent,
|
|
466
|
+
{
|
|
467
|
+
item,
|
|
468
|
+
value: data[item.id],
|
|
469
|
+
values: data,
|
|
470
|
+
extendTypes: props.extendTypes
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
},
|
|
474
|
+
item.id
|
|
475
|
+
) : null;
|
|
476
|
+
}).filter(Boolean)
|
|
477
|
+
})
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
}, props.faasData)
|
|
481
|
+
);
|
|
467
482
|
}
|
|
468
483
|
|
|
469
484
|
// src/ErrorBoundary.tsx
|
|
@@ -497,31 +512,30 @@ var ErrorBoundary = class extends Component {
|
|
|
497
512
|
if (error) {
|
|
498
513
|
if (this.props.onError)
|
|
499
514
|
return this.props.onError(error, info);
|
|
500
|
-
return /* @__PURE__ */ jsx9(
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
515
|
+
return /* @__PURE__ */ jsx9(
|
|
516
|
+
Alert,
|
|
517
|
+
{
|
|
518
|
+
type: "error",
|
|
519
|
+
message: errorMessage,
|
|
520
|
+
description: /* @__PURE__ */ jsx9("pre", { style: {
|
|
505
521
|
fontSize: "0.9em",
|
|
506
522
|
overflowX: "auto"
|
|
507
|
-
},
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
});
|
|
523
|
+
}, children: errorDescription })
|
|
524
|
+
}
|
|
525
|
+
);
|
|
511
526
|
}
|
|
512
527
|
return children;
|
|
513
528
|
}
|
|
514
529
|
};
|
|
515
530
|
|
|
516
531
|
// src/Form.tsx
|
|
517
|
-
import { faas } from "@faasjs/react";
|
|
518
532
|
import {
|
|
519
533
|
Button as Button2,
|
|
520
534
|
Form as AntdForm2
|
|
521
535
|
} from "antd";
|
|
522
536
|
import {
|
|
523
|
-
useEffect as
|
|
524
|
-
useState as
|
|
537
|
+
useEffect as useEffect6,
|
|
538
|
+
useState as useState7,
|
|
525
539
|
useCallback,
|
|
526
540
|
isValidElement
|
|
527
541
|
} from "react";
|
|
@@ -541,9 +555,9 @@ import {
|
|
|
541
555
|
} from "antd";
|
|
542
556
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
543
557
|
import {
|
|
544
|
-
cloneElement as
|
|
545
|
-
useEffect as
|
|
546
|
-
useState as
|
|
558
|
+
cloneElement as cloneElement3,
|
|
559
|
+
useEffect as useEffect5,
|
|
560
|
+
useState as useState6
|
|
547
561
|
} from "react";
|
|
548
562
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
549
563
|
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -595,12 +609,12 @@ function processProps(propsCopy, config) {
|
|
|
595
609
|
}
|
|
596
610
|
function FormItem(props) {
|
|
597
611
|
var _a;
|
|
598
|
-
const [computedProps, setComputedProps] =
|
|
599
|
-
const [extendTypes, setExtendTypes] =
|
|
612
|
+
const [computedProps, setComputedProps] = useState6();
|
|
613
|
+
const [extendTypes, setExtendTypes] = useState6();
|
|
600
614
|
const { common: common2 } = useConfigContext();
|
|
601
|
-
const [hidden, setHidden] =
|
|
602
|
-
|
|
603
|
-
const propsCopy = {
|
|
615
|
+
const [hidden, setHidden] = useState6(props.hidden || false);
|
|
616
|
+
useEffect5(() => {
|
|
617
|
+
const propsCopy = __spreadValues({}, props);
|
|
604
618
|
if (propsCopy.extendTypes) {
|
|
605
619
|
setExtendTypes(propsCopy.extendTypes);
|
|
606
620
|
delete propsCopy.extendTypes;
|
|
@@ -623,290 +637,231 @@ function FormItem(props) {
|
|
|
623
637
|
if (!computedProps)
|
|
624
638
|
return null;
|
|
625
639
|
if (hidden)
|
|
626
|
-
return /* @__PURE__ */ jsx10(
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
hidden: true
|
|
640
|
+
return /* @__PURE__ */ jsx10(
|
|
641
|
+
AntdForm.Item,
|
|
642
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
643
|
+
noStyle: true,
|
|
644
|
+
rules: [],
|
|
645
|
+
children: /* @__PURE__ */ jsx10(Input, { hidden: true })
|
|
632
646
|
})
|
|
633
|
-
|
|
647
|
+
);
|
|
634
648
|
if (extendTypes && extendTypes[computedProps.type])
|
|
635
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
636
|
-
...computedProps,
|
|
637
|
-
children: extendTypes[computedProps.type].children
|
|
638
|
-
});
|
|
649
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: extendTypes[computedProps.type].children }));
|
|
639
650
|
if (computedProps.formChildren === null)
|
|
640
651
|
return null;
|
|
641
652
|
if (computedProps.formChildren)
|
|
642
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
643
|
-
...computedProps,
|
|
644
|
-
children: cloneElement2(computedProps.formChildren, { scene: "form" })
|
|
645
|
-
});
|
|
653
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement3(computedProps.formChildren, { scene: "form" }) }));
|
|
646
654
|
if (computedProps.children === null)
|
|
647
655
|
return null;
|
|
648
656
|
if (computedProps.children)
|
|
649
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
650
|
-
...computedProps,
|
|
651
|
-
children: cloneElement2(computedProps.children, { scene: "form" })
|
|
652
|
-
});
|
|
657
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: cloneElement3(computedProps.children, { scene: "form" }) }));
|
|
653
658
|
if (computedProps.formRender)
|
|
654
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
655
|
-
...computedProps,
|
|
656
|
-
children: computedProps.formRender(null, null, 0, "form")
|
|
657
|
-
});
|
|
659
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.formRender(null, null, 0, "form") }));
|
|
658
660
|
if (computedProps.render)
|
|
659
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
660
|
-
...computedProps,
|
|
661
|
-
children: computedProps.render(null, null, 0, "form")
|
|
662
|
-
});
|
|
661
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.render(null, null, 0, "form") }));
|
|
663
662
|
switch (computedProps.type) {
|
|
664
663
|
case "string":
|
|
665
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
666
|
-
...computedProps,
|
|
667
|
-
children: computedProps.options ? /* @__PURE__ */ jsx10(Select, {
|
|
668
|
-
...computedProps.input
|
|
669
|
-
}) : /* @__PURE__ */ jsx10(Input, {
|
|
670
|
-
...computedProps.input
|
|
671
|
-
})
|
|
672
|
-
});
|
|
664
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ jsx10(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ jsx10(Input, __spreadValues({}, computedProps.input)) }));
|
|
673
665
|
case "string[]":
|
|
674
666
|
if (computedProps.options)
|
|
675
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
mode: "multiple"
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
children: [
|
|
689
|
-
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
690
|
-
className: "ant-form-item-label",
|
|
691
|
-
children: /* @__PURE__ */ jsx10("label", {
|
|
692
|
-
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
693
|
-
children: computedProps.label
|
|
694
|
-
})
|
|
695
|
-
}),
|
|
667
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx10(
|
|
668
|
+
Select,
|
|
669
|
+
__spreadValues({
|
|
670
|
+
mode: "multiple"
|
|
671
|
+
}, computedProps.input)
|
|
672
|
+
) }));
|
|
673
|
+
return /* @__PURE__ */ jsx10(
|
|
674
|
+
AntdForm.List,
|
|
675
|
+
{
|
|
676
|
+
name: computedProps.name,
|
|
677
|
+
rules: computedProps.rules,
|
|
678
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
679
|
+
var _a2;
|
|
680
|
+
return /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
681
|
+
computedProps.label && /* @__PURE__ */ jsx10("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx10("label", { className: computedProps.rules.find((r) => r.required) && "ant-form-item-required", children: computedProps.label }) }),
|
|
696
682
|
fields.map((field) => {
|
|
697
683
|
var _a3;
|
|
698
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
699
|
-
|
|
684
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, { children: /* @__PURE__ */ jsxs2(
|
|
685
|
+
Row,
|
|
686
|
+
{
|
|
700
687
|
gutter: 24,
|
|
701
688
|
style: { flexFlow: "row nowrap" },
|
|
702
689
|
children: [
|
|
703
|
-
/* @__PURE__ */ jsx10(Col, {
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
...field,
|
|
690
|
+
/* @__PURE__ */ jsx10(Col, { span: 23, children: /* @__PURE__ */ jsx10(
|
|
691
|
+
AntdForm.Item,
|
|
692
|
+
__spreadProps(__spreadValues({}, field), {
|
|
707
693
|
noStyle: true,
|
|
708
|
-
children: /* @__PURE__ */ jsx10(Input, {
|
|
709
|
-
...computedProps.input
|
|
710
|
-
})
|
|
694
|
+
children: /* @__PURE__ */ jsx10(Input, __spreadValues({}, computedProps.input))
|
|
711
695
|
})
|
|
712
|
-
}),
|
|
713
|
-
/* @__PURE__ */ jsx10(Col, {
|
|
714
|
-
|
|
715
|
-
|
|
696
|
+
) }),
|
|
697
|
+
/* @__PURE__ */ jsx10(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx10(
|
|
698
|
+
Button,
|
|
699
|
+
{
|
|
716
700
|
danger: true,
|
|
717
701
|
type: "link",
|
|
718
702
|
style: { float: "right" },
|
|
719
703
|
icon: /* @__PURE__ */ jsx10(MinusCircleOutlined, {}),
|
|
720
704
|
onClick: () => remove(field.name)
|
|
721
|
-
}
|
|
722
|
-
})
|
|
705
|
+
}
|
|
706
|
+
) })
|
|
723
707
|
]
|
|
724
|
-
}
|
|
725
|
-
}, field.key);
|
|
708
|
+
}
|
|
709
|
+
) }, field.key);
|
|
726
710
|
}),
|
|
727
|
-
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
728
|
-
|
|
729
|
-
|
|
711
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, { children: [
|
|
712
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx10(
|
|
713
|
+
Button,
|
|
714
|
+
{
|
|
730
715
|
type: "dashed",
|
|
731
716
|
block: true,
|
|
732
717
|
onClick: () => add(),
|
|
733
718
|
icon: /* @__PURE__ */ jsx10(PlusOutlined, {})
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
})
|
|
742
|
-
]
|
|
743
|
-
})
|
|
744
|
-
]
|
|
745
|
-
});
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
computedProps.extra && /* @__PURE__ */ jsx10("div", { className: "ant-form-item-extra", children: computedProps.extra }),
|
|
722
|
+
/* @__PURE__ */ jsx10(AntdForm.ErrorList, { errors })
|
|
723
|
+
] })
|
|
724
|
+
] });
|
|
725
|
+
}
|
|
746
726
|
}
|
|
747
|
-
|
|
727
|
+
);
|
|
748
728
|
case "number":
|
|
749
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
...computedProps.input
|
|
756
|
-
})
|
|
757
|
-
});
|
|
729
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: computedProps.options ? /* @__PURE__ */ jsx10(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ jsx10(
|
|
730
|
+
InputNumber,
|
|
731
|
+
__spreadValues({
|
|
732
|
+
style: { width: "100%" }
|
|
733
|
+
}, computedProps.input)
|
|
734
|
+
) }));
|
|
758
735
|
case "number[]":
|
|
759
736
|
if (computedProps.options)
|
|
760
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
mode: "multiple"
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
children: [
|
|
774
|
-
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
775
|
-
className: "ant-form-item-label",
|
|
776
|
-
children: /* @__PURE__ */ jsx10("label", {
|
|
777
|
-
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
778
|
-
children: computedProps.label
|
|
779
|
-
})
|
|
780
|
-
}),
|
|
737
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx10(
|
|
738
|
+
Select,
|
|
739
|
+
__spreadValues({
|
|
740
|
+
mode: "multiple"
|
|
741
|
+
}, computedProps.input)
|
|
742
|
+
) }));
|
|
743
|
+
return /* @__PURE__ */ jsx10(
|
|
744
|
+
AntdForm.List,
|
|
745
|
+
{
|
|
746
|
+
name: computedProps.name,
|
|
747
|
+
rules: computedProps.rules,
|
|
748
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
749
|
+
var _a2, _b;
|
|
750
|
+
return /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
751
|
+
computedProps.label && /* @__PURE__ */ jsx10("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx10("label", { className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
781
752
|
fields.map((field) => {
|
|
782
753
|
var _a3;
|
|
783
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
784
|
-
|
|
754
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, { children: /* @__PURE__ */ jsxs2(
|
|
755
|
+
Row,
|
|
756
|
+
{
|
|
785
757
|
gutter: 24,
|
|
786
758
|
style: { flexFlow: "row nowrap" },
|
|
787
759
|
children: [
|
|
788
|
-
/* @__PURE__ */ jsx10(Col, {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
...field,
|
|
760
|
+
/* @__PURE__ */ jsx10(Col, { span: 23, children: /* @__PURE__ */ jsx10(
|
|
761
|
+
AntdForm.Item,
|
|
762
|
+
__spreadProps(__spreadValues({}, field), {
|
|
792
763
|
noStyle: true,
|
|
793
|
-
children: /* @__PURE__ */ jsx10(
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
764
|
+
children: /* @__PURE__ */ jsx10(
|
|
765
|
+
InputNumber,
|
|
766
|
+
__spreadValues({
|
|
767
|
+
style: { width: "100%" }
|
|
768
|
+
}, computedProps.input)
|
|
769
|
+
)
|
|
797
770
|
})
|
|
798
|
-
}),
|
|
799
|
-
/* @__PURE__ */ jsx10(Col, {
|
|
800
|
-
|
|
801
|
-
|
|
771
|
+
) }),
|
|
772
|
+
/* @__PURE__ */ jsx10(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx10(
|
|
773
|
+
Button,
|
|
774
|
+
{
|
|
802
775
|
danger: true,
|
|
803
776
|
type: "link",
|
|
804
777
|
style: { float: "right" },
|
|
805
778
|
icon: /* @__PURE__ */ jsx10(MinusCircleOutlined, {}),
|
|
806
779
|
onClick: () => remove(field.name)
|
|
807
|
-
}
|
|
808
|
-
})
|
|
780
|
+
}
|
|
781
|
+
) })
|
|
809
782
|
]
|
|
810
|
-
}
|
|
811
|
-
}, field.key);
|
|
783
|
+
}
|
|
784
|
+
) }, field.key);
|
|
812
785
|
}),
|
|
813
|
-
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
814
|
-
|
|
815
|
-
|
|
786
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, { children: [
|
|
787
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx10(
|
|
788
|
+
Button,
|
|
789
|
+
{
|
|
816
790
|
type: "dashed",
|
|
817
791
|
block: true,
|
|
818
792
|
onClick: () => add(),
|
|
819
793
|
icon: /* @__PURE__ */ jsx10(PlusOutlined, {})
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
})
|
|
828
|
-
]
|
|
829
|
-
})
|
|
830
|
-
]
|
|
831
|
-
});
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
computedProps.extra && /* @__PURE__ */ jsx10("div", { className: "ant-form-item-extra", children: computedProps.extra }),
|
|
797
|
+
/* @__PURE__ */ jsx10(AntdForm.ErrorList, { errors })
|
|
798
|
+
] })
|
|
799
|
+
] });
|
|
800
|
+
}
|
|
832
801
|
}
|
|
833
|
-
|
|
802
|
+
);
|
|
834
803
|
case "boolean":
|
|
835
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
836
|
-
...computedProps,
|
|
837
|
-
children: /* @__PURE__ */ jsx10(Switch, {
|
|
838
|
-
...computedProps.input
|
|
839
|
-
})
|
|
840
|
-
});
|
|
804
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx10(Switch, __spreadValues({}, computedProps.input)) }));
|
|
841
805
|
case "date":
|
|
842
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
843
|
-
...computedProps,
|
|
844
|
-
children: /* @__PURE__ */ jsx10(DatePicker, {
|
|
845
|
-
...computedProps.input
|
|
846
|
-
})
|
|
847
|
-
});
|
|
806
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx10(DatePicker, __spreadValues({}, computedProps.input)) }));
|
|
848
807
|
case "time":
|
|
849
|
-
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
850
|
-
...computedProps,
|
|
851
|
-
children: /* @__PURE__ */ jsx10(TimePicker, {
|
|
852
|
-
...computedProps.input
|
|
853
|
-
})
|
|
854
|
-
});
|
|
808
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, __spreadProps(__spreadValues({}, computedProps), { children: /* @__PURE__ */ jsx10(TimePicker, __spreadValues({}, computedProps.input)) }));
|
|
855
809
|
case "object":
|
|
856
|
-
return /* @__PURE__ */ jsxs2(Fragment4, {
|
|
857
|
-
children:
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}),
|
|
865
|
-
computedProps.object.map((o) => /* @__PURE__ */ jsx10(FormItem, {
|
|
866
|
-
...o
|
|
867
|
-
}, o.id))
|
|
868
|
-
]
|
|
869
|
-
});
|
|
810
|
+
return /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
811
|
+
computedProps.label && /* @__PURE__ */ jsx10("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx10("label", { className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required", children: computedProps.label }) }),
|
|
812
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx10(
|
|
813
|
+
FormItem,
|
|
814
|
+
__spreadValues({}, o),
|
|
815
|
+
o.id
|
|
816
|
+
))
|
|
817
|
+
] });
|
|
870
818
|
case "object[]":
|
|
871
|
-
return /* @__PURE__ */ jsx10(
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
819
|
+
return /* @__PURE__ */ jsx10(
|
|
820
|
+
AntdForm.List,
|
|
821
|
+
{
|
|
822
|
+
name: computedProps.name,
|
|
823
|
+
rules: computedProps.rules,
|
|
824
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs2(Fragment4, { children: [
|
|
825
|
+
fields.map((field) => /* @__PURE__ */ jsxs2(
|
|
826
|
+
AntdForm.Item,
|
|
827
|
+
{
|
|
828
|
+
style: { marginBottom: 0 },
|
|
829
|
+
children: [
|
|
830
|
+
/* @__PURE__ */ jsx10("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxs2("label", { children: [
|
|
831
|
+
computedProps.label,
|
|
832
|
+
" ",
|
|
833
|
+
field.name + 1,
|
|
834
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx10(
|
|
835
|
+
Button,
|
|
836
|
+
{
|
|
887
837
|
danger: true,
|
|
888
838
|
type: "link",
|
|
889
839
|
onClick: () => remove(field.name),
|
|
890
840
|
children: common2.delete
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
})
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
841
|
+
}
|
|
842
|
+
)
|
|
843
|
+
] }) }),
|
|
844
|
+
/* @__PURE__ */ jsx10(Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsx10(
|
|
845
|
+
Col,
|
|
846
|
+
{
|
|
847
|
+
span: o.col || 24,
|
|
848
|
+
children: /* @__PURE__ */ jsx10(
|
|
849
|
+
FormItem,
|
|
850
|
+
__spreadProps(__spreadValues({}, o), {
|
|
851
|
+
name: [field.name, o.id]
|
|
852
|
+
})
|
|
853
|
+
)
|
|
854
|
+
},
|
|
855
|
+
o.id
|
|
856
|
+
)) })
|
|
857
|
+
]
|
|
858
|
+
},
|
|
859
|
+
field.key
|
|
860
|
+
)),
|
|
861
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, { children: [
|
|
862
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs2(
|
|
863
|
+
Button,
|
|
864
|
+
{
|
|
910
865
|
type: "dashed",
|
|
911
866
|
block: true,
|
|
912
867
|
onClick: () => add(),
|
|
@@ -916,19 +871,14 @@ function FormItem(props) {
|
|
|
916
871
|
" ",
|
|
917
872
|
computedProps.label
|
|
918
873
|
]
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
]
|
|
928
|
-
})
|
|
929
|
-
]
|
|
930
|
-
})
|
|
931
|
-
});
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
computedProps.extra && /* @__PURE__ */ jsx10("div", { className: "ant-form-item-extra", children: computedProps.extra }),
|
|
877
|
+
/* @__PURE__ */ jsx10(AntdForm.ErrorList, { errors })
|
|
878
|
+
] })
|
|
879
|
+
] })
|
|
880
|
+
}
|
|
881
|
+
);
|
|
932
882
|
default:
|
|
933
883
|
return null;
|
|
934
884
|
}
|
|
@@ -939,18 +889,17 @@ FormItem.useStatus = AntdForm.Item.useStatus;
|
|
|
939
889
|
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
940
890
|
function Form(props) {
|
|
941
891
|
var _a, _b;
|
|
942
|
-
const [loading, setLoading] =
|
|
943
|
-
const [computedProps, setComputedProps] =
|
|
892
|
+
const [loading, setLoading] = useState7(false);
|
|
893
|
+
const [computedProps, setComputedProps] = useState7();
|
|
944
894
|
const config = useConfigContext();
|
|
945
|
-
const [extendTypes, setExtendTypes] =
|
|
895
|
+
const [extendTypes, setExtendTypes] = useState7();
|
|
946
896
|
const [form] = AntdForm2.useForm(props.form);
|
|
947
|
-
const [initialValues, setInitialValues] =
|
|
948
|
-
|
|
897
|
+
const [initialValues, setInitialValues] = useState7(props.initialValues);
|
|
898
|
+
useEffect6(() => {
|
|
949
899
|
var _a2, _b2, _c;
|
|
950
|
-
const propsCopy = {
|
|
951
|
-
...props,
|
|
900
|
+
const propsCopy = __spreadProps(__spreadValues({}, props), {
|
|
952
901
|
form
|
|
953
|
-
};
|
|
902
|
+
});
|
|
954
903
|
if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
|
|
955
904
|
for (const key in propsCopy.initialValues) {
|
|
956
905
|
propsCopy.initialValues[key] = transferValue(
|
|
@@ -974,10 +923,7 @@ function Form(props) {
|
|
|
974
923
|
setLoading(true);
|
|
975
924
|
try {
|
|
976
925
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
977
|
-
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
978
|
-
...values2,
|
|
979
|
-
...propsCopy.submit.to.params
|
|
980
|
-
} : values2));
|
|
926
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values2), propsCopy.submit.to.params) : values2));
|
|
981
927
|
} else
|
|
982
928
|
await props.onFinish(values);
|
|
983
929
|
} catch (error) {
|
|
@@ -988,10 +934,7 @@ function Form(props) {
|
|
|
988
934
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
989
935
|
propsCopy.onFinish = async (values) => {
|
|
990
936
|
setLoading(true);
|
|
991
|
-
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
992
|
-
...values,
|
|
993
|
-
...propsCopy.submit.to.params
|
|
994
|
-
} : values).then((result) => {
|
|
937
|
+
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? __spreadValues(__spreadValues({}, values), propsCopy.submit.to.params) : values).then((result) => {
|
|
995
938
|
if (propsCopy.submit.to.then)
|
|
996
939
|
propsCopy.submit.to.then(result);
|
|
997
940
|
return result;
|
|
@@ -1025,7 +968,7 @@ function Form(props) {
|
|
|
1025
968
|
item.onValueChange(changedValues[key], allValues, form);
|
|
1026
969
|
}
|
|
1027
970
|
}, [computedProps]);
|
|
1028
|
-
|
|
971
|
+
useEffect6(() => {
|
|
1029
972
|
if (!initialValues)
|
|
1030
973
|
return;
|
|
1031
974
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -1034,25 +977,33 @@ function Form(props) {
|
|
|
1034
977
|
}, [computedProps]);
|
|
1035
978
|
if (!computedProps)
|
|
1036
979
|
return null;
|
|
1037
|
-
return /* @__PURE__ */ jsxs3(
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
980
|
+
return /* @__PURE__ */ jsxs3(
|
|
981
|
+
AntdForm2,
|
|
982
|
+
__spreadProps(__spreadValues({}, computedProps), {
|
|
983
|
+
onValuesChange,
|
|
984
|
+
children: [
|
|
985
|
+
computedProps.beforeItems,
|
|
986
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx11(
|
|
987
|
+
FormItem,
|
|
988
|
+
__spreadProps(__spreadValues({}, item), {
|
|
989
|
+
extendTypes
|
|
990
|
+
}),
|
|
991
|
+
item.id
|
|
992
|
+
)),
|
|
993
|
+
computedProps.children,
|
|
994
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx11(
|
|
995
|
+
Button2,
|
|
996
|
+
{
|
|
997
|
+
htmlType: "submit",
|
|
998
|
+
type: "primary",
|
|
999
|
+
loading,
|
|
1000
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
1001
|
+
}
|
|
1002
|
+
),
|
|
1003
|
+
computedProps.footer
|
|
1004
|
+
]
|
|
1005
|
+
})
|
|
1006
|
+
);
|
|
1056
1007
|
}
|
|
1057
1008
|
Form.useForm = AntdForm2.useForm;
|
|
1058
1009
|
Form.useFormInstance = AntdForm2.useFormInstance;
|
|
@@ -1069,11 +1020,9 @@ import { jsx as jsx12 } from "react/jsx-runtime";
|
|
|
1069
1020
|
function Link(props) {
|
|
1070
1021
|
var _a, _b, _c, _d;
|
|
1071
1022
|
const { Link: Link2 } = useConfigContext();
|
|
1072
|
-
let style = {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
...props.style
|
|
1076
|
-
};
|
|
1023
|
+
let style = __spreadValues(__spreadProps(__spreadValues({}, Link2.style || {}), {
|
|
1024
|
+
cursor: "pointer"
|
|
1025
|
+
}), props.style);
|
|
1077
1026
|
if (props.block)
|
|
1078
1027
|
style = Object.assign({
|
|
1079
1028
|
display: "block",
|
|
@@ -1081,36 +1030,49 @@ function Link(props) {
|
|
|
1081
1030
|
}, style);
|
|
1082
1031
|
if (props.href.startsWith("http")) {
|
|
1083
1032
|
if (props.button)
|
|
1084
|
-
return /* @__PURE__ */ jsx12(
|
|
1085
|
-
|
|
1033
|
+
return /* @__PURE__ */ jsx12(
|
|
1034
|
+
Button3,
|
|
1035
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
1036
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
1037
|
+
style,
|
|
1038
|
+
href: props.href,
|
|
1039
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
1040
|
+
})
|
|
1041
|
+
);
|
|
1042
|
+
return /* @__PURE__ */ jsx12(
|
|
1043
|
+
"a",
|
|
1044
|
+
{
|
|
1045
|
+
href: props.href,
|
|
1086
1046
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
1087
1047
|
style,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
return /* @__PURE__ */ jsx12("a", {
|
|
1092
|
-
href: props.href,
|
|
1093
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
1094
|
-
style,
|
|
1095
|
-
children: (_b = props.text) != null ? _b : props.children
|
|
1096
|
-
});
|
|
1048
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1097
1051
|
}
|
|
1098
1052
|
if (props.button)
|
|
1099
|
-
return /* @__PURE__ */ jsx12(
|
|
1053
|
+
return /* @__PURE__ */ jsx12(
|
|
1054
|
+
RouterLink,
|
|
1055
|
+
{
|
|
1056
|
+
to: props.href,
|
|
1057
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1058
|
+
children: /* @__PURE__ */ jsx12(
|
|
1059
|
+
Button3,
|
|
1060
|
+
__spreadProps(__spreadValues({}, props.button), {
|
|
1061
|
+
style,
|
|
1062
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
1063
|
+
})
|
|
1064
|
+
)
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
return /* @__PURE__ */ jsx12(
|
|
1068
|
+
RouterLink,
|
|
1069
|
+
{
|
|
1100
1070
|
to: props.href,
|
|
1101
1071
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
})
|
|
1107
|
-
});
|
|
1108
|
-
return /* @__PURE__ */ jsx12(RouterLink, {
|
|
1109
|
-
to: props.href,
|
|
1110
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1111
|
-
style,
|
|
1112
|
-
children: (_d = props.text) != null ? _d : props.children
|
|
1113
|
-
});
|
|
1072
|
+
style,
|
|
1073
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
1074
|
+
}
|
|
1075
|
+
);
|
|
1114
1076
|
}
|
|
1115
1077
|
|
|
1116
1078
|
// src/Routers.tsx
|
|
@@ -1126,45 +1088,46 @@ import { lazy } from "react";
|
|
|
1126
1088
|
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1127
1089
|
function PageNotFound() {
|
|
1128
1090
|
const config = useConfigContext();
|
|
1129
|
-
return /* @__PURE__ */ jsx13(
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1091
|
+
return /* @__PURE__ */ jsx13(
|
|
1092
|
+
Result,
|
|
1093
|
+
{
|
|
1094
|
+
status: "404",
|
|
1095
|
+
title: config.common.pageNotFound
|
|
1096
|
+
}
|
|
1097
|
+
);
|
|
1133
1098
|
}
|
|
1134
1099
|
function Routes(props) {
|
|
1135
|
-
return /* @__PURE__ */ jsxs4(OriginRoutes, {
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
element: r.element || /* @__PURE__ */ jsx13(Suspense, {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
children: /* @__PURE__ */ jsx13(r.page, {})
|
|
1147
|
-
})
|
|
1148
|
-
}, r.path)),
|
|
1149
|
-
/* @__PURE__ */ jsx13(Route, {
|
|
1100
|
+
return /* @__PURE__ */ jsxs4(OriginRoutes, { children: [
|
|
1101
|
+
props.routes.map((r) => /* @__PURE__ */ jsx13(
|
|
1102
|
+
Route,
|
|
1103
|
+
__spreadProps(__spreadValues({}, r), {
|
|
1104
|
+
element: r.element || /* @__PURE__ */ jsx13(Suspense, { fallback: props.fallback || /* @__PURE__ */ jsx13("div", { style: { padding: "24px" }, children: /* @__PURE__ */ jsx13(Skeleton, { active: true }) }), children: /* @__PURE__ */ jsx13(r.page, {}) })
|
|
1105
|
+
}),
|
|
1106
|
+
r.path
|
|
1107
|
+
)),
|
|
1108
|
+
/* @__PURE__ */ jsx13(
|
|
1109
|
+
Route,
|
|
1110
|
+
{
|
|
1150
1111
|
path: "*",
|
|
1151
1112
|
element: props.notFound || /* @__PURE__ */ jsx13(PageNotFound, {})
|
|
1152
|
-
},
|
|
1153
|
-
|
|
1154
|
-
|
|
1113
|
+
},
|
|
1114
|
+
"*"
|
|
1115
|
+
)
|
|
1116
|
+
] });
|
|
1155
1117
|
}
|
|
1156
1118
|
|
|
1157
1119
|
// src/Table.tsx
|
|
1158
1120
|
import {
|
|
1159
|
-
useState as
|
|
1160
|
-
useEffect as
|
|
1161
|
-
cloneElement as
|
|
1121
|
+
useState as useState8,
|
|
1122
|
+
useEffect as useEffect7,
|
|
1123
|
+
cloneElement as cloneElement4
|
|
1162
1124
|
} from "react";
|
|
1163
1125
|
import {
|
|
1164
1126
|
Table as AntdTable,
|
|
1165
1127
|
Radio,
|
|
1166
1128
|
Input as Input2,
|
|
1167
|
-
Select as Select2
|
|
1129
|
+
Select as Select2,
|
|
1130
|
+
DatePicker as DatePicker2
|
|
1168
1131
|
} from "antd";
|
|
1169
1132
|
import dayjs2 from "dayjs";
|
|
1170
1133
|
import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
|
|
@@ -1199,9 +1162,9 @@ function processValue(item, value) {
|
|
|
1199
1162
|
return value;
|
|
1200
1163
|
}
|
|
1201
1164
|
function Table(props) {
|
|
1202
|
-
const [columns, setColumns] =
|
|
1165
|
+
const [columns, setColumns] = useState8();
|
|
1203
1166
|
const { common: common2 } = useConfigContext();
|
|
1204
|
-
|
|
1167
|
+
useEffect7(() => {
|
|
1205
1168
|
var _a;
|
|
1206
1169
|
for (const item of props.items) {
|
|
1207
1170
|
if (!item.key)
|
|
@@ -1225,7 +1188,7 @@ function Table(props) {
|
|
|
1225
1188
|
if (item.tableChildren === null)
|
|
1226
1189
|
item.render = () => null;
|
|
1227
1190
|
else if (item.tableChildren)
|
|
1228
|
-
item.render = (value, values) =>
|
|
1191
|
+
item.render = (value, values) => cloneElement4(
|
|
1229
1192
|
item.tableChildren,
|
|
1230
1193
|
{
|
|
1231
1194
|
scene: "table",
|
|
@@ -1236,7 +1199,7 @@ function Table(props) {
|
|
|
1236
1199
|
else if (item.children === null)
|
|
1237
1200
|
item.render = () => null;
|
|
1238
1201
|
else if (item.children)
|
|
1239
|
-
item.render = (value, values) =>
|
|
1202
|
+
item.render = (value, values) => cloneElement4(
|
|
1240
1203
|
item.children,
|
|
1241
1204
|
{
|
|
1242
1205
|
scene: "table",
|
|
@@ -1246,7 +1209,7 @@ function Table(props) {
|
|
|
1246
1209
|
);
|
|
1247
1210
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1248
1211
|
if (props.extendTypes[item.type].children)
|
|
1249
|
-
item.render = (value, values) =>
|
|
1212
|
+
item.render = (value, values) => cloneElement4(
|
|
1250
1213
|
props.extendTypes[item.type].children,
|
|
1251
1214
|
{
|
|
1252
1215
|
scene: "table",
|
|
@@ -1266,11 +1229,11 @@ function Table(props) {
|
|
|
1266
1229
|
item.render = (value) => processValue(item, value);
|
|
1267
1230
|
if (!item.onFilter)
|
|
1268
1231
|
item.onFilter = (value, row) => {
|
|
1269
|
-
if (value
|
|
1232
|
+
if (!value || isNil2(value))
|
|
1270
1233
|
return true;
|
|
1271
|
-
if (
|
|
1234
|
+
if (isNil2(row[item.id]))
|
|
1272
1235
|
return false;
|
|
1273
|
-
return row[item.id].toLowerCase().includes(value.toLowerCase());
|
|
1236
|
+
return row[item.id].trim().toLowerCase().includes(value.trim().toLowerCase());
|
|
1274
1237
|
};
|
|
1275
1238
|
if (item.filterDropdown === false || item.filterDropdown)
|
|
1276
1239
|
break;
|
|
@@ -1279,19 +1242,22 @@ function Table(props) {
|
|
|
1279
1242
|
setSelectedKeys,
|
|
1280
1243
|
confirm,
|
|
1281
1244
|
clearFilters
|
|
1282
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1245
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1246
|
+
Input2.Search,
|
|
1247
|
+
{
|
|
1248
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1249
|
+
allowClear: true,
|
|
1250
|
+
onSearch: (v) => {
|
|
1251
|
+
if (v) {
|
|
1252
|
+
setSelectedKeys([v]);
|
|
1253
|
+
} else {
|
|
1254
|
+
setSelectedKeys([]);
|
|
1255
|
+
clearFilters();
|
|
1256
|
+
}
|
|
1257
|
+
confirm();
|
|
1291
1258
|
}
|
|
1292
|
-
confirm();
|
|
1293
1259
|
}
|
|
1294
|
-
|
|
1260
|
+
);
|
|
1295
1261
|
break;
|
|
1296
1262
|
case "string[]":
|
|
1297
1263
|
if (!item.render)
|
|
@@ -1302,7 +1268,7 @@ function Table(props) {
|
|
|
1302
1268
|
return true;
|
|
1303
1269
|
if (!row[item.id] || !row[item.id].length || !value)
|
|
1304
1270
|
return false;
|
|
1305
|
-
return row[item.id].some((v) => v.toLowerCase().includes(value.toLowerCase()));
|
|
1271
|
+
return row[item.id].some((v) => v.trim().toLowerCase().includes(value.trim().toLowerCase()));
|
|
1306
1272
|
};
|
|
1307
1273
|
if (item.filterDropdown === false || item.filterDropdown)
|
|
1308
1274
|
break;
|
|
@@ -1311,19 +1277,22 @@ function Table(props) {
|
|
|
1311
1277
|
setSelectedKeys,
|
|
1312
1278
|
confirm,
|
|
1313
1279
|
clearFilters
|
|
1314
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1280
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1281
|
+
Input2.Search,
|
|
1282
|
+
{
|
|
1283
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1284
|
+
allowClear: true,
|
|
1285
|
+
onSearch: (v) => {
|
|
1286
|
+
if (v) {
|
|
1287
|
+
setSelectedKeys([v]);
|
|
1288
|
+
} else {
|
|
1289
|
+
setSelectedKeys([]);
|
|
1290
|
+
clearFilters();
|
|
1291
|
+
}
|
|
1292
|
+
confirm();
|
|
1323
1293
|
}
|
|
1324
|
-
confirm();
|
|
1325
1294
|
}
|
|
1326
|
-
|
|
1295
|
+
);
|
|
1327
1296
|
break;
|
|
1328
1297
|
case "number":
|
|
1329
1298
|
if (!item.render)
|
|
@@ -1332,8 +1301,10 @@ function Table(props) {
|
|
|
1332
1301
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1333
1302
|
if (!item.onFilter)
|
|
1334
1303
|
item.onFilter = (value, row) => {
|
|
1335
|
-
if (value === null
|
|
1304
|
+
if (value === null)
|
|
1336
1305
|
return true;
|
|
1306
|
+
if (isNil2(row[item.id]))
|
|
1307
|
+
return false;
|
|
1337
1308
|
return value == row[item.id];
|
|
1338
1309
|
};
|
|
1339
1310
|
if (item.filterDropdown === false || item.filterDropdown)
|
|
@@ -1343,19 +1314,22 @@ function Table(props) {
|
|
|
1343
1314
|
setSelectedKeys,
|
|
1344
1315
|
confirm,
|
|
1345
1316
|
clearFilters
|
|
1346
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1317
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1318
|
+
Input2.Search,
|
|
1319
|
+
{
|
|
1320
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1321
|
+
allowClear: true,
|
|
1322
|
+
onSearch: (v) => {
|
|
1323
|
+
if (v) {
|
|
1324
|
+
setSelectedKeys([Number(v)]);
|
|
1325
|
+
} else {
|
|
1326
|
+
setSelectedKeys([]);
|
|
1327
|
+
clearFilters();
|
|
1328
|
+
}
|
|
1329
|
+
confirm();
|
|
1355
1330
|
}
|
|
1356
|
-
confirm();
|
|
1357
1331
|
}
|
|
1358
|
-
|
|
1332
|
+
);
|
|
1359
1333
|
break;
|
|
1360
1334
|
case "number[]":
|
|
1361
1335
|
if (!item.render)
|
|
@@ -1375,79 +1349,66 @@ function Table(props) {
|
|
|
1375
1349
|
setSelectedKeys,
|
|
1376
1350
|
confirm,
|
|
1377
1351
|
clearFilters
|
|
1378
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1352
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1353
|
+
Input2.Search,
|
|
1354
|
+
{
|
|
1355
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1356
|
+
allowClear: true,
|
|
1357
|
+
onSearch: (v) => {
|
|
1358
|
+
if (v) {
|
|
1359
|
+
setSelectedKeys([Number(v)]);
|
|
1360
|
+
} else {
|
|
1361
|
+
setSelectedKeys([]);
|
|
1362
|
+
clearFilters();
|
|
1363
|
+
}
|
|
1364
|
+
confirm();
|
|
1387
1365
|
}
|
|
1388
|
-
confirm();
|
|
1389
1366
|
}
|
|
1390
|
-
|
|
1367
|
+
);
|
|
1391
1368
|
break;
|
|
1392
1369
|
case "boolean":
|
|
1393
1370
|
if (!item.render)
|
|
1394
|
-
item.render = (value) => isNil2(value) ? /* @__PURE__ */ jsx14(Blank, {}) : value ? /* @__PURE__ */ jsx14(CheckOutlined2, {
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
marginTop: "4px",
|
|
1402
|
-
color: "#ff4d4f"
|
|
1403
|
-
}
|
|
1404
|
-
});
|
|
1371
|
+
item.render = (value) => isNil2(value) ? /* @__PURE__ */ jsx14(Blank, {}) : value ? /* @__PURE__ */ jsx14(CheckOutlined2, { style: {
|
|
1372
|
+
marginTop: "4px",
|
|
1373
|
+
color: "#52c41a"
|
|
1374
|
+
} }) : /* @__PURE__ */ jsx14(CloseOutlined2, { style: {
|
|
1375
|
+
marginTop: "4px",
|
|
1376
|
+
color: "#ff4d4f"
|
|
1377
|
+
} });
|
|
1405
1378
|
if (item.filterDropdown !== false)
|
|
1406
1379
|
item.filterDropdown = ({
|
|
1407
1380
|
setSelectedKeys,
|
|
1408
1381
|
selectedKeys,
|
|
1409
1382
|
confirm
|
|
1410
|
-
}) => /* @__PURE__ */ jsxs5(
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
})
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
style: {
|
|
1440
|
-
verticalAlign: "middle",
|
|
1441
|
-
color: "#ff4d4f"
|
|
1442
|
-
}
|
|
1443
|
-
})
|
|
1444
|
-
}),
|
|
1445
|
-
/* @__PURE__ */ jsx14(Radio.Button, {
|
|
1446
|
-
value: "null",
|
|
1447
|
-
children: common2.blank
|
|
1448
|
-
})
|
|
1449
|
-
]
|
|
1450
|
-
});
|
|
1383
|
+
}) => /* @__PURE__ */ jsxs5(
|
|
1384
|
+
Radio.Group,
|
|
1385
|
+
{
|
|
1386
|
+
style: { padding: 8 },
|
|
1387
|
+
buttonStyle: "solid",
|
|
1388
|
+
value: JSON.stringify(selectedKeys[0]),
|
|
1389
|
+
onChange: (e) => {
|
|
1390
|
+
const Values = {
|
|
1391
|
+
true: true,
|
|
1392
|
+
false: false,
|
|
1393
|
+
null: null
|
|
1394
|
+
};
|
|
1395
|
+
setSelectedKeys(e.target.value ? [Values[e.target.value]] : []);
|
|
1396
|
+
confirm();
|
|
1397
|
+
},
|
|
1398
|
+
children: [
|
|
1399
|
+
/* @__PURE__ */ jsx14(Radio.Button, { children: common2.all }),
|
|
1400
|
+
/* @__PURE__ */ jsx14(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx14(CheckOutlined2, { style: {
|
|
1401
|
+
color: "#52c41a",
|
|
1402
|
+
verticalAlign: "middle"
|
|
1403
|
+
} }) }),
|
|
1404
|
+
/* @__PURE__ */ jsx14(Radio.Button, { value: "false", children: /* @__PURE__ */ jsx14(CloseOutlined2, { style: {
|
|
1405
|
+
verticalAlign: "middle",
|
|
1406
|
+
color: "#ff4d4f"
|
|
1407
|
+
} }) }),
|
|
1408
|
+
/* @__PURE__ */ jsx14(Radio.Button, { value: "null", children: common2.blank })
|
|
1409
|
+
]
|
|
1410
|
+
}
|
|
1411
|
+
);
|
|
1451
1412
|
if (!item.onFilter)
|
|
1452
1413
|
item.onFilter = (value, row) => {
|
|
1453
1414
|
switch (value) {
|
|
@@ -1463,8 +1424,6 @@ function Table(props) {
|
|
|
1463
1424
|
case "date":
|
|
1464
1425
|
if (!item.render)
|
|
1465
1426
|
item.render = (value) => processValue(item, value);
|
|
1466
|
-
if (!item.onFilter)
|
|
1467
|
-
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value), "date");
|
|
1468
1427
|
if (!item.sorter)
|
|
1469
1428
|
item.sorter = (a, b, order) => {
|
|
1470
1429
|
if (isNil2(a[item.id]))
|
|
@@ -1473,12 +1432,31 @@ function Table(props) {
|
|
|
1473
1432
|
return order === "ascend" ? -1 : 1;
|
|
1474
1433
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1475
1434
|
};
|
|
1435
|
+
if (!item.filterDropdown)
|
|
1436
|
+
item.filterDropdown = ({
|
|
1437
|
+
setSelectedKeys,
|
|
1438
|
+
confirm
|
|
1439
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1440
|
+
DatePicker2.RangePicker,
|
|
1441
|
+
{
|
|
1442
|
+
onChange: (dates) => {
|
|
1443
|
+
setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
|
|
1444
|
+
confirm();
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
);
|
|
1448
|
+
if (!item.onFilter)
|
|
1449
|
+
item.onFilter = (value, row) => {
|
|
1450
|
+
if (isNil2(value[0]))
|
|
1451
|
+
return true;
|
|
1452
|
+
if (isNil2(row[item.id]))
|
|
1453
|
+
return false;
|
|
1454
|
+
return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
|
|
1455
|
+
};
|
|
1476
1456
|
break;
|
|
1477
1457
|
case "time":
|
|
1478
1458
|
if (!item.render)
|
|
1479
1459
|
item.render = (value) => processValue(item, value);
|
|
1480
|
-
if (!item.onFilter)
|
|
1481
|
-
item.onFilter = (value, row) => dayjs2(row[item.id]).isSame(dayjs2(value));
|
|
1482
1460
|
if (!item.sorter)
|
|
1483
1461
|
item.sorter = (a, b, order) => {
|
|
1484
1462
|
if (isNil2(a[item.id]))
|
|
@@ -1487,24 +1465,50 @@ function Table(props) {
|
|
|
1487
1465
|
return order === "ascend" ? -1 : 1;
|
|
1488
1466
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1489
1467
|
};
|
|
1468
|
+
if (!item.filterDropdown)
|
|
1469
|
+
item.filterDropdown = ({
|
|
1470
|
+
setSelectedKeys,
|
|
1471
|
+
confirm
|
|
1472
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1473
|
+
DatePicker2.RangePicker,
|
|
1474
|
+
{
|
|
1475
|
+
onChange: (dates) => {
|
|
1476
|
+
setSelectedKeys(dates && dates[0] && dates[1] ? [[dates[0].startOf("day").toISOString(), dates[1].endOf("day").toISOString()]] : []);
|
|
1477
|
+
confirm();
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
);
|
|
1481
|
+
if (!item.onFilter)
|
|
1482
|
+
item.onFilter = (value, row) => {
|
|
1483
|
+
if (isNil2(value[0]))
|
|
1484
|
+
return true;
|
|
1485
|
+
if (isNil2(row[item.id]))
|
|
1486
|
+
return false;
|
|
1487
|
+
return dayjs2(row[item.id]) >= dayjs2(value[0]) && dayjs2(row[item.id]) <= dayjs2(value[1]);
|
|
1488
|
+
};
|
|
1490
1489
|
break;
|
|
1491
1490
|
case "object":
|
|
1492
1491
|
if (!item.render)
|
|
1493
|
-
item.render = (value) => /* @__PURE__ */ jsx14(
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1492
|
+
item.render = (value) => /* @__PURE__ */ jsx14(
|
|
1493
|
+
Description,
|
|
1494
|
+
{
|
|
1495
|
+
items: item.object,
|
|
1496
|
+
dataSource: value || {},
|
|
1497
|
+
column: 1
|
|
1498
|
+
}
|
|
1499
|
+
);
|
|
1498
1500
|
break;
|
|
1499
1501
|
case "object[]":
|
|
1500
1502
|
if (!item.render)
|
|
1501
|
-
item.render = (value) => /* @__PURE__ */ jsx14(Fragment5, {
|
|
1502
|
-
|
|
1503
|
+
item.render = (value) => /* @__PURE__ */ jsx14(Fragment5, { children: value.map((v, i) => /* @__PURE__ */ jsx14(
|
|
1504
|
+
Description,
|
|
1505
|
+
{
|
|
1503
1506
|
items: item.object,
|
|
1504
1507
|
dataSource: v || [],
|
|
1505
1508
|
column: 1
|
|
1506
|
-
},
|
|
1507
|
-
|
|
1509
|
+
},
|
|
1510
|
+
i
|
|
1511
|
+
)) });
|
|
1508
1512
|
break;
|
|
1509
1513
|
default:
|
|
1510
1514
|
if (!item.render)
|
|
@@ -1520,7 +1524,7 @@ function Table(props) {
|
|
|
1520
1524
|
}
|
|
1521
1525
|
setColumns(props.items);
|
|
1522
1526
|
}, [props.items]);
|
|
1523
|
-
|
|
1527
|
+
useEffect7(() => {
|
|
1524
1528
|
if (!props.dataSource || !columns)
|
|
1525
1529
|
return;
|
|
1526
1530
|
for (const column of columns) {
|
|
@@ -1543,35 +1547,41 @@ function Table(props) {
|
|
|
1543
1547
|
setSelectedKeys,
|
|
1544
1548
|
selectedKeys,
|
|
1545
1549
|
confirm
|
|
1546
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
children: /* @__PURE__ */ jsx14(Select2, {
|
|
1553
|
-
options: filters.map((f) => ({
|
|
1554
|
-
label: f.text,
|
|
1555
|
-
value: f.value
|
|
1556
|
-
})),
|
|
1557
|
-
allowClear: true,
|
|
1558
|
-
showSearch: true,
|
|
1559
|
-
style: { width: "100%" },
|
|
1560
|
-
placeholder: `${common2.search} ${newColumns[index].title}`,
|
|
1561
|
-
value: selectedKeys,
|
|
1562
|
-
onChange: (v) => {
|
|
1563
|
-
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1564
|
-
confirm();
|
|
1550
|
+
}) => /* @__PURE__ */ jsx14(
|
|
1551
|
+
"div",
|
|
1552
|
+
{
|
|
1553
|
+
style: {
|
|
1554
|
+
padding: 8,
|
|
1555
|
+
width: "200px"
|
|
1565
1556
|
},
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1557
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1558
|
+
children: /* @__PURE__ */ jsx14(
|
|
1559
|
+
Select2,
|
|
1560
|
+
{
|
|
1561
|
+
options: filters.map((f) => ({
|
|
1562
|
+
label: f.text,
|
|
1563
|
+
value: f.value
|
|
1564
|
+
})),
|
|
1565
|
+
allowClear: true,
|
|
1566
|
+
showSearch: true,
|
|
1567
|
+
style: { width: "100%" },
|
|
1568
|
+
placeholder: `${common2.search} ${newColumns[index].title}`,
|
|
1569
|
+
value: selectedKeys,
|
|
1570
|
+
onChange: (v) => {
|
|
1571
|
+
setSelectedKeys((v == null ? void 0 : v.length) ? v : []);
|
|
1572
|
+
confirm();
|
|
1573
|
+
},
|
|
1574
|
+
mode: "multiple",
|
|
1575
|
+
filterOption: (input, option) => {
|
|
1576
|
+
if (!input || !option || !option.label)
|
|
1577
|
+
return true;
|
|
1578
|
+
input = input.trim();
|
|
1579
|
+
return option.value === input || option.label.toString().toLowerCase().includes(input.toLowerCase());
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
)
|
|
1583
|
+
}
|
|
1584
|
+
);
|
|
1575
1585
|
return newColumns;
|
|
1576
1586
|
});
|
|
1577
1587
|
}
|
|
@@ -1580,19 +1590,26 @@ function Table(props) {
|
|
|
1580
1590
|
if (!columns)
|
|
1581
1591
|
return null;
|
|
1582
1592
|
if (props.dataSource)
|
|
1583
|
-
return /* @__PURE__ */ jsx14(
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1593
|
+
return /* @__PURE__ */ jsx14(
|
|
1594
|
+
AntdTable,
|
|
1595
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1596
|
+
rowKey: props.rowKey || "id",
|
|
1597
|
+
columns,
|
|
1598
|
+
dataSource: props.dataSource
|
|
1599
|
+
})
|
|
1600
|
+
);
|
|
1601
|
+
return /* @__PURE__ */ jsx14(
|
|
1602
|
+
FaasDataWrapper2,
|
|
1603
|
+
__spreadProps(__spreadValues({}, props.faasData), {
|
|
1604
|
+
children: /* @__PURE__ */ jsx14(
|
|
1605
|
+
FaasDataTable,
|
|
1606
|
+
{
|
|
1607
|
+
props,
|
|
1608
|
+
columns
|
|
1609
|
+
}
|
|
1610
|
+
)
|
|
1594
1611
|
})
|
|
1595
|
-
|
|
1612
|
+
);
|
|
1596
1613
|
}
|
|
1597
1614
|
function FaasDataTable({
|
|
1598
1615
|
props,
|
|
@@ -1601,8 +1618,8 @@ function FaasDataTable({
|
|
|
1601
1618
|
params,
|
|
1602
1619
|
reload
|
|
1603
1620
|
}) {
|
|
1604
|
-
const [currentColumns, setCurrentColumns] =
|
|
1605
|
-
|
|
1621
|
+
const [currentColumns, setCurrentColumns] = useState8(columns);
|
|
1622
|
+
useEffect7(() => {
|
|
1606
1623
|
if (!data || Array.isArray(data))
|
|
1607
1624
|
return;
|
|
1608
1625
|
setCurrentColumns((prev) => {
|
|
@@ -1638,75 +1655,75 @@ function FaasDataTable({
|
|
|
1638
1655
|
});
|
|
1639
1656
|
}, [columns, data]);
|
|
1640
1657
|
if (!data)
|
|
1641
|
-
return /* @__PURE__ */ jsx14(
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1658
|
+
return /* @__PURE__ */ jsx14(
|
|
1659
|
+
AntdTable,
|
|
1660
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1661
|
+
rowKey: props.rowKey || "id",
|
|
1662
|
+
columns: currentColumns,
|
|
1663
|
+
dataSource: []
|
|
1664
|
+
})
|
|
1665
|
+
);
|
|
1647
1666
|
if (Array.isArray(data))
|
|
1648
|
-
return /* @__PURE__ */ jsx14(
|
|
1649
|
-
|
|
1667
|
+
return /* @__PURE__ */ jsx14(
|
|
1668
|
+
AntdTable,
|
|
1669
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1670
|
+
rowKey: props.rowKey || "id",
|
|
1671
|
+
columns: currentColumns,
|
|
1672
|
+
dataSource: data
|
|
1673
|
+
})
|
|
1674
|
+
);
|
|
1675
|
+
return /* @__PURE__ */ jsx14(
|
|
1676
|
+
AntdTable,
|
|
1677
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1650
1678
|
rowKey: props.rowKey || "id",
|
|
1651
1679
|
columns: currentColumns,
|
|
1652
|
-
dataSource: data
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
filters: processed.filters,
|
|
1670
|
-
sorter: processed.sorter
|
|
1671
|
-
});
|
|
1672
|
-
return;
|
|
1680
|
+
dataSource: data.rows,
|
|
1681
|
+
pagination: __spreadValues(__spreadValues({}, props.pagination), data.pagination),
|
|
1682
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1683
|
+
if (props.onChange) {
|
|
1684
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1685
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1686
|
+
pagination: processed.pagination,
|
|
1687
|
+
filters: processed.filters,
|
|
1688
|
+
sorter: processed.sorter
|
|
1689
|
+
}));
|
|
1690
|
+
return;
|
|
1691
|
+
}
|
|
1692
|
+
reload(__spreadProps(__spreadValues({}, params), {
|
|
1693
|
+
pagination,
|
|
1694
|
+
filters,
|
|
1695
|
+
sorter
|
|
1696
|
+
}));
|
|
1673
1697
|
}
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
pagination,
|
|
1677
|
-
filters,
|
|
1678
|
-
sorter
|
|
1679
|
-
});
|
|
1680
|
-
}
|
|
1681
|
-
});
|
|
1698
|
+
})
|
|
1699
|
+
);
|
|
1682
1700
|
}
|
|
1683
1701
|
|
|
1684
1702
|
// src/Title.tsx
|
|
1685
|
-
import { useEffect as
|
|
1703
|
+
import { useEffect as useEffect8, cloneElement as cloneElement5 } from "react";
|
|
1686
1704
|
import { Fragment as Fragment6, jsx as jsx15 } from "react/jsx-runtime";
|
|
1687
1705
|
function Title(props) {
|
|
1688
1706
|
const { Title: Title2 } = useConfigContext();
|
|
1689
|
-
|
|
1707
|
+
useEffect8(() => {
|
|
1690
1708
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1691
1709
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1692
1710
|
}, [props]);
|
|
1693
1711
|
if (props.h1) {
|
|
1694
1712
|
if (typeof props.h1 === "boolean")
|
|
1695
|
-
return /* @__PURE__ */ jsx15("h1", {
|
|
1713
|
+
return /* @__PURE__ */ jsx15("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1714
|
+
return /* @__PURE__ */ jsx15(
|
|
1715
|
+
"h1",
|
|
1716
|
+
{
|
|
1717
|
+
className: props.h1.className,
|
|
1718
|
+
style: props.h1.style,
|
|
1696
1719
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
className: props.h1.className,
|
|
1700
|
-
style: props.h1.style,
|
|
1701
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1702
|
-
});
|
|
1720
|
+
}
|
|
1721
|
+
);
|
|
1703
1722
|
}
|
|
1704
1723
|
if (props.plain)
|
|
1705
|
-
return /* @__PURE__ */ jsx15(Fragment6, {
|
|
1706
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1707
|
-
});
|
|
1724
|
+
return /* @__PURE__ */ jsx15(Fragment6, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1708
1725
|
if (props.children)
|
|
1709
|
-
return
|
|
1726
|
+
return cloneElement5(props.children, { title: props.title });
|
|
1710
1727
|
return null;
|
|
1711
1728
|
}
|
|
1712
1729
|
export {
|
|
@@ -1717,7 +1734,7 @@ export {
|
|
|
1717
1734
|
Description,
|
|
1718
1735
|
Drawer,
|
|
1719
1736
|
ErrorBoundary,
|
|
1720
|
-
FaasDataWrapper,
|
|
1737
|
+
FaasDataWrapper2 as FaasDataWrapper,
|
|
1721
1738
|
Form,
|
|
1722
1739
|
FormItem,
|
|
1723
1740
|
Link,
|