@faasjs/ant-design 0.0.3-beta.10 → 0.0.3-beta.101

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