@faasjs/ant-design 0.0.2-beta.329 → 0.0.2-beta.333

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
@@ -37,4 +37,4 @@ Form are based on [Ant Design's Form component](https://ant.design/components/fo
37
37
 
38
38
  Form are based on [Ant Design's Form.Item component](https://ant.design/components/form/#Form.Item).
39
39
 
40
- <iframe src="https://codesandbox.io/s/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>
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>
package/dist/index.d.ts CHANGED
@@ -15,15 +15,25 @@ declare type FaasItemProps = {
15
15
  };
16
16
 
17
17
  declare type StringProps = {
18
- type?: 'string' | 'string[]';
18
+ type?: 'string';
19
19
  input?: InputProps;
20
20
  };
21
+ declare type StringListProps = {
22
+ type: 'string[]';
23
+ input?: InputProps;
24
+ maxCount?: number;
25
+ };
21
26
  declare type NumberProps = {
22
- type?: 'number' | 'number[]';
27
+ type: 'number';
28
+ input?: InputNumberProps;
29
+ };
30
+ declare type NumberListProps = {
31
+ type: 'number[]';
23
32
  input?: InputNumberProps;
33
+ maxCount?: number;
24
34
  };
25
35
  declare type BooleanProps = {
26
- type?: 'boolean';
36
+ type: 'boolean';
27
37
  input?: SwitchProps;
28
38
  };
29
39
  declare type OptionType<T = any> = {
@@ -37,7 +47,7 @@ declare type OptionsProps<T = any> = {
37
47
  type?: 'string' | 'string[]' | 'number' | 'number[]';
38
48
  input?: SelectProps<any>;
39
49
  };
40
- declare type FormItemInputProps<T = any> = StringProps | NumberProps | BooleanProps | OptionsProps<T>;
50
+ declare type FormItemInputProps<T = any> = StringProps | StringListProps | NumberProps | NumberListProps | BooleanProps | OptionsProps<T>;
41
51
  declare type FormItemProps<T = any> = {
42
52
  children?: JSX.Element;
43
53
  rules?: RuleObject[];
package/dist/index.js CHANGED
@@ -135,20 +135,20 @@ function FormItem(props) {
135
135
  }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, {
136
136
  key: field.key
137
137
  }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, {
138
- gutter: 16
138
+ gutter: 24
139
139
  }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, {
140
140
  span: 23
141
141
  }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, __spreadProps(__spreadValues({}, field), {
142
142
  noStyle: true
143
143
  }), /* @__PURE__ */ import_react.default.createElement(import_antd.Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, {
144
144
  span: 1
145
- }, !computedProps.rules.find((r) => r.required) && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
145
+ }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
146
146
  danger: true,
147
147
  type: "link",
148
148
  style: { float: "right" },
149
149
  icon: /* @__PURE__ */ import_react.default.createElement(import_icons.MinusCircleOutlined, null),
150
150
  onClick: () => remove(field.name)
151
- }))))), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
151
+ }))))), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
152
152
  type: "dashed",
153
153
  block: true,
154
154
  onClick: () => add(),
@@ -177,7 +177,7 @@ function FormItem(props) {
177
177
  }, computedProps.label)), fields.map((field) => /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, {
178
178
  key: field.key
179
179
  }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, {
180
- gutter: 16
180
+ gutter: 24
181
181
  }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, {
182
182
  span: 23
183
183
  }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, __spreadProps(__spreadValues({}, field), {
@@ -186,13 +186,13 @@ function FormItem(props) {
186
186
  style: { width: "100%" }
187
187
  }, computedProps.input)))), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, {
188
188
  span: 1
189
- }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
189
+ }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
190
190
  danger: true,
191
191
  type: "link",
192
192
  style: { float: "right" },
193
193
  icon: /* @__PURE__ */ import_react.default.createElement(import_icons.MinusCircleOutlined, null),
194
194
  onClick: () => remove(field.name)
195
- }))))), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, null, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
195
+ }))))), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, {
196
196
  type: "dashed",
197
197
  block: true,
198
198
  onClick: () => add(),
@@ -213,7 +213,7 @@ var Form = function(props) {
213
213
  var _a;
214
214
  return /* @__PURE__ */ import_react.default.createElement(import_antd2.Form, __spreadValues({}, props), (_a = props.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ import_react.default.createElement(FormItem, __spreadValues({
215
215
  key: item.id
216
- }, item))), /* @__PURE__ */ import_react.default.createElement(import_antd2.Button, {
216
+ }, item))), props.children, /* @__PURE__ */ import_react.default.createElement(import_antd2.Button, {
217
217
  htmlType: "submit",
218
218
  type: "primary"
219
219
  }, "Submit"));
package/dist/index.mjs CHANGED
@@ -118,20 +118,20 @@ function FormItem(props) {
118
118
  }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
119
119
  key: field.key
120
120
  }, /* @__PURE__ */ React.createElement(Row, {
121
- gutter: 16
121
+ gutter: 24
122
122
  }, /* @__PURE__ */ React.createElement(Col, {
123
123
  span: 23
124
124
  }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
125
125
  noStyle: true
126
126
  }), /* @__PURE__ */ React.createElement(Input, __spreadValues({}, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
127
127
  span: 1
128
- }, !computedProps.rules.find((r) => r.required) && /* @__PURE__ */ React.createElement(Button, {
128
+ }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
129
129
  danger: true,
130
130
  type: "link",
131
131
  style: { float: "right" },
132
132
  icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
133
133
  onClick: () => remove(field.name)
134
- }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, /* @__PURE__ */ React.createElement(Button, {
134
+ }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
135
135
  type: "dashed",
136
136
  block: true,
137
137
  onClick: () => add(),
@@ -160,7 +160,7 @@ function FormItem(props) {
160
160
  }, computedProps.label)), fields.map((field) => /* @__PURE__ */ React.createElement(AntdForm.Item, {
161
161
  key: field.key
162
162
  }, /* @__PURE__ */ React.createElement(Row, {
163
- gutter: 16
163
+ gutter: 24
164
164
  }, /* @__PURE__ */ React.createElement(Col, {
165
165
  span: 23
166
166
  }, /* @__PURE__ */ React.createElement(AntdForm.Item, __spreadProps(__spreadValues({}, field), {
@@ -169,13 +169,13 @@ function FormItem(props) {
169
169
  style: { width: "100%" }
170
170
  }, computedProps.input)))), /* @__PURE__ */ React.createElement(Col, {
171
171
  span: 1
172
- }, /* @__PURE__ */ React.createElement(Button, {
172
+ }, (!computedProps.rules.find((r) => r.required) || field.key > 0) && /* @__PURE__ */ React.createElement(Button, {
173
173
  danger: true,
174
174
  type: "link",
175
175
  style: { float: "right" },
176
176
  icon: /* @__PURE__ */ React.createElement(MinusCircleOutlined, null),
177
177
  onClick: () => remove(field.name)
178
- }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, /* @__PURE__ */ React.createElement(Button, {
178
+ }))))), /* @__PURE__ */ React.createElement(AntdForm.Item, null, (!computedProps.maxCount || computedProps.maxCount > fields.length) && /* @__PURE__ */ React.createElement(Button, {
179
179
  type: "dashed",
180
180
  block: true,
181
181
  onClick: () => add(),
@@ -196,7 +196,7 @@ var Form = function(props) {
196
196
  var _a;
197
197
  return /* @__PURE__ */ React.createElement(AntdForm2, __spreadValues({}, props), (_a = props.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ React.createElement(FormItem, __spreadValues({
198
198
  key: item.id
199
- }, item))), /* @__PURE__ */ React.createElement(Button2, {
199
+ }, item))), props.children, /* @__PURE__ */ React.createElement(Button2, {
200
200
  htmlType: "submit",
201
201
  type: "primary"
202
202
  }, "Submit"));
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@faasjs/ant-design",
3
- "version": "0.0.2-beta.329",
3
+ "version": "0.0.2-beta.333",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "module": "dist/index.mjs",
8
7
  "homepage": "https://faasjs.com/doc/ant-design.html",
9
8
  "repository": {
10
9
  "type": "git",