@faasjs/ant-design 0.0.2-development → 0.0.3-beta.2
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/LICENSE +6 -6
- package/README.md +867 -5
- package/dist/index.d.ts +444 -0
- package/dist/index.js +1358 -0
- package/dist/index.mjs +1360 -0
- package/package.json +28 -62
- package/lib/components/Button.d.ts +0 -60
- package/lib/components/Button.stories.d.ts +0 -36
- package/lib/components/Description.d.ts +0 -11
- package/lib/components/Description.stories.d.ts +0 -6
- package/lib/components/Form.d.ts +0 -7
- package/lib/components/Form.stories.d.ts +0 -7
- package/lib/components/FormItem.d.ts +0 -7
- package/lib/components/FormItem.stories.d.ts +0 -11
- package/lib/components/Header.d.ts +0 -19
- package/lib/components/Header.stories.d.ts +0 -24
- package/lib/components/Page.d.ts +0 -22
- package/lib/components/Page.stories.d.ts +0 -24
- package/lib/components/Table.d.ts +0 -8
- package/lib/components/Table.stories.d.ts +0 -6
- package/lib/components/__tests__/FormItem.test.d.ts +0 -1
- package/lib/components/data.d.ts +0 -6
- package/lib/index.d.ts +0 -2
- package/lib/index.esm.js +0 -55
- package/lib/index.esm.js.map +0 -1
- package/lib/index.js +0 -60
- package/lib/index.js.map +0 -1
- package/lib/jest.setup.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,871 @@
|
|
|
1
1
|
# @faasjs/ant-design
|
|
2
2
|
|
|
3
|
-
[](https://github.com/faasjs/faasjs/blob/main/packages/faasjs/browser/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@faasjs/browser)
|
|
5
|
+
[](https://www.npmjs.com/package/@faasjs/browser)
|
|
6
6
|
|
|
7
|
-
UI components based on [FaasJS](https://faasjs.com)
|
|
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
|
+
|
|
11
|
+
npm install @faasjs/ant-design
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
In `@faasjs/ant-design`, we use `FaasItemProps` to provide data structures for components.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
type FaasItemType =
|
|
19
|
+
'string' | 'string[]' |
|
|
20
|
+
'number' | 'number[]' |
|
|
21
|
+
'boolean' |
|
|
22
|
+
'date' | 'time' |
|
|
23
|
+
'object' | 'object[]'
|
|
24
|
+
|
|
25
|
+
type FaasItemProps = {
|
|
26
|
+
type: FaasItemTypes
|
|
27
|
+
id: string
|
|
28
|
+
title?: string
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Form
|
|
33
|
+
|
|
34
|
+
Form are based on [Ant Design's Form component](https://ant.design/components/form/#Form).
|
|
35
|
+
|
|
36
|
+
### FormItem
|
|
37
|
+
|
|
38
|
+
Form are based on [Ant Design's Form.Item component](https://ant.design/components/form/#Form.Item).
|
|
39
|
+
|
|
40
|
+
## Modules
|
|
41
|
+
|
|
42
|
+
### Namespaces
|
|
43
|
+
|
|
44
|
+
- [Form](modules/Form.md)
|
|
45
|
+
|
|
46
|
+
### Type Aliases
|
|
47
|
+
|
|
48
|
+
- [BaseItemProps](#baseitemprops)
|
|
49
|
+
- [BaseOption](#baseoption)
|
|
50
|
+
- [BlankProps](#blankprops)
|
|
51
|
+
- [CalendarProps](#calendarprops)
|
|
52
|
+
- [ConfigProviderProps](#configproviderprops)
|
|
53
|
+
- [DatePickerProps](#datepickerprops)
|
|
54
|
+
- [DescriptionItemProps](#descriptionitemprops)
|
|
55
|
+
- [DescriptionProps](#descriptionprops)
|
|
56
|
+
- [DrawerProps](#drawerprops)
|
|
57
|
+
- [ExtendDescriptionItemProps](#extenddescriptionitemprops)
|
|
58
|
+
- [ExtendDescriptionTypeProps](#extenddescriptiontypeprops)
|
|
59
|
+
- [ExtendFormItemProps](#extendformitemprops)
|
|
60
|
+
- [ExtendFormTypeProps](#extendformtypeprops)
|
|
61
|
+
- [ExtendTableItemProps](#extendtableitemprops)
|
|
62
|
+
- [ExtendTableTypeProps](#extendtabletypeprops)
|
|
63
|
+
- [ExtendTypes](#extendtypes)
|
|
64
|
+
- [FaasItemProps](#faasitemprops)
|
|
65
|
+
- [FaasItemType](#faasitemtype)
|
|
66
|
+
- [FaasItemTypeValue](#faasitemtypevalue)
|
|
67
|
+
- [FormItemProps](#formitemprops)
|
|
68
|
+
- [FormProps](#formprops)
|
|
69
|
+
- [LinkProps](#linkprops)
|
|
70
|
+
- [ModalProps](#modalprops)
|
|
71
|
+
- [RoutesProps](#routesprops)
|
|
72
|
+
- [TableItemProps](#tableitemprops)
|
|
73
|
+
- [TableProps](#tableprops)
|
|
74
|
+
- [TimePickerProps](#timepickerprops)
|
|
75
|
+
- [TitleProps](#titleprops)
|
|
76
|
+
- [setDrawerProps](#setdrawerprops)
|
|
77
|
+
- [setModalProps](#setmodalprops)
|
|
78
|
+
|
|
79
|
+
### Variables
|
|
80
|
+
|
|
81
|
+
- [ConfigContext](#configcontext)
|
|
82
|
+
- [DatePicker](#datepicker)
|
|
83
|
+
|
|
84
|
+
### Functions
|
|
85
|
+
|
|
86
|
+
- [Blank](#blank)
|
|
87
|
+
- [Calendar](#calendar)
|
|
88
|
+
- [ConfigProvider](#configprovider)
|
|
89
|
+
- [Description](#description)
|
|
90
|
+
- [Form](#form)
|
|
91
|
+
- [FormItem](#formitem)
|
|
92
|
+
- [Link](#link)
|
|
93
|
+
- [PageNotFound](#pagenotfound)
|
|
94
|
+
- [Routes](#routes)
|
|
95
|
+
- [Table](#table)
|
|
96
|
+
- [TimePicker](#timepicker)
|
|
97
|
+
- [Title](#title)
|
|
98
|
+
- [transferOptions](#transferoptions)
|
|
99
|
+
- [transferValue](#transfervalue)
|
|
100
|
+
- [useConfigContext](#useconfigcontext)
|
|
101
|
+
- [useDrawer](#usedrawer)
|
|
102
|
+
- [useModal](#usemodal)
|
|
103
|
+
|
|
104
|
+
## Type Aliases
|
|
105
|
+
|
|
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
|
+
### BaseOption
|
|
121
|
+
|
|
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` |
|
|
176
|
+
|
|
177
|
+
___
|
|
178
|
+
|
|
179
|
+
### DatePickerProps
|
|
180
|
+
|
|
181
|
+
Ƭ **DatePickerProps**: `PickerDateProps`<`Dayjs`\>
|
|
182
|
+
|
|
183
|
+
___
|
|
184
|
+
|
|
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
|
|
190
|
+
|
|
191
|
+
| Name | Type |
|
|
192
|
+
| :------ | :------ |
|
|
193
|
+
| `T` | `any` |
|
|
194
|
+
|
|
195
|
+
___
|
|
196
|
+
|
|
197
|
+
### DescriptionProps
|
|
198
|
+
|
|
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`
|
|
200
|
+
|
|
201
|
+
#### Type parameters
|
|
202
|
+
|
|
203
|
+
| Name | Type |
|
|
204
|
+
| :------ | :------ |
|
|
205
|
+
| `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
|
+
|
|
226
|
+
#### Type declaration
|
|
227
|
+
|
|
228
|
+
| Name | Type |
|
|
229
|
+
| :------ | :------ |
|
|
230
|
+
| `children?` | `JSX.Element` \| ``null`` |
|
|
231
|
+
| `render?` | (`value`: `any`, `values`: `any`) => `ReactNode` \| `JSX.Element` |
|
|
232
|
+
|
|
233
|
+
___
|
|
234
|
+
|
|
235
|
+
### ExtendFormItemProps
|
|
236
|
+
|
|
237
|
+
Ƭ **ExtendFormItemProps**: [`BaseItemProps`](#baseitemprops) & `AntdFormItemProps`
|
|
238
|
+
|
|
239
|
+
___
|
|
240
|
+
|
|
241
|
+
### ExtendFormTypeProps
|
|
242
|
+
|
|
243
|
+
Ƭ **ExtendFormTypeProps**: `Object`
|
|
244
|
+
|
|
245
|
+
#### Type declaration
|
|
246
|
+
|
|
247
|
+
| Name | Type |
|
|
248
|
+
| :------ | :------ |
|
|
249
|
+
| `children?` | `ReactNode` |
|
|
250
|
+
|
|
251
|
+
___
|
|
252
|
+
|
|
253
|
+
### ExtendTableItemProps
|
|
254
|
+
|
|
255
|
+
Ƭ **ExtendTableItemProps**<`T`\>: [`BaseItemProps`](#baseitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
|
|
256
|
+
|
|
257
|
+
#### Type parameters
|
|
258
|
+
|
|
259
|
+
| Name | Type |
|
|
260
|
+
| :------ | :------ |
|
|
261
|
+
| `T` | `any` |
|
|
262
|
+
|
|
263
|
+
___
|
|
264
|
+
|
|
265
|
+
### ExtendTableTypeProps
|
|
266
|
+
|
|
267
|
+
Ƭ **ExtendTableTypeProps**: `Object`
|
|
268
|
+
|
|
269
|
+
#### Type declaration
|
|
270
|
+
|
|
271
|
+
| Name | Type |
|
|
272
|
+
| :------ | :------ |
|
|
273
|
+
| `children?` | `JSX.Element` \| ``null`` |
|
|
274
|
+
| `render?` | (`value`: `any`, `values`: `any`, `index`: `number`) => `JSX.Element` \| `string` \| `number` \| `boolean` \| ``null`` |
|
|
275
|
+
|
|
276
|
+
___
|
|
277
|
+
|
|
278
|
+
### ExtendTypes
|
|
279
|
+
|
|
280
|
+
Ƭ **ExtendTypes**: `Object`
|
|
281
|
+
|
|
282
|
+
#### Index signature
|
|
283
|
+
|
|
284
|
+
▪ [type: `string`]: [`ExtendFormTypeProps`](#extendformtypeprops)
|
|
285
|
+
|
|
286
|
+
___
|
|
287
|
+
|
|
288
|
+
### FaasItemProps
|
|
289
|
+
|
|
290
|
+
Ƭ **FaasItemProps**: [`BaseItemProps`](#baseitemprops) & { `type?`: [`FaasItemType`](#faasitemtype) }
|
|
291
|
+
|
|
292
|
+
___
|
|
293
|
+
|
|
294
|
+
### FaasItemType
|
|
295
|
+
|
|
296
|
+
Ƭ **FaasItemType**: ``"string"`` \| ``"string[]"`` \| ``"number"`` \| ``"number[]"`` \| ``"boolean"`` \| ``"date"`` \| ``"time"`` \| ``"object"`` \| ``"object[]"``
|
|
297
|
+
|
|
298
|
+
___
|
|
299
|
+
|
|
300
|
+
### FaasItemTypeValue
|
|
301
|
+
|
|
302
|
+
Ƭ **FaasItemTypeValue**: `Object`
|
|
303
|
+
|
|
304
|
+
FaasItemType's value type
|
|
305
|
+
|
|
306
|
+
#### Type declaration
|
|
307
|
+
|
|
308
|
+
| Name | Type |
|
|
309
|
+
| :------ | :------ |
|
|
310
|
+
| `boolean` | `boolean` |
|
|
311
|
+
| `date` | `Dayjs` |
|
|
312
|
+
| `number` | `number` |
|
|
313
|
+
| `number[]` | `number`[] |
|
|
314
|
+
| `object` | `any` |
|
|
315
|
+
| `object[]` | `any`[] |
|
|
316
|
+
| `string` | `string` |
|
|
317
|
+
| `string[]` | `string`[] |
|
|
318
|
+
| `time` | `Dayjs` |
|
|
319
|
+
|
|
320
|
+
___
|
|
321
|
+
|
|
322
|
+
### FormItemProps
|
|
323
|
+
|
|
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"``\>
|
|
325
|
+
|
|
326
|
+
#### Type parameters
|
|
327
|
+
|
|
328
|
+
| Name | Type |
|
|
329
|
+
| :------ | :------ |
|
|
330
|
+
| `T` | `any` |
|
|
331
|
+
|
|
332
|
+
___
|
|
333
|
+
|
|
334
|
+
### FormProps
|
|
335
|
+
|
|
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"``\>
|
|
337
|
+
|
|
338
|
+
#### Type parameters
|
|
339
|
+
|
|
340
|
+
| Name | Type |
|
|
341
|
+
| :------ | :------ |
|
|
342
|
+
| `Values` | extends `Record`<`string`, `any`\> = `any` |
|
|
343
|
+
| `ExtendItemProps` | `any` |
|
|
344
|
+
|
|
345
|
+
___
|
|
346
|
+
|
|
347
|
+
### LinkProps
|
|
348
|
+
|
|
349
|
+
Ƭ **LinkProps**: `Object`
|
|
350
|
+
|
|
351
|
+
#### Type declaration
|
|
352
|
+
|
|
353
|
+
| Name | Type |
|
|
354
|
+
| :------ | :------ |
|
|
355
|
+
| `button?` | `ButtonProps` |
|
|
356
|
+
| `children?` | `ReactNode` |
|
|
357
|
+
| `href` | `string` |
|
|
358
|
+
| `style?` | `CSSProperties` |
|
|
359
|
+
| `target?` | `string` |
|
|
360
|
+
| `text?` | `string` \| `number` |
|
|
361
|
+
|
|
362
|
+
___
|
|
363
|
+
|
|
364
|
+
### ModalProps
|
|
365
|
+
|
|
366
|
+
Ƭ **ModalProps**: `AntdModalProps` & { `children?`: `JSX.Element` \| `JSX.Element`[] \| `string` }
|
|
367
|
+
|
|
368
|
+
___
|
|
369
|
+
|
|
370
|
+
### RoutesProps
|
|
371
|
+
|
|
372
|
+
Ƭ **RoutesProps**: `Object`
|
|
373
|
+
|
|
374
|
+
#### Type declaration
|
|
375
|
+
|
|
376
|
+
| Name | Type |
|
|
377
|
+
| :------ | :------ |
|
|
378
|
+
| `fallback?` | `JSX.Element` |
|
|
379
|
+
| `notFound?` | `JSX.Element` |
|
|
380
|
+
| `routes` | `RouteProps` & { `page?`: `LazyExoticComponent`<`ComponentType`<`any`\>\> }[] |
|
|
381
|
+
|
|
382
|
+
___
|
|
383
|
+
|
|
384
|
+
### TableItemProps
|
|
385
|
+
|
|
386
|
+
Ƭ **TableItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `object?`: [`TableItemProps`](#tableitemprops)[] ; `optionsType?`: ``"auto"`` } & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
|
|
387
|
+
|
|
388
|
+
#### Type parameters
|
|
389
|
+
|
|
390
|
+
| Name | Type |
|
|
391
|
+
| :------ | :------ |
|
|
392
|
+
| `T` | `any` |
|
|
393
|
+
|
|
394
|
+
___
|
|
395
|
+
|
|
396
|
+
### TableProps
|
|
397
|
+
|
|
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`\>
|
|
399
|
+
|
|
400
|
+
#### Type parameters
|
|
401
|
+
|
|
402
|
+
| Name | Type |
|
|
403
|
+
| :------ | :------ |
|
|
404
|
+
| `T` | `any` |
|
|
405
|
+
| `ExtendTypes` | `any` |
|
|
406
|
+
|
|
407
|
+
___
|
|
408
|
+
|
|
409
|
+
### TimePickerProps
|
|
410
|
+
|
|
411
|
+
Ƭ **TimePickerProps**: `Omit`<`PickerTimeProps`<`Dayjs`\>, ``"picker"``\>
|
|
412
|
+
|
|
413
|
+
___
|
|
414
|
+
|
|
415
|
+
### TitleProps
|
|
416
|
+
|
|
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`[] | - |
|
|
430
|
+
|
|
431
|
+
___
|
|
432
|
+
|
|
433
|
+
### setDrawerProps
|
|
434
|
+
|
|
435
|
+
Ƭ **setDrawerProps**: (`changes`: `Partial`<[`DrawerProps`](#drawerprops)\>) => `void`
|
|
436
|
+
|
|
437
|
+
#### Type declaration
|
|
438
|
+
|
|
439
|
+
▸ (`changes`): `void`
|
|
440
|
+
|
|
441
|
+
##### Parameters
|
|
442
|
+
|
|
443
|
+
| Name | Type |
|
|
444
|
+
| :------ | :------ |
|
|
445
|
+
| `changes` | `Partial`<[`DrawerProps`](#drawerprops)\> |
|
|
446
|
+
|
|
447
|
+
##### Returns
|
|
448
|
+
|
|
449
|
+
`void`
|
|
450
|
+
|
|
451
|
+
___
|
|
452
|
+
|
|
453
|
+
### setModalProps
|
|
454
|
+
|
|
455
|
+
Ƭ **setModalProps**: (`changes`: `Partial`<[`ModalProps`](#modalprops)\>) => `void`
|
|
456
|
+
|
|
457
|
+
#### Type declaration
|
|
458
|
+
|
|
459
|
+
▸ (`changes`): `void`
|
|
460
|
+
|
|
461
|
+
##### Parameters
|
|
462
|
+
|
|
463
|
+
| Name | Type |
|
|
464
|
+
| :------ | :------ |
|
|
465
|
+
| `changes` | `Partial`<[`ModalProps`](#modalprops)\> |
|
|
466
|
+
|
|
467
|
+
##### Returns
|
|
468
|
+
|
|
469
|
+
`void`
|
|
470
|
+
|
|
471
|
+
## Variables
|
|
472
|
+
|
|
473
|
+
### ConfigContext
|
|
474
|
+
|
|
475
|
+
• `Const` **ConfigContext**: `Context`<[`ConfigProviderProps`](#configproviderprops)\>
|
|
476
|
+
|
|
477
|
+
___
|
|
478
|
+
|
|
479
|
+
### DatePicker
|
|
480
|
+
|
|
481
|
+
• `Const` **DatePicker**: `PickerComponentClass`<`Object`, `unknown`\> & {}
|
|
482
|
+
|
|
483
|
+
## Functions
|
|
484
|
+
|
|
485
|
+
### Blank
|
|
486
|
+
|
|
487
|
+
▸ **Blank**(`options?`): `JSX.Element`
|
|
488
|
+
|
|
489
|
+
If value is undefined or null, return text, otherwise return value.
|
|
490
|
+
|
|
491
|
+
#### Parameters
|
|
492
|
+
|
|
493
|
+
| Name | Type | Description |
|
|
494
|
+
| :------ | :------ | :------ |
|
|
495
|
+
| `options?` | [`BlankProps`](#blankprops) | {object} |
|
|
496
|
+
|
|
497
|
+
#### Returns
|
|
498
|
+
|
|
499
|
+
`JSX.Element`
|
|
500
|
+
|
|
501
|
+
```ts
|
|
502
|
+
<Blank value={undefined} text="Empty" />
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
___
|
|
506
|
+
|
|
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
|
+
### ConfigProvider
|
|
524
|
+
|
|
525
|
+
▸ **ConfigProvider**(`__namedParameters`): `Element`
|
|
526
|
+
|
|
527
|
+
Config for @faasjs/ant-design components.
|
|
528
|
+
|
|
529
|
+
```ts
|
|
530
|
+
<ConfigProvider config={{
|
|
531
|
+
common: {
|
|
532
|
+
blank: 'Empty',
|
|
533
|
+
},
|
|
534
|
+
}}>
|
|
535
|
+
<Blank />
|
|
536
|
+
</ConfigProvider>
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
#### Parameters
|
|
540
|
+
|
|
541
|
+
| Name | Type |
|
|
542
|
+
| :------ | :------ |
|
|
543
|
+
| `__namedParameters` | `Object` |
|
|
544
|
+
| `__namedParameters.children` | `ReactNode` |
|
|
545
|
+
| `__namedParameters.config` | [`ConfigProviderProps`](#configproviderprops) |
|
|
546
|
+
|
|
547
|
+
#### Returns
|
|
548
|
+
|
|
549
|
+
`Element`
|
|
550
|
+
|
|
551
|
+
___
|
|
552
|
+
|
|
553
|
+
### Description
|
|
554
|
+
|
|
555
|
+
▸ **Description**<`T`\>(`props`): `Element`
|
|
556
|
+
|
|
557
|
+
#### Type parameters
|
|
558
|
+
|
|
559
|
+
| Name | Type |
|
|
560
|
+
| :------ | :------ |
|
|
561
|
+
| `T` | `any` |
|
|
562
|
+
|
|
563
|
+
#### Parameters
|
|
564
|
+
|
|
565
|
+
| Name | Type |
|
|
566
|
+
| :------ | :------ |
|
|
567
|
+
| `props` | [`DescriptionProps`](#descriptionprops)<`T`, `any`\> |
|
|
568
|
+
|
|
569
|
+
#### Returns
|
|
570
|
+
|
|
571
|
+
`Element`
|
|
572
|
+
|
|
573
|
+
___
|
|
574
|
+
|
|
575
|
+
### Form
|
|
576
|
+
|
|
577
|
+
▸ **Form**<`Values`\>(`props`): `Element`
|
|
578
|
+
|
|
579
|
+
Form component with Ant Design & FaasJS
|
|
580
|
+
|
|
581
|
+
**`Ref`**
|
|
582
|
+
|
|
583
|
+
https://ant.design/components/form/
|
|
584
|
+
|
|
585
|
+
#### Type parameters
|
|
586
|
+
|
|
587
|
+
| Name | Type |
|
|
588
|
+
| :------ | :------ |
|
|
589
|
+
| `Values` | `any` |
|
|
590
|
+
|
|
591
|
+
#### Parameters
|
|
592
|
+
|
|
593
|
+
| Name | Type |
|
|
594
|
+
| :------ | :------ |
|
|
595
|
+
| `props` | [`FormProps`](#formprops)<`Values`, `any`\> |
|
|
596
|
+
|
|
597
|
+
#### Returns
|
|
598
|
+
|
|
599
|
+
`Element`
|
|
600
|
+
|
|
601
|
+
___
|
|
602
|
+
|
|
603
|
+
### FormItem
|
|
604
|
+
|
|
605
|
+
▸ **FormItem**<`T`\>(`props`): `Element`
|
|
606
|
+
|
|
607
|
+
FormItem, can be used without Form.
|
|
608
|
+
|
|
609
|
+
```ts
|
|
610
|
+
// use inline type
|
|
611
|
+
<FormItem item={{ type: 'string', id: 'name' }} />
|
|
612
|
+
|
|
613
|
+
// use custom type
|
|
614
|
+
<FormItem item={{ id: 'password' }}>
|
|
615
|
+
<Input.Password />
|
|
616
|
+
</>
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
#### Type parameters
|
|
620
|
+
|
|
621
|
+
| Name | Type |
|
|
622
|
+
| :------ | :------ |
|
|
623
|
+
| `T` | `any` |
|
|
624
|
+
|
|
625
|
+
#### Parameters
|
|
626
|
+
|
|
627
|
+
| Name | Type |
|
|
628
|
+
| :------ | :------ |
|
|
629
|
+
| `props` | [`FormItemProps`](#formitemprops)<`T`\> |
|
|
630
|
+
|
|
631
|
+
#### Returns
|
|
632
|
+
|
|
633
|
+
`Element`
|
|
634
|
+
|
|
635
|
+
___
|
|
636
|
+
|
|
637
|
+
### Link
|
|
638
|
+
|
|
639
|
+
▸ **Link**(`__namedParameters`): `Element`
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
// pure link
|
|
643
|
+
<Link href="/">Home</Link>
|
|
644
|
+
|
|
645
|
+
// link with button
|
|
646
|
+
<Link href="/" button={{type:'primary'}}>Home</Link>
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
#### Parameters
|
|
650
|
+
|
|
651
|
+
| Name | Type |
|
|
652
|
+
| :------ | :------ |
|
|
653
|
+
| `__namedParameters` | [`LinkProps`](#linkprops) |
|
|
654
|
+
|
|
655
|
+
#### Returns
|
|
656
|
+
|
|
657
|
+
`Element`
|
|
658
|
+
|
|
659
|
+
___
|
|
660
|
+
|
|
661
|
+
### PageNotFound
|
|
662
|
+
|
|
663
|
+
▸ **PageNotFound**(): `Element`
|
|
664
|
+
|
|
665
|
+
#### Returns
|
|
666
|
+
|
|
667
|
+
`Element`
|
|
668
|
+
|
|
669
|
+
___
|
|
670
|
+
|
|
671
|
+
### Routes
|
|
672
|
+
|
|
673
|
+
▸ **Routes**(`props`): `Element`
|
|
674
|
+
|
|
675
|
+
Routes with lazy loading and 404 page.
|
|
676
|
+
|
|
677
|
+
```tsx
|
|
678
|
+
import { lazy } from 'react'
|
|
679
|
+
import { BrowserRouter } from 'react-router-dom'
|
|
680
|
+
|
|
681
|
+
export function App () {
|
|
682
|
+
return <BrowserRouter>
|
|
683
|
+
<Routes routes={[
|
|
684
|
+
{
|
|
685
|
+
path: '/',
|
|
686
|
+
page: lazy(() => import('./pages/home'))
|
|
687
|
+
}
|
|
688
|
+
]} />
|
|
689
|
+
</BrowserRouter>
|
|
690
|
+
}
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
#### Parameters
|
|
694
|
+
|
|
695
|
+
| Name | Type |
|
|
696
|
+
| :------ | :------ |
|
|
697
|
+
| `props` | [`RoutesProps`](#routesprops) |
|
|
698
|
+
|
|
699
|
+
#### Returns
|
|
700
|
+
|
|
701
|
+
`Element`
|
|
702
|
+
|
|
703
|
+
___
|
|
704
|
+
|
|
705
|
+
### Table
|
|
706
|
+
|
|
707
|
+
▸ **Table**<`T`, `ExtendTypes`\>(`props`): `Element`
|
|
708
|
+
|
|
709
|
+
Table component with Ant Design & FaasJS
|
|
710
|
+
|
|
711
|
+
**`Ref`**
|
|
712
|
+
|
|
713
|
+
https://ant.design/components/table/
|
|
714
|
+
|
|
715
|
+
#### Type parameters
|
|
716
|
+
|
|
717
|
+
| Name | Type |
|
|
718
|
+
| :------ | :------ |
|
|
719
|
+
| `T` | `any` |
|
|
720
|
+
| `ExtendTypes` | `any` |
|
|
721
|
+
|
|
722
|
+
#### Parameters
|
|
723
|
+
|
|
724
|
+
| Name | Type |
|
|
725
|
+
| :------ | :------ |
|
|
726
|
+
| `props` | [`TableProps`](#tableprops)<`T`, `ExtendTypes`\> |
|
|
727
|
+
|
|
728
|
+
#### Returns
|
|
729
|
+
|
|
730
|
+
`Element`
|
|
731
|
+
|
|
732
|
+
___
|
|
733
|
+
|
|
734
|
+
### TimePicker
|
|
735
|
+
|
|
736
|
+
▸ **TimePicker**(`props`): `ReactElement`<`any`, `string` \| `JSXElementConstructor`<`any`\>\>
|
|
737
|
+
|
|
738
|
+
**NOTE**: Exotic components are not callable.
|
|
739
|
+
|
|
740
|
+
#### Parameters
|
|
741
|
+
|
|
742
|
+
| Name | Type |
|
|
743
|
+
| :------ | :------ |
|
|
744
|
+
| `props` | [`TimePickerProps`](#timepickerprops) & `RefAttributes`<`any`\> |
|
|
745
|
+
|
|
746
|
+
#### Returns
|
|
747
|
+
|
|
748
|
+
`ReactElement`<`any`, `string` \| `JSXElementConstructor`<`any`\>\>
|
|
749
|
+
|
|
750
|
+
___
|
|
751
|
+
|
|
752
|
+
### Title
|
|
753
|
+
|
|
754
|
+
▸ **Title**(`props`): `JSX.Element`
|
|
755
|
+
|
|
756
|
+
Title is used to change the title of the page.
|
|
757
|
+
Return null by default.
|
|
758
|
+
|
|
759
|
+
```ts
|
|
760
|
+
// return null
|
|
761
|
+
<Title title='hi' /> // => change the document.title to 'hi'
|
|
762
|
+
<Title title={['a', 'b']} /> // => change the document.title to 'a - b'
|
|
763
|
+
|
|
764
|
+
// return h1
|
|
765
|
+
<Title title='hi' h1 /> // => <h1>hi</h1>
|
|
766
|
+
<Title title={['a', 'b']} h1 /> // => <h1>a</h1>
|
|
767
|
+
|
|
768
|
+
// return children
|
|
769
|
+
<Title title='hi'><CustomTitle /></Title> // => <CustomTitle />
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
#### Parameters
|
|
773
|
+
|
|
774
|
+
| Name | Type |
|
|
775
|
+
| :------ | :------ |
|
|
776
|
+
| `props` | [`TitleProps`](#titleprops) |
|
|
777
|
+
|
|
778
|
+
#### Returns
|
|
779
|
+
|
|
780
|
+
`JSX.Element`
|
|
781
|
+
|
|
782
|
+
___
|
|
783
|
+
|
|
784
|
+
### transferOptions
|
|
785
|
+
|
|
786
|
+
▸ **transferOptions**(`options`): { `label`: `string` ; `value?`: `string` \| `number` }[]
|
|
787
|
+
|
|
788
|
+
#### Parameters
|
|
789
|
+
|
|
790
|
+
| Name | Type |
|
|
791
|
+
| :------ | :------ |
|
|
792
|
+
| `options` | [`BaseOption`](#baseoption)[] |
|
|
793
|
+
|
|
794
|
+
#### Returns
|
|
795
|
+
|
|
796
|
+
{ `label`: `string` ; `value?`: `string` \| `number` }[]
|
|
797
|
+
|
|
798
|
+
___
|
|
799
|
+
|
|
800
|
+
### transferValue
|
|
801
|
+
|
|
802
|
+
▸ **transferValue**(`type`, `value`): `any`
|
|
803
|
+
|
|
804
|
+
#### Parameters
|
|
805
|
+
|
|
806
|
+
| Name | Type |
|
|
807
|
+
| :------ | :------ |
|
|
808
|
+
| `type` | [`FaasItemType`](#faasitemtype) |
|
|
809
|
+
| `value` | `any` |
|
|
810
|
+
|
|
811
|
+
#### Returns
|
|
812
|
+
|
|
813
|
+
`any`
|
|
814
|
+
|
|
815
|
+
___
|
|
816
|
+
|
|
817
|
+
### useConfigContext
|
|
818
|
+
|
|
819
|
+
▸ **useConfigContext**(): [`ConfigProviderProps`](#configproviderprops)
|
|
820
|
+
|
|
821
|
+
#### Returns
|
|
822
|
+
|
|
823
|
+
[`ConfigProviderProps`](#configproviderprops)
|
|
824
|
+
|
|
825
|
+
___
|
|
826
|
+
|
|
827
|
+
### useDrawer
|
|
828
|
+
|
|
829
|
+
▸ **useDrawer**(`init?`): `Object`
|
|
830
|
+
|
|
831
|
+
Hook style drawer.
|
|
832
|
+
|
|
833
|
+
#### Parameters
|
|
834
|
+
|
|
835
|
+
| Name | Type | Description |
|
|
836
|
+
| :------ | :------ | :------ |
|
|
837
|
+
| `init?` | [`DrawerProps`](#drawerprops) | initial props ```ts function Example() { const { drawer, setDrawerProps } = useDrawer() return <> <Button onClick={ () => setDrawerProps(prev => ({ open: !prev.open})) }> Toggle </Button> {drawer} </> } ``` |
|
|
838
|
+
|
|
839
|
+
#### Returns
|
|
840
|
+
|
|
841
|
+
`Object`
|
|
842
|
+
|
|
843
|
+
| Name | Type |
|
|
844
|
+
| :------ | :------ |
|
|
845
|
+
| `drawer` | `Element` |
|
|
846
|
+
| `drawerProps` | [`DrawerProps`](#drawerprops) |
|
|
847
|
+
| `setDrawerProps` | (`changes`: `Partial`<[`DrawerProps`](#drawerprops)\>) => `void` |
|
|
848
|
+
|
|
849
|
+
___
|
|
850
|
+
|
|
851
|
+
### useModal
|
|
852
|
+
|
|
853
|
+
▸ **useModal**(`init?`): `Object`
|
|
854
|
+
|
|
855
|
+
Hook style modal.
|
|
856
|
+
|
|
857
|
+
#### Parameters
|
|
858
|
+
|
|
859
|
+
| Name | Type | Description |
|
|
860
|
+
| :------ | :------ | :------ |
|
|
861
|
+
| `init?` | [`ModalProps`](#modalprops) | initial props ```ts function Example() { const { modal, setModalProps } = useModal() return <> <Button onClick={() => setModalProps({ open: true })}>Open Modal</Button> {modal}</> } ``` |
|
|
862
|
+
|
|
863
|
+
#### Returns
|
|
864
|
+
|
|
865
|
+
`Object`
|
|
866
|
+
|
|
867
|
+
| Name | Type |
|
|
868
|
+
| :------ | :------ |
|
|
869
|
+
| `modal` | `Element` |
|
|
870
|
+
| `modalProps` | [`ModalProps`](#modalprops) |
|
|
871
|
+
| `setModalProps` | (`changes`: `Partial`<[`ModalProps`](#modalprops)\>) => `void` |
|