@faasjs/ant-design 0.0.2-beta.415 → 0.0.2-beta.417
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -0
- package/dist/index.js +306 -233
- package/dist/index.mjs +205 -130
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -70,7 +70,9 @@ var zh = {
|
|
|
70
70
|
pageNotFound: "\u9875\u9762\u672A\u627E\u5230",
|
|
71
71
|
add: "\u6DFB\u52A0",
|
|
72
72
|
delete: "\u5220\u9664",
|
|
73
|
-
required: "\u5FC5\u586B"
|
|
73
|
+
required: "\u5FC5\u586B",
|
|
74
|
+
search: "\u641C\u7D22",
|
|
75
|
+
reset: "\u91CD\u7F6E"
|
|
74
76
|
};
|
|
75
77
|
var en = {
|
|
76
78
|
lang: "en",
|
|
@@ -80,7 +82,9 @@ var en = {
|
|
|
80
82
|
pageNotFound: "Page Not Found",
|
|
81
83
|
add: "Add",
|
|
82
84
|
delete: "Delete",
|
|
83
|
-
required: "is required"
|
|
85
|
+
required: "is required",
|
|
86
|
+
search: "Search",
|
|
87
|
+
reset: "Reset"
|
|
84
88
|
};
|
|
85
89
|
var common = isZH ? zh : en;
|
|
86
90
|
var baseConfig = {
|
|
@@ -125,10 +129,10 @@ function useConfigContext() {
|
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
// src/Blank.tsx
|
|
128
|
-
var
|
|
132
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
129
133
|
function Blank(options) {
|
|
130
134
|
const { Blank: Blank2 } = useConfigContext();
|
|
131
|
-
return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0,
|
|
135
|
+
return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Typography.Text, {
|
|
132
136
|
disabled: true,
|
|
133
137
|
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
134
138
|
}) : options.value;
|
|
@@ -164,7 +168,7 @@ var import_lodash4 = require("lodash");
|
|
|
164
168
|
var import_react3 = require("react");
|
|
165
169
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
166
170
|
var import_react4 = require("@faasjs/react");
|
|
167
|
-
var
|
|
171
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
168
172
|
function DescriptionItemContent(props) {
|
|
169
173
|
const [computedProps, setComputedProps] = (0, import_react3.useState)();
|
|
170
174
|
(0, import_react3.useEffect)(() => {
|
|
@@ -204,7 +208,7 @@ function DescriptionItemContent(props) {
|
|
|
204
208
|
}
|
|
205
209
|
);
|
|
206
210
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
207
|
-
return /* @__PURE__ */ (0,
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
208
212
|
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
|
|
209
213
|
});
|
|
210
214
|
else
|
|
@@ -212,40 +216,40 @@ function DescriptionItemContent(props) {
|
|
|
212
216
|
if (computedProps.item.children)
|
|
213
217
|
return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
|
|
214
218
|
if (computedProps.item.render)
|
|
215
|
-
return /* @__PURE__ */ (0,
|
|
219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
216
220
|
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
217
221
|
});
|
|
218
222
|
if (typeof computedProps.value === "undefined" || computedProps.value === null)
|
|
219
|
-
return
|
|
223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blank, {});
|
|
220
224
|
switch (computedProps.item.type) {
|
|
221
225
|
case "string[]":
|
|
222
|
-
return /* @__PURE__ */ (0,
|
|
226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
223
227
|
children: computedProps.value.join(", ")
|
|
224
228
|
});
|
|
225
229
|
case "number":
|
|
226
230
|
return computedProps.value || null;
|
|
227
231
|
case "number[]":
|
|
228
|
-
return /* @__PURE__ */ (0,
|
|
232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
229
233
|
children: computedProps.value.join(", ")
|
|
230
234
|
});
|
|
231
235
|
case "boolean":
|
|
232
|
-
return computedProps.value ? /* @__PURE__ */ (0,
|
|
236
|
+
return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CheckOutlined, {
|
|
233
237
|
style: {
|
|
234
238
|
marginTop: "4px",
|
|
235
239
|
color: "#52c41a"
|
|
236
240
|
}
|
|
237
|
-
}) : /* @__PURE__ */ (0,
|
|
241
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.CloseOutlined, {
|
|
238
242
|
style: {
|
|
239
243
|
marginTop: "4px",
|
|
240
244
|
color: "#ff4d4f"
|
|
241
245
|
}
|
|
242
246
|
});
|
|
243
247
|
case "time":
|
|
244
|
-
return /* @__PURE__ */ (0,
|
|
248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
245
249
|
children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD HH:mm:ss") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD HH:mm:ss")
|
|
246
250
|
});
|
|
247
251
|
case "date":
|
|
248
|
-
return /* @__PURE__ */ (0,
|
|
252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {
|
|
249
253
|
children: typeof computedProps.value === "number" && computedProps.value.toString().length === 10 ? import_dayjs3.default.unix(computedProps.value).format("YYYY-MM-DD") : (0, import_dayjs3.default)(computedProps.value).format("YYYY-MM-DD")
|
|
250
254
|
});
|
|
251
255
|
default:
|
|
@@ -254,33 +258,39 @@ function DescriptionItemContent(props) {
|
|
|
254
258
|
}
|
|
255
259
|
function Description(props) {
|
|
256
260
|
if (!props.faasData)
|
|
257
|
-
return /* @__PURE__ */ (0,
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_antd3.Descriptions, {
|
|
258
262
|
...props,
|
|
259
|
-
children:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
children: [
|
|
264
|
+
props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
265
|
+
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
266
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
267
|
+
item,
|
|
268
|
+
value: props.dataSource[item.id],
|
|
269
|
+
values: props.dataSource,
|
|
270
|
+
extendTypes: props.extendTypes
|
|
271
|
+
})
|
|
272
|
+
}, item.id)),
|
|
273
|
+
props.footer && props.footer(props.dataSource)
|
|
274
|
+
]
|
|
268
275
|
});
|
|
269
|
-
return /* @__PURE__ */ (0,
|
|
270
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0,
|
|
276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.FaasDataWrapper, {
|
|
277
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Skeleton, {
|
|
271
278
|
active: true
|
|
272
279
|
}),
|
|
273
|
-
render: ({ data }) => /* @__PURE__ */ (0,
|
|
280
|
+
render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_antd3.Descriptions, {
|
|
274
281
|
...props,
|
|
275
|
-
children:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
children: [
|
|
283
|
+
props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
284
|
+
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
286
|
+
item,
|
|
287
|
+
value: data[item.id],
|
|
288
|
+
values: data,
|
|
289
|
+
extendTypes: props.extendTypes
|
|
290
|
+
})
|
|
291
|
+
}, item.id)),
|
|
292
|
+
props.footer && props.footer(data)
|
|
293
|
+
]
|
|
284
294
|
}),
|
|
285
295
|
...props.faasData
|
|
286
296
|
});
|
|
@@ -289,7 +299,7 @@ function Description(props) {
|
|
|
289
299
|
// src/Drawer.tsx
|
|
290
300
|
var import_antd4 = require("antd");
|
|
291
301
|
var import_react5 = require("react");
|
|
292
|
-
var
|
|
302
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
293
303
|
function useDrawer(init) {
|
|
294
304
|
const [props, setProps] = (0, import_react5.useState)({
|
|
295
305
|
open: false,
|
|
@@ -300,7 +310,7 @@ function useDrawer(init) {
|
|
|
300
310
|
...init
|
|
301
311
|
});
|
|
302
312
|
return {
|
|
303
|
-
drawer: /* @__PURE__ */ (0,
|
|
313
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Drawer, {
|
|
304
314
|
...props
|
|
305
315
|
}),
|
|
306
316
|
drawerProps: props,
|
|
@@ -326,9 +336,9 @@ var import_lodash5 = require("lodash");
|
|
|
326
336
|
|
|
327
337
|
// src/TimePicker.tsx
|
|
328
338
|
var import_react6 = require("react");
|
|
329
|
-
var
|
|
339
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
330
340
|
var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
|
|
331
|
-
return /* @__PURE__ */ (0,
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DatePicker, {
|
|
332
342
|
...props,
|
|
333
343
|
picker: "time",
|
|
334
344
|
mode: void 0,
|
|
@@ -339,7 +349,7 @@ TimePicker.displayName = "TimePicker";
|
|
|
339
349
|
|
|
340
350
|
// src/FormItem.tsx
|
|
341
351
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
342
|
-
var
|
|
352
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
343
353
|
function processProps(propsCopy, config) {
|
|
344
354
|
if (!propsCopy.title)
|
|
345
355
|
propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
|
|
@@ -391,7 +401,7 @@ function DateItem(options) {
|
|
|
391
401
|
(0, import_react7.useEffect)(() => {
|
|
392
402
|
setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
|
|
393
403
|
}, [options.value]);
|
|
394
|
-
return /* @__PURE__ */ (0,
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DatePicker, {
|
|
395
405
|
...options,
|
|
396
406
|
value
|
|
397
407
|
});
|
|
@@ -401,7 +411,7 @@ function TimeItem(options) {
|
|
|
401
411
|
(0, import_react7.useEffect)(() => {
|
|
402
412
|
setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
|
|
403
413
|
}, [options.value]);
|
|
404
|
-
return /* @__PURE__ */ (0,
|
|
414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimePicker, {
|
|
405
415
|
...options,
|
|
406
416
|
value
|
|
407
417
|
});
|
|
@@ -422,77 +432,77 @@ function FormItem(props) {
|
|
|
422
432
|
if (!computedProps)
|
|
423
433
|
return null;
|
|
424
434
|
if (extendTypes && extendTypes[computedProps.type])
|
|
425
|
-
return /* @__PURE__ */ (0,
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
426
436
|
...computedProps,
|
|
427
437
|
children: extendTypes[computedProps.type].children
|
|
428
438
|
});
|
|
429
439
|
if (computedProps.children)
|
|
430
|
-
return /* @__PURE__ */ (0,
|
|
440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
431
441
|
...computedProps,
|
|
432
442
|
children: computedProps.children
|
|
433
443
|
});
|
|
434
444
|
if (computedProps.render)
|
|
435
|
-
return /* @__PURE__ */ (0,
|
|
445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
436
446
|
...computedProps,
|
|
437
447
|
children: computedProps.render()
|
|
438
448
|
});
|
|
439
449
|
switch (computedProps.type) {
|
|
440
450
|
case "string":
|
|
441
|
-
return /* @__PURE__ */ (0,
|
|
451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
442
452
|
...computedProps,
|
|
443
|
-
children: computedProps.options ? /* @__PURE__ */ (0,
|
|
453
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
444
454
|
...computedProps.input
|
|
445
|
-
}) : /* @__PURE__ */ (0,
|
|
455
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
|
|
446
456
|
...computedProps.input
|
|
447
457
|
})
|
|
448
458
|
});
|
|
449
459
|
case "string[]":
|
|
450
460
|
if (computedProps.options)
|
|
451
|
-
return /* @__PURE__ */ (0,
|
|
461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
452
462
|
...computedProps,
|
|
453
|
-
children: /* @__PURE__ */ (0,
|
|
463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
454
464
|
mode: "multiple",
|
|
455
465
|
...computedProps.input
|
|
456
466
|
})
|
|
457
467
|
});
|
|
458
|
-
return /* @__PURE__ */ (0,
|
|
468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
|
|
459
469
|
name: computedProps.name,
|
|
460
470
|
rules: computedProps.rules,
|
|
461
471
|
children: (fields, { add, remove }, { errors }) => {
|
|
462
472
|
var _a2;
|
|
463
|
-
return /* @__PURE__ */ (0,
|
|
473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
464
474
|
children: [
|
|
465
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
475
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
466
476
|
className: "ant-form-item-label",
|
|
467
|
-
children: /* @__PURE__ */ (0,
|
|
477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
|
|
468
478
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
469
479
|
children: computedProps.label
|
|
470
480
|
})
|
|
471
481
|
}),
|
|
472
482
|
fields.map((field) => {
|
|
473
483
|
var _a3;
|
|
474
|
-
return /* @__PURE__ */ (0,
|
|
475
|
-
children: /* @__PURE__ */ (0,
|
|
484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
|
|
476
486
|
gutter: 24,
|
|
477
487
|
style: { flexFlow: "row nowrap" },
|
|
478
488
|
children: [
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
480
490
|
span: 23,
|
|
481
|
-
children: /* @__PURE__ */ (0,
|
|
491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
482
492
|
...field,
|
|
483
493
|
noStyle: true,
|
|
484
|
-
children: /* @__PURE__ */ (0,
|
|
494
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
|
|
485
495
|
...computedProps.input
|
|
486
496
|
})
|
|
487
497
|
})
|
|
488
498
|
}),
|
|
489
|
-
/* @__PURE__ */ (0,
|
|
499
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
490
500
|
span: 1,
|
|
491
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
501
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
492
502
|
danger: true,
|
|
493
503
|
type: "link",
|
|
494
504
|
style: { float: "right" },
|
|
495
|
-
icon: /* @__PURE__ */ (0,
|
|
505
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
496
506
|
onClick: () => remove(field.name)
|
|
497
507
|
})
|
|
498
508
|
})
|
|
@@ -500,15 +510,15 @@ function FormItem(props) {
|
|
|
500
510
|
})
|
|
501
511
|
}, field.key);
|
|
502
512
|
}),
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
513
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
504
514
|
children: [
|
|
505
|
-
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
515
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
506
516
|
type: "dashed",
|
|
507
517
|
block: true,
|
|
508
518
|
onClick: () => add(),
|
|
509
|
-
icon: /* @__PURE__ */ (0,
|
|
519
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
|
|
510
520
|
}),
|
|
511
|
-
/* @__PURE__ */ (0,
|
|
521
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
|
|
512
522
|
errors
|
|
513
523
|
})
|
|
514
524
|
]
|
|
@@ -518,63 +528,63 @@ function FormItem(props) {
|
|
|
518
528
|
}
|
|
519
529
|
});
|
|
520
530
|
case "number":
|
|
521
|
-
return /* @__PURE__ */ (0,
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
522
532
|
...computedProps,
|
|
523
|
-
children: computedProps.options ? /* @__PURE__ */ (0,
|
|
533
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
524
534
|
...computedProps.input
|
|
525
|
-
}) : /* @__PURE__ */ (0,
|
|
535
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, {
|
|
526
536
|
style: { width: "100%" },
|
|
527
537
|
...computedProps.input
|
|
528
538
|
})
|
|
529
539
|
});
|
|
530
540
|
case "number[]":
|
|
531
541
|
if (computedProps.options)
|
|
532
|
-
return /* @__PURE__ */ (0,
|
|
542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
533
543
|
...computedProps,
|
|
534
|
-
children: /* @__PURE__ */ (0,
|
|
544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
535
545
|
mode: "multiple",
|
|
536
546
|
...computedProps.input
|
|
537
547
|
})
|
|
538
548
|
});
|
|
539
|
-
return /* @__PURE__ */ (0,
|
|
549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
|
|
540
550
|
name: computedProps.name,
|
|
541
551
|
rules: computedProps.rules,
|
|
542
552
|
children: (fields, { add, remove }, { errors }) => {
|
|
543
553
|
var _a2, _b;
|
|
544
|
-
return /* @__PURE__ */ (0,
|
|
554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
545
555
|
children: [
|
|
546
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
556
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
547
557
|
className: "ant-form-item-label",
|
|
548
|
-
children: /* @__PURE__ */ (0,
|
|
558
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
|
|
549
559
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
550
560
|
children: computedProps.label
|
|
551
561
|
})
|
|
552
562
|
}),
|
|
553
563
|
fields.map((field) => {
|
|
554
564
|
var _a3;
|
|
555
|
-
return /* @__PURE__ */ (0,
|
|
556
|
-
children: /* @__PURE__ */ (0,
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
|
|
557
567
|
gutter: 24,
|
|
558
568
|
style: { flexFlow: "row nowrap" },
|
|
559
569
|
children: [
|
|
560
|
-
/* @__PURE__ */ (0,
|
|
570
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
561
571
|
span: 23,
|
|
562
|
-
children: /* @__PURE__ */ (0,
|
|
572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
563
573
|
...field,
|
|
564
574
|
noStyle: true,
|
|
565
|
-
children: /* @__PURE__ */ (0,
|
|
575
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, {
|
|
566
576
|
style: { width: "100%" },
|
|
567
577
|
...computedProps.input
|
|
568
578
|
})
|
|
569
579
|
})
|
|
570
580
|
}),
|
|
571
|
-
/* @__PURE__ */ (0,
|
|
581
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
572
582
|
span: 1,
|
|
573
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
583
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
574
584
|
danger: true,
|
|
575
585
|
type: "link",
|
|
576
586
|
style: { float: "right" },
|
|
577
|
-
icon: /* @__PURE__ */ (0,
|
|
587
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
578
588
|
onClick: () => remove(field.name)
|
|
579
589
|
})
|
|
580
590
|
})
|
|
@@ -582,15 +592,15 @@ function FormItem(props) {
|
|
|
582
592
|
})
|
|
583
593
|
}, field.key);
|
|
584
594
|
}),
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
586
596
|
children: [
|
|
587
|
-
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
597
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
588
598
|
type: "dashed",
|
|
589
599
|
block: true,
|
|
590
600
|
onClick: () => add(),
|
|
591
|
-
icon: /* @__PURE__ */ (0,
|
|
601
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
|
|
592
602
|
}),
|
|
593
|
-
/* @__PURE__ */ (0,
|
|
603
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
|
|
594
604
|
errors
|
|
595
605
|
})
|
|
596
606
|
]
|
|
@@ -600,58 +610,58 @@ function FormItem(props) {
|
|
|
600
610
|
}
|
|
601
611
|
});
|
|
602
612
|
case "boolean":
|
|
603
|
-
return /* @__PURE__ */ (0,
|
|
613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
604
614
|
...computedProps,
|
|
605
|
-
children: /* @__PURE__ */ (0,
|
|
615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Switch, {
|
|
606
616
|
...computedProps.input
|
|
607
617
|
})
|
|
608
618
|
});
|
|
609
619
|
case "date":
|
|
610
|
-
return /* @__PURE__ */ (0,
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
611
621
|
...computedProps,
|
|
612
|
-
children: /* @__PURE__ */ (0,
|
|
622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DateItem, {
|
|
613
623
|
...computedProps.input
|
|
614
624
|
})
|
|
615
625
|
});
|
|
616
626
|
case "time":
|
|
617
|
-
return /* @__PURE__ */ (0,
|
|
627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
618
628
|
...computedProps,
|
|
619
|
-
children: /* @__PURE__ */ (0,
|
|
629
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimeItem, {
|
|
620
630
|
...computedProps.input
|
|
621
631
|
})
|
|
622
632
|
});
|
|
623
633
|
case "object":
|
|
624
|
-
return /* @__PURE__ */ (0,
|
|
634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
625
635
|
children: [
|
|
626
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
636
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
627
637
|
className: "ant-form-item-label",
|
|
628
|
-
children: /* @__PURE__ */ (0,
|
|
638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
|
|
629
639
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
630
640
|
children: computedProps.label
|
|
631
641
|
})
|
|
632
642
|
}),
|
|
633
|
-
computedProps.object.map((o) => /* @__PURE__ */ (0,
|
|
643
|
+
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, {
|
|
634
644
|
...o
|
|
635
645
|
}, o.id))
|
|
636
646
|
]
|
|
637
647
|
});
|
|
638
648
|
case "object[]":
|
|
639
|
-
return /* @__PURE__ */ (0,
|
|
649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
|
|
640
650
|
name: computedProps.name,
|
|
641
651
|
rules: computedProps.rules,
|
|
642
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0,
|
|
652
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
643
653
|
children: [
|
|
644
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
654
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
645
655
|
style: { marginBottom: 0 },
|
|
646
656
|
children: [
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
648
658
|
className: "ant-form-item-label",
|
|
649
|
-
children: /* @__PURE__ */ (0,
|
|
659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", {
|
|
650
660
|
children: [
|
|
651
661
|
computedProps.label,
|
|
652
662
|
" ",
|
|
653
663
|
field.name + 1,
|
|
654
|
-
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
664
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
655
665
|
danger: true,
|
|
656
666
|
type: "link",
|
|
657
667
|
onClick: () => remove(field.name),
|
|
@@ -660,11 +670,11 @@ function FormItem(props) {
|
|
|
660
670
|
]
|
|
661
671
|
})
|
|
662
672
|
}),
|
|
663
|
-
/* @__PURE__ */ (0,
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Row, {
|
|
664
674
|
gutter: 24,
|
|
665
|
-
children: computedProps.object.map((o) => /* @__PURE__ */ (0,
|
|
675
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
666
676
|
span: o.col || 6,
|
|
667
|
-
children: /* @__PURE__ */ (0,
|
|
677
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, {
|
|
668
678
|
...o,
|
|
669
679
|
name: [field.name, o.id]
|
|
670
680
|
})
|
|
@@ -672,20 +682,20 @@ function FormItem(props) {
|
|
|
672
682
|
})
|
|
673
683
|
]
|
|
674
684
|
}, field.key)),
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
685
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
676
686
|
children: [
|
|
677
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
687
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Button, {
|
|
678
688
|
type: "dashed",
|
|
679
689
|
block: true,
|
|
680
690
|
onClick: () => add(),
|
|
681
|
-
icon: /* @__PURE__ */ (0,
|
|
691
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {}),
|
|
682
692
|
children: [
|
|
683
693
|
config.common.add,
|
|
684
694
|
" ",
|
|
685
695
|
computedProps.label
|
|
686
696
|
]
|
|
687
697
|
}),
|
|
688
|
-
/* @__PURE__ */ (0,
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
|
|
689
699
|
errors
|
|
690
700
|
})
|
|
691
701
|
]
|
|
@@ -699,7 +709,7 @@ function FormItem(props) {
|
|
|
699
709
|
}
|
|
700
710
|
|
|
701
711
|
// src/Form.tsx
|
|
702
|
-
var
|
|
712
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
703
713
|
function Form(props) {
|
|
704
714
|
var _a, _b;
|
|
705
715
|
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
@@ -743,16 +753,16 @@ function Form(props) {
|
|
|
743
753
|
}, []);
|
|
744
754
|
if (!computedProps)
|
|
745
755
|
return null;
|
|
746
|
-
return /* @__PURE__ */ (0,
|
|
756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd6.Form, {
|
|
747
757
|
...computedProps,
|
|
748
758
|
children: [
|
|
749
759
|
computedProps.beforeItems,
|
|
750
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0,
|
|
760
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FormItem, {
|
|
751
761
|
...item,
|
|
752
762
|
extendTypes
|
|
753
763
|
}, item.id)),
|
|
754
764
|
computedProps.children,
|
|
755
|
-
computedProps.submit !== false && /* @__PURE__ */ (0,
|
|
765
|
+
computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_antd6.Button, {
|
|
756
766
|
htmlType: "submit",
|
|
757
767
|
type: "primary",
|
|
758
768
|
loading,
|
|
@@ -768,7 +778,7 @@ Form.Item = FormItem;
|
|
|
768
778
|
// src/Link.tsx
|
|
769
779
|
var import_react_router_dom = require("react-router-dom");
|
|
770
780
|
var import_antd7 = require("antd");
|
|
771
|
-
var
|
|
781
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
772
782
|
function Link({
|
|
773
783
|
href,
|
|
774
784
|
target,
|
|
@@ -781,9 +791,9 @@ function Link({
|
|
|
781
791
|
style = Object.assign({ cursor: "pointer" }, style);
|
|
782
792
|
if (href.startsWith("http")) {
|
|
783
793
|
if (button)
|
|
784
|
-
return /* @__PURE__ */ (0,
|
|
794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, {
|
|
785
795
|
...button,
|
|
786
|
-
children: /* @__PURE__ */ (0,
|
|
796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
|
|
787
797
|
href,
|
|
788
798
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
789
799
|
style: {
|
|
@@ -793,7 +803,7 @@ function Link({
|
|
|
793
803
|
children: text || children
|
|
794
804
|
})
|
|
795
805
|
});
|
|
796
|
-
return /* @__PURE__ */ (0,
|
|
806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
|
|
797
807
|
href,
|
|
798
808
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
799
809
|
style: {
|
|
@@ -804,9 +814,9 @@ function Link({
|
|
|
804
814
|
});
|
|
805
815
|
}
|
|
806
816
|
if (button)
|
|
807
|
-
return /* @__PURE__ */ (0,
|
|
817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, {
|
|
808
818
|
...button,
|
|
809
|
-
children: /* @__PURE__ */ (0,
|
|
819
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
|
|
810
820
|
to: href,
|
|
811
821
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
812
822
|
style: {
|
|
@@ -816,7 +826,7 @@ function Link({
|
|
|
816
826
|
children: text || children
|
|
817
827
|
})
|
|
818
828
|
});
|
|
819
|
-
return /* @__PURE__ */ (0,
|
|
829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
|
|
820
830
|
to: href,
|
|
821
831
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
822
832
|
style: {
|
|
@@ -830,7 +840,7 @@ function Link({
|
|
|
830
840
|
// src/Modal.tsx
|
|
831
841
|
var import_antd8 = require("antd");
|
|
832
842
|
var import_react10 = require("react");
|
|
833
|
-
var
|
|
843
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
834
844
|
function useModal(init) {
|
|
835
845
|
const [props, setProps] = (0, import_react10.useState)({
|
|
836
846
|
open: false,
|
|
@@ -841,7 +851,7 @@ function useModal(init) {
|
|
|
841
851
|
...init
|
|
842
852
|
});
|
|
843
853
|
return {
|
|
844
|
-
modal: /* @__PURE__ */ (0,
|
|
854
|
+
modal: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd8.Modal, {
|
|
845
855
|
...props
|
|
846
856
|
}),
|
|
847
857
|
modalProps: props,
|
|
@@ -858,32 +868,32 @@ function useModal(init) {
|
|
|
858
868
|
var import_antd9 = require("antd");
|
|
859
869
|
var import_react11 = require("react");
|
|
860
870
|
var import_react_router_dom2 = require("react-router-dom");
|
|
861
|
-
var
|
|
871
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
862
872
|
function PageNotFound() {
|
|
863
873
|
const config = useConfigContext();
|
|
864
|
-
return /* @__PURE__ */ (0,
|
|
874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Result, {
|
|
865
875
|
status: "404",
|
|
866
876
|
title: config.common.pageNotFound
|
|
867
877
|
});
|
|
868
878
|
}
|
|
869
879
|
function Routes(props) {
|
|
870
|
-
return /* @__PURE__ */ (0,
|
|
880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_router_dom2.Routes, {
|
|
871
881
|
children: [
|
|
872
|
-
props.routes.map((r) => /* @__PURE__ */ (0,
|
|
882
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
|
|
873
883
|
...r,
|
|
874
|
-
element: r.element || /* @__PURE__ */ (0,
|
|
875
|
-
fallback: props.fallback || /* @__PURE__ */ (0,
|
|
884
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.Suspense, {
|
|
885
|
+
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
|
|
876
886
|
style: { padding: "24px" },
|
|
877
|
-
children: /* @__PURE__ */ (0,
|
|
887
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Skeleton, {
|
|
878
888
|
active: true
|
|
879
889
|
})
|
|
880
890
|
}),
|
|
881
|
-
children: /* @__PURE__ */ (0,
|
|
891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(r.page, {})
|
|
882
892
|
})
|
|
883
893
|
}, r.path)),
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
894
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
|
|
885
895
|
path: "*",
|
|
886
|
-
element: props.notFound || /* @__PURE__ */ (0,
|
|
896
|
+
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageNotFound, {})
|
|
887
897
|
}, "*")
|
|
888
898
|
]
|
|
889
899
|
});
|
|
@@ -896,39 +906,34 @@ var import_dayjs5 = __toESM(require("dayjs"));
|
|
|
896
906
|
var import_icons3 = require("@ant-design/icons");
|
|
897
907
|
var import_lodash6 = require("lodash");
|
|
898
908
|
var import_react13 = require("@faasjs/react");
|
|
899
|
-
var
|
|
909
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
900
910
|
function processValue(item, value) {
|
|
901
911
|
var _a;
|
|
902
|
-
if (typeof value
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
if (["date", "time"].includes(item.type)) {
|
|
922
|
-
if (typeof value === "number" && value.toString().length === 10)
|
|
923
|
-
value = value * 1e3;
|
|
924
|
-
value = (0, import_dayjs5.default)(value).format(dayjsFormat);
|
|
925
|
-
}
|
|
912
|
+
if (typeof value === "undefined" && value === null)
|
|
913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {});
|
|
914
|
+
if (item.options) {
|
|
915
|
+
if (item.type.endsWith("[]"))
|
|
916
|
+
return value.map((v) => {
|
|
917
|
+
var _a2;
|
|
918
|
+
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
919
|
+
});
|
|
920
|
+
else if ([
|
|
921
|
+
"string",
|
|
922
|
+
"number",
|
|
923
|
+
"boolean"
|
|
924
|
+
].includes(item.type))
|
|
925
|
+
return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
|
|
926
|
+
}
|
|
927
|
+
if (["date", "time"].includes(item.type)) {
|
|
928
|
+
if (typeof value === "number" && value.toString().length === 10)
|
|
929
|
+
value = value * 1e3;
|
|
930
|
+
return (0, import_dayjs5.default)(value).format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
|
|
926
931
|
}
|
|
927
932
|
return value;
|
|
928
933
|
}
|
|
929
934
|
function Table(props) {
|
|
930
935
|
const [columns, setColumns] = (0, import_react12.useState)();
|
|
931
|
-
const
|
|
936
|
+
const { common: common2 } = useConfigContext();
|
|
932
937
|
(0, import_react12.useEffect)(() => {
|
|
933
938
|
var _a;
|
|
934
939
|
for (const item of props.items) {
|
|
@@ -947,8 +952,6 @@ function Table(props) {
|
|
|
947
952
|
value: o.value
|
|
948
953
|
}));
|
|
949
954
|
}
|
|
950
|
-
if (item.render)
|
|
951
|
-
continue;
|
|
952
955
|
if (item.children)
|
|
953
956
|
delete item.children;
|
|
954
957
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
@@ -968,81 +971,131 @@ function Table(props) {
|
|
|
968
971
|
}
|
|
969
972
|
switch (item.type) {
|
|
970
973
|
case "string":
|
|
971
|
-
item.render
|
|
974
|
+
if (!item.render)
|
|
975
|
+
item.render = (value) => processValue(item, value);
|
|
972
976
|
if (!item.onFilter) {
|
|
973
977
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
974
|
-
if (item.filterDropdown !== false)
|
|
975
|
-
item.filterDropdown = ({
|
|
976
|
-
setSelectedKeys,
|
|
977
|
-
selectedKeys,
|
|
978
|
-
confirm,
|
|
979
|
-
clearFilters
|
|
980
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
981
|
-
style: { padding: 8 },
|
|
982
|
-
children: [
|
|
983
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
984
|
-
value: selectedKeys[0],
|
|
985
|
-
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
986
|
-
style: {
|
|
987
|
-
width: 188,
|
|
988
|
-
marginBottom: 8,
|
|
989
|
-
display: "block"
|
|
990
|
-
}
|
|
991
|
-
}),
|
|
992
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
993
|
-
type: "button",
|
|
994
|
-
onClick: () => confirm(),
|
|
995
|
-
style: {
|
|
996
|
-
width: 90,
|
|
997
|
-
marginRight: 8
|
|
998
|
-
},
|
|
999
|
-
children: "Search"
|
|
1000
|
-
}),
|
|
1001
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1002
|
-
type: "button",
|
|
1003
|
-
onClick: () => clearFilters(),
|
|
1004
|
-
style: { width: 90 },
|
|
1005
|
-
children: "Reset"
|
|
1006
|
-
})
|
|
1007
|
-
]
|
|
1008
|
-
});
|
|
1009
978
|
}
|
|
979
|
+
if (!item.filters && item.filterDropdown !== false && item.optionsType !== "auto")
|
|
980
|
+
item.filterDropdown = ({
|
|
981
|
+
setSelectedKeys,
|
|
982
|
+
selectedKeys,
|
|
983
|
+
confirm,
|
|
984
|
+
clearFilters
|
|
985
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
|
|
986
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
987
|
+
value: selectedKeys[0],
|
|
988
|
+
allowClear: true,
|
|
989
|
+
onSearch: (v) => {
|
|
990
|
+
if (v) {
|
|
991
|
+
setSelectedKeys([v]);
|
|
992
|
+
} else {
|
|
993
|
+
setSelectedKeys([]);
|
|
994
|
+
clearFilters();
|
|
995
|
+
}
|
|
996
|
+
confirm();
|
|
997
|
+
}
|
|
998
|
+
});
|
|
1010
999
|
break;
|
|
1011
1000
|
case "string[]":
|
|
1012
|
-
|
|
1001
|
+
if (!item.render)
|
|
1002
|
+
item.render = (value) => processValue(item, value).join(", ");
|
|
1013
1003
|
if (!item.onFilter)
|
|
1014
1004
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
1005
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1006
|
+
item.filterDropdown = ({
|
|
1007
|
+
setSelectedKeys,
|
|
1008
|
+
selectedKeys,
|
|
1009
|
+
confirm,
|
|
1010
|
+
clearFilters
|
|
1011
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
|
|
1012
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1013
|
+
value: selectedKeys[0],
|
|
1014
|
+
allowClear: true,
|
|
1015
|
+
onSearch: (v) => {
|
|
1016
|
+
if (v) {
|
|
1017
|
+
setSelectedKeys([v]);
|
|
1018
|
+
} else {
|
|
1019
|
+
setSelectedKeys([]);
|
|
1020
|
+
clearFilters();
|
|
1021
|
+
}
|
|
1022
|
+
confirm();
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1015
1025
|
break;
|
|
1016
1026
|
case "number":
|
|
1017
|
-
item.render
|
|
1027
|
+
if (!item.render)
|
|
1028
|
+
item.render = (value) => processValue(item, value);
|
|
1018
1029
|
if (!item.sorter)
|
|
1019
1030
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
1020
1031
|
if (!item.onFilter)
|
|
1021
1032
|
item.onFilter = (value, row) => value === row[item.id];
|
|
1033
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1034
|
+
item.filterDropdown = ({
|
|
1035
|
+
setSelectedKeys,
|
|
1036
|
+
selectedKeys,
|
|
1037
|
+
confirm,
|
|
1038
|
+
clearFilters
|
|
1039
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
|
|
1040
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1041
|
+
value: selectedKeys[0],
|
|
1042
|
+
allowClear: true,
|
|
1043
|
+
onSearch: (v) => {
|
|
1044
|
+
if (v) {
|
|
1045
|
+
setSelectedKeys([v]);
|
|
1046
|
+
} else {
|
|
1047
|
+
setSelectedKeys([]);
|
|
1048
|
+
clearFilters();
|
|
1049
|
+
}
|
|
1050
|
+
confirm();
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1022
1053
|
break;
|
|
1023
1054
|
case "number[]":
|
|
1024
|
-
|
|
1055
|
+
if (!item.render)
|
|
1056
|
+
item.render = (value) => processValue(item, value).join(", ");
|
|
1025
1057
|
if (!item.onFilter)
|
|
1026
1058
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
1059
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1060
|
+
item.filterDropdown = ({
|
|
1061
|
+
setSelectedKeys,
|
|
1062
|
+
selectedKeys,
|
|
1063
|
+
confirm,
|
|
1064
|
+
clearFilters
|
|
1065
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Input.Search, {
|
|
1066
|
+
placeholder: `${common2.search} ${item.title}`,
|
|
1067
|
+
value: selectedKeys[0],
|
|
1068
|
+
allowClear: true,
|
|
1069
|
+
onSearch: (v) => {
|
|
1070
|
+
if (v) {
|
|
1071
|
+
setSelectedKeys([v]);
|
|
1072
|
+
} else {
|
|
1073
|
+
setSelectedKeys([]);
|
|
1074
|
+
clearFilters();
|
|
1075
|
+
}
|
|
1076
|
+
confirm();
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1027
1079
|
break;
|
|
1028
1080
|
case "boolean":
|
|
1029
|
-
item.render
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1081
|
+
if (!item.render)
|
|
1082
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
|
|
1083
|
+
style: {
|
|
1084
|
+
marginTop: "4px",
|
|
1085
|
+
color: "#52c41a"
|
|
1086
|
+
}
|
|
1087
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
|
|
1088
|
+
style: {
|
|
1089
|
+
marginTop: "4px",
|
|
1090
|
+
color: "#ff4d4f"
|
|
1091
|
+
}
|
|
1092
|
+
});
|
|
1040
1093
|
if (item.filterDropdown !== false)
|
|
1041
1094
|
item.filterDropdown = ({
|
|
1042
1095
|
setSelectedKeys,
|
|
1043
1096
|
selectedKeys,
|
|
1044
1097
|
confirm
|
|
1045
|
-
}) => /* @__PURE__ */ (0,
|
|
1098
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd10.Radio.Group, {
|
|
1046
1099
|
style: { padding: 8 },
|
|
1047
1100
|
buttonStyle: "solid",
|
|
1048
1101
|
value: selectedKeys[0],
|
|
@@ -1051,30 +1104,30 @@ function Table(props) {
|
|
|
1051
1104
|
confirm();
|
|
1052
1105
|
},
|
|
1053
1106
|
children: [
|
|
1054
|
-
/* @__PURE__ */ (0,
|
|
1055
|
-
children:
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1108
|
+
children: common2.all
|
|
1056
1109
|
}),
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1058
1111
|
value: "true",
|
|
1059
|
-
children: /* @__PURE__ */ (0,
|
|
1112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
|
|
1060
1113
|
style: {
|
|
1061
1114
|
color: "#52c41a",
|
|
1062
1115
|
verticalAlign: "middle"
|
|
1063
1116
|
}
|
|
1064
1117
|
})
|
|
1065
1118
|
}),
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1067
1120
|
value: "false",
|
|
1068
|
-
children: /* @__PURE__ */ (0,
|
|
1121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
|
|
1069
1122
|
style: {
|
|
1070
1123
|
verticalAlign: "middle",
|
|
1071
1124
|
color: "#ff4d4f"
|
|
1072
1125
|
}
|
|
1073
1126
|
})
|
|
1074
1127
|
}),
|
|
1075
|
-
/* @__PURE__ */ (0,
|
|
1128
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1076
1129
|
value: "empty",
|
|
1077
|
-
children:
|
|
1130
|
+
children: common2.blank
|
|
1078
1131
|
})
|
|
1079
1132
|
]
|
|
1080
1133
|
});
|
|
@@ -1093,21 +1146,24 @@ function Table(props) {
|
|
|
1093
1146
|
};
|
|
1094
1147
|
break;
|
|
1095
1148
|
case "date":
|
|
1096
|
-
item.render
|
|
1149
|
+
if (!item.render)
|
|
1150
|
+
item.render = (value) => processValue(item, value);
|
|
1097
1151
|
if (!item.onFilter)
|
|
1098
1152
|
item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
|
|
1099
1153
|
if (!item.sorter)
|
|
1100
1154
|
item.sorter = (a, b) => (0, import_dayjs5.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1101
1155
|
break;
|
|
1102
1156
|
case "time":
|
|
1103
|
-
item.render
|
|
1157
|
+
if (!item.render)
|
|
1158
|
+
item.render = (value) => processValue(item, value);
|
|
1104
1159
|
if (!item.onFilter)
|
|
1105
1160
|
item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
|
|
1106
1161
|
if (!item.sorter)
|
|
1107
1162
|
item.sorter = (a, b) => (0, import_dayjs5.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1108
1163
|
break;
|
|
1109
1164
|
default:
|
|
1110
|
-
item.render
|
|
1165
|
+
if (!item.render)
|
|
1166
|
+
item.render = (value) => processValue(item, value);
|
|
1111
1167
|
if (!item.onFilter)
|
|
1112
1168
|
item.onFilter = (value, row) => value === row[item.id];
|
|
1113
1169
|
break;
|
|
@@ -1115,17 +1171,34 @@ function Table(props) {
|
|
|
1115
1171
|
}
|
|
1116
1172
|
setColumns(props.items);
|
|
1117
1173
|
}, [props.items]);
|
|
1174
|
+
(0, import_react12.useEffect)(() => {
|
|
1175
|
+
if (!props.dataSource || !columns)
|
|
1176
|
+
return;
|
|
1177
|
+
for (const column of columns) {
|
|
1178
|
+
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1179
|
+
setColumns((prev) => {
|
|
1180
|
+
const newColumns = [...prev];
|
|
1181
|
+
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1182
|
+
newColumns[index].filters = (0, import_lodash6.uniqBy)(props.dataSource, column.id).map((v) => ({
|
|
1183
|
+
text: v[column.id],
|
|
1184
|
+
value: v[column.id]
|
|
1185
|
+
}));
|
|
1186
|
+
return newColumns;
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}, [props.dataSource, columns]);
|
|
1118
1191
|
if (!columns)
|
|
1119
1192
|
return null;
|
|
1120
1193
|
if (!props.faasData)
|
|
1121
|
-
return /* @__PURE__ */ (0,
|
|
1194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1122
1195
|
...props,
|
|
1123
1196
|
rowKey: props.rowKey || "id",
|
|
1124
1197
|
columns,
|
|
1125
1198
|
dataSource: props.dataSource
|
|
1126
1199
|
});
|
|
1127
|
-
return /* @__PURE__ */ (0,
|
|
1128
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0,
|
|
1200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.FaasDataWrapper, {
|
|
1201
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Skeleton, {
|
|
1129
1202
|
active: true
|
|
1130
1203
|
}),
|
|
1131
1204
|
render: ({
|
|
@@ -1134,20 +1207,20 @@ function Table(props) {
|
|
|
1134
1207
|
reload
|
|
1135
1208
|
}) => {
|
|
1136
1209
|
if (!data)
|
|
1137
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1138
1211
|
...props,
|
|
1139
1212
|
rowKey: props.rowKey || "id",
|
|
1140
1213
|
columns,
|
|
1141
1214
|
dataSource: []
|
|
1142
1215
|
});
|
|
1143
1216
|
if (Array.isArray(data))
|
|
1144
|
-
return /* @__PURE__ */ (0,
|
|
1217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1145
1218
|
...props,
|
|
1146
1219
|
rowKey: props.rowKey || "id",
|
|
1147
1220
|
columns,
|
|
1148
1221
|
dataSource: data
|
|
1149
1222
|
});
|
|
1150
|
-
return /* @__PURE__ */ (0,
|
|
1223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1151
1224
|
...props,
|
|
1152
1225
|
rowKey: props.rowKey || "id",
|
|
1153
1226
|
columns,
|
|
@@ -1182,7 +1255,7 @@ function Table(props) {
|
|
|
1182
1255
|
|
|
1183
1256
|
// src/Title.tsx
|
|
1184
1257
|
var import_react14 = require("react");
|
|
1185
|
-
var
|
|
1258
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1186
1259
|
function Title(props) {
|
|
1187
1260
|
const config = useConfigContext();
|
|
1188
1261
|
(0, import_react14.useEffect)(() => {
|
|
@@ -1191,10 +1264,10 @@ function Title(props) {
|
|
|
1191
1264
|
}, []);
|
|
1192
1265
|
if (props.h1) {
|
|
1193
1266
|
if (typeof props.h1 === "boolean")
|
|
1194
|
-
return /* @__PURE__ */ (0,
|
|
1267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
|
|
1195
1268
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1196
1269
|
});
|
|
1197
|
-
return /* @__PURE__ */ (0,
|
|
1270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
|
|
1198
1271
|
className: props.h1.className,
|
|
1199
1272
|
style: props.h1.style,
|
|
1200
1273
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|