@ -29,8 +29,13 @@
< div class = "flow-icon icon-confirm" / >
< div class = "action" >
< Operation :operation ="operation" :colored ="false" >
< component :is ="operation.element"
v - if = "operation.element"
ref = "operationComponent"
: model - value = "inputValue"
@ update : model - value = "updateOperationByEvent" / >
< component :is ="operation.options"
v - if = "operation.options"
v - else- if= "operation.options"
v - model = "rule.operation"
@ input = "updateOperation" / >
< / Operation >
@ -95,9 +100,14 @@ export default {
error : null ,
dirty : this . rule . id < 0 ,
originalRule : null ,
element : null ,
inputValue : '' ,
}
} ,
computed : {
/ * *
* @ return { OperatorPlugin }
* /
operation ( ) {
return this . $store . getters . getOperationForRule ( this . rule )
} ,
@ -123,11 +133,24 @@ export default {
} ,
mounted ( ) {
this . originalRule = JSON . parse ( JSON . stringify ( this . rule ) )
if ( this . operation ? . element ) {
this . $refs . operationComponent . value = this . rule . operation
} else if ( this . operation ? . options ) {
/ / k e e p i n g t h i s i n a n e l s e f o r a p p s t h a t t r y t o b e b a c k w a r d s c o m p a t i b l e a n d m a y s h i p b o t h
/ / t o b e r e m o v e d i n 0 3 / 2 0 2 8
console . warn ( 'Developer warning: `OperatorPlugin.options` is deprecated. Use `OperatorPlugin.element` instead.' )
}
} ,
methods : {
async updateOperation ( operation ) {
this . $set ( this . rule , 'operation' , operation )
await this . updateRule ( )
this . updateRule ( )
} ,
async updateOperationByEvent ( event ) {
this . inputValue = event . detail [ 0 ]
this . $set ( this . rule , 'operation' , event . detail [ 0 ] )
this . updateRule ( )
} ,
validate ( /* state */ ) {
this . error = null
@ -164,6 +187,7 @@ export default {
if ( this . rule . id < 0 ) {
this . $store . dispatch ( 'removeRule' , this . rule )
} else {
this . inputValue = this . originalRule . operation
this . $store . dispatch ( 'updateRule' , this . originalRule )
this . originalRule = JSON . parse ( JSON . stringify ( this . rule ) )
this . dirty = false