@faasjs/ant-design 0.0.2-beta.361 → 0.0.2-beta.365

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` | { `text`: `string` } |
252
+ | `Blank.text` | `string` |
253
+ | `Form` | { `submit`: { `text`: `string` } } |
254
+ | `Form.submit` | { `text`: `string` } |
255
+ | `Form.submit.text` | `string` |
256
+ | `Title` | { `separator`: `string` ; `suffix`: `string` } |
257
+ | `Title.separator` | `string` |
258
+ | `Title.suffix` | `string` |
259
+ | `common` | { `all`: `string` ; `blank`: `string` ; `pageNotFound`: `string` ; `submit`: `string` } |
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
@@ -302,34 +302,41 @@ function FormItem(props) {
302
302
  return /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.List, {
303
303
  name: computedProps.name,
304
304
  rules: computedProps.rules
305
- }, (fields, { add, remove }, { errors }) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
306
- className: "ant-form-item-label"
307
- }, /* @__PURE__ */ import_react.default.createElement("label", {
308
- className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
309
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
310
- key: field.key
311
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
312
- gutter: 24
313
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
314
- span: 23
315
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
316
- noStyle: true
317
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
318
- span: 1
319
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
320
- danger: true,
321
- type: "link",
322
- style: { float: "right" },
323
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
324
- onClick: () => remove(field.name)
325
- }))))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
326
- type: "dashed",
327
- block: true,
328
- onClick: () => add(),
329
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.PlusOutlined, null)
330
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.ErrorList, {
331
- errors
332
- }))));
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
+ });
333
340
  case "number":
334
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({
335
342
  style: { width: "100%" }
@@ -343,30 +350,34 @@ function FormItem(props) {
343
350
  name: computedProps.name,
344
351
  rules: computedProps.rules
345
352
  }, (fields, { add, remove }, { errors }) => {
346
- var _a;
353
+ var _a, _b;
347
354
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
348
355
  className: "ant-form-item-label"
349
356
  }, /* @__PURE__ */ import_react.default.createElement("label", {
350
357
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
351
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, {
352
- key: field.key
353
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Row, {
354
- gutter: 24
355
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
356
- span: 23
357
- }, /* @__PURE__ */ import_react.default.createElement(import_antd4.Form.Item, __spreadProps(__spreadValues({}, field), {
358
- noStyle: true
359
- }), /* @__PURE__ */ import_react.default.createElement(import_antd4.InputNumber, __spreadValues({
360
- style: { width: "100%" }
361
- }, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd4.Col, {
362
- span: 1
363
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd4.Button, {
364
- danger: true,
365
- type: "link",
366
- style: { float: "right" },
367
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons2.MinusCircleOutlined, null),
368
- onClick: () => remove(field.name)
369
- }))))), /* @__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, {
370
381
  type: "dashed",
371
382
  block: true,
372
383
  onClick: () => add(),
package/dist/index.mjs CHANGED
@@ -279,34 +279,41 @@ function FormItem(props) {
279
279
  return /* @__PURE__ */ React.createElement(AntdForm.List, {
280
280
  name: computedProps.name,
281
281
  rules: computedProps.rules
282
- }, (fields, { add, remove }, { errors }) => /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
283
- className: "ant-form-item-label"
284
- }, /* @__PURE__ */ React.createElement("label", {
285
- className: computedProps.rules.find((r) => r.required) && "ant-form-item-required"
286
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
287
- key: field.key
288
- }, /* @__PURE__ */ React.createElement(Row, {
289
- gutter: 24
290
- }, /* @__PURE__ */ React.createElement(Col, {
291
- span: 23
292
- }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
293
- noStyle: true
294
- }), /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
295
- span: 1
296
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
297
- danger: true,
298
- type: "link",
299
- style: { float: "right" },
300
- icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
301
- onClick: () => remove(field.name)
302
- }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
303
- type: "dashed",
304
- block: true,
305
- onClick: () => add(),
306
- icon: /* @__PURE__ */ React.createElement(PlusOutlined, null)
307
- }), /* @__PURE__ */ React.createElement(AntdForm.ErrorList, {
308
- errors
309
- }))));
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
+ });
310
317
  case "number":
311
318
  return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ React.createElement(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
312
319
  style: { width: "100%" }
@@ -320,30 +327,34 @@ function FormItem(props) {
320
327
  name: computedProps.name,
321
328
  rules: computedProps.rules
322
329
  }, (fields, { add, remove }, { errors }) => {
323
- var _a;
330
+ var _a, _b;
324
331
  return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
325
332
  className: "ant-form-item-label"
326
333
  }, /* @__PURE__ */ React.createElement("label", {
327
334
  className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
328
- }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
329
- key: field.key
330
- }, /* @__PURE__ */ React.createElement(Row, {
331
- gutter: 24
332
- }, /* @__PURE__ */ React.createElement(Col, {
333
- span: 23
334
- }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
335
- noStyle: true
336
- }), /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
337
- style: { width: "100%" }
338
- }, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
339
- span: 1
340
- }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
341
- danger: true,
342
- type: "link",
343
- style: { float: "right" },
344
- icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
345
- onClick: () => remove(field.name)
346
- }))))), /* @__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, {
347
358
  type: "dashed",
348
359
  block: true,
349
360
  onClick: () => add(),
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.361",
3
+ "version": "0.0.2-beta.365",
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.361",
31
+ "@faasjs/react": "^0.0.2-beta.365",
32
32
  "react-use": "*",
33
33
  "react-router-dom": "*"
34
34
  },