@faasjs/ant-design 0.0.3-beta.99 → 0.0.4-beta.1
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/README.md +30 -20
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +379 -387
- package/dist/index.mjs +379 -387
- package/package.json +15 -9
package/dist/index.mjs
CHANGED
|
@@ -80,12 +80,7 @@ function App(props) {
|
|
|
80
80
|
setModalProps,
|
|
81
81
|
setDrawerProps
|
|
82
82
|
}),
|
|
83
|
-
[
|
|
84
|
-
messageApi,
|
|
85
|
-
notificationApi,
|
|
86
|
-
setModalProps,
|
|
87
|
-
setDrawerProps
|
|
88
|
-
]
|
|
83
|
+
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
89
84
|
);
|
|
90
85
|
return /* @__PURE__ */ jsx(
|
|
91
86
|
StyleProvider,
|
|
@@ -154,12 +149,18 @@ function ConfigProvider2({
|
|
|
154
149
|
const [values, setValues] = useState(baseConfig);
|
|
155
150
|
useEffect(() => {
|
|
156
151
|
if (config.lang === "zh") {
|
|
157
|
-
setValues(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
setValues(
|
|
153
|
+
defaultsDeep(
|
|
154
|
+
config,
|
|
155
|
+
{
|
|
156
|
+
lang: "zh",
|
|
157
|
+
common: zh,
|
|
158
|
+
Blank: { text: zh.blank },
|
|
159
|
+
Form: { submit: { text: zh.submit } }
|
|
160
|
+
},
|
|
161
|
+
baseConfig
|
|
162
|
+
)
|
|
163
|
+
);
|
|
163
164
|
} else
|
|
164
165
|
setValues(defaultsDeep(config, values));
|
|
165
166
|
}, []);
|
|
@@ -175,10 +176,12 @@ function Blank(options) {
|
|
|
175
176
|
function transferOptions(options) {
|
|
176
177
|
if (!options)
|
|
177
178
|
return [];
|
|
178
|
-
return options.map(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
return options.map(
|
|
180
|
+
(item) => typeof item === "object" ? item : {
|
|
181
|
+
label: upperFirst(item.toString()),
|
|
182
|
+
value: item
|
|
183
|
+
}
|
|
184
|
+
);
|
|
182
185
|
}
|
|
183
186
|
function transferValue(type, value) {
|
|
184
187
|
if (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined")
|
|
@@ -198,13 +201,19 @@ function transferValue(type, value) {
|
|
|
198
201
|
function Loading(props) {
|
|
199
202
|
if (props.loading === false)
|
|
200
203
|
return /* @__PURE__ */ jsx(Fragment, { children: props.children });
|
|
201
|
-
return /* @__PURE__ */ jsx(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
return /* @__PURE__ */ jsx(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
style: {
|
|
208
|
+
...props.style || {},
|
|
209
|
+
...!props.size || props.size === "large" ? {
|
|
210
|
+
margin: "20vh auto",
|
|
211
|
+
textAlign: "center"
|
|
212
|
+
} : {}
|
|
213
|
+
},
|
|
214
|
+
children: /* @__PURE__ */ jsx(Spin, { size: props.size || "large" })
|
|
215
|
+
}
|
|
216
|
+
);
|
|
208
217
|
}
|
|
209
218
|
function FaasDataWrapper(props) {
|
|
210
219
|
return /* @__PURE__ */ jsx(
|
|
@@ -216,10 +225,10 @@ function FaasDataWrapper(props) {
|
|
|
216
225
|
);
|
|
217
226
|
}
|
|
218
227
|
function DescriptionItemContent(props) {
|
|
219
|
-
var _a;
|
|
228
|
+
var _a, _b;
|
|
220
229
|
const [computedProps, setComputedProps] = useState();
|
|
221
230
|
useEffect(() => {
|
|
222
|
-
var _a2,
|
|
231
|
+
var _a2, _b2;
|
|
223
232
|
const propsCopy = { ...props };
|
|
224
233
|
if (!propsCopy.item.title)
|
|
225
234
|
propsCopy.item.title = upperFirst(propsCopy.item.id);
|
|
@@ -231,22 +240,20 @@ function DescriptionItemContent(props) {
|
|
|
231
240
|
propsCopy.value = transferValue(propsCopy.item.type, propsCopy.value);
|
|
232
241
|
if (propsCopy.item.options && propsCopy.value !== null) {
|
|
233
242
|
if (propsCopy.item.type.endsWith("[]"))
|
|
234
|
-
propsCopy.value = propsCopy.value.map(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
].includes(propsCopy.item.type))
|
|
243
|
-
propsCopy.value = ((_b = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b.label) || props.value;
|
|
243
|
+
propsCopy.value = propsCopy.value.map(
|
|
244
|
+
(v) => {
|
|
245
|
+
var _a3;
|
|
246
|
+
return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
else if (["string", "number", "boolean"].includes(propsCopy.item.type))
|
|
250
|
+
propsCopy.value = ((_b2 = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b2.label) || props.value;
|
|
244
251
|
}
|
|
245
252
|
setComputedProps(propsCopy);
|
|
246
253
|
}, [props]);
|
|
247
254
|
if (!computedProps)
|
|
248
255
|
return null;
|
|
249
|
-
if (computedProps.extendTypes
|
|
256
|
+
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type])
|
|
250
257
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
251
258
|
return cloneElement(
|
|
252
259
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
@@ -257,9 +264,14 @@ function DescriptionItemContent(props) {
|
|
|
257
264
|
}
|
|
258
265
|
);
|
|
259
266
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
260
|
-
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
267
|
+
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
268
|
+
computedProps.value,
|
|
269
|
+
computedProps.values,
|
|
270
|
+
0,
|
|
271
|
+
"description"
|
|
272
|
+
) });
|
|
261
273
|
else
|
|
262
|
-
throw Error(computedProps.item.type
|
|
274
|
+
throw Error(`${computedProps.item.type} requires children or render`);
|
|
263
275
|
if (computedProps.item.descriptionChildren === null)
|
|
264
276
|
return null;
|
|
265
277
|
if (computedProps.item.descriptionChildren)
|
|
@@ -277,9 +289,19 @@ function DescriptionItemContent(props) {
|
|
|
277
289
|
values: computedProps.values
|
|
278
290
|
});
|
|
279
291
|
if (computedProps.item.descriptionRender)
|
|
280
|
-
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.item.descriptionRender(
|
|
292
|
+
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.item.descriptionRender(
|
|
293
|
+
computedProps.value,
|
|
294
|
+
computedProps.values,
|
|
295
|
+
0,
|
|
296
|
+
"description"
|
|
297
|
+
) });
|
|
281
298
|
if (computedProps.item.render)
|
|
282
|
-
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.item.render(
|
|
299
|
+
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.item.render(
|
|
300
|
+
computedProps.value,
|
|
301
|
+
computedProps.values,
|
|
302
|
+
0,
|
|
303
|
+
"description"
|
|
304
|
+
) });
|
|
283
305
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
284
306
|
return /* @__PURE__ */ jsx(Blank, {});
|
|
285
307
|
switch (computedProps.item.type) {
|
|
@@ -290,13 +312,23 @@ function DescriptionItemContent(props) {
|
|
|
290
312
|
case "number[]":
|
|
291
313
|
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.value.join(", ") });
|
|
292
314
|
case "boolean":
|
|
293
|
-
return computedProps.value ? /* @__PURE__ */ jsx(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
315
|
+
return computedProps.value ? /* @__PURE__ */ jsx(
|
|
316
|
+
CheckOutlined,
|
|
317
|
+
{
|
|
318
|
+
style: {
|
|
319
|
+
marginTop: "4px",
|
|
320
|
+
color: "#52c41a"
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
) : /* @__PURE__ */ jsx(
|
|
324
|
+
CloseOutlined,
|
|
325
|
+
{
|
|
326
|
+
style: {
|
|
327
|
+
marginTop: "4px",
|
|
328
|
+
color: "#ff4d4f"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
);
|
|
300
332
|
case "time":
|
|
301
333
|
return /* @__PURE__ */ jsx(Fragment, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
|
|
302
334
|
case "date":
|
|
@@ -313,17 +345,19 @@ function DescriptionItemContent(props) {
|
|
|
313
345
|
}
|
|
314
346
|
);
|
|
315
347
|
case "object[]":
|
|
316
|
-
if (!((
|
|
348
|
+
if (!((_b = computedProps.value) == null ? void 0 : _b.length))
|
|
317
349
|
return /* @__PURE__ */ jsx(Blank, {});
|
|
318
|
-
return /* @__PURE__ */ jsx(Space, { direction: "vertical", children: computedProps.value.map(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
350
|
+
return /* @__PURE__ */ jsx(Space, { direction: "vertical", children: computedProps.value.map(
|
|
351
|
+
(value, index) => /* @__PURE__ */ jsx(
|
|
352
|
+
Description,
|
|
353
|
+
{
|
|
354
|
+
items: computedProps.item.object,
|
|
355
|
+
dataSource: value,
|
|
356
|
+
column: 1
|
|
357
|
+
},
|
|
358
|
+
index
|
|
359
|
+
)
|
|
360
|
+
) });
|
|
327
361
|
default:
|
|
328
362
|
return computedProps.value || null;
|
|
329
363
|
}
|
|
@@ -333,13 +367,7 @@ function Description(props) {
|
|
|
333
367
|
return /* @__PURE__ */ jsx(
|
|
334
368
|
FaasDataWrapper,
|
|
335
369
|
{
|
|
336
|
-
render: ({ data }) => /* @__PURE__ */ jsx(
|
|
337
|
-
Description,
|
|
338
|
-
{
|
|
339
|
-
...props,
|
|
340
|
-
dataSource: data
|
|
341
|
-
}
|
|
342
|
-
),
|
|
370
|
+
render: ({ data }) => /* @__PURE__ */ jsx(Description, { ...props, dataSource: data }),
|
|
343
371
|
...props.faasData
|
|
344
372
|
}
|
|
345
373
|
);
|
|
@@ -371,21 +399,21 @@ function ErrorChildren(props) {
|
|
|
371
399
|
{
|
|
372
400
|
type: "error",
|
|
373
401
|
message: props.errorMessage,
|
|
374
|
-
description: /* @__PURE__ */ jsx(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
402
|
+
description: /* @__PURE__ */ jsx(
|
|
403
|
+
"pre",
|
|
404
|
+
{
|
|
405
|
+
style: {
|
|
406
|
+
fontSize: "0.9em",
|
|
407
|
+
overflowX: "auto"
|
|
408
|
+
},
|
|
409
|
+
children: props.errorDescription
|
|
410
|
+
}
|
|
411
|
+
)
|
|
378
412
|
}
|
|
379
413
|
);
|
|
380
414
|
}
|
|
381
415
|
function ErrorBoundary(props) {
|
|
382
|
-
return /* @__PURE__ */ jsx(
|
|
383
|
-
ErrorBoundary$1,
|
|
384
|
-
{
|
|
385
|
-
errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}),
|
|
386
|
-
...props
|
|
387
|
-
}
|
|
388
|
-
);
|
|
416
|
+
return /* @__PURE__ */ jsx(ErrorBoundary$1, { errorChildren: /* @__PURE__ */ jsx(ErrorChildren, {}), ...props });
|
|
389
417
|
}
|
|
390
418
|
function processProps(propsCopy, config) {
|
|
391
419
|
if (!propsCopy.title)
|
|
@@ -404,7 +432,9 @@ function processProps(propsCopy, config) {
|
|
|
404
432
|
required: true,
|
|
405
433
|
validator: async (_, values) => {
|
|
406
434
|
if (!values || values.length < 1)
|
|
407
|
-
return Promise.reject(
|
|
435
|
+
return Promise.reject(
|
|
436
|
+
Error(`${propsCopy.label || propsCopy.title} ${config.required}`)
|
|
437
|
+
);
|
|
408
438
|
}
|
|
409
439
|
});
|
|
410
440
|
else
|
|
@@ -416,7 +446,9 @@ function processProps(propsCopy, config) {
|
|
|
416
446
|
if (!propsCopy.input)
|
|
417
447
|
propsCopy.input = {};
|
|
418
448
|
if (propsCopy.options)
|
|
419
|
-
propsCopy.input.options = transferOptions(
|
|
449
|
+
propsCopy.input.options = transferOptions(
|
|
450
|
+
propsCopy.options
|
|
451
|
+
);
|
|
420
452
|
switch (propsCopy.type) {
|
|
421
453
|
case "boolean":
|
|
422
454
|
propsCopy.valuePropName = "checked";
|
|
@@ -463,16 +495,8 @@ function FormItem(props) {
|
|
|
463
495
|
if (!computedProps)
|
|
464
496
|
return null;
|
|
465
497
|
if (hidden)
|
|
466
|
-
return /* @__PURE__ */ jsx(
|
|
467
|
-
|
|
468
|
-
{
|
|
469
|
-
...computedProps,
|
|
470
|
-
noStyle: true,
|
|
471
|
-
rules: [],
|
|
472
|
-
children: /* @__PURE__ */ jsx(Input, { hidden: true })
|
|
473
|
-
}
|
|
474
|
-
);
|
|
475
|
-
if (extendTypes && extendTypes[computedProps.type])
|
|
498
|
+
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, noStyle: true, rules: [], children: /* @__PURE__ */ jsx(Input, { hidden: true }) });
|
|
499
|
+
if (extendTypes == null ? void 0 : extendTypes[computedProps.type])
|
|
476
500
|
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: extendTypes[computedProps.type].children });
|
|
477
501
|
if (computedProps.formChildren === null)
|
|
478
502
|
return null;
|
|
@@ -493,13 +517,7 @@ function FormItem(props) {
|
|
|
493
517
|
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Input, { ...computedProps.input }) });
|
|
494
518
|
case "string[]":
|
|
495
519
|
if (computedProps.options)
|
|
496
|
-
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(
|
|
497
|
-
Select,
|
|
498
|
-
{
|
|
499
|
-
mode: "multiple",
|
|
500
|
-
...computedProps.input
|
|
501
|
-
}
|
|
502
|
-
) });
|
|
520
|
+
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Select, { mode: "multiple", ...computedProps.input }) });
|
|
503
521
|
return /* @__PURE__ */ jsx(
|
|
504
522
|
Form$1.List,
|
|
505
523
|
{
|
|
@@ -508,36 +526,28 @@ function FormItem(props) {
|
|
|
508
526
|
children: (fields, { add, remove }, { errors }) => {
|
|
509
527
|
var _a2;
|
|
510
528
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
511
|
-
computedProps.label && /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx(
|
|
529
|
+
computedProps.label && /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx(
|
|
530
|
+
"label",
|
|
531
|
+
{
|
|
532
|
+
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
533
|
+
children: computedProps.label
|
|
534
|
+
}
|
|
535
|
+
) }),
|
|
512
536
|
fields.map((field) => {
|
|
513
537
|
var _a3;
|
|
514
|
-
return /* @__PURE__ */ jsx(Form$1.Item, { children: /* @__PURE__ */ jsxs(
|
|
515
|
-
|
|
516
|
-
{
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
) }),
|
|
528
|
-
/* @__PURE__ */ jsx(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
|
|
529
|
-
Button,
|
|
530
|
-
{
|
|
531
|
-
danger: true,
|
|
532
|
-
type: "link",
|
|
533
|
-
style: { float: "right" },
|
|
534
|
-
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
535
|
-
onClick: () => remove(field.name)
|
|
536
|
-
}
|
|
537
|
-
) })
|
|
538
|
-
]
|
|
539
|
-
}
|
|
540
|
-
) }, field.key);
|
|
538
|
+
return /* @__PURE__ */ jsx(Form$1.Item, { children: /* @__PURE__ */ jsxs(Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
|
|
539
|
+
/* @__PURE__ */ jsx(Col, { span: 23, children: /* @__PURE__ */ jsx(Form$1.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsx(Input, { ...computedProps.input }) }) }),
|
|
540
|
+
/* @__PURE__ */ jsx(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
|
|
541
|
+
Button,
|
|
542
|
+
{
|
|
543
|
+
danger: true,
|
|
544
|
+
type: "link",
|
|
545
|
+
style: { float: "right" },
|
|
546
|
+
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
547
|
+
onClick: () => remove(field.name)
|
|
548
|
+
}
|
|
549
|
+
) })
|
|
550
|
+
] }) }, field.key);
|
|
541
551
|
}),
|
|
542
552
|
/* @__PURE__ */ jsxs(Form$1.Item, { children: [
|
|
543
553
|
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(
|
|
@@ -568,13 +578,7 @@ function FormItem(props) {
|
|
|
568
578
|
) });
|
|
569
579
|
case "number[]":
|
|
570
580
|
if (computedProps.options)
|
|
571
|
-
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(
|
|
572
|
-
Select,
|
|
573
|
-
{
|
|
574
|
-
mode: "multiple",
|
|
575
|
-
...computedProps.input
|
|
576
|
-
}
|
|
577
|
-
) });
|
|
581
|
+
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(Select, { mode: "multiple", ...computedProps.input }) });
|
|
578
582
|
return /* @__PURE__ */ jsx(
|
|
579
583
|
Form$1.List,
|
|
580
584
|
{
|
|
@@ -583,42 +587,36 @@ function FormItem(props) {
|
|
|
583
587
|
children: (fields, { add, remove }, { errors }) => {
|
|
584
588
|
var _a2, _b;
|
|
585
589
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
586
|
-
computedProps.label && /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx(
|
|
590
|
+
computedProps.label && /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx(
|
|
591
|
+
"label",
|
|
592
|
+
{
|
|
593
|
+
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find(
|
|
594
|
+
(r) => r.required
|
|
595
|
+
)) && "ant-form-item-required",
|
|
596
|
+
children: computedProps.label
|
|
597
|
+
}
|
|
598
|
+
) }),
|
|
587
599
|
fields.map((field) => {
|
|
588
600
|
var _a3;
|
|
589
|
-
return /* @__PURE__ */ jsx(Form$1.Item, { children: /* @__PURE__ */ jsxs(
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
) }),
|
|
609
|
-
/* @__PURE__ */ jsx(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
|
|
610
|
-
Button,
|
|
611
|
-
{
|
|
612
|
-
danger: true,
|
|
613
|
-
type: "link",
|
|
614
|
-
style: { float: "right" },
|
|
615
|
-
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
616
|
-
onClick: () => remove(field.name)
|
|
617
|
-
}
|
|
618
|
-
) })
|
|
619
|
-
]
|
|
620
|
-
}
|
|
621
|
-
) }, field.key);
|
|
601
|
+
return /* @__PURE__ */ jsx(Form$1.Item, { children: /* @__PURE__ */ jsxs(Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
|
|
602
|
+
/* @__PURE__ */ jsx(Col, { span: 23, children: /* @__PURE__ */ jsx(Form$1.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsx(
|
|
603
|
+
InputNumber,
|
|
604
|
+
{
|
|
605
|
+
style: { width: "100%" },
|
|
606
|
+
...computedProps.input
|
|
607
|
+
}
|
|
608
|
+
) }) }),
|
|
609
|
+
/* @__PURE__ */ jsx(Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
|
|
610
|
+
Button,
|
|
611
|
+
{
|
|
612
|
+
danger: true,
|
|
613
|
+
type: "link",
|
|
614
|
+
style: { float: "right" },
|
|
615
|
+
icon: /* @__PURE__ */ jsx(MinusCircleOutlined, {}),
|
|
616
|
+
onClick: () => remove(field.name)
|
|
617
|
+
}
|
|
618
|
+
) })
|
|
619
|
+
] }) }, field.key);
|
|
622
620
|
}),
|
|
623
621
|
/* @__PURE__ */ jsxs(Form$1.Item, { children: [
|
|
624
622
|
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsx(
|
|
@@ -645,14 +643,14 @@ function FormItem(props) {
|
|
|
645
643
|
return /* @__PURE__ */ jsx(Form$1.Item, { ...computedProps, children: /* @__PURE__ */ jsx(TimePicker, { ...computedProps.input }) });
|
|
646
644
|
case "object":
|
|
647
645
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
648
|
-
computedProps.label && /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx(
|
|
649
|
-
|
|
650
|
-
FormItem,
|
|
646
|
+
computedProps.label && /* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsx(
|
|
647
|
+
"label",
|
|
651
648
|
{
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
))
|
|
649
|
+
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
650
|
+
children: computedProps.label
|
|
651
|
+
}
|
|
652
|
+
) }),
|
|
653
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsx(FormItem, { ...o }, o.id))
|
|
656
654
|
] });
|
|
657
655
|
case "object[]":
|
|
658
656
|
return /* @__PURE__ */ jsx(
|
|
@@ -661,43 +659,23 @@ function FormItem(props) {
|
|
|
661
659
|
name: computedProps.name,
|
|
662
660
|
rules: computedProps.rules,
|
|
663
661
|
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
664
|
-
fields.map((field) => /* @__PURE__ */ jsxs(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
)
|
|
682
|
-
] }) }),
|
|
683
|
-
/* @__PURE__ */ jsx(Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsx(
|
|
684
|
-
Col,
|
|
685
|
-
{
|
|
686
|
-
span: o.col || 24,
|
|
687
|
-
children: /* @__PURE__ */ jsx(
|
|
688
|
-
FormItem,
|
|
689
|
-
{
|
|
690
|
-
...o,
|
|
691
|
-
name: [field.name, o.id]
|
|
692
|
-
}
|
|
693
|
-
)
|
|
694
|
-
},
|
|
695
|
-
o.id
|
|
696
|
-
)) })
|
|
697
|
-
]
|
|
698
|
-
},
|
|
699
|
-
field.key
|
|
700
|
-
)),
|
|
662
|
+
fields.map((field) => /* @__PURE__ */ jsxs(Form$1.Item, { style: { marginBottom: 0 }, children: [
|
|
663
|
+
/* @__PURE__ */ jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxs("label", { children: [
|
|
664
|
+
computedProps.label,
|
|
665
|
+
" ",
|
|
666
|
+
field.name + 1,
|
|
667
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsx(
|
|
668
|
+
Button,
|
|
669
|
+
{
|
|
670
|
+
danger: true,
|
|
671
|
+
type: "link",
|
|
672
|
+
onClick: () => remove(field.name),
|
|
673
|
+
children: common2.delete
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
] }) }),
|
|
677
|
+
/* @__PURE__ */ jsx(Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsx(Col, { span: o.col || 24, children: /* @__PURE__ */ jsx(FormItem, { ...o, name: [field.name, o.id] }) }, o.id)) })
|
|
678
|
+
] }, field.key)),
|
|
701
679
|
/* @__PURE__ */ jsxs(Form$1.Item, { children: [
|
|
702
680
|
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxs(
|
|
703
681
|
Button,
|
|
@@ -731,7 +709,9 @@ function Form(props) {
|
|
|
731
709
|
const config = useConfigContext();
|
|
732
710
|
const [extendTypes, setExtendTypes] = useState();
|
|
733
711
|
const [form] = Form$1.useForm(props.form);
|
|
734
|
-
const [initialValues, setInitialValues] = useState(
|
|
712
|
+
const [initialValues, setInitialValues] = useState(
|
|
713
|
+
props.initialValues
|
|
714
|
+
);
|
|
735
715
|
useEffect(() => {
|
|
736
716
|
var _a2, _b2, _c;
|
|
737
717
|
const propsCopy = {
|
|
@@ -757,14 +737,20 @@ function Form(props) {
|
|
|
757
737
|
}
|
|
758
738
|
if (propsCopy.onFinish) {
|
|
759
739
|
propsCopy.onFinish = async (values) => {
|
|
760
|
-
var _a3;
|
|
740
|
+
var _a3, _b3;
|
|
761
741
|
setLoading(true);
|
|
762
742
|
try {
|
|
763
|
-
if (
|
|
764
|
-
await props.onFinish(
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
743
|
+
if ((_b3 = (_a3 = propsCopy.submit) == null ? void 0 : _a3.to) == null ? void 0 : _b3.action) {
|
|
744
|
+
await props.onFinish(
|
|
745
|
+
values,
|
|
746
|
+
async (values2) => faas(
|
|
747
|
+
propsCopy.submit.to.action,
|
|
748
|
+
propsCopy.submit.to.params ? {
|
|
749
|
+
...values2,
|
|
750
|
+
...propsCopy.submit.to.params
|
|
751
|
+
} : values2
|
|
752
|
+
)
|
|
753
|
+
);
|
|
768
754
|
} else
|
|
769
755
|
await props.onFinish(values);
|
|
770
756
|
} catch (error) {
|
|
@@ -775,10 +761,13 @@ function Form(props) {
|
|
|
775
761
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
776
762
|
propsCopy.onFinish = async (values) => {
|
|
777
763
|
setLoading(true);
|
|
778
|
-
return faas(
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
764
|
+
return faas(
|
|
765
|
+
propsCopy.submit.to.action,
|
|
766
|
+
propsCopy.submit.to.params ? {
|
|
767
|
+
...values,
|
|
768
|
+
...propsCopy.submit.to.params
|
|
769
|
+
} : values
|
|
770
|
+
).then((result) => {
|
|
782
771
|
if (propsCopy.submit.to.then)
|
|
783
772
|
propsCopy.submit.to.then(result);
|
|
784
773
|
return result;
|
|
@@ -799,19 +788,22 @@ function Form(props) {
|
|
|
799
788
|
}
|
|
800
789
|
setComputedProps(propsCopy);
|
|
801
790
|
}, [props]);
|
|
802
|
-
const onValuesChange = useCallback(
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
props.onValuesChange
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
const
|
|
811
|
-
|
|
812
|
-
item.onValueChange
|
|
813
|
-
|
|
814
|
-
|
|
791
|
+
const onValuesChange = useCallback(
|
|
792
|
+
(changedValues, allValues) => {
|
|
793
|
+
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
794
|
+
if (props.onValuesChange) {
|
|
795
|
+
props.onValuesChange(changedValues, allValues);
|
|
796
|
+
}
|
|
797
|
+
if (!props.items)
|
|
798
|
+
return;
|
|
799
|
+
for (const key in changedValues) {
|
|
800
|
+
const item = computedProps.items.find((i) => i.id === key);
|
|
801
|
+
if (item == null ? void 0 : item.onValueChange)
|
|
802
|
+
item.onValueChange(changedValues[key], allValues, form);
|
|
803
|
+
}
|
|
804
|
+
},
|
|
805
|
+
[computedProps]
|
|
806
|
+
);
|
|
815
807
|
useEffect(() => {
|
|
816
808
|
if (!initialValues)
|
|
817
809
|
return;
|
|
@@ -821,35 +813,22 @@ function Form(props) {
|
|
|
821
813
|
}, [computedProps]);
|
|
822
814
|
if (!computedProps)
|
|
823
815
|
return null;
|
|
824
|
-
return /* @__PURE__ */ jsxs(
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
computedProps.submit !== false && /* @__PURE__ */ jsx(
|
|
841
|
-
Button,
|
|
842
|
-
{
|
|
843
|
-
htmlType: "submit",
|
|
844
|
-
type: "primary",
|
|
845
|
-
loading,
|
|
846
|
-
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
847
|
-
}
|
|
848
|
-
),
|
|
849
|
-
computedProps.footer
|
|
850
|
-
]
|
|
851
|
-
}
|
|
852
|
-
);
|
|
816
|
+
return /* @__PURE__ */ jsxs(Form$1, { ...computedProps, onValuesChange, children: [
|
|
817
|
+
computedProps.beforeItems,
|
|
818
|
+
(_a = computedProps.items) == null ? void 0 : _a.map(
|
|
819
|
+
(item) => isValidElement(item) ? item : /* @__PURE__ */ jsx(
|
|
820
|
+
FormItem,
|
|
821
|
+
{
|
|
822
|
+
...item,
|
|
823
|
+
extendTypes
|
|
824
|
+
},
|
|
825
|
+
item.id
|
|
826
|
+
)
|
|
827
|
+
),
|
|
828
|
+
computedProps.children,
|
|
829
|
+
computedProps.submit !== false && /* @__PURE__ */ jsx(Button, { htmlType: "submit", type: "primary", loading, children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text }),
|
|
830
|
+
computedProps.footer
|
|
831
|
+
] });
|
|
853
832
|
}
|
|
854
833
|
Form.useForm = Form$1.useForm;
|
|
855
834
|
Form.useFormInstance = Form$1.useFormInstance;
|
|
@@ -862,16 +841,19 @@ function Link(props) {
|
|
|
862
841
|
var _a, _b;
|
|
863
842
|
const { Link: Config } = useConfigContext();
|
|
864
843
|
const navigate = useNavigate();
|
|
865
|
-
let
|
|
844
|
+
let computedStyle = {
|
|
866
845
|
...Config.style || {},
|
|
867
846
|
cursor: "pointer",
|
|
868
847
|
...props.style
|
|
869
848
|
};
|
|
870
849
|
if (props.block)
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
850
|
+
computedStyle = Object.assign(
|
|
851
|
+
{
|
|
852
|
+
display: "block",
|
|
853
|
+
width: "100%"
|
|
854
|
+
},
|
|
855
|
+
computedStyle
|
|
856
|
+
);
|
|
875
857
|
if (props.href.startsWith("http")) {
|
|
876
858
|
if (props.button)
|
|
877
859
|
return /* @__PURE__ */ jsx(
|
|
@@ -879,28 +861,34 @@ function Link(props) {
|
|
|
879
861
|
{
|
|
880
862
|
...props.button,
|
|
881
863
|
target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
|
|
882
|
-
style,
|
|
864
|
+
style: computedStyle,
|
|
883
865
|
href: props.href,
|
|
866
|
+
onClick: props.onClick,
|
|
884
867
|
children: (_a = props.text) != null ? _a : props.children
|
|
885
868
|
}
|
|
886
869
|
);
|
|
887
870
|
if (props.children)
|
|
888
|
-
return
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
871
|
+
return (
|
|
872
|
+
// biome-ignore lint/a11y/useValidAnchor: <explanation>
|
|
873
|
+
/* @__PURE__ */ jsx(
|
|
874
|
+
"a",
|
|
875
|
+
{
|
|
876
|
+
href: props.href,
|
|
877
|
+
target: props.target || (Config == null ? void 0 : Config.target),
|
|
878
|
+
style: computedStyle,
|
|
879
|
+
onClick: props.onClick,
|
|
880
|
+
children: props.children
|
|
881
|
+
}
|
|
882
|
+
)
|
|
896
883
|
);
|
|
897
884
|
return /* @__PURE__ */ jsx(
|
|
898
885
|
Typography.Link,
|
|
899
886
|
{
|
|
900
887
|
href: props.href,
|
|
901
888
|
target: props.target || (Config == null ? void 0 : Config.target) || "_blank",
|
|
902
|
-
style,
|
|
889
|
+
style: computedStyle,
|
|
903
890
|
copyable: props.copyable,
|
|
891
|
+
onClick: props.onClick,
|
|
904
892
|
children: props.text
|
|
905
893
|
}
|
|
906
894
|
);
|
|
@@ -910,8 +898,8 @@ function Link(props) {
|
|
|
910
898
|
Button,
|
|
911
899
|
{
|
|
912
900
|
...props.button,
|
|
913
|
-
style,
|
|
914
|
-
onClick: () => (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
|
|
901
|
+
style: computedStyle,
|
|
902
|
+
onClick: (e) => props.onClick ? props.onClick(e) : (props.target || (Config == null ? void 0 : Config.target)) === "_blank" ? window.open(props.href) : navigate(props.href),
|
|
915
903
|
children: (_b = props.text) != null ? _b : props.children
|
|
916
904
|
}
|
|
917
905
|
);
|
|
@@ -921,7 +909,8 @@ function Link(props) {
|
|
|
921
909
|
{
|
|
922
910
|
to: props.href,
|
|
923
911
|
target: props.target || (Config == null ? void 0 : Config.target),
|
|
924
|
-
style,
|
|
912
|
+
style: computedStyle,
|
|
913
|
+
onClick: props.onClick,
|
|
925
914
|
children: props.children
|
|
926
915
|
}
|
|
927
916
|
);
|
|
@@ -930,22 +919,25 @@ function Link(props) {
|
|
|
930
919
|
{
|
|
931
920
|
href: props.href,
|
|
932
921
|
target: props.target || (Config == null ? void 0 : Config.target),
|
|
933
|
-
style,
|
|
922
|
+
style: computedStyle,
|
|
934
923
|
copyable: props.copyable,
|
|
935
|
-
onClick: () =>
|
|
924
|
+
onClick: (e) => {
|
|
925
|
+
if (props.onClick) {
|
|
926
|
+
props.onClick(e);
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
if ((props.target || (Config == null ? void 0 : Config.target)) !== "_blank") {
|
|
930
|
+
e.preventDefault();
|
|
931
|
+
navigate(props.href);
|
|
932
|
+
}
|
|
933
|
+
},
|
|
936
934
|
children: props.text
|
|
937
935
|
}
|
|
938
936
|
);
|
|
939
937
|
}
|
|
940
938
|
function PageNotFound() {
|
|
941
939
|
const config = useConfigContext();
|
|
942
|
-
return /* @__PURE__ */ jsx(
|
|
943
|
-
Result,
|
|
944
|
-
{
|
|
945
|
-
status: "404",
|
|
946
|
-
title: config.common.pageNotFound
|
|
947
|
-
}
|
|
948
|
-
);
|
|
940
|
+
return /* @__PURE__ */ jsx(Result, { status: "404", title: config.common.pageNotFound });
|
|
949
941
|
}
|
|
950
942
|
function Routes(props) {
|
|
951
943
|
return /* @__PURE__ */ jsxs(Routes$1, { children: [
|
|
@@ -953,18 +945,17 @@ function Routes(props) {
|
|
|
953
945
|
Route,
|
|
954
946
|
{
|
|
955
947
|
...r,
|
|
956
|
-
element: r.element || /* @__PURE__ */ jsx(
|
|
948
|
+
element: r.element || /* @__PURE__ */ jsx(
|
|
949
|
+
Suspense,
|
|
950
|
+
{
|
|
951
|
+
fallback: props.fallback || /* @__PURE__ */ jsx("div", { style: { padding: "24px" }, children: /* @__PURE__ */ jsx(Skeleton, { active: true }) }),
|
|
952
|
+
children: /* @__PURE__ */ jsx(r.page, {})
|
|
953
|
+
}
|
|
954
|
+
)
|
|
957
955
|
},
|
|
958
956
|
r.path
|
|
959
957
|
)),
|
|
960
|
-
/* @__PURE__ */ jsx(
|
|
961
|
-
Route,
|
|
962
|
-
{
|
|
963
|
-
path: "*",
|
|
964
|
-
element: props.notFound || /* @__PURE__ */ jsx(PageNotFound, {})
|
|
965
|
-
},
|
|
966
|
-
"*"
|
|
967
|
-
)
|
|
958
|
+
/* @__PURE__ */ jsx(Route, { path: "*", element: props.notFound || /* @__PURE__ */ jsx(PageNotFound, {}) }, "*")
|
|
968
959
|
] });
|
|
969
960
|
}
|
|
970
961
|
function processValue(item, value) {
|
|
@@ -974,21 +965,21 @@ function processValue(item, value) {
|
|
|
974
965
|
return /* @__PURE__ */ jsx(Blank, {});
|
|
975
966
|
if (item.options) {
|
|
976
967
|
if (item.type.endsWith("[]"))
|
|
977
|
-
return transferred.map(
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
"
|
|
983
|
-
|
|
984
|
-
"boolean"
|
|
985
|
-
].includes(item.type))
|
|
968
|
+
return transferred.map(
|
|
969
|
+
(v) => {
|
|
970
|
+
var _a2;
|
|
971
|
+
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
972
|
+
}
|
|
973
|
+
).join(", ");
|
|
974
|
+
if (["string", "number", "boolean"].includes(item.type))
|
|
986
975
|
return ((_a = item.options.find((option) => option.value === transferred)) == null ? void 0 : _a.label) || transferred;
|
|
987
976
|
}
|
|
988
977
|
if (item.type.endsWith("[]"))
|
|
989
978
|
return transferred.join(", ");
|
|
990
979
|
if (["date", "time"].includes(item.type))
|
|
991
|
-
return transferred.format(
|
|
980
|
+
return transferred.format(
|
|
981
|
+
item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"
|
|
982
|
+
);
|
|
992
983
|
return value;
|
|
993
984
|
}
|
|
994
985
|
function Table(props) {
|
|
@@ -1005,11 +996,7 @@ function Table(props) {
|
|
|
1005
996
|
}));
|
|
1006
997
|
return;
|
|
1007
998
|
}
|
|
1008
|
-
item.filterDropdown = ({
|
|
1009
|
-
setSelectedKeys,
|
|
1010
|
-
selectedKeys,
|
|
1011
|
-
confirm
|
|
1012
|
-
}) => /* @__PURE__ */ jsx(
|
|
999
|
+
item.filterDropdown = ({ setSelectedKeys, selectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1013
1000
|
"div",
|
|
1014
1001
|
{
|
|
1015
1002
|
style: {
|
|
@@ -1044,7 +1031,7 @@ function Table(props) {
|
|
|
1044
1031
|
return item;
|
|
1045
1032
|
};
|
|
1046
1033
|
useEffect(() => {
|
|
1047
|
-
var _a;
|
|
1034
|
+
var _a, _b;
|
|
1048
1035
|
for (const item of props.items) {
|
|
1049
1036
|
if (!item.key)
|
|
1050
1037
|
item.key = item.id;
|
|
@@ -1068,39 +1055,30 @@ function Table(props) {
|
|
|
1068
1055
|
if (item.tableChildren === null)
|
|
1069
1056
|
item.render = () => null;
|
|
1070
1057
|
else if (item.tableChildren)
|
|
1071
|
-
item.render = (value, values) => cloneElement(
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
values
|
|
1077
|
-
}
|
|
1078
|
-
);
|
|
1058
|
+
item.render = (value, values) => cloneElement(item.tableChildren, {
|
|
1059
|
+
scene: "table",
|
|
1060
|
+
value,
|
|
1061
|
+
values
|
|
1062
|
+
});
|
|
1079
1063
|
else if (item.children === null)
|
|
1080
1064
|
item.render = () => null;
|
|
1081
1065
|
else if (item.children)
|
|
1082
|
-
item.render = (value, values) => cloneElement(
|
|
1083
|
-
|
|
1084
|
-
|
|
1066
|
+
item.render = (value, values) => cloneElement(item.children, {
|
|
1067
|
+
scene: "table",
|
|
1068
|
+
value,
|
|
1069
|
+
values
|
|
1070
|
+
});
|
|
1071
|
+
if ((_b = props.extendTypes) == null ? void 0 : _b[item.type]) {
|
|
1072
|
+
if (props.extendTypes[item.type].children)
|
|
1073
|
+
item.render = (value, values) => cloneElement(props.extendTypes[item.type].children, {
|
|
1085
1074
|
scene: "table",
|
|
1086
1075
|
value,
|
|
1087
1076
|
values
|
|
1088
|
-
}
|
|
1089
|
-
);
|
|
1090
|
-
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1091
|
-
if (props.extendTypes[item.type].children)
|
|
1092
|
-
item.render = (value, values) => cloneElement(
|
|
1093
|
-
props.extendTypes[item.type].children,
|
|
1094
|
-
{
|
|
1095
|
-
scene: "table",
|
|
1096
|
-
value,
|
|
1097
|
-
values
|
|
1098
|
-
}
|
|
1099
|
-
);
|
|
1077
|
+
});
|
|
1100
1078
|
else if (props.extendTypes[item.type].render)
|
|
1101
1079
|
item.render = props.extendTypes[item.type].render;
|
|
1102
1080
|
else
|
|
1103
|
-
throw Error(item.type
|
|
1081
|
+
throw Error(`${item.type} requires children or render`);
|
|
1104
1082
|
continue;
|
|
1105
1083
|
}
|
|
1106
1084
|
switch (item.type) {
|
|
@@ -1148,7 +1126,9 @@ function Table(props) {
|
|
|
1148
1126
|
return true;
|
|
1149
1127
|
if (!row[item.id] || !row[item.id].length || !value)
|
|
1150
1128
|
return false;
|
|
1151
|
-
return row[item.id].some(
|
|
1129
|
+
return row[item.id].some(
|
|
1130
|
+
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1131
|
+
);
|
|
1152
1132
|
};
|
|
1153
1133
|
if (item.filterDropdown === false || item.filterDropdown)
|
|
1154
1134
|
break;
|
|
@@ -1248,13 +1228,23 @@ function Table(props) {
|
|
|
1248
1228
|
break;
|
|
1249
1229
|
case "boolean":
|
|
1250
1230
|
if (!item.render)
|
|
1251
|
-
item.render = (value) => isNil(value) ? /* @__PURE__ */ jsx(Blank, {}) : value ? /* @__PURE__ */ jsx(
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1231
|
+
item.render = (value) => isNil(value) ? /* @__PURE__ */ jsx(Blank, {}) : value ? /* @__PURE__ */ jsx(
|
|
1232
|
+
CheckOutlined,
|
|
1233
|
+
{
|
|
1234
|
+
style: {
|
|
1235
|
+
marginTop: "4px",
|
|
1236
|
+
color: "#52c41a"
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
) : /* @__PURE__ */ jsx(
|
|
1240
|
+
CloseOutlined,
|
|
1241
|
+
{
|
|
1242
|
+
style: {
|
|
1243
|
+
marginTop: "4px",
|
|
1244
|
+
color: "#ff4d4f"
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
);
|
|
1258
1248
|
if (item.filterDropdown !== false)
|
|
1259
1249
|
item.filterDropdown = ({
|
|
1260
1250
|
setSelectedKeys,
|
|
@@ -1272,19 +1262,31 @@ function Table(props) {
|
|
|
1272
1262
|
false: false,
|
|
1273
1263
|
null: null
|
|
1274
1264
|
};
|
|
1275
|
-
setSelectedKeys(
|
|
1265
|
+
setSelectedKeys(
|
|
1266
|
+
e.target.value ? [Values[e.target.value]] : []
|
|
1267
|
+
);
|
|
1276
1268
|
confirm();
|
|
1277
1269
|
},
|
|
1278
1270
|
children: [
|
|
1279
1271
|
/* @__PURE__ */ jsx(Radio.Button, { children: common2.all }),
|
|
1280
|
-
/* @__PURE__ */ jsx(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx(
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1272
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx(
|
|
1273
|
+
CheckOutlined,
|
|
1274
|
+
{
|
|
1275
|
+
style: {
|
|
1276
|
+
color: "#52c41a",
|
|
1277
|
+
verticalAlign: "middle"
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
) }),
|
|
1281
|
+
/* @__PURE__ */ jsx(Radio.Button, { value: "false", children: /* @__PURE__ */ jsx(
|
|
1282
|
+
CloseOutlined,
|
|
1283
|
+
{
|
|
1284
|
+
style: {
|
|
1285
|
+
verticalAlign: "middle",
|
|
1286
|
+
color: "#ff4d4f"
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
) }),
|
|
1288
1290
|
/* @__PURE__ */ jsx(Radio.Button, { value: "null", children: common2.blank })
|
|
1289
1291
|
]
|
|
1290
1292
|
}
|
|
@@ -1313,14 +1315,18 @@ function Table(props) {
|
|
|
1313
1315
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1314
1316
|
};
|
|
1315
1317
|
if (!item.filterDropdown)
|
|
1316
|
-
item.filterDropdown = ({
|
|
1317
|
-
setSelectedKeys,
|
|
1318
|
-
confirm
|
|
1319
|
-
}) => /* @__PURE__ */ jsx(
|
|
1318
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1320
1319
|
DatePicker.RangePicker,
|
|
1321
1320
|
{
|
|
1322
1321
|
onChange: (dates) => {
|
|
1323
|
-
setSelectedKeys(
|
|
1322
|
+
setSelectedKeys(
|
|
1323
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1324
|
+
[
|
|
1325
|
+
dates[0].startOf("day").toISOString(),
|
|
1326
|
+
dates[1].endOf("day").toISOString()
|
|
1327
|
+
]
|
|
1328
|
+
] : []
|
|
1329
|
+
);
|
|
1324
1330
|
confirm();
|
|
1325
1331
|
}
|
|
1326
1332
|
}
|
|
@@ -1346,14 +1352,18 @@ function Table(props) {
|
|
|
1346
1352
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1347
1353
|
};
|
|
1348
1354
|
if (!item.filterDropdown)
|
|
1349
|
-
item.filterDropdown = ({
|
|
1350
|
-
setSelectedKeys,
|
|
1351
|
-
confirm
|
|
1352
|
-
}) => /* @__PURE__ */ jsx(
|
|
1355
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1353
1356
|
DatePicker.RangePicker,
|
|
1354
1357
|
{
|
|
1355
1358
|
onChange: (dates) => {
|
|
1356
|
-
setSelectedKeys(
|
|
1359
|
+
setSelectedKeys(
|
|
1360
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1361
|
+
[
|
|
1362
|
+
dates[0].startOf("day").toISOString(),
|
|
1363
|
+
dates[1].endOf("day").toISOString()
|
|
1364
|
+
]
|
|
1365
|
+
] : []
|
|
1366
|
+
);
|
|
1357
1367
|
confirm();
|
|
1358
1368
|
}
|
|
1359
1369
|
}
|
|
@@ -1436,19 +1446,7 @@ function Table(props) {
|
|
|
1436
1446
|
dataSource: props.dataSource
|
|
1437
1447
|
}
|
|
1438
1448
|
);
|
|
1439
|
-
return /* @__PURE__ */ jsx(
|
|
1440
|
-
FaasDataWrapper,
|
|
1441
|
-
{
|
|
1442
|
-
...props.faasData,
|
|
1443
|
-
children: /* @__PURE__ */ jsx(
|
|
1444
|
-
FaasDataTable,
|
|
1445
|
-
{
|
|
1446
|
-
props,
|
|
1447
|
-
columns
|
|
1448
|
-
}
|
|
1449
|
-
)
|
|
1450
|
-
}
|
|
1451
|
-
);
|
|
1449
|
+
return /* @__PURE__ */ jsx(FaasDataWrapper, { ...props.faasData, children: /* @__PURE__ */ jsx(FaasDataTable, { props, columns }) });
|
|
1452
1450
|
}
|
|
1453
1451
|
function FaasDataTable({
|
|
1454
1452
|
props,
|
|
@@ -1462,11 +1460,12 @@ function FaasDataTable({
|
|
|
1462
1460
|
if (!data || Array.isArray(data))
|
|
1463
1461
|
return;
|
|
1464
1462
|
setCurrentColumns((prev) => {
|
|
1463
|
+
var _a;
|
|
1465
1464
|
const newColumns = [...prev];
|
|
1466
1465
|
for (const column of newColumns) {
|
|
1467
|
-
if (
|
|
1468
|
-
column.options = data
|
|
1469
|
-
column.filters = data
|
|
1466
|
+
if ((_a = data.options) == null ? void 0 : _a[column.id]) {
|
|
1467
|
+
column.options = data.options[column.id];
|
|
1468
|
+
column.filters = data.options[column.id].map((v) => ({
|
|
1470
1469
|
text: v.label,
|
|
1471
1470
|
value: v.value
|
|
1472
1471
|
})).concat({
|
|
@@ -1571,14 +1570,7 @@ function Title(props) {
|
|
|
1571
1570
|
if (props.h1) {
|
|
1572
1571
|
if (typeof props.h1 === "boolean")
|
|
1573
1572
|
return /* @__PURE__ */ jsx("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1574
|
-
return /* @__PURE__ */ jsx(
|
|
1575
|
-
"h1",
|
|
1576
|
-
{
|
|
1577
|
-
className: props.h1.className,
|
|
1578
|
-
style: props.h1.style,
|
|
1579
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1580
|
-
}
|
|
1581
|
-
);
|
|
1573
|
+
return /* @__PURE__ */ jsx("h1", { className: props.h1.className, style: props.h1.style, children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1582
1574
|
}
|
|
1583
1575
|
if (props.plain)
|
|
1584
1576
|
return /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|