@faasjs/ant-design 0.0.2-beta.360 → 0.0.2-beta.364

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
@@ -38,3 +38,534 @@ Form are based on [Ant Design's Form component](https://ant.design/components/fo
38
38
  Form are based on [Ant Design's Form.Item component](https://ant.design/components/form/#Form.Item).
39
39
 
40
40
  <iframe src="https://codesandbox.io/embed/faasjs-ant-design-formitem-olqg5" style="width:100%;height:500px;border:0;overflow:hidden;" title="faasjs-ant-design-formitem" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"></iframe>
41
+
42
+ ## Modules
43
+
44
+ ### Namespaces
45
+
46
+ - [Form](modules/Form.md)
47
+
48
+ ### Type aliases
49
+
50
+ - [BaseItemProps](#baseitemprops)
51
+ - [BaseOption](#baseoption)
52
+ - [BlankProps](#blankprops)
53
+ - [DescriptionItemProps](#descriptionitemprops)
54
+ - [DescriptionProps](#descriptionprops)
55
+ - [DrawerProps](#drawerprops)
56
+ - [ExtendDescriptionItemProps](#extenddescriptionitemprops)
57
+ - [ExtendDescriptionTypeProps](#extenddescriptiontypeprops)
58
+ - [ExtendFormItemProps](#extendformitemprops)
59
+ - [ExtendFormTypeProps](#extendformtypeprops)
60
+ - [ExtendTableItemProps](#extendtableitemprops)
61
+ - [ExtendTableTypeProps](#extendtabletypeprops)
62
+ - [FaasItemProps](#faasitemprops)
63
+ - [FaasItemType](#faasitemtype)
64
+ - [FaasItemTypeValue](#faasitemtypevalue)
65
+ - [FaasState](#faasstate)
66
+ - [FormItemProps](#formitemprops)
67
+ - [FormProps](#formprops)
68
+ - [RoutesProps](#routesprops)
69
+ - [TableItemProps](#tableitemprops)
70
+ - [TableProps](#tableprops)
71
+ - [TitleProps](#titleprops)
72
+
73
+ ### Functions
74
+
75
+ - [Blank](#blank)
76
+ - [Config](#config)
77
+ - [Description](#description)
78
+ - [Form](#form)
79
+ - [FormItem](#formitem)
80
+ - [Routes](#routes)
81
+ - [Table](#table)
82
+ - [Title](#title)
83
+ - [transferOptions](#transferoptions)
84
+ - [useDrawer](#usedrawer)
85
+ - [useFaasState](#usefaasstate)
86
+
87
+ ## Type aliases
88
+
89
+ ### BaseItemProps
90
+
91
+ Ƭ **BaseItemProps**: `Object`
92
+
93
+ #### Type declaration
94
+
95
+ | Name | Type |
96
+ | :------ | :------ |
97
+ | `id` | `string` |
98
+ | `options?` | [`BaseOption`](#baseoption)[] |
99
+ | `title?` | `string` |
100
+
101
+ ___
102
+
103
+ ### BaseOption
104
+
105
+ Ƭ **BaseOption**: `string` \| `number` \| { `label`: `string` ; `value?`: `string` \| `number` }
106
+
107
+ ___
108
+
109
+ ### BlankProps
110
+
111
+ Ƭ **BlankProps**: `Object`
112
+
113
+ #### Type declaration
114
+
115
+ | Name | Type |
116
+ | :------ | :------ |
117
+ | `text?` | `string` |
118
+ | `value?` | `any` |
119
+
120
+ ___
121
+
122
+ ### DescriptionItemProps
123
+
124
+ Ƭ **DescriptionItemProps**<`T`\>: { `children?`: `JSX.Element` ; `render?`: (`value`: `T`, `values`: `any`) => `string` \| `number` \| `boolean` \| `Element` } & [`FaasItemProps`](#faasitemprops)
125
+
126
+ #### Type parameters
127
+
128
+ | Name | Type |
129
+ | :------ | :------ |
130
+ | `T` | `any` |
131
+
132
+ ___
133
+
134
+ ### DescriptionProps
135
+
136
+ Ƭ **DescriptionProps**<`T`, `ExtendItemProps`\>: { `dataSource?`: `T` ; `extendTypes?`: { [key: string]: [`ExtendDescriptionTypeProps`](#extenddescriptiontypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`DescriptionItemProps`](#descriptionitemprops) \| `ExtendItemProps`)[] } & `DescriptionsProps`
137
+
138
+ #### Type parameters
139
+
140
+ | Name | Type |
141
+ | :------ | :------ |
142
+ | `T` | `any` |
143
+ | `ExtendItemProps` | `any` |
144
+
145
+ ___
146
+
147
+ ### DrawerProps
148
+
149
+ Ƭ **DrawerProps**: `AntdDrawerProps` & { `children?`: `JSX.Element` \| `JSX.Element`[] }
150
+
151
+ ___
152
+
153
+ ### ExtendDescriptionItemProps
154
+
155
+ Ƭ **ExtendDescriptionItemProps**: [`BaseItemProps`](#baseitemprops)
156
+
157
+ ___
158
+
159
+ ### ExtendDescriptionTypeProps
160
+
161
+ Ƭ **ExtendDescriptionTypeProps**: `Object`
162
+
163
+ #### Type declaration
164
+
165
+ | Name | Type |
166
+ | :------ | :------ |
167
+ | `children?` | `JSX.Element` \| ``null`` |
168
+ | `render?` | (`value`: `any`, `values`: `any`) => `string` \| `number` \| `boolean` \| `Element` |
169
+
170
+ ___
171
+
172
+ ### ExtendFormItemProps
173
+
174
+ Ƭ **ExtendFormItemProps**: [`BaseItemProps`](#baseitemprops) & `AntdFormItemProps`
175
+
176
+ ___
177
+
178
+ ### ExtendFormTypeProps
179
+
180
+ Ƭ **ExtendFormTypeProps**: `Object`
181
+
182
+ #### Type declaration
183
+
184
+ | Name | Type |
185
+ | :------ | :------ |
186
+ | `children?` | `JSX.Element` \| ``null`` |
187
+
188
+ ___
189
+
190
+ ### ExtendTableItemProps
191
+
192
+ Ƭ **ExtendTableItemProps**<`T`\>: [`BaseItemProps`](#baseitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
193
+
194
+ #### Type parameters
195
+
196
+ | Name | Type |
197
+ | :------ | :------ |
198
+ | `T` | `any` |
199
+
200
+ ___
201
+
202
+ ### ExtendTableTypeProps
203
+
204
+ Ƭ **ExtendTableTypeProps**: `Object`
205
+
206
+ #### Type declaration
207
+
208
+ | Name | Type |
209
+ | :------ | :------ |
210
+ | `children?` | `JSX.Element` \| ``null`` |
211
+ | `render?` | (`value`: `any`, `values`: `any`, `index`: `number`) => `string` \| `number` \| `boolean` \| `Element` |
212
+
213
+ ___
214
+
215
+ ### FaasItemProps
216
+
217
+ Ƭ **FaasItemProps**: [`BaseItemProps`](#baseitemprops) & { `type?`: [`FaasItemType`](#faasitemtype) }
218
+
219
+ ___
220
+
221
+ ### FaasItemType
222
+
223
+ Ƭ **FaasItemType**: ``"string"`` \| ``"string[]"`` \| ``"number"`` \| ``"number[]"`` \| ``"boolean"``
224
+
225
+ ___
226
+
227
+ ### FaasItemTypeValue
228
+
229
+ Ƭ **FaasItemTypeValue**: `Object`
230
+
231
+ #### Type declaration
232
+
233
+ | Name | Type |
234
+ | :------ | :------ |
235
+ | `boolean` | `boolean` |
236
+ | `number` | `number` |
237
+ | `number[]` | `number`[] |
238
+ | `string` | `string` |
239
+ | `string[]` | `string`[] |
240
+
241
+ ___
242
+
243
+ ### FaasState
244
+
245
+ Ƭ **FaasState**: `Object`
246
+
247
+ #### Type declaration
248
+
249
+ | Name | Type |
250
+ | :------ | :------ |
251
+ | `Blank` | `Object` |
252
+ | `Blank.text` | `string` |
253
+ | `Form` | `Object` |
254
+ | `Form.submit` | `Object` |
255
+ | `Form.submit.text` | `string` |
256
+ | `Title` | `Object` |
257
+ | `Title.separator` | `string` |
258
+ | `Title.suffix` | `string` |
259
+ | `common` | `Object` |
260
+ | `common.all` | `string` |
261
+ | `common.blank` | `string` |
262
+ | `common.pageNotFound` | `string` |
263
+ | `common.submit` | `string` |
264
+
265
+ ___
266
+
267
+ ### FormItemProps
268
+
269
+ Ƭ **FormItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` ; `extendTypes?`: { [type: string]: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `label?`: `string` \| ``false`` ; `rules?`: `RuleObject`[] ; `render?`: () => `Element` } & `FormItemInputProps`<`T`\> & [`FaasItemProps`](#faasitemprops) & `AntdFormItemProps`<`T`\>
270
+
271
+ #### Type parameters
272
+
273
+ | Name | Type |
274
+ | :------ | :------ |
275
+ | `T` | `any` |
276
+
277
+ ___
278
+
279
+ ### FormProps
280
+
281
+ Ƭ **FormProps**<`Values`, `ExtendItemProps`\>: { `extendTypes?`: { [type: string]: [`ExtendFormTypeProps`](#extendformtypeprops); } ; `items?`: ([`FormItemProps`](#formitemprops) \| `ExtendItemProps`)[] ; `submit?`: ``false`` \| { `text?`: `string` } } & `AntdFormProps`<`Values`\>
282
+
283
+ #### Type parameters
284
+
285
+ | Name | Type |
286
+ | :------ | :------ |
287
+ | `Values` | `any` |
288
+ | `ExtendItemProps` | `any` |
289
+
290
+ ___
291
+
292
+ ### RoutesProps
293
+
294
+ Ƭ **RoutesProps**: `Object`
295
+
296
+ #### Type declaration
297
+
298
+ | Name | Type |
299
+ | :------ | :------ |
300
+ | `fallback?` | `JSX.Element` |
301
+ | `notFound?` | `JSX.Element` |
302
+ | `routes` | `RouteProps` & { `page?`: `LazyExoticComponent`<`ComponentType`<`any`\>\> }[] |
303
+
304
+ ___
305
+
306
+ ### TableItemProps
307
+
308
+ Ƭ **TableItemProps**<`T`\>: { `children?`: `JSX.Element` \| ``null`` } & [`FaasItemProps`](#faasitemprops) & `Omit`<`AntdTableColumnProps`<`T`\>, ``"children"``\>
309
+
310
+ #### Type parameters
311
+
312
+ | Name | Type |
313
+ | :------ | :------ |
314
+ | `T` | `any` |
315
+
316
+ ___
317
+
318
+ ### TableProps
319
+
320
+ Ƭ **TableProps**<`T`, `ExtendTypes`\>: { `extendTypes?`: { [key: string]: [`ExtendTableTypeProps`](#extendtabletypeprops); } ; `faasData?`: `FaasDataWrapperProps`<`T`\> ; `items`: ([`TableItemProps`](#tableitemprops) \| `ExtendTypes` & [`ExtendTableItemProps`](#extendtableitemprops))[] ; `onChange?`: (`pagination`: `TablePaginationConfig`, `filters`: `Record`<`string`, `FilterValue`\>, `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`\>
321
+
322
+ #### Type parameters
323
+
324
+ | Name | Type |
325
+ | :------ | :------ |
326
+ | `T` | `any` |
327
+ | `ExtendTypes` | `any` |
328
+
329
+ ___
330
+
331
+ ### TitleProps
332
+
333
+ Ƭ **TitleProps**: `Object`
334
+
335
+ #### Type declaration
336
+
337
+ | Name | Type | Description |
338
+ | :------ | :------ | :------ |
339
+ | `separator?` | `string` | ` - ` as default |
340
+ | `suffix?` | `string` | - |
341
+ | `title` | `string` \| `string`[] | - |
342
+
343
+ ## Functions
344
+
345
+ ### Blank
346
+
347
+ ▸ **Blank**(`options?`): `any`
348
+
349
+ If value is undefined or null, return text, otherwise return value.
350
+
351
+ #### Parameters
352
+
353
+ | Name | Type |
354
+ | :------ | :------ |
355
+ | `options?` | [`BlankProps`](#blankprops) |
356
+
357
+ #### Returns
358
+
359
+ `any`
360
+
361
+ ```ts
362
+ <Blank value={undefined} text="Empty" />
363
+ ```
364
+
365
+ ___
366
+
367
+ ### Config
368
+
369
+ ▸ **Config**(`props`): `JSX.Element`
370
+
371
+ Config for all @faasjs/ant-design components.
372
+
373
+ #### Parameters
374
+
375
+ | Name | Type |
376
+ | :------ | :------ |
377
+ | `props` | `Object` |
378
+ | `props.config` | `Partial`<[`FaasState`](#faasstate)\> |
379
+
380
+ #### Returns
381
+
382
+ `JSX.Element`
383
+
384
+ ```ts
385
+ <Config config={{
386
+ common: {
387
+ blank: '空',
388
+ },
389
+ }} />
390
+ ```
391
+
392
+ ___
393
+
394
+ ### Description
395
+
396
+ ▸ **Description**<`T`\>(`props`): `Element`
397
+
398
+ #### Type parameters
399
+
400
+ | Name | Type |
401
+ | :------ | :------ |
402
+ | `T` | `any` |
403
+
404
+ #### Parameters
405
+
406
+ | Name | Type |
407
+ | :------ | :------ |
408
+ | `props` | [`DescriptionProps`](#descriptionprops)<`T`, `any`\> |
409
+
410
+ #### Returns
411
+
412
+ `Element`
413
+
414
+ ___
415
+
416
+ ### Form
417
+
418
+ ▸ **Form**<`Values`\>(`props`): `Element`
419
+
420
+ #### Type parameters
421
+
422
+ | Name | Type |
423
+ | :------ | :------ |
424
+ | `Values` | `any` |
425
+
426
+ #### Parameters
427
+
428
+ | Name | Type |
429
+ | :------ | :------ |
430
+ | `props` | [`FormProps`](#formprops)<`Values`, `any`\> |
431
+
432
+ #### Returns
433
+
434
+ `Element`
435
+
436
+ ___
437
+
438
+ ### FormItem
439
+
440
+ ▸ **FormItem**<`T`\>(`props`): `Element`
441
+
442
+ FormItem, can be used without Form.
443
+ Example:
444
+ ```ts
445
+ // use inline type
446
+ <FormItem item={{ type: 'string', id: 'name' }} />
447
+
448
+ // use custom type
449
+ <FormItem item={{ id: 'password' }}>
450
+ <Input.Password />
451
+ </>
452
+ ```
453
+
454
+ #### Type parameters
455
+
456
+ | Name | Type |
457
+ | :------ | :------ |
458
+ | `T` | `any` |
459
+
460
+ #### Parameters
461
+
462
+ | Name | Type |
463
+ | :------ | :------ |
464
+ | `props` | [`FormItemProps`](#formitemprops)<`T`\> |
465
+
466
+ #### Returns
467
+
468
+ `Element`
469
+
470
+ ___
471
+
472
+ ### Routes
473
+
474
+ ▸ **Routes**(`props`): `Element`
475
+
476
+ #### Parameters
477
+
478
+ | Name | Type |
479
+ | :------ | :------ |
480
+ | `props` | [`RoutesProps`](#routesprops) |
481
+
482
+ #### Returns
483
+
484
+ `Element`
485
+
486
+ ___
487
+
488
+ ### Table
489
+
490
+ ▸ **Table**<`T`, `ExtendTypes`\>(`props`): `Element`
491
+
492
+ #### Type parameters
493
+
494
+ | Name | Type |
495
+ | :------ | :------ |
496
+ | `T` | `any` |
497
+ | `ExtendTypes` | `any` |
498
+
499
+ #### Parameters
500
+
501
+ | Name | Type |
502
+ | :------ | :------ |
503
+ | `props` | [`TableProps`](#tableprops)<`T`, `ExtendTypes`\> |
504
+
505
+ #### Returns
506
+
507
+ `Element`
508
+
509
+ ___
510
+
511
+ ### Title
512
+
513
+ ▸ **Title**(`props`): `JSX.Element`
514
+
515
+ #### Parameters
516
+
517
+ | Name | Type |
518
+ | :------ | :------ |
519
+ | `props` | [`TitleProps`](#titleprops) |
520
+
521
+ #### Returns
522
+
523
+ `JSX.Element`
524
+
525
+ ___
526
+
527
+ ### transferOptions
528
+
529
+ ▸ **transferOptions**(`options`): { `label`: `string` ; `value?`: `string` \| `number` }[]
530
+
531
+ #### Parameters
532
+
533
+ | Name | Type |
534
+ | :------ | :------ |
535
+ | `options` | [`BaseOption`](#baseoption)[] |
536
+
537
+ #### Returns
538
+
539
+ { `label`: `string` ; `value?`: `string` \| `number` }[]
540
+
541
+ ___
542
+
543
+ ### useDrawer
544
+
545
+ ▸ **useDrawer**(`init?`): `Object`
546
+
547
+ #### Parameters
548
+
549
+ | Name | Type |
550
+ | :------ | :------ |
551
+ | `init?` | [`DrawerProps`](#drawerprops) |
552
+
553
+ #### Returns
554
+
555
+ `Object`
556
+
557
+ | Name | Type |
558
+ | :------ | :------ |
559
+ | `drawer` | `Element` |
560
+ | `drawerProps` | [`DrawerProps`](#drawerprops) |
561
+ | `setDrawerProps` | (`changes`: `Partial`<[`DrawerProps`](#drawerprops)\>) => `void` |
562
+
563
+ ___
564
+
565
+ ### useFaasState
566
+
567
+ ▸ `Const` **useFaasState**(): [[`FaasState`](#faasstate), (`state`: `IHookStateSetAction`<[`FaasState`](#faasstate)\>) => `void`]
568
+
569
+ #### Returns
570
+
571
+ [[`FaasState`](#faasstate), (`state`: `IHookStateSetAction`<[`FaasState`](#faasstate)\>) => `void`]
package/dist/index.d.ts CHANGED
@@ -12,6 +12,18 @@ declare type BlankProps = {
12
12
  value?: any;
13
13
  text?: string;
14
14
  };
15
+ /**
16
+ * If value is undefined or null, return text, otherwise return value.
17
+ *
18
+ * @param options {object}
19
+ * @param options.value {any}
20
+ * @param options.text {string} Default is 'Empty'
21
+ * @returns {JSX.Element}
22
+ *
23
+ * ```ts
24
+ * <Blank value={undefined} text="Empty" />
25
+ * ```
26
+ */
15
27
  declare function Blank(options?: BlankProps): any;
16
28
 
17
29
  declare type FaasState = {
@@ -35,6 +47,20 @@ declare type FaasState = {
35
47
  };
36
48
  };
37
49
  declare const useFaasState: () => [FaasState, (state: react_use_lib_misc_hookState.IHookStateSetAction<FaasState>) => void];
50
+ /**
51
+ * Config for all @faasjs/ant-design components.
52
+ * @param props {object}
53
+ * @param props.config {Partial<FaasState>}
54
+ * @returns {null}
55
+ *
56
+ * ```ts
57
+ * <Config config={{
58
+ * common: {
59
+ * blank: '空',
60
+ * },
61
+ * }} />
62
+ * ```
63
+ */
38
64
  declare function Config(props: {
39
65
  config: Partial<FaasState>;
40
66
  }): JSX.Element;
@@ -119,7 +145,7 @@ declare type BooleanProps = {
119
145
  input?: SwitchProps;
120
146
  };
121
147
  declare type OptionsProps = {
122
- options: BaseOption[];
148
+ options?: BaseOption[];
123
149
  type?: 'string' | 'string[]' | 'number' | 'number[]';
124
150
  input?: SelectProps<any>;
125
151
  };
@@ -137,6 +163,19 @@ declare type FormItemProps<T = any> = {
137
163
  [type: string]: ExtendFormTypeProps;
138
164
  };
139
165
  } & FormItemInputProps<T> & FaasItemProps & FormItemProps$1<T>;
166
+ /**
167
+ * FormItem, can be used without Form.
168
+ * Example:
169
+ * ```ts
170
+ * // use inline type
171
+ * <FormItem item={{ type: 'string', id: 'name' }} />
172
+ *
173
+ * // use custom type
174
+ * <FormItem item={{ id: 'password' }}>
175
+ * <Input.Password />
176
+ * </>
177
+ * ```
178
+ */
140
179
  declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
141
180
 
142
181
  declare type FormProps<Values = any, ExtendItemProps = any> = {
package/dist/index.js CHANGED
@@ -200,11 +200,9 @@ function Description(props) {
200
200
  extendTypes: props.extendTypes
201
201
  }))));
202
202
  return /* @__PURE__ */ import_react.default.createElement(import_react4.FaasDataWrapper, __spreadValues({
203
- fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
204
- style: { padding: "24px" }
205
- }, /* @__PURE__ */ import_react.default.createElement(import_antd2.Skeleton, {
203
+ fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd2.Skeleton, {
206
204
  active: true
207
- })),
205
+ }),
208
206
  render: ({ data }) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ import_react.default.createElement(import_antd2.Descriptions.Item, {
209
207
  key: item.id,
210
208
  label: item.title || (0, import_lodash3.upperFirst)(item.id)
@@ -304,34 +302,41 @@ function FormItem(props) {
304
302
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
305
303
  name: computedProps.name,
306
304
  rules: computedProps.rules
307
- }, (fields, { add, remove }, { errors }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
308
- className: "ant-form-item-label"
309
- }, /* @__PURE__ */ import_react.default.createElement("label", {
310
- className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
311
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
312
- key: field.key
313
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
314
- gutter: 24
315
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
316
- span: 23
317
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
318
- noStyle: true
319
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
320
- span: 1
321
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
322
- danger: true,
323
- type: "link",
324
- style: { float: "right" },
325
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
326
- onClick: () => remove(field.name)
327
- }))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
328
- type: "dashed",
329
- block: true,
330
- onClick: () => add(),
331
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.PlusOutlined, null)
332
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.ErrorList, {
333
- errors
334
- }))));
305
+ }, (fields, { add, remove }, { errors }) => {
306
+ var _a;
307
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
308
+ className: "ant-form-item-label"
309
+ }, /* @__PURE__ */ import_react.default.createElement("label", {
310
+ className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
311
+ }, computedProps.label)), fields.map((field) => {
312
+ var _a2;
313
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
314
+ key: field.key
315
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
316
+ gutter: 24,
317
+ style: { flexFlow: "row nowrap" }
318
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
319
+ span: 23
320
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
321
+ noStyle: true
322
+ }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
323
+ span: 1
324
+ }, !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
325
+ danger: true,
326
+ type: "link",
327
+ style: { float: "right" },
328
+ icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
329
+ onClick: () => remove(field.name)
330
+ }))));
331
+ }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, !((_a = computedProps.input) == null ? void 0 : _a.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
332
+ type: "dashed",
333
+ block: true,
334
+ onClick: () => add(),
335
+ icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.PlusOutlined, null)
336
+ }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.ErrorList, {
337
+ errors
338
+ })));
339
+ });
335
340
  case "number":
336
341
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ import_react.default.createElement(import_antd4.Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
337
342
  style: { width: "100%" }
@@ -345,30 +350,34 @@ function FormItem(props) {
345
350
  name: computedProps.name,
346
351
  rules: computedProps.rules
347
352
  }, (fields, { add, remove }, { errors }) => {
348
- var _a;
353
+ var _a, _b;
349
354
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
350
355
  className: "ant-form-item-label"
351
356
  }, /* @__PURE__ */ import_react.default.createElement("label", {
352
357
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
353
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
354
- key: field.key
355
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
356
- gutter: 24
357
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
358
- span: 23
359
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
360
- noStyle: true
361
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
362
- style: { width: "100%" }
363
- }, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
364
- span: 1
365
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
366
- danger: true,
367
- type: "link",
368
- style: { float: "right" },
369
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
370
- onClick: () => remove(field.name)
371
- }))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
358
+ }, computedProps.label)), fields.map((field) => {
359
+ var _a2;
360
+ return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
361
+ key: field.key
362
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
363
+ gutter: 24,
364
+ style: { flexFlow: "row nowrap" }
365
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
366
+ span: 23
367
+ }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
368
+ noStyle: true
369
+ }), /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
370
+ style: { width: "100%" }
371
+ }, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
372
+ span: 1
373
+ }, !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
374
+ danger: true,
375
+ type: "link",
376
+ style: { float: "right" },
377
+ icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
378
+ onClick: () => remove(field.name)
379
+ }))));
380
+ }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
372
381
  type: "dashed",
373
382
  block: true,
374
383
  onClick: () => add(),
@@ -597,11 +606,9 @@ function Table(props) {
597
606
  dataSource: props.dataSource
598
607
  }));
599
608
  return /* @__PURE__ */ import_react.default.createElement(import_react10.FaasDataWrapper, __spreadValues({
600
- fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement("div", {
601
- style: { padding: "24px" }
602
- }, /* @__PURE__ */ import_react.default.createElement(import_antd7.Skeleton, {
609
+ fallback: props.faasData.fallback || /* @__PURE__ */ import_react.default.createElement(import_antd7.Skeleton, {
603
610
  active: true
604
- })),
611
+ }),
605
612
  render: ({
606
613
  data,
607
614
  params,
package/dist/index.mjs CHANGED
@@ -165,11 +165,9 @@ function Description(props) {
165
165
  extendTypes: props.extendTypes
166
166
  }))));
167
167
  return /* @__PURE__ */ React.createElement(FaasDataWrapper, __spreadValues({
168
- fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement("div", {
169
- style: { padding: "24px" }
170
- }, /* @__PURE__ */ React.createElement(Skeleton, {
168
+ fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement(Skeleton, {
171
169
  active: true
172
- })),
170
+ }),
173
171
  render: ({ data }) => /* @__PURE__ */ React.createElement(Descriptions, __spreadValues({}, props), props.items.map((item) => /* @__PURE__ */ React.createElement(Descriptions.Item, {
174
172
  key: item.id,
175
173
  label: item.title || upperFirst2(item.id)
@@ -281,34 +279,41 @@ function FormItem(props) {
281
279
  return /* @__PURE__ */ React.createElement(AntdForm.List, {
282
280
  name: computedProps.name,
283
281
  rules: computedProps.rules
284
- }, (fields, { add, remove }, { errors }) => /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
285
- className: "ant-form-item-label"
286
- }, /* @__PURE__ */ React.createElement("label", {
287
- className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
288
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
289
- key: field.key
290
- }, /* @__PURE__ */ React.createElement(Row, {
291
- gutter: 24
292
- }, /* @__PURE__ */ React.createElement(Col, {
293
- span: 23
294
- }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
295
- noStyle: true
296
- }), /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
297
- span: 1
298
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
299
- danger: true,
300
- type: "link",
301
- style: { float: "right" },
302
- icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
303
- onClick: () => remove(field.name)
304
- }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
305
- type: "dashed",
306
- block: true,
307
- onClick: () => add(),
308
- icon: /* @__PURE__ */ React.createElement(PlusOutlined, null)
309
- }), /* @__PURE__ */ React.createElement(AntdForm.ErrorList, {
310
- errors
311
- }))));
282
+ }, (fields, { add, remove }, { errors }) => {
283
+ var _a;
284
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
285
+ className: "ant-form-item-label"
286
+ }, /* @__PURE__ */ React.createElement("label", {
287
+ className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
288
+ }, computedProps.label)), fields.map((field) => {
289
+ var _a2;
290
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
291
+ key: field.key
292
+ }, /* @__PURE__ */ React.createElement(Row, {
293
+ gutter: 24,
294
+ style: { flexFlow: "row nowrap" }
295
+ }, /* @__PURE__ */ React.createElement(Col, {
296
+ span: 23
297
+ }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
298
+ noStyle: true
299
+ }), /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
300
+ span: 1
301
+ }, !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
302
+ danger: true,
303
+ type: "link",
304
+ style: { float: "right" },
305
+ icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
306
+ onClick: () => remove(field.name)
307
+ }))));
308
+ }), /* @__PURE__ */ React.createElement(AntdForm.Item, null, !((_a = computedProps.input) == null ? void 0 : _a.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
309
+ type: "dashed",
310
+ block: true,
311
+ onClick: () => add(),
312
+ icon: /* @__PURE__ */ React.createElement(PlusOutlined, null)
313
+ }), /* @__PURE__ */ React.createElement(AntdForm.ErrorList, {
314
+ errors
315
+ })));
316
+ });
312
317
  case "number":
313
318
  return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ React.createElement(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
314
319
  style: { width: "100%" }
@@ -322,30 +327,34 @@ function FormItem(props) {
322
327
  name: computedProps.name,
323
328
  rules: computedProps.rules
324
329
  }, (fields, { add, remove }, { errors }) => {
325
- var _a;
330
+ var _a, _b;
326
331
  return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
327
332
  className: "ant-form-item-label"
328
333
  }, /* @__PURE__ */ React.createElement("label", {
329
334
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
330
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
331
- key: field.key
332
- }, /* @__PURE__ */ React.createElement(Row, {
333
- gutter: 24
334
- }, /* @__PURE__ */ React.createElement(Col, {
335
- span: 23
336
- }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
337
- noStyle: true
338
- }), /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
339
- style: { width: "100%" }
340
- }, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
341
- span: 1
342
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
343
- danger: true,
344
- type: "link",
345
- style: { float: "right" },
346
- icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
347
- onClick: () => remove(field.name)
348
- }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
335
+ }, computedProps.label)), fields.map((field) => {
336
+ var _a2;
337
+ return /* @__PURE__ */ React.createElement(AntdForm.Item, {
338
+ key: field.key
339
+ }, /* @__PURE__ */ React.createElement(Row, {
340
+ gutter: 24,
341
+ style: { flexFlow: "row nowrap" }
342
+ }, /* @__PURE__ */ React.createElement(Col, {
343
+ span: 23
344
+ }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
345
+ noStyle: true
346
+ }), /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
347
+ style: { width: "100%" }
348
+ }, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
349
+ span: 1
350
+ }, !((_a2 = computedProps.input) == null ? void 0 : _a2.disabled) && (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
351
+ danger: true,
352
+ type: "link",
353
+ style: { float: "right" },
354
+ icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
355
+ onClick: () => remove(field.name)
356
+ }))));
357
+ }), /* @__PURE__ */ React.createElement(AntdForm.Item, null, !((_b = computedProps.input) == null ? void 0 : _b.disabled) && (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
349
358
  type: "dashed",
350
359
  block: true,
351
360
  onClick: () => add(),
@@ -587,11 +596,9 @@ function Table(props) {
587
596
  dataSource: props.dataSource
588
597
  }));
589
598
  return /* @__PURE__ */ React.createElement(FaasDataWrapper2, __spreadValues({
590
- fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement("div", {
591
- style: { padding: "24px" }
592
- }, /* @__PURE__ */ React.createElement(Skeleton3, {
599
+ fallback: props.faasData.fallback || /* @__PURE__ */ React.createElement(Skeleton3, {
593
600
  active: true
594
- })),
601
+ }),
595
602
  render: ({
596
603
  data,
597
604
  params,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.360",
3
+ "version": "0.0.2-beta.364",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
- "homepage": "https://faasjs.com/doc/ant-design.html",
8
+ "homepage": "https://faasjs.com/doc/ant-design",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/faasjs/faasjs.git",
@@ -28,7 +28,7 @@
28
28
  "lodash": "*",
29
29
  "react": "*",
30
30
  "react-dom": "*",
31
- "@faasjs/react": "^0.0.2-beta.360",
31
+ "@faasjs/react": "^0.0.2-beta.364",
32
32
  "react-use": "*",
33
33
  "react-router-dom": "*"
34
34
  },