1919 :clearable =" false"
2020 :placeholder =" t('workflowengine', 'Select a comparator')"
2121 @input =" updateCheck" />
22+ <component :is =" currentElement"
23+ v-if =" currentElement"
24+ ref =" checkComponent"
25+ :disabled =" !currentOption"
26+ :operator =" check.operator"
27+ :model-value =" check.value"
28+ class =" option"
29+ @update:model-value =" updateCheck"
30+ @valid =" (valid=true) && validate()"
31+ @invalid =" !(valid=false) && validate()" />
2232 <component :is =" currentOption.component"
23- v-if =" currentOperator && currentComponent"
33+ v-else- if =" currentOperator && currentComponent"
2434 v-model =" check.value"
2535 :disabled =" !currentOption"
2636 :check =" check"
@@ -52,7 +62,6 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
5262import NcSelect from ' @nextcloud/vue/dist/Components/NcSelect.js'
5363
5464import CloseIcon from ' vue-material-design-icons/Close.vue'
55-
5665import ClickOutside from ' vue-click-outside'
5766
5867export default {
@@ -99,6 +108,12 @@ export default {
99108 }
100109 return operators
101110 },
111+ currentElement () {
112+ if (! this .check .class ) {
113+ return false
114+ }
115+ return this .checks [this .check .class ].element
116+ },
102117 currentComponent () {
103118 if (! this .currentOption ) { return [] }
104119 return this .checks [this .currentOption .class ].component
@@ -120,6 +135,15 @@ export default {
120135 this .currentOption = this .checks [this .check .class ]
121136 this .currentOperator = this .operators .find ((operator ) => operator .operator === this .check .operator )
122137
138+ if (this .currentElement ) {
139+ // If we do not set it, the check`s value would remain empty. Unsure why Vue behaves this way.
140+ this .$refs .checkComponent .modelValue = undefined
141+ } else if (this .currentOption ? .component ) {
142+ // keeping this in an else for apps that try to be backwards compatible and may ship both
143+ // to be removed in 03/2028
144+ console .warn (' Developer warning: `CheckPlugin.options` is deprecated. Use `CheckPlugin.element` instead.' )
145+ }
146+
123147 if (this .check .class === null ) {
124148 this .$nextTick (() => this .$refs .checkSelector .$el .focus ())
125149 }
@@ -141,11 +165,15 @@ export default {
141165 this .check .invalid = ! this .valid
142166 this .$emit (' validate' , this .valid )
143167 },
144- updateCheck () {
145- const matchingOperator = this .operators .findIndex ((operator ) => this .check .operator === operator .operator )
168+ updateCheck (event ) {
169+ const selectedOperator = event ? .operator || this .currentOperator ? .operator || this .check .operator
170+ const matchingOperator = this .operators .findIndex ((operator ) => selectedOperator === operator .operator )
146171 if (this .check .class !== this .currentOption .class || matchingOperator === - 1 ) {
147172 this .currentOperator = this .operators [0 ]
148173 }
174+ if (event ? .detail ) {
175+ this .check .value = event .detail [0 ]
176+ }
149177 // eslint-disable-next-line vue/no-mutating-props
150178 this .check .class = this .currentOption .class
151179 // eslint-disable-next-line vue/no-mutating-props
0 commit comments