22 <table class =" w-100 mb-2" >
33 <colgroup >
44 <col
5- :span =" numInputs "
5+ :span =" numContacts "
66 class =" bg-white"
77 style =" border : 1px solid #dee2e6 "
88 />
99 </colgroup >
1010 <thead >
1111 <tr >
12- <th :colspan =" numInputs " >Eingangsmuster </th >
12+ <th :colspan =" numContacts " >{{ title }} </th >
1313 <th
1414 v-if =" showTestPattern"
1515 rowspan =" 2"
16- class =" input -header"
16+ class =" contact -header"
1717 >
1818 <div >Prüfergebnis</div >
1919 </th >
2020 <th :colspan =" enableAddDelete ? 2 : 1" ></th >
2121 </tr >
2222 <tr >
2323 <th
24- v-for =" key in Object.keys(digitalInputs )"
24+ v-for =" key in Object.keys(contacts )"
2525 :key =" key"
26- class =" input -header"
26+ class =" contact -header"
2727 >
2828 <div >{{ key }}</div >
2929 </th >
30- <th >Verhalten </th >
30+ <th >{{ actionTitle }} </th >
3131 <th v-if =" enableAddDelete" >
3232 <openwb-base-click-button
3333 class =" bg-success text-white"
4646 :key =" patternKey"
4747 >
4848 <td
49- v-for =" deviceInputKey in Object.keys(digitalInputs )"
50- :key =" deviceInputKey "
49+ v-for =" deviceContactKey in Object.keys(contacts )"
50+ :key =" deviceContactKey "
5151 class =" text-center"
5252 >
5353 <font-awesome-icon
54- :title =" getTitle(pattern.input_matrix[deviceInputKey ])"
55- :icon =" getIcon(pattern.input_matrix[deviceInputKey ])"
56- :class =" getIconClass(pattern.input_matrix[deviceInputKey ])"
54+ :title =" getTitle(pattern.matrix[deviceContactKey ])"
55+ :icon =" getIcon(pattern.matrix[deviceContactKey ])"
56+ :class =" getIconClass(pattern.matrix[deviceContactKey ])"
5757 class =" fa-fw clickable"
5858 size =" 2x"
59- :transform =" pattern.input_matrix[deviceInputKey ] == undefined ? 'shrink-6' : null"
60- :mask =" pattern.input_matrix[deviceInputKey ] == undefined ? ['fas', 'square'] : null"
61- @click.stop.prevent =" toggleInput (patternKey, deviceInputKey )"
59+ :transform =" pattern.matrix[deviceContactKey ] == undefined ? 'shrink-6' : null"
60+ :mask =" pattern.matrix[deviceContactKey ] == undefined ? ['fas', 'square'] : null"
61+ @click.stop.prevent =" toggleContact (patternKey, deviceContactKey )"
6262 @mousedown.stop.prevent
6363 @mouseup.stop.prevent
6464 />
9090 </tr >
9191 <tr v-if =" showTestPattern" >
9292 <td
93- v-for =" deviceInputKey in Object.keys(digitalInputs )"
94- :key =" deviceInputKey "
93+ v-for =" deviceContactKey in Object.keys(contacts )"
94+ :key =" deviceContactKey "
9595 class =" pt-4"
9696 >
9797   ;
103103 class =" bg-info"
104104 >
105105 <td
106- v-for =" deviceInputKey in Object.keys(digitalInputs )"
107- :key =" deviceInputKey "
106+ v-for =" deviceContactKey in Object.keys(contacts )"
107+ :key =" deviceContactKey "
108108 class =" text-center text-body"
109109 >
110110 <font-awesome-icon
111- :title =" getTitle(testPattern[deviceInputKey ])"
112- :icon =" getIcon(testPattern[deviceInputKey ])"
113- :class =" getIconClass(testPattern[deviceInputKey ])"
111+ :title =" getTitle(testPattern[deviceContactKey ])"
112+ :icon =" getIcon(testPattern[deviceContactKey ])"
113+ :class =" getIconClass(testPattern[deviceContactKey ])"
114114 class =" fa-fw clickable"
115115 size =" 2x"
116- :transform =" testPattern[deviceInputKey ] == undefined ? 'shrink-6' : null"
117- :mask =" testPattern[deviceInputKey ] == undefined ? ['fas', 'square'] : null"
118- @click.stop.prevent =" toggleTestPattern(deviceInputKey )"
116+ :transform =" testPattern[deviceContactKey ] == undefined ? 'shrink-6' : null"
117+ :mask =" testPattern[deviceContactKey ] == undefined ? ['fas', 'square'] : null"
118+ @click.stop.prevent =" toggleTestPattern(deviceContactKey )"
119119 @mousedown.stop.prevent
120120 @mouseup.stop.prevent
121121 />
130130 </tbody >
131131 </table >
132132 <openwb-base-button-group-input
133+ v-if =" showCheckPattern"
133134 v-model =" showTestPattern"
134135 title =" Prüfmuster"
135136 :buttons =" [
@@ -198,23 +199,26 @@ const states = {
198199};
199200
200201export default {
201- name: " IoActionInputPattern " ,
202+ name: " IoActionContactPattern " ,
202203 components: {
203204 FontAwesomeIcon,
204205 },
205206 inheritAttrs: false ,
206207 props: {
207- digitalInputs : { type: Object , required: true },
208+ contacts : { type: Object , required: true },
208209 modelValue: { type: Array , required: true },
210+ title: { type: String , required: false , default: " Eingangsmuster" },
211+ actionTitle: { type: String , required: false , default: " Verhalten" },
209212 enableAddDelete: { type: Boolean , default: true },
210213 minPatterns: { type: Number , default: 1 },
211214 maxPatterns: { type: Number , default: 10 },
215+ showCheckPattern: { type: Boolean , required: false , default: true },
212216 },
213217 emits: [" update:modelValue" ],
214218 data () {
215219 return {
216220 showTestPattern: false ,
217- testPattern: { ... this .digitalInputs },
221+ testPattern: { ... this .contacts },
218222 };
219223 },
220224 computed: {
@@ -226,8 +230,8 @@ export default {
226230 this .$emit (" update:modelValue" , newValue);
227231 },
228232 },
229- numInputs () {
230- return Object .keys (this .digitalInputs ).length ;
233+ numContacts () {
234+ return Object .keys (this .contacts ).length ;
231235 },
232236 addPatternDisabled () {
233237 return this .value .length >= this .maxPatterns ;
@@ -255,8 +259,8 @@ export default {
255259 },
256260 },
257261 watch: {
258- digitalInputs () {
259- this .testPattern = { ... this .digitalInputs };
262+ contacts () {
263+ this .testPattern = { ... this .contacts };
260264 },
261265 },
262266 mounted () {
@@ -268,40 +272,40 @@ export default {
268272 toggleHelp () {
269273 this .showHelp = ! this .showHelp ;
270274 },
271- getIcon (input ) {
272- return states[input ].icon ;
275+ getIcon (contact ) {
276+ return states[contact ].icon ;
273277 },
274- getIconClass (input ) {
275- return states[input ].iconClass ;
278+ getIconClass (contact ) {
279+ return states[contact ].iconClass ;
276280 },
277- getTitle (input ) {
278- return states[input ].title ;
281+ getTitle (contact ) {
282+ return states[contact ].title ;
279283 },
280- toggleInput (patternKey , deviceInputKey ) {
281- const nextValue = states[this .value [patternKey].input_matrix [deviceInputKey ]].nextValue ;
284+ toggleContact (patternKey , deviceContactKey ) {
285+ const nextValue = states[this .value [patternKey].matrix [deviceContactKey ]].nextValue ;
282286 if (nextValue !== undefined ) {
283- this .value [patternKey].input_matrix [deviceInputKey ] = nextValue;
287+ this .value [patternKey].matrix [deviceContactKey ] = nextValue;
284288 } else {
285- delete this .value [patternKey].input_matrix [deviceInputKey ];
289+ delete this .value [patternKey].matrix [deviceContactKey ];
286290 }
287291 },
288- toggleTestPattern (deviceInputKey ) {
289- this .testPattern [deviceInputKey ] = ! this .testPattern [deviceInputKey ];
292+ toggleTestPattern (deviceContactKey ) {
293+ this .testPattern [deviceContactKey ] = ! this .testPattern [deviceContactKey ];
290294 },
291295 patternMatch (patternKey ) {
292- return Object .keys (this .value [patternKey].input_matrix ).every ((deviceInputKey ) => {
293- if (this .testPattern [deviceInputKey ] === undefined ) {
296+ return Object .keys (this .value [patternKey].matrix ).every ((deviceContactKey ) => {
297+ if (this .testPattern [deviceContactKey ] === undefined ) {
294298 return true ;
295299 }
296- return this .value [patternKey].input_matrix [deviceInputKey ] === this .testPattern [deviceInputKey ];
300+ return this .value [patternKey].matrix [deviceContactKey ] === this .testPattern [deviceContactKey ];
297301 });
298302 },
299303 deletePattern (patternKey ) {
300304 delete this .value .splice (patternKey, 1 );
301305 },
302306 addPattern () {
303307 this .value .push ({
304- input_matrix : {},
308+ matrix : {},
305309 value: null ,
306310 });
307311 },
@@ -315,12 +319,12 @@ th {
315319 vertical-align : bottom ;
316320}
317321
318- .input -header {
322+ .contact -header {
319323 position : relative ;
320324 height : 6em ;
321325}
322326
323- .input -header div {
327+ .contact -header div {
324328 position : absolute ;
325329 bottom : 0 ;
326330 left : 50% ;
0 commit comments