@faasjs/ant-design 0.0.2-beta.452 → 0.0.2-beta.454
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 +84 -47
- package/dist/index.js +177 -173
- package/dist/index.mjs +29 -25
- package/package.json +3 -5
package/dist/index.js
CHANGED
|
@@ -130,10 +130,10 @@ function useConfigContext() {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
// src/Blank.tsx
|
|
133
|
-
var
|
|
133
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
134
134
|
function Blank(options) {
|
|
135
135
|
const { Blank: Blank2 } = useConfigContext();
|
|
136
|
-
return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0,
|
|
136
|
+
return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Typography.Text, {
|
|
137
137
|
disabled: true,
|
|
138
138
|
children: (options == null ? void 0 : options.text) || Blank2.text
|
|
139
139
|
}) : options.value;
|
|
@@ -184,7 +184,7 @@ var import_antd3 = require("antd");
|
|
|
184
184
|
var import_lodash4 = require("lodash");
|
|
185
185
|
var import_react3 = require("react");
|
|
186
186
|
var import_react4 = require("@faasjs/react");
|
|
187
|
-
var
|
|
187
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
188
188
|
function DescriptionItemContent(props) {
|
|
189
189
|
var _a;
|
|
190
190
|
const [computedProps, setComputedProps] = (0, import_react3.useState)();
|
|
@@ -226,7 +226,7 @@ function DescriptionItemContent(props) {
|
|
|
226
226
|
}
|
|
227
227
|
);
|
|
228
228
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
229
|
-
return /* @__PURE__ */ (0,
|
|
229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
230
230
|
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
|
|
231
231
|
});
|
|
232
232
|
else
|
|
@@ -234,54 +234,54 @@ function DescriptionItemContent(props) {
|
|
|
234
234
|
if (computedProps.item.children)
|
|
235
235
|
return (0, import_react3.cloneElement)(computedProps.item.children, { value: computedProps.value });
|
|
236
236
|
if (computedProps.item.render)
|
|
237
|
-
return /* @__PURE__ */ (0,
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
238
238
|
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
239
239
|
});
|
|
240
240
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
241
|
-
return /* @__PURE__ */ (0,
|
|
241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
242
242
|
switch (computedProps.item.type) {
|
|
243
243
|
case "string[]":
|
|
244
|
-
return /* @__PURE__ */ (0,
|
|
244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
245
245
|
children: computedProps.value.join(", ")
|
|
246
246
|
});
|
|
247
247
|
case "number":
|
|
248
248
|
return computedProps.value || null;
|
|
249
249
|
case "number[]":
|
|
250
|
-
return /* @__PURE__ */ (0,
|
|
250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
251
251
|
children: computedProps.value.join(", ")
|
|
252
252
|
});
|
|
253
253
|
case "boolean":
|
|
254
|
-
return computedProps.value ? /* @__PURE__ */ (0,
|
|
254
|
+
return computedProps.value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {
|
|
255
255
|
style: {
|
|
256
256
|
marginTop: "4px",
|
|
257
257
|
color: "#52c41a"
|
|
258
258
|
}
|
|
259
|
-
}) : /* @__PURE__ */ (0,
|
|
259
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {
|
|
260
260
|
style: {
|
|
261
261
|
marginTop: "4px",
|
|
262
262
|
color: "#ff4d4f"
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
case "time":
|
|
266
|
-
return /* @__PURE__ */ (0,
|
|
266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
267
267
|
children: computedProps.value.format("YYYY-MM-DD HH:mm:ss")
|
|
268
268
|
});
|
|
269
269
|
case "date":
|
|
270
|
-
return /* @__PURE__ */ (0,
|
|
270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
271
271
|
children: computedProps.value.format("YYYY-MM-DD")
|
|
272
272
|
});
|
|
273
273
|
case "object":
|
|
274
|
-
return /* @__PURE__ */ (0,
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
275
275
|
items: computedProps.item.object,
|
|
276
276
|
dataSource: computedProps.value,
|
|
277
277
|
column: 1
|
|
278
278
|
});
|
|
279
279
|
case "object[]":
|
|
280
280
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
281
|
-
return /* @__PURE__ */ (0,
|
|
282
|
-
return /* @__PURE__ */ (0,
|
|
281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
282
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
|
|
283
283
|
direction: "vertical",
|
|
284
|
-
children: computedProps.value.map((value, index) => /* @__PURE__ */ (0,
|
|
284
|
+
children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
285
285
|
items: computedProps.item.object,
|
|
286
286
|
dataSource: value,
|
|
287
287
|
column: 1
|
|
@@ -293,13 +293,13 @@ function DescriptionItemContent(props) {
|
|
|
293
293
|
}
|
|
294
294
|
function Description(props) {
|
|
295
295
|
if (!props.faasData)
|
|
296
|
-
return /* @__PURE__ */ (0,
|
|
296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
297
297
|
...props,
|
|
298
298
|
title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
299
299
|
children: props.items.map((item) => {
|
|
300
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0,
|
|
300
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
301
301
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
302
|
-
children: /* @__PURE__ */ (0,
|
|
302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
303
303
|
item,
|
|
304
304
|
value: props.dataSource[item.id],
|
|
305
305
|
values: props.dataSource,
|
|
@@ -308,18 +308,18 @@ function Description(props) {
|
|
|
308
308
|
}, item.id) : null;
|
|
309
309
|
}).filter(Boolean)
|
|
310
310
|
});
|
|
311
|
-
return /* @__PURE__ */ (0,
|
|
312
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0,
|
|
311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
|
|
312
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
|
|
313
313
|
active: true
|
|
314
314
|
}),
|
|
315
315
|
render: ({ data }) => {
|
|
316
|
-
return /* @__PURE__ */ (0,
|
|
316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
317
317
|
...props,
|
|
318
318
|
title: (0, import_lodash4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
319
319
|
children: props.items.map((item) => {
|
|
320
|
-
return !item.if || item.if(data) ? /* @__PURE__ */ (0,
|
|
320
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
321
321
|
label: item.title || (0, import_lodash4.upperFirst)(item.id),
|
|
322
|
-
children: /* @__PURE__ */ (0,
|
|
322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
323
323
|
item,
|
|
324
324
|
value: data[item.id],
|
|
325
325
|
values: data,
|
|
@@ -336,7 +336,7 @@ function Description(props) {
|
|
|
336
336
|
// src/Drawer.tsx
|
|
337
337
|
var import_antd4 = require("antd");
|
|
338
338
|
var import_react5 = require("react");
|
|
339
|
-
var
|
|
339
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
340
340
|
function useDrawer(init) {
|
|
341
341
|
const [props, setProps] = (0, import_react5.useState)({
|
|
342
342
|
open: false,
|
|
@@ -347,7 +347,7 @@ function useDrawer(init) {
|
|
|
347
347
|
...init
|
|
348
348
|
});
|
|
349
349
|
return {
|
|
350
|
-
drawer: /* @__PURE__ */ (0,
|
|
350
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
|
|
351
351
|
...props
|
|
352
352
|
}),
|
|
353
353
|
drawerProps: props,
|
|
@@ -373,9 +373,9 @@ var import_lodash5 = require("lodash");
|
|
|
373
373
|
|
|
374
374
|
// src/TimePicker.tsx
|
|
375
375
|
var import_react6 = require("react");
|
|
376
|
-
var
|
|
376
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
377
377
|
var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
|
|
378
|
-
return /* @__PURE__ */ (0,
|
|
378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
|
|
379
379
|
...props,
|
|
380
380
|
picker: "time",
|
|
381
381
|
mode: void 0,
|
|
@@ -385,7 +385,7 @@ var TimePicker = (0, import_react6.forwardRef)((props, ref) => {
|
|
|
385
385
|
TimePicker.displayName = "TimePicker";
|
|
386
386
|
|
|
387
387
|
// src/FormItem.tsx
|
|
388
|
-
var
|
|
388
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
389
389
|
function processProps(propsCopy, config) {
|
|
390
390
|
if (!propsCopy.title)
|
|
391
391
|
propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
|
|
@@ -437,88 +437,106 @@ function FormItem(props) {
|
|
|
437
437
|
const [computedProps, setComputedProps] = (0, import_react7.useState)();
|
|
438
438
|
const [extendTypes, setExtendTypes] = (0, import_react7.useState)();
|
|
439
439
|
const config = useConfigContext();
|
|
440
|
+
const [hidden, setHidden] = (0, import_react7.useState)(false);
|
|
440
441
|
(0, import_react7.useEffect)(() => {
|
|
441
442
|
const propsCopy = { ...props };
|
|
442
443
|
if (propsCopy.extendTypes) {
|
|
443
444
|
setExtendTypes(propsCopy.extendTypes);
|
|
444
445
|
delete propsCopy.extendTypes;
|
|
445
446
|
}
|
|
447
|
+
if (propsCopy.if) {
|
|
448
|
+
const condition = propsCopy.if;
|
|
449
|
+
propsCopy.shouldUpdate = (_, cur) => {
|
|
450
|
+
const show = condition(cur);
|
|
451
|
+
setHidden(!show);
|
|
452
|
+
return show;
|
|
453
|
+
};
|
|
454
|
+
delete propsCopy.if;
|
|
455
|
+
}
|
|
446
456
|
setComputedProps(processProps(propsCopy, config));
|
|
447
457
|
}, [props]);
|
|
448
458
|
if (!computedProps)
|
|
449
459
|
return null;
|
|
460
|
+
if (hidden)
|
|
461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
462
|
+
...computedProps,
|
|
463
|
+
noStyle: true,
|
|
464
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
|
|
465
|
+
hidden: true
|
|
466
|
+
})
|
|
467
|
+
});
|
|
450
468
|
if (extendTypes && extendTypes[computedProps.type])
|
|
451
|
-
return /* @__PURE__ */ (0,
|
|
469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
452
470
|
...computedProps,
|
|
453
471
|
children: extendTypes[computedProps.type].children
|
|
454
472
|
});
|
|
455
473
|
if (computedProps.children)
|
|
456
|
-
return /* @__PURE__ */ (0,
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
457
475
|
...computedProps,
|
|
458
476
|
children: computedProps.children
|
|
459
477
|
});
|
|
460
478
|
if (computedProps.render)
|
|
461
|
-
return /* @__PURE__ */ (0,
|
|
479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
462
480
|
...computedProps,
|
|
463
481
|
children: computedProps.render()
|
|
464
482
|
});
|
|
465
483
|
switch (computedProps.type) {
|
|
466
484
|
case "string":
|
|
467
|
-
return /* @__PURE__ */ (0,
|
|
485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
468
486
|
...computedProps,
|
|
469
|
-
children: computedProps.options ? /* @__PURE__ */ (0,
|
|
487
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
|
|
470
488
|
...computedProps.input
|
|
471
|
-
}) : /* @__PURE__ */ (0,
|
|
489
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
|
|
472
490
|
...computedProps.input
|
|
473
491
|
})
|
|
474
492
|
});
|
|
475
493
|
case "string[]":
|
|
476
494
|
if (computedProps.options)
|
|
477
|
-
return /* @__PURE__ */ (0,
|
|
495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
478
496
|
...computedProps,
|
|
479
|
-
children: /* @__PURE__ */ (0,
|
|
497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
|
|
480
498
|
mode: "multiple",
|
|
481
499
|
...computedProps.input
|
|
482
500
|
})
|
|
483
501
|
});
|
|
484
|
-
return /* @__PURE__ */ (0,
|
|
502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
|
|
485
503
|
name: computedProps.name,
|
|
486
504
|
rules: computedProps.rules,
|
|
487
505
|
children: (fields, { add, remove }, { errors }) => {
|
|
488
506
|
var _a2;
|
|
489
|
-
return /* @__PURE__ */ (0,
|
|
507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
490
508
|
children: [
|
|
491
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
509
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
492
510
|
className: "ant-form-item-label",
|
|
493
|
-
children: /* @__PURE__ */ (0,
|
|
511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
494
512
|
className: computedProps.rules.find((r) => r.required) && "ant-form-item-required",
|
|
495
513
|
children: computedProps.label
|
|
496
514
|
})
|
|
497
515
|
}),
|
|
498
516
|
fields.map((field) => {
|
|
499
517
|
var _a3;
|
|
500
|
-
return /* @__PURE__ */ (0,
|
|
501
|
-
children: /* @__PURE__ */ (0,
|
|
518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
|
|
502
520
|
gutter: 24,
|
|
503
521
|
style: { flexFlow: "row nowrap" },
|
|
504
522
|
children: [
|
|
505
|
-
/* @__PURE__ */ (0,
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
|
|
506
524
|
span: 23,
|
|
507
|
-
children: /* @__PURE__ */ (0,
|
|
525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
508
526
|
...field,
|
|
509
527
|
noStyle: true,
|
|
510
|
-
children: /* @__PURE__ */ (0,
|
|
528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
|
|
511
529
|
...computedProps.input
|
|
512
530
|
})
|
|
513
531
|
})
|
|
514
532
|
}),
|
|
515
|
-
/* @__PURE__ */ (0,
|
|
533
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
|
|
516
534
|
span: 1,
|
|
517
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
535
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
|
|
518
536
|
danger: true,
|
|
519
537
|
type: "link",
|
|
520
538
|
style: { float: "right" },
|
|
521
|
-
icon: /* @__PURE__ */ (0,
|
|
539
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
522
540
|
onClick: () => remove(field.name)
|
|
523
541
|
})
|
|
524
542
|
})
|
|
@@ -526,15 +544,15 @@ function FormItem(props) {
|
|
|
526
544
|
})
|
|
527
545
|
}, field.key);
|
|
528
546
|
}),
|
|
529
|
-
/* @__PURE__ */ (0,
|
|
547
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
|
|
530
548
|
children: [
|
|
531
|
-
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
549
|
+
!((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
|
|
532
550
|
type: "dashed",
|
|
533
551
|
block: true,
|
|
534
552
|
onClick: () => add(),
|
|
535
|
-
icon: /* @__PURE__ */ (0,
|
|
553
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
|
|
536
554
|
}),
|
|
537
|
-
/* @__PURE__ */ (0,
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
|
|
538
556
|
errors
|
|
539
557
|
})
|
|
540
558
|
]
|
|
@@ -544,63 +562,63 @@ function FormItem(props) {
|
|
|
544
562
|
}
|
|
545
563
|
});
|
|
546
564
|
case "number":
|
|
547
|
-
return /* @__PURE__ */ (0,
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
548
566
|
...computedProps,
|
|
549
|
-
children: computedProps.options ? /* @__PURE__ */ (0,
|
|
567
|
+
children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
|
|
550
568
|
...computedProps.input
|
|
551
|
-
}) : /* @__PURE__ */ (0,
|
|
569
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
|
|
552
570
|
style: { width: "100%" },
|
|
553
571
|
...computedProps.input
|
|
554
572
|
})
|
|
555
573
|
});
|
|
556
574
|
case "number[]":
|
|
557
575
|
if (computedProps.options)
|
|
558
|
-
return /* @__PURE__ */ (0,
|
|
576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
559
577
|
...computedProps,
|
|
560
|
-
children: /* @__PURE__ */ (0,
|
|
578
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
|
|
561
579
|
mode: "multiple",
|
|
562
580
|
...computedProps.input
|
|
563
581
|
})
|
|
564
582
|
});
|
|
565
|
-
return /* @__PURE__ */ (0,
|
|
583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
|
|
566
584
|
name: computedProps.name,
|
|
567
585
|
rules: computedProps.rules,
|
|
568
586
|
children: (fields, { add, remove }, { errors }) => {
|
|
569
587
|
var _a2, _b;
|
|
570
|
-
return /* @__PURE__ */ (0,
|
|
588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
571
589
|
children: [
|
|
572
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
590
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
573
591
|
className: "ant-form-item-label",
|
|
574
|
-
children: /* @__PURE__ */ (0,
|
|
592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
575
593
|
className: ((_a2 = computedProps.rules) == null ? void 0 : _a2.find((r) => r.required)) && "ant-form-item-required",
|
|
576
594
|
children: computedProps.label
|
|
577
595
|
})
|
|
578
596
|
}),
|
|
579
597
|
fields.map((field) => {
|
|
580
598
|
var _a3;
|
|
581
|
-
return /* @__PURE__ */ (0,
|
|
582
|
-
children: /* @__PURE__ */ (0,
|
|
599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
|
|
583
601
|
gutter: 24,
|
|
584
602
|
style: { flexFlow: "row nowrap" },
|
|
585
603
|
children: [
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
604
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
|
|
587
605
|
span: 23,
|
|
588
|
-
children: /* @__PURE__ */ (0,
|
|
606
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
589
607
|
...field,
|
|
590
608
|
noStyle: true,
|
|
591
|
-
children: /* @__PURE__ */ (0,
|
|
609
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
|
|
592
610
|
style: { width: "100%" },
|
|
593
611
|
...computedProps.input
|
|
594
612
|
})
|
|
595
613
|
})
|
|
596
614
|
}),
|
|
597
|
-
/* @__PURE__ */ (0,
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
|
|
598
616
|
span: 1,
|
|
599
|
-
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
617
|
+
children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
|
|
600
618
|
danger: true,
|
|
601
619
|
type: "link",
|
|
602
620
|
style: { float: "right" },
|
|
603
|
-
icon: /* @__PURE__ */ (0,
|
|
621
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.MinusCircleOutlined, {}),
|
|
604
622
|
onClick: () => remove(field.name)
|
|
605
623
|
})
|
|
606
624
|
})
|
|
@@ -608,15 +626,15 @@ function FormItem(props) {
|
|
|
608
626
|
})
|
|
609
627
|
}, field.key);
|
|
610
628
|
}),
|
|
611
|
-
/* @__PURE__ */ (0,
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
|
|
612
630
|
children: [
|
|
613
|
-
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
631
|
+
!((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
|
|
614
632
|
type: "dashed",
|
|
615
633
|
block: true,
|
|
616
634
|
onClick: () => add(),
|
|
617
|
-
icon: /* @__PURE__ */ (0,
|
|
635
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
|
|
618
636
|
}),
|
|
619
|
-
/* @__PURE__ */ (0,
|
|
637
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
|
|
620
638
|
errors
|
|
621
639
|
})
|
|
622
640
|
]
|
|
@@ -626,58 +644,58 @@ function FormItem(props) {
|
|
|
626
644
|
}
|
|
627
645
|
});
|
|
628
646
|
case "boolean":
|
|
629
|
-
return /* @__PURE__ */ (0,
|
|
647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
630
648
|
...computedProps,
|
|
631
|
-
children: /* @__PURE__ */ (0,
|
|
649
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
|
|
632
650
|
...computedProps.input
|
|
633
651
|
})
|
|
634
652
|
});
|
|
635
653
|
case "date":
|
|
636
|
-
return /* @__PURE__ */ (0,
|
|
654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
637
655
|
...computedProps,
|
|
638
|
-
children: /* @__PURE__ */ (0,
|
|
656
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, {
|
|
639
657
|
...computedProps.input
|
|
640
658
|
})
|
|
641
659
|
});
|
|
642
660
|
case "time":
|
|
643
|
-
return /* @__PURE__ */ (0,
|
|
661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
|
|
644
662
|
...computedProps,
|
|
645
|
-
children: /* @__PURE__ */ (0,
|
|
663
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimePicker, {
|
|
646
664
|
...computedProps.input
|
|
647
665
|
})
|
|
648
666
|
});
|
|
649
667
|
case "object":
|
|
650
|
-
return /* @__PURE__ */ (0,
|
|
668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
651
669
|
children: [
|
|
652
|
-
computedProps.label && /* @__PURE__ */ (0,
|
|
670
|
+
computedProps.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
653
671
|
className: "ant-form-item-label",
|
|
654
|
-
children: /* @__PURE__ */ (0,
|
|
672
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
|
|
655
673
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required",
|
|
656
674
|
children: computedProps.label
|
|
657
675
|
})
|
|
658
676
|
}),
|
|
659
|
-
computedProps.object.map((o) => /* @__PURE__ */ (0,
|
|
677
|
+
computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
660
678
|
...o
|
|
661
679
|
}, o.id))
|
|
662
680
|
]
|
|
663
681
|
});
|
|
664
682
|
case "object[]":
|
|
665
|
-
return /* @__PURE__ */ (0,
|
|
683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
|
|
666
684
|
name: computedProps.name,
|
|
667
685
|
rules: computedProps.rules,
|
|
668
|
-
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0,
|
|
686
|
+
children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
669
687
|
children: [
|
|
670
|
-
fields.map((field) => /* @__PURE__ */ (0,
|
|
688
|
+
fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
|
|
671
689
|
style: { marginBottom: 0 },
|
|
672
690
|
children: [
|
|
673
|
-
/* @__PURE__ */ (0,
|
|
691
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
674
692
|
className: "ant-form-item-label",
|
|
675
|
-
children: /* @__PURE__ */ (0,
|
|
693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
676
694
|
children: [
|
|
677
695
|
computedProps.label,
|
|
678
696
|
" ",
|
|
679
697
|
field.name + 1,
|
|
680
|
-
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0,
|
|
698
|
+
!computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
|
|
681
699
|
danger: true,
|
|
682
700
|
type: "link",
|
|
683
701
|
onClick: () => remove(field.name),
|
|
@@ -686,11 +704,11 @@ function FormItem(props) {
|
|
|
686
704
|
]
|
|
687
705
|
})
|
|
688
706
|
}),
|
|
689
|
-
/* @__PURE__ */ (0,
|
|
707
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
|
|
690
708
|
gutter: 24,
|
|
691
|
-
children: computedProps.object.map((o) => /* @__PURE__ */ (0,
|
|
709
|
+
children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
|
|
692
710
|
span: o.col || 24,
|
|
693
|
-
children: /* @__PURE__ */ (0,
|
|
711
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
694
712
|
...o,
|
|
695
713
|
name: [field.name, o.id]
|
|
696
714
|
})
|
|
@@ -698,20 +716,20 @@ function FormItem(props) {
|
|
|
698
716
|
})
|
|
699
717
|
]
|
|
700
718
|
}, field.key)),
|
|
701
|
-
/* @__PURE__ */ (0,
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
|
|
702
720
|
children: [
|
|
703
|
-
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0,
|
|
721
|
+
!computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
|
|
704
722
|
type: "dashed",
|
|
705
723
|
block: true,
|
|
706
724
|
onClick: () => add(),
|
|
707
|
-
icon: /* @__PURE__ */ (0,
|
|
725
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {}),
|
|
708
726
|
children: [
|
|
709
727
|
config.common.add,
|
|
710
728
|
" ",
|
|
711
729
|
computedProps.label
|
|
712
730
|
]
|
|
713
731
|
}),
|
|
714
|
-
/* @__PURE__ */ (0,
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
|
|
715
733
|
errors
|
|
716
734
|
})
|
|
717
735
|
]
|
|
@@ -725,7 +743,7 @@ function FormItem(props) {
|
|
|
725
743
|
}
|
|
726
744
|
|
|
727
745
|
// src/Form.tsx
|
|
728
|
-
var
|
|
746
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
729
747
|
function Form(props) {
|
|
730
748
|
var _a, _b;
|
|
731
749
|
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
@@ -733,21 +751,22 @@ function Form(props) {
|
|
|
733
751
|
const config = useConfigContext();
|
|
734
752
|
const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
|
|
735
753
|
const [form] = import_antd6.Form.useForm(props.form);
|
|
754
|
+
const [initialValues, setInitialValues] = (0, import_react9.useState)(props.initialValues);
|
|
736
755
|
(0, import_react9.useEffect)(() => {
|
|
737
756
|
var _a2, _b2;
|
|
738
757
|
const propsCopy = {
|
|
739
758
|
...props,
|
|
740
|
-
items: (props.items || []).filter((it) => {
|
|
741
|
-
return !it.if || it.if(props.initialValues || {});
|
|
742
|
-
}),
|
|
743
759
|
form
|
|
744
760
|
};
|
|
745
|
-
if (propsCopy.initialValues)
|
|
761
|
+
if (propsCopy.initialValues) {
|
|
746
762
|
for (const key in propsCopy.initialValues)
|
|
747
763
|
propsCopy.initialValues[key] = transferValue(
|
|
748
764
|
(_a2 = propsCopy.items.find((item) => item.id === key)) == null ? void 0 : _a2.type,
|
|
749
765
|
propsCopy.initialValues[key]
|
|
750
766
|
);
|
|
767
|
+
setInitialValues(propsCopy.initialValues);
|
|
768
|
+
delete propsCopy.initialValues;
|
|
769
|
+
}
|
|
751
770
|
if (propsCopy.onFinish) {
|
|
752
771
|
propsCopy.onFinish = async (values) => {
|
|
753
772
|
var _a3;
|
|
@@ -791,41 +810,26 @@ function Form(props) {
|
|
|
791
810
|
if (item == null ? void 0 : item.onValueChange)
|
|
792
811
|
item.onValueChange(changedValues[key], allValues, form);
|
|
793
812
|
}
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
props.form.setFields([
|
|
801
|
-
{
|
|
802
|
-
name: it.id,
|
|
803
|
-
errors: null
|
|
804
|
-
}
|
|
805
|
-
]);
|
|
806
|
-
}
|
|
807
|
-
return show;
|
|
808
|
-
});
|
|
809
|
-
if (computedProps.items.length !== filterItems.length || computedProps.items.some((it, i) => it !== filterItems[i])) {
|
|
810
|
-
setComputedProps({
|
|
811
|
-
...computedProps,
|
|
812
|
-
items: filterItems
|
|
813
|
-
});
|
|
814
|
-
}
|
|
813
|
+
}, [computedProps]);
|
|
814
|
+
(0, import_react9.useEffect)(() => {
|
|
815
|
+
if (!initialValues)
|
|
816
|
+
return;
|
|
817
|
+
form.setFieldsValue(initialValues);
|
|
818
|
+
setInitialValues(null);
|
|
815
819
|
}, [computedProps]);
|
|
816
820
|
if (!computedProps)
|
|
817
821
|
return null;
|
|
818
|
-
return /* @__PURE__ */ (0,
|
|
822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
|
|
819
823
|
...computedProps,
|
|
820
824
|
onValuesChange,
|
|
821
825
|
children: [
|
|
822
826
|
computedProps.beforeItems,
|
|
823
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0,
|
|
827
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
824
828
|
...item,
|
|
825
829
|
extendTypes
|
|
826
830
|
}, item.id)),
|
|
827
831
|
computedProps.children,
|
|
828
|
-
computedProps.submit !== false && /* @__PURE__ */ (0,
|
|
832
|
+
computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
|
|
829
833
|
htmlType: "submit",
|
|
830
834
|
type: "primary",
|
|
831
835
|
loading,
|
|
@@ -840,7 +844,7 @@ Form.useForm = import_antd6.Form.useForm;
|
|
|
840
844
|
// src/Link.tsx
|
|
841
845
|
var import_react_router_dom = require("react-router-dom");
|
|
842
846
|
var import_antd7 = require("antd");
|
|
843
|
-
var
|
|
847
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
844
848
|
function Link({
|
|
845
849
|
href,
|
|
846
850
|
target,
|
|
@@ -853,9 +857,9 @@ function Link({
|
|
|
853
857
|
style = Object.assign({ cursor: "pointer" }, style);
|
|
854
858
|
if (href.startsWith("http")) {
|
|
855
859
|
if (button)
|
|
856
|
-
return /* @__PURE__ */ (0,
|
|
860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
|
|
857
861
|
...button,
|
|
858
|
-
children: /* @__PURE__ */ (0,
|
|
862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
859
863
|
href,
|
|
860
864
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
861
865
|
style: {
|
|
@@ -865,7 +869,7 @@ function Link({
|
|
|
865
869
|
children: text || children
|
|
866
870
|
})
|
|
867
871
|
});
|
|
868
|
-
return /* @__PURE__ */ (0,
|
|
872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
869
873
|
href,
|
|
870
874
|
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
871
875
|
style: {
|
|
@@ -876,9 +880,9 @@ function Link({
|
|
|
876
880
|
});
|
|
877
881
|
}
|
|
878
882
|
if (button)
|
|
879
|
-
return /* @__PURE__ */ (0,
|
|
883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
|
|
880
884
|
...button,
|
|
881
|
-
children: /* @__PURE__ */ (0,
|
|
885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
882
886
|
to: href,
|
|
883
887
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
884
888
|
style: {
|
|
@@ -888,7 +892,7 @@ function Link({
|
|
|
888
892
|
children: text || children
|
|
889
893
|
})
|
|
890
894
|
});
|
|
891
|
-
return /* @__PURE__ */ (0,
|
|
895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
892
896
|
to: href,
|
|
893
897
|
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
894
898
|
style: {
|
|
@@ -902,7 +906,7 @@ function Link({
|
|
|
902
906
|
// src/Modal.tsx
|
|
903
907
|
var import_antd8 = require("antd");
|
|
904
908
|
var import_react10 = require("react");
|
|
905
|
-
var
|
|
909
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
906
910
|
function useModal(init) {
|
|
907
911
|
const [props, setProps] = (0, import_react10.useState)({
|
|
908
912
|
open: false,
|
|
@@ -913,7 +917,7 @@ function useModal(init) {
|
|
|
913
917
|
...init
|
|
914
918
|
});
|
|
915
919
|
return {
|
|
916
|
-
modal: /* @__PURE__ */ (0,
|
|
920
|
+
modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
|
|
917
921
|
...props
|
|
918
922
|
}),
|
|
919
923
|
modalProps: props,
|
|
@@ -930,32 +934,32 @@ function useModal(init) {
|
|
|
930
934
|
var import_antd9 = require("antd");
|
|
931
935
|
var import_react11 = require("react");
|
|
932
936
|
var import_react_router_dom2 = require("react-router-dom");
|
|
933
|
-
var
|
|
937
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
934
938
|
function PageNotFound() {
|
|
935
939
|
const config = useConfigContext();
|
|
936
|
-
return /* @__PURE__ */ (0,
|
|
940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
|
|
937
941
|
status: "404",
|
|
938
942
|
title: config.common.pageNotFound
|
|
939
943
|
});
|
|
940
944
|
}
|
|
941
945
|
function Routes(props) {
|
|
942
|
-
return /* @__PURE__ */ (0,
|
|
946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
|
|
943
947
|
children: [
|
|
944
|
-
props.routes.map((r) => /* @__PURE__ */ (0,
|
|
948
|
+
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
|
|
945
949
|
...r,
|
|
946
|
-
element: r.element || /* @__PURE__ */ (0,
|
|
947
|
-
fallback: props.fallback || /* @__PURE__ */ (0,
|
|
950
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
|
|
951
|
+
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
948
952
|
style: { padding: "24px" },
|
|
949
|
-
children: /* @__PURE__ */ (0,
|
|
953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
|
|
950
954
|
active: true
|
|
951
955
|
})
|
|
952
956
|
}),
|
|
953
|
-
children: /* @__PURE__ */ (0,
|
|
957
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
|
|
954
958
|
})
|
|
955
959
|
}, r.path)),
|
|
956
|
-
/* @__PURE__ */ (0,
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
|
|
957
961
|
path: "*",
|
|
958
|
-
element: props.notFound || /* @__PURE__ */ (0,
|
|
962
|
+
element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
|
|
959
963
|
}, "*")
|
|
960
964
|
]
|
|
961
965
|
});
|
|
@@ -968,12 +972,12 @@ var import_dayjs4 = __toESM(require("dayjs"));
|
|
|
968
972
|
var import_icons3 = require("@ant-design/icons");
|
|
969
973
|
var import_lodash6 = require("lodash");
|
|
970
974
|
var import_react13 = require("@faasjs/react");
|
|
971
|
-
var
|
|
975
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
972
976
|
function processValue(item, value) {
|
|
973
977
|
var _a;
|
|
974
978
|
const transferred = transferValue(item.type, value);
|
|
975
979
|
if (transferred === null || Array.isArray(transferred) && transferred.length === 0)
|
|
976
|
-
return /* @__PURE__ */ (0,
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
977
981
|
if (item.options) {
|
|
978
982
|
if (item.type.endsWith("[]"))
|
|
979
983
|
return transferred.map((v) => {
|
|
@@ -1046,7 +1050,7 @@ function Table(props) {
|
|
|
1046
1050
|
setSelectedKeys,
|
|
1047
1051
|
confirm,
|
|
1048
1052
|
clearFilters
|
|
1049
|
-
}) => /* @__PURE__ */ (0,
|
|
1053
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
|
|
1050
1054
|
placeholder: `${common2.search} ${item.title}`,
|
|
1051
1055
|
allowClear: true,
|
|
1052
1056
|
onSearch: (v) => {
|
|
@@ -1074,7 +1078,7 @@ function Table(props) {
|
|
|
1074
1078
|
setSelectedKeys,
|
|
1075
1079
|
confirm,
|
|
1076
1080
|
clearFilters
|
|
1077
|
-
}) => /* @__PURE__ */ (0,
|
|
1081
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
|
|
1078
1082
|
placeholder: `${common2.search} ${item.title}`,
|
|
1079
1083
|
allowClear: true,
|
|
1080
1084
|
onSearch: (v) => {
|
|
@@ -1100,7 +1104,7 @@ function Table(props) {
|
|
|
1100
1104
|
setSelectedKeys,
|
|
1101
1105
|
confirm,
|
|
1102
1106
|
clearFilters
|
|
1103
|
-
}) => /* @__PURE__ */ (0,
|
|
1107
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
|
|
1104
1108
|
placeholder: `${common2.search} ${item.title}`,
|
|
1105
1109
|
allowClear: true,
|
|
1106
1110
|
onSearch: (v) => {
|
|
@@ -1124,7 +1128,7 @@ function Table(props) {
|
|
|
1124
1128
|
setSelectedKeys,
|
|
1125
1129
|
confirm,
|
|
1126
1130
|
clearFilters
|
|
1127
|
-
}) => /* @__PURE__ */ (0,
|
|
1131
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Input.Search, {
|
|
1128
1132
|
placeholder: `${common2.search} ${item.title}`,
|
|
1129
1133
|
allowClear: true,
|
|
1130
1134
|
onSearch: (v) => {
|
|
@@ -1140,12 +1144,12 @@ function Table(props) {
|
|
|
1140
1144
|
break;
|
|
1141
1145
|
case "boolean":
|
|
1142
1146
|
if (!item.render)
|
|
1143
|
-
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0,
|
|
1147
|
+
item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {}) : value ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
|
|
1144
1148
|
style: {
|
|
1145
1149
|
marginTop: "4px",
|
|
1146
1150
|
color: "#52c41a"
|
|
1147
1151
|
}
|
|
1148
|
-
}) : /* @__PURE__ */ (0,
|
|
1152
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
|
|
1149
1153
|
style: {
|
|
1150
1154
|
marginTop: "4px",
|
|
1151
1155
|
color: "#ff4d4f"
|
|
@@ -1156,7 +1160,7 @@ function Table(props) {
|
|
|
1156
1160
|
setSelectedKeys,
|
|
1157
1161
|
selectedKeys,
|
|
1158
1162
|
confirm
|
|
1159
|
-
}) => /* @__PURE__ */ (0,
|
|
1163
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
|
|
1160
1164
|
style: { padding: 8 },
|
|
1161
1165
|
buttonStyle: "solid",
|
|
1162
1166
|
value: selectedKeys[0],
|
|
@@ -1165,28 +1169,28 @@ function Table(props) {
|
|
|
1165
1169
|
confirm();
|
|
1166
1170
|
},
|
|
1167
1171
|
children: [
|
|
1168
|
-
/* @__PURE__ */ (0,
|
|
1172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
|
|
1169
1173
|
children: common2.all
|
|
1170
1174
|
}),
|
|
1171
|
-
/* @__PURE__ */ (0,
|
|
1175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
|
|
1172
1176
|
value: "true",
|
|
1173
|
-
children: /* @__PURE__ */ (0,
|
|
1177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
|
|
1174
1178
|
style: {
|
|
1175
1179
|
color: "#52c41a",
|
|
1176
1180
|
verticalAlign: "middle"
|
|
1177
1181
|
}
|
|
1178
1182
|
})
|
|
1179
1183
|
}),
|
|
1180
|
-
/* @__PURE__ */ (0,
|
|
1184
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
|
|
1181
1185
|
value: "false",
|
|
1182
|
-
children: /* @__PURE__ */ (0,
|
|
1186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
|
|
1183
1187
|
style: {
|
|
1184
1188
|
verticalAlign: "middle",
|
|
1185
1189
|
color: "#ff4d4f"
|
|
1186
1190
|
}
|
|
1187
1191
|
})
|
|
1188
1192
|
}),
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
|
|
1190
1194
|
value: "empty",
|
|
1191
1195
|
children: common2.blank
|
|
1192
1196
|
})
|
|
@@ -1224,7 +1228,7 @@ function Table(props) {
|
|
|
1224
1228
|
break;
|
|
1225
1229
|
case "object":
|
|
1226
1230
|
if (!item.render)
|
|
1227
|
-
item.render = (value) => /* @__PURE__ */ (0,
|
|
1231
|
+
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
1228
1232
|
items: item.object,
|
|
1229
1233
|
dataSource: value,
|
|
1230
1234
|
column: 1
|
|
@@ -1232,7 +1236,7 @@ function Table(props) {
|
|
|
1232
1236
|
break;
|
|
1233
1237
|
case "object[]":
|
|
1234
1238
|
if (!item.render)
|
|
1235
|
-
item.render = (value) => value.map((v, i) => /* @__PURE__ */ (0,
|
|
1239
|
+
item.render = (value) => value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
1236
1240
|
items: item.object,
|
|
1237
1241
|
dataSource: v,
|
|
1238
1242
|
column: 1
|
|
@@ -1268,14 +1272,14 @@ function Table(props) {
|
|
|
1268
1272
|
if (!columns)
|
|
1269
1273
|
return null;
|
|
1270
1274
|
if (!props.faasData)
|
|
1271
|
-
return /* @__PURE__ */ (0,
|
|
1275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
|
|
1272
1276
|
...props,
|
|
1273
1277
|
rowKey: props.rowKey || "id",
|
|
1274
1278
|
columns,
|
|
1275
1279
|
dataSource: props.dataSource
|
|
1276
1280
|
});
|
|
1277
|
-
return /* @__PURE__ */ (0,
|
|
1278
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0,
|
|
1281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
|
|
1282
|
+
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
|
|
1279
1283
|
active: true
|
|
1280
1284
|
}),
|
|
1281
1285
|
render: ({
|
|
@@ -1284,20 +1288,20 @@ function Table(props) {
|
|
|
1284
1288
|
reload
|
|
1285
1289
|
}) => {
|
|
1286
1290
|
if (!data)
|
|
1287
|
-
return /* @__PURE__ */ (0,
|
|
1291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
|
|
1288
1292
|
...props,
|
|
1289
1293
|
rowKey: props.rowKey || "id",
|
|
1290
1294
|
columns,
|
|
1291
1295
|
dataSource: []
|
|
1292
1296
|
});
|
|
1293
1297
|
if (Array.isArray(data))
|
|
1294
|
-
return /* @__PURE__ */ (0,
|
|
1298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
|
|
1295
1299
|
...props,
|
|
1296
1300
|
rowKey: props.rowKey || "id",
|
|
1297
1301
|
columns,
|
|
1298
1302
|
dataSource: data
|
|
1299
1303
|
});
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
|
|
1301
1305
|
...props,
|
|
1302
1306
|
rowKey: props.rowKey || "id",
|
|
1303
1307
|
columns,
|
|
@@ -1333,7 +1337,7 @@ function Table(props) {
|
|
|
1333
1337
|
// src/Title.tsx
|
|
1334
1338
|
var import_react14 = require("react");
|
|
1335
1339
|
var import_antd11 = require("antd");
|
|
1336
|
-
var
|
|
1340
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1337
1341
|
function Title(props) {
|
|
1338
1342
|
const { Title: Title2 } = useConfigContext();
|
|
1339
1343
|
(0, import_react14.useEffect)(() => {
|
|
@@ -1342,21 +1346,21 @@ function Title(props) {
|
|
|
1342
1346
|
}, [props]);
|
|
1343
1347
|
if (props.h1) {
|
|
1344
1348
|
if (typeof props.h1 === "boolean")
|
|
1345
|
-
return /* @__PURE__ */ (0,
|
|
1349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
1346
1350
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1347
1351
|
});
|
|
1348
|
-
return /* @__PURE__ */ (0,
|
|
1352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
1349
1353
|
className: props.h1.className,
|
|
1350
1354
|
style: props.h1.style,
|
|
1351
1355
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1352
1356
|
});
|
|
1353
1357
|
}
|
|
1354
1358
|
if (props.plain)
|
|
1355
|
-
return /* @__PURE__ */ (0,
|
|
1359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
1356
1360
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1357
1361
|
});
|
|
1358
1362
|
if (props.header)
|
|
1359
|
-
return /* @__PURE__ */ (0,
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.PageHeader, {
|
|
1360
1364
|
title: Array.isArray(props.title) ? props.title[0] : props.title,
|
|
1361
1365
|
...props.header
|
|
1362
1366
|
});
|