@faasjs/ant-design 0.0.3-beta.52 → 0.0.3-beta.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +74 -56
- package/dist/index.js +265 -205
- package/dist/index.mjs +304 -238
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,137 @@
|
|
|
1
1
|
// react-shim.js
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
+
// src/App.tsx
|
|
5
|
+
import {
|
|
6
|
+
ConfigProvider,
|
|
7
|
+
message,
|
|
8
|
+
notification
|
|
9
|
+
} from "antd";
|
|
10
|
+
import { StyleProvider, legacyLogicalPropertiesTransformer } from "@ant-design/cssinjs";
|
|
11
|
+
import {
|
|
12
|
+
createContext,
|
|
13
|
+
useContext,
|
|
14
|
+
useMemo
|
|
15
|
+
} from "react";
|
|
16
|
+
|
|
17
|
+
// src/Modal.tsx
|
|
18
|
+
import { Modal } from "antd";
|
|
19
|
+
import { useState } from "react";
|
|
20
|
+
import { jsx } from "react/jsx-runtime";
|
|
21
|
+
function useModal(init) {
|
|
22
|
+
const [props, setProps] = useState({
|
|
23
|
+
open: false,
|
|
24
|
+
onCancel: () => setProps((prev) => ({
|
|
25
|
+
...prev,
|
|
26
|
+
open: false
|
|
27
|
+
})),
|
|
28
|
+
...init
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
modal: /* @__PURE__ */ jsx(Modal, {
|
|
32
|
+
...props
|
|
33
|
+
}),
|
|
34
|
+
modalProps: props,
|
|
35
|
+
setModalProps(changes) {
|
|
36
|
+
setProps((prev) => ({
|
|
37
|
+
...prev,
|
|
38
|
+
...changes
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/Drawer.tsx
|
|
45
|
+
import { Drawer } from "antd";
|
|
46
|
+
import { useState as useState2 } from "react";
|
|
47
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
48
|
+
function useDrawer(init) {
|
|
49
|
+
const [props, setProps] = useState2({
|
|
50
|
+
open: false,
|
|
51
|
+
onClose: () => setProps((prev) => ({
|
|
52
|
+
...prev,
|
|
53
|
+
open: false
|
|
54
|
+
})),
|
|
55
|
+
...init
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
drawer: /* @__PURE__ */ jsx2(Drawer, {
|
|
59
|
+
...props
|
|
60
|
+
}),
|
|
61
|
+
drawerProps: props,
|
|
62
|
+
setDrawerProps(changes) {
|
|
63
|
+
setProps((prev) => ({
|
|
64
|
+
...prev,
|
|
65
|
+
...changes
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/App.tsx
|
|
72
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
73
|
+
var AppContext = createContext({
|
|
74
|
+
message: {},
|
|
75
|
+
notification: {},
|
|
76
|
+
setModalProps: () => void 0,
|
|
77
|
+
setDrawerProps: () => void 0
|
|
78
|
+
});
|
|
79
|
+
function App(props) {
|
|
80
|
+
const [messageApi, messageContextHolder] = message.useMessage();
|
|
81
|
+
const [notificationApi, notificationContextHolder] = notification.useNotification();
|
|
82
|
+
const { modal, setModalProps } = useModal();
|
|
83
|
+
const { drawer, setDrawerProps } = useDrawer();
|
|
84
|
+
const memoizedContextValue = useMemo(
|
|
85
|
+
() => ({
|
|
86
|
+
message: messageApi,
|
|
87
|
+
notification: notificationApi,
|
|
88
|
+
setModalProps,
|
|
89
|
+
setDrawerProps
|
|
90
|
+
}),
|
|
91
|
+
[
|
|
92
|
+
messageApi,
|
|
93
|
+
notificationApi,
|
|
94
|
+
setModalProps,
|
|
95
|
+
setDrawerProps
|
|
96
|
+
]
|
|
97
|
+
);
|
|
98
|
+
return /* @__PURE__ */ jsx3(StyleProvider, {
|
|
99
|
+
...props.styleProviderProps || {},
|
|
100
|
+
children: /* @__PURE__ */ jsx3(ConfigProvider, {
|
|
101
|
+
...Object.assign(props.configProviderProps || {}, {
|
|
102
|
+
hashPriority: "high",
|
|
103
|
+
transformers: [legacyLogicalPropertiesTransformer]
|
|
104
|
+
}),
|
|
105
|
+
children: /* @__PURE__ */ jsxs(AppContext.Provider, {
|
|
106
|
+
value: memoizedContextValue,
|
|
107
|
+
children: [
|
|
108
|
+
messageContextHolder,
|
|
109
|
+
notificationContextHolder,
|
|
110
|
+
modal,
|
|
111
|
+
drawer,
|
|
112
|
+
props.children
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function useApp() {
|
|
119
|
+
return useContext(AppContext);
|
|
120
|
+
}
|
|
121
|
+
|
|
4
122
|
// src/Blank.tsx
|
|
5
123
|
import { Typography } from "antd";
|
|
6
124
|
import { isNil } from "lodash-es";
|
|
7
125
|
|
|
8
126
|
// src/Config.tsx
|
|
9
127
|
import {
|
|
10
|
-
createContext,
|
|
11
|
-
useContext,
|
|
128
|
+
createContext as createContext2,
|
|
129
|
+
useContext as useContext2,
|
|
12
130
|
useEffect,
|
|
13
|
-
useState
|
|
131
|
+
useState as useState3
|
|
14
132
|
} from "react";
|
|
15
133
|
import { defaultsDeep } from "lodash-es";
|
|
16
|
-
import { jsx } from "react/jsx-runtime";
|
|
134
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
17
135
|
var isZH = /^zh/i.test(navigator.language);
|
|
18
136
|
var zh = {
|
|
19
137
|
lang: "zh",
|
|
@@ -52,12 +170,12 @@ var baseConfig = {
|
|
|
52
170
|
},
|
|
53
171
|
Link: { style: {} }
|
|
54
172
|
};
|
|
55
|
-
var ConfigContext =
|
|
56
|
-
function
|
|
173
|
+
var ConfigContext = createContext2(baseConfig);
|
|
174
|
+
function ConfigProvider2({
|
|
57
175
|
config,
|
|
58
176
|
children
|
|
59
177
|
}) {
|
|
60
|
-
const [values, setValues] =
|
|
178
|
+
const [values, setValues] = useState3(baseConfig);
|
|
61
179
|
useEffect(() => {
|
|
62
180
|
if (config.lang === "zh") {
|
|
63
181
|
setValues(defaultsDeep(config, {
|
|
@@ -69,20 +187,20 @@ function ConfigProvider({
|
|
|
69
187
|
} else
|
|
70
188
|
setValues(defaultsDeep(config, values));
|
|
71
189
|
}, []);
|
|
72
|
-
return /* @__PURE__ */
|
|
190
|
+
return /* @__PURE__ */ jsx4(ConfigContext.Provider, {
|
|
73
191
|
value: values,
|
|
74
192
|
children
|
|
75
193
|
});
|
|
76
194
|
}
|
|
77
195
|
function useConfigContext() {
|
|
78
|
-
return
|
|
196
|
+
return useContext2(ConfigContext);
|
|
79
197
|
}
|
|
80
198
|
|
|
81
199
|
// src/Blank.tsx
|
|
82
|
-
import { jsx as
|
|
200
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
83
201
|
function Blank(options) {
|
|
84
202
|
const { Blank: Blank2 } = useConfigContext();
|
|
85
|
-
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */
|
|
203
|
+
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx5(Typography.Text, {
|
|
86
204
|
disabled: true,
|
|
87
205
|
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
88
206
|
}) : options.value;
|
|
@@ -125,7 +243,7 @@ import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
|
125
243
|
import {
|
|
126
244
|
cloneElement,
|
|
127
245
|
useEffect as useEffect2,
|
|
128
|
-
useState as
|
|
246
|
+
useState as useState4
|
|
129
247
|
} from "react";
|
|
130
248
|
|
|
131
249
|
// src/FaasDataWrapper.tsx
|
|
@@ -133,13 +251,13 @@ import { FaasDataWrapper as Origin } from "@faasjs/react";
|
|
|
133
251
|
|
|
134
252
|
// src/Loading.tsx
|
|
135
253
|
import { Spin } from "antd";
|
|
136
|
-
import { Fragment, jsx as
|
|
254
|
+
import { Fragment, jsx as jsx6 } from "react/jsx-runtime";
|
|
137
255
|
function Loading(props) {
|
|
138
256
|
if (props.loading === false)
|
|
139
|
-
return /* @__PURE__ */
|
|
257
|
+
return /* @__PURE__ */ jsx6(Fragment, {
|
|
140
258
|
children: props.children
|
|
141
259
|
});
|
|
142
|
-
return /* @__PURE__ */
|
|
260
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
143
261
|
style: {
|
|
144
262
|
...props.style || {},
|
|
145
263
|
...!props.size || props.size === "large" ? {
|
|
@@ -147,17 +265,17 @@ function Loading(props) {
|
|
|
147
265
|
textAlign: "center"
|
|
148
266
|
} : {}
|
|
149
267
|
},
|
|
150
|
-
children: /* @__PURE__ */
|
|
268
|
+
children: /* @__PURE__ */ jsx6(Spin, {
|
|
151
269
|
size: props.size || "large"
|
|
152
270
|
})
|
|
153
271
|
});
|
|
154
272
|
}
|
|
155
273
|
|
|
156
274
|
// src/FaasDataWrapper.tsx
|
|
157
|
-
import { jsx as
|
|
275
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
158
276
|
function FaasDataWrapper(props) {
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
-
fallback: props.loading || /* @__PURE__ */
|
|
277
|
+
return /* @__PURE__ */ jsx7(Origin, {
|
|
278
|
+
fallback: props.loading || /* @__PURE__ */ jsx7(Loading, {
|
|
161
279
|
...props.loadingProps
|
|
162
280
|
}),
|
|
163
281
|
...props
|
|
@@ -165,10 +283,10 @@ function FaasDataWrapper(props) {
|
|
|
165
283
|
}
|
|
166
284
|
|
|
167
285
|
// src/Description.tsx
|
|
168
|
-
import { Fragment as Fragment2, jsx as
|
|
286
|
+
import { Fragment as Fragment2, jsx as jsx8 } from "react/jsx-runtime";
|
|
169
287
|
function DescriptionItemContent(props) {
|
|
170
288
|
var _a;
|
|
171
|
-
const [computedProps, setComputedProps] =
|
|
289
|
+
const [computedProps, setComputedProps] = useState4();
|
|
172
290
|
useEffect2(() => {
|
|
173
291
|
var _a2, _b;
|
|
174
292
|
const propsCopy = { ...props };
|
|
@@ -208,7 +326,7 @@ function DescriptionItemContent(props) {
|
|
|
208
326
|
}
|
|
209
327
|
);
|
|
210
328
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
211
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ jsx8(Fragment2, {
|
|
212
330
|
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
213
331
|
});
|
|
214
332
|
else
|
|
@@ -234,52 +352,52 @@ function DescriptionItemContent(props) {
|
|
|
234
352
|
if (computedProps.item.render)
|
|
235
353
|
return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
|
|
236
354
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
237
|
-
return /* @__PURE__ */
|
|
355
|
+
return /* @__PURE__ */ jsx8(Blank, {});
|
|
238
356
|
switch (computedProps.item.type) {
|
|
239
357
|
case "string[]":
|
|
240
|
-
return /* @__PURE__ */
|
|
358
|
+
return /* @__PURE__ */ jsx8(Fragment2, {
|
|
241
359
|
children: computedProps.value.join(", ")
|
|
242
360
|
});
|
|
243
361
|
case "number":
|
|
244
362
|
return computedProps.value || null;
|
|
245
363
|
case "number[]":
|
|
246
|
-
return /* @__PURE__ */
|
|
364
|
+
return /* @__PURE__ */ jsx8(Fragment2, {
|
|
247
365
|
children: computedProps.value.join(", ")
|
|
248
366
|
});
|
|
249
367
|
case "boolean":
|
|
250
|
-
return computedProps.value ? /* @__PURE__ */
|
|
368
|
+
return computedProps.value ? /* @__PURE__ */ jsx8(CheckOutlined, {
|
|
251
369
|
style: {
|
|
252
370
|
marginTop: "4px",
|
|
253
371
|
color: "#52c41a"
|
|
254
372
|
}
|
|
255
|
-
}) : /* @__PURE__ */
|
|
373
|
+
}) : /* @__PURE__ */ jsx8(CloseOutlined, {
|
|
256
374
|
style: {
|
|
257
375
|
marginTop: "4px",
|
|
258
376
|
color: "#ff4d4f"
|
|
259
377
|
}
|
|
260
378
|
});
|
|
261
379
|
case "time":
|
|
262
|
-
return /* @__PURE__ */
|
|
380
|
+
return /* @__PURE__ */ jsx8(Fragment2, {
|
|
263
381
|
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
264
382
|
});
|
|
265
383
|
case "date":
|
|
266
|
-
return /* @__PURE__ */
|
|
384
|
+
return /* @__PURE__ */ jsx8(Fragment2, {
|
|
267
385
|
children: computedProps.value.format("YYYY-MM-DD")
|
|
268
386
|
});
|
|
269
387
|
case "object":
|
|
270
388
|
if (!computedProps.value)
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ jsx8(Blank, {});
|
|
390
|
+
return /* @__PURE__ */ jsx8(Description, {
|
|
273
391
|
items: computedProps.item.object,
|
|
274
392
|
dataSource: computedProps.value,
|
|
275
393
|
column: 1
|
|
276
394
|
});
|
|
277
395
|
case "object[]":
|
|
278
396
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
279
|
-
return /* @__PURE__ */
|
|
280
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ jsx8(Blank, {});
|
|
398
|
+
return /* @__PURE__ */ jsx8(Space, {
|
|
281
399
|
direction: "vertical",
|
|
282
|
-
children: computedProps.value.map((value, index) => /* @__PURE__ */
|
|
400
|
+
children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx8(Description, {
|
|
283
401
|
items: computedProps.item.object,
|
|
284
402
|
dataSource: value,
|
|
285
403
|
column: 1
|
|
@@ -291,13 +409,13 @@ function DescriptionItemContent(props) {
|
|
|
291
409
|
}
|
|
292
410
|
function Description(props) {
|
|
293
411
|
if (props.dataSource)
|
|
294
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ jsx8(Descriptions, {
|
|
295
413
|
...props,
|
|
296
414
|
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
297
415
|
children: props.items.map((item) => {
|
|
298
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */
|
|
416
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx8(Descriptions.Item, {
|
|
299
417
|
label: item.title || upperFirst2(item.id),
|
|
300
|
-
children: /* @__PURE__ */
|
|
418
|
+
children: /* @__PURE__ */ jsx8(DescriptionItemContent, {
|
|
301
419
|
item,
|
|
302
420
|
value: props.dataSource[item.id],
|
|
303
421
|
values: props.dataSource,
|
|
@@ -306,15 +424,15 @@ function Description(props) {
|
|
|
306
424
|
}, item.id) : null;
|
|
307
425
|
}).filter(Boolean)
|
|
308
426
|
});
|
|
309
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ jsx8(FaasDataWrapper, {
|
|
310
428
|
render: ({ data }) => {
|
|
311
|
-
return /* @__PURE__ */
|
|
429
|
+
return /* @__PURE__ */ jsx8(Descriptions, {
|
|
312
430
|
...props,
|
|
313
431
|
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
314
432
|
children: props.items.map((item) => {
|
|
315
|
-
return !item.if || item.if(data) ? /* @__PURE__ */
|
|
433
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ jsx8(Descriptions.Item, {
|
|
316
434
|
label: item.title || upperFirst2(item.id),
|
|
317
|
-
children: /* @__PURE__ */
|
|
435
|
+
children: /* @__PURE__ */ jsx8(DescriptionItemContent, {
|
|
318
436
|
item,
|
|
319
437
|
value: data[item.id],
|
|
320
438
|
values: data,
|
|
@@ -328,37 +446,10 @@ function Description(props) {
|
|
|
328
446
|
});
|
|
329
447
|
}
|
|
330
448
|
|
|
331
|
-
// src/Drawer.tsx
|
|
332
|
-
import { Drawer } from "antd";
|
|
333
|
-
import { useState as useState3 } from "react";
|
|
334
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
335
|
-
function useDrawer(init) {
|
|
336
|
-
const [props, setProps] = useState3({
|
|
337
|
-
open: false,
|
|
338
|
-
onClose: () => setProps((prev) => ({
|
|
339
|
-
...prev,
|
|
340
|
-
open: false
|
|
341
|
-
})),
|
|
342
|
-
...init
|
|
343
|
-
});
|
|
344
|
-
return {
|
|
345
|
-
drawer: /* @__PURE__ */ jsx6(Drawer, {
|
|
346
|
-
...props
|
|
347
|
-
}),
|
|
348
|
-
drawerProps: props,
|
|
349
|
-
setDrawerProps(changes) {
|
|
350
|
-
setProps((prev) => ({
|
|
351
|
-
...prev,
|
|
352
|
-
...changes
|
|
353
|
-
}));
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
|
|
358
449
|
// src/ErrorBoundary.tsx
|
|
359
450
|
import { Component } from "react";
|
|
360
451
|
import { Alert } from "antd";
|
|
361
|
-
import { jsx as
|
|
452
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
362
453
|
var ErrorBoundary = class extends Component {
|
|
363
454
|
constructor(props) {
|
|
364
455
|
super(props);
|
|
@@ -375,21 +466,21 @@ var ErrorBoundary = class extends Component {
|
|
|
375
466
|
}
|
|
376
467
|
render() {
|
|
377
468
|
const {
|
|
378
|
-
message,
|
|
469
|
+
message: message2,
|
|
379
470
|
description,
|
|
380
471
|
children
|
|
381
472
|
} = this.props;
|
|
382
473
|
const { error, info } = this.state;
|
|
383
474
|
const componentStack = info && info.componentStack ? info.componentStack : null;
|
|
384
|
-
const errorMessage = typeof
|
|
475
|
+
const errorMessage = typeof message2 === "undefined" ? (error || "").toString() : message2;
|
|
385
476
|
const errorDescription = typeof description === "undefined" ? componentStack : description;
|
|
386
477
|
if (error) {
|
|
387
478
|
if (this.props.onError)
|
|
388
479
|
return this.props.onError(error, info);
|
|
389
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ jsx9(Alert, {
|
|
390
481
|
type: "error",
|
|
391
482
|
message: errorMessage,
|
|
392
|
-
description: /* @__PURE__ */
|
|
483
|
+
description: /* @__PURE__ */ jsx9("pre", {
|
|
393
484
|
style: {
|
|
394
485
|
fontSize: "0.9em",
|
|
395
486
|
overflowX: "auto"
|
|
@@ -410,7 +501,7 @@ import {
|
|
|
410
501
|
} from "antd";
|
|
411
502
|
import {
|
|
412
503
|
useEffect as useEffect4,
|
|
413
|
-
useState as
|
|
504
|
+
useState as useState6,
|
|
414
505
|
useCallback,
|
|
415
506
|
isValidElement
|
|
416
507
|
} from "react";
|
|
@@ -432,10 +523,10 @@ import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
|
432
523
|
import {
|
|
433
524
|
cloneElement as cloneElement2,
|
|
434
525
|
useEffect as useEffect3,
|
|
435
|
-
useState as
|
|
526
|
+
useState as useState5
|
|
436
527
|
} from "react";
|
|
437
528
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
438
|
-
import { Fragment as Fragment3, jsx as
|
|
529
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
439
530
|
function processProps(propsCopy, config) {
|
|
440
531
|
if (!propsCopy.title)
|
|
441
532
|
propsCopy.title = upperFirst3(propsCopy.id);
|
|
@@ -484,10 +575,10 @@ function processProps(propsCopy, config) {
|
|
|
484
575
|
}
|
|
485
576
|
function FormItem(props) {
|
|
486
577
|
var _a;
|
|
487
|
-
const [computedProps, setComputedProps] =
|
|
488
|
-
const [extendTypes, setExtendTypes] =
|
|
578
|
+
const [computedProps, setComputedProps] = useState5();
|
|
579
|
+
const [extendTypes, setExtendTypes] = useState5();
|
|
489
580
|
const { common: common2 } = useConfigContext();
|
|
490
|
-
const [hidden, setHidden] =
|
|
581
|
+
const [hidden, setHidden] = useState5(props.hidden || false);
|
|
491
582
|
useEffect3(() => {
|
|
492
583
|
const propsCopy = { ...props };
|
|
493
584
|
if (propsCopy.extendTypes) {
|
|
@@ -512,100 +603,100 @@ function FormItem(props) {
|
|
|
512
603
|
if (!computedProps)
|
|
513
604
|
return null;
|
|
514
605
|
if (hidden)
|
|
515
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
516
607
|
...computedProps,
|
|
517
608
|
noStyle: true,
|
|
518
609
|
rules: [],
|
|
519
|
-
children: /* @__PURE__ */
|
|
610
|
+
children: /* @__PURE__ */ jsx10(Input, {
|
|
520
611
|
hidden: true
|
|
521
612
|
})
|
|
522
613
|
});
|
|
523
614
|
if (extendTypes && extendTypes[computedProps.type])
|
|
524
|
-
return /* @__PURE__ */
|
|
615
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
525
616
|
...computedProps,
|
|
526
617
|
children: extendTypes[computedProps.type].children
|
|
527
618
|
});
|
|
528
619
|
if (computedProps.formChildren === null)
|
|
529
620
|
return null;
|
|
530
621
|
if (computedProps.formChildren)
|
|
531
|
-
return /* @__PURE__ */
|
|
622
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
532
623
|
...computedProps,
|
|
533
624
|
children: cloneElement2(computedProps.formChildren, { scene: "form" })
|
|
534
625
|
});
|
|
535
626
|
if (computedProps.children === null)
|
|
536
627
|
return null;
|
|
537
628
|
if (computedProps.children)
|
|
538
|
-
return /* @__PURE__ */
|
|
629
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
539
630
|
...computedProps,
|
|
540
631
|
children: cloneElement2(computedProps.children, { scene: "form" })
|
|
541
632
|
});
|
|
542
633
|
if (computedProps.formRender)
|
|
543
|
-
return /* @__PURE__ */
|
|
634
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
544
635
|
...computedProps,
|
|
545
636
|
children: computedProps.formRender(null, null, 0, "form")
|
|
546
637
|
});
|
|
547
638
|
if (computedProps.render)
|
|
548
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
549
640
|
...computedProps,
|
|
550
641
|
children: computedProps.render(null, null, 0, "form")
|
|
551
642
|
});
|
|
552
643
|
switch (computedProps.type) {
|
|
553
644
|
case "string":
|
|
554
|
-
return /* @__PURE__ */
|
|
645
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
555
646
|
...computedProps,
|
|
556
|
-
children: computedProps.options ? /* @__PURE__ */
|
|
647
|
+
children: computedProps.options ? /* @__PURE__ */ jsx10(Select, {
|
|
557
648
|
...computedProps.input
|
|
558
|
-
}) : /* @__PURE__ */
|
|
649
|
+
}) : /* @__PURE__ */ jsx10(Input, {
|
|
559
650
|
...computedProps.input
|
|
560
651
|
})
|
|
561
652
|
});
|
|
562
653
|
case "string[]":
|
|
563
654
|
if (computedProps.options)
|
|
564
|
-
return /* @__PURE__ */
|
|
655
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
565
656
|
...computedProps,
|
|
566
|
-
children: /* @__PURE__ */
|
|
657
|
+
children: /* @__PURE__ */ jsx10(Select, {
|
|
567
658
|
mode: "multiple",
|
|
568
659
|
...computedProps.input
|
|
569
660
|
})
|
|
570
661
|
});
|
|
571
|
-
return /* @__PURE__ */
|
|
662
|
+
return /* @__PURE__ */ jsx10(AntdForm.List, {
|
|
572
663
|
name: computedProps.name,
|
|
573
664
|
rules: computedProps.rules,
|
|
574
665
|
children: (fields, { add, remove }, { errors }) => {
|
|
575
666
|
var _a2;
|
|
576
|
-
return /* @__PURE__ */
|
|
667
|
+
return /* @__PURE__ */ jsxs2(Fragment3, {
|
|
577
668
|
children: [
|
|
578
|
-
computedProps.label && /* @__PURE__ */
|
|
669
|
+
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
579
670
|
className: "ant-form-item-label",
|
|
580
|
-
children: /* @__PURE__ */
|
|
671
|
+
children: /* @__PURE__ */ jsx10("label", {
|
|
581
672
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
582
673
|
children: computedProps.label
|
|
583
674
|
})
|
|
584
675
|
}),
|
|
585
676
|
fields.map((field) => {
|
|
586
677
|
var _a3;
|
|
587
|
-
return /* @__PURE__ */
|
|
588
|
-
children: /* @__PURE__ */
|
|
678
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
679
|
+
children: /* @__PURE__ */ jsxs2(Row, {
|
|
589
680
|
gutter: 24,
|
|
590
681
|
style: { flexFlow: "row nowrap" },
|
|
591
682
|
children: [
|
|
592
|
-
/* @__PURE__ */
|
|
683
|
+
/* @__PURE__ */ jsx10(Col, {
|
|
593
684
|
span: 23,
|
|
594
|
-
children: /* @__PURE__ */
|
|
685
|
+
children: /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
595
686
|
...field,
|
|
596
687
|
noStyle: true,
|
|
597
|
-
children: /* @__PURE__ */
|
|
688
|
+
children: /* @__PURE__ */ jsx10(Input, {
|
|
598
689
|
...computedProps.input
|
|
599
690
|
})
|
|
600
691
|
})
|
|
601
692
|
}),
|
|
602
|
-
/* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ jsx10(Col, {
|
|
603
694
|
span: 1,
|
|
604
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
695
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx10(Button, {
|
|
605
696
|
danger: true,
|
|
606
697
|
type: "link",
|
|
607
698
|
style: { float: "right" },
|
|
608
|
-
icon: /* @__PURE__ */
|
|
699
|
+
icon: /* @__PURE__ */ jsx10(MinusCircleOutlined, {}),
|
|
609
700
|
onClick: () => remove(field.name)
|
|
610
701
|
})
|
|
611
702
|
})
|
|
@@ -613,19 +704,19 @@ function FormItem(props) {
|
|
|
613
704
|
})
|
|
614
705
|
}, field.key);
|
|
615
706
|
}),
|
|
616
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
617
708
|
children: [
|
|
618
|
-
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
709
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx10(Button, {
|
|
619
710
|
type: "dashed",
|
|
620
711
|
block: true,
|
|
621
712
|
onClick: () => add(),
|
|
622
|
-
icon: /* @__PURE__ */
|
|
713
|
+
icon: /* @__PURE__ */ jsx10(PlusOutlined, {})
|
|
623
714
|
}),
|
|
624
|
-
computedProps.extra && /* @__PURE__ */
|
|
715
|
+
computedProps.extra && /* @__PURE__ */ jsx10("div", {
|
|
625
716
|
className: "ant-form-item-extra",
|
|
626
717
|
children: computedProps.extra
|
|
627
718
|
}),
|
|
628
|
-
/* @__PURE__ */
|
|
719
|
+
/* @__PURE__ */ jsx10(AntdForm.ErrorList, {
|
|
629
720
|
errors
|
|
630
721
|
})
|
|
631
722
|
]
|
|
@@ -635,63 +726,63 @@ function FormItem(props) {
|
|
|
635
726
|
}
|
|
636
727
|
});
|
|
637
728
|
case "number":
|
|
638
|
-
return /* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
639
730
|
...computedProps,
|
|
640
|
-
children: computedProps.options ? /* @__PURE__ */
|
|
731
|
+
children: computedProps.options ? /* @__PURE__ */ jsx10(Select, {
|
|
641
732
|
...computedProps.input
|
|
642
|
-
}) : /* @__PURE__ */
|
|
733
|
+
}) : /* @__PURE__ */ jsx10(InputNumber, {
|
|
643
734
|
style: { width: "100%" },
|
|
644
735
|
...computedProps.input
|
|
645
736
|
})
|
|
646
737
|
});
|
|
647
738
|
case "number[]":
|
|
648
739
|
if (computedProps.options)
|
|
649
|
-
return /* @__PURE__ */
|
|
740
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
650
741
|
...computedProps,
|
|
651
|
-
children: /* @__PURE__ */
|
|
742
|
+
children: /* @__PURE__ */ jsx10(Select, {
|
|
652
743
|
mode: "multiple",
|
|
653
744
|
...computedProps.input
|
|
654
745
|
})
|
|
655
746
|
});
|
|
656
|
-
return /* @__PURE__ */
|
|
747
|
+
return /* @__PURE__ */ jsx10(AntdForm.List, {
|
|
657
748
|
name: computedProps.name,
|
|
658
749
|
rules: computedProps.rules,
|
|
659
750
|
children: (fields, { add, remove }, { errors }) => {
|
|
660
751
|
var _a2, _b;
|
|
661
|
-
return /* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ jsxs2(Fragment3, {
|
|
662
753
|
children: [
|
|
663
|
-
computedProps.label && /* @__PURE__ */
|
|
754
|
+
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
664
755
|
className: "ant-form-item-label",
|
|
665
|
-
children: /* @__PURE__ */
|
|
756
|
+
children: /* @__PURE__ */ jsx10("label", {
|
|
666
757
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
667
758
|
children: computedProps.label
|
|
668
759
|
})
|
|
669
760
|
}),
|
|
670
761
|
fields.map((field) => {
|
|
671
762
|
var _a3;
|
|
672
|
-
return /* @__PURE__ */
|
|
673
|
-
children: /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
764
|
+
children: /* @__PURE__ */ jsxs2(Row, {
|
|
674
765
|
gutter: 24,
|
|
675
766
|
style: { flexFlow: "row nowrap" },
|
|
676
767
|
children: [
|
|
677
|
-
/* @__PURE__ */
|
|
768
|
+
/* @__PURE__ */ jsx10(Col, {
|
|
678
769
|
span: 23,
|
|
679
|
-
children: /* @__PURE__ */
|
|
770
|
+
children: /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
680
771
|
...field,
|
|
681
772
|
noStyle: true,
|
|
682
|
-
children: /* @__PURE__ */
|
|
773
|
+
children: /* @__PURE__ */ jsx10(InputNumber, {
|
|
683
774
|
style: { width: "100%" },
|
|
684
775
|
...computedProps.input
|
|
685
776
|
})
|
|
686
777
|
})
|
|
687
778
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ jsx10(Col, {
|
|
689
780
|
span: 1,
|
|
690
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
781
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx10(Button, {
|
|
691
782
|
danger: true,
|
|
692
783
|
type: "link",
|
|
693
784
|
style: { float: "right" },
|
|
694
|
-
icon: /* @__PURE__ */
|
|
785
|
+
icon: /* @__PURE__ */ jsx10(MinusCircleOutlined, {}),
|
|
695
786
|
onClick: () => remove(field.name)
|
|
696
787
|
})
|
|
697
788
|
})
|
|
@@ -699,19 +790,19 @@ function FormItem(props) {
|
|
|
699
790
|
})
|
|
700
791
|
}, field.key);
|
|
701
792
|
}),
|
|
702
|
-
/* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
703
794
|
children: [
|
|
704
|
-
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
795
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx10(Button, {
|
|
705
796
|
type: "dashed",
|
|
706
797
|
block: true,
|
|
707
798
|
onClick: () => add(),
|
|
708
|
-
icon: /* @__PURE__ */
|
|
799
|
+
icon: /* @__PURE__ */ jsx10(PlusOutlined, {})
|
|
709
800
|
}),
|
|
710
|
-
computedProps.extra && /* @__PURE__ */
|
|
801
|
+
computedProps.extra && /* @__PURE__ */ jsx10("div", {
|
|
711
802
|
className: "ant-form-item-extra",
|
|
712
803
|
children: computedProps.extra
|
|
713
804
|
}),
|
|
714
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ jsx10(AntdForm.ErrorList, {
|
|
715
806
|
errors
|
|
716
807
|
})
|
|
717
808
|
]
|
|
@@ -721,58 +812,58 @@ function FormItem(props) {
|
|
|
721
812
|
}
|
|
722
813
|
});
|
|
723
814
|
case "boolean":
|
|
724
|
-
return /* @__PURE__ */
|
|
815
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
725
816
|
...computedProps,
|
|
726
|
-
children: /* @__PURE__ */
|
|
817
|
+
children: /* @__PURE__ */ jsx10(Switch, {
|
|
727
818
|
...computedProps.input
|
|
728
819
|
})
|
|
729
820
|
});
|
|
730
821
|
case "date":
|
|
731
|
-
return /* @__PURE__ */
|
|
822
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
732
823
|
...computedProps,
|
|
733
|
-
children: /* @__PURE__ */
|
|
824
|
+
children: /* @__PURE__ */ jsx10(DatePicker, {
|
|
734
825
|
...computedProps.input
|
|
735
826
|
})
|
|
736
827
|
});
|
|
737
828
|
case "time":
|
|
738
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ jsx10(AntdForm.Item, {
|
|
739
830
|
...computedProps,
|
|
740
|
-
children: /* @__PURE__ */
|
|
831
|
+
children: /* @__PURE__ */ jsx10(TimePicker, {
|
|
741
832
|
...computedProps.input
|
|
742
833
|
})
|
|
743
834
|
});
|
|
744
835
|
case "object":
|
|
745
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ jsxs2(Fragment3, {
|
|
746
837
|
children: [
|
|
747
|
-
computedProps.label && /* @__PURE__ */
|
|
838
|
+
computedProps.label && /* @__PURE__ */ jsx10("div", {
|
|
748
839
|
className: "ant-form-item-label",
|
|
749
|
-
children: /* @__PURE__ */
|
|
840
|
+
children: /* @__PURE__ */ jsx10("label", {
|
|
750
841
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
751
842
|
children: computedProps.label
|
|
752
843
|
})
|
|
753
844
|
}),
|
|
754
|
-
computedProps.object.map((o) => /* @__PURE__ */
|
|
845
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx10(FormItem, {
|
|
755
846
|
...o
|
|
756
847
|
}, o.id))
|
|
757
848
|
]
|
|
758
849
|
});
|
|
759
850
|
case "object[]":
|
|
760
|
-
return /* @__PURE__ */
|
|
851
|
+
return /* @__PURE__ */ jsx10(AntdForm.List, {
|
|
761
852
|
name: computedProps.name,
|
|
762
853
|
rules: computedProps.rules,
|
|
763
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */
|
|
854
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs2(Fragment3, {
|
|
764
855
|
children: [
|
|
765
|
-
fields.map((field) => /* @__PURE__ */
|
|
856
|
+
fields.map((field) => /* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
766
857
|
style: { marginBottom: 0 },
|
|
767
858
|
children: [
|
|
768
|
-
/* @__PURE__ */
|
|
859
|
+
/* @__PURE__ */ jsx10("div", {
|
|
769
860
|
className: "ant-form-item-label",
|
|
770
|
-
children: /* @__PURE__ */
|
|
861
|
+
children: /* @__PURE__ */ jsxs2("label", {
|
|
771
862
|
children: [
|
|
772
863
|
computedProps.label,
|
|
773
864
|
" ",
|
|
774
865
|
field.name + 1,
|
|
775
|
-
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */
|
|
866
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx10(Button, {
|
|
776
867
|
danger: true,
|
|
777
868
|
type: "link",
|
|
778
869
|
onClick: () => remove(field.name),
|
|
@@ -781,11 +872,11 @@ function FormItem(props) {
|
|
|
781
872
|
]
|
|
782
873
|
})
|
|
783
874
|
}),
|
|
784
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ jsx10(Row, {
|
|
785
876
|
gutter: 24,
|
|
786
|
-
children: computedProps.object.map((o) => /* @__PURE__ */
|
|
877
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ jsx10(Col, {
|
|
787
878
|
span: o.col || 24,
|
|
788
|
-
children: /* @__PURE__ */
|
|
879
|
+
children: /* @__PURE__ */ jsx10(FormItem, {
|
|
789
880
|
...o,
|
|
790
881
|
name: [field.name, o.id]
|
|
791
882
|
})
|
|
@@ -793,24 +884,24 @@ function FormItem(props) {
|
|
|
793
884
|
})
|
|
794
885
|
]
|
|
795
886
|
}, field.key)),
|
|
796
|
-
/* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ jsxs2(AntdForm.Item, {
|
|
797
888
|
children: [
|
|
798
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */
|
|
889
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs2(Button, {
|
|
799
890
|
type: "dashed",
|
|
800
891
|
block: true,
|
|
801
892
|
onClick: () => add(),
|
|
802
|
-
icon: /* @__PURE__ */
|
|
893
|
+
icon: /* @__PURE__ */ jsx10(PlusOutlined, {}),
|
|
803
894
|
children: [
|
|
804
895
|
common2.add,
|
|
805
896
|
" ",
|
|
806
897
|
computedProps.label
|
|
807
898
|
]
|
|
808
899
|
}),
|
|
809
|
-
computedProps.extra && /* @__PURE__ */
|
|
900
|
+
computedProps.extra && /* @__PURE__ */ jsx10("div", {
|
|
810
901
|
className: "ant-form-item-extra",
|
|
811
902
|
children: computedProps.extra
|
|
812
903
|
}),
|
|
813
|
-
/* @__PURE__ */
|
|
904
|
+
/* @__PURE__ */ jsx10(AntdForm.ErrorList, {
|
|
814
905
|
errors
|
|
815
906
|
})
|
|
816
907
|
]
|
|
@@ -825,15 +916,15 @@ function FormItem(props) {
|
|
|
825
916
|
FormItem.useStatus = AntdForm.Item.useStatus;
|
|
826
917
|
|
|
827
918
|
// src/Form.tsx
|
|
828
|
-
import { jsx as
|
|
919
|
+
import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
829
920
|
function Form(props) {
|
|
830
921
|
var _a, _b;
|
|
831
|
-
const [loading, setLoading] =
|
|
832
|
-
const [computedProps, setComputedProps] =
|
|
922
|
+
const [loading, setLoading] = useState6(false);
|
|
923
|
+
const [computedProps, setComputedProps] = useState6();
|
|
833
924
|
const config = useConfigContext();
|
|
834
|
-
const [extendTypes, setExtendTypes] =
|
|
925
|
+
const [extendTypes, setExtendTypes] = useState6();
|
|
835
926
|
const [form] = AntdForm2.useForm(props.form);
|
|
836
|
-
const [initialValues, setInitialValues] =
|
|
927
|
+
const [initialValues, setInitialValues] = useState6(props.initialValues);
|
|
837
928
|
useEffect4(() => {
|
|
838
929
|
var _a2, _b2, _c;
|
|
839
930
|
const propsCopy = {
|
|
@@ -923,17 +1014,17 @@ function Form(props) {
|
|
|
923
1014
|
}, [computedProps]);
|
|
924
1015
|
if (!computedProps)
|
|
925
1016
|
return null;
|
|
926
|
-
return /* @__PURE__ */
|
|
1017
|
+
return /* @__PURE__ */ jsxs3(AntdForm2, {
|
|
927
1018
|
...computedProps,
|
|
928
1019
|
onValuesChange,
|
|
929
1020
|
children: [
|
|
930
1021
|
computedProps.beforeItems,
|
|
931
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */
|
|
1022
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx11(FormItem, {
|
|
932
1023
|
...item,
|
|
933
1024
|
extendTypes
|
|
934
1025
|
}, item.id)),
|
|
935
1026
|
computedProps.children,
|
|
936
|
-
computedProps.submit !== false && /* @__PURE__ */
|
|
1027
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx11(Button2, {
|
|
937
1028
|
htmlType: "submit",
|
|
938
1029
|
type: "primary",
|
|
939
1030
|
loading,
|
|
@@ -954,7 +1045,7 @@ Form.Provider = AntdForm2.Provider;
|
|
|
954
1045
|
// src/Link.tsx
|
|
955
1046
|
import { Link as RouterLink } from "react-router-dom";
|
|
956
1047
|
import { Button as Button3 } from "antd";
|
|
957
|
-
import { jsx as
|
|
1048
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
958
1049
|
function Link(props) {
|
|
959
1050
|
var _a, _b, _c, _d;
|
|
960
1051
|
const { Link: Link2 } = useConfigContext();
|
|
@@ -970,14 +1061,14 @@ function Link(props) {
|
|
|
970
1061
|
}, style);
|
|
971
1062
|
if (props.href.startsWith("http")) {
|
|
972
1063
|
if (props.button)
|
|
973
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ jsx12(Button3, {
|
|
974
1065
|
...props.button,
|
|
975
1066
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
976
1067
|
style,
|
|
977
1068
|
href: props.href,
|
|
978
1069
|
children: (_a = props.text) != null ? _a : props.children
|
|
979
1070
|
});
|
|
980
|
-
return /* @__PURE__ */
|
|
1071
|
+
return /* @__PURE__ */ jsx12("a", {
|
|
981
1072
|
href: props.href,
|
|
982
1073
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
983
1074
|
style,
|
|
@@ -985,16 +1076,16 @@ function Link(props) {
|
|
|
985
1076
|
});
|
|
986
1077
|
}
|
|
987
1078
|
if (props.button)
|
|
988
|
-
return /* @__PURE__ */
|
|
1079
|
+
return /* @__PURE__ */ jsx12(RouterLink, {
|
|
989
1080
|
to: props.href,
|
|
990
1081
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
991
|
-
children: /* @__PURE__ */
|
|
1082
|
+
children: /* @__PURE__ */ jsx12(Button3, {
|
|
992
1083
|
...props.button,
|
|
993
1084
|
style,
|
|
994
1085
|
children: (_c = props.text) != null ? _c : props.children
|
|
995
1086
|
})
|
|
996
1087
|
});
|
|
997
|
-
return /* @__PURE__ */
|
|
1088
|
+
return /* @__PURE__ */ jsx12(RouterLink, {
|
|
998
1089
|
to: props.href,
|
|
999
1090
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1000
1091
|
style,
|
|
@@ -1002,33 +1093,6 @@ function Link(props) {
|
|
|
1002
1093
|
});
|
|
1003
1094
|
}
|
|
1004
1095
|
|
|
1005
|
-
// src/Modal.tsx
|
|
1006
|
-
import { Modal } from "antd";
|
|
1007
|
-
import { useState as useState6 } from "react";
|
|
1008
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1009
|
-
function useModal(init) {
|
|
1010
|
-
const [props, setProps] = useState6({
|
|
1011
|
-
open: false,
|
|
1012
|
-
onCancel: () => setProps((prev) => ({
|
|
1013
|
-
...prev,
|
|
1014
|
-
open: false
|
|
1015
|
-
})),
|
|
1016
|
-
...init
|
|
1017
|
-
});
|
|
1018
|
-
return {
|
|
1019
|
-
modal: /* @__PURE__ */ jsx11(Modal, {
|
|
1020
|
-
...props
|
|
1021
|
-
}),
|
|
1022
|
-
modalProps: props,
|
|
1023
|
-
setModalProps(changes) {
|
|
1024
|
-
setProps((prev) => ({
|
|
1025
|
-
...prev,
|
|
1026
|
-
...changes
|
|
1027
|
-
}));
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
1096
|
// src/Routers.tsx
|
|
1033
1097
|
import { Result, Skeleton } from "antd";
|
|
1034
1098
|
import {
|
|
@@ -1038,32 +1102,32 @@ import {
|
|
|
1038
1102
|
Routes as OriginRoutes,
|
|
1039
1103
|
Route
|
|
1040
1104
|
} from "react-router-dom";
|
|
1041
|
-
import { jsx as
|
|
1105
|
+
import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1042
1106
|
function PageNotFound() {
|
|
1043
1107
|
const config = useConfigContext();
|
|
1044
|
-
return /* @__PURE__ */
|
|
1108
|
+
return /* @__PURE__ */ jsx13(Result, {
|
|
1045
1109
|
status: "404",
|
|
1046
1110
|
title: config.common.pageNotFound
|
|
1047
1111
|
});
|
|
1048
1112
|
}
|
|
1049
1113
|
function Routes(props) {
|
|
1050
|
-
return /* @__PURE__ */
|
|
1114
|
+
return /* @__PURE__ */ jsxs4(OriginRoutes, {
|
|
1051
1115
|
children: [
|
|
1052
|
-
props.routes.map((r) => /* @__PURE__ */
|
|
1116
|
+
props.routes.map((r) => /* @__PURE__ */ jsx13(Route, {
|
|
1053
1117
|
...r,
|
|
1054
|
-
element: r.element || /* @__PURE__ */
|
|
1055
|
-
fallback: props.fallback || /* @__PURE__ */
|
|
1118
|
+
element: r.element || /* @__PURE__ */ jsx13(Suspense, {
|
|
1119
|
+
fallback: props.fallback || /* @__PURE__ */ jsx13("div", {
|
|
1056
1120
|
style: { padding: "24px" },
|
|
1057
|
-
children: /* @__PURE__ */
|
|
1121
|
+
children: /* @__PURE__ */ jsx13(Skeleton, {
|
|
1058
1122
|
active: true
|
|
1059
1123
|
})
|
|
1060
1124
|
}),
|
|
1061
|
-
children: /* @__PURE__ */
|
|
1125
|
+
children: /* @__PURE__ */ jsx13(r.page, {})
|
|
1062
1126
|
})
|
|
1063
1127
|
}, r.path)),
|
|
1064
|
-
/* @__PURE__ */
|
|
1128
|
+
/* @__PURE__ */ jsx13(Route, {
|
|
1065
1129
|
path: "*",
|
|
1066
|
-
element: props.notFound || /* @__PURE__ */
|
|
1130
|
+
element: props.notFound || /* @__PURE__ */ jsx13(PageNotFound, {})
|
|
1067
1131
|
}, "*")
|
|
1068
1132
|
]
|
|
1069
1133
|
});
|
|
@@ -1087,12 +1151,12 @@ import {
|
|
|
1087
1151
|
uniqBy,
|
|
1088
1152
|
upperFirst as upperFirst4
|
|
1089
1153
|
} from "lodash-es";
|
|
1090
|
-
import { Fragment as Fragment4, jsx as
|
|
1154
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1091
1155
|
function processValue(item, value) {
|
|
1092
1156
|
var _a;
|
|
1093
1157
|
const transferred = transferValue(item.type, value);
|
|
1094
1158
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
1095
|
-
return /* @__PURE__ */
|
|
1159
|
+
return /* @__PURE__ */ jsx14(Blank, {});
|
|
1096
1160
|
if (item.options) {
|
|
1097
1161
|
if (item.type.endsWith("[]"))
|
|
1098
1162
|
return transferred.map((v) => {
|
|
@@ -1132,7 +1196,7 @@ function Table(props) {
|
|
|
1132
1196
|
text: o.label,
|
|
1133
1197
|
value: o.value
|
|
1134
1198
|
})).concat({
|
|
1135
|
-
text: /* @__PURE__ */
|
|
1199
|
+
text: /* @__PURE__ */ jsx14(Blank, {}),
|
|
1136
1200
|
value: null
|
|
1137
1201
|
});
|
|
1138
1202
|
}
|
|
@@ -1191,7 +1255,7 @@ function Table(props) {
|
|
|
1191
1255
|
setSelectedKeys,
|
|
1192
1256
|
confirm,
|
|
1193
1257
|
clearFilters
|
|
1194
|
-
}) => /* @__PURE__ */
|
|
1258
|
+
}) => /* @__PURE__ */ jsx14(Input2.Search, {
|
|
1195
1259
|
placeholder: `${common2.search} ${item.title}`,
|
|
1196
1260
|
allowClear: true,
|
|
1197
1261
|
onSearch: (v) => {
|
|
@@ -1221,7 +1285,7 @@ function Table(props) {
|
|
|
1221
1285
|
setSelectedKeys,
|
|
1222
1286
|
confirm,
|
|
1223
1287
|
clearFilters
|
|
1224
|
-
}) => /* @__PURE__ */
|
|
1288
|
+
}) => /* @__PURE__ */ jsx14(Input2.Search, {
|
|
1225
1289
|
placeholder: `${common2.search} ${item.title}`,
|
|
1226
1290
|
allowClear: true,
|
|
1227
1291
|
onSearch: (v) => {
|
|
@@ -1251,7 +1315,7 @@ function Table(props) {
|
|
|
1251
1315
|
setSelectedKeys,
|
|
1252
1316
|
confirm,
|
|
1253
1317
|
clearFilters
|
|
1254
|
-
}) => /* @__PURE__ */
|
|
1318
|
+
}) => /* @__PURE__ */ jsx14(Input2.Search, {
|
|
1255
1319
|
placeholder: `${common2.search} ${item.title}`,
|
|
1256
1320
|
allowClear: true,
|
|
1257
1321
|
onSearch: (v) => {
|
|
@@ -1281,7 +1345,7 @@ function Table(props) {
|
|
|
1281
1345
|
setSelectedKeys,
|
|
1282
1346
|
confirm,
|
|
1283
1347
|
clearFilters
|
|
1284
|
-
}) => /* @__PURE__ */
|
|
1348
|
+
}) => /* @__PURE__ */ jsx14(Input2.Search, {
|
|
1285
1349
|
placeholder: `${common2.search} ${item.title}`,
|
|
1286
1350
|
allowClear: true,
|
|
1287
1351
|
onSearch: (v) => {
|
|
@@ -1297,12 +1361,12 @@ function Table(props) {
|
|
|
1297
1361
|
break;
|
|
1298
1362
|
case "boolean":
|
|
1299
1363
|
if (!item.render)
|
|
1300
|
-
item.render = (value) => isNil2(value) ? /* @__PURE__ */
|
|
1364
|
+
item.render = (value) => isNil2(value) ? /* @__PURE__ */ jsx14(Blank, {}) : value ? /* @__PURE__ */ jsx14(CheckOutlined2, {
|
|
1301
1365
|
style: {
|
|
1302
1366
|
marginTop: "4px",
|
|
1303
1367
|
color: "#52c41a"
|
|
1304
1368
|
}
|
|
1305
|
-
}) : /* @__PURE__ */
|
|
1369
|
+
}) : /* @__PURE__ */ jsx14(CloseOutlined2, {
|
|
1306
1370
|
style: {
|
|
1307
1371
|
marginTop: "4px",
|
|
1308
1372
|
color: "#ff4d4f"
|
|
@@ -1313,7 +1377,7 @@ function Table(props) {
|
|
|
1313
1377
|
setSelectedKeys,
|
|
1314
1378
|
selectedKeys,
|
|
1315
1379
|
confirm
|
|
1316
|
-
}) => /* @__PURE__ */
|
|
1380
|
+
}) => /* @__PURE__ */ jsxs5(Radio.Group, {
|
|
1317
1381
|
style: { padding: 8 },
|
|
1318
1382
|
buttonStyle: "solid",
|
|
1319
1383
|
value: selectedKeys[0],
|
|
@@ -1327,28 +1391,28 @@ function Table(props) {
|
|
|
1327
1391
|
confirm();
|
|
1328
1392
|
},
|
|
1329
1393
|
children: [
|
|
1330
|
-
/* @__PURE__ */
|
|
1394
|
+
/* @__PURE__ */ jsx14(Radio.Button, {
|
|
1331
1395
|
children: common2.all
|
|
1332
1396
|
}),
|
|
1333
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ jsx14(Radio.Button, {
|
|
1334
1398
|
value: "true",
|
|
1335
|
-
children: /* @__PURE__ */
|
|
1399
|
+
children: /* @__PURE__ */ jsx14(CheckOutlined2, {
|
|
1336
1400
|
style: {
|
|
1337
1401
|
color: "#52c41a",
|
|
1338
1402
|
verticalAlign: "middle"
|
|
1339
1403
|
}
|
|
1340
1404
|
})
|
|
1341
1405
|
}),
|
|
1342
|
-
/* @__PURE__ */
|
|
1406
|
+
/* @__PURE__ */ jsx14(Radio.Button, {
|
|
1343
1407
|
value: "false",
|
|
1344
|
-
children: /* @__PURE__ */
|
|
1408
|
+
children: /* @__PURE__ */ jsx14(CloseOutlined2, {
|
|
1345
1409
|
style: {
|
|
1346
1410
|
verticalAlign: "middle",
|
|
1347
1411
|
color: "#ff4d4f"
|
|
1348
1412
|
}
|
|
1349
1413
|
})
|
|
1350
1414
|
}),
|
|
1351
|
-
/* @__PURE__ */
|
|
1415
|
+
/* @__PURE__ */ jsx14(Radio.Button, {
|
|
1352
1416
|
value: "null",
|
|
1353
1417
|
children: common2.blank
|
|
1354
1418
|
})
|
|
@@ -1396,7 +1460,7 @@ function Table(props) {
|
|
|
1396
1460
|
break;
|
|
1397
1461
|
case "object":
|
|
1398
1462
|
if (!item.render)
|
|
1399
|
-
item.render = (value) => /* @__PURE__ */
|
|
1463
|
+
item.render = (value) => /* @__PURE__ */ jsx14(Description, {
|
|
1400
1464
|
items: item.object,
|
|
1401
1465
|
dataSource: value || {},
|
|
1402
1466
|
column: 1
|
|
@@ -1404,8 +1468,8 @@ function Table(props) {
|
|
|
1404
1468
|
break;
|
|
1405
1469
|
case "object[]":
|
|
1406
1470
|
if (!item.render)
|
|
1407
|
-
item.render = (value) => /* @__PURE__ */
|
|
1408
|
-
children: value.map((v, i) => /* @__PURE__ */
|
|
1471
|
+
item.render = (value) => /* @__PURE__ */ jsx14(Fragment4, {
|
|
1472
|
+
children: value.map((v, i) => /* @__PURE__ */ jsx14(Description, {
|
|
1409
1473
|
items: item.object,
|
|
1410
1474
|
dataSource: v || [],
|
|
1411
1475
|
column: 1
|
|
@@ -1440,7 +1504,7 @@ function Table(props) {
|
|
|
1440
1504
|
const newColumns = [...prev];
|
|
1441
1505
|
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1442
1506
|
newColumns[index].filters = filters.concat({
|
|
1443
|
-
text: /* @__PURE__ */
|
|
1507
|
+
text: /* @__PURE__ */ jsx14(Blank, {}),
|
|
1444
1508
|
value: null
|
|
1445
1509
|
});
|
|
1446
1510
|
return newColumns;
|
|
@@ -1451,15 +1515,15 @@ function Table(props) {
|
|
|
1451
1515
|
if (!columns)
|
|
1452
1516
|
return null;
|
|
1453
1517
|
if (props.dataSource)
|
|
1454
|
-
return /* @__PURE__ */
|
|
1518
|
+
return /* @__PURE__ */ jsx14(AntdTable, {
|
|
1455
1519
|
...props,
|
|
1456
1520
|
rowKey: props.rowKey || "id",
|
|
1457
1521
|
columns,
|
|
1458
1522
|
dataSource: props.dataSource
|
|
1459
1523
|
});
|
|
1460
|
-
return /* @__PURE__ */
|
|
1524
|
+
return /* @__PURE__ */ jsx14(FaasDataWrapper, {
|
|
1461
1525
|
...props.faasData,
|
|
1462
|
-
children: /* @__PURE__ */
|
|
1526
|
+
children: /* @__PURE__ */ jsx14(FaasDataTable, {
|
|
1463
1527
|
props,
|
|
1464
1528
|
columns
|
|
1465
1529
|
})
|
|
@@ -1485,7 +1549,7 @@ function FaasDataTable({
|
|
|
1485
1549
|
text: v.label,
|
|
1486
1550
|
value: v.value
|
|
1487
1551
|
})).concat({
|
|
1488
|
-
text: /* @__PURE__ */
|
|
1552
|
+
text: /* @__PURE__ */ jsx14(Blank, {}),
|
|
1489
1553
|
value: null
|
|
1490
1554
|
});
|
|
1491
1555
|
column.render = (value) => processValue(column, value);
|
|
@@ -1500,7 +1564,7 @@ function FaasDataTable({
|
|
|
1500
1564
|
}));
|
|
1501
1565
|
if (filters.length)
|
|
1502
1566
|
column.filters = filters.concat({
|
|
1503
|
-
text: /* @__PURE__ */
|
|
1567
|
+
text: /* @__PURE__ */ jsx14(Blank, {}),
|
|
1504
1568
|
value: null
|
|
1505
1569
|
});
|
|
1506
1570
|
}
|
|
@@ -1509,20 +1573,20 @@ function FaasDataTable({
|
|
|
1509
1573
|
});
|
|
1510
1574
|
}, [columns, data]);
|
|
1511
1575
|
if (!data)
|
|
1512
|
-
return /* @__PURE__ */
|
|
1576
|
+
return /* @__PURE__ */ jsx14(AntdTable, {
|
|
1513
1577
|
...props,
|
|
1514
1578
|
rowKey: props.rowKey || "id",
|
|
1515
1579
|
columns: currentColumns,
|
|
1516
1580
|
dataSource: []
|
|
1517
1581
|
});
|
|
1518
1582
|
if (Array.isArray(data))
|
|
1519
|
-
return /* @__PURE__ */
|
|
1583
|
+
return /* @__PURE__ */ jsx14(AntdTable, {
|
|
1520
1584
|
...props,
|
|
1521
1585
|
rowKey: props.rowKey || "id",
|
|
1522
1586
|
columns: currentColumns,
|
|
1523
1587
|
dataSource: data
|
|
1524
1588
|
});
|
|
1525
|
-
return /* @__PURE__ */
|
|
1589
|
+
return /* @__PURE__ */ jsx14(AntdTable, {
|
|
1526
1590
|
...props,
|
|
1527
1591
|
rowKey: props.rowKey || "id",
|
|
1528
1592
|
columns: currentColumns,
|
|
@@ -1554,7 +1618,7 @@ function FaasDataTable({
|
|
|
1554
1618
|
|
|
1555
1619
|
// src/Title.tsx
|
|
1556
1620
|
import { useEffect as useEffect6, cloneElement as cloneElement4 } from "react";
|
|
1557
|
-
import { Fragment as Fragment5, jsx as
|
|
1621
|
+
import { Fragment as Fragment5, jsx as jsx15 } from "react/jsx-runtime";
|
|
1558
1622
|
function Title(props) {
|
|
1559
1623
|
const { Title: Title2 } = useConfigContext();
|
|
1560
1624
|
useEffect6(() => {
|
|
@@ -1563,17 +1627,17 @@ function Title(props) {
|
|
|
1563
1627
|
}, [props]);
|
|
1564
1628
|
if (props.h1) {
|
|
1565
1629
|
if (typeof props.h1 === "boolean")
|
|
1566
|
-
return /* @__PURE__ */
|
|
1630
|
+
return /* @__PURE__ */ jsx15("h1", {
|
|
1567
1631
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1568
1632
|
});
|
|
1569
|
-
return /* @__PURE__ */
|
|
1633
|
+
return /* @__PURE__ */ jsx15("h1", {
|
|
1570
1634
|
className: props.h1.className,
|
|
1571
1635
|
style: props.h1.style,
|
|
1572
1636
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1573
1637
|
});
|
|
1574
1638
|
}
|
|
1575
1639
|
if (props.plain)
|
|
1576
|
-
return /* @__PURE__ */
|
|
1640
|
+
return /* @__PURE__ */ jsx15(Fragment5, {
|
|
1577
1641
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1578
1642
|
});
|
|
1579
1643
|
if (props.children)
|
|
@@ -1581,9 +1645,10 @@ function Title(props) {
|
|
|
1581
1645
|
return null;
|
|
1582
1646
|
}
|
|
1583
1647
|
export {
|
|
1648
|
+
App,
|
|
1584
1649
|
Blank,
|
|
1585
1650
|
ConfigContext,
|
|
1586
|
-
ConfigProvider,
|
|
1651
|
+
ConfigProvider2 as ConfigProvider,
|
|
1587
1652
|
Description,
|
|
1588
1653
|
Drawer,
|
|
1589
1654
|
ErrorBoundary,
|
|
@@ -1599,6 +1664,7 @@ export {
|
|
|
1599
1664
|
Title,
|
|
1600
1665
|
transferOptions,
|
|
1601
1666
|
transferValue,
|
|
1667
|
+
useApp,
|
|
1602
1668
|
useConfigContext,
|
|
1603
1669
|
useDrawer,
|
|
1604
1670
|
useModal
|