@worksafevictoria/wcl7.5 1.17.1 → 1.18.0-beta.2
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/icons/chevron-right-icon.svg +14 -0
- package/src/assets/icons/notepad.svg +93 -0
- package/src/assets/icons/question.svg +7 -0
- package/src/components/Common/CardGrid/index.vue +83 -74
- package/src/components/Common/CardGridItem/index.vue +31 -4
- package/src/components/Containers/Carousel/index.vue +24 -4
- package/src/components/Containers/SectionGroup/index.stories.js +28 -27
- package/src/components/Containers/SectionGroup/index.vue +5 -0
- package/src/components/Global/AppHeaderNew/index.vue +9 -1
- package/src/components/Global/AppHeaderNew/mobile.scss +4 -2
- package/src/components/Global/HeroHeader/index.vue +74 -57
- package/src/components/Paragraphs/Calculator/CardContainer/index.vue +69 -62
- package/src/components/Paragraphs/Calculator/CardContainer/styles.scss +72 -68
- package/src/components/Paragraphs/Calculator/index.vue +61 -44
- package/src/components/Paragraphs/RTWPlanner/CardContainer/index.vue +134 -0
- package/src/components/Paragraphs/RTWPlanner/Constants.js +433 -0
- package/src/components/Paragraphs/RTWPlanner/Footer/index.vue +32 -0
- package/src/components/Paragraphs/RTWPlanner/{NavBar → Header}/index.vue +20 -9
- package/src/components/Paragraphs/RTWPlanner/HomePage/index.vue +72 -0
- package/src/components/Paragraphs/RTWPlanner/Injuries/index.vue +231 -0
- package/src/components/Paragraphs/RTWPlanner/Planners/PlanTasks.vue +9 -8
- package/src/components/Paragraphs/RTWPlanner/Planners/PlannerNameModal.vue +97 -0
- package/src/components/Paragraphs/RTWPlanner/Planners/index.vue +367 -175
- package/src/components/Paragraphs/RTWPlanner/index.stories.js +82 -15
- package/src/components/Paragraphs/RTWPlanner/index.vue +109 -31
- package/src/components/Paragraphs/SelectableCards/Control/index.stories.js +32 -11
- package/src/components/Paragraphs/SelectableCards/cardbody.vue +9 -10
- package/src/components/Paragraphs/SelectableCards/cardtop.vue +23 -16
- package/src/components/Paragraphs/SelectableCards/index.stories.js +29 -8
- package/src/components/Paragraphs/SelectableCards/index.vue +124 -50
- package/src/components/Paragraphs/TextMedia/index.vue +4 -0
- package/src/components/SubComponents/Breadcrumb/index.vue +40 -7
- package/src/components/SubComponents/FormInstance/models/base-form-element.js +4 -3
- package/src/components/SubComponents/FormInstance/services/form-render-parser.js +51 -16
- package/src/components/SubComponents/FormInstance/services/logic-parser.js +122 -18
- package/src/components/SubComponents/FormInstance/services/registry-factory.js +52 -50
- package/src/components/SubComponents/FormInstance/stories/mocks/checkboxesother.json +1 -10
- package/src/components/SubComponents/FormInstance/stories/mocks/emailconfirm.json +1 -10
- package/src/components/SubComponents/FormInstance/stories/mocks/jahd.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/quad.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/radiosother.json +1 -9
- package/src/components/SubComponents/FormInstance/stories/mocks/sameas.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/selectother.json +1 -10
- package/src/components/SubComponents/FormInstance/stories/mocks/styles.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/table-select.json +1 -15
- package/src/components/SubComponents/FormInstance/stories/mocks/token.json +1 -5
- package/src/components/SubComponents/FormInstance/stories/mocks/twig.json +1 -13
- package/src/components/SubComponents/FormInstance/stories/mocks/wizard.json +1 -13
- package/src/components/SubComponents/FormInstance/tests/form-test-utils.js +3 -0
- package/src/components/SubComponents/FormInstance/tests/form.test.js +2 -1
- package/src/components/SubComponents/FormInstance/tests/radiosother.test.js +12 -11
- package/src/components/SubComponents/FormInstance/tests/rule-disabled.test.js +13 -45
- package/src/components/SubComponents/FormInstance/tests/rule-enabled-value.test.js +8 -24
- package/src/components/SubComponents/FormInstance/tests/rule-hidden.test.js +13 -45
- package/src/components/SubComponents/FormInstance/tests/rule-required-value.test.js +15 -55
- package/src/components/SubComponents/FormInstance/tests/rule-visible.test.js +0 -413
- package/src/components/SubComponents/FormInstance/tests/sameas.test.js +9 -25
- package/src/components/SubComponents/FormInstance/tests/twig.test.js +7 -5
- package/src/components/SubComponents/ResourceGroup/index.vue +1 -1
- package/src/includes/scss/vars/src/colors.module.scss +3 -0
- package/src/includes/scss/vars/src/colors.scss +3 -0
- package/src/index.js +6 -0
- package/src/mock/control-selectable-cards.js +68 -25
- package/src/components/Paragraphs/RTWPlanner/Home/index.vue +0 -83
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
:cards="cards"
|
|
8
8
|
class="ffh-card-container control-selectablecards"
|
|
9
9
|
:card-type="typeCard"
|
|
10
|
+
:button-role="'radio'"
|
|
10
11
|
:icon-is-bordered="iconIsBordered"
|
|
11
12
|
:card-text-align="cardItemTextAlign"
|
|
12
13
|
@selected="selectedCardChangeFocus"
|
|
@@ -55,8 +56,7 @@
|
|
|
55
56
|
}}</span>
|
|
56
57
|
</column>
|
|
57
58
|
</row>
|
|
58
|
-
|
|
59
|
-
<container>
|
|
59
|
+
|
|
60
60
|
<row>
|
|
61
61
|
<column class="ffh-cc-nav__back-col" xs="12">
|
|
62
62
|
<cta-button
|
|
@@ -87,18 +87,18 @@
|
|
|
87
87
|
</template>
|
|
88
88
|
|
|
89
89
|
<script>
|
|
90
|
-
import Container from
|
|
91
|
-
import Column from
|
|
92
|
-
import Row from
|
|
93
|
-
import CtaButton from
|
|
94
|
-
import SelectableCards from
|
|
95
|
-
import CaretDown from
|
|
96
|
-
import CaretUp from
|
|
97
|
-
import CaretRight from
|
|
98
|
-
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'
|
|
99
99
|
|
|
100
100
|
export default {
|
|
101
|
-
name:
|
|
101
|
+
name: 'CardContainer',
|
|
102
102
|
components: {
|
|
103
103
|
Column,
|
|
104
104
|
Container,
|
|
@@ -131,6 +131,10 @@ export default {
|
|
|
131
131
|
type: Array,
|
|
132
132
|
default: () => [],
|
|
133
133
|
},
|
|
134
|
+
buttonRole: {
|
|
135
|
+
type: String,
|
|
136
|
+
default: 'radio',
|
|
137
|
+
},
|
|
134
138
|
},
|
|
135
139
|
data() {
|
|
136
140
|
return {
|
|
@@ -138,108 +142,111 @@ export default {
|
|
|
138
142
|
CaretDown,
|
|
139
143
|
CaretRight,
|
|
140
144
|
CaretLeft,
|
|
141
|
-
typeCard:
|
|
142
|
-
cardItemTextAlign:
|
|
145
|
+
typeCard: 'control-selectcards',
|
|
146
|
+
cardItemTextAlign: 'center',
|
|
143
147
|
title: null,
|
|
144
148
|
cards: null,
|
|
145
149
|
cardUnit: null,
|
|
146
|
-
placeHolder:
|
|
150
|
+
placeHolder: '000',
|
|
147
151
|
inputValueDisplay: null,
|
|
148
152
|
minValue: 0.25,
|
|
149
153
|
maxValue: 500,
|
|
150
154
|
selectedCard: null,
|
|
151
155
|
selectedInput: null,
|
|
152
|
-
}
|
|
156
|
+
}
|
|
153
157
|
},
|
|
154
158
|
computed: {
|
|
155
159
|
isButtonDisabled() {
|
|
156
160
|
// Call the function to get its result, then check if either selectedCard is null or inputValueDisplay is null
|
|
157
|
-
return this.getValueWithoutUnits === null
|
|
161
|
+
return this.getValueWithoutUnits === null
|
|
158
162
|
},
|
|
159
163
|
getValueWithoutUnits() {
|
|
160
164
|
// Ensure that inputValueDisplay is not null before attempting to replace
|
|
161
165
|
if (this.inputValueDisplay !== null) {
|
|
162
166
|
// Remove units (e.g., 'kg' or 'meters') from the input value
|
|
163
|
-
const valueWithoutUnits = this.inputValueDisplay.replace(
|
|
167
|
+
const valueWithoutUnits = this.inputValueDisplay.replace(
|
|
168
|
+
/kg|meters/i,
|
|
169
|
+
'',
|
|
170
|
+
)
|
|
164
171
|
// Convert the remaining value to a numeric representation
|
|
165
|
-
const numericValue = parseFloat(valueWithoutUnits)
|
|
172
|
+
const numericValue = parseFloat(valueWithoutUnits)
|
|
166
173
|
// Check if numericValue is a valid number
|
|
167
174
|
if (!isNaN(numericValue)) {
|
|
168
175
|
// Use toFixed(2) to display the number with two decimal places
|
|
169
|
-
return parseFloat(numericValue.toFixed(2))
|
|
176
|
+
return parseFloat(numericValue.toFixed(2))
|
|
170
177
|
} else {
|
|
171
|
-
return null
|
|
178
|
+
return null
|
|
172
179
|
}
|
|
173
180
|
} else {
|
|
174
|
-
return null
|
|
181
|
+
return null
|
|
175
182
|
}
|
|
176
183
|
},
|
|
177
184
|
},
|
|
178
185
|
mounted() {
|
|
179
|
-
this.inputValueDisplay = null
|
|
186
|
+
this.inputValueDisplay = null
|
|
180
187
|
if (this.isWeight) {
|
|
181
|
-
this.title = this.titles.weight
|
|
182
|
-
this.cards = this.weights
|
|
183
|
-
this.cardUnit =
|
|
184
|
-
this.placeHolder = this.placeHolder + this.cardUnit
|
|
185
|
-
this.minValue = 0.25
|
|
186
|
-
this.maxValue = 500
|
|
188
|
+
this.title = this.titles.weight
|
|
189
|
+
this.cards = this.weights
|
|
190
|
+
this.cardUnit = ' kg'
|
|
191
|
+
this.placeHolder = this.placeHolder + this.cardUnit
|
|
192
|
+
this.minValue = 0.25
|
|
193
|
+
this.maxValue = 500
|
|
187
194
|
} else {
|
|
188
|
-
this.title = this.titles.height
|
|
189
|
-
this.cards = this.heights
|
|
190
|
-
this.cardUnit =
|
|
191
|
-
this.placeHolder = this.placeHolder + this.cardUnit
|
|
192
|
-
this.minValue = 2
|
|
193
|
-
this.maxValue = 250
|
|
195
|
+
this.title = this.titles.height
|
|
196
|
+
this.cards = this.heights
|
|
197
|
+
this.cardUnit = ' meters'
|
|
198
|
+
this.placeHolder = this.placeHolder + this.cardUnit
|
|
199
|
+
this.minValue = 2
|
|
200
|
+
this.maxValue = 250
|
|
194
201
|
}
|
|
195
202
|
},
|
|
196
203
|
methods: {
|
|
197
204
|
handlePrevScreen() {
|
|
198
|
-
this.$emit(
|
|
205
|
+
this.$emit('prevScreen')
|
|
199
206
|
},
|
|
200
207
|
handleNextScreen() {
|
|
201
208
|
// Only emit the 'nextScreen' event if the button is not disabled
|
|
202
209
|
if (!this.isButtonDisabled) {
|
|
203
|
-
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
210
|
+
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
204
211
|
|
|
205
|
-
this.inputValueDisplay = null
|
|
206
|
-
this.$emit(
|
|
212
|
+
this.inputValueDisplay = null
|
|
213
|
+
this.$emit('nextScreen', this.selectedInput)
|
|
207
214
|
}
|
|
208
215
|
},
|
|
209
216
|
selectedCardChangeFocus(card) {
|
|
210
217
|
// if statement added to overcome issue of lost values when function is called twice
|
|
211
218
|
if (card.value !== undefined) {
|
|
212
|
-
this.selectedCard = card
|
|
213
|
-
this.selectedInput = null
|
|
214
|
-
this.inputValueDisplay = card.value +
|
|
215
|
-
this.$nextTick(() => this.$refs.calNextBtn.$el.focus())
|
|
219
|
+
this.selectedCard = card
|
|
220
|
+
this.selectedInput = null
|
|
221
|
+
this.inputValueDisplay = card.value + ' ' + this.cardUnit
|
|
222
|
+
this.$nextTick(() => this.$refs.calNextBtn.$el.focus())
|
|
216
223
|
}
|
|
217
224
|
},
|
|
218
225
|
clearCard() {
|
|
219
|
-
this.selectedInput = null
|
|
226
|
+
this.selectedInput = null
|
|
220
227
|
|
|
221
|
-
this.selectedCard = null
|
|
222
|
-
this.$refs.cardDeck.clearCard()
|
|
228
|
+
this.selectedCard = null
|
|
229
|
+
this.$refs.cardDeck.clearCard()
|
|
223
230
|
},
|
|
224
231
|
incrementValue() {
|
|
225
232
|
if (this.selectedCard !== null) {
|
|
226
|
-
this.$refs.cardDeck.clearCard()
|
|
233
|
+
this.$refs.cardDeck.clearCard()
|
|
227
234
|
}
|
|
228
235
|
|
|
229
|
-
let newValue = Math.min(this.getValueWithoutUnits + 1, this.maxValue)
|
|
230
|
-
this.inputValueDisplay = newValue + this.cardUnit
|
|
236
|
+
let newValue = Math.min(this.getValueWithoutUnits + 1, this.maxValue)
|
|
237
|
+
this.inputValueDisplay = newValue + this.cardUnit
|
|
231
238
|
|
|
232
|
-
this.selectedInput = { value: newValue }
|
|
239
|
+
this.selectedInput = { value: newValue }
|
|
233
240
|
},
|
|
234
241
|
decrementValue() {
|
|
235
242
|
if (this.selectedCard !== null) {
|
|
236
|
-
this.$refs.cardDeck.clearCard()
|
|
243
|
+
this.$refs.cardDeck.clearCard()
|
|
237
244
|
}
|
|
238
245
|
|
|
239
|
-
let newValue = Math.max(this.getValueWithoutUnits - 1, this.minValue)
|
|
240
|
-
this.inputValueDisplay = newValue + this.cardUnit
|
|
246
|
+
let newValue = Math.max(this.getValueWithoutUnits - 1, this.minValue)
|
|
247
|
+
this.inputValueDisplay = newValue + this.cardUnit
|
|
241
248
|
|
|
242
|
-
this.selectedInput = { value: newValue }
|
|
249
|
+
this.selectedInput = { value: newValue }
|
|
243
250
|
},
|
|
244
251
|
// Validate the input value on blur
|
|
245
252
|
validateInput() {
|
|
@@ -250,28 +257,28 @@ export default {
|
|
|
250
257
|
this.getValueWithoutUnits <= this.maxValue
|
|
251
258
|
) {
|
|
252
259
|
// Value is within the range, update the input value
|
|
253
|
-
this.inputValueDisplay = this.getValueWithoutUnits + this.cardUnit
|
|
260
|
+
this.inputValueDisplay = this.getValueWithoutUnits + this.cardUnit
|
|
254
261
|
|
|
255
262
|
// alternate..
|
|
256
|
-
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
263
|
+
this.selectedInput = { value: this.getValueWithoutUnits }
|
|
257
264
|
} else {
|
|
258
265
|
// Value is outside the range, leave the input blank
|
|
259
|
-
this.inputValueDisplay = null
|
|
266
|
+
this.inputValueDisplay = null
|
|
260
267
|
|
|
261
|
-
this.selectedInput = null
|
|
268
|
+
this.selectedInput = null
|
|
262
269
|
}
|
|
263
270
|
},
|
|
264
271
|
// Handle input focus
|
|
265
272
|
handleInputFocus() {
|
|
266
273
|
if (this.selectedCard !== null) {
|
|
267
|
-
this.$refs.cardDeck.clearCard()
|
|
274
|
+
this.$refs.cardDeck.clearCard()
|
|
268
275
|
}
|
|
269
276
|
},
|
|
270
277
|
},
|
|
271
|
-
}
|
|
278
|
+
}
|
|
272
279
|
</script>
|
|
273
280
|
|
|
274
281
|
<style lang="scss" scoped>
|
|
275
|
-
@import
|
|
276
|
-
@import
|
|
282
|
+
@import '../../../../includes/scss/all';
|
|
283
|
+
@import './styles';
|
|
277
284
|
</style>
|
|
@@ -18,11 +18,76 @@
|
|
|
18
18
|
margin-top: 5px;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
.ffh-cc-nav {
|
|
23
|
-
margin-top: 2rem;
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
&__footer {
|
|
25
|
+
&--title {
|
|
26
|
+
font-size: px-to-rem(26px);
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
margin-bottom: 15px;
|
|
29
|
+
|
|
30
|
+
span {
|
|
31
|
+
font-size: px-to-rem(16px);
|
|
32
|
+
font-weight: 400;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&--label {
|
|
36
|
+
font-size: px-to-rem(14px);
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
|
|
39
|
+
@media screen and (min-width: 1200px) {
|
|
40
|
+
font-size: px-to-rem(16px);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.input-group {
|
|
45
|
+
position: relative;
|
|
46
|
+
margin-bottom: 10px;
|
|
47
|
+
|
|
48
|
+
.input-with-arrows {
|
|
49
|
+
font-size: px-to-rem(22px);
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
height: 64px;
|
|
52
|
+
border: 3px solid $gray;
|
|
53
|
+
border-radius: 10px;
|
|
54
|
+
width: 100%;
|
|
55
|
+
|
|
56
|
+
@media screen and (min-width: 768) {
|
|
57
|
+
font-size: px-to-rem(24px);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.input-group-btn {
|
|
62
|
+
border-radius: 0 10px 10px 0;
|
|
63
|
+
position: absolute;
|
|
64
|
+
background: $black;
|
|
65
|
+
width: 15%;
|
|
66
|
+
height: 64px;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
align-items: center;
|
|
71
|
+
padding: 10px 0;
|
|
72
|
+
z-index: 9;
|
|
73
|
+
right: 0;
|
|
74
|
+
@media (min-width: 768px) {
|
|
75
|
+
width: 10%;
|
|
76
|
+
}
|
|
77
|
+
@media (min-width: 991px) {
|
|
78
|
+
width: 7%;
|
|
79
|
+
}
|
|
80
|
+
img {
|
|
81
|
+
width: 16px;
|
|
82
|
+
height: 16px;
|
|
83
|
+
filter: invert(100%);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
.ffh-cc-nav__back-col {
|
|
26
91
|
font-weight: bold;
|
|
27
92
|
line-height: 1.6;
|
|
28
93
|
flex: 0 0 100%;
|
|
@@ -44,7 +109,7 @@
|
|
|
44
109
|
}
|
|
45
110
|
}
|
|
46
111
|
|
|
47
|
-
|
|
112
|
+
.ffh-cc-nav__right-col {
|
|
48
113
|
text-align: right;
|
|
49
114
|
min-height: 30px;
|
|
50
115
|
display: flex;
|
|
@@ -84,69 +149,8 @@
|
|
|
84
149
|
}
|
|
85
150
|
}
|
|
86
151
|
}
|
|
152
|
+
|
|
153
|
+
|
|
87
154
|
|
|
88
|
-
&__footer {
|
|
89
|
-
&--title {
|
|
90
|
-
font-size: px-to-rem(26px);
|
|
91
|
-
font-weight: 700;
|
|
92
|
-
margin-bottom: 15px;
|
|
93
|
-
|
|
94
|
-
span {
|
|
95
|
-
font-size: px-to-rem(16px);
|
|
96
|
-
font-weight: 400;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
&--label {
|
|
100
|
-
font-size: px-to-rem(14px);
|
|
101
|
-
font-weight: 700;
|
|
102
|
-
|
|
103
|
-
@media screen and (min-width: 1200px) {
|
|
104
|
-
font-size: px-to-rem(16px);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
.input-group {
|
|
109
|
-
position: relative;
|
|
110
|
-
margin-bottom: 10px;
|
|
111
|
-
|
|
112
|
-
.input-with-arrows {
|
|
113
|
-
font-size: px-to-rem(22px);
|
|
114
|
-
font-weight: 700;
|
|
115
|
-
height: 64px;
|
|
116
|
-
border: 3px solid $gray;
|
|
117
|
-
border-radius: 10px;
|
|
118
|
-
width: 100%;
|
|
119
|
-
|
|
120
|
-
@media screen and (min-width: 768) {
|
|
121
|
-
font-size: px-to-rem(24px);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.input-group-btn {
|
|
126
|
-
border-radius: 0 10px 10px 0;
|
|
127
|
-
position: absolute;
|
|
128
|
-
background: $black;
|
|
129
|
-
width: 15%;
|
|
130
|
-
height: 64px;
|
|
131
|
-
display: flex;
|
|
132
|
-
flex-direction: column;
|
|
133
|
-
justify-content: space-between;
|
|
134
|
-
align-items: center;
|
|
135
|
-
padding: 10px 0;
|
|
136
|
-
z-index: 9;
|
|
137
|
-
right: 0;
|
|
138
|
-
@media (min-width: 768px) {
|
|
139
|
-
width: 10%;
|
|
140
|
-
}
|
|
141
|
-
@media (min-width: 991px) {
|
|
142
|
-
width: 7%;
|
|
143
|
-
}
|
|
144
|
-
img {
|
|
145
|
-
width: 16px;
|
|
146
|
-
height: 16px;
|
|
147
|
-
filter: invert(100%);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
155
|
|
|
151
|
-
}
|
|
152
156
|
}
|
|
@@ -18,15 +18,16 @@
|
|
|
18
18
|
</container>
|
|
19
19
|
|
|
20
20
|
<card-container
|
|
21
|
-
v-
|
|
21
|
+
v-if="screen === 1"
|
|
22
22
|
ref="weightCardContainer"
|
|
23
23
|
:is-weight="true"
|
|
24
24
|
:titles="titles.weight"
|
|
25
25
|
:weights="weights || []"
|
|
26
26
|
@nextScreen="nextScreen"
|
|
27
27
|
/>
|
|
28
|
+
|
|
28
29
|
<card-container
|
|
29
|
-
v-
|
|
30
|
+
v-if="screen === 2"
|
|
30
31
|
ref="heightCardContainer"
|
|
31
32
|
:is-weight="false"
|
|
32
33
|
:titles="titles.height"
|
|
@@ -34,8 +35,9 @@
|
|
|
34
35
|
@nextScreen="nextScreen"
|
|
35
36
|
@prevScreen="prevScreen"
|
|
36
37
|
/>
|
|
38
|
+
|
|
37
39
|
<risk-level
|
|
38
|
-
v-
|
|
40
|
+
v-if="screen === 3"
|
|
39
41
|
:risk-points="riskPoints"
|
|
40
42
|
@prevScreen="prevScreen"
|
|
41
43
|
@reset="resetApp"
|
|
@@ -70,41 +72,41 @@ export default {
|
|
|
70
72
|
CardContainer,
|
|
71
73
|
ProgressBar,
|
|
72
74
|
RiskLevel,
|
|
73
|
-
RichText
|
|
75
|
+
RichText,
|
|
74
76
|
},
|
|
75
77
|
props: {
|
|
76
78
|
items: {
|
|
77
79
|
type: Array,
|
|
78
|
-
default: () => []
|
|
80
|
+
default: () => [],
|
|
79
81
|
},
|
|
80
82
|
steeperStyle: {
|
|
81
83
|
type: Boolean,
|
|
82
|
-
default: true
|
|
84
|
+
default: true,
|
|
83
85
|
},
|
|
84
86
|
titles: {
|
|
85
87
|
type: Object,
|
|
86
|
-
default: () => {}
|
|
88
|
+
default: () => {},
|
|
87
89
|
},
|
|
88
90
|
weights: {
|
|
89
91
|
type: Array,
|
|
90
|
-
default: () => []
|
|
92
|
+
default: () => [],
|
|
91
93
|
},
|
|
92
94
|
heights: {
|
|
93
95
|
type: Array,
|
|
94
|
-
default: () => []
|
|
96
|
+
default: () => [],
|
|
95
97
|
},
|
|
96
98
|
ffhPage: {
|
|
97
99
|
type: Object,
|
|
98
|
-
default: () => {}
|
|
100
|
+
default: () => {},
|
|
99
101
|
},
|
|
100
102
|
heroHeader: {
|
|
101
103
|
type: Object,
|
|
102
|
-
default: () => {}
|
|
104
|
+
default: () => {},
|
|
103
105
|
},
|
|
104
106
|
riskResults: {
|
|
105
107
|
type: Array,
|
|
106
|
-
default: () => []
|
|
107
|
-
}
|
|
108
|
+
default: () => [],
|
|
109
|
+
},
|
|
108
110
|
},
|
|
109
111
|
data() {
|
|
110
112
|
return {
|
|
@@ -112,14 +114,14 @@ export default {
|
|
|
112
114
|
selectedWeight: null,
|
|
113
115
|
selectedHeight: null,
|
|
114
116
|
barItems: [],
|
|
115
|
-
g: 9.81
|
|
117
|
+
g: 9.81,
|
|
116
118
|
}
|
|
117
119
|
},
|
|
118
120
|
computed: {
|
|
119
121
|
updateBar() {
|
|
120
122
|
const data = this.barItems
|
|
121
123
|
const currentIndex = data.findIndex(
|
|
122
|
-
(item) => item.value === this.screen.toString()
|
|
124
|
+
(item) => item.value === this.screen.toString(),
|
|
123
125
|
)
|
|
124
126
|
|
|
125
127
|
if (data.length === this.screen) {
|
|
@@ -144,13 +146,13 @@ export default {
|
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
let speedImpactMS = Math.sqrt(
|
|
147
|
-
2 * Number(this.selectedHeight.value) * this.g
|
|
149
|
+
2 * Number(this.selectedHeight.value) * this.g,
|
|
148
150
|
).toFixed(2)
|
|
149
151
|
let speedImpactKmH = (
|
|
150
152
|
Math.sqrt(2 * Number(this.selectedHeight.value) * this.g) * 3.6
|
|
151
153
|
).toFixed(2)
|
|
152
154
|
let timeImpact = Math.sqrt(
|
|
153
|
-
(2 * Number(this.selectedHeight.value)) / this.g
|
|
155
|
+
(2 * Number(this.selectedHeight.value)) / this.g,
|
|
154
156
|
).toFixed(2)
|
|
155
157
|
let energyImpact = (
|
|
156
158
|
Number(this.selectedHeight.value) *
|
|
@@ -177,10 +179,10 @@ export default {
|
|
|
177
179
|
speedImpactMS: speedImpactMS,
|
|
178
180
|
speedImpactKmH: speedImpactKmH,
|
|
179
181
|
timeImpact: timeImpact,
|
|
180
|
-
energyImpact: energyImpact
|
|
181
|
-
}
|
|
182
|
+
energyImpact: energyImpact,
|
|
183
|
+
},
|
|
182
184
|
]
|
|
183
|
-
}
|
|
185
|
+
},
|
|
184
186
|
},
|
|
185
187
|
created() {
|
|
186
188
|
this.barItems = JSON.parse(JSON.stringify(this.items))
|
|
@@ -206,42 +208,57 @@ export default {
|
|
|
206
208
|
})
|
|
207
209
|
},
|
|
208
210
|
prevScreen() {
|
|
211
|
+
// go back one screen
|
|
209
212
|
this.screen--
|
|
213
|
+
|
|
214
|
+
// if we just went back to the first screen
|
|
210
215
|
if (this.screen === 1) {
|
|
211
216
|
this.selectedWeight = null
|
|
212
217
|
|
|
213
|
-
|
|
214
|
-
this
|
|
215
|
-
|
|
216
|
-
// update Bar
|
|
217
|
-
this.barItems = JSON.parse(JSON.stringify(this.items)) // Reseting the data back to the original items
|
|
218
|
+
// reset Bar
|
|
219
|
+
this.barItems = JSON.parse(JSON.stringify(this.items))
|
|
218
220
|
|
|
219
221
|
this.$nextTick(() => {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
if (this.$refs.weightCardContainer) {
|
|
223
|
+
this.$refs.weightCardContainer.clearCard()
|
|
224
|
+
|
|
225
|
+
const cardElement =
|
|
226
|
+
this.$refs.weightCardContainer.$el.querySelector(
|
|
227
|
+
'#selectable-cc-card-0',
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
if (cardElement !== null) {
|
|
231
|
+
cardElement.focus()
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// height container may not be in DOM yet, so guard it
|
|
236
|
+
if (this.$refs.heightCardContainer) {
|
|
237
|
+
this.$refs.heightCardContainer.clearCard()
|
|
225
238
|
}
|
|
226
239
|
})
|
|
227
240
|
}
|
|
228
241
|
},
|
|
229
242
|
resetApp() {
|
|
230
|
-
|
|
231
|
-
this
|
|
232
|
-
|
|
233
|
-
// added so that existing values are cleared and not reported to GTM if fired
|
|
234
|
-
//delete this.selectedWeight
|
|
235
|
-
//delete this.selectedHeight
|
|
236
|
-
//delete this.riskPoints[0]
|
|
237
|
-
|
|
243
|
+
// reset state first
|
|
244
|
+
this.selectedWeight = null
|
|
245
|
+
this.selectedHeight = null
|
|
238
246
|
this.screen = 1
|
|
239
247
|
|
|
240
248
|
// reset Bar
|
|
241
|
-
this.barItems = JSON.parse(JSON.stringify(this.items))
|
|
249
|
+
this.barItems = JSON.parse(JSON.stringify(this.items))
|
|
242
250
|
|
|
243
251
|
this.$nextTick(() => {
|
|
244
|
-
|
|
252
|
+
// these refs will only exist when their screen is rendered
|
|
253
|
+
if (this.$refs.weightCardContainer) {
|
|
254
|
+
this.$refs.weightCardContainer.clearCard()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (this.$refs.heightCardContainer) {
|
|
258
|
+
this.$refs.heightCardContainer.clearCard()
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (this.$refs.ffhApp && this.$refs.ffhApp.scrollIntoView) {
|
|
245
262
|
this.$refs.ffhApp.scrollIntoView({ behavior: 'smooth' })
|
|
246
263
|
}
|
|
247
264
|
})
|
|
@@ -265,16 +282,16 @@ export default {
|
|
|
265
282
|
label: labelVar,
|
|
266
283
|
mass: massVar,
|
|
267
284
|
height: heightVar,
|
|
268
|
-
energy: energyVar
|
|
285
|
+
energy: energyVar,
|
|
269
286
|
}
|
|
270
287
|
// fire the event
|
|
271
288
|
this.$gtm.push({
|
|
272
289
|
event: 'custom.interaction.droppedobject.click',
|
|
273
|
-
...attrs
|
|
290
|
+
...attrs,
|
|
274
291
|
})
|
|
275
292
|
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
293
|
+
},
|
|
294
|
+
},
|
|
278
295
|
}
|
|
279
296
|
</script>
|
|
280
297
|
|