@@ -165,6 +165,22 @@ let MyBuilderFormStateCondition = {
165
165
isFirst : { type :Boolean , required :true } ,
166
166
modelValue : { type :Object , required :true }
167
167
} ,
168
+ watch :{
169
+ condition :{
170
+ handler :function ( c ) {
171
+ // set main mode
172
+ if ( c . newRecord !== null ) this . mode = 'record' ;
173
+ else if ( c . roleId !== null ) this . mode = 'role' ;
174
+ else if ( c . fieldId0 !== null ) this . mode = 'field' ;
175
+
176
+ // set field comparisson mode
177
+ if ( c . presetId1 !== null ) this . mode2Field = 'preset' ;
178
+ else if ( c . value1 !== null ) this . mode2Field = 'fixed' ;
179
+ else this . mode2Field = 'field' ;
180
+ } ,
181
+ immediate :true
182
+ }
183
+ } ,
168
184
emits :[ 'remove' , 'update:modelValue' ] ,
169
185
data :function ( ) {
170
186
return {
@@ -205,19 +221,6 @@ let MyBuilderFormStateCondition = {
205
221
attributeIdMap :function ( ) { return this . $store . getters [ 'schema/attributeIdMap' ] ; } ,
206
222
capApp : function ( ) { return this . $store . getters . captions . builder . form . states ; }
207
223
} ,
208
- mounted :function ( ) {
209
- let c = this . condition ;
210
-
211
- // set main mode
212
- if ( c . newRecord !== null ) this . mode = 'record' ;
213
- else if ( c . roleId !== null ) this . mode = 'role' ;
214
- else if ( c . fieldId0 !== null ) this . mode = 'field' ;
215
-
216
- // set field comparisson mode
217
- if ( c . presetId1 !== null ) this . mode2Field = 'preset' ;
218
- else if ( c . value1 !== null ) this . mode2Field = 'fixed' ;
219
- else this . mode2Field = 'field' ;
220
- } ,
221
224
methods :{
222
225
changeMode :function ( value ) {
223
226
this . mode = value ;
0 commit comments