@faasjs/ant-design 0.0.4-beta.9 → 0.0.5-beta.1

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,4 +1,4 @@
1
- import { FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1, ErrorBoundaryProps } from '@faasjs/react';
1
+ import { ErrorBoundaryProps, FaasReactClientOptions, FaasDataInjection as FaasDataInjection$1, FaasDataWrapperProps as FaasDataWrapperProps$1 } from '@faasjs/react';
2
2
  export { ErrorBoundaryProps, faas, useFaas } from '@faasjs/react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ConfigProviderProps as ConfigProviderProps$1 } from 'antd/es/config-provider';
@@ -73,11 +73,64 @@ declare function useDrawer(init?: DrawerProps): {
73
73
  setDrawerProps(changes: Partial<DrawerProps>): void;
74
74
  };
75
75
 
76
+ declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
77
+
78
+ interface ConfigProviderProps {
79
+ faasClientOptions?: FaasReactClientOptions;
80
+ children: React.ReactNode;
81
+ theme?: {
82
+ lang?: string;
83
+ common?: {
84
+ blank?: string;
85
+ all?: string;
86
+ submit?: string;
87
+ pageNotFound?: string;
88
+ add?: string;
89
+ delete?: string;
90
+ required?: string;
91
+ search?: string;
92
+ reset?: string;
93
+ };
94
+ Blank?: {
95
+ text?: string;
96
+ };
97
+ Form?: {
98
+ submit?: {
99
+ text?: string;
100
+ };
101
+ };
102
+ Title?: {
103
+ /** ' - ' as default */
104
+ separator?: string;
105
+ suffix?: string;
106
+ };
107
+ Link?: {
108
+ /** '_blank' as default */
109
+ target?: string;
110
+ style?: CSSProperties;
111
+ };
112
+ };
113
+ }
114
+ declare const ConfigContext: react.Context<Partial<ConfigProviderProps>>;
115
+ /**
116
+ * Config for @faasjs/ant-design components.
117
+ *
118
+ * ```ts
119
+ * <ConfigProvider theme={{ common: { blank: 'Empty' } }}>
120
+ * <Blank />
121
+ * </ConfigProvider>
122
+ * ```
123
+ */
124
+ declare function ConfigProvider(props: ConfigProviderProps): react_jsx_runtime.JSX.Element;
125
+ declare function useConfigContext(): Partial<ConfigProviderProps>;
126
+
76
127
  interface AppProps {
77
128
  children: React.ReactNode;
78
129
  styleProviderProps?: StyleProviderProps;
79
130
  configProviderProps?: ConfigProviderProps$1;
80
131
  browserRouterProps?: BrowserRouterProps;
132
+ errorBoundaryProps?: Omit<ErrorBoundaryProps, 'children'>;
133
+ faasConfigProviderProps?: Omit<ConfigProviderProps, 'children'>;
81
134
  }
82
135
  interface useAppProps {
83
136
  message: MessageInstance;
@@ -89,6 +142,15 @@ declare function App(props: AppProps): react_jsx_runtime.JSX.Element;
89
142
  declare namespace App {
90
143
  var useApp: typeof useApp;
91
144
  }
145
+ /**
146
+ * Get app context.
147
+ *
148
+ * ```ts
149
+ * import { useApp } from '@faasjs/ant-design'
150
+ *
151
+ * const { message, notification, setModalProps, setDrawerProps } = useApp()
152
+ * ```
153
+ */
92
154
  declare function useApp(): useAppProps;
93
155
 
94
156
  interface BlankProps {
@@ -111,58 +173,6 @@ interface BlankProps {
111
173
  */
112
174
  declare function Blank(options?: BlankProps): JSX.Element;
113
175
 
114
- interface ConfigProviderProps {
115
- lang?: string;
116
- common?: {
117
- blank?: string;
118
- all?: string;
119
- submit?: string;
120
- pageNotFound?: string;
121
- add?: string;
122
- delete?: string;
123
- required?: string;
124
- search?: string;
125
- reset?: string;
126
- };
127
- Blank?: {
128
- text?: string;
129
- };
130
- Form?: {
131
- submit?: {
132
- text?: string;
133
- };
134
- };
135
- Title?: {
136
- /** ' - ' as default */
137
- separator?: string;
138
- suffix?: string;
139
- };
140
- Link?: {
141
- /** '_blank' as default */
142
- target?: string;
143
- style?: CSSProperties;
144
- };
145
- }
146
- declare const ConfigContext: react.Context<ConfigProviderProps>;
147
- /**
148
- * Config for @faasjs/ant-design components.
149
- *
150
- * ```ts
151
- * <ConfigProvider config={{
152
- * common: {
153
- * blank: 'Empty',
154
- * },
155
- * }}>
156
- * <Blank />
157
- * </ConfigProvider>
158
- * ```
159
- */
160
- declare function ConfigProvider({ config, children, }: {
161
- config: ConfigProviderProps;
162
- children: React.ReactNode;
163
- }): react_jsx_runtime.JSX.Element;
164
- declare function useConfigContext(): ConfigProviderProps;
165
-
166
176
  type ExtendFormTypeProps<T = any> = {
167
177
  children?: UnionFaasItemElement<T>;
168
178
  };
@@ -316,6 +326,11 @@ type TableProps<T = any, ExtendTypes = any> = {
316
326
  /**
317
327
  * Table component with Ant Design & FaasJS
318
328
  *
329
+ * - Support all Ant Design Table props.
330
+ * - Support FaasJS injection.
331
+ * - Auto generate filter dropdown (disable with `filterDropdown: false`).
332
+ * - Auto generate sorter (disable with `sorter: false`).
333
+ *
319
334
  * @ref https://ant.design/components/table/
320
335
  */
321
336
  declare function Table<T extends Record<string, any>, ExtendTypes = any>(props: TableProps<T, ExtendTypes>): react_jsx_runtime.JSX.Element;
@@ -350,7 +365,7 @@ interface FaasItemProps extends BaseItemProps {
350
365
  type?: FaasItemType;
351
366
  }
352
367
  /**
353
- * convert options to { label, value }[]
368
+ * convert string[] or number[] to { label, value }[]
354
369
  */
355
370
  declare function transferOptions(options: BaseOption[]): {
356
371
  label: string;
@@ -372,8 +387,6 @@ interface UnionFaasItemProps<Value = any, Values = any> extends FormItemProps, D
372
387
  object?: UnionFaasItemProps<Value, Values>[];
373
388
  }
374
389
 
375
- declare function ErrorBoundary(props: ErrorBoundaryProps): react_jsx_runtime.JSX.Element;
376
-
377
390
  type FormSubmitProps = {
378
391
  /** Default: Submit */
379
392
  text?: string;
@@ -542,4 +555,4 @@ interface TitleProps {
542
555
  */
543
556
  declare function Title(props: TitleProps): JSX.Element;
544
557
 
545
- export { App, AppProps, BaseItemProps, BaseOption, Blank, BlankProps, ConfigContext, ConfigProvider, ConfigProviderProps, Description, DescriptionItemContentProps, DescriptionItemProps, DescriptionProps, DrawerProps, ErrorBoundary, ExtendDescriptionItemProps, ExtendDescriptionTypeProps, ExtendFormItemProps, ExtendFormTypeProps, ExtendTableItemProps, ExtendTableTypeProps, ExtendTypes, FaasDataInjection, FaasDataWrapper, FaasDataWrapperProps, FaasItemProps, FaasItemType, FaasItemTypeValue, Form, FormItem, FormItemProps, FormProps, FormSubmitProps, Link, LinkProps, Loading, LoadingProps, ModalProps, PageNotFound, Routes, RoutesProps, TabProps, Table, TableItemProps, TableProps, Tabs, TabsProps, Title, TitleProps, UnionFaasItemElement, UnionFaasItemInjection, UnionFaasItemProps, UnionFaasItemRender, UnionScene, setDrawerProps, setModalProps, transferOptions, transferValue, useApp, useAppProps, useConfigContext, useDrawer, useModal };
558
+ export { App, type AppProps, type BaseItemProps, type BaseOption, Blank, type BlankProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Description, type DescriptionItemContentProps, type DescriptionItemProps, type DescriptionProps, type DrawerProps, ErrorBoundary, type ExtendDescriptionItemProps, type ExtendDescriptionTypeProps, type ExtendFormItemProps, type ExtendFormTypeProps, type ExtendTableItemProps, type ExtendTableTypeProps, type ExtendTypes, type FaasDataInjection, FaasDataWrapper, type FaasDataWrapperProps, type FaasItemProps, type FaasItemType, type FaasItemTypeValue, Form, FormItem, type FormItemProps, type FormProps, type FormSubmitProps, Link, type LinkProps, Loading, type LoadingProps, type ModalProps, PageNotFound, Routes, type RoutesProps, type TabProps, Table, type TableItemProps, type TableProps, Tabs, type TabsProps, Title, type TitleProps, type UnionFaasItemElement, type UnionFaasItemInjection, type UnionFaasItemProps, type UnionFaasItemRender, type UnionScene, type setDrawerProps, type setModalProps, transferOptions, transferValue, useApp, type useAppProps, useConfigContext, useDrawer, useModal };