@faasjs/ant-design 0.0.2-beta.407 → 0.0.2-beta.408

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as antd_es_calendar_generateCalendar_js from 'antd/es/calendar/generateCalendar.js';
2
2
  import { Dayjs } from 'dayjs';
3
- import { CalendarProps as CalendarProps$1, DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1, SelectProps, FormProps as FormProps$1, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
3
+ import { CalendarProps as CalendarProps$1, DescriptionsProps, DrawerProps as DrawerProps$1, FormItemProps as FormItemProps$1, InputProps, InputNumberProps, SwitchProps, DatePickerProps as DatePickerProps$1, TimePickerProps as TimePickerProps$1, SelectProps, FormProps as FormProps$1, ButtonProps, ModalProps as ModalProps$1, TableColumnProps, TablePaginationConfig, TableProps as TableProps$1 } from 'antd';
4
4
  export { Drawer, Modal } from 'antd';
5
5
  import * as react from 'react';
6
6
  import { CSSProperties, ReactNode, LazyExoticComponent, ComponentType } from 'react';
@@ -305,12 +305,13 @@ declare namespace Form {
305
305
  var Item: typeof FormItem;
306
306
  }
307
307
 
308
- declare function Link({ href, target, text, children, style }: {
308
+ declare function Link({ href, target, text, children, style, button, }: {
309
309
  href: string;
310
310
  target?: string;
311
311
  text?: string | number;
312
312
  children?: ReactNode;
313
313
  style?: CSSProperties;
314
+ button?: ButtonProps;
314
315
  }): JSX.Element;
315
316
 
316
317
  declare type ModalProps = ModalProps$1 & {
@@ -337,6 +338,7 @@ declare function useModal(init?: ModalProps): {
337
338
  setModalProps(changes: Partial<ModalProps>): void;
338
339
  };
339
340
 
341
+ declare function PageNotFound(): JSX.Element;
340
342
  declare type RoutesProps = {
341
343
  routes: (RouteProps & {
342
344
  page?: LazyExoticComponent<ComponentType<any>>;
@@ -424,4 +426,4 @@ declare type TitleProps = {
424
426
  */
425
427
  declare function Title(props: TitleProps): JSX.Element;
426
428
 
427
- export { BaseItemProps, BaseOption, Blank, BlankProps, Calendar, CalendarProps, ConfigContext, ConfigProvider, ConfigProviderProps, DatePicker, DatePickerProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, ModalProps, Routes, RoutesProps, Table, TableItemProps, TableProps, TimePicker, TimePickerProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, useConfigContext, useDrawer, useModal };
429
+ export { BaseItemProps, BaseOption, Blank, BlankProps, Calendar, CalendarProps, ConfigContext, ConfigProvider, ConfigProviderProps, DatePicker, DatePickerProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, Link, ModalProps, PageNotFound, Routes, RoutesProps, Table, TableItemProps, TableProps, TimePicker, TimePickerProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, useConfigContext, useDrawer, useModal };
package/dist/index.js CHANGED
@@ -36,7 +36,8 @@ __export(src_exports, {
36
36
  Form: () => Form,
37
37
  FormItem: () => FormItem,
38
38
  Link: () => Link,
39
- Modal: () => import_antd7.Modal,
39
+ Modal: () => import_antd8.Modal,
40
+ PageNotFound: () => PageNotFound,
40
41
  Routes: () => Routes,
41
42
  Table: () => Table,
42
43
  TimePicker: () => TimePicker,
@@ -61,7 +62,7 @@ var import_antd = require("antd");
61
62
  var import_lodash = require("lodash");
62
63
  var import_jsx_runtime = require("react/jsx-runtime");
63
64
  var isZH = /^zh/i.test(navigator.language);
64
- var common = isZH ? {
65
+ var zh = {
65
66
  lang: "zh",
66
67
  blank: "\u7A7A",
67
68
  all: "\u5168\u90E8",
@@ -70,7 +71,8 @@ var common = isZH ? {
70
71
  add: "\u6DFB\u52A0",
71
72
  delete: "\u5220\u9664",
72
73
  required: "\u5FC5\u586B"
73
- } : {
74
+ };
75
+ var en = {
74
76
  lang: "en",
75
77
  blank: "Empty",
76
78
  all: "All",
@@ -80,6 +82,7 @@ var common = isZH ? {
80
82
  delete: "Delete",
81
83
  required: "is required"
82
84
  };
85
+ var common = isZH ? zh : en;
83
86
  var baseConfig = {
84
87
  antd: {},
85
88
  lang: "en",
@@ -97,8 +100,20 @@ function ConfigProvider({
97
100
  config,
98
101
  children
99
102
  }) {
103
+ const [values, setValues] = (0, import_react2.useState)(baseConfig);
104
+ (0, import_react2.useEffect)(() => {
105
+ if (config.lang === "zh") {
106
+ setValues((0, import_lodash.defaultsDeep)(config, {
107
+ lang: "zh",
108
+ common: zh,
109
+ Blank: { text: zh.blank },
110
+ Form: { submit: { text: zh.submit } }
111
+ }, baseConfig));
112
+ } else
113
+ setValues(values);
114
+ }, []);
100
115
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
101
- value: (0, import_lodash.defaultsDeep)(config, baseConfig),
116
+ value: values,
102
117
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
103
118
  ...config.antd,
104
119
  children
@@ -713,10 +728,11 @@ function Form(props) {
713
728
  };
714
729
  } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
715
730
  propsCopy.onFinish = async (values) => {
716
- return await (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
731
+ setLoading(true);
732
+ return (0, import_react8.faas)(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
717
733
  ...values,
718
734
  ...propsCopy.submit.to.params
719
- } : values);
735
+ } : values).finally(() => setLoading(false));
720
736
  };
721
737
  }
722
738
  if (propsCopy.extendTypes) {
@@ -751,16 +767,31 @@ Form.Item = FormItem;
751
767
 
752
768
  // src/Link.tsx
753
769
  var import_react_router_dom = require("react-router-dom");
770
+ var import_antd7 = require("antd");
754
771
  var import_jsx_runtime = require("react/jsx-runtime");
755
772
  function Link({
756
773
  href,
757
774
  target,
758
775
  text,
759
776
  children,
760
- style
777
+ style,
778
+ button
761
779
  }) {
762
780
  const { Link: Link2 } = useConfigContext();
763
781
  style = Object.assign({ cursor: "pointer" }, style);
782
+ if (button)
783
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Button, {
784
+ ...button,
785
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
786
+ to: href,
787
+ target: target || (Link2 == null ? void 0 : Link2.target),
788
+ style: {
789
+ ...Link2.style,
790
+ ...style || {}
791
+ },
792
+ children: text || children
793
+ })
794
+ });
764
795
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
765
796
  to: href,
766
797
  target: target || (Link2 == null ? void 0 : Link2.target),
@@ -773,7 +804,7 @@ function Link({
773
804
  }
774
805
 
775
806
  // src/Modal.tsx
776
- var import_antd7 = require("antd");
807
+ var import_antd8 = require("antd");
777
808
  var import_react10 = require("react");
778
809
  var import_jsx_runtime = require("react/jsx-runtime");
779
810
  function useModal(init) {
@@ -786,7 +817,7 @@ function useModal(init) {
786
817
  ...init
787
818
  });
788
819
  return {
789
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Modal, {
820
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Modal, {
790
821
  ...props
791
822
  }),
792
823
  modalProps: props,
@@ -800,13 +831,13 @@ function useModal(init) {
800
831
  }
801
832
 
802
833
  // src/Routers.tsx
803
- var import_antd8 = require("antd");
834
+ var import_antd9 = require("antd");
804
835
  var import_react11 = require("react");
805
836
  var import_react_router_dom2 = require("react-router-dom");
806
837
  var import_jsx_runtime = require("react/jsx-runtime");
807
- function NotFound() {
838
+ function PageNotFound() {
808
839
  const config = useConfigContext();
809
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Result, {
840
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Result, {
810
841
  status: "404",
811
842
  title: config.common.pageNotFound
812
843
  });
@@ -819,7 +850,7 @@ function Routes(props) {
819
850
  element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
820
851
  fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
821
852
  style: { padding: "24px" },
822
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
853
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
823
854
  active: true
824
855
  })
825
856
  }),
@@ -828,7 +859,7 @@ function Routes(props) {
828
859
  }, r.path)),
829
860
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
830
861
  path: "*",
831
- element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotFound, {})
862
+ element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageNotFound, {})
832
863
  }, "*")
833
864
  ]
834
865
  });
@@ -836,7 +867,7 @@ function Routes(props) {
836
867
 
837
868
  // src/Table.tsx
838
869
  var import_react12 = require("react");
839
- var import_antd9 = require("antd");
870
+ var import_antd10 = require("antd");
840
871
  var import_dayjs5 = __toESM(require("dayjs"));
841
872
  var import_icons3 = require("@ant-design/icons");
842
873
  var import_lodash6 = require("lodash");
@@ -946,7 +977,7 @@ function Table(props) {
946
977
  setSelectedKeys,
947
978
  selectedKeys,
948
979
  confirm
949
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd9.Radio.Group, {
980
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd10.Radio.Group, {
950
981
  style: { padding: 8 },
951
982
  buttonStyle: "solid",
952
983
  value: selectedKeys[0],
@@ -955,10 +986,10 @@ function Table(props) {
955
986
  confirm();
956
987
  },
957
988
  children: [
958
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
989
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
959
990
  children: config.common.all
960
991
  }),
961
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
992
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
962
993
  value: "true",
963
994
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
964
995
  style: {
@@ -967,7 +998,7 @@ function Table(props) {
967
998
  }
968
999
  })
969
1000
  }),
970
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
1001
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
971
1002
  value: "false",
972
1003
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
973
1004
  style: {
@@ -976,7 +1007,7 @@ function Table(props) {
976
1007
  }
977
1008
  })
978
1009
  }),
979
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
1010
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Radio.Button, {
980
1011
  value: "empty",
981
1012
  children: config.common.blank
982
1013
  })
@@ -1018,14 +1049,14 @@ function Table(props) {
1018
1049
  if (!columns)
1019
1050
  return null;
1020
1051
  if (!props.faasData)
1021
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1052
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1022
1053
  ...props,
1023
1054
  rowKey: props.rowKey || "id",
1024
1055
  columns,
1025
1056
  dataSource: props.dataSource
1026
1057
  });
1027
1058
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
1028
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
1059
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Skeleton, {
1029
1060
  active: true
1030
1061
  }),
1031
1062
  render: ({
@@ -1034,20 +1065,20 @@ function Table(props) {
1034
1065
  reload
1035
1066
  }) => {
1036
1067
  if (!data)
1037
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1068
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1038
1069
  ...props,
1039
1070
  rowKey: props.rowKey || "id",
1040
1071
  columns,
1041
1072
  dataSource: []
1042
1073
  });
1043
1074
  if (Array.isArray(data))
1044
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1075
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1045
1076
  ...props,
1046
1077
  rowKey: props.rowKey || "id",
1047
1078
  columns,
1048
1079
  dataSource: data
1049
1080
  });
1050
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1081
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd10.Table, {
1051
1082
  ...props,
1052
1083
  rowKey: props.rowKey || "id",
1053
1084
  columns,
@@ -1117,6 +1148,7 @@ function Title(props) {
1117
1148
  FormItem,
1118
1149
  Link,
1119
1150
  Modal,
1151
+ PageNotFound,
1120
1152
  Routes,
1121
1153
  Table,
1122
1154
  TimePicker,
package/dist/index.mjs CHANGED
@@ -8,13 +8,15 @@ import { isNil } from "lodash";
8
8
  // src/Config.tsx
9
9
  import {
10
10
  createContext,
11
- useContext
11
+ useContext,
12
+ useEffect,
13
+ useState
12
14
  } from "react";
13
15
  import { ConfigProvider as AntdConfigProvider } from "antd";
14
16
  import { defaultsDeep } from "lodash";
15
17
  import { jsx } from "react/jsx-runtime";
16
18
  var isZH = /^zh/i.test(navigator.language);
17
- var common = isZH ? {
19
+ var zh = {
18
20
  lang: "zh",
19
21
  blank: "\u7A7A",
20
22
  all: "\u5168\u90E8",
@@ -23,7 +25,8 @@ var common = isZH ? {
23
25
  add: "\u6DFB\u52A0",
24
26
  delete: "\u5220\u9664",
25
27
  required: "\u5FC5\u586B"
26
- } : {
28
+ };
29
+ var en = {
27
30
  lang: "en",
28
31
  blank: "Empty",
29
32
  all: "All",
@@ -33,6 +36,7 @@ var common = isZH ? {
33
36
  delete: "Delete",
34
37
  required: "is required"
35
38
  };
39
+ var common = isZH ? zh : en;
36
40
  var baseConfig = {
37
41
  antd: {},
38
42
  lang: "en",
@@ -50,8 +54,20 @@ function ConfigProvider({
50
54
  config,
51
55
  children
52
56
  }) {
57
+ const [values, setValues] = useState(baseConfig);
58
+ useEffect(() => {
59
+ if (config.lang === "zh") {
60
+ setValues(defaultsDeep(config, {
61
+ lang: "zh",
62
+ common: zh,
63
+ Blank: { text: zh.blank },
64
+ Form: { submit: { text: zh.submit } }
65
+ }, baseConfig));
66
+ } else
67
+ setValues(values);
68
+ }, []);
53
69
  return /* @__PURE__ */ jsx(ConfigContext.Provider, {
54
- value: defaultsDeep(config, baseConfig),
70
+ value: values,
55
71
  children: /* @__PURE__ */ jsx(AntdConfigProvider, {
56
72
  ...config.antd,
57
73
  children
@@ -104,15 +120,15 @@ import {
104
120
  import { upperFirst as upperFirst2 } from "lodash";
105
121
  import {
106
122
  cloneElement,
107
- useEffect,
108
- useState
123
+ useEffect as useEffect2,
124
+ useState as useState2
109
125
  } from "react";
110
126
  import dayjs from "dayjs";
111
127
  import { FaasDataWrapper } from "@faasjs/react";
112
128
  import { Fragment, jsx as jsx3 } from "react/jsx-runtime";
113
129
  function DescriptionItemContent(props) {
114
- const [computedProps, setComputedProps] = useState();
115
- useEffect(() => {
130
+ const [computedProps, setComputedProps] = useState2();
131
+ useEffect2(() => {
116
132
  var _a, _b;
117
133
  const propsCopy = { ...props };
118
134
  if (!propsCopy.item.title)
@@ -233,10 +249,10 @@ function Description(props) {
233
249
 
234
250
  // src/Drawer.tsx
235
251
  import { Drawer } from "antd";
236
- import { useState as useState2 } from "react";
252
+ import { useState as useState3 } from "react";
237
253
  import { jsx as jsx4 } from "react/jsx-runtime";
238
254
  function useDrawer(init) {
239
- const [props, setProps] = useState2({
255
+ const [props, setProps] = useState3({
240
256
  visible: false,
241
257
  onClose: () => setProps((prev) => ({
242
258
  ...prev,
@@ -265,8 +281,8 @@ import {
265
281
  Form as AntdForm2
266
282
  } from "antd";
267
283
  import {
268
- useEffect as useEffect3,
269
- useState as useState4
284
+ useEffect as useEffect4,
285
+ useState as useState5
270
286
  } from "react";
271
287
 
272
288
  // src/FormItem.tsx
@@ -281,7 +297,7 @@ import {
281
297
  Select
282
298
  } from "antd";
283
299
  import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons";
284
- import { useEffect as useEffect2, useState as useState3 } from "react";
300
+ import { useEffect as useEffect3, useState as useState4 } from "react";
285
301
  import { upperFirst as upperFirst3 } from "lodash";
286
302
 
287
303
  // src/TimePicker.tsx
@@ -347,8 +363,8 @@ function processProps(propsCopy, config) {
347
363
  return propsCopy;
348
364
  }
349
365
  function DateItem(options) {
350
- const [value, setValue] = useState3();
351
- useEffect2(() => {
366
+ const [value, setValue] = useState4();
367
+ useEffect3(() => {
352
368
  setValue(options.value && !isDayjs(options.value) ? dayjs2(options.value) : null);
353
369
  }, [options.value]);
354
370
  return /* @__PURE__ */ jsx6(DatePicker, {
@@ -357,8 +373,8 @@ function DateItem(options) {
357
373
  });
358
374
  }
359
375
  function TimeItem(options) {
360
- const [value, setValue] = useState3();
361
- useEffect2(() => {
376
+ const [value, setValue] = useState4();
377
+ useEffect3(() => {
362
378
  setValue(options.value && !isDayjs(options.value) ? dayjs2(options.value) : null);
363
379
  }, [options.value]);
364
380
  return /* @__PURE__ */ jsx6(TimePicker, {
@@ -368,10 +384,10 @@ function TimeItem(options) {
368
384
  }
369
385
  function FormItem(props) {
370
386
  var _a;
371
- const [computedProps, setComputedProps] = useState3();
372
- const [extendTypes, setExtendTypes] = useState3();
387
+ const [computedProps, setComputedProps] = useState4();
388
+ const [extendTypes, setExtendTypes] = useState4();
373
389
  const config = useConfigContext();
374
- useEffect2(() => {
390
+ useEffect3(() => {
375
391
  const propsCopy = { ...props };
376
392
  if (propsCopy.extendTypes) {
377
393
  setExtendTypes(propsCopy.extendTypes);
@@ -662,11 +678,11 @@ function FormItem(props) {
662
678
  import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
663
679
  function Form(props) {
664
680
  var _a, _b;
665
- const [loading, setLoading] = useState4(false);
666
- const [computedProps, setComputedProps] = useState4();
681
+ const [loading, setLoading] = useState5(false);
682
+ const [computedProps, setComputedProps] = useState5();
667
683
  const config = useConfigContext();
668
- const [extendTypes, setExtendTypes] = useState4();
669
- useEffect3(() => {
684
+ const [extendTypes, setExtendTypes] = useState5();
685
+ useEffect4(() => {
670
686
  var _a2;
671
687
  const propsCopy = { ...props };
672
688
  if (propsCopy.onFinish) {
@@ -688,10 +704,11 @@ function Form(props) {
688
704
  };
689
705
  } else if (propsCopy.submit && ((_a2 = propsCopy.submit.to) == null ? void 0 : _a2.action)) {
690
706
  propsCopy.onFinish = async (values) => {
691
- return await faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
707
+ setLoading(true);
708
+ return faas(propsCopy.submit.to.action, propsCopy.submit.to.params ? {
692
709
  ...values,
693
710
  ...propsCopy.submit.to.params
694
- } : values);
711
+ } : values).finally(() => setLoading(false));
695
712
  };
696
713
  }
697
714
  if (propsCopy.extendTypes) {
@@ -726,16 +743,31 @@ Form.Item = FormItem;
726
743
 
727
744
  // src/Link.tsx
728
745
  import { Link as RouterLink } from "react-router-dom";
746
+ import { Button as Button3 } from "antd";
729
747
  import { jsx as jsx8 } from "react/jsx-runtime";
730
748
  function Link({
731
749
  href,
732
750
  target,
733
751
  text,
734
752
  children,
735
- style
753
+ style,
754
+ button
736
755
  }) {
737
756
  const { Link: Link2 } = useConfigContext();
738
757
  style = Object.assign({ cursor: "pointer" }, style);
758
+ if (button)
759
+ return /* @__PURE__ */ jsx8(Button3, {
760
+ ...button,
761
+ children: /* @__PURE__ */ jsx8(RouterLink, {
762
+ to: href,
763
+ target: target || (Link2 == null ? void 0 : Link2.target),
764
+ style: {
765
+ ...Link2.style,
766
+ ...style || {}
767
+ },
768
+ children: text || children
769
+ })
770
+ });
739
771
  return /* @__PURE__ */ jsx8(RouterLink, {
740
772
  to: href,
741
773
  target: target || (Link2 == null ? void 0 : Link2.target),
@@ -749,10 +781,10 @@ function Link({
749
781
 
750
782
  // src/Modal.tsx
751
783
  import { Modal } from "antd";
752
- import { useState as useState5 } from "react";
784
+ import { useState as useState6 } from "react";
753
785
  import { jsx as jsx9 } from "react/jsx-runtime";
754
786
  function useModal(init) {
755
- const [props, setProps] = useState5({
787
+ const [props, setProps] = useState6({
756
788
  visible: false,
757
789
  onCancel: () => setProps((prev) => ({
758
790
  ...prev,
@@ -784,7 +816,7 @@ import {
784
816
  Route
785
817
  } from "react-router-dom";
786
818
  import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
787
- function NotFound() {
819
+ function PageNotFound() {
788
820
  const config = useConfigContext();
789
821
  return /* @__PURE__ */ jsx10(Result, {
790
822
  status: "404",
@@ -808,7 +840,7 @@ function Routes(props) {
808
840
  }, r.path)),
809
841
  /* @__PURE__ */ jsx10(Route, {
810
842
  path: "*",
811
- element: props.notFound || /* @__PURE__ */ jsx10(NotFound, {})
843
+ element: props.notFound || /* @__PURE__ */ jsx10(PageNotFound, {})
812
844
  }, "*")
813
845
  ]
814
846
  });
@@ -816,8 +848,8 @@ function Routes(props) {
816
848
 
817
849
  // src/Table.tsx
818
850
  import {
819
- useState as useState6,
820
- useEffect as useEffect4,
851
+ useState as useState7,
852
+ useEffect as useEffect5,
821
853
  cloneElement as cloneElement2
822
854
  } from "react";
823
855
  import {
@@ -860,9 +892,9 @@ function processValue(item, value) {
860
892
  return value;
861
893
  }
862
894
  function Table(props) {
863
- const [columns, setColumns] = useState6();
895
+ const [columns, setColumns] = useState7();
864
896
  const config = useConfigContext();
865
- useEffect4(() => {
897
+ useEffect5(() => {
866
898
  var _a;
867
899
  for (const item of props.items) {
868
900
  if (!item.key)
@@ -1069,11 +1101,11 @@ function Table(props) {
1069
1101
  }
1070
1102
 
1071
1103
  // src/Title.tsx
1072
- import { useEffect as useEffect5, cloneElement as cloneElement3 } from "react";
1104
+ import { useEffect as useEffect6, cloneElement as cloneElement3 } from "react";
1073
1105
  import { jsx as jsx12 } from "react/jsx-runtime";
1074
1106
  function Title(props) {
1075
1107
  const config = useConfigContext();
1076
- useEffect5(() => {
1108
+ useEffect6(() => {
1077
1109
  const title = Array.isArray(props.title) ? props.title : [props.title];
1078
1110
  document.title = title.concat(props.suffix || config.Title.suffix).filter((t) => !!t).join(props.separator || config.Title.separator);
1079
1111
  }, []);
@@ -1104,6 +1136,7 @@ export {
1104
1136
  FormItem,
1105
1137
  Link,
1106
1138
  Modal,
1139
+ PageNotFound,
1107
1140
  Routes,
1108
1141
  Table,
1109
1142
  TimePicker,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.407",
3
+ "version": "0.0.2-beta.408",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -28,7 +28,7 @@
28
28
  "lodash": "*",
29
29
  "react": "*",
30
30
  "react-dom": "*",
31
- "@faasjs/react": "^0.0.2-beta.407",
31
+ "@faasjs/react": "^0.0.2-beta.408",
32
32
  "react-router-dom": "*",
33
33
  "dayjs": "*"
34
34
  },