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