@faasjs/ant-design 0.0.2-beta.406 → 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/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
@@ -1,9 +1,10 @@
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
- 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,15 @@ declare namespace Form {
297
305
  var Item: typeof FormItem;
298
306
  }
299
307
 
308
+ declare function Link({ href, target, text, children, style, button, }: {
309
+ href: string;
310
+ target?: string;
311
+ text?: string | number;
312
+ children?: ReactNode;
313
+ style?: CSSProperties;
314
+ button?: ButtonProps;
315
+ }): JSX.Element;
316
+
300
317
  declare type ModalProps = ModalProps$1 & {
301
318
  children?: JSX.Element | JSX.Element[] | string;
302
319
  };
@@ -321,6 +338,7 @@ declare function useModal(init?: ModalProps): {
321
338
  setModalProps(changes: Partial<ModalProps>): void;
322
339
  };
323
340
 
341
+ declare function PageNotFound(): JSX.Element;
324
342
  declare type RoutesProps = {
325
343
  routes: (RouteProps & {
326
344
  page?: LazyExoticComponent<ComponentType<any>>;
@@ -328,6 +346,25 @@ declare type RoutesProps = {
328
346
  fallback?: JSX.Element;
329
347
  notFound?: JSX.Element;
330
348
  };
349
+ /**
350
+ * Routes with lazy loading and 404 page.
351
+ *
352
+ * ```tsx
353
+ * import { lazy } from 'react'
354
+ * import { BrowserRouter } from 'react-router-dom'
355
+ *
356
+ * export function App () {
357
+ * return <BrowserRouter>
358
+ * <Routes routes={[
359
+ * {
360
+ * path: '/',
361
+ * page: lazy(() => import('./pages/home'))
362
+ * }
363
+ * ]} />
364
+ * </BrowserRouter>
365
+ * }
366
+ * ```
367
+ */
331
368
  declare function Routes(props: RoutesProps): JSX.Element;
332
369
 
333
370
  declare type TableItemProps<T = any> = {
@@ -389,4 +426,4 @@ declare type TitleProps = {
389
426
  */
390
427
  declare function Title(props: TitleProps): JSX.Element;
391
428
 
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 };
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 };