@faasjs/ant-design 0.0.2-beta.363 → 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 +12 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +59 -50
- package/dist/index.mjs +59 -50
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -439,6 +439,18 @@ ___
|
|
|
439
439
|
|
|
440
440
|
▸ **FormItem**<`T`\>(`props`): `Element`
|
|
441
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
|
+
|
|
442
454
|
#### Type parameters
|
|
443
455
|
|
|
444
456
|
| Name | Type |
|
package/dist/index.d.ts
CHANGED
|
@@ -163,6 +163,19 @@ declare type FormItemProps<T = any> = {
|
|
|
163
163
|
[type: string]: ExtendFormTypeProps;
|
|
164
164
|
};
|
|
165
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
|
+
*/
|
|
166
179
|
declare function FormItem<T = any>(props: FormItemProps<T>): JSX.Element;
|
|
167
180
|
|
|
168
181
|
declare type FormProps<Values = any, ExtendItemProps = any> = {
|
package/dist/index.js
CHANGED
|
@@ -302,35 +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 }) =>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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
|
+
});
|
|
334
340
|
case "number":
|
|
335
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({
|
|
336
342
|
style: { width: "100%" }
|
|
@@ -344,31 +350,34 @@ function FormItem(props) {
|
|
|
344
350
|
name: computedProps.name,
|
|
345
351
|
rules: computedProps.rules
|
|
346
352
|
}, (fields, { add, remove }, { errors }) => {
|
|
347
|
-
var _a;
|
|
353
|
+
var _a, _b;
|
|
348
354
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, computedProps.label && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
349
355
|
className: "ant-form-item-label"
|
|
350
356
|
}, /* @__PURE__ */ import_react.default.createElement("label", {
|
|
351
357
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
|
|
352
|
-
}, computedProps.label)), fields.map((field) =>
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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(),
|
package/dist/index.mjs
CHANGED
|
@@ -279,35 +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 }) =>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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
|
+
});
|
|
311
317
|
case "number":
|
|
312
318
|
return /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadValues({}, computedProps), computedProps.options ? /* @__PURE__ */ React.createElement(Select, __spreadValues({}, computedProps.input)) : /* @__PURE__ */ React.createElement(InputNumber, __spreadValues({
|
|
313
319
|
style: { width: "100%" }
|
|
@@ -321,31 +327,34 @@ function FormItem(props) {
|
|
|
321
327
|
name: computedProps.name,
|
|
322
328
|
rules: computedProps.rules
|
|
323
329
|
}, (fields, { add, remove }, { errors }) => {
|
|
324
|
-
var _a;
|
|
330
|
+
var _a, _b;
|
|
325
331
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, computedProps.label && /* @__PURE__ */ React.createElement("div", {
|
|
326
332
|
className: "ant-form-item-label"
|
|
327
333
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
328
334
|
className: ((_a = computedProps.rules) == null ? void 0 : _a.find((r) => r.required)) && "ant-form-item-required"
|
|
329
|
-
}, computedProps.label)), fields.map((field) =>
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faasjs/ant-design",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.364",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"lodash": "*",
|
|
29
29
|
"react": "*",
|
|
30
30
|
"react-dom": "*",
|
|
31
|
-
"@faasjs/react": "^0.0.2-beta.
|
|
31
|
+
"@faasjs/react": "^0.0.2-beta.364",
|
|
32
32
|
"react-use": "*",
|
|
33
33
|
"react-router-dom": "*"
|
|
34
34
|
},
|