@faasjs/ant-design 0.0.2-beta.405 → 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 = {
@@ -222,15 +230,16 @@ declare type FormItemInputProps = StringProps | StringListProps | NumberProps |
222
230
  declare type ExtendFormTypeProps = {
223
231
  children?: JSX.Element | null;
224
232
  };
233
+ declare type ExtendTypes = {
234
+ [type: string]: ExtendFormTypeProps;
235
+ };
225
236
  declare type ExtendFormItemProps = BaseItemProps & FormItemProps$1;
226
237
  declare type FormItemProps<T = any> = {
227
238
  children?: JSX.Element | null;
228
239
  render?: () => JSX.Element | null;
229
240
  rules?: RuleObject[];
230
241
  label?: string | false;
231
- extendTypes?: {
232
- [type: string]: ExtendFormTypeProps;
233
- };
242
+ extendTypes?: ExtendTypes;
234
243
  } & FormItemInputProps & FaasItemProps & Omit<FormItemProps$1<T>, 'children'>;
235
244
  /**
236
245
  * FormItem, can be used without Form.
@@ -287,9 +296,7 @@ declare type FormProps<Values = any, ExtendItemProps = any> = {
287
296
  onFinish?: (values: Values, submit?: (values: any) => Promise<any>) => Promise<any>;
288
297
  beforeItems?: JSX.Element | JSX.Element[];
289
298
  footer?: JSX.Element | JSX.Element[];
290
- extendTypes?: {
291
- [type: string]: ExtendFormTypeProps;
292
- };
299
+ extendTypes?: ExtendTypes;
293
300
  children?: ReactNode;
294
301
  } & Omit<FormProps$1<Values>, 'onFinish' | 'children'>;
295
302
  declare function Form<Values = any>(props: FormProps<Values>): JSX.Element;
@@ -298,6 +305,14 @@ declare namespace Form {
298
305
  var Item: typeof FormItem;
299
306
  }
300
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
+
301
316
  declare type ModalProps = ModalProps$1 & {
302
317
  children?: JSX.Element | JSX.Element[] | string;
303
318
  };
@@ -329,6 +344,25 @@ declare type RoutesProps = {
329
344
  fallback?: JSX.Element;
330
345
  notFound?: JSX.Element;
331
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
+ */
332
366
  declare function Routes(props: RoutesProps): JSX.Element;
333
367
 
334
368
  declare type TableItemProps<T = any> = {
@@ -390,4 +424,4 @@ declare type TitleProps = {
390
424
  */
391
425
  declare function Title(props: TitleProps): JSX.Element;
392
426
 
393
- export { BaseItemProps, BaseOption, Blank, BlankProps, Calendar, CalendarProps, ConfigContext, ConfigProvider, DatePicker, DatePickerProps, Description, DescriptionItemProps, DescriptionProps, DrawerProps, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, 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 };