@faasjs/ant-design 0.0.3-beta.107 → 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.js
CHANGED
|
@@ -83,12 +83,7 @@ function App(props) {
|
|
|
83
83
|
setModalProps,
|
|
84
84
|
setDrawerProps
|
|
85
85
|
}),
|
|
86
|
-
[
|
|
87
|
-
messageApi,
|
|
88
|
-
notificationApi,
|
|
89
|
-
setModalProps,
|
|
90
|
-
setDrawerProps
|
|
91
|
-
]
|
|
86
|
+
[messageApi, notificationApi, setModalProps, setDrawerProps]
|
|
92
87
|
);
|
|
93
88
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
89
|
cssinjs.StyleProvider,
|
|
@@ -157,12 +152,18 @@ function ConfigProvider2({
|
|
|
157
152
|
const [values, setValues] = react$1.useState(baseConfig);
|
|
158
153
|
react$1.useEffect(() => {
|
|
159
154
|
if (config.lang === "zh") {
|
|
160
|
-
setValues(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
155
|
+
setValues(
|
|
156
|
+
lodashEs.defaultsDeep(
|
|
157
|
+
config,
|
|
158
|
+
{
|
|
159
|
+
lang: "zh",
|
|
160
|
+
common: zh,
|
|
161
|
+
Blank: { text: zh.blank },
|
|
162
|
+
Form: { submit: { text: zh.submit } }
|
|
163
|
+
},
|
|
164
|
+
baseConfig
|
|
165
|
+
)
|
|
166
|
+
);
|
|
166
167
|
} else
|
|
167
168
|
setValues(lodashEs.defaultsDeep(config, values));
|
|
168
169
|
}, []);
|
|
@@ -178,10 +179,12 @@ function Blank(options) {
|
|
|
178
179
|
function transferOptions(options) {
|
|
179
180
|
if (!options)
|
|
180
181
|
return [];
|
|
181
|
-
return options.map(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
return options.map(
|
|
183
|
+
(item) => typeof item === "object" ? item : {
|
|
184
|
+
label: lodashEs.upperFirst(item.toString()),
|
|
185
|
+
value: item
|
|
186
|
+
}
|
|
187
|
+
);
|
|
185
188
|
}
|
|
186
189
|
function transferValue(type, value) {
|
|
187
190
|
if (typeof value === "undefined" || value === null || value === "" || value === "null" || value === "undefined")
|
|
@@ -201,13 +204,19 @@ function transferValue(type, value) {
|
|
|
201
204
|
function Loading(props) {
|
|
202
205
|
if (props.loading === false)
|
|
203
206
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: props.children });
|
|
204
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
208
|
+
"div",
|
|
209
|
+
{
|
|
210
|
+
style: {
|
|
211
|
+
...props.style || {},
|
|
212
|
+
...!props.size || props.size === "large" ? {
|
|
213
|
+
margin: "20vh auto",
|
|
214
|
+
textAlign: "center"
|
|
215
|
+
} : {}
|
|
216
|
+
},
|
|
217
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: props.size || "large" })
|
|
218
|
+
}
|
|
219
|
+
);
|
|
211
220
|
}
|
|
212
221
|
function FaasDataWrapper(props) {
|
|
213
222
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -219,10 +228,10 @@ function FaasDataWrapper(props) {
|
|
|
219
228
|
);
|
|
220
229
|
}
|
|
221
230
|
function DescriptionItemContent(props) {
|
|
222
|
-
var _a;
|
|
231
|
+
var _a, _b;
|
|
223
232
|
const [computedProps, setComputedProps] = react$1.useState();
|
|
224
233
|
react$1.useEffect(() => {
|
|
225
|
-
var _a2,
|
|
234
|
+
var _a2, _b2;
|
|
226
235
|
const propsCopy = { ...props };
|
|
227
236
|
if (!propsCopy.item.title)
|
|
228
237
|
propsCopy.item.title = lodashEs.upperFirst(propsCopy.item.id);
|
|
@@ -234,22 +243,20 @@ function DescriptionItemContent(props) {
|
|
|
234
243
|
propsCopy.value = transferValue(propsCopy.item.type, propsCopy.value);
|
|
235
244
|
if (propsCopy.item.options && propsCopy.value !== null) {
|
|
236
245
|
if (propsCopy.item.type.endsWith("[]"))
|
|
237
|
-
propsCopy.value = propsCopy.value.map(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
].includes(propsCopy.item.type))
|
|
246
|
-
propsCopy.value = ((_b = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b.label) || props.value;
|
|
246
|
+
propsCopy.value = propsCopy.value.map(
|
|
247
|
+
(v) => {
|
|
248
|
+
var _a3;
|
|
249
|
+
return ((_a3 = propsCopy.item.options.find((option) => option.value === v)) == null ? void 0 : _a3.label) || v;
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
else if (["string", "number", "boolean"].includes(propsCopy.item.type))
|
|
253
|
+
propsCopy.value = ((_b2 = props.item.options.find((option) => option.value === props.value)) == null ? void 0 : _b2.label) || props.value;
|
|
247
254
|
}
|
|
248
255
|
setComputedProps(propsCopy);
|
|
249
256
|
}, [props]);
|
|
250
257
|
if (!computedProps)
|
|
251
258
|
return null;
|
|
252
|
-
if (computedProps.extendTypes
|
|
259
|
+
if ((_a = computedProps.extendTypes) == null ? void 0 : _a[computedProps.item.type])
|
|
253
260
|
if (computedProps.extendTypes[computedProps.item.type].children)
|
|
254
261
|
return react$1.cloneElement(
|
|
255
262
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
@@ -260,9 +267,14 @@ function DescriptionItemContent(props) {
|
|
|
260
267
|
}
|
|
261
268
|
);
|
|
262
269
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
263
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.extendTypes[computedProps.item.type].render(
|
|
271
|
+
computedProps.value,
|
|
272
|
+
computedProps.values,
|
|
273
|
+
0,
|
|
274
|
+
"description"
|
|
275
|
+
) });
|
|
264
276
|
else
|
|
265
|
-
throw Error(computedProps.item.type
|
|
277
|
+
throw Error(`${computedProps.item.type} requires children or render`);
|
|
266
278
|
if (computedProps.item.descriptionChildren === null)
|
|
267
279
|
return null;
|
|
268
280
|
if (computedProps.item.descriptionChildren)
|
|
@@ -280,9 +292,19 @@ function DescriptionItemContent(props) {
|
|
|
280
292
|
values: computedProps.values
|
|
281
293
|
});
|
|
282
294
|
if (computedProps.item.descriptionRender)
|
|
283
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.item.descriptionRender(
|
|
295
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.item.descriptionRender(
|
|
296
|
+
computedProps.value,
|
|
297
|
+
computedProps.values,
|
|
298
|
+
0,
|
|
299
|
+
"description"
|
|
300
|
+
) });
|
|
284
301
|
if (computedProps.item.render)
|
|
285
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.item.render(
|
|
302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.item.render(
|
|
303
|
+
computedProps.value,
|
|
304
|
+
computedProps.values,
|
|
305
|
+
0,
|
|
306
|
+
"description"
|
|
307
|
+
) });
|
|
286
308
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
287
309
|
return /* @__PURE__ */ jsxRuntime.jsx(Blank, {});
|
|
288
310
|
switch (computedProps.item.type) {
|
|
@@ -293,13 +315,23 @@ function DescriptionItemContent(props) {
|
|
|
293
315
|
case "number[]":
|
|
294
316
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.value.join(", ") });
|
|
295
317
|
case "boolean":
|
|
296
|
-
return computedProps.value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
318
|
+
return computedProps.value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
319
|
+
icons.CheckOutlined,
|
|
320
|
+
{
|
|
321
|
+
style: {
|
|
322
|
+
marginTop: "4px",
|
|
323
|
+
color: "#52c41a"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
327
|
+
icons.CloseOutlined,
|
|
328
|
+
{
|
|
329
|
+
style: {
|
|
330
|
+
marginTop: "4px",
|
|
331
|
+
color: "#ff4d4f"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
);
|
|
303
335
|
case "time":
|
|
304
336
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: computedProps.value.format("YYYY-MM-DD HH:mm:ss") });
|
|
305
337
|
case "date":
|
|
@@ -316,17 +348,19 @@ function DescriptionItemContent(props) {
|
|
|
316
348
|
}
|
|
317
349
|
);
|
|
318
350
|
case "object[]":
|
|
319
|
-
if (!((
|
|
351
|
+
if (!((_b = computedProps.value) == null ? void 0 : _b.length))
|
|
320
352
|
return /* @__PURE__ */ jsxRuntime.jsx(Blank, {});
|
|
321
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { direction: "vertical", children: computedProps.value.map(
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
353
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Space, { direction: "vertical", children: computedProps.value.map(
|
|
354
|
+
(value, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
355
|
+
Description,
|
|
356
|
+
{
|
|
357
|
+
items: computedProps.item.object,
|
|
358
|
+
dataSource: value,
|
|
359
|
+
column: 1
|
|
360
|
+
},
|
|
361
|
+
index
|
|
362
|
+
)
|
|
363
|
+
) });
|
|
330
364
|
default:
|
|
331
365
|
return computedProps.value || null;
|
|
332
366
|
}
|
|
@@ -336,13 +370,7 @@ function Description(props) {
|
|
|
336
370
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
337
371
|
FaasDataWrapper,
|
|
338
372
|
{
|
|
339
|
-
render: ({ data }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
340
|
-
Description,
|
|
341
|
-
{
|
|
342
|
-
...props,
|
|
343
|
-
dataSource: data
|
|
344
|
-
}
|
|
345
|
-
),
|
|
373
|
+
render: ({ data }) => /* @__PURE__ */ jsxRuntime.jsx(Description, { ...props, dataSource: data }),
|
|
346
374
|
...props.faasData
|
|
347
375
|
}
|
|
348
376
|
);
|
|
@@ -374,21 +402,21 @@ function ErrorChildren(props) {
|
|
|
374
402
|
{
|
|
375
403
|
type: "error",
|
|
376
404
|
message: props.errorMessage,
|
|
377
|
-
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
405
|
+
description: /* @__PURE__ */ jsxRuntime.jsx(
|
|
406
|
+
"pre",
|
|
407
|
+
{
|
|
408
|
+
style: {
|
|
409
|
+
fontSize: "0.9em",
|
|
410
|
+
overflowX: "auto"
|
|
411
|
+
},
|
|
412
|
+
children: props.errorDescription
|
|
413
|
+
}
|
|
414
|
+
)
|
|
381
415
|
}
|
|
382
416
|
);
|
|
383
417
|
}
|
|
384
418
|
function ErrorBoundary(props) {
|
|
385
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
-
react.ErrorBoundary,
|
|
387
|
-
{
|
|
388
|
-
errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}),
|
|
389
|
-
...props
|
|
390
|
-
}
|
|
391
|
-
);
|
|
419
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.ErrorBoundary, { errorChildren: /* @__PURE__ */ jsxRuntime.jsx(ErrorChildren, {}), ...props });
|
|
392
420
|
}
|
|
393
421
|
function processProps(propsCopy, config) {
|
|
394
422
|
if (!propsCopy.title)
|
|
@@ -407,7 +435,9 @@ function processProps(propsCopy, config) {
|
|
|
407
435
|
required: true,
|
|
408
436
|
validator: async (_, values) => {
|
|
409
437
|
if (!values || values.length < 1)
|
|
410
|
-
return Promise.reject(
|
|
438
|
+
return Promise.reject(
|
|
439
|
+
Error(`${propsCopy.label || propsCopy.title} ${config.required}`)
|
|
440
|
+
);
|
|
411
441
|
}
|
|
412
442
|
});
|
|
413
443
|
else
|
|
@@ -419,7 +449,9 @@ function processProps(propsCopy, config) {
|
|
|
419
449
|
if (!propsCopy.input)
|
|
420
450
|
propsCopy.input = {};
|
|
421
451
|
if (propsCopy.options)
|
|
422
|
-
propsCopy.input.options = transferOptions(
|
|
452
|
+
propsCopy.input.options = transferOptions(
|
|
453
|
+
propsCopy.options
|
|
454
|
+
);
|
|
423
455
|
switch (propsCopy.type) {
|
|
424
456
|
case "boolean":
|
|
425
457
|
propsCopy.valuePropName = "checked";
|
|
@@ -466,16 +498,8 @@ function FormItem(props) {
|
|
|
466
498
|
if (!computedProps)
|
|
467
499
|
return null;
|
|
468
500
|
if (hidden)
|
|
469
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
470
|
-
|
|
471
|
-
{
|
|
472
|
-
...computedProps,
|
|
473
|
-
noStyle: true,
|
|
474
|
-
rules: [],
|
|
475
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { hidden: true })
|
|
476
|
-
}
|
|
477
|
-
);
|
|
478
|
-
if (extendTypes && extendTypes[computedProps.type])
|
|
501
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, noStyle: true, rules: [], children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { hidden: true }) });
|
|
502
|
+
if (extendTypes == null ? void 0 : extendTypes[computedProps.type])
|
|
479
503
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: extendTypes[computedProps.type].children });
|
|
480
504
|
if (computedProps.formChildren === null)
|
|
481
505
|
return null;
|
|
@@ -496,13 +520,7 @@ function FormItem(props) {
|
|
|
496
520
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { ...computedProps.input }) });
|
|
497
521
|
case "string[]":
|
|
498
522
|
if (computedProps.options)
|
|
499
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
500
|
-
antd.Select,
|
|
501
|
-
{
|
|
502
|
-
mode: "multiple",
|
|
503
|
-
...computedProps.input
|
|
504
|
-
}
|
|
505
|
-
) });
|
|
523
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { mode: "multiple", ...computedProps.input }) });
|
|
506
524
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
507
525
|
antd.Form.List,
|
|
508
526
|
{
|
|
@@ -511,36 +529,28 @@ function FormItem(props) {
|
|
|
511
529
|
children: (fields, { add, remove }, { errors }) => {
|
|
512
530
|
var _a2;
|
|
513
531
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
514
|
-
computedProps.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
+
computedProps.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
533
|
+
"label",
|
|
534
|
+
{
|
|
535
|
+
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
536
|
+
children: computedProps.label
|
|
537
|
+
}
|
|
538
|
+
) }),
|
|
515
539
|
fields.map((field) => {
|
|
516
540
|
var _a3;
|
|
517
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
518
|
-
antd.
|
|
519
|
-
{
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
) }),
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
-
antd.Button,
|
|
533
|
-
{
|
|
534
|
-
danger: true,
|
|
535
|
-
type: "link",
|
|
536
|
-
style: { float: "right" },
|
|
537
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
|
|
538
|
-
onClick: () => remove(field.name)
|
|
539
|
-
}
|
|
540
|
-
) })
|
|
541
|
-
]
|
|
542
|
-
}
|
|
543
|
-
) }, field.key);
|
|
541
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
|
|
542
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 23, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { ...computedProps.input }) }) }),
|
|
543
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
544
|
+
antd.Button,
|
|
545
|
+
{
|
|
546
|
+
danger: true,
|
|
547
|
+
type: "link",
|
|
548
|
+
style: { float: "right" },
|
|
549
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
|
|
550
|
+
onClick: () => remove(field.name)
|
|
551
|
+
}
|
|
552
|
+
) })
|
|
553
|
+
] }) }, field.key);
|
|
544
554
|
}),
|
|
545
555
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { children: [
|
|
546
556
|
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -571,13 +581,7 @@ function FormItem(props) {
|
|
|
571
581
|
) });
|
|
572
582
|
case "number[]":
|
|
573
583
|
if (computedProps.options)
|
|
574
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
575
|
-
antd.Select,
|
|
576
|
-
{
|
|
577
|
-
mode: "multiple",
|
|
578
|
-
...computedProps.input
|
|
579
|
-
}
|
|
580
|
-
) });
|
|
584
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Select, { mode: "multiple", ...computedProps.input }) });
|
|
581
585
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
582
586
|
antd.Form.List,
|
|
583
587
|
{
|
|
@@ -586,42 +590,36 @@ function FormItem(props) {
|
|
|
586
590
|
children: (fields, { add, remove }, { errors }) => {
|
|
587
591
|
var _a2, _b;
|
|
588
592
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
589
|
-
computedProps.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
593
|
+
computedProps.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
594
|
+
"label",
|
|
595
|
+
{
|
|
596
|
+
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find(
|
|
597
|
+
(r) => r.required
|
|
598
|
+
)) && "ant-form-item-required",
|
|
599
|
+
children: computedProps.label
|
|
600
|
+
}
|
|
601
|
+
) }),
|
|
590
602
|
fields.map((field) => {
|
|
591
603
|
var _a3;
|
|
592
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
593
|
-
antd.
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
) }),
|
|
612
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
613
|
-
antd.Button,
|
|
614
|
-
{
|
|
615
|
-
danger: true,
|
|
616
|
-
type: "link",
|
|
617
|
-
style: { float: "right" },
|
|
618
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
|
|
619
|
-
onClick: () => remove(field.name)
|
|
620
|
-
}
|
|
621
|
-
) })
|
|
622
|
-
]
|
|
623
|
-
}
|
|
624
|
-
) }, field.key);
|
|
604
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Row, { gutter: 24, style: { flexFlow: "row nowrap" }, children: [
|
|
605
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 23, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...field, noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
606
|
+
antd.InputNumber,
|
|
607
|
+
{
|
|
608
|
+
style: { width: "100%" },
|
|
609
|
+
...computedProps.input
|
|
610
|
+
}
|
|
611
|
+
) }) }),
|
|
612
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 1, children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
613
|
+
antd.Button,
|
|
614
|
+
{
|
|
615
|
+
danger: true,
|
|
616
|
+
type: "link",
|
|
617
|
+
style: { float: "right" },
|
|
618
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusCircleOutlined, {}),
|
|
619
|
+
onClick: () => remove(field.name)
|
|
620
|
+
}
|
|
621
|
+
) })
|
|
622
|
+
] }) }, field.key);
|
|
625
623
|
}),
|
|
626
624
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { children: [
|
|
627
625
|
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -648,14 +646,14 @@ function FormItem(props) {
|
|
|
648
646
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { ...computedProps, children: /* @__PURE__ */ jsxRuntime.jsx(antd.TimePicker, { ...computedProps.input }) });
|
|
649
647
|
case "object":
|
|
650
648
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
651
|
-
computedProps.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
652
|
-
|
|
653
|
-
FormItem,
|
|
649
|
+
computedProps.label && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
650
|
+
"label",
|
|
654
651
|
{
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
))
|
|
652
|
+
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
653
|
+
children: computedProps.label
|
|
654
|
+
}
|
|
655
|
+
) }),
|
|
656
|
+
computedProps.object.map((o) => /* @__PURE__ */ jsxRuntime.jsx(FormItem, { ...o }, o.id))
|
|
659
657
|
] });
|
|
660
658
|
case "object[]":
|
|
661
659
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -664,43 +662,23 @@ function FormItem(props) {
|
|
|
664
662
|
name: computedProps.name,
|
|
665
663
|
rules: computedProps.rules,
|
|
666
664
|
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
667
|
-
fields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
)
|
|
685
|
-
] }) }),
|
|
686
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
687
|
-
antd.Col,
|
|
688
|
-
{
|
|
689
|
-
span: o.col || 24,
|
|
690
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
691
|
-
FormItem,
|
|
692
|
-
{
|
|
693
|
-
...o,
|
|
694
|
-
name: [field.name, o.id]
|
|
695
|
-
}
|
|
696
|
-
)
|
|
697
|
-
},
|
|
698
|
-
o.id
|
|
699
|
-
)) })
|
|
700
|
-
]
|
|
701
|
-
},
|
|
702
|
-
field.key
|
|
703
|
-
)),
|
|
665
|
+
fields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { style: { marginBottom: 0 }, children: [
|
|
666
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "ant-form-item-label", children: /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
|
|
667
|
+
computedProps.label,
|
|
668
|
+
" ",
|
|
669
|
+
field.name + 1,
|
|
670
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
671
|
+
antd.Button,
|
|
672
|
+
{
|
|
673
|
+
danger: true,
|
|
674
|
+
type: "link",
|
|
675
|
+
onClick: () => remove(field.name),
|
|
676
|
+
children: common2.delete
|
|
677
|
+
}
|
|
678
|
+
)
|
|
679
|
+
] }) }),
|
|
680
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 24, children: computedProps.object.map((o) => /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: o.col || 24, children: /* @__PURE__ */ jsxRuntime.jsx(FormItem, { ...o, name: [field.name, o.id] }) }, o.id)) })
|
|
681
|
+
] }, field.key)),
|
|
704
682
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Form.Item, { children: [
|
|
705
683
|
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
706
684
|
antd.Button,
|
|
@@ -734,7 +712,9 @@ function Form(props) {
|
|
|
734
712
|
const config = useConfigContext();
|
|
735
713
|
const [extendTypes, setExtendTypes] = react$1.useState();
|
|
736
714
|
const [form] = antd.Form.useForm(props.form);
|
|
737
|
-
const [initialValues, setInitialValues] = react$1.useState(
|
|
715
|
+
const [initialValues, setInitialValues] = react$1.useState(
|
|
716
|
+
props.initialValues
|
|
717
|
+
);
|
|
738
718
|
react$1.useEffect(() => {
|
|
739
719
|
var _a2, _b2, _c;
|
|
740
720
|
const propsCopy = {
|
|
@@ -760,14 +740,20 @@ function Form(props) {
|
|
|
760
740
|
}
|
|
761
741
|
if (propsCopy.onFinish) {
|
|
762
742
|
propsCopy.onFinish = async (values) => {
|
|
763
|
-
var _a3;
|
|
743
|
+
var _a3, _b3;
|
|
764
744
|
setLoading(true);
|
|
765
745
|
try {
|
|
766
|
-
if (
|
|
767
|
-
await props.onFinish(
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
746
|
+
if ((_b3 = (_a3 = propsCopy.submit) == null ? void 0 : _a3.to) == null ? void 0 : _b3.action) {
|
|
747
|
+
await props.onFinish(
|
|
748
|
+
values,
|
|
749
|
+
async (values2) => react.faas(
|
|
750
|
+
propsCopy.submit.to.action,
|
|
751
|
+
propsCopy.submit.to.params ? {
|
|
752
|
+
...values2,
|
|
753
|
+
...propsCopy.submit.to.params
|
|
754
|
+
} : values2
|
|
755
|
+
)
|
|
756
|
+
);
|
|
771
757
|
} else
|
|
772
758
|
await props.onFinish(values);
|
|
773
759
|
} catch (error) {
|
|
@@ -778,10 +764,13 @@ function Form(props) {
|
|
|
778
764
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
779
765
|
propsCopy.onFinish = async (values) => {
|
|
780
766
|
setLoading(true);
|
|
781
|
-
return react.faas(
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
767
|
+
return react.faas(
|
|
768
|
+
propsCopy.submit.to.action,
|
|
769
|
+
propsCopy.submit.to.params ? {
|
|
770
|
+
...values,
|
|
771
|
+
...propsCopy.submit.to.params
|
|
772
|
+
} : values
|
|
773
|
+
).then((result) => {
|
|
785
774
|
if (propsCopy.submit.to.then)
|
|
786
775
|
propsCopy.submit.to.then(result);
|
|
787
776
|
return result;
|
|
@@ -802,19 +791,22 @@ function Form(props) {
|
|
|
802
791
|
}
|
|
803
792
|
setComputedProps(propsCopy);
|
|
804
793
|
}, [props]);
|
|
805
|
-
const onValuesChange = react$1.useCallback(
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
props.onValuesChange
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
item.onValueChange
|
|
816
|
-
|
|
817
|
-
|
|
794
|
+
const onValuesChange = react$1.useCallback(
|
|
795
|
+
(changedValues, allValues) => {
|
|
796
|
+
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
797
|
+
if (props.onValuesChange) {
|
|
798
|
+
props.onValuesChange(changedValues, allValues);
|
|
799
|
+
}
|
|
800
|
+
if (!props.items)
|
|
801
|
+
return;
|
|
802
|
+
for (const key in changedValues) {
|
|
803
|
+
const item = computedProps.items.find((i) => i.id === key);
|
|
804
|
+
if (item == null ? void 0 : item.onValueChange)
|
|
805
|
+
item.onValueChange(changedValues[key], allValues, form);
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
[computedProps]
|
|
809
|
+
);
|
|
818
810
|
react$1.useEffect(() => {
|
|
819
811
|
if (!initialValues)
|
|
820
812
|
return;
|
|
@@ -824,35 +816,22 @@ function Form(props) {
|
|
|
824
816
|
}, [computedProps]);
|
|
825
817
|
if (!computedProps)
|
|
826
818
|
return null;
|
|
827
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
computedProps.submit !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
844
|
-
antd.Button,
|
|
845
|
-
{
|
|
846
|
-
htmlType: "submit",
|
|
847
|
-
type: "primary",
|
|
848
|
-
loading,
|
|
849
|
-
children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text
|
|
850
|
-
}
|
|
851
|
-
),
|
|
852
|
-
computedProps.footer
|
|
853
|
-
]
|
|
854
|
-
}
|
|
855
|
-
);
|
|
819
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(antd.Form, { ...computedProps, onValuesChange, children: [
|
|
820
|
+
computedProps.beforeItems,
|
|
821
|
+
(_a = computedProps.items) == null ? void 0 : _a.map(
|
|
822
|
+
(item) => react$1.isValidElement(item) ? item : /* @__PURE__ */ jsxRuntime.jsx(
|
|
823
|
+
FormItem,
|
|
824
|
+
{
|
|
825
|
+
...item,
|
|
826
|
+
extendTypes
|
|
827
|
+
},
|
|
828
|
+
item.id
|
|
829
|
+
)
|
|
830
|
+
),
|
|
831
|
+
computedProps.children,
|
|
832
|
+
computedProps.submit !== false && /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { htmlType: "submit", type: "primary", loading, children: ((_b = computedProps.submit) == null ? void 0 : _b.text) || config.Form.submit.text }),
|
|
833
|
+
computedProps.footer
|
|
834
|
+
] });
|
|
856
835
|
}
|
|
857
836
|
Form.useForm = antd.Form.useForm;
|
|
858
837
|
Form.useFormInstance = antd.Form.useFormInstance;
|
|
@@ -871,10 +850,13 @@ function Link(props) {
|
|
|
871
850
|
...props.style
|
|
872
851
|
};
|
|
873
852
|
if (props.block)
|
|
874
|
-
computedStyle = Object.assign(
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
853
|
+
computedStyle = Object.assign(
|
|
854
|
+
{
|
|
855
|
+
display: "block",
|
|
856
|
+
width: "100%"
|
|
857
|
+
},
|
|
858
|
+
computedStyle
|
|
859
|
+
);
|
|
878
860
|
if (props.href.startsWith("http")) {
|
|
879
861
|
if (props.button)
|
|
880
862
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -889,15 +871,18 @@ function Link(props) {
|
|
|
889
871
|
}
|
|
890
872
|
);
|
|
891
873
|
if (props.children)
|
|
892
|
-
return
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
874
|
+
return (
|
|
875
|
+
// biome-ignore lint/a11y/useValidAnchor: <explanation>
|
|
876
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
877
|
+
"a",
|
|
878
|
+
{
|
|
879
|
+
href: props.href,
|
|
880
|
+
target: props.target || (Config == null ? void 0 : Config.target),
|
|
881
|
+
style: computedStyle,
|
|
882
|
+
onClick: props.onClick,
|
|
883
|
+
children: props.children
|
|
884
|
+
}
|
|
885
|
+
)
|
|
901
886
|
);
|
|
902
887
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
903
888
|
antd.Typography.Link,
|
|
@@ -955,13 +940,7 @@ function Link(props) {
|
|
|
955
940
|
}
|
|
956
941
|
function PageNotFound() {
|
|
957
942
|
const config = useConfigContext();
|
|
958
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
959
|
-
antd.Result,
|
|
960
|
-
{
|
|
961
|
-
status: "404",
|
|
962
|
-
title: config.common.pageNotFound
|
|
963
|
-
}
|
|
964
|
-
);
|
|
943
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Result, { status: "404", title: config.common.pageNotFound });
|
|
965
944
|
}
|
|
966
945
|
function Routes(props) {
|
|
967
946
|
return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
@@ -969,18 +948,17 @@ function Routes(props) {
|
|
|
969
948
|
reactRouterDom.Route,
|
|
970
949
|
{
|
|
971
950
|
...r,
|
|
972
|
-
element: r.element || /* @__PURE__ */ jsxRuntime.jsx(
|
|
951
|
+
element: r.element || /* @__PURE__ */ jsxRuntime.jsx(
|
|
952
|
+
react$1.Suspense,
|
|
953
|
+
{
|
|
954
|
+
fallback: props.fallback || /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "24px" }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Skeleton, { active: true }) }),
|
|
955
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(r.page, {})
|
|
956
|
+
}
|
|
957
|
+
)
|
|
973
958
|
},
|
|
974
959
|
r.path
|
|
975
960
|
)),
|
|
976
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
977
|
-
reactRouterDom.Route,
|
|
978
|
-
{
|
|
979
|
-
path: "*",
|
|
980
|
-
element: props.notFound || /* @__PURE__ */ jsxRuntime.jsx(PageNotFound, {})
|
|
981
|
-
},
|
|
982
|
-
"*"
|
|
983
|
-
)
|
|
961
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: props.notFound || /* @__PURE__ */ jsxRuntime.jsx(PageNotFound, {}) }, "*")
|
|
984
962
|
] });
|
|
985
963
|
}
|
|
986
964
|
function processValue(item, value) {
|
|
@@ -990,21 +968,21 @@ function processValue(item, value) {
|
|
|
990
968
|
return /* @__PURE__ */ jsxRuntime.jsx(Blank, {});
|
|
991
969
|
if (item.options) {
|
|
992
970
|
if (item.type.endsWith("[]"))
|
|
993
|
-
return transferred.map(
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
"
|
|
999
|
-
|
|
1000
|
-
"boolean"
|
|
1001
|
-
].includes(item.type))
|
|
971
|
+
return transferred.map(
|
|
972
|
+
(v) => {
|
|
973
|
+
var _a2;
|
|
974
|
+
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
975
|
+
}
|
|
976
|
+
).join(", ");
|
|
977
|
+
if (["string", "number", "boolean"].includes(item.type))
|
|
1002
978
|
return ((_a = item.options.find((option) => option.value === transferred)) == null ? void 0 : _a.label) || transferred;
|
|
1003
979
|
}
|
|
1004
980
|
if (item.type.endsWith("[]"))
|
|
1005
981
|
return transferred.join(", ");
|
|
1006
982
|
if (["date", "time"].includes(item.type))
|
|
1007
|
-
return transferred.format(
|
|
983
|
+
return transferred.format(
|
|
984
|
+
item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss"
|
|
985
|
+
);
|
|
1008
986
|
return value;
|
|
1009
987
|
}
|
|
1010
988
|
function Table(props) {
|
|
@@ -1021,11 +999,7 @@ function Table(props) {
|
|
|
1021
999
|
}));
|
|
1022
1000
|
return;
|
|
1023
1001
|
}
|
|
1024
|
-
item.filterDropdown = ({
|
|
1025
|
-
setSelectedKeys,
|
|
1026
|
-
selectedKeys,
|
|
1027
|
-
confirm
|
|
1028
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1002
|
+
item.filterDropdown = ({ setSelectedKeys, selectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1029
1003
|
"div",
|
|
1030
1004
|
{
|
|
1031
1005
|
style: {
|
|
@@ -1060,7 +1034,7 @@ function Table(props) {
|
|
|
1060
1034
|
return item;
|
|
1061
1035
|
};
|
|
1062
1036
|
react$1.useEffect(() => {
|
|
1063
|
-
var _a;
|
|
1037
|
+
var _a, _b;
|
|
1064
1038
|
for (const item of props.items) {
|
|
1065
1039
|
if (!item.key)
|
|
1066
1040
|
item.key = item.id;
|
|
@@ -1084,39 +1058,30 @@ function Table(props) {
|
|
|
1084
1058
|
if (item.tableChildren === null)
|
|
1085
1059
|
item.render = () => null;
|
|
1086
1060
|
else if (item.tableChildren)
|
|
1087
|
-
item.render = (value, values) => react$1.cloneElement(
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
values
|
|
1093
|
-
}
|
|
1094
|
-
);
|
|
1061
|
+
item.render = (value, values) => react$1.cloneElement(item.tableChildren, {
|
|
1062
|
+
scene: "table",
|
|
1063
|
+
value,
|
|
1064
|
+
values
|
|
1065
|
+
});
|
|
1095
1066
|
else if (item.children === null)
|
|
1096
1067
|
item.render = () => null;
|
|
1097
1068
|
else if (item.children)
|
|
1098
|
-
item.render = (value, values) => react$1.cloneElement(
|
|
1099
|
-
|
|
1100
|
-
|
|
1069
|
+
item.render = (value, values) => react$1.cloneElement(item.children, {
|
|
1070
|
+
scene: "table",
|
|
1071
|
+
value,
|
|
1072
|
+
values
|
|
1073
|
+
});
|
|
1074
|
+
if ((_b = props.extendTypes) == null ? void 0 : _b[item.type]) {
|
|
1075
|
+
if (props.extendTypes[item.type].children)
|
|
1076
|
+
item.render = (value, values) => react$1.cloneElement(props.extendTypes[item.type].children, {
|
|
1101
1077
|
scene: "table",
|
|
1102
1078
|
value,
|
|
1103
1079
|
values
|
|
1104
|
-
}
|
|
1105
|
-
);
|
|
1106
|
-
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1107
|
-
if (props.extendTypes[item.type].children)
|
|
1108
|
-
item.render = (value, values) => react$1.cloneElement(
|
|
1109
|
-
props.extendTypes[item.type].children,
|
|
1110
|
-
{
|
|
1111
|
-
scene: "table",
|
|
1112
|
-
value,
|
|
1113
|
-
values
|
|
1114
|
-
}
|
|
1115
|
-
);
|
|
1080
|
+
});
|
|
1116
1081
|
else if (props.extendTypes[item.type].render)
|
|
1117
1082
|
item.render = props.extendTypes[item.type].render;
|
|
1118
1083
|
else
|
|
1119
|
-
throw Error(item.type
|
|
1084
|
+
throw Error(`${item.type} requires children or render`);
|
|
1120
1085
|
continue;
|
|
1121
1086
|
}
|
|
1122
1087
|
switch (item.type) {
|
|
@@ -1164,7 +1129,9 @@ function Table(props) {
|
|
|
1164
1129
|
return true;
|
|
1165
1130
|
if (!row[item.id] || !row[item.id].length || !value)
|
|
1166
1131
|
return false;
|
|
1167
|
-
return row[item.id].some(
|
|
1132
|
+
return row[item.id].some(
|
|
1133
|
+
(v) => v.trim().toLowerCase().includes(value.trim().toLowerCase())
|
|
1134
|
+
);
|
|
1168
1135
|
};
|
|
1169
1136
|
if (item.filterDropdown === false || item.filterDropdown)
|
|
1170
1137
|
break;
|
|
@@ -1264,13 +1231,23 @@ function Table(props) {
|
|
|
1264
1231
|
break;
|
|
1265
1232
|
case "boolean":
|
|
1266
1233
|
if (!item.render)
|
|
1267
|
-
item.render = (value) => lodashEs.isNil(value) ? /* @__PURE__ */ jsxRuntime.jsx(Blank, {}) : value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1234
|
+
item.render = (value) => lodashEs.isNil(value) ? /* @__PURE__ */ jsxRuntime.jsx(Blank, {}) : value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1235
|
+
icons.CheckOutlined,
|
|
1236
|
+
{
|
|
1237
|
+
style: {
|
|
1238
|
+
marginTop: "4px",
|
|
1239
|
+
color: "#52c41a"
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1243
|
+
icons.CloseOutlined,
|
|
1244
|
+
{
|
|
1245
|
+
style: {
|
|
1246
|
+
marginTop: "4px",
|
|
1247
|
+
color: "#ff4d4f"
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
);
|
|
1274
1251
|
if (item.filterDropdown !== false)
|
|
1275
1252
|
item.filterDropdown = ({
|
|
1276
1253
|
setSelectedKeys,
|
|
@@ -1288,19 +1265,31 @@ function Table(props) {
|
|
|
1288
1265
|
false: false,
|
|
1289
1266
|
null: null
|
|
1290
1267
|
};
|
|
1291
|
-
setSelectedKeys(
|
|
1268
|
+
setSelectedKeys(
|
|
1269
|
+
e.target.value ? [Values[e.target.value]] : []
|
|
1270
|
+
);
|
|
1292
1271
|
confirm();
|
|
1293
1272
|
},
|
|
1294
1273
|
children: [
|
|
1295
1274
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { children: common2.all }),
|
|
1296
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1275
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1276
|
+
icons.CheckOutlined,
|
|
1277
|
+
{
|
|
1278
|
+
style: {
|
|
1279
|
+
color: "#52c41a",
|
|
1280
|
+
verticalAlign: "middle"
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
) }),
|
|
1284
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "false", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1285
|
+
icons.CloseOutlined,
|
|
1286
|
+
{
|
|
1287
|
+
style: {
|
|
1288
|
+
verticalAlign: "middle",
|
|
1289
|
+
color: "#ff4d4f"
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
) }),
|
|
1304
1293
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Radio.Button, { value: "null", children: common2.blank })
|
|
1305
1294
|
]
|
|
1306
1295
|
}
|
|
@@ -1329,14 +1318,18 @@ function Table(props) {
|
|
|
1329
1318
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1330
1319
|
};
|
|
1331
1320
|
if (!item.filterDropdown)
|
|
1332
|
-
item.filterDropdown = ({
|
|
1333
|
-
setSelectedKeys,
|
|
1334
|
-
confirm
|
|
1335
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1321
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1336
1322
|
antd.DatePicker.RangePicker,
|
|
1337
1323
|
{
|
|
1338
1324
|
onChange: (dates) => {
|
|
1339
|
-
setSelectedKeys(
|
|
1325
|
+
setSelectedKeys(
|
|
1326
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1327
|
+
[
|
|
1328
|
+
dates[0].startOf("day").toISOString(),
|
|
1329
|
+
dates[1].endOf("day").toISOString()
|
|
1330
|
+
]
|
|
1331
|
+
] : []
|
|
1332
|
+
);
|
|
1340
1333
|
confirm();
|
|
1341
1334
|
}
|
|
1342
1335
|
}
|
|
@@ -1362,14 +1355,18 @@ function Table(props) {
|
|
|
1362
1355
|
return new Date(a[item.id]).getTime() < new Date(b[item.id]).getTime() ? -1 : 1;
|
|
1363
1356
|
};
|
|
1364
1357
|
if (!item.filterDropdown)
|
|
1365
|
-
item.filterDropdown = ({
|
|
1366
|
-
setSelectedKeys,
|
|
1367
|
-
confirm
|
|
1368
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1358
|
+
item.filterDropdown = ({ setSelectedKeys, confirm }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1369
1359
|
antd.DatePicker.RangePicker,
|
|
1370
1360
|
{
|
|
1371
1361
|
onChange: (dates) => {
|
|
1372
|
-
setSelectedKeys(
|
|
1362
|
+
setSelectedKeys(
|
|
1363
|
+
(dates == null ? void 0 : dates[0]) && dates[1] ? [
|
|
1364
|
+
[
|
|
1365
|
+
dates[0].startOf("day").toISOString(),
|
|
1366
|
+
dates[1].endOf("day").toISOString()
|
|
1367
|
+
]
|
|
1368
|
+
] : []
|
|
1369
|
+
);
|
|
1373
1370
|
confirm();
|
|
1374
1371
|
}
|
|
1375
1372
|
}
|
|
@@ -1452,19 +1449,7 @@ function Table(props) {
|
|
|
1452
1449
|
dataSource: props.dataSource
|
|
1453
1450
|
}
|
|
1454
1451
|
);
|
|
1455
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1456
|
-
FaasDataWrapper,
|
|
1457
|
-
{
|
|
1458
|
-
...props.faasData,
|
|
1459
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1460
|
-
FaasDataTable,
|
|
1461
|
-
{
|
|
1462
|
-
props,
|
|
1463
|
-
columns
|
|
1464
|
-
}
|
|
1465
|
-
)
|
|
1466
|
-
}
|
|
1467
|
-
);
|
|
1452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FaasDataWrapper, { ...props.faasData, children: /* @__PURE__ */ jsxRuntime.jsx(FaasDataTable, { props, columns }) });
|
|
1468
1453
|
}
|
|
1469
1454
|
function FaasDataTable({
|
|
1470
1455
|
props,
|
|
@@ -1478,11 +1463,12 @@ function FaasDataTable({
|
|
|
1478
1463
|
if (!data || Array.isArray(data))
|
|
1479
1464
|
return;
|
|
1480
1465
|
setCurrentColumns((prev) => {
|
|
1466
|
+
var _a;
|
|
1481
1467
|
const newColumns = [...prev];
|
|
1482
1468
|
for (const column of newColumns) {
|
|
1483
|
-
if (
|
|
1484
|
-
column.options = data
|
|
1485
|
-
column.filters = data
|
|
1469
|
+
if ((_a = data.options) == null ? void 0 : _a[column.id]) {
|
|
1470
|
+
column.options = data.options[column.id];
|
|
1471
|
+
column.filters = data.options[column.id].map((v) => ({
|
|
1486
1472
|
text: v.label,
|
|
1487
1473
|
value: v.value
|
|
1488
1474
|
})).concat({
|
|
@@ -1587,14 +1573,7 @@ function Title(props) {
|
|
|
1587
1573
|
if (props.h1) {
|
|
1588
1574
|
if (typeof props.h1 === "boolean")
|
|
1589
1575
|
return /* @__PURE__ */ jsxRuntime.jsx("h1", { children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1590
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1591
|
-
"h1",
|
|
1592
|
-
{
|
|
1593
|
-
className: props.h1.className,
|
|
1594
|
-
style: props.h1.style,
|
|
1595
|
-
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1596
|
-
}
|
|
1597
|
-
);
|
|
1576
|
+
return /* @__PURE__ */ jsxRuntime.jsx("h1", { className: props.h1.className, style: props.h1.style, children: Array.isArray(props.title) ? props.title[0] : props.title });
|
|
1598
1577
|
}
|
|
1599
1578
|
if (props.plain)
|
|
1600
1579
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.isArray(props.title) ? props.title[0] : props.title });
|