@worksafevictoria/wcl7.5 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/assets/styles/generated-icons.scss +46 -46
- package/src/components/Common/CardGridItem/card-grid-item-caret.vue +40 -46
- package/src/components/Common/CardGridItem/card-grid-item-icon.vue +1 -1
- package/src/components/Common/CardGridItem/index.vue +153 -115
- package/src/components/Containers/Carousel/index.stories.js +6 -4
- package/src/components/Containers/Carousel/index.vue +131 -120
- package/src/components/Containers/HomepageHeader/index.stories.js +1 -1
- package/src/components/Containers/HomepageHeaderNew/index.stories.js +3 -15
- package/src/components/Containers/HomepageHeaderNew/index.vue +3 -7
- package/src/components/Global/AppFooter/index.vue +29 -19
- package/src/components/Global/AppHeader/ModalSearch/index.vue +7 -1
- package/src/components/Global/AppHeader/index.stories.js +2 -2
- package/src/components/Global/AppHeaderNew/ModalSearch/index.vue +21 -17
- package/src/components/Global/AppHeaderNew/includes.scss +4 -2
- package/src/components/Global/AppHeaderNew/index.stories.js +2 -2
- package/src/components/Global/AppHeaderNew/index.vue +126 -386
- package/src/components/Global/AppHeaderNew/mobile.scss +41 -6
- package/src/components/Global/AppHeaderNew/styles.scss +57 -45
- package/src/components/Global/BackToTop/index.vue +16 -16
- package/src/components/Global/ContrastMode/index.stories.js +1 -1
- package/src/components/Global/DirectoryFilters/index.vue +24 -18
- package/src/components/Global/HeroHeader/index.vue +62 -73
- package/src/components/Global/SocialShare/index.vue +114 -129
- package/src/components/Global/Strip/index.vue +43 -39
- package/src/components/Paragraphs/Accordion/AccordionItem/index.vue +22 -24
- package/src/components/Paragraphs/Accordion/StepperItem/index.vue +15 -15
- package/src/components/Paragraphs/Calculator/CardContainer/index.vue +74 -75
- package/src/components/Paragraphs/Calculator/RiskLevel/index.vue +31 -39
- package/src/components/Paragraphs/Directory/Asbestos/Records/SingleRecord/index.vue +104 -107
- package/src/components/Paragraphs/Directory/Asbestos/Records/index.vue +129 -64
- package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/index.vue +127 -133
- package/src/components/Paragraphs/Directory/HSCP/Records/index.vue +112 -66
- package/src/components/Paragraphs/Statistics/index.vue +9 -9
- package/src/components/Paragraphs/Tabs/index.vue +4 -4
- package/src/components/Paragraphs/TabulatedData/index.vue +27 -20
- package/src/components/SubComponents/CtaButton/index.vue +47 -44
- package/src/components/SubComponents/Icon/README.md +2 -2
- package/src/components/SubComponents/Icon/example.js +1 -0
- package/src/components/SubComponents/Icon/index.stories.js +1 -1
- package/src/components/SubComponents/Icon/index.vue +47 -47
- package/src/components/SubComponents/ResourceGroup/cardbody.vue +18 -16
- package/src/components/SubComponents/VideoThumbnail/index.vue +8 -6
- package/src/mock/carousel-items.js +46 -81
|
@@ -12,14 +12,18 @@
|
|
|
12
12
|
<div
|
|
13
13
|
:role="mini ? 'link' : null"
|
|
14
14
|
:class="type + '-strip__inner-wrap'"
|
|
15
|
-
:tabindex="mini ? 0 :
|
|
15
|
+
:tabindex="mini ? 0 : -1"
|
|
16
16
|
:style="mini ? 'cursor: pointer;' : false"
|
|
17
17
|
@click="mini ? handleClick() : false"
|
|
18
18
|
@keypress.enter="mini ? handleClick() : false"
|
|
19
19
|
>
|
|
20
20
|
<div :class="`${type}-strip__icon`">
|
|
21
|
-
<img
|
|
22
|
-
|
|
21
|
+
<img
|
|
22
|
+
v-if="type === 'alert'"
|
|
23
|
+
:src="exclamationIcon"
|
|
24
|
+
alt="alert exclamation icon"
|
|
25
|
+
/>
|
|
26
|
+
<img v-else :src="infoIcon" alt="alert information icon" />
|
|
23
27
|
</div>
|
|
24
28
|
<div
|
|
25
29
|
:class="{
|
|
@@ -28,7 +32,7 @@
|
|
|
28
32
|
[`${type}-strip__content--right`]: rtl,
|
|
29
33
|
}"
|
|
30
34
|
>
|
|
31
|
-
<
|
|
35
|
+
<h2
|
|
32
36
|
:class="{
|
|
33
37
|
[`${type}-strip__heading`]: true,
|
|
34
38
|
[`${type}-strip__heading--left`]: !rtl,
|
|
@@ -36,14 +40,14 @@
|
|
|
36
40
|
}"
|
|
37
41
|
>
|
|
38
42
|
{{ stripTitle }}
|
|
39
|
-
</
|
|
43
|
+
</h2>
|
|
40
44
|
<rich-text :content="stripContent" :without-container="true" />
|
|
41
45
|
</div>
|
|
42
46
|
<img
|
|
43
47
|
v-if="mini"
|
|
44
48
|
height="16"
|
|
45
49
|
class="alert-strip__icon--caret"
|
|
46
|
-
alt=""
|
|
50
|
+
alt="alert icon"
|
|
47
51
|
:src="chevronIcon"
|
|
48
52
|
/>
|
|
49
53
|
</div>
|
|
@@ -55,16 +59,16 @@
|
|
|
55
59
|
</template>
|
|
56
60
|
|
|
57
61
|
<script>
|
|
58
|
-
import exclamationIcon from
|
|
59
|
-
import arrowIcon from
|
|
60
|
-
import dismissIcon from
|
|
61
|
-
import infoIcon from
|
|
62
|
-
import chevronIcon from
|
|
63
|
-
import RichText from
|
|
64
|
-
import { BAlert } from
|
|
62
|
+
import exclamationIcon from '../../../assets/icons/Strip/Exclamation triangle fill.svg?url'
|
|
63
|
+
import arrowIcon from '../../../assets/icons/Strip/Arrow right.svg?url'
|
|
64
|
+
import dismissIcon from '../../../assets/icons/Strip/Dismiss.svg?url'
|
|
65
|
+
import infoIcon from '../../../assets/icons/Strip/Info circle fill.svg?url'
|
|
66
|
+
import chevronIcon from '../../../assets/icons/caret-right.svg?url'
|
|
67
|
+
import RichText from '../../Paragraphs/RichText/index.vue'
|
|
68
|
+
import { BAlert } from 'bootstrap-vue-next'
|
|
65
69
|
|
|
66
70
|
export default {
|
|
67
|
-
name:
|
|
71
|
+
name: 'Strip',
|
|
68
72
|
components: {
|
|
69
73
|
RichText,
|
|
70
74
|
BAlert,
|
|
@@ -76,15 +80,15 @@ export default {
|
|
|
76
80
|
},
|
|
77
81
|
stripHeading: {
|
|
78
82
|
type: String,
|
|
79
|
-
default:
|
|
83
|
+
default: '',
|
|
80
84
|
},
|
|
81
85
|
stripContent: {
|
|
82
86
|
type: String,
|
|
83
|
-
default:
|
|
87
|
+
default: '',
|
|
84
88
|
},
|
|
85
89
|
url: {
|
|
86
90
|
type: String,
|
|
87
|
-
default:
|
|
91
|
+
default: '#',
|
|
88
92
|
},
|
|
89
93
|
type: {
|
|
90
94
|
type: String,
|
|
@@ -99,7 +103,7 @@ export default {
|
|
|
99
103
|
default: false,
|
|
100
104
|
},
|
|
101
105
|
},
|
|
102
|
-
emits: [
|
|
106
|
+
emits: ['update:modelValue', 'dismissed'],
|
|
103
107
|
data() {
|
|
104
108
|
return {
|
|
105
109
|
dismissibleAlert: this.modelValue,
|
|
@@ -108,34 +112,34 @@ export default {
|
|
|
108
112
|
dismissIcon,
|
|
109
113
|
infoIcon,
|
|
110
114
|
chevronIcon,
|
|
111
|
-
}
|
|
115
|
+
}
|
|
112
116
|
},
|
|
113
117
|
watch: {
|
|
114
118
|
modelValue(val) {
|
|
115
|
-
this.dismissibleAlert = val
|
|
119
|
+
this.dismissibleAlert = val
|
|
116
120
|
},
|
|
117
121
|
dismissibleAlert(val) {
|
|
118
122
|
if (val !== this.modelValue) {
|
|
119
|
-
this.$emit(
|
|
123
|
+
this.$emit('update:modelValue', val)
|
|
120
124
|
}
|
|
121
125
|
},
|
|
122
126
|
},
|
|
123
127
|
computed: {
|
|
124
128
|
layout() {
|
|
125
|
-
return this.mini ?
|
|
129
|
+
return this.mini ? 'mini' : 'full'
|
|
126
130
|
},
|
|
127
131
|
themeColor() {
|
|
128
|
-
return this.type ===
|
|
132
|
+
return this.type === 'alert' ? 'red' : 'blue'
|
|
129
133
|
},
|
|
130
134
|
stripTitle() {
|
|
131
|
-
if (this.mini && this.type ===
|
|
132
|
-
return
|
|
133
|
-
} else if (this.mini && this.type ===
|
|
134
|
-
return
|
|
135
|
+
if (this.mini && this.type === 'alert') {
|
|
136
|
+
return 'Safety alert'
|
|
137
|
+
} else if (this.mini && this.type === 'notice') {
|
|
138
|
+
return 'Information'
|
|
135
139
|
} else if (this.stripHeading) {
|
|
136
|
-
return this.stripHeading
|
|
140
|
+
return this.stripHeading
|
|
137
141
|
} else {
|
|
138
|
-
return
|
|
142
|
+
return ''
|
|
139
143
|
}
|
|
140
144
|
},
|
|
141
145
|
},
|
|
@@ -147,18 +151,18 @@ export default {
|
|
|
147
151
|
link: this.mini ? this.url : false,
|
|
148
152
|
clickedOnPage: this.$route.path,
|
|
149
153
|
globalStrip: false,
|
|
150
|
-
}
|
|
154
|
+
}
|
|
151
155
|
if (this.$gtm) {
|
|
152
156
|
this.$gtm.push({
|
|
153
157
|
event: `custom.interaction.${this.type}.click`,
|
|
154
158
|
...attrs,
|
|
155
|
-
})
|
|
159
|
+
})
|
|
156
160
|
}
|
|
157
|
-
this.$router.push(this.url)
|
|
161
|
+
this.$router.push(this.url)
|
|
158
162
|
},
|
|
159
163
|
handleDismissed() {
|
|
160
|
-
this.$emit(
|
|
161
|
-
this.$emit(
|
|
164
|
+
this.$emit('update:modelValue', false)
|
|
165
|
+
this.$emit('dismissed')
|
|
162
166
|
|
|
163
167
|
if (this.$gtm) {
|
|
164
168
|
const attrs = {
|
|
@@ -166,19 +170,19 @@ export default {
|
|
|
166
170
|
label: this.stripHeading,
|
|
167
171
|
clickedOnPage: this.$route.path,
|
|
168
172
|
globalStrip: false,
|
|
169
|
-
}
|
|
173
|
+
}
|
|
170
174
|
this.$gtm.push({
|
|
171
175
|
event: `custom.interaction.${this.type}.close`,
|
|
172
176
|
...attrs,
|
|
173
|
-
})
|
|
177
|
+
})
|
|
174
178
|
}
|
|
175
179
|
},
|
|
176
180
|
},
|
|
177
|
-
}
|
|
181
|
+
}
|
|
178
182
|
</script>
|
|
179
183
|
|
|
180
184
|
<style lang="scss" scoped>
|
|
181
|
-
@import
|
|
185
|
+
@import '../../../includes/scss/all';
|
|
182
186
|
.red {
|
|
183
187
|
.alert-strip {
|
|
184
188
|
&__inner {
|
|
@@ -312,7 +316,7 @@ export default {
|
|
|
312
316
|
max-width: 794px;
|
|
313
317
|
}
|
|
314
318
|
|
|
315
|
-
@include mq(
|
|
319
|
+
@include mq('sm') {
|
|
316
320
|
flex-direction: column;
|
|
317
321
|
margin-right: 16px;
|
|
318
322
|
|
|
@@ -12,25 +12,23 @@
|
|
|
12
12
|
<a
|
|
13
13
|
:id="'accordion' + itemid"
|
|
14
14
|
role="button"
|
|
15
|
-
:aria-expanded="showAccordion
|
|
15
|
+
:aria-expanded="showAccordion"
|
|
16
16
|
class="accordion-item__title"
|
|
17
17
|
:aria-controls="'sect' + itemid"
|
|
18
18
|
tabindex="0"
|
|
19
19
|
@click.prevent="toggleAccordion"
|
|
20
20
|
@keypress.enter="toggleAccordion"
|
|
21
21
|
>
|
|
22
|
-
<span
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
>{{ preHeading }}</span
|
|
26
|
-
>
|
|
22
|
+
<span v-if="preHeading && showPreHeading" class="accordion-item__pre-heading">{{
|
|
23
|
+
preHeading
|
|
24
|
+
}}</span>
|
|
27
25
|
<rich-text :tag="'h4'" :tag-class="'card-title'" :content="title" />
|
|
28
26
|
<icon
|
|
29
27
|
v-show="showAccordion && content"
|
|
30
28
|
width="18"
|
|
31
29
|
height="12"
|
|
32
30
|
class="accordion-icon"
|
|
33
|
-
:icon-alt="'collapse'"
|
|
31
|
+
:icon-alt="'collapse icon'"
|
|
34
32
|
:glyph="CaretUp"
|
|
35
33
|
:class="{
|
|
36
34
|
'--with-pre-heading': preHeading && showPreHeading,
|
|
@@ -41,7 +39,7 @@
|
|
|
41
39
|
width="18"
|
|
42
40
|
height="12"
|
|
43
41
|
class="accordion-icon"
|
|
44
|
-
:icon-alt="'expand'"
|
|
42
|
+
:icon-alt="'expand icon'"
|
|
45
43
|
:glyph="CaretDown"
|
|
46
44
|
:class="{
|
|
47
45
|
'--with-pre-heading': preHeading && showPreHeading,
|
|
@@ -64,14 +62,14 @@
|
|
|
64
62
|
</template>
|
|
65
63
|
|
|
66
64
|
<script>
|
|
67
|
-
import CaretDown from
|
|
68
|
-
import CaretUp from
|
|
69
|
-
import RichText from
|
|
70
|
-
import Icon from
|
|
71
|
-
import { BCard, BCardBody } from
|
|
65
|
+
import CaretDown from "../../../../assets/icons/caret-down.svg?url";
|
|
66
|
+
import CaretUp from "../../../../assets/icons/caret-up.svg?url";
|
|
67
|
+
import RichText from "../../RichText/index.vue";
|
|
68
|
+
import Icon from "../../../SubComponents/Icon/index.vue";
|
|
69
|
+
import { BCard, BCardBody } from "bootstrap-vue-next";
|
|
72
70
|
|
|
73
71
|
export default {
|
|
74
|
-
name:
|
|
72
|
+
name: "AccordionItem",
|
|
75
73
|
components: {
|
|
76
74
|
RichText,
|
|
77
75
|
Icon,
|
|
@@ -81,11 +79,11 @@ export default {
|
|
|
81
79
|
props: {
|
|
82
80
|
title: {
|
|
83
81
|
type: String,
|
|
84
|
-
default:
|
|
82
|
+
default: "Item",
|
|
85
83
|
},
|
|
86
84
|
preHeading: {
|
|
87
85
|
type: String,
|
|
88
|
-
default:
|
|
86
|
+
default: "PRE-HEADING",
|
|
89
87
|
},
|
|
90
88
|
content: {
|
|
91
89
|
type: String,
|
|
@@ -109,7 +107,7 @@ export default {
|
|
|
109
107
|
},
|
|
110
108
|
itemid: {
|
|
111
109
|
type: String,
|
|
112
|
-
default:
|
|
110
|
+
default: "Item",
|
|
113
111
|
},
|
|
114
112
|
},
|
|
115
113
|
data: () => ({
|
|
@@ -119,28 +117,28 @@ export default {
|
|
|
119
117
|
}),
|
|
120
118
|
mounted() {
|
|
121
119
|
this.$nextTick(() => {
|
|
122
|
-
this.showAccordion = this.open
|
|
123
|
-
})
|
|
120
|
+
this.showAccordion = this.open;
|
|
121
|
+
});
|
|
124
122
|
},
|
|
125
123
|
methods: {
|
|
126
124
|
toggleAccordion() {
|
|
127
|
-
this.showAccordion = !this.showAccordion
|
|
125
|
+
this.showAccordion = !this.showAccordion;
|
|
128
126
|
if (this.showAccordion) {
|
|
129
127
|
if (this.$bus) {
|
|
130
|
-
this.$bus.$emit(
|
|
128
|
+
this.$bus.$emit("accordionItemOpen", this.meta); // this.$root.$emit('accordionItemOpen', this.meta)
|
|
131
129
|
}
|
|
132
130
|
} else {
|
|
133
131
|
if (this.$bus) {
|
|
134
|
-
this.$bus.$emit(
|
|
132
|
+
this.$bus.$emit("accordionItemClose", this.meta); // this.$root.$emit('accordionItemClose', this.meta)
|
|
135
133
|
}
|
|
136
134
|
}
|
|
137
135
|
},
|
|
138
136
|
},
|
|
139
|
-
}
|
|
137
|
+
};
|
|
140
138
|
</script>
|
|
141
139
|
|
|
142
140
|
<style lang="scss">
|
|
143
|
-
@import
|
|
141
|
+
@import "../../../../includes/scss/all";
|
|
144
142
|
.subcomponent--accordion-item {
|
|
145
143
|
.accordion-item {
|
|
146
144
|
border-radius: 6px;
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
width="18"
|
|
35
35
|
height="12"
|
|
36
36
|
class="stepper-icon"
|
|
37
|
-
:icon-alt="'collapse'"
|
|
37
|
+
:icon-alt="'collapse icon'"
|
|
38
38
|
:glyph="CaretUp"
|
|
39
39
|
/>
|
|
40
40
|
<icon
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
width="18"
|
|
43
43
|
height="12"
|
|
44
44
|
class="stepper-icon"
|
|
45
|
-
:icon-alt="'expand'"
|
|
45
|
+
:icon-alt="'expand icon'"
|
|
46
46
|
:glyph="CaretDown"
|
|
47
47
|
/>
|
|
48
48
|
</div>
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
</template>
|
|
65
65
|
|
|
66
66
|
<script>
|
|
67
|
-
import CaretDown from
|
|
68
|
-
import CaretUp from
|
|
69
|
-
import RichText from
|
|
70
|
-
import Icon from
|
|
71
|
-
import { BCard, BCardBody } from
|
|
67
|
+
import CaretDown from "../../../../assets/icons/caret-down.svg?url";
|
|
68
|
+
import CaretUp from "../../../../assets/icons/caret-up.svg?url";
|
|
69
|
+
import RichText from "../../RichText/index.vue";
|
|
70
|
+
import Icon from "../../../SubComponents/Icon/index.vue";
|
|
71
|
+
import { BCard, BCardBody } from "bootstrap-vue-next";
|
|
72
72
|
|
|
73
73
|
export default {
|
|
74
|
-
name:
|
|
74
|
+
name: "StepperItem",
|
|
75
75
|
components: {
|
|
76
76
|
RichText,
|
|
77
77
|
Icon,
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
props: {
|
|
82
82
|
title: {
|
|
83
83
|
type: String,
|
|
84
|
-
default:
|
|
84
|
+
default: "Item",
|
|
85
85
|
},
|
|
86
86
|
content: {
|
|
87
87
|
type: String,
|
|
@@ -109,7 +109,7 @@ export default {
|
|
|
109
109
|
},
|
|
110
110
|
itemid: {
|
|
111
111
|
type: String,
|
|
112
|
-
default:
|
|
112
|
+
default: "Item",
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
data: () => ({
|
|
@@ -119,19 +119,19 @@ export default {
|
|
|
119
119
|
}),
|
|
120
120
|
mounted() {
|
|
121
121
|
this.$nextTick(() => {
|
|
122
|
-
this.showAccordion = this.open
|
|
123
|
-
})
|
|
122
|
+
this.showAccordion = this.open;
|
|
123
|
+
});
|
|
124
124
|
},
|
|
125
125
|
methods: {
|
|
126
126
|
toggleAccordion() {
|
|
127
|
-
this.showAccordion = !this.showAccordion
|
|
127
|
+
this.showAccordion = !this.showAccordion;
|
|
128
128
|
},
|
|
129
129
|
},
|
|
130
|
-
}
|
|
130
|
+
};
|
|
131
131
|
</script>
|
|
132
132
|
|
|
133
133
|
<style lang="scss">
|
|
134
|
-
@import
|
|
134
|
+
@import "../../../../includes/scss/all";
|
|
135
135
|
.subcomponent--accordion-stepper {
|
|
136
136
|
.accordion-stepper {
|
|
137
137
|
border-radius: 6px;
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
width="16"
|
|
38
38
|
class="btn-up"
|
|
39
39
|
@click="incrementValue"
|
|
40
|
+
alt="collapse icon"
|
|
40
41
|
/>
|
|
41
42
|
|
|
42
43
|
<img
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
width="16"
|
|
46
47
|
class="btn-down"
|
|
47
48
|
@click="decrementValue"
|
|
49
|
+
alt="expand icon"
|
|
48
50
|
/>
|
|
49
51
|
</div>
|
|
50
52
|
</div>
|
|
@@ -85,50 +87,50 @@
|
|
|
85
87
|
</template>
|
|
86
88
|
|
|
87
89
|
<script>
|
|
88
|
-
import Container from
|
|
89
|
-
import Column from
|
|
90
|
-
import Row from
|
|
91
|
-
import CtaButton from
|
|
92
|
-
import SelectableCards from
|
|
93
|
-
import CaretDown from
|
|
94
|
-
import CaretUp from
|
|
95
|
-
import CaretRight from
|
|
96
|
-
import CaretLeft from
|
|
90
|
+
import Container from "../../../Containers/Container/index.vue";
|
|
91
|
+
import Column from "../../../Containers/Column/index.vue";
|
|
92
|
+
import Row from "../../../Containers/Row/index.vue";
|
|
93
|
+
import CtaButton from "../../../SubComponents/CtaButton/index.vue";
|
|
94
|
+
import SelectableCards from "../../SelectableCards/index.vue";
|
|
95
|
+
import CaretDown from "../../../../assets/icons/caret-down.svg?url";
|
|
96
|
+
import CaretUp from "../../../../assets/icons/caret-up.svg?url";
|
|
97
|
+
import CaretRight from "../../../../assets/icons/caret-right.svg?url";
|
|
98
|
+
import CaretLeft from "../../../../assets/icons/caret-left.svg?url";
|
|
97
99
|
|
|
98
100
|
export default {
|
|
99
|
-
name:
|
|
101
|
+
name: "CardContainer",
|
|
100
102
|
components: {
|
|
101
103
|
Column,
|
|
102
104
|
Container,
|
|
103
105
|
Row,
|
|
104
106
|
CtaButton,
|
|
105
|
-
SelectableCards
|
|
107
|
+
SelectableCards,
|
|
106
108
|
},
|
|
107
109
|
props: {
|
|
108
110
|
iconIsBordered: {
|
|
109
111
|
type: Boolean,
|
|
110
|
-
default: false
|
|
112
|
+
default: false,
|
|
111
113
|
},
|
|
112
114
|
isWeight: {
|
|
113
115
|
type: Boolean,
|
|
114
|
-
default: true
|
|
116
|
+
default: true,
|
|
115
117
|
},
|
|
116
118
|
isHeight: {
|
|
117
119
|
type: Boolean,
|
|
118
|
-
default: false
|
|
120
|
+
default: false,
|
|
119
121
|
},
|
|
120
122
|
titles: {
|
|
121
123
|
type: Object,
|
|
122
|
-
default: () => []
|
|
124
|
+
default: () => [],
|
|
123
125
|
},
|
|
124
126
|
weights: {
|
|
125
127
|
type: Array,
|
|
126
|
-
default: () => []
|
|
128
|
+
default: () => [],
|
|
127
129
|
},
|
|
128
130
|
heights: {
|
|
129
131
|
type: Array,
|
|
130
|
-
default: () => []
|
|
131
|
-
}
|
|
132
|
+
default: () => [],
|
|
133
|
+
},
|
|
132
134
|
},
|
|
133
135
|
data() {
|
|
134
136
|
return {
|
|
@@ -136,111 +138,108 @@ export default {
|
|
|
136
138
|
CaretDown,
|
|
137
139
|
CaretRight,
|
|
138
140
|
CaretLeft,
|
|
139
|
-
typeCard:
|
|
140
|
-
cardItemTextAlign:
|
|
141
|
+
typeCard: "control-selectcards",
|
|
142
|
+
cardItemTextAlign: "center",
|
|
141
143
|
title: null,
|
|
142
144
|
cards: null,
|
|
143
145
|
cardUnit: null,
|
|
144
|
-
placeHolder:
|
|
146
|
+
placeHolder: "000",
|
|
145
147
|
inputValueDisplay: null,
|
|
146
148
|
minValue: 0.25,
|
|
147
149
|
maxValue: 500,
|
|
148
150
|
selectedCard: null,
|
|
149
|
-
selectedInput: null
|
|
150
|
-
}
|
|
151
|
+
selectedInput: null,
|
|
152
|
+
};
|
|
151
153
|
},
|
|
152
154
|
computed: {
|
|
153
155
|
isButtonDisabled() {
|
|
154
156
|
// Call the function to get its result, then check if either selectedCard is null or inputValueDisplay is null
|
|
155
|
-
return this.getValueWithoutUnits === null
|
|
157
|
+
return this.getValueWithoutUnits === null;
|
|
156
158
|
},
|
|
157
159
|
getValueWithoutUnits() {
|
|
158
160
|
// Ensure that inputValueDisplay is not null before attempting to replace
|
|
159
161
|
if (this.inputValueDisplay !== null) {
|
|
160
162
|
// Remove units (e.g., 'kg' or 'meters') from the input value
|
|
161
|
-
const valueWithoutUnits = this.inputValueDisplay.replace(
|
|
162
|
-
/kg|meters/i,
|
|
163
|
-
''
|
|
164
|
-
)
|
|
163
|
+
const valueWithoutUnits = this.inputValueDisplay.replace(/kg|meters/i, "");
|
|
165
164
|
// Convert the remaining value to a numeric representation
|
|
166
|
-
const numericValue = parseFloat(valueWithoutUnits)
|
|
165
|
+
const numericValue = parseFloat(valueWithoutUnits);
|
|
167
166
|
// Check if numericValue is a valid number
|
|
168
167
|
if (!isNaN(numericValue)) {
|
|
169
168
|
// Use toFixed(2) to display the number with two decimal places
|
|
170
|
-
return parseFloat(numericValue.toFixed(2))
|
|
169
|
+
return parseFloat(numericValue.toFixed(2));
|
|
171
170
|
} else {
|
|
172
|
-
return null
|
|
171
|
+
return null;
|
|
173
172
|
}
|
|
174
173
|
} else {
|
|
175
|
-
return null
|
|
174
|
+
return null;
|
|
176
175
|
}
|
|
177
|
-
}
|
|
176
|
+
},
|
|
178
177
|
},
|
|
179
178
|
mounted() {
|
|
180
|
-
this.inputValueDisplay = null
|
|
179
|
+
this.inputValueDisplay = null;
|
|
181
180
|
if (this.isWeight) {
|
|
182
|
-
this.title = this.titles.weight
|
|
183
|
-
this.cards = this.weights
|
|
184
|
-
this.cardUnit =
|
|
185
|
-
this.placeHolder = this.placeHolder + this.cardUnit
|
|
186
|
-
this.minValue = 0.25
|
|
187
|
-
this.maxValue = 500
|
|
181
|
+
this.title = this.titles.weight;
|
|
182
|
+
this.cards = this.weights;
|
|
183
|
+
this.cardUnit = " kg";
|
|
184
|
+
this.placeHolder = this.placeHolder + this.cardUnit;
|
|
185
|
+
this.minValue = 0.25;
|
|
186
|
+
this.maxValue = 500;
|
|
188
187
|
} else {
|
|
189
|
-
this.title = this.titles.height
|
|
190
|
-
this.cards = this.heights
|
|
191
|
-
this.cardUnit =
|
|
192
|
-
this.placeHolder = this.placeHolder + this.cardUnit
|
|
193
|
-
this.minValue = 2
|
|
194
|
-
this.maxValue = 250
|
|
188
|
+
this.title = this.titles.height;
|
|
189
|
+
this.cards = this.heights;
|
|
190
|
+
this.cardUnit = " meters";
|
|
191
|
+
this.placeHolder = this.placeHolder + this.cardUnit;
|
|
192
|
+
this.minValue = 2;
|
|
193
|
+
this.maxValue = 250;
|
|
195
194
|
}
|
|
196
195
|
},
|
|
197
196
|
methods: {
|
|
198
197
|
handlePrevScreen() {
|
|
199
|
-
this.$emit(
|
|
198
|
+
this.$emit("prevScreen");
|
|
200
199
|
},
|
|
201
200
|
handleNextScreen() {
|
|
202
201
|
// Only emit the 'nextScreen' event if the button is not disabled
|
|
203
202
|
if (!this.isButtonDisabled) {
|
|
204
|
-
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
203
|
+
this.selectedInput = { value: this.getValueWithoutUnits };
|
|
205
204
|
|
|
206
|
-
this.inputValueDisplay = null
|
|
207
|
-
this.$emit(
|
|
205
|
+
this.inputValueDisplay = null;
|
|
206
|
+
this.$emit("nextScreen", this.selectedInput);
|
|
208
207
|
}
|
|
209
208
|
},
|
|
210
209
|
selectedCardChangeFocus(card) {
|
|
211
210
|
// if statement added to overcome issue of lost values when function is called twice
|
|
212
211
|
if (card.value !== undefined) {
|
|
213
|
-
this.selectedCard = card
|
|
214
|
-
this.selectedInput = null
|
|
215
|
-
this.inputValueDisplay = card.value +
|
|
216
|
-
this.$nextTick(() => this.$refs.calNextBtn.$el.focus())
|
|
212
|
+
this.selectedCard = card;
|
|
213
|
+
this.selectedInput = null;
|
|
214
|
+
this.inputValueDisplay = card.value + " " + this.cardUnit;
|
|
215
|
+
this.$nextTick(() => this.$refs.calNextBtn.$el.focus());
|
|
217
216
|
}
|
|
218
217
|
},
|
|
219
218
|
clearCard() {
|
|
220
|
-
this.selectedInput = null
|
|
219
|
+
this.selectedInput = null;
|
|
221
220
|
|
|
222
|
-
this.selectedCard = null
|
|
223
|
-
this.$refs.cardDeck.clearCard()
|
|
221
|
+
this.selectedCard = null;
|
|
222
|
+
this.$refs.cardDeck.clearCard();
|
|
224
223
|
},
|
|
225
224
|
incrementValue() {
|
|
226
225
|
if (this.selectedCard !== null) {
|
|
227
|
-
this.$refs.cardDeck.clearCard()
|
|
226
|
+
this.$refs.cardDeck.clearCard();
|
|
228
227
|
}
|
|
229
228
|
|
|
230
|
-
let newValue = Math.min(this.getValueWithoutUnits + 1, this.maxValue)
|
|
231
|
-
this.inputValueDisplay = newValue + this.cardUnit
|
|
229
|
+
let newValue = Math.min(this.getValueWithoutUnits + 1, this.maxValue);
|
|
230
|
+
this.inputValueDisplay = newValue + this.cardUnit;
|
|
232
231
|
|
|
233
|
-
this.selectedInput = { value: newValue }
|
|
232
|
+
this.selectedInput = { value: newValue };
|
|
234
233
|
},
|
|
235
234
|
decrementValue() {
|
|
236
235
|
if (this.selectedCard !== null) {
|
|
237
|
-
this.$refs.cardDeck.clearCard()
|
|
236
|
+
this.$refs.cardDeck.clearCard();
|
|
238
237
|
}
|
|
239
238
|
|
|
240
|
-
let newValue = Math.max(this.getValueWithoutUnits - 1, this.minValue)
|
|
241
|
-
this.inputValueDisplay = newValue + this.cardUnit
|
|
239
|
+
let newValue = Math.max(this.getValueWithoutUnits - 1, this.minValue);
|
|
240
|
+
this.inputValueDisplay = newValue + this.cardUnit;
|
|
242
241
|
|
|
243
|
-
this.selectedInput = { value: newValue }
|
|
242
|
+
this.selectedInput = { value: newValue };
|
|
244
243
|
},
|
|
245
244
|
// Validate the input value on blur
|
|
246
245
|
validateInput() {
|
|
@@ -251,28 +250,28 @@ export default {
|
|
|
251
250
|
this.getValueWithoutUnits <= this.maxValue
|
|
252
251
|
) {
|
|
253
252
|
// Value is within the range, update the input value
|
|
254
|
-
this.inputValueDisplay = this.getValueWithoutUnits + this.cardUnit
|
|
253
|
+
this.inputValueDisplay = this.getValueWithoutUnits + this.cardUnit;
|
|
255
254
|
|
|
256
255
|
// alternate..
|
|
257
|
-
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
256
|
+
this.selectedInput = { value: this.getValueWithoutUnits };
|
|
258
257
|
} else {
|
|
259
258
|
// Value is outside the range, leave the input blank
|
|
260
|
-
this.inputValueDisplay = null
|
|
259
|
+
this.inputValueDisplay = null;
|
|
261
260
|
|
|
262
|
-
this.selectedInput = null
|
|
261
|
+
this.selectedInput = null;
|
|
263
262
|
}
|
|
264
263
|
},
|
|
265
264
|
// Handle input focus
|
|
266
265
|
handleInputFocus() {
|
|
267
266
|
if (this.selectedCard !== null) {
|
|
268
|
-
this.$refs.cardDeck.clearCard()
|
|
267
|
+
this.$refs.cardDeck.clearCard();
|
|
269
268
|
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
};
|
|
273
272
|
</script>
|
|
274
273
|
|
|
275
274
|
<style lang="scss" scoped>
|
|
276
|
-
@import
|
|
277
|
-
@import
|
|
275
|
+
@import "../../../../includes/scss/all";
|
|
276
|
+
@import "./styles";
|
|
278
277
|
</style>
|