@faasjs/ant-design 0.0.3-beta.32 → 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/dist/index.d.ts +23 -5
- package/dist/index.js +127 -82
- package/dist/index.mjs +195 -151
- 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,67 @@ 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
|
+
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)
|
|
930
974
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
|
|
931
|
-
...button,
|
|
932
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
975
|
+
...props.button,
|
|
976
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
933
977
|
style: {
|
|
934
978
|
...Link2.style,
|
|
935
|
-
...style || {}
|
|
979
|
+
...props.style || {}
|
|
936
980
|
},
|
|
937
|
-
href,
|
|
938
|
-
children: text != null ?
|
|
981
|
+
href: props.href,
|
|
982
|
+
children: (_a = props.text) != null ? _a : props.children
|
|
939
983
|
});
|
|
940
984
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
941
|
-
href,
|
|
942
|
-
target: target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
985
|
+
href: props.href,
|
|
986
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target) || "_blank",
|
|
943
987
|
style: {
|
|
944
988
|
...Link2.style,
|
|
945
|
-
...style || {}
|
|
989
|
+
...props.style || {}
|
|
946
990
|
},
|
|
947
|
-
children: text != null ?
|
|
991
|
+
children: (_b = props.text) != null ? _b : props.children
|
|
948
992
|
});
|
|
949
993
|
}
|
|
950
|
-
if (button)
|
|
994
|
+
if (props.button)
|
|
951
995
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
952
|
-
to: href,
|
|
953
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
996
|
+
to: props.href,
|
|
997
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
954
998
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Button, {
|
|
955
|
-
...button,
|
|
999
|
+
...props.button,
|
|
956
1000
|
style: {
|
|
957
1001
|
...Link2.style,
|
|
958
|
-
...style || {}
|
|
1002
|
+
...props.style || {}
|
|
959
1003
|
},
|
|
960
|
-
children: text != null ?
|
|
1004
|
+
children: (_c = props.text) != null ? _c : props.children
|
|
961
1005
|
})
|
|
962
1006
|
});
|
|
963
1007
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
|
|
964
|
-
to: href,
|
|
965
|
-
target: target || (Link2 == null ? void 0 : Link2.target),
|
|
1008
|
+
to: props.href,
|
|
1009
|
+
target: props.target || (Link2 == null ? void 0 : Link2.target),
|
|
966
1010
|
style: {
|
|
967
1011
|
...Link2.style,
|
|
968
|
-
...style || {}
|
|
1012
|
+
...props.style || {}
|
|
969
1013
|
},
|
|
970
|
-
children: text != null ?
|
|
1014
|
+
children: (_d = props.text) != null ? _d : props.children
|
|
971
1015
|
});
|
|
972
1016
|
}
|
|
973
1017
|
|
|
974
1018
|
// src/Modal.tsx
|
|
975
1019
|
var import_antd9 = require("antd");
|
|
976
|
-
var
|
|
1020
|
+
var import_react10 = require("react");
|
|
977
1021
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
978
1022
|
function useModal(init) {
|
|
979
|
-
const [props, setProps] = (0,
|
|
1023
|
+
const [props, setProps] = (0, import_react10.useState)({
|
|
980
1024
|
open: false,
|
|
981
1025
|
onCancel: () => setProps((prev) => ({
|
|
982
1026
|
...prev,
|
|
@@ -1000,7 +1044,7 @@ function useModal(init) {
|
|
|
1000
1044
|
|
|
1001
1045
|
// src/Routers.tsx
|
|
1002
1046
|
var import_antd10 = require("antd");
|
|
1003
|
-
var
|
|
1047
|
+
var import_react11 = require("react");
|
|
1004
1048
|
var import_react_router_dom2 = require("react-router-dom");
|
|
1005
1049
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1006
1050
|
function PageNotFound() {
|
|
@@ -1016,7 +1060,7 @@ function Routes(props) {
|
|
|
1016
1060
|
children: [
|
|
1017
1061
|
props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
|
|
1018
1062
|
...r,
|
|
1019
|
-
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1063
|
+
element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
|
|
1020
1064
|
fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1021
1065
|
style: { padding: "24px" },
|
|
1022
1066
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
|
|
@@ -1036,7 +1080,7 @@ function Routes(props) {
|
|
|
1036
1080
|
}
|
|
1037
1081
|
|
|
1038
1082
|
// src/Table.tsx
|
|
1039
|
-
var
|
|
1083
|
+
var import_react12 = require("react");
|
|
1040
1084
|
var import_antd11 = require("antd");
|
|
1041
1085
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
1042
1086
|
var import_icons3 = require("@ant-design/icons");
|
|
@@ -1067,9 +1111,9 @@ function processValue(item, value) {
|
|
|
1067
1111
|
return value;
|
|
1068
1112
|
}
|
|
1069
1113
|
function Table(props) {
|
|
1070
|
-
const [columns, setColumns] = (0,
|
|
1114
|
+
const [columns, setColumns] = (0, import_react12.useState)();
|
|
1071
1115
|
const { common: common2 } = useConfigContext();
|
|
1072
|
-
(0,
|
|
1116
|
+
(0, import_react12.useEffect)(() => {
|
|
1073
1117
|
var _a;
|
|
1074
1118
|
for (const item of props.items) {
|
|
1075
1119
|
if (!item.key)
|
|
@@ -1093,7 +1137,7 @@ function Table(props) {
|
|
|
1093
1137
|
if (item.tableChildren === null)
|
|
1094
1138
|
item.render = () => null;
|
|
1095
1139
|
else if (item.tableChildren)
|
|
1096
|
-
item.render = (value, values) => (0,
|
|
1140
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1097
1141
|
item.tableChildren,
|
|
1098
1142
|
{
|
|
1099
1143
|
scene: "table",
|
|
@@ -1104,7 +1148,7 @@ function Table(props) {
|
|
|
1104
1148
|
else if (item.children === null)
|
|
1105
1149
|
item.render = () => null;
|
|
1106
1150
|
else if (item.children)
|
|
1107
|
-
item.render = (value, values) => (0,
|
|
1151
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1108
1152
|
item.children,
|
|
1109
1153
|
{
|
|
1110
1154
|
scene: "table",
|
|
@@ -1114,7 +1158,7 @@ function Table(props) {
|
|
|
1114
1158
|
);
|
|
1115
1159
|
if (props.extendTypes && props.extendTypes[item.type]) {
|
|
1116
1160
|
if (props.extendTypes[item.type].children)
|
|
1117
|
-
item.render = (value, values) => (0,
|
|
1161
|
+
item.render = (value, values) => (0, import_react12.cloneElement)(
|
|
1118
1162
|
props.extendTypes[item.type].children,
|
|
1119
1163
|
{
|
|
1120
1164
|
scene: "table",
|
|
@@ -1365,7 +1409,7 @@ function Table(props) {
|
|
|
1365
1409
|
}
|
|
1366
1410
|
setColumns(props.items);
|
|
1367
1411
|
}, [props.items]);
|
|
1368
|
-
(0,
|
|
1412
|
+
(0, import_react12.useEffect)(() => {
|
|
1369
1413
|
if (!props.dataSource || !columns)
|
|
1370
1414
|
return;
|
|
1371
1415
|
for (const column of columns) {
|
|
@@ -1411,8 +1455,8 @@ function FaasDataTable({
|
|
|
1411
1455
|
params,
|
|
1412
1456
|
reload
|
|
1413
1457
|
}) {
|
|
1414
|
-
const [currentColumns, setCurrentColumns] = (0,
|
|
1415
|
-
(0,
|
|
1458
|
+
const [currentColumns, setCurrentColumns] = (0, import_react12.useState)(columns);
|
|
1459
|
+
(0, import_react12.useEffect)(() => {
|
|
1416
1460
|
if (!data || Array.isArray(data))
|
|
1417
1461
|
return;
|
|
1418
1462
|
setCurrentColumns((prev) => {
|
|
@@ -1492,11 +1536,11 @@ function FaasDataTable({
|
|
|
1492
1536
|
}
|
|
1493
1537
|
|
|
1494
1538
|
// src/Title.tsx
|
|
1495
|
-
var
|
|
1539
|
+
var import_react13 = require("react");
|
|
1496
1540
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1497
1541
|
function Title(props) {
|
|
1498
1542
|
const { Title: Title2 } = useConfigContext();
|
|
1499
|
-
(0,
|
|
1543
|
+
(0, import_react13.useEffect)(() => {
|
|
1500
1544
|
const title = Array.isArray(props.title) ? props.title : [props.title];
|
|
1501
1545
|
document.title = title.concat(props.suffix || Title2.suffix).filter((t) => !!t).join(props.separator || Title2.separator);
|
|
1502
1546
|
}, [props]);
|
|
@@ -1516,7 +1560,7 @@ function Title(props) {
|
|
|
1516
1560
|
children: Array.isArray(props.title) ? props.title[0] : props.title
|
|
1517
1561
|
});
|
|
1518
1562
|
if (props.children)
|
|
1519
|
-
return (0,
|
|
1563
|
+
return (0, import_react13.cloneElement)(props.children, { title: props.title });
|
|
1520
1564
|
return null;
|
|
1521
1565
|
}
|
|
1522
1566
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1526,6 +1570,7 @@ function Title(props) {
|
|
|
1526
1570
|
ConfigProvider,
|
|
1527
1571
|
Description,
|
|
1528
1572
|
Drawer,
|
|
1573
|
+
ErrorBoundary,
|
|
1529
1574
|
FaasDataWrapper,
|
|
1530
1575
|
Form,
|
|
1531
1576
|
FormItem,
|