Skip to content

Commit b8c6098

Browse files
authored
Fixes (#857)
* implement disabled state for button group component * collapse fixed tariff time slots * typos * add missing id to base components * adopt tests to element changes
1 parent 280fdda commit b8c6098

22 files changed

+74
-17
lines changed

src/components/OpenwbBaseArrayInput.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
</div>
2626
</div>
2727
<input
28+
:id="`${uid}-tag-input`"
2829
ref="tagInput"
2930
v-model="newTag"
3031
type="text"
@@ -76,6 +77,7 @@
7677

7778
<script>
7879
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
80+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
7981
8082
import { library } from "@fortawesome/fontawesome-svg-core";
8183
import {
@@ -94,6 +96,7 @@ export default {
9496
FontAwesomeIcon,
9597
OpenwbBaseSettingElement,
9698
},
99+
mixins: [BaseSettingComponents],
97100
inheritAttrs: false,
98101
props: {
99102
title: { type: String, required: true, default: "#TITLE#" },
@@ -120,7 +123,6 @@ export default {
120123
data() {
121124
return {
122125
newTag: "",
123-
showHelp: false,
124126
};
125127
},
126128
computed: {

src/components/OpenwbBaseButtonGroupInput.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,22 @@
1717
v-for="button in buttons"
1818
:key="button.value"
1919
class="btn btn-same-size btn-centered"
20-
:class="[value == button.buttonValue ? 'active' : '', button.class ? button.class : 'btn-outline-info']"
20+
:disabled="disabled"
21+
:class="[
22+
{ active: value == button.buttonValue },
23+
{ disabled: disabled },
24+
button.class ? button.class : 'btn-outline-info',
25+
]"
26+
:for="`${uid}-${button.buttonValue}`"
2127
>
2228
<span>
2329
<input
30+
:id="`${uid}-${button.buttonValue}`"
2431
v-model="value"
2532
type="radio"
2633
:value="button.buttonValue"
2734
v-bind="$attrs"
35+
:disabled="disabled"
2836
@click="$emit('button-click', button.buttonValue)"
2937
/>
3038
<slot :name="'label-' + button.buttonValue">
@@ -44,6 +52,7 @@
4452

4553
<script>
4654
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
55+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
4756
4857
import { library } from "@fortawesome/fontawesome-svg-core";
4958
import { faCheck as fasCheck } from "@fortawesome/free-solid-svg-icons";
@@ -57,11 +66,13 @@ export default {
5766
FontAwesomeIcon,
5867
OpenwbBaseSettingElement,
5968
},
69+
mixins: [BaseSettingComponents],
6070
inheritAttrs: false,
6171
props: {
6272
title: { type: String, required: false, default: "" },
6373
modelValue: { type: [String, Number, Boolean], default: undefined },
6474
buttons: { type: Array, required: true },
75+
disabled: { type: Boolean, required: false, default: false },
6576
},
6677
emits: ["update:modelValue", "button-click"],
6778
computed: {

src/components/OpenwbBaseCheckboxInput.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<template #default>
1515
<div class="col-md-8">
1616
<input
17+
:id="`${uid}-checkbox-input`"
1718
v-model="value"
1819
class="form-control"
1920
type="checkbox"
@@ -26,12 +27,14 @@
2627

2728
<script>
2829
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
30+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
2931
3032
export default {
3133
name: "OpenwbCheckboxInput",
3234
components: {
3335
OpenwbBaseSettingElement,
3436
},
37+
mixins: [BaseSettingComponents],
3538
inheritAttrs: false,
3639
props: {
3740
title: { type: String, required: false, default: "" },

src/components/OpenwbBaseColorPicker.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div class="wrapper">
33
<input
4+
:id="`${uid}-color-input`"
45
type="color"
56
class="custom-color-picker"
67
:value="modelValue"
@@ -18,6 +19,8 @@
1819
</template>
1920

2021
<script>
22+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
23+
2124
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
2225
import { library } from "@fortawesome/fontawesome-svg-core";
2326
import { faRotateLeft as fasRotateLeft } from "@fortawesome/free-solid-svg-icons";
@@ -28,6 +31,7 @@ export default {
2831
components: {
2932
FontAwesomeIcon,
3033
},
34+
mixins: [BaseSettingComponents],
3135
props: {
3236
defaultColor: {
3337
type: String,

src/components/OpenwbBaseNumberInput.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
</div>
2020
</div>
2121
<input
22+
:id="`${uid}-number-input`"
2223
v-model.number="value"
2324
type="number"
2425
class="form-control"
@@ -47,6 +48,7 @@
4748

4849
<script>
4950
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
51+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
5052
5153
import { library } from "@fortawesome/fontawesome-svg-core";
5254
import { faCalculator as fasCalculator } from "@fortawesome/free-solid-svg-icons";
@@ -60,6 +62,7 @@ export default {
6062
FontAwesomeIcon,
6163
OpenwbBaseSettingElement,
6264
},
65+
mixins: [BaseSettingComponents],
6366
inheritAttrs: false,
6467
props: {
6568
title: { type: String, required: false, default: "" },

src/components/OpenwbBaseRangeInput.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
<label
1818
v-if="label"
1919
class="col-2 pl-0 col-form-label valueLabel"
20+
:for="`${uid}-button`"
2021
>
2122
{{ label }}
2223
</label>
2324
<button
25+
:id="`${uid}-button`"
2426
class="col-1 btn btn-block btn-info"
2527
type="button"
2628
@click="decrement"
@@ -53,6 +55,7 @@
5355

5456
<script>
5557
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
58+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
5659
5760
import { library } from "@fortawesome/fontawesome-svg-core";
5861
import { faStepForward as fasStepForward, faStepBackward as fasStepBackward } from "@fortawesome/free-solid-svg-icons";
@@ -66,6 +69,7 @@ export default {
6669
FontAwesomeIcon,
6770
OpenwbBaseSettingElement,
6871
},
72+
mixins: [BaseSettingComponents],
6973
inheritAttrs: false,
7074
props: {
7175
title: { type: String, required: false, default: "" },

src/components/OpenwbBaseSelectInput.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
</div>
2727
</div>
2828
<select
29+
:id="`${uid}-select`"
2930
v-model="value"
3031
class="col form-control"
3132
v-bind="$attrs"
@@ -82,6 +83,7 @@
8283

8384
<script>
8485
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
86+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
8587
8688
import { library } from "@fortawesome/fontawesome-svg-core";
8789
import { faPlus as fasPlus } from "@fortawesome/free-solid-svg-icons";
@@ -95,6 +97,7 @@ export default {
9597
FontAwesomeIcon,
9698
OpenwbBaseSettingElement,
9799
},
100+
mixins: [BaseSettingComponents],
98101
inheritAttrs: false,
99102
props: {
100103
title: { type: String, required: false, default: undefined },

src/components/OpenwbBaseSettingElement.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class="form-row"
44
:class="$slots.title ? 'mb-1' : 'mx-0'"
55
>
6-
<label
6+
<div
77
v-if="$slots.title"
88
class="col-md-4 col-form-label"
99
>
@@ -15,7 +15,7 @@
1515
:class="showHelp ? 'text-info' : ''"
1616
@click.stop="toggleHelp"
1717
/>
18-
</label>
18+
</div>
1919
<div :class="$slots.title ? 'col-md-8' : 'col px-0'">
2020
<div :class="{ 'form-row': $slots.title }">
2121
<slot>*ELEMENT MISSING*</slot>

src/components/OpenwbBaseTextInput.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
</div>
5757
<input
5858
v-if="['text', 'user'].includes(subtype)"
59+
:id="`${uid}-text-input`"
5960
ref="textInput"
6061
v-model="value"
6162
type="text"
@@ -66,6 +67,7 @@
6667
/>
6768
<input
6869
v-if="subtype == 'json'"
70+
:id="`${uid}-json-input`"
6971
ref="jsonInput"
7072
v-model="value"
7173
type="text"
@@ -75,6 +77,7 @@
7577
/>
7678
<input
7779
v-if="subtype == 'password'"
80+
:id="`${uid}-password-input`"
7881
ref="passwordInput"
7982
v-model="value"
8083
:type="showPassword ? 'text' : 'password'"
@@ -84,6 +87,7 @@
8487
/>
8588
<input
8689
v-if="subtype == 'host'"
90+
:id="`${uid}-host-input`"
8791
ref="hostInput"
8892
v-model="value"
8993
type="text"
@@ -93,6 +97,7 @@
9397
/>
9498
<input
9599
v-if="['email', 'url'].includes(subtype)"
100+
:id="`${uid}-url-input`"
96101
v-model="value"
97102
refs="urlInput"
98103
:type="subtype"
@@ -101,6 +106,7 @@
101106
/>
102107
<input
103108
v-if="subtype == 'time'"
109+
:id="`${uid}-time-input`"
104110
ref="timeInput"
105111
v-model="value"
106112
type="time"
@@ -109,6 +115,7 @@
109115
/>
110116
<input
111117
v-if="subtype == 'date'"
118+
:id="`${uid}-date-input`"
112119
ref="dateInput"
113120
v-model="value"
114121
type="date"
@@ -117,6 +124,7 @@
117124
/>
118125
<input
119126
v-if="subtype == 'month'"
127+
:id="`${uid}-month-input`"
120128
ref="monthInput"
121129
v-model="value"
122130
type="month"
@@ -125,6 +133,7 @@
125133
/>
126134
<input
127135
v-if="subtype == 'year'"
136+
:id="`${uid}-year-input`"
128137
ref="yearInput"
129138
v-model="value"
130139
type="number"
@@ -178,6 +187,7 @@
178187

179188
<script>
180189
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
190+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
181191
182192
import { library } from "@fortawesome/fontawesome-svg-core";
183193
import {
@@ -216,6 +226,7 @@ export default {
216226
FontAwesomeIcon,
217227
OpenwbBaseSettingElement,
218228
},
229+
mixins: [BaseSettingComponents],
219230
inheritAttrs: false,
220231
props: {
221232
title: { type: String, required: false, default: "" },

src/components/OpenwbBaseTextarea.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
</div>
2929
<textarea
3030
v-if="subtype === 'json'"
31+
:id="`${uid}-textarea`"
3132
ref="jsonInput"
3233
v-model.lazy="value"
3334
class="form-control"
3435
v-bind="$attrs"
3536
/>
3637
<textarea
3738
v-else
39+
:id="`${uid}-textarea`"
3840
v-model="value"
3941
class="form-control"
4042
v-bind="$attrs"
@@ -55,6 +57,7 @@
5557

5658
<script>
5759
import OpenwbBaseSettingElement from "./OpenwbBaseSettingElement.vue";
60+
import BaseSettingComponents from "./mixins/BaseSettingComponents.vue";
5861
5962
import { library } from "@fortawesome/fontawesome-svg-core";
6063
import { faKeyboard as fasKeyboard, faCode as fasCode } from "@fortawesome/free-solid-svg-icons";
@@ -68,6 +71,7 @@ export default {
6871
OpenwbBaseSettingElement,
6972
FontAwesomeIcon,
7073
},
74+
mixins: [BaseSettingComponents],
7175
inheritAttrs: false,
7276
props: {
7377
title: { type: String, required: false, default: "" },

0 commit comments

Comments
 (0)