@faasjs/ant-design 0.0.3-beta.31 → 0.0.3-beta.33
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/README.md +120 -23
- package/dist/index.d.ts +175 -121
- package/dist/index.js +183 -95
- package/dist/index.mjs +268 -182
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30,7 +30,8 @@ __export(src_exports, {
|
|
|
30
30
|
ConfigContext: () => ConfigContext,
|
|
31
31
|
ConfigProvider: () => ConfigProvider,
|
|
32
32
|
Description: () => Description,
|
|
33
|
-
Drawer: () =>
|
|
33
|
+
Drawer: () => import_antd4.Drawer,
|
|
34
|
+
ErrorBoundary: () => ErrorBoundary,
|
|
34
35
|
FaasDataWrapper: () => FaasDataWrapper,
|
|
35
36
|
Form: () => Form,
|
|
36
37
|
FormItem: () => FormItem,
|
|
@@ -163,7 +164,7 @@ function transferValue(type, value) {
|
|
|
163
164
|
|
|
164
165
|
// src/Description.tsx
|
|
165
166
|
var import_icons = require("@ant-design/icons");
|
|
166
|
-
var
|
|
167
|
+
var import_antd3 = require("antd");
|
|
167
168
|
var import_lodash_es4 = require("lodash-es");
|
|
168
169
|
var import_react4 = require("react");
|
|
169
170
|
|
|
@@ -174,6 +175,10 @@ var import_react3 = require("@faasjs/react");
|
|
|
174
175
|
var import_antd2 = require("antd");
|
|
175
176
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
176
177
|
function Loading(props) {
|
|
178
|
+
if (props.loading === false)
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
180
|
+
children: props.children
|
|
181
|
+
});
|
|
177
182
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
178
183
|
style: {
|
|
179
184
|
...props.style || {},
|
|
@@ -189,14 +194,13 @@ function Loading(props) {
|
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
// src/FaasDataWrapper.tsx
|
|
192
|
-
var import_antd3 = require("antd");
|
|
193
197
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
194
198
|
function FaasDataWrapper(props) {
|
|
195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react3.FaasDataWrapper, {
|
|
200
|
+
fallback: props.loading || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {
|
|
201
|
+
...props.loadingProps
|
|
202
|
+
}),
|
|
203
|
+
...props
|
|
200
204
|
});
|
|
201
205
|
}
|
|
202
206
|
|
|
@@ -238,25 +242,37 @@ function DescriptionItemContent(props) {
|
|
|
238
242
|
return (0, import_react4.cloneElement)(
|
|
239
243
|
computedProps.extendTypes[computedProps.item.type].children,
|
|
240
244
|
{
|
|
245
|
+
scene: "description",
|
|
241
246
|
value: computedProps.value,
|
|
242
247
|
values: computedProps.values
|
|
243
248
|
}
|
|
244
249
|
);
|
|
245
250
|
else if (computedProps.extendTypes[computedProps.item.type].render)
|
|
246
251
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
247
|
-
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values)
|
|
252
|
+
children: computedProps.extendTypes[computedProps.item.type].render(computedProps.value, computedProps.values, 0, "description")
|
|
248
253
|
});
|
|
249
254
|
else
|
|
250
255
|
throw Error(computedProps.item.type + " requires children or render");
|
|
256
|
+
if (computedProps.item.descriptionChildren === null)
|
|
257
|
+
return null;
|
|
258
|
+
if (computedProps.item.descriptionChildren)
|
|
259
|
+
return (0, import_react4.cloneElement)(computedProps.item.descriptionChildren, {
|
|
260
|
+
scene: "description",
|
|
261
|
+
value: computedProps.value,
|
|
262
|
+
values: computedProps.values
|
|
263
|
+
});
|
|
264
|
+
if (computedProps.item.children === null)
|
|
265
|
+
return null;
|
|
251
266
|
if (computedProps.item.children)
|
|
252
267
|
return (0, import_react4.cloneElement)(computedProps.item.children, {
|
|
268
|
+
scene: "description",
|
|
253
269
|
value: computedProps.value,
|
|
254
270
|
values: computedProps.values
|
|
255
271
|
});
|
|
272
|
+
if (computedProps.item.descriptionRender)
|
|
273
|
+
return computedProps.item.descriptionRender(computedProps.value, computedProps.values, 0, "description");
|
|
256
274
|
if (computedProps.item.render)
|
|
257
|
-
return
|
|
258
|
-
children: computedProps.item.render(computedProps.value, computedProps.values)
|
|
259
|
-
});
|
|
275
|
+
return computedProps.item.render(computedProps.value, computedProps.values, 0, "description");
|
|
260
276
|
if (computedProps.value === null || Array.isArray(computedProps.value) && !computedProps.value.length)
|
|
261
277
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
262
278
|
switch (computedProps.item.type) {
|
|
@@ -301,7 +317,7 @@ function DescriptionItemContent(props) {
|
|
|
301
317
|
case "object[]":
|
|
302
318
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
303
319
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
|
|
305
321
|
direction: "vertical",
|
|
306
322
|
children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
307
323
|
items: computedProps.item.object,
|
|
@@ -315,11 +331,11 @@ function DescriptionItemContent(props) {
|
|
|
315
331
|
}
|
|
316
332
|
function Description(props) {
|
|
317
333
|
if (!props.faasData)
|
|
318
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
319
335
|
...props,
|
|
320
336
|
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
321
337
|
children: props.items.map((item) => {
|
|
322
|
-
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
338
|
+
return !item.if || item.if(props.dataSource) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
323
339
|
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
324
340
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
325
341
|
item,
|
|
@@ -331,15 +347,12 @@ function Description(props) {
|
|
|
331
347
|
}).filter(Boolean)
|
|
332
348
|
});
|
|
333
349
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
|
|
334
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Skeleton, {
|
|
335
|
-
active: true
|
|
336
|
-
}),
|
|
337
350
|
render: ({ data }) => {
|
|
338
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
339
352
|
...props,
|
|
340
353
|
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
341
354
|
children: props.items.map((item) => {
|
|
342
|
-
return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
355
|
+
return !item.if || item.if(data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
|
|
343
356
|
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
344
357
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
345
358
|
item,
|
|
@@ -356,7 +369,7 @@ function Description(props) {
|
|
|
356
369
|
}
|
|
357
370
|
|
|
358
371
|
// src/Drawer.tsx
|
|
359
|
-
var
|
|
372
|
+
var import_antd4 = require("antd");
|
|
360
373
|
var import_react5 = require("react");
|
|
361
374
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
362
375
|
function useDrawer(init) {
|
|
@@ -369,7 +382,7 @@ function useDrawer(init) {
|
|
|
369
382
|
...init
|
|
370
383
|
});
|
|
371
384
|
return {
|
|
372
|
-
drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
385
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
|
|
373
386
|
...props
|
|
374
387
|
}),
|
|
375
388
|
drawerProps: props,
|
|
@@ -382,15 +395,62 @@ function useDrawer(init) {
|
|
|
382
395
|
};
|
|
383
396
|
}
|
|
384
397
|
|
|
398
|
+
// src/ErrorBoundary.tsx
|
|
399
|
+
var import_react6 = require("react");
|
|
400
|
+
var import_antd5 = require("antd");
|
|
401
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
402
|
+
var ErrorBoundary = class extends import_react6.Component {
|
|
403
|
+
constructor(props) {
|
|
404
|
+
super(props);
|
|
405
|
+
this.state = {
|
|
406
|
+
error: void 0,
|
|
407
|
+
info: { componentStack: "" }
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
componentDidCatch(error, info) {
|
|
411
|
+
this.setState({
|
|
412
|
+
error,
|
|
413
|
+
info
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
render() {
|
|
417
|
+
const {
|
|
418
|
+
message,
|
|
419
|
+
description,
|
|
420
|
+
children
|
|
421
|
+
} = this.props;
|
|
422
|
+
const { error, info } = this.state;
|
|
423
|
+
const componentStack = info && info.componentStack ? info.componentStack : null;
|
|
424
|
+
const errorMessage = typeof message === "undefined" ? (error || "").toString() : message;
|
|
425
|
+
const errorDescription = typeof description === "undefined" ? componentStack : description;
|
|
426
|
+
if (error) {
|
|
427
|
+
if (this.props.onError)
|
|
428
|
+
return this.props.onError(error, info);
|
|
429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Alert, {
|
|
430
|
+
type: "error",
|
|
431
|
+
message: errorMessage,
|
|
432
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
|
|
433
|
+
style: {
|
|
434
|
+
fontSize: "0.9em",
|
|
435
|
+
overflowX: "auto"
|
|
436
|
+
},
|
|
437
|
+
children: errorDescription
|
|
438
|
+
})
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
return children;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
|
|
385
445
|
// src/Form.tsx
|
|
386
|
-
var
|
|
446
|
+
var import_react8 = require("@faasjs/react");
|
|
387
447
|
var import_antd7 = require("antd");
|
|
388
|
-
var
|
|
448
|
+
var import_react9 = require("react");
|
|
389
449
|
|
|
390
450
|
// src/FormItem.tsx
|
|
391
451
|
var import_antd6 = require("antd");
|
|
392
452
|
var import_icons2 = require("@ant-design/icons");
|
|
393
|
-
var
|
|
453
|
+
var import_react7 = require("react");
|
|
394
454
|
var import_lodash_es5 = require("lodash-es");
|
|
395
455
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
396
456
|
function processProps(propsCopy, config) {
|
|
@@ -441,11 +501,11 @@ function processProps(propsCopy, config) {
|
|
|
441
501
|
}
|
|
442
502
|
function FormItem(props) {
|
|
443
503
|
var _a;
|
|
444
|
-
const [computedProps, setComputedProps] = (0,
|
|
445
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
504
|
+
const [computedProps, setComputedProps] = (0, import_react7.useState)();
|
|
505
|
+
const [extendTypes, setExtendTypes] = (0, import_react7.useState)();
|
|
446
506
|
const { common: common2 } = useConfigContext();
|
|
447
|
-
const [hidden, setHidden] = (0,
|
|
448
|
-
(0,
|
|
507
|
+
const [hidden, setHidden] = (0, import_react7.useState)(props.hidden || false);
|
|
508
|
+
(0, import_react7.useEffect)(() => {
|
|
449
509
|
const propsCopy = { ...props };
|
|
450
510
|
if (propsCopy.extendTypes) {
|
|
451
511
|
setExtendTypes(propsCopy.extendTypes);
|
|
@@ -482,15 +542,29 @@ function FormItem(props) {
|
|
|
482
542
|
...computedProps,
|
|
483
543
|
children: extendTypes[computedProps.type].children
|
|
484
544
|
});
|
|
545
|
+
if (computedProps.formChildren === null)
|
|
546
|
+
return null;
|
|
547
|
+
if (computedProps.formChildren)
|
|
548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
549
|
+
...computedProps,
|
|
550
|
+
children: (0, import_react7.cloneElement)(computedProps.formChildren, { scene: "form" })
|
|
551
|
+
});
|
|
552
|
+
if (computedProps.children === null)
|
|
553
|
+
return null;
|
|
485
554
|
if (computedProps.children)
|
|
486
555
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
487
556
|
...computedProps,
|
|
488
|
-
children: computedProps.children
|
|
557
|
+
children: (0, import_react7.cloneElement)(computedProps.children, { scene: "form" })
|
|
558
|
+
});
|
|
559
|
+
if (computedProps.formRender)
|
|
560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
561
|
+
...computedProps,
|
|
562
|
+
children: computedProps.formRender(null, null, 0, "form")
|
|
489
563
|
});
|
|
490
564
|
if (computedProps.render)
|
|
491
565
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
492
566
|
...computedProps,
|
|
493
|
-
children: computedProps.render()
|
|
567
|
+
children: computedProps.render(null, null, 0, "form")
|
|
494
568
|
});
|
|
495
569
|
switch (computedProps.type) {
|
|
496
570
|
case "string":
|
|
@@ -759,13 +833,13 @@ FormItem.useStatus = import_antd6.Form.Item.useStatus;
|
|
|
759
833
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
760
834
|
function Form(props) {
|
|
761
835
|
var _a, _b;
|
|
762
|
-
const [loading, setLoading] = (0,
|
|
763
|
-
const [computedProps, setComputedProps] = (0,
|
|
836
|
+
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
837
|
+
const [computedProps, setComputedProps] = (0, import_react9.useState)();
|
|
764
838
|
const config = useConfigContext();
|
|
765
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
839
|
+
const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
|
|
766
840
|
const [form] = import_antd7.Form.useForm(props.form);
|
|
767
|
-
const [initialValues, setInitialValues] = (0,
|
|
768
|
-
(0,
|
|
841
|
+
const [initialValues, setInitialValues] = (0, import_react9.useState)(props.initialValues);
|
|
842
|
+
(0, import_react9.useEffect)(() => {
|
|
769
843
|
var _a2, _b2, _c;
|
|
770
844
|
const propsCopy = {
|
|
771
845
|
...props,
|
|
@@ -794,7 +868,7 @@ function Form(props) {
|
|
|
794
868
|
setLoading(true);
|
|
795
869
|
try {
|
|
796
870
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
797
|
-
await props.onFinish(values, async (values2) => (0,
|
|
871
|
+
await props.onFinish(values, async (values2) => (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
798
872
|
...values2,
|
|
799
873
|
...propsCopy.submit.to.params
|
|
800
874
|
} : values2));
|
|
@@ -808,7 +882,7 @@ function Form(props) {
|
|
|
808
882
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
809
883
|
propsCopy.onFinish = async (values) => {
|
|
810
884
|
setLoading(true);
|
|
811
|
-
return (0,
|
|
885
|
+
return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
812
886
|
...values,
|
|
813
887
|
...propsCopy.submit.to.params
|
|
814
888
|
} : values).then((result) => {
|
|
@@ -832,7 +906,7 @@ function Form(props) {
|
|
|
832
906
|
}
|
|
833
907
|
setComputedProps(propsCopy);
|
|
834
908
|
}, [props]);
|
|
835
|
-
const onValuesChange = (0,
|
|
909
|
+
const onValuesChange = (0, import_react9.useCallback)((changedValues, allValues) => {
|
|
836
910
|
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
837
911
|
if (props.onValuesChange) {
|
|
838
912
|
props.onValuesChange(changedValues, allValues);
|
|
@@ -845,7 +919,7 @@ function Form(props) {
|
|
|
845
919
|
item.onValueChange(changedValues[key], allValues, form);
|
|
846
920
|
}
|
|
847
921
|
}, [computedProps]);
|
|
848
|
-
(0,
|
|
922
|
+
(0, import_react9.useEffect)(() => {
|
|
849
923
|
if (!initialValues)
|
|
850
924
|
return;
|
|
851
925
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -859,7 +933,7 @@ function Form(props) {
|
|
|
859
933
|
onValuesChange,
|
|
860
934
|
children: [
|
|
861
935
|
computedProps.beforeItems,
|
|
862
|
-
(_a = computedProps.items) == null ? void 0 : _a.map((item) => (0,
|
|
936
|
+
(_a = computedProps.items) == null ? void 0 : _a.map((item) => (0, import_react9.isValidElement)(item) ? item : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
|
|
863
937
|
...item,
|
|
864
938
|
extendTypes
|
|
865
939
|
}, item.id)),
|
|
@@ -886,68 +960,67 @@ Form.Provider = import_antd7.Form.Provider;
|
|
|
886
960
|
var import_react_router_dom = require("react-router-dom");
|
|
887
961
|
var import_antd8 = require("antd");
|
|
888
962
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
889
|
-
function Link({
|
|
890
|
-
|
|
891
|
-
target,
|
|
892
|
-
text,
|
|
893
|
-
children,
|
|
894
|
-
style,
|
|
895
|
-
button
|
|
896
|
-
}) {
|
|
963
|
+
function Link(props) {
|
|
964
|
+
var _a, _b, _c, _d;
|
|
897
965
|
const { Link: Link2 } = useConfigContext();
|
|
898
|
-
style = Object.assign({ cursor: "pointer" }, style);
|
|
899
|
-
if (
|
|
900
|
-
|
|
966
|
+
props.style = Object.assign({ cursor: "pointer" }, props.style);
|
|
967
|
+
if (props.block)
|
|
968
|
+
props.style = Object.assign({
|
|
969
|
+
display: "block",
|
|
970
|
+
width: "100%"
|
|
971
|
+
}, props.style);
|
|
972
|
+
if (props.href.startsWith("http")) {
|
|
973
|
+
if (props.button)
|
|
901
974
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
|
|
902
|
-
...button,
|
|
903
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
975
|
+
...props.button,
|
|
976
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
904
977
|
style: {
|
|
905
978
|
...Link2.style,
|
|
906
|
-
...style || {}
|
|
979
|
+
...props.style || {}
|
|
907
980
|
},
|
|
908
|
-
href,
|
|
909
|
-
children: text != null ?
|
|
981
|
+
href: props.href,
|
|
982
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
910
983
|
});
|
|
911
984
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
912
|
-
href,
|
|
913
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
985
|
+
href: props.href,
|
|
986
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
914
987
|
style: {
|
|
915
988
|
...Link2.style,
|
|
916
|
-
...style || {}
|
|
989
|
+
...props.style || {}
|
|
917
990
|
},
|
|
918
|
-
children: text != null ?
|
|
991
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
919
992
|
});
|
|
920
993
|
}
|
|
921
|
-
if (button)
|
|
994
|
+
if (props.button)
|
|
922
995
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
923
|
-
to: href,
|
|
924
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
996
|
+
to: props.href,
|
|
997
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
925
998
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
|
|
926
|
-
...button,
|
|
999
|
+
...props.button,
|
|
927
1000
|
style: {
|
|
928
1001
|
...Link2.style,
|
|
929
|
-
...style || {}
|
|
1002
|
+
...props.style || {}
|
|
930
1003
|
},
|
|
931
|
-
children: text != null ?
|
|
1004
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
932
1005
|
})
|
|
933
1006
|
});
|
|
934
1007
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
935
|
-
to: href,
|
|
936
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
1008
|
+
to: props.href,
|
|
1009
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
937
1010
|
style: {
|
|
938
1011
|
...Link2.style,
|
|
939
|
-
...style || {}
|
|
1012
|
+
...props.style || {}
|
|
940
1013
|
},
|
|
941
|
-
children: text != null ?
|
|
1014
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
942
1015
|
});
|
|
943
1016
|
}
|
|
944
1017
|
|
|
945
1018
|
// src/Modal.tsx
|
|
946
1019
|
var import_antd9 = require("antd");
|
|
947
|
-
var
|
|
1020
|
+
var import_react10 = require("react");
|
|
948
1021
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
949
1022
|
function useModal(init) {
|
|
950
|
-
const [props, setProps] = (0,
|
|
1023
|
+
const [props, setProps] = (0, import_react10.useState)({
|
|
951
1024
|
open: false,
|
|
952
1025
|
onCancel: () => setProps((prev) => ({
|
|
953
1026
|
...prev,
|
|
@@ -971,7 +1044,7 @@ function useModal(init) {
|
|
|
971
1044
|
|
|
972
1045
|
// src/Routers.tsx
|
|
973
1046
|
var import_antd10 = require("antd");
|
|
974
|
-
var
|
|
1047
|
+
var import_react11 = require("react");
|
|
975
1048
|
var import_react_router_dom2 = require("react-router-dom");
|
|
976
1049
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
977
1050
|
function PageNotFound() {
|
|
@@ -987,7 +1060,7 @@ function Routes(props) {
|
|
|
987
1060
|
children: [
|
|
988
1061
|
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
|
|
989
1062
|
...r,
|
|
990
|
-
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1063
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
|
|
991
1064
|
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
992
1065
|
style: { padding: "24px" },
|
|
993
1066
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
|
|
@@ -1007,7 +1080,7 @@ function Routes(props) {
|
|
|
1007
1080
|
}
|
|
1008
1081
|
|
|
1009
1082
|
// src/Table.tsx
|
|
1010
|
-
var
|
|
1083
|
+
var import_react12 = require("react");
|
|
1011
1084
|
var import_antd11 = require("antd");
|
|
1012
1085
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1013
1086
|
var import_icons3 = require("@ant-design/icons");
|
|
@@ -1038,9 +1111,9 @@ function processValue(item, value) {
|
|
|
1038
1111
|
return value;
|
|
1039
1112
|
}
|
|
1040
1113
|
function Table(props) {
|
|
1041
|
-
const [columns, setColumns] = (0,
|
|
1114
|
+
const [columns, setColumns] = (0, import_react12.useState)();
|
|
1042
1115
|
const { common: common2 } = useConfigContext();
|
|
1043
|
-
(0,
|
|
1116
|
+
(0, import_react12.useEffect)(() => {
|
|
1044
1117
|
var _a;
|
|
1045
1118
|
for (const item of props.items) {
|
|
1046
1119
|
if (!item.key)
|
|
@@ -1061,19 +1134,34 @@ function Table(props) {
|
|
|
1061
1134
|
value: null
|
|
1062
1135
|
});
|
|
1063
1136
|
}
|
|
1064
|
-
if (item.
|
|
1065
|
-
item.render = (
|
|
1137
|
+
if (item.tableChildren === null)
|
|
1138
|
+
item.render = () => null;
|
|
1139
|
+
else if (item.tableChildren)
|
|
1140
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1141
|
+
item.tableChildren,
|
|
1142
|
+
{
|
|
1143
|
+
scene: "table",
|
|
1144
|
+
value,
|
|
1145
|
+
values
|
|
1146
|
+
}
|
|
1147
|
+
);
|
|
1148
|
+
else if (item.children === null)
|
|
1149
|
+
item.render = () => null;
|
|
1150
|
+
else if (item.children)
|
|
1151
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1066
1152
|
item.children,
|
|
1067
1153
|
{
|
|
1154
|
+
scene: "table",
|
|
1068
1155
|
value,
|
|
1069
1156
|
values
|
|
1070
1157
|
}
|
|
1071
1158
|
);
|
|
1072
1159
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1073
1160
|
if (props.extendTypes[item.type].children)
|
|
1074
|
-
item.render = (value, values) => (0,
|
|
1161
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1075
1162
|
props.extendTypes[item.type].children,
|
|
1076
1163
|
{
|
|
1164
|
+
scene: "table",
|
|
1077
1165
|
value,
|
|
1078
1166
|
values
|
|
1079
1167
|
}
|
|
@@ -1299,11 +1387,13 @@ function Table(props) {
|
|
|
1299
1387
|
break;
|
|
1300
1388
|
case "object[]":
|
|
1301
1389
|
if (!item.render)
|
|
1302
|
-
item.render = (value) =>
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1390
|
+
item.render = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
|
|
1391
|
+
children: value.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
1392
|
+
items: item.object,
|
|
1393
|
+
dataSource: v || [],
|
|
1394
|
+
column: 1
|
|
1395
|
+
}, i))
|
|
1396
|
+
});
|
|
1307
1397
|
break;
|
|
1308
1398
|
default:
|
|
1309
1399
|
if (!item.render)
|
|
@@ -1319,7 +1409,7 @@ function Table(props) {
|
|
|
1319
1409
|
}
|
|
1320
1410
|
setColumns(props.items);
|
|
1321
1411
|
}, [props.items]);
|
|
1322
|
-
(0,
|
|
1412
|
+
(0, import_react12.useEffect)(() => {
|
|
1323
1413
|
if (!props.dataSource || !columns)
|
|
1324
1414
|
return;
|
|
1325
1415
|
for (const column of columns) {
|
|
@@ -1351,9 +1441,6 @@ function Table(props) {
|
|
|
1351
1441
|
dataSource: props.dataSource
|
|
1352
1442
|
});
|
|
1353
1443
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
|
|
1354
|
-
fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd11.Skeleton, {
|
|
1355
|
-
active: true
|
|
1356
|
-
}),
|
|
1357
1444
|
...props.faasData,
|
|
1358
1445
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataTable, {
|
|
1359
1446
|
props,
|
|
@@ -1368,8 +1455,8 @@ function FaasDataTable({
|
|
|
1368
1455
|
params,
|
|
1369
1456
|
reload
|
|
1370
1457
|
}) {
|
|
1371
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
1372
|
-
(0,
|
|
1458
|
+
const [currentColumns, setCurrentColumns] = (0, import_react12.useState)(columns);
|
|
1459
|
+
(0, import_react12.useEffect)(() => {
|
|
1373
1460
|
if (!data || Array.isArray(data))
|
|
1374
1461
|
return;
|
|
1375
1462
|
setCurrentColumns((prev) => {
|
|
@@ -1449,11 +1536,11 @@ function FaasDataTable({
|
|
|
1449
1536
|
}
|
|
1450
1537
|
|
|
1451
1538
|
// src/Title.tsx
|
|
1452
|
-
var
|
|
1539
|
+
var import_react13 = require("react");
|
|
1453
1540
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1454
1541
|
function Title(props) {
|
|
1455
1542
|
const { Title: Title2 } = useConfigContext();
|
|
1456
|
-
(0,
|
|
1543
|
+
(0, import_react13.useEffect)(() => {
|
|
1457
1544
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1458
1545
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1459
1546
|
}, [props]);
|
|
@@ -1473,7 +1560,7 @@ function Title(props) {
|
|
|
1473
1560
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1474
1561
|
});
|
|
1475
1562
|
if (props.children)
|
|
1476
|
-
return (0,
|
|
1563
|
+
return (0, import_react13.cloneElement)(props.children, { title: props.title });
|
|
1477
1564
|
return null;
|
|
1478
1565
|
}
|
|
1479
1566
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1483,6 +1570,7 @@ function Title(props) {
|
|
|
1483
1570
|
ConfigProvider,
|
|
1484
1571
|
Description,
|
|
1485
1572
|
Drawer,
|
|
1573
|
+
ErrorBoundary,
|
|
1486
1574
|
FaasDataWrapper,
|
|
1487
1575
|
Form,
|
|
1488
1576
|
FormItem,
|