Skip to content

Commit 6050ac7

Browse files
committed
Implement dynamicProperties
1 parent 9b7d4f4 commit 6050ac7

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/vfjs-global-mixin/methods/vfjs-ui/getters.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { get } from 'lodash';
1+
import { get, merge } from 'lodash';
22

33
const vfjsUiGetters = {
44
getVfjsFields(fields = []) {
@@ -61,23 +61,24 @@ const vfjsUiGetters = {
6161
.map((v, i) => this.vfjsHelperChildArrayReducerMapper(model, children, i))
6262
.map(this.getVfjsUiFieldsActive);
6363
},
64-
getVfjsUiField({ children = [], model, ...field }) {
65-
if (this.getVfjsUiFieldVisible({ ...field, model })) {
66-
const isArray = this.vfjsHelperFieldIsArray(model);
67-
const required = this.vfjsHelperFieldIsRequired(model);
64+
getVfjsUiField(field) {
65+
if (this.getVfjsUiFieldVisible(field)) {
66+
const isArray = this.vfjsHelperFieldIsArray(field.model);
67+
const required = this.vfjsHelperFieldIsRequired(field.model);
68+
69+
const dynamicProperties = this.vfjsHelperFieldDynamicProperties(field);
70+
const { children = [], ...fieldProperties } = merge({}, field, dynamicProperties);
6871

6972
if (isArray) {
7073
return {
71-
...field,
72-
model,
74+
...fieldProperties,
7375
required,
74-
children: this.getVfjsUiFieldArrayChildrenActive(model, children),
76+
children: this.getVfjsUiFieldArrayChildrenActive(field.model, children),
7577
};
7678
}
7779

7880
return {
79-
...field,
80-
model,
81+
...fieldProperties,
8182
required,
8283
children: this.getVfjsUiFieldsActive(children),
8384
};

0 commit comments

Comments
 (0)