@faasjs/ant-design 0.0.3-beta.32 → 0.0.3-beta.34
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 +23 -5
- package/dist/index.js +127 -94
- package/dist/index.mjs +195 -163
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode, ReactElement, LazyExoticComponent, ComponentType } from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, ReactElement, Component, LazyExoticComponent, ComponentType } from 'react';
|
|
3
3
|
import { Dayjs } from 'dayjs';
|
|
4
4
|
import { FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, SelectProps, DatePickerProps, TimePickerProps, FormInstance, DescriptionsProps, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1, DrawerProps as DrawerProps$1, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1 } from 'antd';
|
|
5
5
|
export { Drawer, Modal } from 'antd';
|
|
@@ -152,10 +152,10 @@ type LoadingProps = {
|
|
|
152
152
|
*/
|
|
153
153
|
declare function Loading(props: LoadingProps): JSX.Element;
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
interface FaasDataWrapperProps<T = any> extends FaasDataWrapperProps$1<T> {
|
|
156
156
|
loadingProps?: LoadingProps;
|
|
157
157
|
loading?: JSX.Element;
|
|
158
|
-
}
|
|
158
|
+
}
|
|
159
159
|
/**
|
|
160
160
|
* FaasDataWrapper component with Loading and ErrorBoundary
|
|
161
161
|
*/
|
|
@@ -306,6 +306,23 @@ declare function useDrawer(init?: DrawerProps): {
|
|
|
306
306
|
setDrawerProps(changes: Partial<DrawerProps>): void;
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
+
interface ErrorBoundaryProps {
|
|
310
|
+
message?: ReactNode;
|
|
311
|
+
description?: ReactNode;
|
|
312
|
+
children?: ReactNode;
|
|
313
|
+
onError?: (error: Error | null, info: any) => ReactNode;
|
|
314
|
+
}
|
|
315
|
+
declare class ErrorBoundary extends Component<ErrorBoundaryProps, {
|
|
316
|
+
error?: Error | null;
|
|
317
|
+
info?: {
|
|
318
|
+
componentStack?: string;
|
|
319
|
+
};
|
|
320
|
+
}> {
|
|
321
|
+
constructor(props: ErrorBoundaryProps);
|
|
322
|
+
componentDidCatch(error: Error | null, info: any): void;
|
|
323
|
+
render(): string | number | boolean | react.ReactFragment | JSX.Element;
|
|
324
|
+
}
|
|
325
|
+
|
|
309
326
|
type FormSubmitProps = {
|
|
310
327
|
/** Default: Submit */
|
|
311
328
|
text?: string;
|
|
@@ -377,6 +394,7 @@ interface LinkProps {
|
|
|
377
394
|
children?: ReactNode;
|
|
378
395
|
style?: CSSProperties;
|
|
379
396
|
button?: ButtonProps;
|
|
397
|
+
block?: boolean;
|
|
380
398
|
}
|
|
381
399
|
/**
|
|
382
400
|
* Link component with button.
|
|
@@ -389,7 +407,7 @@ interface LinkProps {
|
|
|
389
407
|
* <Link href="/" button={{ type:'primary' }}>Home</Link>
|
|
390
408
|
* ```
|
|
391
409
|
*/
|
|
392
|
-
declare function Link(
|
|
410
|
+
declare function Link(props: LinkProps): JSX.Element;
|
|
393
411
|
|
|
394
412
|
interface ModalProps extends ModalProps$1 {
|
|
395
413
|
children?: JSX.Element | JSX.Element[] | string;
|
|
@@ -478,4 +496,4 @@ interface TitleProps {
|
|
|
478
496
|
*/
|
|
479
497
|
declare function Title(props: TitleProps): JSX.Element;
|
|
480
498
|
|
|
481
|
-
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|
|
499
|
+
export { BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ErrorBoundaryProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useConfigContext, useDrawer, useModal };
|
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
|
|
|
@@ -193,16 +194,13 @@ function Loading(props) {
|
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
// src/FaasDataWrapper.tsx
|
|
196
|
-
var import_antd3 = require("antd");
|
|
197
197
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
198
198
|
function FaasDataWrapper(props) {
|
|
199
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
...props
|
|
205
|
-
})
|
|
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
|
|
206
204
|
});
|
|
207
205
|
}
|
|
208
206
|
|
|
@@ -319,7 +317,7 @@ function DescriptionItemContent(props) {
|
|
|
319
317
|
case "object[]":
|
|
320
318
|
if (!((_a = computedProps.value) == null ? void 0 : _a.length))
|
|
321
319
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Blank, {});
|
|
322
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Space, {
|
|
323
321
|
direction: "vertical",
|
|
324
322
|
children: computedProps.value.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, {
|
|
325
323
|
items: computedProps.item.object,
|
|
@@ -333,11 +331,11 @@ function DescriptionItemContent(props) {
|
|
|
333
331
|
}
|
|
334
332
|
function Description(props) {
|
|
335
333
|
if (!props.faasData)
|
|
336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
337
335
|
...props,
|
|
338
336
|
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(props.dataSource) : props.title,
|
|
339
337
|
children: props.items.map((item) => {
|
|
340
|
-
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, {
|
|
341
339
|
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
342
340
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
343
341
|
item,
|
|
@@ -350,11 +348,11 @@ function Description(props) {
|
|
|
350
348
|
});
|
|
351
349
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FaasDataWrapper, {
|
|
352
350
|
render: ({ data }) => {
|
|
353
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
|
|
354
352
|
...props,
|
|
355
353
|
title: (0, import_lodash_es4.isFunction)(props.renderTitle) ? props.renderTitle(data) : props.title,
|
|
356
354
|
children: props.items.map((item) => {
|
|
357
|
-
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, {
|
|
358
356
|
label: item.title || (0, import_lodash_es4.upperFirst)(item.id),
|
|
359
357
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
|
|
360
358
|
item,
|
|
@@ -371,7 +369,7 @@ function Description(props) {
|
|
|
371
369
|
}
|
|
372
370
|
|
|
373
371
|
// src/Drawer.tsx
|
|
374
|
-
var
|
|
372
|
+
var import_antd4 = require("antd");
|
|
375
373
|
var import_react5 = require("react");
|
|
376
374
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
377
375
|
function useDrawer(init) {
|
|
@@ -384,7 +382,7 @@ function useDrawer(init) {
|
|
|
384
382
|
...init
|
|
385
383
|
});
|
|
386
384
|
return {
|
|
387
|
-
drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
385
|
+
drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
|
|
388
386
|
...props
|
|
389
387
|
}),
|
|
390
388
|
drawerProps: props,
|
|
@@ -397,15 +395,62 @@ function useDrawer(init) {
|
|
|
397
395
|
};
|
|
398
396
|
}
|
|
399
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
|
+
|
|
400
445
|
// src/Form.tsx
|
|
401
|
-
var
|
|
446
|
+
var import_react8 = require("@faasjs/react");
|
|
402
447
|
var import_antd7 = require("antd");
|
|
403
|
-
var
|
|
448
|
+
var import_react9 = require("react");
|
|
404
449
|
|
|
405
450
|
// src/FormItem.tsx
|
|
406
451
|
var import_antd6 = require("antd");
|
|
407
452
|
var import_icons2 = require("@ant-design/icons");
|
|
408
|
-
var
|
|
453
|
+
var import_react7 = require("react");
|
|
409
454
|
var import_lodash_es5 = require("lodash-es");
|
|
410
455
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
411
456
|
function processProps(propsCopy, config) {
|
|
@@ -456,11 +501,11 @@ function processProps(propsCopy, config) {
|
|
|
456
501
|
}
|
|
457
502
|
function FormItem(props) {
|
|
458
503
|
var _a;
|
|
459
|
-
const [computedProps, setComputedProps] = (0,
|
|
460
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
504
|
+
const [computedProps, setComputedProps] = (0, import_react7.useState)();
|
|
505
|
+
const [extendTypes, setExtendTypes] = (0, import_react7.useState)();
|
|
461
506
|
const { common: common2 } = useConfigContext();
|
|
462
|
-
const [hidden, setHidden] = (0,
|
|
463
|
-
(0,
|
|
507
|
+
const [hidden, setHidden] = (0, import_react7.useState)(props.hidden || false);
|
|
508
|
+
(0, import_react7.useEffect)(() => {
|
|
464
509
|
const propsCopy = { ...props };
|
|
465
510
|
if (propsCopy.extendTypes) {
|
|
466
511
|
setExtendTypes(propsCopy.extendTypes);
|
|
@@ -502,14 +547,14 @@ function FormItem(props) {
|
|
|
502
547
|
if (computedProps.formChildren)
|
|
503
548
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
504
549
|
...computedProps,
|
|
505
|
-
children: (0,
|
|
550
|
+
children: (0, import_react7.cloneElement)(computedProps.formChildren, { scene: "form" })
|
|
506
551
|
});
|
|
507
552
|
if (computedProps.children === null)
|
|
508
553
|
return null;
|
|
509
554
|
if (computedProps.children)
|
|
510
555
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
511
556
|
...computedProps,
|
|
512
|
-
children: (0,
|
|
557
|
+
children: (0, import_react7.cloneElement)(computedProps.children, { scene: "form" })
|
|
513
558
|
});
|
|
514
559
|
if (computedProps.formRender)
|
|
515
560
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Form.Item, {
|
|
@@ -788,13 +833,13 @@ FormItem.useStatus = import_antd6.Form.Item.useStatus;
|
|
|
788
833
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
789
834
|
function Form(props) {
|
|
790
835
|
var _a, _b;
|
|
791
|
-
const [loading, setLoading] = (0,
|
|
792
|
-
const [computedProps, setComputedProps] = (0,
|
|
836
|
+
const [loading, setLoading] = (0, import_react9.useState)(false);
|
|
837
|
+
const [computedProps, setComputedProps] = (0, import_react9.useState)();
|
|
793
838
|
const config = useConfigContext();
|
|
794
|
-
const [extendTypes, setExtendTypes] = (0,
|
|
839
|
+
const [extendTypes, setExtendTypes] = (0, import_react9.useState)();
|
|
795
840
|
const [form] = import_antd7.Form.useForm(props.form);
|
|
796
|
-
const [initialValues, setInitialValues] = (0,
|
|
797
|
-
(0,
|
|
841
|
+
const [initialValues, setInitialValues] = (0, import_react9.useState)(props.initialValues);
|
|
842
|
+
(0, import_react9.useEffect)(() => {
|
|
798
843
|
var _a2, _b2, _c;
|
|
799
844
|
const propsCopy = {
|
|
800
845
|
...props,
|
|
@@ -823,7 +868,7 @@ function Form(props) {
|
|
|
823
868
|
setLoading(true);
|
|
824
869
|
try {
|
|
825
870
|
if (propsCopy.submit && ((_a3 = propsCopy.submit.to) == null ? void 0 : _a3.action)) {
|
|
826
|
-
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 ? {
|
|
827
872
|
...values2,
|
|
828
873
|
...propsCopy.submit.to.params
|
|
829
874
|
} : values2));
|
|
@@ -837,7 +882,7 @@ function Form(props) {
|
|
|
837
882
|
} else if (propsCopy.submit && ((_c = propsCopy.submit.to) == null ? void 0 : _c.action)) {
|
|
838
883
|
propsCopy.onFinish = async (values) => {
|
|
839
884
|
setLoading(true);
|
|
840
|
-
return (0,
|
|
885
|
+
return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
|
|
841
886
|
...values,
|
|
842
887
|
...propsCopy.submit.to.params
|
|
843
888
|
} : values).then((result) => {
|
|
@@ -861,7 +906,7 @@ function Form(props) {
|
|
|
861
906
|
}
|
|
862
907
|
setComputedProps(propsCopy);
|
|
863
908
|
}, [props]);
|
|
864
|
-
const onValuesChange = (0,
|
|
909
|
+
const onValuesChange = (0, import_react9.useCallback)((changedValues, allValues) => {
|
|
865
910
|
console.debug("Form:onValuesChange", changedValues, allValues);
|
|
866
911
|
if (props.onValuesChange) {
|
|
867
912
|
props.onValuesChange(changedValues, allValues);
|
|
@@ -874,7 +919,7 @@ function Form(props) {
|
|
|
874
919
|
item.onValueChange(changedValues[key], allValues, form);
|
|
875
920
|
}
|
|
876
921
|
}, [computedProps]);
|
|
877
|
-
(0,
|
|
922
|
+
(0, import_react9.useEffect)(() => {
|
|
878
923
|
if (!initialValues)
|
|
879
924
|
return;
|
|
880
925
|
console.debug("Form:initialValues", initialValues);
|
|
@@ -888,7 +933,7 @@ function Form(props) {
|
|
|
888
933
|
onValuesChange,
|
|
889
934
|
children: [
|
|
890
935
|
computedProps.beforeItems,
|
|
891
|
-
(_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, {
|
|
892
937
|
...item,
|
|
893
938
|
extendTypes
|
|
894
939
|
}, item.id)),
|
|
@@ -915,68 +960,55 @@ Form.Provider = import_antd7.Form.Provider;
|
|
|
915
960
|
var import_react_router_dom = require("react-router-dom");
|
|
916
961
|
var import_antd8 = require("antd");
|
|
917
962
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
918
|
-
function Link({
|
|
919
|
-
|
|
920
|
-
target,
|
|
921
|
-
text,
|
|
922
|
-
children,
|
|
923
|
-
style,
|
|
924
|
-
button
|
|
925
|
-
}) {
|
|
963
|
+
function Link(props) {
|
|
964
|
+
var _a, _b, _c, _d;
|
|
926
965
|
const { Link: Link2 } = useConfigContext();
|
|
927
|
-
style = Object.assign({ cursor: "pointer" }, style);
|
|
928
|
-
if (
|
|
929
|
-
|
|
966
|
+
let style = Object.assign(Link2.style || {}, { cursor: "pointer" }, props.style || {});
|
|
967
|
+
if (props.block)
|
|
968
|
+
style = Object.assign({
|
|
969
|
+
display: "block",
|
|
970
|
+
width: "100%"
|
|
971
|
+
}, style);
|
|
972
|
+
if (props.href.startsWith("http")) {
|
|
973
|
+
if (props.button)
|
|
930
974
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
|
|
931
|
-
...button,
|
|
932
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
933
|
-
style
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
},
|
|
937
|
-
href,
|
|
938
|
-
children: text != null ? text : children
|
|
975
|
+
...props.button,
|
|
976
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
977
|
+
style,
|
|
978
|
+
href: props.href,
|
|
979
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
939
980
|
});
|
|
940
981
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
941
|
-
href,
|
|
942
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
943
|
-
style
|
|
944
|
-
|
|
945
|
-
...style || {}
|
|
946
|
-
},
|
|
947
|
-
children: text != null ? text : children
|
|
982
|
+
href: props.href,
|
|
983
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
984
|
+
style,
|
|
985
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
948
986
|
});
|
|
949
987
|
}
|
|
950
|
-
if (button)
|
|
988
|
+
if (props.button)
|
|
951
989
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
952
|
-
to: href,
|
|
953
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
990
|
+
to: props.href,
|
|
991
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
954
992
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
|
|
955
|
-
...button,
|
|
956
|
-
style
|
|
957
|
-
|
|
958
|
-
...style || {}
|
|
959
|
-
},
|
|
960
|
-
children: text != null ? text : children
|
|
993
|
+
...props.button,
|
|
994
|
+
style,
|
|
995
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
961
996
|
})
|
|
962
997
|
});
|
|
963
998
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
964
|
-
to: href,
|
|
965
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
966
|
-
style
|
|
967
|
-
|
|
968
|
-
...style || {}
|
|
969
|
-
},
|
|
970
|
-
children: text != null ? text : children
|
|
999
|
+
to: props.href,
|
|
1000
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
1001
|
+
style,
|
|
1002
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
971
1003
|
});
|
|
972
1004
|
}
|
|
973
1005
|
|
|
974
1006
|
// src/Modal.tsx
|
|
975
1007
|
var import_antd9 = require("antd");
|
|
976
|
-
var
|
|
1008
|
+
var import_react10 = require("react");
|
|
977
1009
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
978
1010
|
function useModal(init) {
|
|
979
|
-
const [props, setProps] = (0,
|
|
1011
|
+
const [props, setProps] = (0, import_react10.useState)({
|
|
980
1012
|
open: false,
|
|
981
1013
|
onCancel: () => setProps((prev) => ({
|
|
982
1014
|
...prev,
|
|
@@ -1000,7 +1032,7 @@ function useModal(init) {
|
|
|
1000
1032
|
|
|
1001
1033
|
// src/Routers.tsx
|
|
1002
1034
|
var import_antd10 = require("antd");
|
|
1003
|
-
var
|
|
1035
|
+
var import_react11 = require("react");
|
|
1004
1036
|
var import_react_router_dom2 = require("react-router-dom");
|
|
1005
1037
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1006
1038
|
function PageNotFound() {
|
|
@@ -1016,7 +1048,7 @@ function Routes(props) {
|
|
|
1016
1048
|
children: [
|
|
1017
1049
|
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
|
|
1018
1050
|
...r,
|
|
1019
|
-
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1051
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
|
|
1020
1052
|
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1021
1053
|
style: { padding: "24px" },
|
|
1022
1054
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
|
|
@@ -1036,7 +1068,7 @@ function Routes(props) {
|
|
|
1036
1068
|
}
|
|
1037
1069
|
|
|
1038
1070
|
// src/Table.tsx
|
|
1039
|
-
var
|
|
1071
|
+
var import_react12 = require("react");
|
|
1040
1072
|
var import_antd11 = require("antd");
|
|
1041
1073
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1042
1074
|
var import_icons3 = require("@ant-design/icons");
|
|
@@ -1067,9 +1099,9 @@ function processValue(item, value) {
|
|
|
1067
1099
|
return value;
|
|
1068
1100
|
}
|
|
1069
1101
|
function Table(props) {
|
|
1070
|
-
const [columns, setColumns] = (0,
|
|
1102
|
+
const [columns, setColumns] = (0, import_react12.useState)();
|
|
1071
1103
|
const { common: common2 } = useConfigContext();
|
|
1072
|
-
(0,
|
|
1104
|
+
(0, import_react12.useEffect)(() => {
|
|
1073
1105
|
var _a;
|
|
1074
1106
|
for (const item of props.items) {
|
|
1075
1107
|
if (!item.key)
|
|
@@ -1093,7 +1125,7 @@ function Table(props) {
|
|
|
1093
1125
|
if (item.tableChildren === null)
|
|
1094
1126
|
item.render = () => null;
|
|
1095
1127
|
else if (item.tableChildren)
|
|
1096
|
-
item.render = (value, values) => (0,
|
|
1128
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1097
1129
|
item.tableChildren,
|
|
1098
1130
|
{
|
|
1099
1131
|
scene: "table",
|
|
@@ -1104,7 +1136,7 @@ function Table(props) {
|
|
|
1104
1136
|
else if (item.children === null)
|
|
1105
1137
|
item.render = () => null;
|
|
1106
1138
|
else if (item.children)
|
|
1107
|
-
item.render = (value, values) => (0,
|
|
1139
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1108
1140
|
item.children,
|
|
1109
1141
|
{
|
|
1110
1142
|
scene: "table",
|
|
@@ -1114,7 +1146,7 @@ function Table(props) {
|
|
|
1114
1146
|
);
|
|
1115
1147
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1116
1148
|
if (props.extendTypes[item.type].children)
|
|
1117
|
-
item.render = (value, values) => (0,
|
|
1149
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1118
1150
|
props.extendTypes[item.type].children,
|
|
1119
1151
|
{
|
|
1120
1152
|
scene: "table",
|
|
@@ -1365,7 +1397,7 @@ function Table(props) {
|
|
|
1365
1397
|
}
|
|
1366
1398
|
setColumns(props.items);
|
|
1367
1399
|
}, [props.items]);
|
|
1368
|
-
(0,
|
|
1400
|
+
(0, import_react12.useEffect)(() => {
|
|
1369
1401
|
if (!props.dataSource || !columns)
|
|
1370
1402
|
return;
|
|
1371
1403
|
for (const column of columns) {
|
|
@@ -1411,8 +1443,8 @@ function FaasDataTable({
|
|
|
1411
1443
|
params,
|
|
1412
1444
|
reload
|
|
1413
1445
|
}) {
|
|
1414
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
1415
|
-
(0,
|
|
1446
|
+
const [currentColumns, setCurrentColumns] = (0, import_react12.useState)(columns);
|
|
1447
|
+
(0, import_react12.useEffect)(() => {
|
|
1416
1448
|
if (!data || Array.isArray(data))
|
|
1417
1449
|
return;
|
|
1418
1450
|
setCurrentColumns((prev) => {
|
|
@@ -1492,11 +1524,11 @@ function FaasDataTable({
|
|
|
1492
1524
|
}
|
|
1493
1525
|
|
|
1494
1526
|
// src/Title.tsx
|
|
1495
|
-
var
|
|
1527
|
+
var import_react13 = require("react");
|
|
1496
1528
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1497
1529
|
function Title(props) {
|
|
1498
1530
|
const { Title: Title2 } = useConfigContext();
|
|
1499
|
-
(0,
|
|
1531
|
+
(0, import_react13.useEffect)(() => {
|
|
1500
1532
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1501
1533
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1502
1534
|
}, [props]);
|
|
@@ -1516,7 +1548,7 @@ function Title(props) {
|
|
|
1516
1548
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1517
1549
|
});
|
|
1518
1550
|
if (props.children)
|
|
1519
|
-
return (0,
|
|
1551
|
+
return (0, import_react13.cloneElement)(props.children, { title: props.title });
|
|
1520
1552
|
return null;
|
|
1521
1553
|
}
|
|
1522
1554
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1526,6 +1558,7 @@ function Title(props) {
|
|
|
1526
1558
|
ConfigProvider,
|
|
1527
1559
|
Description,
|
|
1528
1560
|
Drawer,
|
|
1561
|
+
ErrorBoundary,
|
|
1529
1562
|
FaasDataWrapper,
|
|
1530
1563
|
Form,
|
|
1531
1564
|
FormItem,
|