@faasjs/ant-design 0.0.2-beta.414 → 0.0.2-beta.416
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 +3 -0
- package/dist/index.js +347 -184
- package/dist/index.mjs +220 -52
- 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
223
|
return null;
|
|
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,11 +258,11 @@ 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.jsx)(import_antd3.Descriptions, {
|
|
258
262
|
...props,
|
|
259
|
-
children: props.items.map((item) => /* @__PURE__ */ (0,
|
|
263
|
+
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
260
264
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
261
|
-
children: /* @__PURE__ */ (0,
|
|
265
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
262
266
|
item,
|
|
263
267
|
value: props.dataSource[item.id],
|
|
264
268
|
values: props.dataSource,
|
|
@@ -266,15 +270,15 @@ function Description(props) {
|
|
|
266
270
|
})
|
|
267
271
|
}, item.id))
|
|
268
272
|
});
|
|
269
|
-
return /* @__PURE__ */ (0,
|
|
270
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0,
|
|
273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react4.FaasDataWrapper, {
|
|
274
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Skeleton, {
|
|
271
275
|
active: true
|
|
272
276
|
}),
|
|
273
|
-
render: ({ data }) => /* @__PURE__ */ (0,
|
|
277
|
+
render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions, {
|
|
274
278
|
...props,
|
|
275
|
-
children: props.items.map((item) => /* @__PURE__ */ (0,
|
|
279
|
+
children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Descriptions.Item, {
|
|
276
280
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
277
|
-
children: /* @__PURE__ */ (0,
|
|
281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DescriptionItemContent, {
|
|
278
282
|
item,
|
|
279
283
|
value: data[item.id],
|
|
280
284
|
values: data,
|
|
@@ -289,7 +293,7 @@ function Description(props) {
|
|
|
289
293
|
// src/Drawer.tsx
|
|
290
294
|
var import_antd4 = require("antd");
|
|
291
295
|
var import_react5 = require("react");
|
|
292
|
-
var
|
|
296
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
293
297
|
function useDrawer(init) {
|
|
294
298
|
const [props, setProps] = (0, import_react5.useState)({
|
|
295
299
|
open: false,
|
|
@@ -300,7 +304,7 @@ function useDrawer(init) {
|
|
|
300
304
|
...init
|
|
301
305
|
});
|
|
302
306
|
return {
|
|
303
|
-
drawer: /* @__PURE__ */ (0,
|
|
307
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Drawer, {
|
|
304
308
|
...props
|
|
305
309
|
}),
|
|
306
310
|
drawerProps: props,
|
|
@@ -326,9 +330,9 @@ var import_lodash5 = require("lodash");
|
|
|
326
330
|
|
|
327
331
|
// src/TimePicker.tsx
|
|
328
332
|
var import_react6 = require("react");
|
|
329
|
-
var
|
|
333
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
330
334
|
var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
|
|
331
|
-
return /* @__PURE__ */ (0,
|
|
335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(DatePicker, {
|
|
332
336
|
...props,
|
|
333
337
|
picker: "time",
|
|
334
338
|
mode: void 0,
|
|
@@ -339,7 +343,7 @@ TimePicker.displayName = "TimePicker";
|
|
|
339
343
|
|
|
340
344
|
// src/FormItem.tsx
|
|
341
345
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
342
|
-
var
|
|
346
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
343
347
|
function processProps(propsCopy, config) {
|
|
344
348
|
if (!propsCopy.title)
|
|
345
349
|
propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
|
|
@@ -391,7 +395,7 @@ function DateItem(options) {
|
|
|
391
395
|
(0, import_react7.useEffect)(() => {
|
|
392
396
|
setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
|
|
393
397
|
}, [options.value]);
|
|
394
|
-
return /* @__PURE__ */ (0,
|
|
398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DatePicker, {
|
|
395
399
|
...options,
|
|
396
400
|
value
|
|
397
401
|
});
|
|
@@ -401,7 +405,7 @@ function TimeItem(options) {
|
|
|
401
405
|
(0, import_react7.useEffect)(() => {
|
|
402
406
|
setValue(options.value && !(0, import_dayjs4.isDayjs)(options.value) ? (0, import_dayjs4.default)(options.value) : null);
|
|
403
407
|
}, [options.value]);
|
|
404
|
-
return /* @__PURE__ */ (0,
|
|
408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimePicker, {
|
|
405
409
|
...options,
|
|
406
410
|
value
|
|
407
411
|
});
|
|
@@ -422,77 +426,77 @@ function FormItem(props) {
|
|
|
422
426
|
if (!computedProps)
|
|
423
427
|
return null;
|
|
424
428
|
if (extendTypes && extendTypes[computedProps.type])
|
|
425
|
-
return /* @__PURE__ */ (0,
|
|
429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
426
430
|
...computedProps,
|
|
427
431
|
children: extendTypes[computedProps.type].children
|
|
428
432
|
});
|
|
429
433
|
if (computedProps.children)
|
|
430
|
-
return /* @__PURE__ */ (0,
|
|
434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
431
435
|
...computedProps,
|
|
432
436
|
children: computedProps.children
|
|
433
437
|
});
|
|
434
438
|
if (computedProps.render)
|
|
435
|
-
return /* @__PURE__ */ (0,
|
|
439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
436
440
|
...computedProps,
|
|
437
441
|
children: computedProps.render()
|
|
438
442
|
});
|
|
439
443
|
switch (computedProps.type) {
|
|
440
444
|
case "string":
|
|
441
|
-
return /* @__PURE__ */ (0,
|
|
445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
442
446
|
...computedProps,
|
|
443
|
-
children: computedProps.options ? /* @__PURE__ */ (0,
|
|
447
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
444
448
|
...computedProps.input
|
|
445
|
-
}) : /* @__PURE__ */ (0,
|
|
449
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
|
|
446
450
|
...computedProps.input
|
|
447
451
|
})
|
|
448
452
|
});
|
|
449
453
|
case "string[]":
|
|
450
454
|
if (computedProps.options)
|
|
451
|
-
return /* @__PURE__ */ (0,
|
|
455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
452
456
|
...computedProps,
|
|
453
|
-
children: /* @__PURE__ */ (0,
|
|
457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
454
458
|
mode: "multiple",
|
|
455
459
|
...computedProps.input
|
|
456
460
|
})
|
|
457
461
|
});
|
|
458
|
-
return /* @__PURE__ */ (0,
|
|
462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
|
|
459
463
|
name: computedProps.name,
|
|
460
464
|
rules: computedProps.rules,
|
|
461
465
|
children: (fields, { add, remove }, { errors }) => {
|
|
462
466
|
var _a2;
|
|
463
|
-
return /* @__PURE__ */ (0,
|
|
467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
464
468
|
children: [
|
|
465
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
469
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
466
470
|
className: "ant-form-item-label",
|
|
467
|
-
children: /* @__PURE__ */ (0,
|
|
471
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
|
|
468
472
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
469
473
|
children: computedProps.label
|
|
470
474
|
})
|
|
471
475
|
}),
|
|
472
476
|
fields.map((field) => {
|
|
473
477
|
var _a3;
|
|
474
|
-
return /* @__PURE__ */ (0,
|
|
475
|
-
children: /* @__PURE__ */ (0,
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
|
|
476
480
|
gutter: 24,
|
|
477
481
|
style: { flexFlow: "row nowrap" },
|
|
478
482
|
children: [
|
|
479
|
-
/* @__PURE__ */ (0,
|
|
483
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
480
484
|
span: 23,
|
|
481
|
-
children: /* @__PURE__ */ (0,
|
|
485
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
482
486
|
...field,
|
|
483
487
|
noStyle: true,
|
|
484
|
-
children: /* @__PURE__ */ (0,
|
|
488
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Input, {
|
|
485
489
|
...computedProps.input
|
|
486
490
|
})
|
|
487
491
|
})
|
|
488
492
|
}),
|
|
489
|
-
/* @__PURE__ */ (0,
|
|
493
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
490
494
|
span: 1,
|
|
491
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
495
|
+
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
496
|
danger: true,
|
|
493
497
|
type: "link",
|
|
494
498
|
style: { float: "right" },
|
|
495
|
-
icon: /* @__PURE__ */ (0,
|
|
499
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
496
500
|
onClick: () => remove(field.name)
|
|
497
501
|
})
|
|
498
502
|
})
|
|
@@ -500,15 +504,15 @@ function FormItem(props) {
|
|
|
500
504
|
})
|
|
501
505
|
}, field.key);
|
|
502
506
|
}),
|
|
503
|
-
/* @__PURE__ */ (0,
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
504
508
|
children: [
|
|
505
|
-
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
509
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
506
510
|
type: "dashed",
|
|
507
511
|
block: true,
|
|
508
512
|
onClick: () => add(),
|
|
509
|
-
icon: /* @__PURE__ */ (0,
|
|
513
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
|
|
510
514
|
}),
|
|
511
|
-
/* @__PURE__ */ (0,
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
|
|
512
516
|
errors
|
|
513
517
|
})
|
|
514
518
|
]
|
|
@@ -518,63 +522,63 @@ function FormItem(props) {
|
|
|
518
522
|
}
|
|
519
523
|
});
|
|
520
524
|
case "number":
|
|
521
|
-
return /* @__PURE__ */ (0,
|
|
525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
522
526
|
...computedProps,
|
|
523
|
-
children: computedProps.options ? /* @__PURE__ */ (0,
|
|
527
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
524
528
|
...computedProps.input
|
|
525
|
-
}) : /* @__PURE__ */ (0,
|
|
529
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, {
|
|
526
530
|
style: { width: "100%" },
|
|
527
531
|
...computedProps.input
|
|
528
532
|
})
|
|
529
533
|
});
|
|
530
534
|
case "number[]":
|
|
531
535
|
if (computedProps.options)
|
|
532
|
-
return /* @__PURE__ */ (0,
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
533
537
|
...computedProps,
|
|
534
|
-
children: /* @__PURE__ */ (0,
|
|
538
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Select, {
|
|
535
539
|
mode: "multiple",
|
|
536
540
|
...computedProps.input
|
|
537
541
|
})
|
|
538
542
|
});
|
|
539
|
-
return /* @__PURE__ */ (0,
|
|
543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
|
|
540
544
|
name: computedProps.name,
|
|
541
545
|
rules: computedProps.rules,
|
|
542
546
|
children: (fields, { add, remove }, { errors }) => {
|
|
543
547
|
var _a2, _b;
|
|
544
|
-
return /* @__PURE__ */ (0,
|
|
548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
545
549
|
children: [
|
|
546
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
550
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
547
551
|
className: "ant-form-item-label",
|
|
548
|
-
children: /* @__PURE__ */ (0,
|
|
552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
|
|
549
553
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
550
554
|
children: computedProps.label
|
|
551
555
|
})
|
|
552
556
|
}),
|
|
553
557
|
fields.map((field) => {
|
|
554
558
|
var _a3;
|
|
555
|
-
return /* @__PURE__ */ (0,
|
|
556
|
-
children: /* @__PURE__ */ (0,
|
|
559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
560
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Row, {
|
|
557
561
|
gutter: 24,
|
|
558
562
|
style: { flexFlow: "row nowrap" },
|
|
559
563
|
children: [
|
|
560
|
-
/* @__PURE__ */ (0,
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
561
565
|
span: 23,
|
|
562
|
-
children: /* @__PURE__ */ (0,
|
|
566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
563
567
|
...field,
|
|
564
568
|
noStyle: true,
|
|
565
|
-
children: /* @__PURE__ */ (0,
|
|
569
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.InputNumber, {
|
|
566
570
|
style: { width: "100%" },
|
|
567
571
|
...computedProps.input
|
|
568
572
|
})
|
|
569
573
|
})
|
|
570
574
|
}),
|
|
571
|
-
/* @__PURE__ */ (0,
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
572
576
|
span: 1,
|
|
573
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
577
|
+
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
578
|
danger: true,
|
|
575
579
|
type: "link",
|
|
576
580
|
style: { float: "right" },
|
|
577
|
-
icon: /* @__PURE__ */ (0,
|
|
581
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
578
582
|
onClick: () => remove(field.name)
|
|
579
583
|
})
|
|
580
584
|
})
|
|
@@ -582,15 +586,15 @@ function FormItem(props) {
|
|
|
582
586
|
})
|
|
583
587
|
}, field.key);
|
|
584
588
|
}),
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
586
590
|
children: [
|
|
587
|
-
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
591
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
588
592
|
type: "dashed",
|
|
589
593
|
block: true,
|
|
590
594
|
onClick: () => add(),
|
|
591
|
-
icon: /* @__PURE__ */ (0,
|
|
595
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {})
|
|
592
596
|
}),
|
|
593
|
-
/* @__PURE__ */ (0,
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
|
|
594
598
|
errors
|
|
595
599
|
})
|
|
596
600
|
]
|
|
@@ -600,58 +604,58 @@ function FormItem(props) {
|
|
|
600
604
|
}
|
|
601
605
|
});
|
|
602
606
|
case "boolean":
|
|
603
|
-
return /* @__PURE__ */ (0,
|
|
607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
604
608
|
...computedProps,
|
|
605
|
-
children: /* @__PURE__ */ (0,
|
|
609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Switch, {
|
|
606
610
|
...computedProps.input
|
|
607
611
|
})
|
|
608
612
|
});
|
|
609
613
|
case "date":
|
|
610
|
-
return /* @__PURE__ */ (0,
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
611
615
|
...computedProps,
|
|
612
|
-
children: /* @__PURE__ */ (0,
|
|
616
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DateItem, {
|
|
613
617
|
...computedProps.input
|
|
614
618
|
})
|
|
615
619
|
});
|
|
616
620
|
case "time":
|
|
617
|
-
return /* @__PURE__ */ (0,
|
|
621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.Item, {
|
|
618
622
|
...computedProps,
|
|
619
|
-
children: /* @__PURE__ */ (0,
|
|
623
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TimeItem, {
|
|
620
624
|
...computedProps.input
|
|
621
625
|
})
|
|
622
626
|
});
|
|
623
627
|
case "object":
|
|
624
|
-
return /* @__PURE__ */ (0,
|
|
628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
625
629
|
children: [
|
|
626
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
630
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
627
631
|
className: "ant-form-item-label",
|
|
628
|
-
children: /* @__PURE__ */ (0,
|
|
632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", {
|
|
629
633
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
630
634
|
children: computedProps.label
|
|
631
635
|
})
|
|
632
636
|
}),
|
|
633
|
-
computedProps.object.map((o) => /* @__PURE__ */ (0,
|
|
637
|
+
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, {
|
|
634
638
|
...o
|
|
635
639
|
}, o.id))
|
|
636
640
|
]
|
|
637
641
|
});
|
|
638
642
|
case "object[]":
|
|
639
|
-
return /* @__PURE__ */ (0,
|
|
643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.List, {
|
|
640
644
|
name: computedProps.name,
|
|
641
645
|
rules: computedProps.rules,
|
|
642
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0,
|
|
646
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
|
|
643
647
|
children: [
|
|
644
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
648
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
645
649
|
style: { marginBottom: 0 },
|
|
646
650
|
children: [
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
651
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", {
|
|
648
652
|
className: "ant-form-item-label",
|
|
649
|
-
children: /* @__PURE__ */ (0,
|
|
653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", {
|
|
650
654
|
children: [
|
|
651
655
|
computedProps.label,
|
|
652
656
|
" ",
|
|
653
657
|
field.name + 1,
|
|
654
|
-
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
658
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Button, {
|
|
655
659
|
danger: true,
|
|
656
660
|
type: "link",
|
|
657
661
|
onClick: () => remove(field.name),
|
|
@@ -660,11 +664,11 @@ function FormItem(props) {
|
|
|
660
664
|
]
|
|
661
665
|
})
|
|
662
666
|
}),
|
|
663
|
-
/* @__PURE__ */ (0,
|
|
667
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Row, {
|
|
664
668
|
gutter: 24,
|
|
665
|
-
children: computedProps.object.map((o) => /* @__PURE__ */ (0,
|
|
669
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Col, {
|
|
666
670
|
span: o.col || 6,
|
|
667
|
-
children: /* @__PURE__ */ (0,
|
|
671
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FormItem, {
|
|
668
672
|
...o,
|
|
669
673
|
name: [field.name, o.id]
|
|
670
674
|
})
|
|
@@ -672,20 +676,20 @@ function FormItem(props) {
|
|
|
672
676
|
})
|
|
673
677
|
]
|
|
674
678
|
}, field.key)),
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
679
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Form.Item, {
|
|
676
680
|
children: [
|
|
677
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
681
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_antd5.Button, {
|
|
678
682
|
type: "dashed",
|
|
679
683
|
block: true,
|
|
680
684
|
onClick: () => add(),
|
|
681
|
-
icon: /* @__PURE__ */ (0,
|
|
685
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_icons2.PlusOutlined, {}),
|
|
682
686
|
children: [
|
|
683
687
|
config.common.add,
|
|
684
688
|
" ",
|
|
685
689
|
computedProps.label
|
|
686
690
|
]
|
|
687
691
|
}),
|
|
688
|
-
/* @__PURE__ */ (0,
|
|
692
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_antd5.Form.ErrorList, {
|
|
689
693
|
errors
|
|
690
694
|
})
|
|
691
695
|
]
|
|
@@ -699,7 +703,7 @@ function FormItem(props) {
|
|
|
699
703
|
}
|
|
700
704
|
|
|
701
705
|
// src/Form.tsx
|
|
702
|
-
var
|
|
706
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
703
707
|
function Form(props) {
|
|
704
708
|
var _a, _b;
|
|
705
709
|
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
@@ -743,16 +747,16 @@ function Form(props) {
|
|
|
743
747
|
}, []);
|
|
744
748
|
if (!computedProps)
|
|
745
749
|
return null;
|
|
746
|
-
return /* @__PURE__ */ (0,
|
|
750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_antd6.Form, {
|
|
747
751
|
...computedProps,
|
|
748
752
|
children: [
|
|
749
753
|
computedProps.beforeItems,
|
|
750
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0,
|
|
754
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FormItem, {
|
|
751
755
|
...item,
|
|
752
756
|
extendTypes
|
|
753
757
|
}, item.id)),
|
|
754
758
|
computedProps.children,
|
|
755
|
-
computedProps.submit !== false && /* @__PURE__ */ (0,
|
|
759
|
+
computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_antd6.Button, {
|
|
756
760
|
htmlType: "submit",
|
|
757
761
|
type: "primary",
|
|
758
762
|
loading,
|
|
@@ -768,7 +772,7 @@ Form.Item = FormItem;
|
|
|
768
772
|
// src/Link.tsx
|
|
769
773
|
var import_react_router_dom = require("react-router-dom");
|
|
770
774
|
var import_antd7 = require("antd");
|
|
771
|
-
var
|
|
775
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
772
776
|
function Link({
|
|
773
777
|
href,
|
|
774
778
|
target,
|
|
@@ -781,9 +785,9 @@ function Link({
|
|
|
781
785
|
style = Object.assign({ cursor: "pointer" }, style);
|
|
782
786
|
if (href.startsWith("http")) {
|
|
783
787
|
if (button)
|
|
784
|
-
return /* @__PURE__ */ (0,
|
|
788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, {
|
|
785
789
|
...button,
|
|
786
|
-
children: /* @__PURE__ */ (0,
|
|
790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
|
|
787
791
|
href,
|
|
788
792
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
789
793
|
style: {
|
|
@@ -793,7 +797,7 @@ function Link({
|
|
|
793
797
|
children: text || children
|
|
794
798
|
})
|
|
795
799
|
});
|
|
796
|
-
return /* @__PURE__ */ (0,
|
|
800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", {
|
|
797
801
|
href,
|
|
798
802
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
799
803
|
style: {
|
|
@@ -804,9 +808,9 @@ function Link({
|
|
|
804
808
|
});
|
|
805
809
|
}
|
|
806
810
|
if (button)
|
|
807
|
-
return /* @__PURE__ */ (0,
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_antd7.Button, {
|
|
808
812
|
...button,
|
|
809
|
-
children: /* @__PURE__ */ (0,
|
|
813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
|
|
810
814
|
to: href,
|
|
811
815
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
812
816
|
style: {
|
|
@@ -816,7 +820,7 @@ function Link({
|
|
|
816
820
|
children: text || children
|
|
817
821
|
})
|
|
818
822
|
});
|
|
819
|
-
return /* @__PURE__ */ (0,
|
|
823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_router_dom.Link, {
|
|
820
824
|
to: href,
|
|
821
825
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
822
826
|
style: {
|
|
@@ -830,7 +834,7 @@ function Link({
|
|
|
830
834
|
// src/Modal.tsx
|
|
831
835
|
var import_antd8 = require("antd");
|
|
832
836
|
var import_react10 = require("react");
|
|
833
|
-
var
|
|
837
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
834
838
|
function useModal(init) {
|
|
835
839
|
const [props, setProps] = (0, import_react10.useState)({
|
|
836
840
|
open: false,
|
|
@@ -841,7 +845,7 @@ function useModal(init) {
|
|
|
841
845
|
...init
|
|
842
846
|
});
|
|
843
847
|
return {
|
|
844
|
-
modal: /* @__PURE__ */ (0,
|
|
848
|
+
modal: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_antd8.Modal, {
|
|
845
849
|
...props
|
|
846
850
|
}),
|
|
847
851
|
modalProps: props,
|
|
@@ -858,32 +862,32 @@ function useModal(init) {
|
|
|
858
862
|
var import_antd9 = require("antd");
|
|
859
863
|
var import_react11 = require("react");
|
|
860
864
|
var import_react_router_dom2 = require("react-router-dom");
|
|
861
|
-
var
|
|
865
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
862
866
|
function PageNotFound() {
|
|
863
867
|
const config = useConfigContext();
|
|
864
|
-
return /* @__PURE__ */ (0,
|
|
868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Result, {
|
|
865
869
|
status: "404",
|
|
866
870
|
title: config.common.pageNotFound
|
|
867
871
|
});
|
|
868
872
|
}
|
|
869
873
|
function Routes(props) {
|
|
870
|
-
return /* @__PURE__ */ (0,
|
|
874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_router_dom2.Routes, {
|
|
871
875
|
children: [
|
|
872
|
-
props.routes.map((r) => /* @__PURE__ */ (0,
|
|
876
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
|
|
873
877
|
...r,
|
|
874
|
-
element: r.element || /* @__PURE__ */ (0,
|
|
875
|
-
fallback: props.fallback || /* @__PURE__ */ (0,
|
|
878
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.Suspense, {
|
|
879
|
+
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {
|
|
876
880
|
style: { padding: "24px" },
|
|
877
|
-
children: /* @__PURE__ */ (0,
|
|
881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_antd9.Skeleton, {
|
|
878
882
|
active: true
|
|
879
883
|
})
|
|
880
884
|
}),
|
|
881
|
-
children: /* @__PURE__ */ (0,
|
|
885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(r.page, {})
|
|
882
886
|
})
|
|
883
887
|
}, r.path)),
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_router_dom2.Route, {
|
|
885
889
|
path: "*",
|
|
886
|
-
element: props.notFound || /* @__PURE__ */ (0,
|
|
890
|
+
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageNotFound, {})
|
|
887
891
|
}, "*")
|
|
888
892
|
]
|
|
889
893
|
});
|
|
@@ -896,39 +900,34 @@ var import_dayjs5 = __toESM(require("dayjs"));
|
|
|
896
900
|
var import_icons3 = require("@ant-design/icons");
|
|
897
901
|
var import_lodash6 = require("lodash");
|
|
898
902
|
var import_react13 = require("@faasjs/react");
|
|
899
|
-
var
|
|
903
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
900
904
|
function processValue(item, value) {
|
|
901
905
|
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
|
-
}
|
|
906
|
+
if (typeof value === "undefined" && value === null)
|
|
907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Empty, {});
|
|
908
|
+
if (item.options) {
|
|
909
|
+
if (item.type.endsWith("[]"))
|
|
910
|
+
return value.map((v) => {
|
|
911
|
+
var _a2;
|
|
912
|
+
return ((_a2 = item.options.find((option) => option.value === v)) == null ? void 0 : _a2.label) || v;
|
|
913
|
+
});
|
|
914
|
+
else if ([
|
|
915
|
+
"string",
|
|
916
|
+
"number",
|
|
917
|
+
"boolean"
|
|
918
|
+
].includes(item.type))
|
|
919
|
+
return ((_a = item.options.find((option) => option.value === value)) == null ? void 0 : _a.label) || value;
|
|
920
|
+
}
|
|
921
|
+
if (["date", "time"].includes(item.type)) {
|
|
922
|
+
if (typeof value === "number" && value.toString().length === 10)
|
|
923
|
+
value = value * 1e3;
|
|
924
|
+
return (0, import_dayjs5.default)(value).format(item.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm:ss");
|
|
926
925
|
}
|
|
927
926
|
return value;
|
|
928
927
|
}
|
|
929
928
|
function Table(props) {
|
|
930
929
|
const [columns, setColumns] = (0, import_react12.useState)();
|
|
931
|
-
const
|
|
930
|
+
const { common: common2 } = useConfigContext();
|
|
932
931
|
(0, import_react12.useEffect)(() => {
|
|
933
932
|
var _a;
|
|
934
933
|
for (const item of props.items) {
|
|
@@ -947,8 +946,6 @@ function Table(props) {
|
|
|
947
946
|
value: o.value
|
|
948
947
|
}));
|
|
949
948
|
}
|
|
950
|
-
if (item.render)
|
|
951
|
-
continue;
|
|
952
949
|
if (item.children)
|
|
953
950
|
delete item.children;
|
|
954
951
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
@@ -968,45 +965,191 @@ function Table(props) {
|
|
|
968
965
|
}
|
|
969
966
|
switch (item.type) {
|
|
970
967
|
case "string":
|
|
971
|
-
item.render
|
|
972
|
-
|
|
968
|
+
if (!item.render)
|
|
969
|
+
item.render = (value) => processValue(item, value);
|
|
970
|
+
if (!item.onFilter) {
|
|
973
971
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
972
|
+
}
|
|
973
|
+
if (!item.filters && item.filterDropdown !== false && item.optionsType !== "auto")
|
|
974
|
+
item.filterDropdown = ({
|
|
975
|
+
setSelectedKeys,
|
|
976
|
+
selectedKeys,
|
|
977
|
+
confirm,
|
|
978
|
+
clearFilters
|
|
979
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
|
|
980
|
+
style: { padding: 8 },
|
|
981
|
+
children: [
|
|
982
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
|
|
983
|
+
value: selectedKeys[0],
|
|
984
|
+
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
985
|
+
style: {
|
|
986
|
+
width: 188,
|
|
987
|
+
marginBottom: 8,
|
|
988
|
+
display: "block"
|
|
989
|
+
}
|
|
990
|
+
}),
|
|
991
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
992
|
+
type: "button",
|
|
993
|
+
onClick: () => confirm(),
|
|
994
|
+
style: {
|
|
995
|
+
width: 90,
|
|
996
|
+
marginRight: 8
|
|
997
|
+
},
|
|
998
|
+
children: common2.search
|
|
999
|
+
}),
|
|
1000
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1001
|
+
type: "button",
|
|
1002
|
+
onClick: () => clearFilters(),
|
|
1003
|
+
style: { width: 90 },
|
|
1004
|
+
children: common2.reset
|
|
1005
|
+
})
|
|
1006
|
+
]
|
|
1007
|
+
});
|
|
974
1008
|
break;
|
|
975
1009
|
case "string[]":
|
|
976
|
-
|
|
1010
|
+
if (!item.render)
|
|
1011
|
+
item.render = (value) => processValue(item, value).join(", ");
|
|
977
1012
|
if (!item.onFilter)
|
|
978
1013
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
1014
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1015
|
+
item.filterDropdown = ({
|
|
1016
|
+
setSelectedKeys,
|
|
1017
|
+
selectedKeys,
|
|
1018
|
+
confirm,
|
|
1019
|
+
clearFilters
|
|
1020
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
|
|
1021
|
+
style: { padding: 8 },
|
|
1022
|
+
children: [
|
|
1023
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
|
|
1024
|
+
value: selectedKeys[0],
|
|
1025
|
+
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
1026
|
+
style: {
|
|
1027
|
+
width: 188,
|
|
1028
|
+
marginBottom: 8,
|
|
1029
|
+
display: "block"
|
|
1030
|
+
}
|
|
1031
|
+
}),
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1033
|
+
type: "button",
|
|
1034
|
+
onClick: () => confirm(),
|
|
1035
|
+
style: {
|
|
1036
|
+
width: 90,
|
|
1037
|
+
marginRight: 8
|
|
1038
|
+
},
|
|
1039
|
+
children: common2.search
|
|
1040
|
+
}),
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1042
|
+
type: "button",
|
|
1043
|
+
onClick: () => clearFilters(),
|
|
1044
|
+
style: { width: 90 },
|
|
1045
|
+
children: common2.reset
|
|
1046
|
+
})
|
|
1047
|
+
]
|
|
1048
|
+
});
|
|
979
1049
|
break;
|
|
980
1050
|
case "number":
|
|
981
|
-
item.render
|
|
1051
|
+
if (!item.render)
|
|
1052
|
+
item.render = (value) => processValue(item, value);
|
|
982
1053
|
if (!item.sorter)
|
|
983
1054
|
item.sorter = (a, b) => a[item.id] - b[item.id];
|
|
984
1055
|
if (!item.onFilter)
|
|
985
1056
|
item.onFilter = (value, row) => value === row[item.id];
|
|
1057
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1058
|
+
item.filterDropdown = ({
|
|
1059
|
+
setSelectedKeys,
|
|
1060
|
+
selectedKeys,
|
|
1061
|
+
confirm,
|
|
1062
|
+
clearFilters
|
|
1063
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
|
|
1064
|
+
style: { padding: 8 },
|
|
1065
|
+
children: [
|
|
1066
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
|
|
1067
|
+
value: selectedKeys[0],
|
|
1068
|
+
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
1069
|
+
style: {
|
|
1070
|
+
width: 188,
|
|
1071
|
+
marginBottom: 8,
|
|
1072
|
+
display: "block"
|
|
1073
|
+
}
|
|
1074
|
+
}),
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1076
|
+
type: "button",
|
|
1077
|
+
onClick: () => confirm(),
|
|
1078
|
+
style: {
|
|
1079
|
+
width: 90,
|
|
1080
|
+
marginRight: 8
|
|
1081
|
+
},
|
|
1082
|
+
children: common2.search
|
|
1083
|
+
}),
|
|
1084
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1085
|
+
type: "button",
|
|
1086
|
+
onClick: () => clearFilters(),
|
|
1087
|
+
style: { width: 90 },
|
|
1088
|
+
children: common2.reset
|
|
1089
|
+
})
|
|
1090
|
+
]
|
|
1091
|
+
});
|
|
986
1092
|
break;
|
|
987
1093
|
case "number[]":
|
|
988
|
-
|
|
1094
|
+
if (!item.render)
|
|
1095
|
+
item.render = (value) => processValue(item, value).join(", ");
|
|
989
1096
|
if (!item.onFilter)
|
|
990
1097
|
item.onFilter = (value, row) => row[item.id].includes(value);
|
|
1098
|
+
if (!item.filters && item.filterDropdown !== false)
|
|
1099
|
+
item.filterDropdown = ({
|
|
1100
|
+
setSelectedKeys,
|
|
1101
|
+
selectedKeys,
|
|
1102
|
+
confirm,
|
|
1103
|
+
clearFilters
|
|
1104
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", {
|
|
1105
|
+
style: { padding: 8 },
|
|
1106
|
+
children: [
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("input", {
|
|
1108
|
+
value: selectedKeys[0],
|
|
1109
|
+
onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []),
|
|
1110
|
+
style: {
|
|
1111
|
+
width: 188,
|
|
1112
|
+
marginBottom: 8,
|
|
1113
|
+
display: "block"
|
|
1114
|
+
}
|
|
1115
|
+
}),
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1117
|
+
type: "button",
|
|
1118
|
+
onClick: () => confirm(),
|
|
1119
|
+
style: {
|
|
1120
|
+
width: 90,
|
|
1121
|
+
marginRight: 8
|
|
1122
|
+
},
|
|
1123
|
+
children: common2.search
|
|
1124
|
+
}),
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", {
|
|
1126
|
+
type: "button",
|
|
1127
|
+
onClick: () => clearFilters(),
|
|
1128
|
+
style: { width: 90 },
|
|
1129
|
+
children: common2.reset
|
|
1130
|
+
})
|
|
1131
|
+
]
|
|
1132
|
+
});
|
|
991
1133
|
break;
|
|
992
1134
|
case "boolean":
|
|
993
|
-
item.render
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1135
|
+
if (!item.render)
|
|
1136
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
|
|
1137
|
+
style: {
|
|
1138
|
+
marginTop: "4px",
|
|
1139
|
+
color: "#52c41a"
|
|
1140
|
+
}
|
|
1141
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
|
|
1142
|
+
style: {
|
|
1143
|
+
marginTop: "4px",
|
|
1144
|
+
color: "#ff4d4f"
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1004
1147
|
if (item.filterDropdown !== false)
|
|
1005
1148
|
item.filterDropdown = ({
|
|
1006
1149
|
setSelectedKeys,
|
|
1007
1150
|
selectedKeys,
|
|
1008
1151
|
confirm
|
|
1009
|
-
}) => /* @__PURE__ */ (0,
|
|
1152
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_antd10.Radio.Group, {
|
|
1010
1153
|
style: { padding: 8 },
|
|
1011
1154
|
buttonStyle: "solid",
|
|
1012
1155
|
value: selectedKeys[0],
|
|
@@ -1015,30 +1158,30 @@ function Table(props) {
|
|
|
1015
1158
|
confirm();
|
|
1016
1159
|
},
|
|
1017
1160
|
children: [
|
|
1018
|
-
/* @__PURE__ */ (0,
|
|
1019
|
-
children:
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1162
|
+
children: common2.all
|
|
1020
1163
|
}),
|
|
1021
|
-
/* @__PURE__ */ (0,
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1022
1165
|
value: "true",
|
|
1023
|
-
children: /* @__PURE__ */ (0,
|
|
1166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CheckOutlined, {
|
|
1024
1167
|
style: {
|
|
1025
1168
|
color: "#52c41a",
|
|
1026
1169
|
verticalAlign: "middle"
|
|
1027
1170
|
}
|
|
1028
1171
|
})
|
|
1029
1172
|
}),
|
|
1030
|
-
/* @__PURE__ */ (0,
|
|
1173
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1031
1174
|
value: "false",
|
|
1032
|
-
children: /* @__PURE__ */ (0,
|
|
1175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_icons3.CloseOutlined, {
|
|
1033
1176
|
style: {
|
|
1034
1177
|
verticalAlign: "middle",
|
|
1035
1178
|
color: "#ff4d4f"
|
|
1036
1179
|
}
|
|
1037
1180
|
})
|
|
1038
1181
|
}),
|
|
1039
|
-
/* @__PURE__ */ (0,
|
|
1182
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Radio.Button, {
|
|
1040
1183
|
value: "empty",
|
|
1041
|
-
children:
|
|
1184
|
+
children: common2.blank
|
|
1042
1185
|
})
|
|
1043
1186
|
]
|
|
1044
1187
|
});
|
|
@@ -1057,21 +1200,24 @@ function Table(props) {
|
|
|
1057
1200
|
};
|
|
1058
1201
|
break;
|
|
1059
1202
|
case "date":
|
|
1060
|
-
item.render
|
|
1203
|
+
if (!item.render)
|
|
1204
|
+
item.render = (value) => processValue(item, value);
|
|
1061
1205
|
if (!item.onFilter)
|
|
1062
1206
|
item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
|
|
1063
1207
|
if (!item.sorter)
|
|
1064
1208
|
item.sorter = (a, b) => (0, import_dayjs5.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1065
1209
|
break;
|
|
1066
1210
|
case "time":
|
|
1067
|
-
item.render
|
|
1211
|
+
if (!item.render)
|
|
1212
|
+
item.render = (value) => processValue(item, value);
|
|
1068
1213
|
if (!item.onFilter)
|
|
1069
1214
|
item.onFilter = (value, row) => (0, import_dayjs5.default)(row[item.id]).isSame((0, import_dayjs5.default)(value));
|
|
1070
1215
|
if (!item.sorter)
|
|
1071
1216
|
item.sorter = (a, b) => (0, import_dayjs5.default)(a[item.id]).isBefore(b[item.id]) ? -1 : 1;
|
|
1072
1217
|
break;
|
|
1073
1218
|
default:
|
|
1074
|
-
item.render
|
|
1219
|
+
if (!item.render)
|
|
1220
|
+
item.render = (value) => processValue(item, value);
|
|
1075
1221
|
if (!item.onFilter)
|
|
1076
1222
|
item.onFilter = (value, row) => value === row[item.id];
|
|
1077
1223
|
break;
|
|
@@ -1079,17 +1225,34 @@ function Table(props) {
|
|
|
1079
1225
|
}
|
|
1080
1226
|
setColumns(props.items);
|
|
1081
1227
|
}, [props.items]);
|
|
1228
|
+
(0, import_react12.useEffect)(() => {
|
|
1229
|
+
if (!props.dataSource || !columns)
|
|
1230
|
+
return;
|
|
1231
|
+
for (const column of columns) {
|
|
1232
|
+
if (column.optionsType === "auto" && !column.options && !column.filters) {
|
|
1233
|
+
setColumns((prev) => {
|
|
1234
|
+
const newColumns = [...prev];
|
|
1235
|
+
const index = newColumns.findIndex((item) => item.id === column.id);
|
|
1236
|
+
newColumns[index].filters = (0, import_lodash6.uniqBy)(props.dataSource, column.id).map((v) => ({
|
|
1237
|
+
text: v[column.id],
|
|
1238
|
+
value: v[column.id]
|
|
1239
|
+
}));
|
|
1240
|
+
return newColumns;
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}, [props.dataSource, columns]);
|
|
1082
1245
|
if (!columns)
|
|
1083
1246
|
return null;
|
|
1084
1247
|
if (!props.faasData)
|
|
1085
|
-
return /* @__PURE__ */ (0,
|
|
1248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1086
1249
|
...props,
|
|
1087
1250
|
rowKey: props.rowKey || "id",
|
|
1088
1251
|
columns,
|
|
1089
1252
|
dataSource: props.dataSource
|
|
1090
1253
|
});
|
|
1091
|
-
return /* @__PURE__ */ (0,
|
|
1092
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0,
|
|
1254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react13.FaasDataWrapper, {
|
|
1255
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Skeleton, {
|
|
1093
1256
|
active: true
|
|
1094
1257
|
}),
|
|
1095
1258
|
render: ({
|
|
@@ -1098,20 +1261,20 @@ function Table(props) {
|
|
|
1098
1261
|
reload
|
|
1099
1262
|
}) => {
|
|
1100
1263
|
if (!data)
|
|
1101
|
-
return /* @__PURE__ */ (0,
|
|
1264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1102
1265
|
...props,
|
|
1103
1266
|
rowKey: props.rowKey || "id",
|
|
1104
1267
|
columns,
|
|
1105
1268
|
dataSource: []
|
|
1106
1269
|
});
|
|
1107
1270
|
if (Array.isArray(data))
|
|
1108
|
-
return /* @__PURE__ */ (0,
|
|
1271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1109
1272
|
...props,
|
|
1110
1273
|
rowKey: props.rowKey || "id",
|
|
1111
1274
|
columns,
|
|
1112
1275
|
dataSource: data
|
|
1113
1276
|
});
|
|
1114
|
-
return /* @__PURE__ */ (0,
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_antd10.Table, {
|
|
1115
1278
|
...props,
|
|
1116
1279
|
rowKey: props.rowKey || "id",
|
|
1117
1280
|
columns,
|
|
@@ -1146,7 +1309,7 @@ function Table(props) {
|
|
|
1146
1309
|
|
|
1147
1310
|
// src/Title.tsx
|
|
1148
1311
|
var import_react14 = require("react");
|
|
1149
|
-
var
|
|
1312
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1150
1313
|
function Title(props) {
|
|
1151
1314
|
const config = useConfigContext();
|
|
1152
1315
|
(0, import_react14.useEffect)(() => {
|
|
@@ -1155,10 +1318,10 @@ function Title(props) {
|
|
|
1155
1318
|
}, []);
|
|
1156
1319
|
if (props.h1) {
|
|
1157
1320
|
if (typeof props.h1 === "boolean")
|
|
1158
|
-
return /* @__PURE__ */ (0,
|
|
1321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
|
|
1159
1322
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1160
1323
|
});
|
|
1161
|
-
return /* @__PURE__ */ (0,
|
|
1324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", {
|
|
1162
1325
|
className: props.h1.className,
|
|
1163
1326
|
style: props.h1.style,
|
|
1164
1327
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|