File tree 1 file changed +24
-0
lines changed
src/components/components
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,30 @@ export default class Component extends React.Component {
94
94
95
95
return Object . keys ( componentData . schema )
96
96
. sort ( )
97
+ . filter ( ( propertyName ) => {
98
+ if ( ! componentData . schema [ propertyName ] . if ) {
99
+ return true ;
100
+ }
101
+ let showProperty = true ;
102
+ for ( const [ conditionKey , conditionValue ] of Object . entries (
103
+ componentData . schema [ propertyName ] . if
104
+ ) ) {
105
+ if ( Array . isArray ( conditionValue ) ) {
106
+ if (
107
+ conditionValue . indexOf ( componentData . data [ conditionKey ] ) === - 1
108
+ ) {
109
+ showProperty = false ;
110
+ break ;
111
+ }
112
+ } else {
113
+ if ( conditionValue !== componentData . data [ conditionKey ] ) {
114
+ showProperty = false ;
115
+ break ;
116
+ }
117
+ }
118
+ }
119
+ return showProperty ;
120
+ } )
97
121
. map ( ( propertyName ) => (
98
122
< PropertyRow
99
123
key = { propertyName }
You can’t perform that action at this time.
0 commit comments