File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
src/vfjs-global-mixin/methods/vfjs-helpers Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1- import { set , cloneDeep } from 'lodash' ;
1+ import { set , cloneDeep , merge } from 'lodash' ;
22import vfjsFieldComponent from '../../../vfjs-field-component' ;
33
44const vfjsHelpers = {
@@ -257,6 +257,29 @@ const vfjsHelpers = {
257257
258258 return oldErrors . length === 0 ;
259259 } ,
260+ vfjsHelperFieldDynamicProperties ( { dynamicOptions, ...field } ) {
261+ if ( ! dynamicOptions ) {
262+ return null ;
263+ }
264+
265+ if ( Array . isArray ( dynamicOptions ) ) {
266+ return dynamicOptions . reduce ( ( properties , { schema, model, ...dynamicProperties } ) => {
267+ if ( this . vfjsHelperSchemaHasErrors ( schema , model ) ) {
268+ return merge ( properties , dynamicProperties ) ;
269+ }
270+
271+ return properties ;
272+ } ) ;
273+ }
274+
275+ const { schema, model, ...dynamicProperties } = dynamicOptions ;
276+ if ( this . vfjsHelperSchemaHasErrors ( schema , model ) ) {
277+ console . log ( 'dynamicProperties' , dynamicProperties ) ;
278+ return dynamicProperties ;
279+ }
280+
281+ return null ;
282+ } ,
260283 getVfjsFieldsModels ( fields , fieldModels = [ ] ) {
261284 return fields . reduce ( ( models , { children = [ ] , model } ) => {
262285 if ( model ) {
You can’t perform that action at this time.
0 commit comments