@faasjs/ant-design 0.0.3-beta.9 → 0.0.3-beta.90

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
@@ -8,7 +8,7 @@ UI components based on [FaasJS](https://faasjs.com), [Ant Design](https://ant.de
8
8
 
9
9
  ## Install
10
10
 
11
- npm install @faasjs/ant-design
11
+ npm install @faasjs/ant-design antd react react-dom @faasjs/react react-router-dom
12
12
 
13
13
  ## Usage
14
14
 
@@ -41,218 +41,144 @@ Form are based on [Ant Design's Form.Item component](https://ant.design/componen
41
41
 
42
42
  ### Namespaces
43
43
 
44
+ - [App](modules/App.md)
44
45
  - [Form](modules/Form.md)
46
+ - [FormItem](modules/FormItem.md)
47
+
48
+ ### Classes
49
+
50
+ - [ErrorBoundary](classes/ErrorBoundary.md)
51
+
52
+ ### Interfaces
53
+
54
+ - [AppProps](interfaces/AppProps.md)
55
+ - [BaseItemProps](interfaces/BaseItemProps.md)
56
+ - [BlankProps](interfaces/BlankProps.md)
57
+ - [ConfigProviderProps](interfaces/ConfigProviderProps.md)
58
+ - [DescriptionItemContentProps](interfaces/DescriptionItemContentProps.md)
59
+ - [DescriptionItemProps](interfaces/DescriptionItemProps.md)
60
+ - [DescriptionProps](interfaces/DescriptionProps.md)
61
+ - [DrawerProps](interfaces/DrawerProps.md)
62
+ - [ErrorBoundaryProps](interfaces/ErrorBoundaryProps.md)
63
+ - [ExtendDescriptionTypeProps](interfaces/ExtendDescriptionTypeProps.md)
64
+ - [FaasDataWrapperProps](interfaces/FaasDataWrapperProps.md)
65
+ - [FaasItemProps](interfaces/FaasItemProps.md)
66
+ - [FormItemProps](interfaces/FormItemProps.md)
67
+ - [FormProps](interfaces/FormProps.md)
68
+ - [LinkProps](interfaces/LinkProps.md)
69
+ - [ModalProps](interfaces/ModalProps.md)
70
+ - [RoutesProps](interfaces/RoutesProps.md)
71
+ - [TabProps](interfaces/TabProps.md)
72
+ - [TableItemProps](interfaces/TableItemProps.md)
73
+ - [TabsProps](interfaces/TabsProps.md)
74
+ - [TitleProps](interfaces/TitleProps.md)
75
+ - [UnionFaasItemProps](interfaces/UnionFaasItemProps.md)
76
+ - [useAppProps](interfaces/useAppProps.md)
45
77
 
46
78
  ### Type Aliases
47
79
 
48
- - [BaseItemProps](#baseitemprops)
49
80
  - [BaseOption](#baseoption)
50
- - [BlankProps](#blankprops)
51
- - [CalendarProps](#calendarprops)
52
- - [ConfigProviderProps](#configproviderprops)
53
- - [DatePickerProps](#datepickerprops)
54
- - [DescriptionItemProps](#descriptionitemprops)
55
- - [DescriptionProps](#descriptionprops)
56
- - [DrawerProps](#drawerprops)
57
81
  - [ExtendDescriptionItemProps](#extenddescriptionitemprops)
58
- - [ExtendDescriptionTypeProps](#extenddescriptiontypeprops)
59
82
  - [ExtendFormItemProps](#extendformitemprops)
60
83
  - [ExtendFormTypeProps](#extendformtypeprops)
61
84
  - [ExtendTableItemProps](#extendtableitemprops)
62
85
  - [ExtendTableTypeProps](#extendtabletypeprops)
63
86
  - [ExtendTypes](#extendtypes)
64
- - [FaasItemProps](#faasitemprops)
87
+ - [FaasDataInjection](#faasdatainjection)
65
88
  - [FaasItemType](#faasitemtype)
66
89
  - [FaasItemTypeValue](#faasitemtypevalue)
67
- - [FormItemProps](#formitemprops)
68
- - [FormProps](#formprops)
69
- - [LinkProps](#linkprops)
70
- - [ModalProps](#modalprops)
71
- - [RoutesProps](#routesprops)
72
- - [TableItemProps](#tableitemprops)
90
+ - [FormSubmitProps](#formsubmitprops)
91
+ - [LoadingProps](#loadingprops)
73
92
  - [TableProps](#tableprops)
74
- - [TimePickerProps](#timepickerprops)
75
- - [TitleProps](#titleprops)
93
+ - [UnionFaasItemElement](#unionfaasitemelement)
94
+ - [UnionFaasItemInjection](#unionfaasiteminjection)
95
+ - [UnionFaasItemRender](#unionfaasitemrender)
96
+ - [UnionScene](#unionscene)
76
97
  - [setDrawerProps](#setdrawerprops)
77
98
  - [setModalProps](#setmodalprops)
78
99
 
79
100
  ### Variables
80
101
 
81
102
  - [ConfigContext](#configcontext)
82
- - [DatePicker](#datepicker)
83
103
 
84
104
  ### Functions
85
105
 
106
+ - [App](#app)
86
107
  - [Blank](#blank)
87
- - [Calendar](#calendar)
88
108
  - [ConfigProvider](#configprovider)
89
109
  - [Description](#description)
110
+ - [FaasDataWrapper](#faasdatawrapper)
90
111
  - [Form](#form)
91
112
  - [FormItem](#formitem)
92
113
  - [Link](#link)
114
+ - [Loading](#loading)
93
115
  - [PageNotFound](#pagenotfound)
94
116
  - [Routes](#routes)
95
117
  - [Table](#table)
96
- - [TimePicker](#timepicker)
118
+ - [Tabs](#tabs)
97
119
  - [Title](#title)
120
+ - [faas](#faas)
98
121
  - [transferOptions](#transferoptions)
99
122
  - [transferValue](#transfervalue)
123
+ - [useApp](#useapp)
100
124
  - [useConfigContext](#useconfigcontext)
101
125
  - [useDrawer](#usedrawer)
126
+ - [useFaas](#usefaas)
102
127
  - [useModal](#usemodal)
103
128
 
104
129
  ## Type Aliases
105
130
 
106
- ### BaseItemProps
107
-
108
- Ƭ **BaseItemProps**: `Object`
109
-
110
- #### Type declaration
111
-
112
- | Name | Type |
113
- | :------ | :------ |
114
- | `id` | `string` |
115
- | `options?` | [`BaseOption`](#baseoption)[] |
116
- | `title?` | `string` |
117
-
118
- ___
119
-
120
131
  ### BaseOption
121
132
 
122
- Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `string` \| `number` }
123
-
124
- ___
125
-
126
- ### BlankProps
127
-
128
- Ƭ **BlankProps**: `Object`
129
-
130
- #### Type declaration
131
-
132
- | Name | Type |
133
- | :------ | :------ |
134
- | `text?` | `string` |
135
- | `value?` | `any` |
136
-
137
- ___
138
-
139
- ### CalendarProps
140
-
141
- Ƭ **CalendarProps**: `AntdProps`<`Dayjs`\>
142
-
143
- ___
144
-
145
- ### ConfigProviderProps
146
-
147
- Ƭ **ConfigProviderProps**: `Object`
148
-
149
- #### Type declaration
150
-
151
- | Name | Type |
152
- | :------ | :------ |
153
- | `Blank?` | { `text?`: `string` } |
154
- | `Blank.text?` | `string` |
155
- | `Form?` | { `submit?`: { `text?`: `string` } } |
156
- | `Form.submit?` | { `text?`: `string` } |
157
- | `Form.submit.text?` | `string` |
158
- | `Link?` | { `style?`: `CSSProperties` ; `target?`: `string` } |
159
- | `Link.style?` | `CSSProperties` |
160
- | `Link.target?` | `string` |
161
- | `Title?` | { `separator?`: `string` ; `suffix?`: `string` } |
162
- | `Title.separator?` | `string` |
163
- | `Title.suffix?` | `string` |
164
- | `antd?` | `AntdConfigProviderProps` |
165
- | `common?` | { `add?`: `string` ; `all?`: `string` ; `blank?`: `string` ; `delete?`: `string` ; `pageNotFound?`: `string` ; `required?`: `string` ; `reset?`: `string` ; `search?`: `string` ; `submit?`: `string` } |
166
- | `common.add?` | `string` |
167
- | `common.all?` | `string` |
168
- | `common.blank?` | `string` |
169
- | `common.delete?` | `string` |
170
- | `common.pageNotFound?` | `string` |
171
- | `common.required?` | `string` |
172
- | `common.reset?` | `string` |
173
- | `common.search?` | `string` |
174
- | `common.submit?` | `string` |
175
- | `lang?` | `string` |
133
+ Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `any` }
176
134
 
177
135
  ___
178
136
 
179
- ### DatePickerProps
137
+ ### ExtendDescriptionItemProps
180
138
 
181
- Ƭ **DatePickerProps**: `PickerDateProps`<`Dayjs`\>
139
+ Ƭ **ExtendDescriptionItemProps**: [`BaseItemProps`](interfaces/BaseItemProps.md)
182
140
 
183
141
  ___
184
142
 
185
- ### DescriptionItemProps
186
-
187
- Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `if?`: (`values`: `Record`<`string`, `any`\>) => `boolean` ; `render?`: (`value`: `T`, `values`: `any`) => `ReactNode` \| `JSX.Element` } & [`FaasItemProps`](#faasitemprops) & { `object?`: [`DescriptionItemProps`](#descriptionitemprops)[] }
188
-
189
- #### Type parameters
143
+ ### ExtendFormItemProps
190
144
 
191
- | Name | Type |
192
- | :------ | :------ |
193
- | `T` | `any` |
145
+ Ƭ **ExtendFormItemProps**: [`BaseItemProps`](interfaces/BaseItemProps.md) & `AntdFormItemProps`
194
146
 
195
147
  ___
196
148
 
197
- ### DescriptionProps
149
+ ### ExtendFormTypeProps
198
150
 
199
- Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { `[key: string]`: [`ExtendDescriptionTypeProps`](#extenddescriptiontypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`DescriptionItemProps`](#descriptionitemprops) \| `ExtendItemProps`)[] ; `renderTitle?`: (`values`: `T`) => `ReactNode` \| `JSX.Element` } & `DescriptionsProps`
151
+ Ƭ **ExtendFormTypeProps**<`T`\>: `Object`
200
152
 
201
153
  #### Type parameters
202
154
 
203
155
  | Name | Type |
204
156
  | :------ | :------ |
205
157
  | `T` | `any` |
206
- | `ExtendItemProps` | `any` |
207
-
208
- ___
209
-
210
- ### DrawerProps
211
-
212
- Ƭ **DrawerProps**: `AntdDrawerProps` & { `children?`: `JSX.Element` \| `JSX.Element`[] }
213
-
214
- ___
215
-
216
- ### ExtendDescriptionItemProps
217
-
218
- Ƭ **ExtendDescriptionItemProps**: [`BaseItemProps`](#baseitemprops)
219
-
220
- ___
221
-
222
- ### ExtendDescriptionTypeProps
223
-
224
- Ƭ **ExtendDescriptionTypeProps**: `Object`
225
158
 
226
159
  #### Type declaration
227
160
 
228
161
  | Name | Type |
229
162
  | :------ | :------ |
230
- | `children?` | `JSX.Element` \| ``null`` |
231
- | `render?` | (`value`: `any`, `values`: `any`) => `ReactNode` \| `JSX.Element` |
163
+ | `children?` | [`UnionFaasItemElement`](#unionfaasitemelement)<`T`\> |
232
164
 
233
165
  ___
234
166
 
235
- ### ExtendFormItemProps
236
-
237
- Ƭ **ExtendFormItemProps**: [`BaseItemProps`](#baseitemprops) & `AntdFormItemProps`
238
-
239
- ___
240
-
241
- ### ExtendFormTypeProps
167
+ ### ExtendTableItemProps
242
168
 
243
- Ƭ **ExtendFormTypeProps**: `Object`
169
+ Ƭ **ExtendTableItemProps**<`T`\>: [`BaseItemProps`](interfaces/BaseItemProps.md) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
244
170
 
245
- #### Type declaration
171
+ #### Type parameters
246
172
 
247
173
  | Name | Type |
248
174
  | :------ | :------ |
249
- | `children?` | `ReactNode` |
175
+ | `T` | `any` |
250
176
 
251
177
  ___
252
178
 
253
- ### ExtendTableItemProps
179
+ ### ExtendTableTypeProps
254
180
 
255
- Ƭ **ExtendTableItemProps**<`T`\>: [`BaseItemProps`](#baseitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
181
+ Ƭ **ExtendTableTypeProps**<`T`\>: `Object`
256
182
 
257
183
  #### Type parameters
258
184
 
@@ -260,18 +186,12 @@ ___
260
186
  | :------ | :------ |
261
187
  | `T` | `any` |
262
188
 
263
- ___
264
-
265
- ### ExtendTableTypeProps
266
-
267
- Ƭ **ExtendTableTypeProps**: `Object`
268
-
269
189
  #### Type declaration
270
190
 
271
191
  | Name | Type |
272
192
  | :------ | :------ |
273
- | `children?` | `JSX.Element` \| ``null`` |
274
- | `render?` | (`value`: `any`, `values`: `any`, `index`: `number`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` |
193
+ | `children?` | `JSX.Element` |
194
+ | `render?` | [`UnionFaasItemRender`](#unionfaasitemrender)<`T`\> |
275
195
 
276
196
  ___
277
197
 
@@ -285,9 +205,15 @@ ___
285
205
 
286
206
  ___
287
207
 
288
- ### FaasItemProps
208
+ ### FaasDataInjection
289
209
 
290
- Ƭ **FaasItemProps**: [`BaseItemProps`](#baseitemprops) & { `type?`: [`FaasItemType`](#faasitemtype) }
210
+ Ƭ **FaasDataInjection**<`T`\>: `Partial`<`OriginFaasDataInjection`<`T`\>\>
211
+
212
+ #### Type parameters
213
+
214
+ | Name | Type |
215
+ | :------ | :------ |
216
+ | `T` | `any` |
291
217
 
292
218
  ___
293
219
 
@@ -319,120 +245,126 @@ FaasItemType's value type
319
245
 
320
246
  ___
321
247
 
322
- ### FormItemProps
248
+ ### FormSubmitProps
323
249
 
324
- Ƭ **FormItemProps**<`T`\>: { `children?`: `ReactNode` ; `extendTypes?`: [`ExtendTypes`](#extendtypes) ; `if?`: (`values`: `Record`<`string`, `any`\>) => `boolean` ; `label?`: `string` \| ``false`` ; `onValueChange?`: (`value`: `T`, `values`: `any`, `form`: `FormInstance`) => `void` ; `render?`: (`value?`: `T`) => `ReactNode` \| `JSX.Element` ; `rules?`: `RuleObject`[] } & `FormItemInputProps` & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdFormItemProps`<`T`\>, ``"children"``\>
250
+ Ƭ **FormSubmitProps**: `Object`
325
251
 
326
- #### Type parameters
252
+ #### Type declaration
253
+
254
+ | Name | Type | Description |
255
+ | :------ | :------ | :------ |
256
+ | `text?` | `string` | Default: Submit |
257
+ | `to?` | { `action`: `string` ; `catch?`: (`error`: `any`) => `void` ; `finally?`: () => `void` ; `params?`: `Record`<`string`, `any`\> ; `then?`: (`result`: `any`) => `void` } | Submit to FaasJS server. If use onFinish, you should call submit manually. ```ts { submit: { to: { action: 'action_name' } }, onFinish: (values, submit) => { // do something before submit // submit await submit({ ...values, extraProps: 'some extra props' }) // do something after submit } } ``` |
258
+ | `to.action` | `string` | - |
259
+ | `to.catch?` | (`error`: `any`) => `void` | - |
260
+ | `to.finally?` | () => `void` | - |
261
+ | `to.params?` | `Record`<`string`, `any`\> | params will overwrite form values before submit |
262
+ | `to.then?` | (`result`: `any`) => `void` | - |
263
+
264
+ ___
265
+
266
+ ### LoadingProps
267
+
268
+ Ƭ **LoadingProps**: `Object`
269
+
270
+ #### Type declaration
327
271
 
328
272
  | Name | Type |
329
273
  | :------ | :------ |
330
- | `T` | `any` |
274
+ | `children?` | `React.ReactNode` |
275
+ | `loading?` | `boolean` |
276
+ | `size?` | ``"small"`` \| ``"default"`` \| ``"large"`` |
277
+ | `style?` | `React.CSSProperties` |
331
278
 
332
279
  ___
333
280
 
334
- ### FormProps
281
+ ### TableProps
335
282
 
336
- Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `beforeItems?`: `JSX.Element` \| `JSX.Element`[] ; `children?`: `ReactNode` ; `extendTypes?`: [`ExtendTypes`](#extendtypes) ; `footer?`: `JSX.Element` \| `JSX.Element`[] ; `initialValues?`: `Values` ; `items?`: ([`FormItemProps`](#formitemprops) \| `ExtendItemProps`)[] ; `onFinish?`: (`values`: `Values`, `submit?`: (`values`: `any`) => `Promise`<`any`\>) => `Promise`<`any`\> ; `submit?`: ``false`` \| { `text?`: `string` ; `to?`: { `action`: `string` ; `params?`: `Record`<`string`, `any`\> } } } & `Omit`<`AntdFormProps`<`Values`\>, ``"onFinish"`` \| ``"children"`` \| ``"initialValues"``\>
283
+ Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)<`T`\> ; `items`: ([`TableItemProps`](interfaces/TableItemProps.md) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue` \| ``null``\>, `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[], `extra`: `TableCurrentDataSource`<`T`\>) => { `extra`: `TableCurrentDataSource`<`T`\> ; `filters`: `Record`<`string`, `FilterValue` \| ``null``\> ; `pagination`: `TablePaginationConfig` ; `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[] } } & `AntdTableProps`<`T`\>
337
284
 
338
285
  #### Type parameters
339
286
 
340
287
  | Name | Type |
341
288
  | :------ | :------ |
342
- | `Values` | extends `Record`<`string`, `any`\> = `any` |
343
- | `ExtendItemProps` | `any` |
289
+ | `T` | `any` |
290
+ | `ExtendTypes` | `any` |
344
291
 
345
292
  ___
346
293
 
347
- ### LinkProps
294
+ ### UnionFaasItemElement
348
295
 
349
- Ƭ **LinkProps**: `Object`
296
+ Ƭ **UnionFaasItemElement**<`Value`, `Values`\>: `ReactElement`<[`UnionFaasItemInjection`](#unionfaasiteminjection)<`Value`, `Values`\>\> \| ``null``
350
297
 
351
- #### Type declaration
298
+ #### Type parameters
352
299
 
353
300
  | Name | Type |
354
301
  | :------ | :------ |
355
- | `button?` | `ButtonProps` |
356
- | `children?` | `ReactNode` |
357
- | `href` | `string` |
358
- | `style?` | `CSSProperties` |
359
- | `target?` | `string` |
360
- | `text?` | `string` \| `number` |
302
+ | `Value` | `any` |
303
+ | `Values` | `any` |
361
304
 
362
305
  ___
363
306
 
364
- ### ModalProps
365
-
366
- Ƭ **ModalProps**: `AntdModalProps` & { `children?`: `JSX.Element` \| `JSX.Element`[] \| `string` }
307
+ ### UnionFaasItemInjection
367
308
 
368
- ___
309
+ Ƭ **UnionFaasItemInjection**<`Value`, `Values`\>: `Object`
369
310
 
370
- ### RoutesProps
311
+ #### Type parameters
371
312
 
372
- Ƭ **RoutesProps**: `Object`
313
+ | Name | Type |
314
+ | :------ | :------ |
315
+ | `Value` | `any` |
316
+ | `Values` | `any` |
373
317
 
374
318
  #### Type declaration
375
319
 
376
320
  | Name | Type |
377
321
  | :------ | :------ |
378
- | `fallback?` | `JSX.Element` |
379
- | `notFound?` | `JSX.Element` |
380
- | `routes` | `RouteProps` & { `page?`: `LazyExoticComponent`<`ComponentType`<`any`\>\> }[] |
322
+ | `index?` | `number` |
323
+ | `scene?` | [`UnionScene`](#unionscene) |
324
+ | `value?` | `Value` |
325
+ | `values?` | `Values` |
381
326
 
382
327
  ___
383
328
 
384
- ### TableItemProps
329
+ ### UnionFaasItemRender
385
330
 
386
- Ƭ **TableItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `object?`: [`TableItemProps`](#tableitemprops)[] ; `optionsType?`: ``"auto"`` } & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
331
+ Ƭ **UnionFaasItemRender**<`Value`, `Values`\>: (`value`: `Value`, `values`: `Values`, `index`: `number`, `scene`: [`UnionScene`](#unionscene)) => `React.ReactNode`
387
332
 
388
333
  #### Type parameters
389
334
 
390
335
  | Name | Type |
391
336
  | :------ | :------ |
392
- | `T` | `any` |
393
-
394
- ___
337
+ | `Value` | `any` |
338
+ | `Values` | `any` |
395
339
 
396
- ### TableProps
340
+ #### Type declaration
397
341
 
398
- Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { `[key: string]`: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`TableItemProps`](#tableitemprops) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue` \| ``null``\>, `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[], `extra`: `TableCurrentDataSource`<`T`\>) => { `extra`: `TableCurrentDataSource`<`T`\> ; `filters`: `Record`<`string`, `FilterValue` \| ``null``\> ; `pagination`: `TablePaginationConfig` ; `sorter`: `SorterResult`<`T`\> \| `SorterResult`<`T`\>[] } } & `AntdTableProps`<`T`\>
342
+ (`value`, `values`, `index`, `scene`): `React.ReactNode`
399
343
 
400
- #### Type parameters
344
+ ##### Parameters
401
345
 
402
346
  | Name | Type |
403
347
  | :------ | :------ |
404
- | `T` | `any` |
405
- | `ExtendTypes` | `any` |
406
-
407
- ___
348
+ | `value` | `Value` |
349
+ | `values` | `Values` |
350
+ | `index` | `number` |
351
+ | `scene` | [`UnionScene`](#unionscene) |
408
352
 
409
- ### TimePickerProps
353
+ ##### Returns
410
354
 
411
- Ƭ **TimePickerProps**: `Omit`<`PickerTimeProps`<`Dayjs`\>, ``"picker"``\>
355
+ `React.ReactNode`
412
356
 
413
357
  ___
414
358
 
415
- ### TitleProps
359
+ ### UnionScene
416
360
 
417
- Ƭ **TitleProps**: `Object`
418
-
419
- #### Type declaration
420
-
421
- | Name | Type | Description |
422
- | :------ | :------ | :------ |
423
- | `children?` | `JSX.Element` | return children |
424
- | `h1?` | `boolean` \| { `className?`: `string` ; `style?`: `React.CSSProperties` } | return a h1 element |
425
- | `header?` | `PageHeaderProps` | return a PageHeader element |
426
- | `plain?` | `boolean` | return a pure text element |
427
- | `separator?` | `string` | ` - ` as default |
428
- | `suffix?` | `string` | - |
429
- | `title` | `string` \| `string`[] | - |
361
+ Ƭ **UnionScene**: ``"form"`` \| ``"description"`` \| ``"table"``
430
362
 
431
363
  ___
432
364
 
433
365
  ### setDrawerProps
434
366
 
435
- Ƭ **setDrawerProps**: (`changes`: `Partial`<[`DrawerProps`](#drawerprops)\>) => `void`
367
+ Ƭ **setDrawerProps**: (`changes`: `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void`
436
368
 
437
369
  #### Type declaration
438
370
 
@@ -442,7 +374,7 @@ ___
442
374
 
443
375
  | Name | Type |
444
376
  | :------ | :------ |
445
- | `changes` | `Partial`<[`DrawerProps`](#drawerprops)\> |
377
+ | `changes` | `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\> |
446
378
 
447
379
  ##### Returns
448
380
 
@@ -452,7 +384,7 @@ ___
452
384
 
453
385
  ### setModalProps
454
386
 
455
- Ƭ **setModalProps**: (`changes`: `Partial`<[`ModalProps`](#modalprops)\>) => `void`
387
+ Ƭ **setModalProps**: (`changes`: `Partial`<[`ModalProps`](interfaces/ModalProps.md)\>) => `void`
456
388
 
457
389
  #### Type declaration
458
390
 
@@ -462,7 +394,7 @@ ___
462
394
 
463
395
  | Name | Type |
464
396
  | :------ | :------ |
465
- | `changes` | `Partial`<[`ModalProps`](#modalprops)\> |
397
+ | `changes` | `Partial`<[`ModalProps`](interfaces/ModalProps.md)\> |
466
398
 
467
399
  ##### Returns
468
400
 
@@ -472,27 +404,39 @@ ___
472
404
 
473
405
  ### ConfigContext
474
406
 
475
- • `Const` **ConfigContext**: `Context`<[`ConfigProviderProps`](#configproviderprops)\>
407
+ • `Const` **ConfigContext**: `Context`<[`ConfigProviderProps`](interfaces/ConfigProviderProps.md)\>
476
408
 
477
- ___
409
+ ## Functions
478
410
 
479
- ### DatePicker
411
+ ### App
480
412
 
481
- `Const` **DatePicker**: `PickerComponentClass`<`Object`, `unknown`\> & {}
413
+ **App**(`props`): `Element`
482
414
 
483
- ## Functions
415
+ #### Parameters
416
+
417
+ | Name | Type |
418
+ | :------ | :------ |
419
+ | `props` | [`AppProps`](interfaces/AppProps.md) |
420
+
421
+ #### Returns
422
+
423
+ `Element`
424
+
425
+ ___
484
426
 
485
427
  ### Blank
486
428
 
487
429
  ▸ **Blank**(`options?`): `JSX.Element`
488
430
 
431
+ Blank component.
432
+
489
433
  If value is undefined or null, return text, otherwise return value.
490
434
 
491
435
  #### Parameters
492
436
 
493
437
  | Name | Type | Description |
494
438
  | :------ | :------ | :------ |
495
- | `options?` | [`BlankProps`](#blankprops) | {object} |
439
+ | `options?` | [`BlankProps`](interfaces/BlankProps.md) | {object} |
496
440
 
497
441
  #### Returns
498
442
 
@@ -504,25 +448,9 @@ If value is undefined or null, return text, otherwise return value.
504
448
 
505
449
  ___
506
450
 
507
- ### Calendar
508
-
509
- ▸ **Calendar**(`props`): `Element`
510
-
511
- #### Parameters
512
-
513
- | Name | Type |
514
- | :------ | :------ |
515
- | `props` | `CalendarProps`<`Dayjs`\> |
516
-
517
- #### Returns
518
-
519
- `Element`
520
-
521
- ___
522
-
523
451
  ### ConfigProvider
524
452
 
525
- ▸ **ConfigProvider**(`__namedParameters`): `Element`
453
+ ▸ **ConfigProvider**(`«destructured»`): `Element`
526
454
 
527
455
  Config for @faasjs/ant-design components.
528
456
 
@@ -540,9 +468,9 @@ Config for @faasjs/ant-design components.
540
468
 
541
469
  | Name | Type |
542
470
  | :------ | :------ |
543
- | `__namedParameters` | `Object` |
544
- | `__namedParameters.children` | `ReactNode` |
545
- | `__namedParameters.config` | [`ConfigProviderProps`](#configproviderprops) |
471
+ | `«destructured»` | `Object` |
472
+ | › `children` | `ReactNode` |
473
+ | › `config` | [`ConfigProviderProps`](interfaces/ConfigProviderProps.md) |
546
474
 
547
475
  #### Returns
548
476
 
@@ -554,6 +482,8 @@ ___
554
482
 
555
483
  ▸ **Description**<`T`\>(`props`): `Element`
556
484
 
485
+ Description component.
486
+
557
487
  #### Type parameters
558
488
 
559
489
  | Name | Type |
@@ -564,7 +494,7 @@ ___
564
494
 
565
495
  | Name | Type |
566
496
  | :------ | :------ |
567
- | `props` | [`DescriptionProps`](#descriptionprops)<`T`, `any`\> |
497
+ | `props` | [`DescriptionProps`](interfaces/DescriptionProps.md)<`T`, `any`\> |
568
498
 
569
499
  #### Returns
570
500
 
@@ -572,6 +502,42 @@ ___
572
502
 
573
503
  ___
574
504
 
505
+ ### FaasDataWrapper
506
+
507
+ ▸ **FaasDataWrapper**<`T`\>(`props`): `JSX.Element`
508
+
509
+ FaasDataWrapper component with Loading
510
+
511
+ ```tsx
512
+ function MyComponent (props: FaasDataInjection) {
513
+ return <div>{ props.data }</div>
514
+ }
515
+
516
+ function MyPage () {
517
+ return <FaasDataWrapper action="test" params={{ a: 1 }}>
518
+ <MyComponent />
519
+ </FaasDataWrapper>
520
+ }
521
+ ```
522
+
523
+ #### Type parameters
524
+
525
+ | Name | Type |
526
+ | :------ | :------ |
527
+ | `T` | `any` |
528
+
529
+ #### Parameters
530
+
531
+ | Name | Type |
532
+ | :------ | :------ |
533
+ | `props` | [`FaasDataWrapperProps`](interfaces/FaasDataWrapperProps.md)<`T`\> |
534
+
535
+ #### Returns
536
+
537
+ `JSX.Element`
538
+
539
+ ___
540
+
575
541
  ### Form
576
542
 
577
543
  ▸ **Form**<`Values`\>(`props`): `Element`
@@ -592,7 +558,7 @@ https://ant.design/components/form/
592
558
 
593
559
  | Name | Type |
594
560
  | :------ | :------ |
595
- | `props` | [`FormProps`](#formprops)<`Values`, `any`\> |
561
+ | `props` | [`FormProps`](interfaces/FormProps.md)<`Values`, `any`\> |
596
562
 
597
563
  #### Returns
598
564
 
@@ -608,10 +574,10 @@ FormItem, can be used without Form.
608
574
 
609
575
  ```ts
610
576
  // use inline type
611
- <FormItem item={{ type: 'string', id: 'name' }} />
577
+ <FormItem type='string' id='name' />
612
578
 
613
579
  // use custom type
614
- <FormItem item={{ id: 'password' }}>
580
+ <FormItem id='password'>
615
581
  <Input.Password />
616
582
  </>
617
583
  ```
@@ -626,7 +592,7 @@ FormItem, can be used without Form.
626
592
 
627
593
  | Name | Type |
628
594
  | :------ | :------ |
629
- | `props` | [`FormItemProps`](#formitemprops)<`T`\> |
595
+ | `props` | [`FormItemProps`](interfaces/FormItemProps.md)<`T`\> |
630
596
 
631
597
  #### Returns
632
598
 
@@ -636,21 +602,49 @@ ___
636
602
 
637
603
  ### Link
638
604
 
639
- ▸ **Link**(`__namedParameters`): `Element`
605
+ ▸ **Link**(`props`): `Element`
606
+
607
+ Link component with button.
640
608
 
641
609
  ```ts
642
610
  // pure link
643
611
  <Link href="/">Home</Link>
644
612
 
645
613
  // link with button
646
- <Link href="/" button={{type:'primary'}}>Home</Link>
614
+ <Link href="/" button={{ type:'primary' }}>Home</Link>
647
615
  ```
648
616
 
649
617
  #### Parameters
650
618
 
651
619
  | Name | Type |
652
620
  | :------ | :------ |
653
- | `__namedParameters` | [`LinkProps`](#linkprops) |
621
+ | `props` | [`LinkProps`](interfaces/LinkProps.md) |
622
+
623
+ #### Returns
624
+
625
+ `Element`
626
+
627
+ ___
628
+
629
+ ### Loading
630
+
631
+ ▸ **Loading**(`props`): `Element`
632
+
633
+ Loading component based on Spin
634
+
635
+ ```tsx
636
+ <Loading /> // display loading
637
+
638
+ <Loading loading={ !remoteData }>
639
+ <div>{remoteData}</div>
640
+ </Loading>
641
+ ```
642
+
643
+ #### Parameters
644
+
645
+ | Name | Type |
646
+ | :------ | :------ |
647
+ | `props` | [`LoadingProps`](#loadingprops) |
654
648
 
655
649
  #### Returns
656
650
 
@@ -675,7 +669,7 @@ ___
675
669
  Routes with lazy loading and 404 page.
676
670
 
677
671
  ```tsx
678
- import { lazy } from 'react'
672
+ import { Routes, lazy } from '@faasjs/ant-design'
679
673
  import { BrowserRouter } from 'react-router-dom'
680
674
 
681
675
  export function App () {
@@ -694,7 +688,7 @@ export function App () {
694
688
 
695
689
  | Name | Type |
696
690
  | :------ | :------ |
697
- | `props` | [`RoutesProps`](#routesprops) |
691
+ | `props` | [`RoutesProps`](interfaces/RoutesProps.md) |
698
692
 
699
693
  #### Returns
700
694
 
@@ -716,7 +710,7 @@ https://ant.design/components/table/
716
710
 
717
711
  | Name | Type |
718
712
  | :------ | :------ |
719
- | `T` | `any` |
713
+ | `T` | extends `Record`<`string`, `any`\> |
720
714
  | `ExtendTypes` | `any` |
721
715
 
722
716
  #### Parameters
@@ -731,21 +725,25 @@ https://ant.design/components/table/
731
725
 
732
726
  ___
733
727
 
734
- ### TimePicker
728
+ ### Tabs
729
+
730
+ ▸ **Tabs**(`props`): `Element`
731
+
732
+ Tabs component with Ant Design & FaasJS
735
733
 
736
- ▸ **TimePicker**(`props`): `ReactElement`<`any`, `string` \| `JSXElementConstructor`<`any`\>\>
734
+ **`Ref`**
737
735
 
738
- **NOTE**: Exotic components are not callable.
736
+ https://ant.design/components/tabs/
739
737
 
740
738
  #### Parameters
741
739
 
742
740
  | Name | Type |
743
741
  | :------ | :------ |
744
- | `props` | [`TimePickerProps`](#timepickerprops) & `RefAttributes`<`any`\> |
742
+ | `props` | [`TabsProps`](interfaces/TabsProps.md) |
745
743
 
746
744
  #### Returns
747
745
 
748
- `ReactElement`<`any`, `string` \| `JSXElementConstructor`<`any`\>\>
746
+ `Element`
749
747
 
750
748
  ___
751
749
 
@@ -773,7 +771,7 @@ Return null by default.
773
771
 
774
772
  | Name | Type |
775
773
  | :------ | :------ |
776
- | `props` | [`TitleProps`](#titleprops) |
774
+ | `props` | [`TitleProps`](interfaces/TitleProps.md) |
777
775
 
778
776
  #### Returns
779
777
 
@@ -781,10 +779,43 @@ Return null by default.
781
779
 
782
780
  ___
783
781
 
782
+ ### faas
783
+
784
+ ▸ **faas**<`PathOrData`\>(`action`, `params`): `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\>
785
+
786
+ Request faas server
787
+
788
+ #### Type parameters
789
+
790
+ | Name | Type |
791
+ | :------ | :------ |
792
+ | `PathOrData` | extends `Record`<`string`, `any`\> |
793
+
794
+ #### Parameters
795
+
796
+ | Name | Type | Description |
797
+ | :------ | :------ | :------ |
798
+ | `action` | `string` \| `PathOrData` | {string} action name |
799
+ | `params` | `FaasParams`<`PathOrData`\> | {object} action params |
800
+
801
+ #### Returns
802
+
803
+ `Promise`<`Response`<`FaasData`<`PathOrData`\>\>\>
804
+
805
+ ```ts
806
+ faas<{ title: string }>('post/get', { id: 1 }).then(res => {
807
+ console.log(res.data.title)
808
+ })
809
+ ```
810
+
811
+ ___
812
+
784
813
  ### transferOptions
785
814
 
786
815
  ▸ **transferOptions**(`options`): { `label`: `string` ; `value?`: `string` \| `number` }[]
787
816
 
817
+ convert options to { label, value }[]
818
+
788
819
  #### Parameters
789
820
 
790
821
  | Name | Type |
@@ -814,13 +845,23 @@ ___
814
845
 
815
846
  ___
816
847
 
848
+ ### useApp
849
+
850
+ ▸ **useApp**(): [`useAppProps`](interfaces/useAppProps.md)
851
+
852
+ #### Returns
853
+
854
+ [`useAppProps`](interfaces/useAppProps.md)
855
+
856
+ ___
857
+
817
858
  ### useConfigContext
818
859
 
819
- ▸ **useConfigContext**(): [`ConfigProviderProps`](#configproviderprops)
860
+ ▸ **useConfigContext**(): [`ConfigProviderProps`](interfaces/ConfigProviderProps.md)
820
861
 
821
862
  #### Returns
822
863
 
823
- [`ConfigProviderProps`](#configproviderprops)
864
+ [`ConfigProviderProps`](interfaces/ConfigProviderProps.md)
824
865
 
825
866
  ___
826
867
 
@@ -834,7 +875,7 @@ Hook style drawer.
834
875
 
835
876
  | Name | Type | Description |
836
877
  | :------ | :------ | :------ |
837
- | `init?` | [`DrawerProps`](#drawerprops) | initial props ```ts function Example() { const { drawer, setDrawerProps } = useDrawer() return <> <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }> Toggle </Button> {drawer} </> } ``` |
878
+ | `init?` | [`DrawerProps`](interfaces/DrawerProps.md) | initial props ```ts function Example() { const { drawer, setDrawerProps } = useDrawer() return <> <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }> Toggle </Button> {drawer} </> } ``` |
838
879
 
839
880
  #### Returns
840
881
 
@@ -843,8 +884,44 @@ Hook style drawer.
843
884
  | Name | Type |
844
885
  | :------ | :------ |
845
886
  | `drawer` | `Element` |
846
- | `drawerProps` | [`DrawerProps`](#drawerprops) |
847
- | `setDrawerProps` | (`changes`: `Partial`<[`DrawerProps`](#drawerprops)\>) => `void` |
887
+ | `drawerProps` | [`DrawerProps`](interfaces/DrawerProps.md) |
888
+ | `setDrawerProps` | (`changes`: `Partial`<[`DrawerProps`](interfaces/DrawerProps.md)\>) => `void` |
889
+
890
+ ___
891
+
892
+ ### useFaas
893
+
894
+ ▸ **useFaas**<`PathOrData`\>(`action`, `defaultParams`, `options?`): `FaasDataInjection`<`FaasData`<`PathOrData`\>\>
895
+
896
+ Request faas server with React hook
897
+
898
+ #### Type parameters
899
+
900
+ | Name | Type |
901
+ | :------ | :------ |
902
+ | `PathOrData` | extends `Record`<`string`, `any`\> |
903
+
904
+ #### Parameters
905
+
906
+ | Name | Type | Description |
907
+ | :------ | :------ | :------ |
908
+ | `action` | `string` \| `PathOrData` | {string} action name |
909
+ | `defaultParams` | `FaasParams`<`PathOrData`\> | {object} initial action params |
910
+ | `options?` | `Object` | - |
911
+ | `options.data?` | `FaasData`<`PathOrData`\> | - |
912
+ | `options.setData?` | `Dispatch`<`SetStateAction`<`FaasData`<`PathOrData`\>\>\> | - |
913
+ | `options.skip?` | `boolean` | - |
914
+
915
+ #### Returns
916
+
917
+ `FaasDataInjection`<`FaasData`<`PathOrData`\>\>
918
+
919
+ ```ts
920
+ function Post ({ id }) {
921
+ const { data } = useFaas<{ title: string }>('post/get', { id })
922
+ return <h1>{data.title}</h1>
923
+ }
924
+ ```
848
925
 
849
926
  ___
850
927
 
@@ -858,7 +935,7 @@ Hook style modal.
858
935
 
859
936
  | Name | Type | Description |
860
937
  | :------ | :------ | :------ |
861
- | `init?` | [`ModalProps`](#modalprops) | initial props ```ts function Example() { const { modal, setModalProps } = useModal() return <> <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button> {modal}</> } ``` |
938
+ | `init?` | [`ModalProps`](interfaces/ModalProps.md) | initial props ```ts function Example() { const { modal, setModalProps } = useModal() return <> <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button> {modal}</> } ``` |
862
939
 
863
940
  #### Returns
864
941
 
@@ -867,5 +944,5 @@ Hook style modal.
867
944
  | Name | Type |
868
945
  | :------ | :------ |
869
946
  | `modal` | `Element` |
870
- | `modalProps` | [`ModalProps`](#modalprops) |
871
- | `setModalProps` | (`changes`: `Partial`<[`ModalProps`](#modalprops)\>) => `void` |
947
+ | `modalProps` | [`ModalProps`](interfaces/ModalProps.md) |
948
+ | `setModalProps` | (`changes`: `Partial`<[`ModalProps`](interfaces/ModalProps.md)\>) => `void` |