@faasjs/ant-design 0.0.3-beta.106 → 0.0.3-beta.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +359 -380
- package/dist/index.mjs +359 -380
- package/package.json +2 -2
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;
|
|
@@ -868,10 +847,13 @@ function Link(props) {
|
|
|
868
847
|
...props.style
|
|
869
848
|
};
|
|
870
849
|
if (props.block)
|
|
871
|
-
computedStyle = Object.assign(
|
|
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(
|
|
@@ -886,15 +868,18 @@ function Link(props) {
|
|
|
886
868
|
}
|
|
887
869
|
);
|
|
888
870
|
if (props.children)
|
|
889
|
-
return
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
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
|
+
)
|
|
898
883
|
);
|
|
899
884
|
return /* @__PURE__ */ jsx(
|
|
900
885
|
Typography.Link,
|
|
@@ -952,13 +937,7 @@ function Link(props) {
|
|
|
952
937
|
}
|
|
953
938
|
function PageNotFound() {
|
|
954
939
|
const config = useConfigContext();
|
|
955
|
-
return /* @__PURE__ */ jsx(
|
|
956
|
-
Result,
|
|
957
|
-
{
|
|
958
|
-
status: "404",
|
|
959
|
-
title: config.common.pageNotFound
|
|
960
|
-
}
|
|
961
|
-
);
|
|
940
|
+
return /* @__PURE__ */ jsx(Result, { status: "404", title: config.common.pageNotFound });
|
|
962
941
|
}
|
|
963
942
|
function Routes(props) {
|
|
964
943
|
return /* @__PURE__ */ jsxs(Routes$1, { children: [
|
|
@@ -966,18 +945,17 @@ function Routes(props) {
|
|
|
966
945
|
Route,
|
|
967
946
|
{
|
|
968
947
|
...r,
|
|
969
|
-
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
|
+
)
|
|
970
955
|
},
|
|
971
956
|
r.path
|
|
972
957
|
)),
|
|
973
|
-
/* @__PURE__ */ jsx(
|
|
974
|
-
Route,
|
|
975
|
-
{
|
|
976
|
-
path: "*",
|
|
977
|
-
element: props.notFound || /* @__PURE__ */ jsx(PageNotFound, {})
|
|
978
|
-
},
|
|
979
|
-
"*"
|
|
980
|
-
)
|
|
958
|
+
/* @__PURE__ */ jsx(Route, { path: "*", element: props.notFound || /* @__PURE__ */ jsx(PageNotFound, {}) }, "*")
|
|
981
959
|
] });
|
|
982
960
|
}
|
|
983
961
|
function processValue(item, value) {
|
|
@@ -987,21 +965,21 @@ function processValue(item, value) {
|
|
|
987
965
|
return /* @__PURE__ */ jsx(Blank, {});
|
|
988
966
|
if (item.options) {
|
|
989
967
|
if (item.type.endsWith("[]"))
|
|
990
|
-
return transferred.map(
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
"
|
|
996
|
-
|
|
997
|
-
"boolean"
|
|
998
|
-
].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))
|
|
999
975
|
return ((_a = item.options.find((option) => option.value === transferred)) == null ? void 0 : _a.label) || transferred;
|
|
1000
976
|
}
|
|
1001
977
|
if (item.type.endsWith("[]"))
|
|
1002
978
|
return transferred.join(", ");
|
|
1003
979
|
if (["date", "time"].includes(item.type))
|
|
1004
|
-
return transferred.format(
|
|
980
|
+
return transferred.format(
|
|
981
|
+
item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"
|
|
982
|
+
);
|
|
1005
983
|
return value;
|
|
1006
984
|
}
|
|
1007
985
|
function Table(props) {
|
|
@@ -1018,11 +996,7 @@ function Table(props) {
|
|
|
1018
996
|
}));
|
|
1019
997
|
return;
|
|
1020
998
|
}
|
|
1021
|
-
item.filterDropdown = ({
|
|
1022
|
-
setSelectedKeys,
|
|
1023
|
-
selectedKeys,
|
|
1024
|
-
confirm
|
|
1025
|
-
}) => /* @__PURE__ */ jsx(
|
|
999
|
+
item.filterDropdown = ({ setSelectedKeys, selectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1026
1000
|
"div",
|
|
1027
1001
|
{
|
|
1028
1002
|
style: {
|
|
@@ -1057,7 +1031,7 @@ function Table(props) {
|
|
|
1057
1031
|
return item;
|
|
1058
1032
|
};
|
|
1059
1033
|
useEffect(() => {
|
|
1060
|
-
var _a;
|
|
1034
|
+
var _a, _b;
|
|
1061
1035
|
for (const item of props.items) {
|
|
1062
1036
|
if (!item.key)
|
|
1063
1037
|
item.key = item.id;
|
|
@@ -1081,39 +1055,30 @@ function Table(props) {
|
|
|
1081
1055
|
if (item.tableChildren === null)
|
|
1082
1056
|
item.render = () => null;
|
|
1083
1057
|
else if (item.tableChildren)
|
|
1084
|
-
item.render = (value, values) => cloneElement(
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
values
|
|
1090
|
-
}
|
|
1091
|
-
);
|
|
1058
|
+
item.render = (value, values) => cloneElement(item.tableChildren, {
|
|
1059
|
+
scene: "table",
|
|
1060
|
+
value,
|
|
1061
|
+
values
|
|
1062
|
+
});
|
|
1092
1063
|
else if (item.children === null)
|
|
1093
1064
|
item.render = () => null;
|
|
1094
1065
|
else if (item.children)
|
|
1095
|
-
item.render = (value, values) => cloneElement(
|
|
1096
|
-
|
|
1097
|
-
|
|
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, {
|
|
1098
1074
|
scene: "table",
|
|
1099
1075
|
value,
|
|
1100
1076
|
values
|
|
1101
|
-
}
|
|
1102
|
-
);
|
|
1103
|
-
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1104
|
-
if (props.extendTypes[item.type].children)
|
|
1105
|
-
item.render = (value, values) => cloneElement(
|
|
1106
|
-
props.extendTypes[item.type].children,
|
|
1107
|
-
{
|
|
1108
|
-
scene: "table",
|
|
1109
|
-
value,
|
|
1110
|
-
values
|
|
1111
|
-
}
|
|
1112
|
-
);
|
|
1077
|
+
});
|
|
1113
1078
|
else if (props.extendTypes[item.type].render)
|
|
1114
1079
|
item.render = props.extendTypes[item.type].render;
|
|
1115
1080
|
else
|
|
1116
|
-
throw Error(item.type
|
|
1081
|
+
throw Error(`${item.type} requires children or render`);
|
|
1117
1082
|
continue;
|
|
1118
1083
|
}
|
|
1119
1084
|
switch (item.type) {
|
|
@@ -1161,7 +1126,9 @@ function Table(props) {
|
|
|
1161
1126
|
return true;
|
|
1162
1127
|
if (!row[item.id] || !row[item.id].length || !value)
|
|
1163
1128
|
return false;
|
|
1164
|
-
return row[item.id].some(
|
|
1129
|
+
return row[item.id].some(
|
|
1130
|
+
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1131
|
+
);
|
|
1165
1132
|
};
|
|
1166
1133
|
if (item.filterDropdown === false || item.filterDropdown)
|
|
1167
1134
|
break;
|
|
@@ -1261,13 +1228,23 @@ function Table(props) {
|
|
|
1261
1228
|
break;
|
|
1262
1229
|
case "boolean":
|
|
1263
1230
|
if (!item.render)
|
|
1264
|
-
item.render = (value) => isNil(value) ? /* @__PURE__ */ jsx(Blank, {}) : value ? /* @__PURE__ */ jsx(
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
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
|
+
);
|
|
1271
1248
|
if (item.filterDropdown !== false)
|
|
1272
1249
|
item.filterDropdown = ({
|
|
1273
1250
|
setSelectedKeys,
|
|
@@ -1285,19 +1262,31 @@ function Table(props) {
|
|
|
1285
1262
|
false: false,
|
|
1286
1263
|
null: null
|
|
1287
1264
|
};
|
|
1288
|
-
setSelectedKeys(
|
|
1265
|
+
setSelectedKeys(
|
|
1266
|
+
e.target.value ? [Values[e.target.value]] : []
|
|
1267
|
+
);
|
|
1289
1268
|
confirm();
|
|
1290
1269
|
},
|
|
1291
1270
|
children: [
|
|
1292
1271
|
/* @__PURE__ */ jsx(Radio.Button, { children: common2.all }),
|
|
1293
|
-
/* @__PURE__ */ jsx(Radio.Button, { value: "true", children: /* @__PURE__ */ jsx(
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
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
|
+
) }),
|
|
1301
1290
|
/* @__PURE__ */ jsx(Radio.Button, { value: "null", children: common2.blank })
|
|
1302
1291
|
]
|
|
1303
1292
|
}
|
|
@@ -1326,14 +1315,18 @@ function Table(props) {
|
|
|
1326
1315
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1327
1316
|
};
|
|
1328
1317
|
if (!item.filterDropdown)
|
|
1329
|
-
item.filterDropdown = ({
|
|
1330
|
-
setSelectedKeys,
|
|
1331
|
-
confirm
|
|
1332
|
-
}) => /* @__PURE__ */ jsx(
|
|
1318
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1333
1319
|
DatePicker.RangePicker,
|
|
1334
1320
|
{
|
|
1335
1321
|
onChange: (dates) => {
|
|
1336
|
-
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
|
+
);
|
|
1337
1330
|
confirm();
|
|
1338
1331
|
}
|
|
1339
1332
|
}
|
|
@@ -1359,14 +1352,18 @@ function Table(props) {
|
|
|
1359
1352
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1360
1353
|
};
|
|
1361
1354
|
if (!item.filterDropdown)
|
|
1362
|
-
item.filterDropdown = ({
|
|
1363
|
-
setSelectedKeys,
|
|
1364
|
-
confirm
|
|
1365
|
-
}) => /* @__PURE__ */ jsx(
|
|
1355
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsx(
|
|
1366
1356
|
DatePicker.RangePicker,
|
|
1367
1357
|
{
|
|
1368
1358
|
onChange: (dates) => {
|
|
1369
|
-
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
|
+
);
|
|
1370
1367
|
confirm();
|
|
1371
1368
|
}
|
|
1372
1369
|
}
|
|
@@ -1449,19 +1446,7 @@ function Table(props) {
|
|
|
1449
1446
|
dataSource: props.dataSource
|
|
1450
1447
|
}
|
|
1451
1448
|
);
|
|
1452
|
-
return /* @__PURE__ */ jsx(
|
|
1453
|
-
FaasDataWrapper,
|
|
1454
|
-
{
|
|
1455
|
-
...props.faasData,
|
|
1456
|
-
children: /* @__PURE__ */ jsx(
|
|
1457
|
-
FaasDataTable,
|
|
1458
|
-
{
|
|
1459
|
-
props,
|
|
1460
|
-
columns
|
|
1461
|
-
}
|
|
1462
|
-
)
|
|
1463
|
-
}
|
|
1464
|
-
);
|
|
1449
|
+
return /* @__PURE__ */ jsx(FaasDataWrapper, { ...props.faasData, children: /* @__PURE__ */ jsx(FaasDataTable, { props, columns }) });
|
|
1465
1450
|
}
|
|
1466
1451
|
function FaasDataTable({
|
|
1467
1452
|
props,
|
|
@@ -1475,11 +1460,12 @@ function FaasDataTable({
|
|
|
1475
1460
|
if (!data || Array.isArray(data))
|
|
1476
1461
|
return;
|
|
1477
1462
|
setCurrentColumns((prev) => {
|
|
1463
|
+
var _a;
|
|
1478
1464
|
const newColumns = [...prev];
|
|
1479
1465
|
for (const column of newColumns) {
|
|
1480
|
-
if (
|
|
1481
|
-
column.options = data
|
|
1482
|
-
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) => ({
|
|
1483
1469
|
text: v.label,
|
|
1484
1470
|
value: v.value
|
|
1485
1471
|
})).concat({
|
|
@@ -1584,14 +1570,7 @@ function Title(props) {
|
|
|
1584
1570
|
if (props.h1) {
|
|
1585
1571
|
if (typeof props.h1 === "boolean")
|
|
1586
1572
|
return /* @__PURE__ */ jsx("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1587
|
-
return /* @__PURE__ */ jsx(
|
|
1588
|
-
"h1",
|
|
1589
|
-
{
|
|
1590
|
-
className: props.h1.className,
|
|
1591
|
-
style: props.h1.style,
|
|
1592
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1593
|
-
}
|
|
1594
|
-
);
|
|
1573
|
+
return /* @__PURE__ */ jsx("h1", { className: props.h1.className, style: props.h1.style, children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1595
1574
|
}
|
|
1596
1575
|
if (props.plain)
|
|
1597
1576
|
return /* @__PURE__ */ jsx(Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|