@worksafevictoria/wcl7.5 1.17.0-beta.6 → 1.17.0-beta.8
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
CHANGED
|
@@ -351,6 +351,7 @@ import CtaButton from '../../SubComponents/CtaButton/index.vue'
|
|
|
351
351
|
import chevronIcon from '../../../assets/icons/caret-right.svg?url'
|
|
352
352
|
import { ref } from "vue";
|
|
353
353
|
|
|
354
|
+
|
|
354
355
|
export default {
|
|
355
356
|
setup() {
|
|
356
357
|
const show = ref(false);
|
|
@@ -613,7 +614,7 @@ export default {
|
|
|
613
614
|
},
|
|
614
615
|
|
|
615
616
|
showMobileMenu() {
|
|
616
|
-
|
|
617
|
+
// Reset screen to top to fix whitespace issues
|
|
617
618
|
if (window) {
|
|
618
619
|
window.scrollTo(0, 0)
|
|
619
620
|
}
|
|
@@ -776,7 +777,13 @@ export default {
|
|
|
776
777
|
.getElementsByTagName('a')[0]
|
|
777
778
|
.setAttribute('aria-expanded', 'false')
|
|
778
779
|
this.isSecondLevelOpen = false
|
|
780
|
+
this.closeMegaMenu()
|
|
781
|
+
this.$nextTick(() => {
|
|
782
|
+
this.showMobileMenu()
|
|
783
|
+
})
|
|
784
|
+
|
|
779
785
|
}
|
|
786
|
+
|
|
780
787
|
},
|
|
781
788
|
searchFocus(index, length, event) {
|
|
782
789
|
if (index === length - 1 && this.isMobileMenuOpen && !event.shiftKey) {
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
margin-left: 10px;
|
|
187
187
|
|
|
188
188
|
span {
|
|
189
|
-
color: $app-
|
|
189
|
+
color: $app-menu-white;
|
|
190
190
|
font-size: 18px !important;
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
border-bottom: none;
|
|
249
249
|
|
|
250
250
|
span {
|
|
251
|
-
color: $app-
|
|
251
|
+
color: $app-menu-white;
|
|
252
252
|
|
|
253
253
|
&:hover,
|
|
254
254
|
&:focus {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
convertStringWithDotNotationToObject,
|
|
3
3
|
generateUniqueId,
|
|
4
|
-
isEmpty
|
|
4
|
+
isEmpty,
|
|
5
5
|
} from '../models/form-utils'
|
|
6
6
|
|
|
7
7
|
export function parseElementStates(webformElement) {
|
|
@@ -75,17 +75,38 @@ function ruleToString(rule) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
function ruleItemToString(ruleItem, itemKey) {
|
|
78
|
-
|
|
79
|
-
const
|
|
78
|
+
// Regex 1: Matches standard selectors (name="foo"). Captures 'foo'.
|
|
79
|
+
const standardMatch = itemKey.match(/name="([^"]+)"/)
|
|
80
|
+
// Regex 2: Matches array selectors (name="foo[bar]"). Captures 'foo' and 'bar'.
|
|
81
|
+
const arrayMatch = itemKey.match(/name="([^"]+)\[([^\]]+)\]"/)
|
|
82
|
+
|
|
83
|
+
let formComponentID = null // The Formio component key (e.g., 'checkboxes')
|
|
84
|
+
let checkboxOptionKey = null // The specific option key (e.g., 'foo bar')
|
|
85
|
+
|
|
86
|
+
if (arrayMatch && arrayMatch[1] && arrayMatch[2]) {
|
|
87
|
+
// Array Notation found (e.g., name="checkboxes[foo bar]")
|
|
88
|
+
formComponentID = arrayMatch[1]
|
|
89
|
+
checkboxOptionKey = arrayMatch[2]
|
|
90
|
+
} else if (standardMatch && standardMatch[1]) {
|
|
91
|
+
// Standard Notation found (e.g., name="foobar")
|
|
92
|
+
formComponentID = standardMatch[1]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// ... (rest of the function)
|
|
96
|
+
|
|
97
|
+
// Now pass BOTH keys to getTrigger for array-based lookups
|
|
80
98
|
const conditions = Object.keys(ruleItem)
|
|
81
99
|
.map((elementProp) =>
|
|
82
|
-
|
|
100
|
+
formComponentID
|
|
101
|
+
? getTrigger(formComponentID, ruleItem, elementProp, checkboxOptionKey)
|
|
102
|
+
: null,
|
|
83
103
|
)
|
|
84
104
|
.filter((trigger) => !!trigger)
|
|
85
105
|
.reduce((triggers, trigger) => {
|
|
86
106
|
triggers.push(trigger)
|
|
87
107
|
return triggers
|
|
88
108
|
}, [])
|
|
109
|
+
|
|
89
110
|
return conditions.join('')
|
|
90
111
|
}
|
|
91
112
|
|
|
@@ -95,7 +116,7 @@ function createNewLogic(actionName, actionValue) {
|
|
|
95
116
|
convertStringWithDotNotationToObject(
|
|
96
117
|
defaultProps,
|
|
97
118
|
actionName,
|
|
98
|
-
!!!actionValue
|
|
119
|
+
!!!actionValue,
|
|
99
120
|
)
|
|
100
121
|
} else {
|
|
101
122
|
defaultProps[actionName] = !!!actionValue
|
|
@@ -104,7 +125,7 @@ function createNewLogic(actionName, actionValue) {
|
|
|
104
125
|
name: generateUniqueId(),
|
|
105
126
|
trigger: {
|
|
106
127
|
type: 'javascript',
|
|
107
|
-
javascript: ''
|
|
128
|
+
javascript: '',
|
|
108
129
|
},
|
|
109
130
|
defaultProps,
|
|
110
131
|
actions: [
|
|
@@ -114,20 +135,31 @@ function createNewLogic(actionName, actionValue) {
|
|
|
114
135
|
property: {
|
|
115
136
|
label: generateUniqueId(),
|
|
116
137
|
value: actionName,
|
|
117
|
-
type: 'boolean'
|
|
138
|
+
type: 'boolean',
|
|
118
139
|
},
|
|
119
|
-
state: actionValue
|
|
120
|
-
}
|
|
121
|
-
]
|
|
140
|
+
state: actionValue,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
122
143
|
}
|
|
123
144
|
}
|
|
124
145
|
|
|
125
|
-
function getTrigger(
|
|
146
|
+
function getTrigger(formComponentID, ruleItem, prop, checkboxOptionKey = null) {
|
|
126
147
|
if (ruleItem.hasOwnProperty(prop)) {
|
|
127
148
|
const value = ruleItem[prop] ?? ''
|
|
149
|
+
|
|
150
|
+
let variable = `data.{${formComponentID}}`
|
|
151
|
+
console.log('🚀 ~ getTrigger ~ variable:', variable)
|
|
128
152
|
let valueDelimeter = typeof value === 'string' ? "'" : ''
|
|
129
153
|
let expression = `${valueDelimeter}${value}${valueDelimeter}`
|
|
130
|
-
|
|
154
|
+
|
|
155
|
+
if (checkboxOptionKey && prop === 'checked' && value === true) {
|
|
156
|
+
return `(${variable}['${checkboxOptionKey}']===true)`
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (checkboxOptionKey && prop === 'unchecked' && value === true) {
|
|
160
|
+
return `(!(${variable}['${checkboxOptionKey}']===true))`
|
|
161
|
+
}
|
|
162
|
+
|
|
131
163
|
if (typeof value !== 'object' && prop === 'value') {
|
|
132
164
|
return `${variable} === ${expression}`
|
|
133
165
|
} else if (typeof value === 'object' && prop === 'value') {
|