@faasjs/ant-design 0.0.3-beta.38 → 0.0.3-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +664 -646
- package/dist/index.mjs +640 -630
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
1
|
// react-shim.js
|
|
22
2
|
import React from "react";
|
|
23
3
|
|
|
@@ -89,7 +69,10 @@ function ConfigProvider({
|
|
|
89
69
|
} else
|
|
90
70
|
setValues(defaultsDeep(config, values));
|
|
91
71
|
}, []);
|
|
92
|
-
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
72
|
+
return /* @__PURE__ */ jsx(ConfigContext.Provider, {
|
|
73
|
+
value: values,
|
|
74
|
+
children
|
|
75
|
+
});
|
|
93
76
|
}
|
|
94
77
|
function useConfigContext() {
|
|
95
78
|
return useContext(ConfigContext);
|
|
@@ -99,7 +82,10 @@ function useConfigContext() {
|
|
|
99
82
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
100
83
|
function Blank(options) {
|
|
101
84
|
const { Blank: Blank2 } = useConfigContext();
|
|
102
|
-
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx2(Typography.Text, {
|
|
85
|
+
return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx2(Typography.Text, {
|
|
86
|
+
disabled: true,
|
|
87
|
+
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
88
|
+
}) : options.value;
|
|
103
89
|
}
|
|
104
90
|
|
|
105
91
|
// src/data.ts
|
|
@@ -137,71 +123,55 @@ import {
|
|
|
137
123
|
} from "antd";
|
|
138
124
|
import { isFunction, upperFirst as upperFirst2 } from "lodash-es";
|
|
139
125
|
import {
|
|
140
|
-
cloneElement
|
|
141
|
-
useEffect as useEffect3,
|
|
142
|
-
useState as useState3
|
|
143
|
-
} from "react";
|
|
144
|
-
|
|
145
|
-
// ../react/src/index.tsx
|
|
146
|
-
import {
|
|
147
|
-
useState as useState2,
|
|
126
|
+
cloneElement,
|
|
148
127
|
useEffect as useEffect2,
|
|
149
|
-
|
|
150
|
-
cloneElement
|
|
128
|
+
useState as useState2
|
|
151
129
|
} from "react";
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (!client)
|
|
156
|
-
throw Error("FaasReactClient is not initialized");
|
|
157
|
-
return client;
|
|
158
|
-
}
|
|
159
|
-
async function faas(action, params) {
|
|
160
|
-
return getClient().faas(action, params);
|
|
161
|
-
}
|
|
162
|
-
function FaasDataWrapper(props) {
|
|
163
|
-
const [client, setClient] = useState2();
|
|
164
|
-
useEffect2(() => {
|
|
165
|
-
if (client)
|
|
166
|
-
return;
|
|
167
|
-
setClient(getClient());
|
|
168
|
-
}, []);
|
|
169
|
-
if (!client)
|
|
170
|
-
return props.fallback || null;
|
|
171
|
-
return createElement(client.FaasDataWrapper, props);
|
|
172
|
-
}
|
|
130
|
+
|
|
131
|
+
// src/FaasDataWrapper.tsx
|
|
132
|
+
import { FaasDataWrapper as Origin } from "@faasjs/react";
|
|
173
133
|
|
|
174
134
|
// src/Loading.tsx
|
|
175
135
|
import { Spin } from "antd";
|
|
176
136
|
import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
|
|
177
137
|
function Loading(props) {
|
|
178
138
|
if (props.loading === false)
|
|
179
|
-
return /* @__PURE__ */ jsx3(Fragment, {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
139
|
+
return /* @__PURE__ */ jsx3(Fragment, {
|
|
140
|
+
children: props.children
|
|
141
|
+
});
|
|
142
|
+
return /* @__PURE__ */ jsx3("div", {
|
|
143
|
+
style: {
|
|
144
|
+
...props.style || {},
|
|
145
|
+
...!props.size || props.size === "large" ? {
|
|
146
|
+
margin: "20vh auto",
|
|
147
|
+
textAlign: "center"
|
|
148
|
+
} : {}
|
|
149
|
+
},
|
|
150
|
+
children: /* @__PURE__ */ jsx3(Spin, {
|
|
151
|
+
size: props.size || "large"
|
|
152
|
+
})
|
|
153
|
+
});
|
|
184
154
|
}
|
|
185
155
|
|
|
186
156
|
// src/FaasDataWrapper.tsx
|
|
187
157
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
188
|
-
function
|
|
189
|
-
return /* @__PURE__ */ jsx4(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
);
|
|
158
|
+
function FaasDataWrapper(props) {
|
|
159
|
+
return /* @__PURE__ */ jsx4(Origin, {
|
|
160
|
+
fallback: props.loading || /* @__PURE__ */ jsx4(Loading, {
|
|
161
|
+
...props.loadingProps
|
|
162
|
+
}),
|
|
163
|
+
...props
|
|
164
|
+
});
|
|
195
165
|
}
|
|
196
166
|
|
|
197
167
|
// src/Description.tsx
|
|
198
168
|
import { Fragment as Fragment2, jsx as jsx5 } from "react/jsx-runtime";
|
|
199
169
|
function DescriptionItemContent(props) {
|
|
200
170
|
var _a;
|
|
201
|
-
const [computedProps, setComputedProps] =
|
|
202
|
-
|
|
171
|
+
const [computedProps, setComputedProps] = useState2();
|
|
172
|
+
useEffect2(() => {
|
|
203
173
|
var _a2, _b;
|
|
204
|
-
const propsCopy =
|
|
174
|
+
const propsCopy = { ...props };
|
|
205
175
|
if (!propsCopy.item.title)
|
|
206
176
|
propsCopy.item.title = upperFirst2(propsCopy.item.id);
|
|
207
177
|
if (!propsCopy.item.type)
|
|
@@ -229,7 +199,7 @@ function DescriptionItemContent(props) {
|
|
|
229
199
|
return null;
|
|
230
200
|
if (computedProps.extendTypes && computedProps.extendTypes[computedProps.item.type])
|
|
231
201
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
232
|
-
return
|
|
202
|
+
return cloneElement(
|
|
233
203
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
234
204
|
{
|
|
235
205
|
scene: "description",
|
|
@@ -238,13 +208,15 @@ function DescriptionItemContent(props) {
|
|
|
238
208
|
}
|
|
239
209
|
);
|
|
240
210
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
241
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
211
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
212
|
+
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
213
|
+
});
|
|
242
214
|
else
|
|
243
215
|
throw Error(computedProps.item.type + " requires children or render");
|
|
244
216
|
if (computedProps.item.descriptionChildren === null)
|
|
245
217
|
return null;
|
|
246
218
|
if (computedProps.item.descriptionChildren)
|
|
247
|
-
return
|
|
219
|
+
return cloneElement(computedProps.item.descriptionChildren, {
|
|
248
220
|
scene: "description",
|
|
249
221
|
value: computedProps.value,
|
|
250
222
|
values: computedProps.values
|
|
@@ -252,7 +224,7 @@ function DescriptionItemContent(props) {
|
|
|
252
224
|
if (computedProps.item.children === null)
|
|
253
225
|
return null;
|
|
254
226
|
if (computedProps.item.children)
|
|
255
|
-
return
|
|
227
|
+
return cloneElement(computedProps.item.children, {
|
|
256
228
|
scene: "description",
|
|
257
229
|
value: computedProps.value,
|
|
258
230
|
values: computedProps.values
|
|
@@ -265,125 +237,120 @@ function DescriptionItemContent(props) {
|
|
|
265
237
|
return /* @__PURE__ */ jsx5(Blank, {});
|
|
266
238
|
switch (computedProps.item.type) {
|
|
267
239
|
case "string[]":
|
|
268
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
240
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
241
|
+
children: computedProps.value.join(", ")
|
|
242
|
+
});
|
|
269
243
|
case "number":
|
|
270
244
|
return computedProps.value || null;
|
|
271
245
|
case "number[]":
|
|
272
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
246
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
247
|
+
children: computedProps.value.join(", ")
|
|
248
|
+
});
|
|
273
249
|
case "boolean":
|
|
274
|
-
return computedProps.value ? /* @__PURE__ */ jsx5(CheckOutlined, {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
250
|
+
return computedProps.value ? /* @__PURE__ */ jsx5(CheckOutlined, {
|
|
251
|
+
style: {
|
|
252
|
+
marginTop: "4px",
|
|
253
|
+
color: "#52c41a"
|
|
254
|
+
}
|
|
255
|
+
}) : /* @__PURE__ */ jsx5(CloseOutlined, {
|
|
256
|
+
style: {
|
|
257
|
+
marginTop: "4px",
|
|
258
|
+
color: "#ff4d4f"
|
|
259
|
+
}
|
|
260
|
+
});
|
|
281
261
|
case "time":
|
|
282
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
262
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
263
|
+
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
264
|
+
});
|
|
283
265
|
case "date":
|
|
284
|
-
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
266
|
+
return /* @__PURE__ */ jsx5(Fragment2, {
|
|
267
|
+
children: computedProps.value.format("YYYY-MM-DD")
|
|
268
|
+
});
|
|
285
269
|
case "object":
|
|
286
270
|
if (!computedProps.value)
|
|
287
271
|
return /* @__PURE__ */ jsx5(Blank, {});
|
|
288
|
-
return /* @__PURE__ */ jsx5(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
column: 1
|
|
294
|
-
}
|
|
295
|
-
);
|
|
272
|
+
return /* @__PURE__ */ jsx5(Description, {
|
|
273
|
+
items: computedProps.item.object,
|
|
274
|
+
dataSource: computedProps.value,
|
|
275
|
+
column: 1
|
|
276
|
+
});
|
|
296
277
|
case "object[]":
|
|
297
278
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
298
279
|
return /* @__PURE__ */ jsx5(Blank, {});
|
|
299
|
-
return /* @__PURE__ */ jsx5(Space, {
|
|
300
|
-
|
|
301
|
-
{
|
|
280
|
+
return /* @__PURE__ */ jsx5(Space, {
|
|
281
|
+
direction: "vertical",
|
|
282
|
+
children: computedProps.value.map((value, index) => /* @__PURE__ */ jsx5(Description, {
|
|
302
283
|
items: computedProps.item.object,
|
|
303
284
|
dataSource: value,
|
|
304
285
|
column: 1
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
)) });
|
|
286
|
+
}, index))
|
|
287
|
+
});
|
|
308
288
|
default:
|
|
309
289
|
return computedProps.value || null;
|
|
310
290
|
}
|
|
311
291
|
}
|
|
312
292
|
function Description(props) {
|
|
313
293
|
if (!props.faasData)
|
|
314
|
-
return /* @__PURE__ */ jsx5(
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
294
|
+
return /* @__PURE__ */ jsx5(Descriptions, {
|
|
295
|
+
...props,
|
|
296
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
297
|
+
children: props.items.map((item) => {
|
|
298
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ jsx5(Descriptions.Item, {
|
|
299
|
+
label: item.title || upperFirst2(item.id),
|
|
300
|
+
children: /* @__PURE__ */ jsx5(DescriptionItemContent, {
|
|
301
|
+
item,
|
|
302
|
+
value: props.dataSource[item.id],
|
|
303
|
+
values: props.dataSource,
|
|
304
|
+
extendTypes: props.extendTypes
|
|
305
|
+
})
|
|
306
|
+
}, item.id) : null;
|
|
307
|
+
}).filter(Boolean)
|
|
308
|
+
});
|
|
309
|
+
return /* @__PURE__ */ jsx5(FaasDataWrapper, {
|
|
310
|
+
render: ({ data }) => {
|
|
311
|
+
return /* @__PURE__ */ jsx5(Descriptions, {
|
|
312
|
+
...props,
|
|
313
|
+
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
318
314
|
children: props.items.map((item) => {
|
|
319
|
-
return !item.if || item.if(
|
|
320
|
-
|
|
321
|
-
{
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
values: props.dataSource,
|
|
329
|
-
extendTypes: props.extendTypes
|
|
330
|
-
}
|
|
331
|
-
)
|
|
332
|
-
},
|
|
333
|
-
item.id
|
|
334
|
-
) : null;
|
|
315
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ jsx5(Descriptions.Item, {
|
|
316
|
+
label: item.title || upperFirst2(item.id),
|
|
317
|
+
children: /* @__PURE__ */ jsx5(DescriptionItemContent, {
|
|
318
|
+
item,
|
|
319
|
+
value: data[item.id],
|
|
320
|
+
values: data,
|
|
321
|
+
extendTypes: props.extendTypes
|
|
322
|
+
})
|
|
323
|
+
}, item.id) : null;
|
|
335
324
|
}).filter(Boolean)
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
__spreadValues({
|
|
341
|
-
render: ({ data }) => {
|
|
342
|
-
return /* @__PURE__ */ jsx5(
|
|
343
|
-
Descriptions,
|
|
344
|
-
__spreadProps(__spreadValues({}, props), {
|
|
345
|
-
title: isFunction(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
346
|
-
children: props.items.map((item) => {
|
|
347
|
-
return !item.if || item.if(data) ? /* @__PURE__ */ jsx5(
|
|
348
|
-
Descriptions.Item,
|
|
349
|
-
{
|
|
350
|
-
label: item.title || upperFirst2(item.id),
|
|
351
|
-
children: /* @__PURE__ */ jsx5(
|
|
352
|
-
DescriptionItemContent,
|
|
353
|
-
{
|
|
354
|
-
item,
|
|
355
|
-
value: data[item.id],
|
|
356
|
-
values: data,
|
|
357
|
-
extendTypes: props.extendTypes
|
|
358
|
-
}
|
|
359
|
-
)
|
|
360
|
-
},
|
|
361
|
-
item.id
|
|
362
|
-
) : null;
|
|
363
|
-
}).filter(Boolean)
|
|
364
|
-
})
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
}, props.faasData)
|
|
368
|
-
);
|
|
325
|
+
});
|
|
326
|
+
},
|
|
327
|
+
...props.faasData
|
|
328
|
+
});
|
|
369
329
|
}
|
|
370
330
|
|
|
371
331
|
// src/Drawer.tsx
|
|
372
332
|
import { Drawer } from "antd";
|
|
373
|
-
import { useState as
|
|
333
|
+
import { useState as useState3 } from "react";
|
|
374
334
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
375
335
|
function useDrawer(init) {
|
|
376
|
-
const [props, setProps] =
|
|
336
|
+
const [props, setProps] = useState3({
|
|
377
337
|
open: false,
|
|
378
|
-
onClose: () => setProps((prev) =>
|
|
338
|
+
onClose: () => setProps((prev) => ({
|
|
339
|
+
...prev,
|
|
379
340
|
open: false
|
|
380
|
-
}))
|
|
381
|
-
|
|
341
|
+
})),
|
|
342
|
+
...init
|
|
343
|
+
});
|
|
382
344
|
return {
|
|
383
|
-
drawer: /* @__PURE__ */ jsx6(Drawer,
|
|
345
|
+
drawer: /* @__PURE__ */ jsx6(Drawer, {
|
|
346
|
+
...props
|
|
347
|
+
}),
|
|
384
348
|
drawerProps: props,
|
|
385
349
|
setDrawerProps(changes) {
|
|
386
|
-
setProps((prev) =>
|
|
350
|
+
setProps((prev) => ({
|
|
351
|
+
...prev,
|
|
352
|
+
...changes
|
|
353
|
+
}));
|
|
387
354
|
}
|
|
388
355
|
};
|
|
389
356
|
}
|
|
@@ -419,30 +386,31 @@ var ErrorBoundary = class extends Component {
|
|
|
419
386
|
if (error) {
|
|
420
387
|
if (this.props.onError)
|
|
421
388
|
return this.props.onError(error, info);
|
|
422
|
-
return /* @__PURE__ */ jsx7(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
description: /* @__PURE__ */ jsx7("pre", { style: {
|
|
389
|
+
return /* @__PURE__ */ jsx7(Alert, {
|
|
390
|
+
type: "error",
|
|
391
|
+
message: errorMessage,
|
|
392
|
+
description: /* @__PURE__ */ jsx7("pre", {
|
|
393
|
+
style: {
|
|
428
394
|
fontSize: "0.9em",
|
|
429
395
|
overflowX: "auto"
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
|
|
396
|
+
},
|
|
397
|
+
children: errorDescription
|
|
398
|
+
})
|
|
399
|
+
});
|
|
433
400
|
}
|
|
434
401
|
return children;
|
|
435
402
|
}
|
|
436
403
|
};
|
|
437
404
|
|
|
438
405
|
// src/Form.tsx
|
|
406
|
+
import { faas } from "@faasjs/react";
|
|
439
407
|
import {
|
|
440
408
|
Button as Button2,
|
|
441
409
|
Form as AntdForm2
|
|
442
410
|
} from "antd";
|
|
443
411
|
import {
|
|
444
|
-
useEffect as
|
|
445
|
-
useState as
|
|
412
|
+
useEffect as useEffect4,
|
|
413
|
+
useState as useState5,
|
|
446
414
|
useCallback,
|
|
447
415
|
isValidElement
|
|
448
416
|
} from "react";
|
|
@@ -462,9 +430,9 @@ import {
|
|
|
462
430
|
} from "antd";
|
|
463
431
|
import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
|
|
464
432
|
import {
|
|
465
|
-
cloneElement as
|
|
466
|
-
useEffect as
|
|
467
|
-
useState as
|
|
433
|
+
cloneElement as cloneElement2,
|
|
434
|
+
useEffect as useEffect3,
|
|
435
|
+
useState as useState4
|
|
468
436
|
} from "react";
|
|
469
437
|
import { upperFirst as upperFirst3 } from "lodash-es";
|
|
470
438
|
import { Fragment as Fragment3, jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
@@ -516,12 +484,12 @@ function processProps(propsCopy, config) {
|
|
|
516
484
|
}
|
|
517
485
|
function FormItem(props) {
|
|
518
486
|
var _a;
|
|
519
|
-
const [computedProps, setComputedProps] =
|
|
520
|
-
const [extendTypes, setExtendTypes] =
|
|
487
|
+
const [computedProps, setComputedProps] = useState4();
|
|
488
|
+
const [extendTypes, setExtendTypes] = useState4();
|
|
521
489
|
const { common: common2 } = useConfigContext();
|
|
522
|
-
const [hidden, setHidden] =
|
|
523
|
-
|
|
524
|
-
const propsCopy =
|
|
490
|
+
const [hidden, setHidden] = useState4(props.hidden || false);
|
|
491
|
+
useEffect3(() => {
|
|
492
|
+
const propsCopy = { ...props };
|
|
525
493
|
if (propsCopy.extendTypes) {
|
|
526
494
|
setExtendTypes(propsCopy.extendTypes);
|
|
527
495
|
delete propsCopy.extendTypes;
|
|
@@ -544,229 +512,282 @@ function FormItem(props) {
|
|
|
544
512
|
if (!computedProps)
|
|
545
513
|
return null;
|
|
546
514
|
if (hidden)
|
|
547
|
-
return /* @__PURE__ */ jsx8(
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
515
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
516
|
+
...computedProps,
|
|
517
|
+
noStyle: true,
|
|
518
|
+
rules: [],
|
|
519
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
520
|
+
hidden: true
|
|
553
521
|
})
|
|
554
|
-
);
|
|
522
|
+
});
|
|
555
523
|
if (extendTypes && extendTypes[computedProps.type])
|
|
556
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
524
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
525
|
+
...computedProps,
|
|
526
|
+
children: extendTypes[computedProps.type].children
|
|
527
|
+
});
|
|
557
528
|
if (computedProps.formChildren === null)
|
|
558
529
|
return null;
|
|
559
530
|
if (computedProps.formChildren)
|
|
560
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
531
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
532
|
+
...computedProps,
|
|
533
|
+
children: cloneElement2(computedProps.formChildren, { scene: "form" })
|
|
534
|
+
});
|
|
561
535
|
if (computedProps.children === null)
|
|
562
536
|
return null;
|
|
563
537
|
if (computedProps.children)
|
|
564
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
538
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
539
|
+
...computedProps,
|
|
540
|
+
children: cloneElement2(computedProps.children, { scene: "form" })
|
|
541
|
+
});
|
|
565
542
|
if (computedProps.formRender)
|
|
566
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
543
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
544
|
+
...computedProps,
|
|
545
|
+
children: computedProps.formRender(null, null, 0, "form")
|
|
546
|
+
});
|
|
567
547
|
if (computedProps.render)
|
|
568
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
548
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
549
|
+
...computedProps,
|
|
550
|
+
children: computedProps.render(null, null, 0, "form")
|
|
551
|
+
});
|
|
569
552
|
switch (computedProps.type) {
|
|
570
553
|
case "string":
|
|
571
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
554
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
555
|
+
...computedProps,
|
|
556
|
+
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
557
|
+
...computedProps.input
|
|
558
|
+
}) : /* @__PURE__ */ jsx8(Input, {
|
|
559
|
+
...computedProps.input
|
|
560
|
+
})
|
|
561
|
+
});
|
|
572
562
|
case "string[]":
|
|
573
563
|
if (computedProps.options)
|
|
574
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
mode: "multiple"
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
564
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
565
|
+
...computedProps,
|
|
566
|
+
children: /* @__PURE__ */ jsx8(Select, {
|
|
567
|
+
mode: "multiple",
|
|
568
|
+
...computedProps.input
|
|
569
|
+
})
|
|
570
|
+
});
|
|
571
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
572
|
+
name: computedProps.name,
|
|
573
|
+
rules: computedProps.rules,
|
|
574
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
575
|
+
var _a2;
|
|
576
|
+
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
577
|
+
children: [
|
|
578
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
579
|
+
className: "ant-form-item-label",
|
|
580
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
581
|
+
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
582
|
+
children: computedProps.label
|
|
583
|
+
})
|
|
584
|
+
}),
|
|
589
585
|
fields.map((field) => {
|
|
590
586
|
var _a3;
|
|
591
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
592
|
-
Row,
|
|
593
|
-
{
|
|
587
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
588
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
594
589
|
gutter: 24,
|
|
595
590
|
style: { flexFlow: "row nowrap" },
|
|
596
591
|
children: [
|
|
597
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
598
|
-
|
|
599
|
-
|
|
592
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
593
|
+
span: 23,
|
|
594
|
+
children: /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
595
|
+
...field,
|
|
600
596
|
noStyle: true,
|
|
601
|
-
children: /* @__PURE__ */ jsx8(Input,
|
|
597
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
598
|
+
...computedProps.input
|
|
599
|
+
})
|
|
602
600
|
})
|
|
603
|
-
|
|
604
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
605
|
-
|
|
606
|
-
{
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
603
|
+
span: 1,
|
|
604
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
607
605
|
danger: true,
|
|
608
606
|
type: "link",
|
|
609
607
|
style: { float: "right" },
|
|
610
608
|
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
611
609
|
onClick: () => remove(field.name)
|
|
612
|
-
}
|
|
613
|
-
|
|
610
|
+
})
|
|
611
|
+
})
|
|
614
612
|
]
|
|
615
|
-
}
|
|
616
|
-
|
|
613
|
+
})
|
|
614
|
+
}, field.key);
|
|
617
615
|
}),
|
|
618
|
-
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
619
|
-
|
|
620
|
-
Button,
|
|
621
|
-
{
|
|
616
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
617
|
+
children: [
|
|
618
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
|
|
622
619
|
type: "dashed",
|
|
623
620
|
block: true,
|
|
624
621
|
onClick: () => add(),
|
|
625
622
|
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
623
|
+
}),
|
|
624
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
625
|
+
errors
|
|
626
|
+
})
|
|
627
|
+
]
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
});
|
|
632
631
|
}
|
|
633
|
-
);
|
|
632
|
+
});
|
|
634
633
|
case "number":
|
|
635
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
},
|
|
640
|
-
|
|
634
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
635
|
+
...computedProps,
|
|
636
|
+
children: computedProps.options ? /* @__PURE__ */ jsx8(Select, {
|
|
637
|
+
...computedProps.input
|
|
638
|
+
}) : /* @__PURE__ */ jsx8(InputNumber, {
|
|
639
|
+
style: { width: "100%" },
|
|
640
|
+
...computedProps.input
|
|
641
|
+
})
|
|
642
|
+
});
|
|
641
643
|
case "number[]":
|
|
642
644
|
if (computedProps.options)
|
|
643
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
mode: "multiple"
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
645
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
646
|
+
...computedProps,
|
|
647
|
+
children: /* @__PURE__ */ jsx8(Select, {
|
|
648
|
+
mode: "multiple",
|
|
649
|
+
...computedProps.input
|
|
650
|
+
})
|
|
651
|
+
});
|
|
652
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
653
|
+
name: computedProps.name,
|
|
654
|
+
rules: computedProps.rules,
|
|
655
|
+
children: (fields, { add, remove }, { errors }) => {
|
|
656
|
+
var _a2, _b;
|
|
657
|
+
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
658
|
+
children: [
|
|
659
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
660
|
+
className: "ant-form-item-label",
|
|
661
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
662
|
+
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
663
|
+
children: computedProps.label
|
|
664
|
+
})
|
|
665
|
+
}),
|
|
658
666
|
fields.map((field) => {
|
|
659
667
|
var _a3;
|
|
660
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
661
|
-
Row,
|
|
662
|
-
{
|
|
668
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
669
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
663
670
|
gutter: 24,
|
|
664
671
|
style: { flexFlow: "row nowrap" },
|
|
665
672
|
children: [
|
|
666
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
667
|
-
|
|
668
|
-
|
|
673
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
674
|
+
span: 23,
|
|
675
|
+
children: /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
676
|
+
...field,
|
|
669
677
|
noStyle: true,
|
|
670
|
-
children: /* @__PURE__ */ jsx8(
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
}, computedProps.input)
|
|
675
|
-
)
|
|
678
|
+
children: /* @__PURE__ */ jsx8(InputNumber, {
|
|
679
|
+
style: { width: "100%" },
|
|
680
|
+
...computedProps.input
|
|
681
|
+
})
|
|
676
682
|
})
|
|
677
|
-
|
|
678
|
-
/* @__PURE__ */ jsx8(Col, {
|
|
679
|
-
|
|
680
|
-
{
|
|
683
|
+
}),
|
|
684
|
+
/* @__PURE__ */ jsx8(Col, {
|
|
685
|
+
span: 1,
|
|
686
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
681
687
|
danger: true,
|
|
682
688
|
type: "link",
|
|
683
689
|
style: { float: "right" },
|
|
684
690
|
icon: /* @__PURE__ */ jsx8(MinusCircleOutlined, {}),
|
|
685
691
|
onClick: () => remove(field.name)
|
|
686
|
-
}
|
|
687
|
-
|
|
692
|
+
})
|
|
693
|
+
})
|
|
688
694
|
]
|
|
689
|
-
}
|
|
690
|
-
|
|
695
|
+
})
|
|
696
|
+
}, field.key);
|
|
691
697
|
}),
|
|
692
|
-
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
693
|
-
|
|
694
|
-
Button,
|
|
695
|
-
{
|
|
698
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
699
|
+
children: [
|
|
700
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx8(Button, {
|
|
696
701
|
type: "dashed",
|
|
697
702
|
block: true,
|
|
698
703
|
onClick: () => add(),
|
|
699
704
|
icon: /* @__PURE__ */ jsx8(PlusOutlined, {})
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
705
|
+
}),
|
|
706
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
707
|
+
errors
|
|
708
|
+
})
|
|
709
|
+
]
|
|
710
|
+
})
|
|
711
|
+
]
|
|
712
|
+
});
|
|
706
713
|
}
|
|
707
|
-
);
|
|
714
|
+
});
|
|
708
715
|
case "boolean":
|
|
709
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
716
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
717
|
+
...computedProps,
|
|
718
|
+
children: /* @__PURE__ */ jsx8(Switch, {
|
|
719
|
+
...computedProps.input
|
|
720
|
+
})
|
|
721
|
+
});
|
|
710
722
|
case "date":
|
|
711
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
723
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
724
|
+
...computedProps,
|
|
725
|
+
children: /* @__PURE__ */ jsx8(DatePicker, {
|
|
726
|
+
...computedProps.input
|
|
727
|
+
})
|
|
728
|
+
});
|
|
712
729
|
case "time":
|
|
713
|
-
return /* @__PURE__ */ jsx8(AntdForm.Item,
|
|
730
|
+
return /* @__PURE__ */ jsx8(AntdForm.Item, {
|
|
731
|
+
...computedProps,
|
|
732
|
+
children: /* @__PURE__ */ jsx8(TimePicker, {
|
|
733
|
+
...computedProps.input
|
|
734
|
+
})
|
|
735
|
+
});
|
|
714
736
|
case "object":
|
|
715
|
-
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
737
|
+
return /* @__PURE__ */ jsxs(Fragment3, {
|
|
738
|
+
children: [
|
|
739
|
+
computedProps.label && /* @__PURE__ */ jsx8("div", {
|
|
740
|
+
className: "ant-form-item-label",
|
|
741
|
+
children: /* @__PURE__ */ jsx8("label", {
|
|
742
|
+
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
743
|
+
children: computedProps.label
|
|
744
|
+
})
|
|
745
|
+
}),
|
|
746
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx8(FormItem, {
|
|
747
|
+
...o
|
|
748
|
+
}, o.id))
|
|
749
|
+
]
|
|
750
|
+
});
|
|
723
751
|
case "object[]":
|
|
724
|
-
return /* @__PURE__ */ jsx8(
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
Button,
|
|
741
|
-
{
|
|
752
|
+
return /* @__PURE__ */ jsx8(AntdForm.List, {
|
|
753
|
+
name: computedProps.name,
|
|
754
|
+
rules: computedProps.rules,
|
|
755
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment3, {
|
|
756
|
+
children: [
|
|
757
|
+
fields.map((field) => /* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
758
|
+
style: { marginBottom: 0 },
|
|
759
|
+
children: [
|
|
760
|
+
/* @__PURE__ */ jsx8("div", {
|
|
761
|
+
className: "ant-form-item-label",
|
|
762
|
+
children: /* @__PURE__ */ jsxs("label", {
|
|
763
|
+
children: [
|
|
764
|
+
computedProps.label,
|
|
765
|
+
" ",
|
|
766
|
+
field.name + 1,
|
|
767
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx8(Button, {
|
|
742
768
|
danger: true,
|
|
743
769
|
type: "link",
|
|
744
770
|
onClick: () => remove(field.name),
|
|
745
771
|
children: common2.delete
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
)),
|
|
766
|
-
/* @__PURE__ */ jsxs(AntdForm.Item, { children: [
|
|
767
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(
|
|
768
|
-
Button,
|
|
769
|
-
{
|
|
772
|
+
})
|
|
773
|
+
]
|
|
774
|
+
})
|
|
775
|
+
}),
|
|
776
|
+
/* @__PURE__ */ jsx8(Row, {
|
|
777
|
+
gutter: 24,
|
|
778
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ jsx8(Col, {
|
|
779
|
+
span: o.col || 24,
|
|
780
|
+
children: /* @__PURE__ */ jsx8(FormItem, {
|
|
781
|
+
...o,
|
|
782
|
+
name: [field.name, o.id]
|
|
783
|
+
})
|
|
784
|
+
}, o.id))
|
|
785
|
+
})
|
|
786
|
+
]
|
|
787
|
+
}, field.key)),
|
|
788
|
+
/* @__PURE__ */ jsxs(AntdForm.Item, {
|
|
789
|
+
children: [
|
|
790
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(Button, {
|
|
770
791
|
type: "dashed",
|
|
771
792
|
block: true,
|
|
772
793
|
onClick: () => add(),
|
|
@@ -776,13 +797,15 @@ function FormItem(props) {
|
|
|
776
797
|
" ",
|
|
777
798
|
computedProps.label
|
|
778
799
|
]
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
800
|
+
}),
|
|
801
|
+
/* @__PURE__ */ jsx8(AntdForm.ErrorList, {
|
|
802
|
+
errors
|
|
803
|
+
})
|
|
804
|
+
]
|
|
805
|
+
})
|
|
806
|
+
]
|
|
807
|
+
})
|
|
808
|
+
});
|
|
786
809
|
default:
|
|
787
810
|
return null;
|
|
788
811
|
}
|
|
@@ -793,17 +816,18 @@ FormItem.useStatus = AntdForm.Item.useStatus;
|
|
|
793
816
|
import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
794
817
|
function Form(props) {
|
|
795
818
|
var _a, _b;
|
|
796
|
-
const [loading, setLoading] =
|
|
797
|
-
const [computedProps, setComputedProps] =
|
|
819
|
+
const [loading, setLoading] = useState5(false);
|
|
820
|
+
const [computedProps, setComputedProps] = useState5();
|
|
798
821
|
const config = useConfigContext();
|
|
799
|
-
const [extendTypes, setExtendTypes] =
|
|
822
|
+
const [extendTypes, setExtendTypes] = useState5();
|
|
800
823
|
const [form] = AntdForm2.useForm(props.form);
|
|
801
|
-
const [initialValues, setInitialValues] =
|
|
802
|
-
|
|
824
|
+
const [initialValues, setInitialValues] = useState5(props.initialValues);
|
|
825
|
+
useEffect4(() => {
|
|
803
826
|
var _a2, _b2, _c;
|
|
804
|
-
const propsCopy =
|
|
827
|
+
const propsCopy = {
|
|
828
|
+
...props,
|
|
805
829
|
form
|
|
806
|
-
}
|
|
830
|
+
};
|
|
807
831
|
if (propsCopy.initialValues && ((_a2 = propsCopy.items) == null ? void 0 : _a2.length)) {
|
|
808
832
|
for (const key in propsCopy.initialValues) {
|
|
809
833
|
propsCopy.initialValues[key] = transferValue(
|
|
@@ -827,7 +851,10 @@ function Form(props) {
|
|
|
827
851
|
setLoading(true);
|
|
828
852
|
try {
|
|
829
853
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
830
|
-
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ?
|
|
854
|
+
await props.onFinish(values, async (values2) => faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
855
|
+
...values2,
|
|
856
|
+
...propsCopy.submit.to.params
|
|
857
|
+
} : values2));
|
|
831
858
|
} else
|
|
832
859
|
await props.onFinish(values);
|
|
833
860
|
} catch (error) {
|
|
@@ -838,7 +865,10 @@ function Form(props) {
|
|
|
838
865
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
839
866
|
propsCopy.onFinish = async (values) => {
|
|
840
867
|
setLoading(true);
|
|
841
|
-
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ?
|
|
868
|
+
return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
869
|
+
...values,
|
|
870
|
+
...propsCopy.submit.to.params
|
|
871
|
+
} : values).then((result) => {
|
|
842
872
|
if (propsCopy.submit.to.then)
|
|
843
873
|
propsCopy.submit.to.then(result);
|
|
844
874
|
return result;
|
|
@@ -872,7 +902,7 @@ function Form(props) {
|
|
|
872
902
|
item.onValueChange(changedValues[key], allValues, form);
|
|
873
903
|
}
|
|
874
904
|
}, [computedProps]);
|
|
875
|
-
|
|
905
|
+
useEffect4(() => {
|
|
876
906
|
if (!initialValues)
|
|
877
907
|
return;
|
|
878
908
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -881,33 +911,25 @@ function Form(props) {
|
|
|
881
911
|
}, [computedProps]);
|
|
882
912
|
if (!computedProps)
|
|
883
913
|
return null;
|
|
884
|
-
return /* @__PURE__ */ jsxs2(
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
computedProps.submit
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
loading,
|
|
904
|
-
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
905
|
-
}
|
|
906
|
-
),
|
|
907
|
-
computedProps.footer
|
|
908
|
-
]
|
|
909
|
-
})
|
|
910
|
-
);
|
|
914
|
+
return /* @__PURE__ */ jsxs2(AntdForm2, {
|
|
915
|
+
...computedProps,
|
|
916
|
+
onValuesChange,
|
|
917
|
+
children: [
|
|
918
|
+
computedProps.beforeItems,
|
|
919
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => isValidElement(item) ? item : /* @__PURE__ */ jsx9(FormItem, {
|
|
920
|
+
...item,
|
|
921
|
+
extendTypes
|
|
922
|
+
}, item.id)),
|
|
923
|
+
computedProps.children,
|
|
924
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx9(Button2, {
|
|
925
|
+
htmlType: "submit",
|
|
926
|
+
type: "primary",
|
|
927
|
+
loading,
|
|
928
|
+
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
929
|
+
}),
|
|
930
|
+
computedProps.footer
|
|
931
|
+
]
|
|
932
|
+
});
|
|
911
933
|
}
|
|
912
934
|
Form.useForm = AntdForm2.useForm;
|
|
913
935
|
Form.useFormInstance = AntdForm2.useFormInstance;
|
|
@@ -924,9 +946,11 @@ import { jsx as jsx10 } from "react/jsx-runtime";
|
|
|
924
946
|
function Link(props) {
|
|
925
947
|
var _a, _b, _c, _d;
|
|
926
948
|
const { Link: Link2 } = useConfigContext();
|
|
927
|
-
let style =
|
|
928
|
-
|
|
929
|
-
|
|
949
|
+
let style = {
|
|
950
|
+
...Link2.style || {},
|
|
951
|
+
cursor: "pointer",
|
|
952
|
+
...props.style
|
|
953
|
+
};
|
|
930
954
|
if (props.block)
|
|
931
955
|
style = Object.assign({
|
|
932
956
|
display: "block",
|
|
@@ -934,67 +958,61 @@ function Link(props) {
|
|
|
934
958
|
}, style);
|
|
935
959
|
if (props.href.startsWith("http")) {
|
|
936
960
|
if (props.button)
|
|
937
|
-
return /* @__PURE__ */ jsx10(
|
|
938
|
-
|
|
939
|
-
__spreadProps(__spreadValues({}, props.button), {
|
|
940
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
941
|
-
style,
|
|
942
|
-
href: props.href,
|
|
943
|
-
children: (_a = props.text) != null ? _a : props.children
|
|
944
|
-
})
|
|
945
|
-
);
|
|
946
|
-
return /* @__PURE__ */ jsx10(
|
|
947
|
-
"a",
|
|
948
|
-
{
|
|
949
|
-
href: props.href,
|
|
961
|
+
return /* @__PURE__ */ jsx10(Button3, {
|
|
962
|
+
...props.button,
|
|
950
963
|
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
951
964
|
style,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
965
|
+
href: props.href,
|
|
966
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
967
|
+
});
|
|
968
|
+
return /* @__PURE__ */ jsx10("a", {
|
|
969
|
+
href: props.href,
|
|
970
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
971
|
+
style,
|
|
972
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
973
|
+
});
|
|
955
974
|
}
|
|
956
975
|
if (props.button)
|
|
957
|
-
return /* @__PURE__ */ jsx10(
|
|
958
|
-
RouterLink,
|
|
959
|
-
{
|
|
960
|
-
to: props.href,
|
|
961
|
-
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
962
|
-
children: /* @__PURE__ */ jsx10(
|
|
963
|
-
Button3,
|
|
964
|
-
__spreadProps(__spreadValues({}, props.button), {
|
|
965
|
-
style,
|
|
966
|
-
children: (_c = props.text) != null ? _c : props.children
|
|
967
|
-
})
|
|
968
|
-
)
|
|
969
|
-
}
|
|
970
|
-
);
|
|
971
|
-
return /* @__PURE__ */ jsx10(
|
|
972
|
-
RouterLink,
|
|
973
|
-
{
|
|
976
|
+
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
974
977
|
to: props.href,
|
|
975
978
|
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
979
|
+
children: /* @__PURE__ */ jsx10(Button3, {
|
|
980
|
+
...props.button,
|
|
981
|
+
style,
|
|
982
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
983
|
+
})
|
|
984
|
+
});
|
|
985
|
+
return /* @__PURE__ */ jsx10(RouterLink, {
|
|
986
|
+
to: props.href,
|
|
987
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
988
|
+
style,
|
|
989
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
990
|
+
});
|
|
980
991
|
}
|
|
981
992
|
|
|
982
993
|
// src/Modal.tsx
|
|
983
994
|
import { Modal } from "antd";
|
|
984
|
-
import { useState as
|
|
995
|
+
import { useState as useState6 } from "react";
|
|
985
996
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
986
997
|
function useModal(init) {
|
|
987
|
-
const [props, setProps] =
|
|
998
|
+
const [props, setProps] = useState6({
|
|
988
999
|
open: false,
|
|
989
|
-
onCancel: () => setProps((prev) =>
|
|
1000
|
+
onCancel: () => setProps((prev) => ({
|
|
1001
|
+
...prev,
|
|
990
1002
|
open: false
|
|
991
|
-
}))
|
|
992
|
-
|
|
1003
|
+
})),
|
|
1004
|
+
...init
|
|
1005
|
+
});
|
|
993
1006
|
return {
|
|
994
|
-
modal: /* @__PURE__ */ jsx11(Modal,
|
|
1007
|
+
modal: /* @__PURE__ */ jsx11(Modal, {
|
|
1008
|
+
...props
|
|
1009
|
+
}),
|
|
995
1010
|
modalProps: props,
|
|
996
1011
|
setModalProps(changes) {
|
|
997
|
-
setProps((prev) =>
|
|
1012
|
+
setProps((prev) => ({
|
|
1013
|
+
...prev,
|
|
1014
|
+
...changes
|
|
1015
|
+
}));
|
|
998
1016
|
}
|
|
999
1017
|
};
|
|
1000
1018
|
}
|
|
@@ -1011,39 +1029,39 @@ import {
|
|
|
1011
1029
|
import { jsx as jsx12, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1012
1030
|
function PageNotFound() {
|
|
1013
1031
|
const config = useConfigContext();
|
|
1014
|
-
return /* @__PURE__ */ jsx12(
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
title: config.common.pageNotFound
|
|
1019
|
-
}
|
|
1020
|
-
);
|
|
1032
|
+
return /* @__PURE__ */ jsx12(Result, {
|
|
1033
|
+
status: "404",
|
|
1034
|
+
title: config.common.pageNotFound
|
|
1035
|
+
});
|
|
1021
1036
|
}
|
|
1022
1037
|
function Routes(props) {
|
|
1023
|
-
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
1024
|
-
|
|
1025
|
-
Route,
|
|
1026
|
-
|
|
1027
|
-
element: r.element || /* @__PURE__ */ jsx12(Suspense, {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1038
|
+
return /* @__PURE__ */ jsxs3(OriginRoutes, {
|
|
1039
|
+
children: [
|
|
1040
|
+
props.routes.map((r) => /* @__PURE__ */ jsx12(Route, {
|
|
1041
|
+
...r,
|
|
1042
|
+
element: r.element || /* @__PURE__ */ jsx12(Suspense, {
|
|
1043
|
+
fallback: props.fallback || /* @__PURE__ */ jsx12("div", {
|
|
1044
|
+
style: { padding: "24px" },
|
|
1045
|
+
children: /* @__PURE__ */ jsx12(Skeleton, {
|
|
1046
|
+
active: true
|
|
1047
|
+
})
|
|
1048
|
+
}),
|
|
1049
|
+
children: /* @__PURE__ */ jsx12(r.page, {})
|
|
1050
|
+
})
|
|
1051
|
+
}, r.path)),
|
|
1052
|
+
/* @__PURE__ */ jsx12(Route, {
|
|
1034
1053
|
path: "*",
|
|
1035
1054
|
element: props.notFound || /* @__PURE__ */ jsx12(PageNotFound, {})
|
|
1036
|
-
},
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
] });
|
|
1055
|
+
}, "*")
|
|
1056
|
+
]
|
|
1057
|
+
});
|
|
1040
1058
|
}
|
|
1041
1059
|
|
|
1042
1060
|
// src/Table.tsx
|
|
1043
1061
|
import {
|
|
1044
|
-
useState as
|
|
1045
|
-
useEffect as
|
|
1046
|
-
cloneElement as
|
|
1062
|
+
useState as useState7,
|
|
1063
|
+
useEffect as useEffect5,
|
|
1064
|
+
cloneElement as cloneElement3
|
|
1047
1065
|
} from "react";
|
|
1048
1066
|
import {
|
|
1049
1067
|
Table as AntdTable,
|
|
@@ -1083,9 +1101,9 @@ function processValue(item, value) {
|
|
|
1083
1101
|
return value;
|
|
1084
1102
|
}
|
|
1085
1103
|
function Table(props) {
|
|
1086
|
-
const [columns, setColumns] =
|
|
1104
|
+
const [columns, setColumns] = useState7();
|
|
1087
1105
|
const { common: common2 } = useConfigContext();
|
|
1088
|
-
|
|
1106
|
+
useEffect5(() => {
|
|
1089
1107
|
var _a;
|
|
1090
1108
|
for (const item of props.items) {
|
|
1091
1109
|
if (!item.key)
|
|
@@ -1109,7 +1127,7 @@ function Table(props) {
|
|
|
1109
1127
|
if (item.tableChildren === null)
|
|
1110
1128
|
item.render = () => null;
|
|
1111
1129
|
else if (item.tableChildren)
|
|
1112
|
-
item.render = (value, values) =>
|
|
1130
|
+
item.render = (value, values) => cloneElement3(
|
|
1113
1131
|
item.tableChildren,
|
|
1114
1132
|
{
|
|
1115
1133
|
scene: "table",
|
|
@@ -1120,7 +1138,7 @@ function Table(props) {
|
|
|
1120
1138
|
else if (item.children === null)
|
|
1121
1139
|
item.render = () => null;
|
|
1122
1140
|
else if (item.children)
|
|
1123
|
-
item.render = (value, values) =>
|
|
1141
|
+
item.render = (value, values) => cloneElement3(
|
|
1124
1142
|
item.children,
|
|
1125
1143
|
{
|
|
1126
1144
|
scene: "table",
|
|
@@ -1130,7 +1148,7 @@ function Table(props) {
|
|
|
1130
1148
|
);
|
|
1131
1149
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1132
1150
|
if (props.extendTypes[item.type].children)
|
|
1133
|
-
item.render = (value, values) =>
|
|
1151
|
+
item.render = (value, values) => cloneElement3(
|
|
1134
1152
|
props.extendTypes[item.type].children,
|
|
1135
1153
|
{
|
|
1136
1154
|
scene: "table",
|
|
@@ -1161,22 +1179,19 @@ function Table(props) {
|
|
|
1161
1179
|
setSelectedKeys,
|
|
1162
1180
|
confirm,
|
|
1163
1181
|
clearFilters
|
|
1164
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
setSelectedKeys([]);
|
|
1174
|
-
clearFilters();
|
|
1175
|
-
}
|
|
1176
|
-
confirm();
|
|
1182
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1183
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1184
|
+
allowClear: true,
|
|
1185
|
+
onSearch: (v) => {
|
|
1186
|
+
if (v) {
|
|
1187
|
+
setSelectedKeys([v]);
|
|
1188
|
+
} else {
|
|
1189
|
+
setSelectedKeys([]);
|
|
1190
|
+
clearFilters();
|
|
1177
1191
|
}
|
|
1192
|
+
confirm();
|
|
1178
1193
|
}
|
|
1179
|
-
);
|
|
1194
|
+
});
|
|
1180
1195
|
break;
|
|
1181
1196
|
case "string[]":
|
|
1182
1197
|
if (!item.render)
|
|
@@ -1194,22 +1209,19 @@ function Table(props) {
|
|
|
1194
1209
|
setSelectedKeys,
|
|
1195
1210
|
confirm,
|
|
1196
1211
|
clearFilters
|
|
1197
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
setSelectedKeys([]);
|
|
1207
|
-
clearFilters();
|
|
1208
|
-
}
|
|
1209
|
-
confirm();
|
|
1212
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1213
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1214
|
+
allowClear: true,
|
|
1215
|
+
onSearch: (v) => {
|
|
1216
|
+
if (v) {
|
|
1217
|
+
setSelectedKeys([v]);
|
|
1218
|
+
} else {
|
|
1219
|
+
setSelectedKeys([]);
|
|
1220
|
+
clearFilters();
|
|
1210
1221
|
}
|
|
1222
|
+
confirm();
|
|
1211
1223
|
}
|
|
1212
|
-
);
|
|
1224
|
+
});
|
|
1213
1225
|
break;
|
|
1214
1226
|
case "number":
|
|
1215
1227
|
if (!item.render)
|
|
@@ -1227,22 +1239,19 @@ function Table(props) {
|
|
|
1227
1239
|
setSelectedKeys,
|
|
1228
1240
|
confirm,
|
|
1229
1241
|
clearFilters
|
|
1230
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
setSelectedKeys([]);
|
|
1240
|
-
clearFilters();
|
|
1241
|
-
}
|
|
1242
|
-
confirm();
|
|
1242
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1243
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1244
|
+
allowClear: true,
|
|
1245
|
+
onSearch: (v) => {
|
|
1246
|
+
if (v) {
|
|
1247
|
+
setSelectedKeys([Number(v)]);
|
|
1248
|
+
} else {
|
|
1249
|
+
setSelectedKeys([]);
|
|
1250
|
+
clearFilters();
|
|
1243
1251
|
}
|
|
1252
|
+
confirm();
|
|
1244
1253
|
}
|
|
1245
|
-
);
|
|
1254
|
+
});
|
|
1246
1255
|
break;
|
|
1247
1256
|
case "number[]":
|
|
1248
1257
|
if (!item.render)
|
|
@@ -1260,61 +1269,74 @@ function Table(props) {
|
|
|
1260
1269
|
setSelectedKeys,
|
|
1261
1270
|
confirm,
|
|
1262
1271
|
clearFilters
|
|
1263
|
-
}) => /* @__PURE__ */ jsx13(
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
setSelectedKeys([]);
|
|
1273
|
-
clearFilters();
|
|
1274
|
-
}
|
|
1275
|
-
confirm();
|
|
1272
|
+
}) => /* @__PURE__ */ jsx13(Input2.Search, {
|
|
1273
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1274
|
+
allowClear: true,
|
|
1275
|
+
onSearch: (v) => {
|
|
1276
|
+
if (v) {
|
|
1277
|
+
setSelectedKeys([Number(v)]);
|
|
1278
|
+
} else {
|
|
1279
|
+
setSelectedKeys([]);
|
|
1280
|
+
clearFilters();
|
|
1276
1281
|
}
|
|
1282
|
+
confirm();
|
|
1277
1283
|
}
|
|
1278
|
-
);
|
|
1284
|
+
});
|
|
1279
1285
|
break;
|
|
1280
1286
|
case "boolean":
|
|
1281
1287
|
if (!item.render)
|
|
1282
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1288
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx13(Blank, {}) : value ? /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1289
|
+
style: {
|
|
1290
|
+
marginTop: "4px",
|
|
1291
|
+
color: "#52c41a"
|
|
1292
|
+
}
|
|
1293
|
+
}) : /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1294
|
+
style: {
|
|
1295
|
+
marginTop: "4px",
|
|
1296
|
+
color: "#ff4d4f"
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1289
1299
|
if (item.filterDropdown !== false)
|
|
1290
1300
|
item.filterDropdown = ({
|
|
1291
1301
|
setSelectedKeys,
|
|
1292
1302
|
selectedKeys,
|
|
1293
1303
|
confirm
|
|
1294
|
-
}) => /* @__PURE__ */ jsxs4(
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
value:
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1304
|
+
}) => /* @__PURE__ */ jsxs4(Radio.Group, {
|
|
1305
|
+
style: { padding: 8 },
|
|
1306
|
+
buttonStyle: "solid",
|
|
1307
|
+
value: selectedKeys[0],
|
|
1308
|
+
onChange: (e) => {
|
|
1309
|
+
setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
1310
|
+
confirm();
|
|
1311
|
+
},
|
|
1312
|
+
children: [
|
|
1313
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1314
|
+
children: common2.all
|
|
1315
|
+
}),
|
|
1316
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1317
|
+
value: "true",
|
|
1318
|
+
children: /* @__PURE__ */ jsx13(CheckOutlined2, {
|
|
1319
|
+
style: {
|
|
1320
|
+
color: "#52c41a",
|
|
1321
|
+
verticalAlign: "middle"
|
|
1322
|
+
}
|
|
1323
|
+
})
|
|
1324
|
+
}),
|
|
1325
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1326
|
+
value: "false",
|
|
1327
|
+
children: /* @__PURE__ */ jsx13(CloseOutlined2, {
|
|
1328
|
+
style: {
|
|
1329
|
+
verticalAlign: "middle",
|
|
1330
|
+
color: "#ff4d4f"
|
|
1331
|
+
}
|
|
1332
|
+
})
|
|
1333
|
+
}),
|
|
1334
|
+
/* @__PURE__ */ jsx13(Radio.Button, {
|
|
1335
|
+
value: "empty",
|
|
1336
|
+
children: common2.blank
|
|
1337
|
+
})
|
|
1338
|
+
]
|
|
1339
|
+
});
|
|
1318
1340
|
if (!item.onFilter)
|
|
1319
1341
|
item.onFilter = (value, row) => {
|
|
1320
1342
|
switch (value) {
|
|
@@ -1347,26 +1369,21 @@ function Table(props) {
|
|
|
1347
1369
|
break;
|
|
1348
1370
|
case "object":
|
|
1349
1371
|
if (!item.render)
|
|
1350
|
-
item.render = (value) => /* @__PURE__ */ jsx13(
|
|
1351
|
-
|
|
1352
|
-
{
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
column: 1
|
|
1356
|
-
}
|
|
1357
|
-
);
|
|
1372
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Description, {
|
|
1373
|
+
items: item.object,
|
|
1374
|
+
dataSource: value || {},
|
|
1375
|
+
column: 1
|
|
1376
|
+
});
|
|
1358
1377
|
break;
|
|
1359
1378
|
case "object[]":
|
|
1360
1379
|
if (!item.render)
|
|
1361
|
-
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
|
|
1362
|
-
Description,
|
|
1363
|
-
{
|
|
1380
|
+
item.render = (value) => /* @__PURE__ */ jsx13(Fragment4, {
|
|
1381
|
+
children: value.map((v, i) => /* @__PURE__ */ jsx13(Description, {
|
|
1364
1382
|
items: item.object,
|
|
1365
1383
|
dataSource: v || [],
|
|
1366
1384
|
column: 1
|
|
1367
|
-
},
|
|
1368
|
-
|
|
1369
|
-
)) });
|
|
1385
|
+
}, i))
|
|
1386
|
+
});
|
|
1370
1387
|
break;
|
|
1371
1388
|
default:
|
|
1372
1389
|
if (!item.render)
|
|
@@ -1382,7 +1399,7 @@ function Table(props) {
|
|
|
1382
1399
|
}
|
|
1383
1400
|
setColumns(props.items);
|
|
1384
1401
|
}, [props.items]);
|
|
1385
|
-
|
|
1402
|
+
useEffect5(() => {
|
|
1386
1403
|
if (!props.dataSource || !columns)
|
|
1387
1404
|
return;
|
|
1388
1405
|
for (const column of columns) {
|
|
@@ -1407,26 +1424,19 @@ function Table(props) {
|
|
|
1407
1424
|
if (!columns)
|
|
1408
1425
|
return null;
|
|
1409
1426
|
if (!props.faasData)
|
|
1410
|
-
return /* @__PURE__ */ jsx13(
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
children: /* @__PURE__ */ jsx13(
|
|
1422
|
-
FaasDataTable,
|
|
1423
|
-
{
|
|
1424
|
-
props,
|
|
1425
|
-
columns
|
|
1426
|
-
}
|
|
1427
|
-
)
|
|
1427
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1428
|
+
...props,
|
|
1429
|
+
rowKey: props.rowKey || "id",
|
|
1430
|
+
columns,
|
|
1431
|
+
dataSource: props.dataSource
|
|
1432
|
+
});
|
|
1433
|
+
return /* @__PURE__ */ jsx13(FaasDataWrapper, {
|
|
1434
|
+
...props.faasData,
|
|
1435
|
+
children: /* @__PURE__ */ jsx13(FaasDataTable, {
|
|
1436
|
+
props,
|
|
1437
|
+
columns
|
|
1428
1438
|
})
|
|
1429
|
-
);
|
|
1439
|
+
});
|
|
1430
1440
|
}
|
|
1431
1441
|
function FaasDataTable({
|
|
1432
1442
|
props,
|
|
@@ -1435,8 +1445,8 @@ function FaasDataTable({
|
|
|
1435
1445
|
params,
|
|
1436
1446
|
reload
|
|
1437
1447
|
}) {
|
|
1438
|
-
const [currentColumns, setCurrentColumns] =
|
|
1439
|
-
|
|
1448
|
+
const [currentColumns, setCurrentColumns] = useState7(columns);
|
|
1449
|
+
useEffect5(() => {
|
|
1440
1450
|
if (!data || Array.isArray(data))
|
|
1441
1451
|
return;
|
|
1442
1452
|
setCurrentColumns((prev) => {
|
|
@@ -1472,75 +1482,75 @@ function FaasDataTable({
|
|
|
1472
1482
|
});
|
|
1473
1483
|
}, [columns, data]);
|
|
1474
1484
|
if (!data)
|
|
1475
|
-
return /* @__PURE__ */ jsx13(
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
})
|
|
1482
|
-
);
|
|
1485
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1486
|
+
...props,
|
|
1487
|
+
rowKey: props.rowKey || "id",
|
|
1488
|
+
columns: currentColumns,
|
|
1489
|
+
dataSource: []
|
|
1490
|
+
});
|
|
1483
1491
|
if (Array.isArray(data))
|
|
1484
|
-
return /* @__PURE__ */ jsx13(
|
|
1485
|
-
|
|
1486
|
-
__spreadProps(__spreadValues({}, props), {
|
|
1487
|
-
rowKey: props.rowKey || "id",
|
|
1488
|
-
columns: currentColumns,
|
|
1489
|
-
dataSource: data
|
|
1490
|
-
})
|
|
1491
|
-
);
|
|
1492
|
-
return /* @__PURE__ */ jsx13(
|
|
1493
|
-
AntdTable,
|
|
1494
|
-
__spreadProps(__spreadValues({}, props), {
|
|
1492
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1493
|
+
...props,
|
|
1495
1494
|
rowKey: props.rowKey || "id",
|
|
1496
1495
|
columns: currentColumns,
|
|
1497
|
-
dataSource: data
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1496
|
+
dataSource: data
|
|
1497
|
+
});
|
|
1498
|
+
return /* @__PURE__ */ jsx13(AntdTable, {
|
|
1499
|
+
...props,
|
|
1500
|
+
rowKey: props.rowKey || "id",
|
|
1501
|
+
columns: currentColumns,
|
|
1502
|
+
dataSource: data.rows,
|
|
1503
|
+
pagination: {
|
|
1504
|
+
...props.pagination,
|
|
1505
|
+
...data.pagination
|
|
1506
|
+
},
|
|
1507
|
+
onChange: (pagination, filters, sorter, extra) => {
|
|
1508
|
+
if (props.onChange) {
|
|
1509
|
+
const processed = props.onChange(pagination, filters, sorter, extra);
|
|
1510
|
+
reload({
|
|
1511
|
+
...params,
|
|
1512
|
+
pagination: processed.pagination,
|
|
1513
|
+
filters: processed.filters,
|
|
1514
|
+
sorter: processed.sorter
|
|
1515
|
+
});
|
|
1516
|
+
return;
|
|
1514
1517
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1518
|
+
reload({
|
|
1519
|
+
...params,
|
|
1520
|
+
pagination,
|
|
1521
|
+
filters,
|
|
1522
|
+
sorter
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1517
1526
|
}
|
|
1518
1527
|
|
|
1519
1528
|
// src/Title.tsx
|
|
1520
|
-
import { useEffect as
|
|
1529
|
+
import { useEffect as useEffect6, cloneElement as cloneElement4 } from "react";
|
|
1521
1530
|
import { Fragment as Fragment5, jsx as jsx14 } from "react/jsx-runtime";
|
|
1522
1531
|
function Title(props) {
|
|
1523
1532
|
const { Title: Title2 } = useConfigContext();
|
|
1524
|
-
|
|
1533
|
+
useEffect6(() => {
|
|
1525
1534
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1526
1535
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1527
1536
|
}, [props]);
|
|
1528
1537
|
if (props.h1) {
|
|
1529
1538
|
if (typeof props.h1 === "boolean")
|
|
1530
|
-
return /* @__PURE__ */ jsx14("h1", {
|
|
1531
|
-
return /* @__PURE__ */ jsx14(
|
|
1532
|
-
"h1",
|
|
1533
|
-
{
|
|
1534
|
-
className: props.h1.className,
|
|
1535
|
-
style: props.h1.style,
|
|
1539
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1536
1540
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1541
|
+
});
|
|
1542
|
+
return /* @__PURE__ */ jsx14("h1", {
|
|
1543
|
+
className: props.h1.className,
|
|
1544
|
+
style: props.h1.style,
|
|
1545
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1546
|
+
});
|
|
1539
1547
|
}
|
|
1540
1548
|
if (props.plain)
|
|
1541
|
-
return /* @__PURE__ */ jsx14(Fragment5, {
|
|
1549
|
+
return /* @__PURE__ */ jsx14(Fragment5, {
|
|
1550
|
+
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1551
|
+
});
|
|
1542
1552
|
if (props.children)
|
|
1543
|
-
return
|
|
1553
|
+
return cloneElement4(props.children, { title: props.title });
|
|
1544
1554
|
return null;
|
|
1545
1555
|
}
|
|
1546
1556
|
export {
|
|
@@ -1550,7 +1560,7 @@ export {
|
|
|
1550
1560
|
Description,
|
|
1551
1561
|
Drawer,
|
|
1552
1562
|
ErrorBoundary,
|
|
1553
|
-
|
|
1563
|
+
FaasDataWrapper,
|
|
1554
1564
|
Form,
|
|
1555
1565
|
FormItem,
|
|
1556
1566
|
Link,
|