Skip to content

Commit fd9da0c

Browse files
committed
[2.5.7] Every unrecognized props applied to ArrayField passed to renderField as extra prop
1 parent 9668229 commit fd9da0c

File tree

7 files changed

+41
-8
lines changed

7 files changed

+41
-8
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 2.5.7
2+
3+
### Added
4+
5+
- Every unrecognized props applied to `ArrayField` passed to `renderField` as `extra` prop
6+
7+
### Fixed
8+
9+
- `ArrayField` now also supports `FormItem` Props
10+
- If you want to pass an empty label to a Control due to `element-ui` limitations — now you can. It won't be a `name` prop anymore.
11+
- But if you will pass a `label` that means `label={true}` you will get a label `startCase(name)`
12+
113
## 2.5.6
214

315
### Removed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ See demo at [https://detools.github.io/vue-form](https://detools.github.io/vue-f
7979

8080
## Changelog
8181

82+
- [2.5.7](/CHANGELOG.md#257)
8283
- [2.5.6](/CHANGELOG.md#256)
8384
- [2.5.5](/CHANGELOG.md#255)
8485
- [2.5.4](/CHANGELOG.md#254)

VueForm/components/ConnectedArrayField.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ export default {
2222
type: [Function, Object],
2323
required: true,
2424
},
25+
26+
/* FormItem Props */
27+
formItem: Boolean,
28+
label: String,
29+
labelWidth: String,
2530
},
2631

2732
mixins: [ConnectedArrayFieldMixin],
@@ -171,7 +176,12 @@ export default {
171176
},
172177

173178
renderComponent(value, setValue, createElement) {
174-
const props = { data: value, fields: this.fields, name: this.name }
179+
const props = {
180+
data: value,
181+
fields: this.fields,
182+
name: this.name,
183+
extra: this.$attrs,
184+
}
175185

176186
if (isFunction(this.renderField)) {
177187
return this.renderField(props)

VueForm/mixins/ConnectedControl.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import isNil from 'lodash/isNil'
22
import castArray from 'lodash/castArray'
3+
import isBoolean from 'lodash/isBoolean'
4+
import startCase from 'lodash/startCase'
35
import resolveRegisterFormComponent from '../utils/resolveRegisterFormComponent'
46
import FormItem from '../components/ConnectedFormItem'
57

@@ -36,7 +38,15 @@ const ConnectedControlMixin = {
3638

3739
render(createElement) {
3840
const [value, setValue, error] = this.state
39-
const label = this.omitFormItemLabel ? undefined : this.label || this.name
41+
let { label } = this
42+
43+
if (isBoolean(this.label)) {
44+
label = this.label ? startCase(this.name) : undefined
45+
}
46+
47+
if (this.omitFormItemLabel) {
48+
label = undefined
49+
}
4050

4151
if (this.formItem) {
4252
return (

docs/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/vendors~main.bundle.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@detools/vue-form",
3-
"version": "2.5.6",
3+
"version": "2.5.7",
44
"description": "Form State Management for VueJS",
55
"main": "VueForm/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)