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

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  [![NPM Stable Version](https://img.shields.io/npm/v/@faasjs/browser/stable.svg)](https://www.npmjs.com/package/@faasjs/browser)
5
5
  [![NPM Beta Version](https://img.shields.io/npm/v/@faasjs/browser/beta.svg)](https://www.npmjs.com/package/@faasjs/browser)
6
6
 
7
- UI components based on [FaasJS](https://faasjs.com) and [Ant Design](https://ant.design).
7
+ UI components based on [FaasJS](https://faasjs.com), [Ant Design](https://ant.design) and [React Router](https://reactrouter.com).
8
8
 
9
9
  ## Install
10
10
 
package/dist/index.d.ts CHANGED
@@ -3,7 +3,8 @@ import { Dayjs } from 'dayjs';
3
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';
4
4
  export { Drawer, Modal } from 'antd';
5
5
  import * as react from 'react';
6
- import { ReactNode, LazyExoticComponent, ComponentType } from 'react';
6
+ import { CSSProperties, ReactNode, LazyExoticComponent, ComponentType } from 'react';
7
+ import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/lib/config-provider';
7
8
  import * as antd_es_date_picker_generatePicker_interface from 'antd/es/date-picker/generatePicker/interface';
8
9
  import * as antd_es_date_picker_generatePicker from 'antd/es/date-picker/generatePicker';
9
10
  import { PickerDateProps, PickerTimeProps } from 'antd/es/date-picker/generatePicker';
@@ -34,31 +35,38 @@ declare function Blank(options?: BlankProps): any;
34
35
  declare type CalendarProps = CalendarProps$1<Dayjs>;
35
36
  declare const Calendar: (props: antd_es_calendar_generateCalendar_js.CalendarProps<Dayjs>) => JSX.Element;
36
37
 
37
- declare type FaasState = {
38
- lang: string;
39
- common: {
40
- blank: string;
41
- all: string;
42
- submit: string;
43
- pageNotFound: string;
44
- add: string;
45
- delete: string;
46
- required: string;
38
+ declare type ConfigProviderProps = {
39
+ antd?: ConfigProviderProps$1;
40
+ lang?: string;
41
+ common?: {
42
+ blank?: string;
43
+ all?: string;
44
+ submit?: string;
45
+ pageNotFound?: string;
46
+ add?: string;
47
+ delete?: string;
48
+ required?: string;
47
49
  };
48
- Blank: {
49
- text: string;
50
+ Blank?: {
51
+ text?: string;
50
52
  };
51
- Form: {
52
- submit: {
53
- text: string;
53
+ Form?: {
54
+ submit?: {
55
+ text?: string;
54
56
  };
55
57
  };
56
- Title: {
57
- separator: string;
58
- suffix: string;
58
+ Title?: {
59
+ /** ' - ' as default */
60
+ separator?: string;
61
+ suffix?: string;
62
+ };
63
+ Link?: {
64
+ /** '_blank' as default */
65
+ target?: string;
66
+ style?: CSSProperties;
59
67
  };
60
68
  };
61
- declare const ConfigContext: react.Context<FaasState>;
69
+ declare const ConfigContext: react.Context<ConfigProviderProps>;
62
70
  /**
63
71
  * Config for @faasjs/ant-design components.
64
72
  *
@@ -73,10 +81,10 @@ declare const ConfigContext: react.Context<FaasState>;
73
81
  * ```
74
82
  */
75
83
  declare function ConfigProvider({ config, children }: {
76
- config: Partial<FaasState>;
84
+ config: ConfigProviderProps;
77
85
  children: React.ReactNode;
78
86
  }): JSX.Element;
79
- declare function useConfigContext(): FaasState;
87
+ declare function useConfigContext(): ConfigProviderProps;
80
88
 
81
89
  declare type FaasItemType = 'string' | 'string[]' | 'number' | 'number[]' | 'boolean' | 'date' | 'time' | 'object' | 'object[]';
82
90
  declare type FaasItemTypeValue = {
@@ -297,6 +305,14 @@ declare namespace Form {
297
305
  var Item: typeof FormItem;
298
306
  }
299
307
 
308
+ declare function Link({ href, target, text, children, style }: {
309
+ href: string;
310
+ target?: string;
311
+ text?: string | number;
312
+ children?: ReactNode;
313
+ style?: CSSProperties;
314
+ }): JSX.Element;
315
+
300
316
  declare type ModalProps = ModalProps$1 & {
301
317
  children?: JSX.Element | JSX.Element[] | string;
302
318
  };
@@ -328,6 +344,25 @@ declare type RoutesProps = {
328
344
  fallback?: JSX.Element;
329
345
  notFound?: JSX.Element;
330
346
  };
347
+ /**
348
+ * Routes with lazy loading and 404 page.
349
+ *
350
+ * ```tsx
351
+ * import { lazy } from 'react'
352
+ * import { BrowserRouter } from 'react-router-dom'
353
+ *
354
+ * export function App () {
355
+ * return <BrowserRouter>
356
+ * <Routes routes={[
357
+ * {
358
+ * path: '/',
359
+ * page: lazy(() => import('./pages/home'))
360
+ * }
361
+ * ]} />
362
+ * </BrowserRouter>
363
+ * }
364
+ * ```
365
+ */
331
366
  declare function Routes(props: RoutesProps): JSX.Element;
332
367
 
333
368
  declare type TableItemProps<T = any> = {
@@ -389,4 +424,4 @@ declare type TitleProps = {
389
424
  */
390
425
  declare function Title(props: TitleProps): JSX.Element;
391
426
 
392
- export { BaseItemProps, BaseOption, Blank, BlankProps, Calendar, CalendarProps, ConfigContext, ConfigProvider, DatePicker, DatePickerProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasItemProps, FaasItemType, FaasItemTypeValue, FaasState, Form, FormItem, FormItemProps, FormProps, ModalProps, Routes, RoutesProps, Table, TableItemProps, TableProps, TimePicker, TimePickerProps, Title, TitleProps, setDrawerProps, setModalProps, transferOptions, useConfigContext, useDrawer, useModal };
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 };
package/dist/index.js CHANGED
@@ -32,10 +32,11 @@ __export(src_exports, {
32
32
  ConfigProvider: () => ConfigProvider,
33
33
  DatePicker: () => DatePicker,
34
34
  Description: () => Description,
35
- Drawer: () => import_antd3.Drawer,
35
+ Drawer: () => import_antd4.Drawer,
36
36
  Form: () => Form,
37
37
  FormItem: () => FormItem,
38
- Modal: () => import_antd6.Modal,
38
+ Link: () => Link,
39
+ Modal: () => import_antd7.Modal,
39
40
  Routes: () => Routes,
40
41
  Table: () => Table,
41
42
  TimePicker: () => TimePicker,
@@ -51,11 +52,13 @@ module.exports = __toCommonJS(src_exports);
51
52
  var import_react = __toESM(require("react"));
52
53
 
53
54
  // src/Blank.tsx
54
- var import_antd = require("antd");
55
- var import_lodash = require("lodash");
55
+ var import_antd2 = require("antd");
56
+ var import_lodash2 = require("lodash");
56
57
 
57
58
  // src/Config.tsx
58
59
  var import_react2 = require("react");
60
+ var import_antd = require("antd");
61
+ var import_lodash = require("lodash");
59
62
  var import_jsx_runtime = require("react/jsx-runtime");
60
63
  var isZH = /^zh/i.test(navigator.language);
61
64
  var common = isZH ? {
@@ -78,6 +81,7 @@ var common = isZH ? {
78
81
  required: "is required"
79
82
  };
80
83
  var baseConfig = {
84
+ antd: {},
81
85
  lang: "en",
82
86
  common,
83
87
  Blank: { text: common.blank },
@@ -85,7 +89,8 @@ var baseConfig = {
85
89
  Title: {
86
90
  separator: " - ",
87
91
  suffix: ""
88
- }
92
+ },
93
+ Link: { style: {} }
89
94
  };
90
95
  var ConfigContext = (0, import_react2.createContext)(baseConfig);
91
96
  function ConfigProvider({
@@ -93,11 +98,11 @@ function ConfigProvider({
93
98
  children
94
99
  }) {
95
100
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfigContext.Provider, {
96
- value: {
97
- ...baseConfig,
98
- ...config
99
- },
100
- children
101
+ value: (0, import_lodash.defaultsDeep)(config, baseConfig),
102
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.ConfigProvider, {
103
+ ...config.antd,
104
+ children
105
+ })
101
106
  });
102
107
  }
103
108
  function useConfigContext() {
@@ -107,10 +112,10 @@ function useConfigContext() {
107
112
  // src/Blank.tsx
108
113
  var import_jsx_runtime = require("react/jsx-runtime");
109
114
  function Blank(options) {
110
- const config = useConfigContext();
111
- return !options || (0, import_lodash.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Typography.Text, {
115
+ const { Blank: Blank2 } = useConfigContext();
116
+ return !options || (0, import_lodash2.isNil)(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Typography.Text, {
112
117
  disabled: true,
113
- children: (options == null ? void 0 : options.text) || config.Blank.text
118
+ children: (options == null ? void 0 : options.text) || Blank2.text
114
119
  }) : options.value;
115
120
  }
116
121
 
@@ -121,12 +126,12 @@ var import_style = require("antd/es/calendar/style/index.js");
121
126
  var Calendar = (0, import_generateCalendar.default)(import_dayjs.default);
122
127
 
123
128
  // src/data.ts
124
- var import_lodash2 = require("lodash");
129
+ var import_lodash3 = require("lodash");
125
130
  function transferOptions(options) {
126
131
  if (!options)
127
132
  return [];
128
133
  return options.map((item) => typeof item === "object" ? item : {
129
- label: (0, import_lodash2.upperFirst)(item.toString()),
134
+ label: (0, import_lodash3.upperFirst)(item.toString()),
130
135
  value: item
131
136
  });
132
137
  }
@@ -139,8 +144,8 @@ var DatePicker = (0, import_generatePicker.default)(import_dayjs2.default);
139
144
 
140
145
  // src/Description.tsx
141
146
  var import_icons = require("@ant-design/icons");
142
- var import_antd2 = require("antd");
143
- var import_lodash3 = require("lodash");
147
+ var import_antd3 = require("antd");
148
+ var import_lodash4 = require("lodash");
144
149
  var import_react3 = require("react");
145
150
  var import_dayjs3 = __toESM(require("dayjs"));
146
151
  var import_react4 = require("@faasjs/react");
@@ -151,7 +156,7 @@ function DescriptionItemContent(props) {
151
156
  var _a, _b;
152
157
  const propsCopy = { ...props };
153
158
  if (!propsCopy.item.title)
154
- propsCopy.item.title = (0, import_lodash3.upperFirst)(propsCopy.item.id);
159
+ propsCopy.item.title = (0, import_lodash4.upperFirst)(propsCopy.item.id);
155
160
  if (!propsCopy.item.type)
156
161
  propsCopy.item.type = "string";
157
162
  if ((_a = propsCopy.item.options) == null ? void 0 : _a.length) {
@@ -234,10 +239,10 @@ function DescriptionItemContent(props) {
234
239
  }
235
240
  function Description(props) {
236
241
  if (!props.faasData)
237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
242
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
238
243
  ...props,
239
- children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
240
- label: item.title || (0, import_lodash3.upperFirst)(item.id),
244
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
245
+ label: item.title || (0, import_lodash4.upperFirst)(item.id),
241
246
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
242
247
  item,
243
248
  value: props.dataSource[item.id],
@@ -247,13 +252,13 @@ function Description(props) {
247
252
  }, item.id))
248
253
  });
249
254
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react4.FaasDataWrapper, {
250
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Skeleton, {
255
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Skeleton, {
251
256
  active: true
252
257
  }),
253
- render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions, {
258
+ render: ({ data }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions, {
254
259
  ...props,
255
- children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd2.Descriptions.Item, {
256
- label: item.title || (0, import_lodash3.upperFirst)(item.id),
260
+ children: props.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Descriptions.Item, {
261
+ label: item.title || (0, import_lodash4.upperFirst)(item.id),
257
262
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DescriptionItemContent, {
258
263
  item,
259
264
  value: data[item.id],
@@ -267,7 +272,7 @@ function Description(props) {
267
272
  }
268
273
 
269
274
  // src/Drawer.tsx
270
- var import_antd3 = require("antd");
275
+ var import_antd4 = require("antd");
271
276
  var import_react5 = require("react");
272
277
  var import_jsx_runtime = require("react/jsx-runtime");
273
278
  function useDrawer(init) {
@@ -280,7 +285,7 @@ function useDrawer(init) {
280
285
  ...init
281
286
  });
282
287
  return {
283
- drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd3.Drawer, {
288
+ drawer: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Drawer, {
284
289
  ...props
285
290
  }),
286
291
  drawerProps: props,
@@ -295,14 +300,14 @@ function useDrawer(init) {
295
300
 
296
301
  // src/Form.tsx
297
302
  var import_react8 = require("@faasjs/react");
298
- var import_antd5 = require("antd");
303
+ var import_antd6 = require("antd");
299
304
  var import_react9 = require("react");
300
305
 
301
306
  // src/FormItem.tsx
302
- var import_antd4 = require("antd");
307
+ var import_antd5 = require("antd");
303
308
  var import_icons2 = require("@ant-design/icons");
304
309
  var import_react7 = require("react");
305
- var import_lodash4 = require("lodash");
310
+ var import_lodash5 = require("lodash");
306
311
 
307
312
  // src/TimePicker.tsx
308
313
  var import_react6 = require("react");
@@ -322,7 +327,7 @@ var import_dayjs4 = __toESM(require("dayjs"));
322
327
  var import_jsx_runtime = require("react/jsx-runtime");
323
328
  function processProps(propsCopy, config) {
324
329
  if (!propsCopy.title)
325
- propsCopy.title = (0, import_lodash4.upperFirst)(propsCopy.id);
330
+ propsCopy.title = (0, import_lodash5.upperFirst)(propsCopy.id);
326
331
  if (!propsCopy.label && propsCopy.label !== false)
327
332
  propsCopy.label = propsCopy.title;
328
333
  if (!propsCopy.name)
@@ -402,40 +407,40 @@ function FormItem(props) {
402
407
  if (!computedProps)
403
408
  return null;
404
409
  if (extendTypes && extendTypes[computedProps.type])
405
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
410
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
406
411
  ...computedProps,
407
412
  children: extendTypes[computedProps.type].children
408
413
  });
409
414
  if (computedProps.children)
410
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
415
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
411
416
  ...computedProps,
412
417
  children: computedProps.children
413
418
  });
414
419
  if (computedProps.render)
415
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
420
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
416
421
  ...computedProps,
417
422
  children: computedProps.render()
418
423
  });
419
424
  switch (computedProps.type) {
420
425
  case "string":
421
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
426
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
422
427
  ...computedProps,
423
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
428
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
424
429
  ...computedProps.input
425
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
430
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
426
431
  ...computedProps.input
427
432
  })
428
433
  });
429
434
  case "string[]":
430
435
  if (computedProps.options)
431
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
436
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
432
437
  ...computedProps,
433
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
438
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
434
439
  mode: "multiple",
435
440
  ...computedProps.input
436
441
  })
437
442
  });
438
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
443
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
439
444
  name: computedProps.name,
440
445
  rules: computedProps.rules,
441
446
  children: (fields, { add, remove }, { errors }) => {
@@ -451,24 +456,24 @@ function FormItem(props) {
451
456
  }),
452
457
  fields.map((field) => {
453
458
  var _a3;
454
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
455
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
459
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
460
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
456
461
  gutter: 24,
457
462
  style: { flexFlow: "row nowrap" },
458
463
  children: [
459
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
464
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
460
465
  span: 23,
461
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
466
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
462
467
  ...field,
463
468
  noStyle: true,
464
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Input, {
469
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Input, {
465
470
  ...computedProps.input
466
471
  })
467
472
  })
468
473
  }),
469
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
474
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
470
475
  span: 1,
471
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
476
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
472
477
  danger: true,
473
478
  type: "link",
474
479
  style: { float: "right" },
@@ -480,15 +485,15 @@ function FormItem(props) {
480
485
  })
481
486
  }, field.key);
482
487
  }),
483
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
488
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
484
489
  children: [
485
- !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
490
+ !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
486
491
  type: "dashed",
487
492
  block: true,
488
493
  onClick: () => add(),
489
494
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
490
495
  }),
491
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
496
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
492
497
  errors
493
498
  })
494
499
  ]
@@ -498,25 +503,25 @@ function FormItem(props) {
498
503
  }
499
504
  });
500
505
  case "number":
501
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
506
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
502
507
  ...computedProps,
503
- children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
508
+ children: computedProps.options ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
504
509
  ...computedProps.input
505
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
510
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
506
511
  style: { width: "100%" },
507
512
  ...computedProps.input
508
513
  })
509
514
  });
510
515
  case "number[]":
511
516
  if (computedProps.options)
512
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
517
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
513
518
  ...computedProps,
514
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Select, {
519
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Select, {
515
520
  mode: "multiple",
516
521
  ...computedProps.input
517
522
  })
518
523
  });
519
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
524
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
520
525
  name: computedProps.name,
521
526
  rules: computedProps.rules,
522
527
  children: (fields, { add, remove }, { errors }) => {
@@ -532,25 +537,25 @@ function FormItem(props) {
532
537
  }),
533
538
  fields.map((field) => {
534
539
  var _a3;
535
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
536
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Row, {
540
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
541
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Row, {
537
542
  gutter: 24,
538
543
  style: { flexFlow: "row nowrap" },
539
544
  children: [
540
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
545
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
541
546
  span: 23,
542
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
547
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
543
548
  ...field,
544
549
  noStyle: true,
545
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.InputNumber, {
550
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.InputNumber, {
546
551
  style: { width: "100%" },
547
552
  ...computedProps.input
548
553
  })
549
554
  })
550
555
  }),
551
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
556
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
552
557
  span: 1,
553
- children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
558
+ children: !((_a3 = computedProps.input) == null ? void 0 : _a3.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
554
559
  danger: true,
555
560
  type: "link",
556
561
  style: { float: "right" },
@@ -562,15 +567,15 @@ function FormItem(props) {
562
567
  })
563
568
  }, field.key);
564
569
  }),
565
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
570
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
566
571
  children: [
567
- !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
572
+ !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
568
573
  type: "dashed",
569
574
  block: true,
570
575
  onClick: () => add(),
571
576
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons2.PlusOutlined, {})
572
577
  }),
573
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
578
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
574
579
  errors
575
580
  })
576
581
  ]
@@ -580,21 +585,21 @@ function FormItem(props) {
580
585
  }
581
586
  });
582
587
  case "boolean":
583
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
588
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
584
589
  ...computedProps,
585
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Switch, {
590
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Switch, {
586
591
  ...computedProps.input
587
592
  })
588
593
  });
589
594
  case "date":
590
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
595
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
591
596
  ...computedProps,
592
597
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DateItem, {
593
598
  ...computedProps.input
594
599
  })
595
600
  });
596
601
  case "time":
597
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.Item, {
602
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.Item, {
598
603
  ...computedProps,
599
604
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TimeItem, {
600
605
  ...computedProps.input
@@ -616,12 +621,12 @@ function FormItem(props) {
616
621
  ]
617
622
  });
618
623
  case "object[]":
619
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.List, {
624
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.List, {
620
625
  name: computedProps.name,
621
626
  rules: computedProps.rules,
622
627
  children: (fields, { add, remove }, { errors }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
623
628
  children: [
624
- fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
629
+ fields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
625
630
  style: { marginBottom: 0 },
626
631
  children: [
627
632
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -631,7 +636,7 @@ function FormItem(props) {
631
636
  computedProps.label,
632
637
  " ",
633
638
  field.name + 1,
634
- !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Button, {
639
+ !computedProps.disabled && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
635
640
  danger: true,
636
641
  type: "link",
637
642
  onClick: () => remove(field.name),
@@ -640,9 +645,9 @@ function FormItem(props) {
640
645
  ]
641
646
  })
642
647
  }),
643
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Row, {
648
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Row, {
644
649
  gutter: 24,
645
- children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Col, {
650
+ children: computedProps.object.map((o) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Col, {
646
651
  span: o.col || 6,
647
652
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, {
648
653
  ...o,
@@ -652,9 +657,9 @@ function FormItem(props) {
652
657
  })
653
658
  ]
654
659
  }, field.key)),
655
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Form.Item, {
660
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form.Item, {
656
661
  children: [
657
- !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd4.Button, {
662
+ !computedProps.disabled && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Button, {
658
663
  type: "dashed",
659
664
  block: true,
660
665
  onClick: () => add(),
@@ -665,7 +670,7 @@ function FormItem(props) {
665
670
  computedProps.label
666
671
  ]
667
672
  }),
668
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd4.Form.ErrorList, {
673
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Form.ErrorList, {
669
674
  errors
670
675
  })
671
676
  ]
@@ -722,7 +727,7 @@ function Form(props) {
722
727
  }, []);
723
728
  if (!computedProps)
724
729
  return null;
725
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd5.Form, {
730
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd6.Form, {
726
731
  ...computedProps,
727
732
  children: [
728
733
  computedProps.beforeItems,
@@ -731,7 +736,7 @@ function Form(props) {
731
736
  extendTypes
732
737
  }, item.id)),
733
738
  computedProps.children,
734
- computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd5.Button, {
739
+ computedProps.submit !== false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Button, {
735
740
  htmlType: "submit",
736
741
  type: "primary",
737
742
  loading,
@@ -741,11 +746,34 @@ function Form(props) {
741
746
  ]
742
747
  });
743
748
  }
744
- Form.useForm = import_antd5.Form.useForm;
749
+ Form.useForm = import_antd6.Form.useForm;
745
750
  Form.Item = FormItem;
746
751
 
752
+ // src/Link.tsx
753
+ var import_react_router_dom = require("react-router-dom");
754
+ var import_jsx_runtime = require("react/jsx-runtime");
755
+ function Link({
756
+ href,
757
+ target,
758
+ text,
759
+ children,
760
+ style
761
+ }) {
762
+ const { Link: Link2 } = useConfigContext();
763
+ style = Object.assign({ cursor: "pointer" }, style);
764
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Link, {
765
+ to: href,
766
+ target: target || (Link2 == null ? void 0 : Link2.target),
767
+ style: {
768
+ ...Link2.style,
769
+ ...style || {}
770
+ },
771
+ children: text || children
772
+ });
773
+ }
774
+
747
775
  // src/Modal.tsx
748
- var import_antd6 = require("antd");
776
+ var import_antd7 = require("antd");
749
777
  var import_react10 = require("react");
750
778
  var import_jsx_runtime = require("react/jsx-runtime");
751
779
  function useModal(init) {
@@ -758,7 +786,7 @@ function useModal(init) {
758
786
  ...init
759
787
  });
760
788
  return {
761
- modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd6.Modal, {
789
+ modal: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Modal, {
762
790
  ...props
763
791
  }),
764
792
  modalProps: props,
@@ -772,33 +800,33 @@ function useModal(init) {
772
800
  }
773
801
 
774
802
  // src/Routers.tsx
775
- var import_antd7 = require("antd");
803
+ var import_antd8 = require("antd");
776
804
  var import_react11 = require("react");
777
- var import_react_router_dom = require("react-router-dom");
805
+ var import_react_router_dom2 = require("react-router-dom");
778
806
  var import_jsx_runtime = require("react/jsx-runtime");
779
807
  function NotFound() {
780
808
  const config = useConfigContext();
781
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Result, {
809
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Result, {
782
810
  status: "404",
783
811
  title: config.common.pageNotFound
784
812
  });
785
813
  }
786
814
  function Routes(props) {
787
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom.Routes, {
815
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_router_dom2.Routes, {
788
816
  children: [
789
- props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
817
+ props.routes.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
790
818
  ...r,
791
819
  element: r.element || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react11.Suspense, {
792
820
  fallback: props.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
793
821
  style: { padding: "24px" },
794
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd7.Skeleton, {
822
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
795
823
  active: true
796
824
  })
797
825
  }),
798
826
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(r.page, {})
799
827
  })
800
828
  }, r.path)),
801
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom.Route, {
829
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_router_dom2.Route, {
802
830
  path: "*",
803
831
  element: props.notFound || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NotFound, {})
804
832
  }, "*")
@@ -808,10 +836,10 @@ function Routes(props) {
808
836
 
809
837
  // src/Table.tsx
810
838
  var import_react12 = require("react");
811
- var import_antd8 = require("antd");
839
+ var import_antd9 = require("antd");
812
840
  var import_dayjs5 = __toESM(require("dayjs"));
813
841
  var import_icons3 = require("@ant-design/icons");
814
- var import_lodash5 = require("lodash");
842
+ var import_lodash6 = require("lodash");
815
843
  var import_react13 = require("@faasjs/react");
816
844
  var import_jsx_runtime = require("react/jsx-runtime");
817
845
  function processValue(item, value) {
@@ -854,7 +882,7 @@ function Table(props) {
854
882
  if (!item.dataIndex)
855
883
  item.dataIndex = item.id;
856
884
  if (!item.title)
857
- item.title = (0, import_lodash5.upperFirst)(item.id);
885
+ item.title = (0, import_lodash6.upperFirst)(item.id);
858
886
  if (!item.type)
859
887
  item.type = "string";
860
888
  if ((_a = item.options) == null ? void 0 : _a.length) {
@@ -918,7 +946,7 @@ function Table(props) {
918
946
  setSelectedKeys,
919
947
  selectedKeys,
920
948
  confirm
921
- }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd8.Radio.Group, {
949
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_antd9.Radio.Group, {
922
950
  style: { padding: 8 },
923
951
  buttonStyle: "solid",
924
952
  value: selectedKeys[0],
@@ -927,10 +955,10 @@ function Table(props) {
927
955
  confirm();
928
956
  },
929
957
  children: [
930
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
958
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
931
959
  children: config.common.all
932
960
  }),
933
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
961
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
934
962
  value: "true",
935
963
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CheckOutlined, {
936
964
  style: {
@@ -939,7 +967,7 @@ function Table(props) {
939
967
  }
940
968
  })
941
969
  }),
942
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
970
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
943
971
  value: "false",
944
972
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons3.CloseOutlined, {
945
973
  style: {
@@ -948,7 +976,7 @@ function Table(props) {
948
976
  }
949
977
  })
950
978
  }),
951
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Radio.Button, {
979
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Radio.Button, {
952
980
  value: "empty",
953
981
  children: config.common.blank
954
982
  })
@@ -958,11 +986,11 @@ function Table(props) {
958
986
  item.onFilter = (value, row) => {
959
987
  switch (value) {
960
988
  case "true":
961
- return !(0, import_lodash5.isNil)(row[item.id]) && !!row[item.id];
989
+ return !(0, import_lodash6.isNil)(row[item.id]) && !!row[item.id];
962
990
  case "false":
963
- return !(0, import_lodash5.isNil)(row[item.id]) && !row[item.id];
991
+ return !(0, import_lodash6.isNil)(row[item.id]) && !row[item.id];
964
992
  case "empty":
965
- return (0, import_lodash5.isNil)(row[item.id]);
993
+ return (0, import_lodash6.isNil)(row[item.id]);
966
994
  default:
967
995
  return true;
968
996
  }
@@ -990,14 +1018,14 @@ function Table(props) {
990
1018
  if (!columns)
991
1019
  return null;
992
1020
  if (!props.faasData)
993
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1021
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
994
1022
  ...props,
995
1023
  rowKey: props.rowKey || "id",
996
1024
  columns,
997
1025
  dataSource: props.dataSource
998
1026
  });
999
1027
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react13.FaasDataWrapper, {
1000
- fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Skeleton, {
1028
+ fallback: props.faasData.fallback || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Skeleton, {
1001
1029
  active: true
1002
1030
  }),
1003
1031
  render: ({
@@ -1006,20 +1034,20 @@ function Table(props) {
1006
1034
  reload
1007
1035
  }) => {
1008
1036
  if (!data)
1009
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1037
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1010
1038
  ...props,
1011
1039
  rowKey: props.rowKey || "id",
1012
1040
  columns,
1013
1041
  dataSource: []
1014
1042
  });
1015
1043
  if (Array.isArray(data))
1016
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1044
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1017
1045
  ...props,
1018
1046
  rowKey: props.rowKey || "id",
1019
1047
  columns,
1020
1048
  dataSource: data
1021
1049
  });
1022
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd8.Table, {
1050
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd9.Table, {
1023
1051
  ...props,
1024
1052
  rowKey: props.rowKey || "id",
1025
1053
  columns,
@@ -1087,6 +1115,7 @@ function Title(props) {
1087
1115
  Drawer,
1088
1116
  Form,
1089
1117
  FormItem,
1118
+ Link,
1090
1119
  Modal,
1091
1120
  Routes,
1092
1121
  Table,
package/dist/index.mjs CHANGED
@@ -6,7 +6,12 @@ import { Typography } from "antd";
6
6
  import { isNil } from "lodash";
7
7
 
8
8
  // src/Config.tsx
9
- import { createContext, useContext } from "react";
9
+ import {
10
+ createContext,
11
+ useContext
12
+ } from "react";
13
+ import { ConfigProvider as AntdConfigProvider } from "antd";
14
+ import { defaultsDeep } from "lodash";
10
15
  import { jsx } from "react/jsx-runtime";
11
16
  var isZH = /^zh/i.test(navigator.language);
12
17
  var common = isZH ? {
@@ -29,6 +34,7 @@ var common = isZH ? {
29
34
  required: "is required"
30
35
  };
31
36
  var baseConfig = {
37
+ antd: {},
32
38
  lang: "en",
33
39
  common,
34
40
  Blank: { text: common.blank },
@@ -36,7 +42,8 @@ var baseConfig = {
36
42
  Title: {
37
43
  separator: " - ",
38
44
  suffix: ""
39
- }
45
+ },
46
+ Link: { style: {} }
40
47
  };
41
48
  var ConfigContext = createContext(baseConfig);
42
49
  function ConfigProvider({
@@ -44,11 +51,11 @@ function ConfigProvider({
44
51
  children
45
52
  }) {
46
53
  return /* @__PURE__ */ jsx(ConfigContext.Provider, {
47
- value: {
48
- ...baseConfig,
49
- ...config
50
- },
51
- children
54
+ value: defaultsDeep(config, baseConfig),
55
+ children: /* @__PURE__ */ jsx(AntdConfigProvider, {
56
+ ...config.antd,
57
+ children
58
+ })
52
59
  });
53
60
  }
54
61
  function useConfigContext() {
@@ -58,10 +65,10 @@ function useConfigContext() {
58
65
  // src/Blank.tsx
59
66
  import { jsx as jsx2 } from "react/jsx-runtime";
60
67
  function Blank(options) {
61
- const config = useConfigContext();
68
+ const { Blank: Blank2 } = useConfigContext();
62
69
  return !options || isNil(options.value) || Array.isArray(options.value) && !options.value.length || options.value === "" ? /* @__PURE__ */ jsx2(Typography.Text, {
63
70
  disabled: true,
64
- children: (options == null ? void 0 : options.text) || config.Blank.text
71
+ children: (options == null ? void 0 : options.text) || Blank2.text
65
72
  }) : options.value;
66
73
  }
67
74
 
@@ -717,10 +724,33 @@ function Form(props) {
717
724
  Form.useForm = AntdForm2.useForm;
718
725
  Form.Item = FormItem;
719
726
 
727
+ // src/Link.tsx
728
+ import { Link as RouterLink } from "react-router-dom";
729
+ import { jsx as jsx8 } from "react/jsx-runtime";
730
+ function Link({
731
+ href,
732
+ target,
733
+ text,
734
+ children,
735
+ style
736
+ }) {
737
+ const { Link: Link2 } = useConfigContext();
738
+ style = Object.assign({ cursor: "pointer" }, style);
739
+ return /* @__PURE__ */ jsx8(RouterLink, {
740
+ to: href,
741
+ target: target || (Link2 == null ? void 0 : Link2.target),
742
+ style: {
743
+ ...Link2.style,
744
+ ...style || {}
745
+ },
746
+ children: text || children
747
+ });
748
+ }
749
+
720
750
  // src/Modal.tsx
721
751
  import { Modal } from "antd";
722
752
  import { useState as useState5 } from "react";
723
- import { jsx as jsx8 } from "react/jsx-runtime";
753
+ import { jsx as jsx9 } from "react/jsx-runtime";
724
754
  function useModal(init) {
725
755
  const [props, setProps] = useState5({
726
756
  visible: false,
@@ -731,7 +761,7 @@ function useModal(init) {
731
761
  ...init
732
762
  });
733
763
  return {
734
- modal: /* @__PURE__ */ jsx8(Modal, {
764
+ modal: /* @__PURE__ */ jsx9(Modal, {
735
765
  ...props
736
766
  }),
737
767
  modalProps: props,
@@ -753,10 +783,10 @@ import {
753
783
  Routes as OriginRoutes,
754
784
  Route
755
785
  } from "react-router-dom";
756
- import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
786
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
757
787
  function NotFound() {
758
788
  const config = useConfigContext();
759
- return /* @__PURE__ */ jsx9(Result, {
789
+ return /* @__PURE__ */ jsx10(Result, {
760
790
  status: "404",
761
791
  title: config.common.pageNotFound
762
792
  });
@@ -764,21 +794,21 @@ function NotFound() {
764
794
  function Routes(props) {
765
795
  return /* @__PURE__ */ jsxs3(OriginRoutes, {
766
796
  children: [
767
- props.routes.map((r) => /* @__PURE__ */ jsx9(Route, {
797
+ props.routes.map((r) => /* @__PURE__ */ jsx10(Route, {
768
798
  ...r,
769
- element: r.element || /* @__PURE__ */ jsx9(Suspense, {
770
- fallback: props.fallback || /* @__PURE__ */ jsx9("div", {
799
+ element: r.element || /* @__PURE__ */ jsx10(Suspense, {
800
+ fallback: props.fallback || /* @__PURE__ */ jsx10("div", {
771
801
  style: { padding: "24px" },
772
- children: /* @__PURE__ */ jsx9(Skeleton2, {
802
+ children: /* @__PURE__ */ jsx10(Skeleton2, {
773
803
  active: true
774
804
  })
775
805
  }),
776
- children: /* @__PURE__ */ jsx9(r.page, {})
806
+ children: /* @__PURE__ */ jsx10(r.page, {})
777
807
  })
778
808
  }, r.path)),
779
- /* @__PURE__ */ jsx9(Route, {
809
+ /* @__PURE__ */ jsx10(Route, {
780
810
  path: "*",
781
- element: props.notFound || /* @__PURE__ */ jsx9(NotFound, {})
811
+ element: props.notFound || /* @__PURE__ */ jsx10(NotFound, {})
782
812
  }, "*")
783
813
  ]
784
814
  });
@@ -799,7 +829,7 @@ import dayjs3 from "dayjs";
799
829
  import { CheckOutlined as CheckOutlined2, CloseOutlined as CloseOutlined2 } from "@ant-design/icons";
800
830
  import { isNil as isNil2, upperFirst as upperFirst4 } from "lodash";
801
831
  import { FaasDataWrapper as FaasDataWrapper2 } from "@faasjs/react";
802
- import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
832
+ import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
803
833
  function processValue(item, value) {
804
834
  var _a;
805
835
  if (typeof value !== "undefined" && value !== null) {
@@ -888,12 +918,12 @@ function Table(props) {
888
918
  item.onFilter = (value, row) => row[item.id].includes(value);
889
919
  break;
890
920
  case "boolean":
891
- item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx10(Blank, {}) : value ? /* @__PURE__ */ jsx10(CheckOutlined2, {
921
+ item.render = (value) => typeof value === "undefined" ? /* @__PURE__ */ jsx11(Blank, {}) : value ? /* @__PURE__ */ jsx11(CheckOutlined2, {
892
922
  style: {
893
923
  marginTop: "4px",
894
924
  color: "#52c41a"
895
925
  }
896
- }) : /* @__PURE__ */ jsx10(CloseOutlined2, {
926
+ }) : /* @__PURE__ */ jsx11(CloseOutlined2, {
897
927
  style: {
898
928
  marginTop: "4px",
899
929
  color: "#ff4d4f"
@@ -913,28 +943,28 @@ function Table(props) {
913
943
  confirm();
914
944
  },
915
945
  children: [
916
- /* @__PURE__ */ jsx10(Radio.Button, {
946
+ /* @__PURE__ */ jsx11(Radio.Button, {
917
947
  children: config.common.all
918
948
  }),
919
- /* @__PURE__ */ jsx10(Radio.Button, {
949
+ /* @__PURE__ */ jsx11(Radio.Button, {
920
950
  value: "true",
921
- children: /* @__PURE__ */ jsx10(CheckOutlined2, {
951
+ children: /* @__PURE__ */ jsx11(CheckOutlined2, {
922
952
  style: {
923
953
  color: "#52c41a",
924
954
  verticalAlign: "middle"
925
955
  }
926
956
  })
927
957
  }),
928
- /* @__PURE__ */ jsx10(Radio.Button, {
958
+ /* @__PURE__ */ jsx11(Radio.Button, {
929
959
  value: "false",
930
- children: /* @__PURE__ */ jsx10(CloseOutlined2, {
960
+ children: /* @__PURE__ */ jsx11(CloseOutlined2, {
931
961
  style: {
932
962
  verticalAlign: "middle",
933
963
  color: "#ff4d4f"
934
964
  }
935
965
  })
936
966
  }),
937
- /* @__PURE__ */ jsx10(Radio.Button, {
967
+ /* @__PURE__ */ jsx11(Radio.Button, {
938
968
  value: "empty",
939
969
  children: config.common.blank
940
970
  })
@@ -976,14 +1006,14 @@ function Table(props) {
976
1006
  if (!columns)
977
1007
  return null;
978
1008
  if (!props.faasData)
979
- return /* @__PURE__ */ jsx10(AntdTable, {
1009
+ return /* @__PURE__ */ jsx11(AntdTable, {
980
1010
  ...props,
981
1011
  rowKey: props.rowKey || "id",
982
1012
  columns,
983
1013
  dataSource: props.dataSource
984
1014
  });
985
- return /* @__PURE__ */ jsx10(FaasDataWrapper2, {
986
- fallback: props.faasData.fallback || /* @__PURE__ */ jsx10(Skeleton3, {
1015
+ return /* @__PURE__ */ jsx11(FaasDataWrapper2, {
1016
+ fallback: props.faasData.fallback || /* @__PURE__ */ jsx11(Skeleton3, {
987
1017
  active: true
988
1018
  }),
989
1019
  render: ({
@@ -992,20 +1022,20 @@ function Table(props) {
992
1022
  reload
993
1023
  }) => {
994
1024
  if (!data)
995
- return /* @__PURE__ */ jsx10(AntdTable, {
1025
+ return /* @__PURE__ */ jsx11(AntdTable, {
996
1026
  ...props,
997
1027
  rowKey: props.rowKey || "id",
998
1028
  columns,
999
1029
  dataSource: []
1000
1030
  });
1001
1031
  if (Array.isArray(data))
1002
- return /* @__PURE__ */ jsx10(AntdTable, {
1032
+ return /* @__PURE__ */ jsx11(AntdTable, {
1003
1033
  ...props,
1004
1034
  rowKey: props.rowKey || "id",
1005
1035
  columns,
1006
1036
  dataSource: data
1007
1037
  });
1008
- return /* @__PURE__ */ jsx10(AntdTable, {
1038
+ return /* @__PURE__ */ jsx11(AntdTable, {
1009
1039
  ...props,
1010
1040
  rowKey: props.rowKey || "id",
1011
1041
  columns,
@@ -1040,7 +1070,7 @@ function Table(props) {
1040
1070
 
1041
1071
  // src/Title.tsx
1042
1072
  import { useEffect as useEffect5, cloneElement as cloneElement3 } from "react";
1043
- import { jsx as jsx11 } from "react/jsx-runtime";
1073
+ import { jsx as jsx12 } from "react/jsx-runtime";
1044
1074
  function Title(props) {
1045
1075
  const config = useConfigContext();
1046
1076
  useEffect5(() => {
@@ -1049,10 +1079,10 @@ function Title(props) {
1049
1079
  }, []);
1050
1080
  if (props.h1) {
1051
1081
  if (typeof props.h1 === "boolean")
1052
- return /* @__PURE__ */ jsx11("h1", {
1082
+ return /* @__PURE__ */ jsx12("h1", {
1053
1083
  children: Array.isArray(props.title) ? props.title[0] : props.title
1054
1084
  });
1055
- return /* @__PURE__ */ jsx11("h1", {
1085
+ return /* @__PURE__ */ jsx12("h1", {
1056
1086
  className: props.h1.className,
1057
1087
  style: props.h1.style,
1058
1088
  children: Array.isArray(props.title) ? props.title[0] : props.title
@@ -1072,6 +1102,7 @@ export {
1072
1102
  Drawer,
1073
1103
  Form,
1074
1104
  FormItem,
1105
+ Link,
1075
1106
  Modal,
1076
1107
  Routes,
1077
1108
  Table,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.406",
3
+ "version": "0.0.2-beta.407",
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.406",
31
+ "@faasjs/react": "^0.0.2-beta.407",
32
32
  "react-router-dom": "*",
33
33
  "dayjs": "*"
34
34
  },