@worksafevictoria/wcl7.5 1.2.0 → 1.2.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/.env +1 -3
- package/package.json +2 -2
- package/src/components/Containers/HomepageHeader/index.vue +25 -11
- package/src/components/Containers/Subheader/index.vue +17 -17
- package/src/components/Global/AppHeader/index.vue +52 -54
- package/src/components/Global/Cookies/index.vue +134 -141
- package/src/components/Global/GlobalNotice/index.vue +23 -2
- package/src/components/Global/HeroHeader/index.vue +33 -31
- package/src/components/Paragraphs/BrowseContent/index.vue +45 -31
- package/src/components/Paragraphs/Directory/index.vue +38 -27
- package/src/components/Paragraphs/TabulatedData/index.stories.js +5 -5
- package/src/components/Paragraphs/TabulatedData/index.vue +57 -34
- package/src/components/SubComponents/FormInstance/models/overrides/address.js +21 -12
- package/src/components/SubComponents/FormInstance/tests/address.test.js +48 -48
- package/src/components/SubComponents/ResourceGroup/index.vue +194 -170
- package/vite.config.js +28 -16
|
@@ -47,63 +47,70 @@ export default {
|
|
|
47
47
|
components: {
|
|
48
48
|
CardGroup,
|
|
49
49
|
DirectoryFilters,
|
|
50
|
-
Switcher
|
|
50
|
+
Switcher,
|
|
51
51
|
},
|
|
52
52
|
props: {
|
|
53
53
|
background: {
|
|
54
54
|
type: String,
|
|
55
|
-
default: 'grey'
|
|
55
|
+
default: 'grey',
|
|
56
56
|
},
|
|
57
57
|
title: {
|
|
58
58
|
type: String,
|
|
59
|
-
default: ''
|
|
59
|
+
default: '',
|
|
60
60
|
},
|
|
61
61
|
titleTag: {
|
|
62
62
|
type: String,
|
|
63
|
-
default: 'h2'
|
|
63
|
+
default: 'h2',
|
|
64
64
|
},
|
|
65
65
|
bundle: {
|
|
66
66
|
type: Array,
|
|
67
|
-
default: () => ['']
|
|
67
|
+
default: () => [''],
|
|
68
68
|
},
|
|
69
69
|
columns: {
|
|
70
70
|
type: Number,
|
|
71
|
-
default: 0
|
|
71
|
+
default: 0,
|
|
72
72
|
},
|
|
73
73
|
initialDisplyLimit: {
|
|
74
74
|
type: Number,
|
|
75
|
-
default: 0
|
|
75
|
+
default: 0,
|
|
76
76
|
},
|
|
77
77
|
fetchContent: {
|
|
78
78
|
type: Function,
|
|
79
|
-
required: true
|
|
79
|
+
required: true,
|
|
80
80
|
},
|
|
81
81
|
fetchFilters: {
|
|
82
82
|
type: Function,
|
|
83
83
|
required: false,
|
|
84
|
-
default: null
|
|
84
|
+
default: null,
|
|
85
85
|
},
|
|
86
86
|
enableBundleFilter: {
|
|
87
|
-
type: Boolean
|
|
87
|
+
type: Boolean,
|
|
88
88
|
},
|
|
89
89
|
getBundleAlias: {
|
|
90
90
|
type: Function,
|
|
91
91
|
required: false,
|
|
92
|
-
default: null
|
|
92
|
+
default: null,
|
|
93
93
|
},
|
|
94
94
|
showMore: {
|
|
95
|
-
type: Boolean
|
|
95
|
+
type: Boolean,
|
|
96
96
|
},
|
|
97
97
|
type: {
|
|
98
98
|
type: String,
|
|
99
|
-
required: true
|
|
100
|
-
}
|
|
99
|
+
required: true,
|
|
100
|
+
},
|
|
101
101
|
},
|
|
102
|
-
|
|
102
|
+
// Temp use of mounted to replace fetch
|
|
103
|
+
async mounted() {
|
|
103
104
|
if (this.displayedCards.length === 0) {
|
|
104
105
|
await this.loadFiltersAndContent()
|
|
105
106
|
}
|
|
106
107
|
},
|
|
108
|
+
// TODO useAsyncData <script setup>
|
|
109
|
+
// async fetch() {
|
|
110
|
+
// if (this.displayedCards.length === 0) {
|
|
111
|
+
// await this.loadFiltersAndContent()
|
|
112
|
+
// }
|
|
113
|
+
// },
|
|
107
114
|
data() {
|
|
108
115
|
return {
|
|
109
116
|
hasMorePages: false,
|
|
@@ -115,8 +122,8 @@ export default {
|
|
|
115
122
|
filters: {
|
|
116
123
|
taxonomies: [],
|
|
117
124
|
selected: {},
|
|
118
|
-
availableBundles: []
|
|
119
|
-
}
|
|
125
|
+
availableBundles: [],
|
|
126
|
+
},
|
|
120
127
|
}
|
|
121
128
|
},
|
|
122
129
|
fetchOnServer: true,
|
|
@@ -125,13 +132,13 @@ export default {
|
|
|
125
132
|
async loadFiltersAndContent() {
|
|
126
133
|
await Promise.all([
|
|
127
134
|
this.fetchFilters ? this.loadFilters() : Promise.resolve(),
|
|
128
|
-
this.loadMoreCards(true)
|
|
135
|
+
this.loadMoreCards(true),
|
|
129
136
|
])
|
|
130
137
|
},
|
|
131
138
|
init() {
|
|
132
139
|
this.allCards = {
|
|
133
140
|
total: 0,
|
|
134
|
-
cards: []
|
|
141
|
+
cards: [],
|
|
135
142
|
}
|
|
136
143
|
this.displayLimit = 0
|
|
137
144
|
this.hasMorePages = false
|
|
@@ -144,8 +151,8 @@ export default {
|
|
|
144
151
|
if (shouldMakeNewFetchCall) {
|
|
145
152
|
const cardBundles = await Promise.all(
|
|
146
153
|
bundles.map((bundle, index) =>
|
|
147
|
-
this.getBundle(bundle, addMoreBy, index)
|
|
148
|
-
)
|
|
154
|
+
this.getBundle(bundle, addMoreBy, index),
|
|
155
|
+
),
|
|
149
156
|
)
|
|
150
157
|
allCards = this.getShuffledCards(cardBundles)
|
|
151
158
|
|
|
@@ -159,8 +166,12 @@ export default {
|
|
|
159
166
|
return allCards
|
|
160
167
|
},
|
|
161
168
|
async loadMoreCards(init) {
|
|
169
|
+
// Preference pinia
|
|
162
170
|
const attrs = {
|
|
163
|
-
group: this.$
|
|
171
|
+
group: this.$pinia?.state?.value?.page?.content?.title
|
|
172
|
+
? this.$pinia?.state?.value?.page?.content?.title
|
|
173
|
+
: this.$store?.state?.page?.content?.title,
|
|
174
|
+
// group: this.$store?.state?.page?.content?.title ? this.$store?.state?.page?.content?.title : this.$pinia?.state?.page?.content?.title
|
|
164
175
|
}
|
|
165
176
|
if (this.$gtm && !init) {
|
|
166
177
|
this.$gtm.push({ event: 'custom.interaction.showmore.click', ...attrs })
|
|
@@ -179,7 +190,7 @@ export default {
|
|
|
179
190
|
this.displayedCards,
|
|
180
191
|
this.allCards,
|
|
181
192
|
addMoreBy,
|
|
182
|
-
bundles
|
|
193
|
+
bundles,
|
|
183
194
|
)
|
|
184
195
|
this.hasMorePages = this.allCards.total > this.allCards.cards.length
|
|
185
196
|
this.displayedCards = this.allCards.cards.slice(0, this.displayLimit)
|
|
@@ -191,11 +202,11 @@ export default {
|
|
|
191
202
|
const cache = (this.bundleCache[bundle] = this.bundleCache[bundle] || {
|
|
192
203
|
response: {
|
|
193
204
|
results: [],
|
|
194
|
-
numFound: 0
|
|
205
|
+
numFound: 0,
|
|
195
206
|
},
|
|
196
207
|
qs: {
|
|
197
|
-
start
|
|
198
|
-
}
|
|
208
|
+
start,
|
|
209
|
+
},
|
|
199
210
|
})
|
|
200
211
|
|
|
201
212
|
if (cache.qs.start === undefined) {
|
|
@@ -209,7 +220,7 @@ export default {
|
|
|
209
220
|
const qs = {
|
|
210
221
|
bundle,
|
|
211
222
|
rows,
|
|
212
|
-
start
|
|
223
|
+
start,
|
|
213
224
|
}
|
|
214
225
|
return this.fetchContent(qs, this.filters.selected, index).then(
|
|
215
226
|
(response) => {
|
|
@@ -217,14 +228,14 @@ export default {
|
|
|
217
228
|
cache.response.numFound = response.numFound
|
|
218
229
|
cache.response.results.push(...response.results)
|
|
219
230
|
return cache.response
|
|
220
|
-
}
|
|
231
|
+
},
|
|
221
232
|
)
|
|
222
233
|
},
|
|
223
234
|
getShuffledCards(cardBundles) {
|
|
224
235
|
const shuffled = []
|
|
225
236
|
const bundleWithMostCards = cardBundles.reduce(
|
|
226
237
|
(a, b) => (a.results.length > b.results.length ? a : b),
|
|
227
|
-
{ results: [] }
|
|
238
|
+
{ results: [] },
|
|
228
239
|
).results.length
|
|
229
240
|
|
|
230
241
|
for (let i = 0; i < bundleWithMostCards; i++) {
|
|
@@ -273,8 +284,8 @@ export default {
|
|
|
273
284
|
return new Date(b.dateSort) - new Date(a.dateSort)
|
|
274
285
|
})
|
|
275
286
|
return sorted
|
|
276
|
-
}
|
|
277
|
-
}
|
|
287
|
+
},
|
|
288
|
+
},
|
|
278
289
|
}
|
|
279
290
|
</script>
|
|
280
291
|
<style lang="scss" scoped>
|
|
@@ -283,14 +294,17 @@ export default {
|
|
|
283
294
|
align-items: flex-end;
|
|
284
295
|
place-content: flex-end;
|
|
285
296
|
}
|
|
297
|
+
|
|
286
298
|
&.card_group__card--col-4 {
|
|
287
299
|
:deep(.card-grid__column .card-grid-item__description) {
|
|
288
300
|
display: none;
|
|
289
301
|
}
|
|
290
302
|
}
|
|
303
|
+
|
|
291
304
|
:deep(.card_group__card--blue .card_item__desc p) {
|
|
292
305
|
margin-top: 12px;
|
|
293
306
|
}
|
|
307
|
+
|
|
294
308
|
:deep(.card_group__card--red .card_item__desc p) {
|
|
295
309
|
margin-top: 12px;
|
|
296
310
|
}
|
|
@@ -62,30 +62,40 @@ export default {
|
|
|
62
62
|
Records,
|
|
63
63
|
Pagination,
|
|
64
64
|
Loading,
|
|
65
|
-
SectionGroup
|
|
65
|
+
SectionGroup,
|
|
66
66
|
},
|
|
67
67
|
props: {
|
|
68
68
|
options: {
|
|
69
69
|
type: Object,
|
|
70
|
-
default: () => {}
|
|
70
|
+
default: () => {},
|
|
71
71
|
},
|
|
72
72
|
fetchFilters: {
|
|
73
73
|
type: Function,
|
|
74
|
-
required: true
|
|
74
|
+
required: true,
|
|
75
75
|
},
|
|
76
76
|
fetchRecords: {
|
|
77
77
|
type: Function,
|
|
78
|
-
required: true
|
|
79
|
-
}
|
|
78
|
+
required: true,
|
|
79
|
+
},
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
// Temp use of mounted to replace fetch
|
|
82
|
+
async mounted() {
|
|
82
83
|
await this.loadFilters(
|
|
83
|
-
this.DIR_CONFIG[this.options.field_directory_type].taxonomies
|
|
84
|
+
this.DIR_CONFIG[this.options.field_directory_type].taxonomies,
|
|
84
85
|
)
|
|
85
86
|
this.loadSortOptions(
|
|
86
|
-
this.DIR_CONFIG[this.options.field_directory_type].sorting
|
|
87
|
+
this.DIR_CONFIG[this.options.field_directory_type].sorting,
|
|
87
88
|
)
|
|
88
89
|
},
|
|
90
|
+
// TODO useAsyncData <script setup>
|
|
91
|
+
// async fetch() {
|
|
92
|
+
// await this.loadFilters(
|
|
93
|
+
// this.DIR_CONFIG[this.options.field_directory_type].taxonomies
|
|
94
|
+
// )
|
|
95
|
+
// this.loadSortOptions(
|
|
96
|
+
// this.DIR_CONFIG[this.options.field_directory_type].sorting
|
|
97
|
+
// )
|
|
98
|
+
// },
|
|
89
99
|
fetchOnServer: true,
|
|
90
100
|
fetchKey: 'ws-directory',
|
|
91
101
|
data() {
|
|
@@ -93,25 +103,25 @@ export default {
|
|
|
93
103
|
DIR_CONFIG,
|
|
94
104
|
filters: {
|
|
95
105
|
taxonomies: [],
|
|
96
|
-
sorting: []
|
|
106
|
+
sorting: [],
|
|
97
107
|
},
|
|
98
108
|
selectedFilters: {},
|
|
99
109
|
qs: {
|
|
100
110
|
record_type: this.options.field_directory_type,
|
|
101
111
|
rows: this.options.field_directory_rows,
|
|
102
112
|
start: 0,
|
|
103
|
-
...this.defaultSortOrderOption(this.options.field_directory_type)
|
|
113
|
+
...this.defaultSortOrderOption(this.options.field_directory_type),
|
|
104
114
|
},
|
|
105
115
|
records: [],
|
|
106
116
|
total: 0,
|
|
107
|
-
loading: true
|
|
117
|
+
loading: true,
|
|
108
118
|
}
|
|
109
119
|
},
|
|
110
120
|
computed: {
|
|
111
121
|
apiUrl() {
|
|
112
122
|
return Object.keys(this.qs)
|
|
113
123
|
.map(
|
|
114
|
-
(k) => `${encodeURIComponent(k)}=${encodeURIComponent(this.qs[k])}
|
|
124
|
+
(k) => `${encodeURIComponent(k)}=${encodeURIComponent(this.qs[k])}`,
|
|
115
125
|
)
|
|
116
126
|
.join('&')
|
|
117
127
|
},
|
|
@@ -137,7 +147,7 @@ export default {
|
|
|
137
147
|
return this.qs.lat && this.qs.lon
|
|
138
148
|
? { lat: this.qs.lat, lng: this.qs.lon }
|
|
139
149
|
: false
|
|
140
|
-
}
|
|
150
|
+
},
|
|
141
151
|
},
|
|
142
152
|
watch: {
|
|
143
153
|
apiUrl: {
|
|
@@ -145,7 +155,7 @@ export default {
|
|
|
145
155
|
deep: false,
|
|
146
156
|
handler() {
|
|
147
157
|
this.getData()
|
|
148
|
-
}
|
|
158
|
+
},
|
|
149
159
|
},
|
|
150
160
|
selectedFilters: {
|
|
151
161
|
immediate: false,
|
|
@@ -171,7 +181,7 @@ export default {
|
|
|
171
181
|
this.qs.order = this.selectedFilters.sorting.order.value
|
|
172
182
|
} else {
|
|
173
183
|
const sortOrderDefaults = this.defaultSortOrderOption(
|
|
174
|
-
this.qs.record_type
|
|
184
|
+
this.qs.record_type,
|
|
175
185
|
)
|
|
176
186
|
this.qs.sort = sortOrderDefaults.sort
|
|
177
187
|
this.qs.order = sortOrderDefaults.order
|
|
@@ -204,8 +214,8 @@ export default {
|
|
|
204
214
|
this.$delete(this.qs, 'lat')
|
|
205
215
|
this.$delete(this.qs, 'lon')
|
|
206
216
|
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
217
|
+
},
|
|
218
|
+
},
|
|
209
219
|
},
|
|
210
220
|
methods: {
|
|
211
221
|
async getData() {
|
|
@@ -223,25 +233,25 @@ export default {
|
|
|
223
233
|
const taxonomies = await this.fetchFilters(
|
|
224
234
|
taxonomy.id,
|
|
225
235
|
taxonomy.record_id,
|
|
226
|
-
taxonomy.name
|
|
236
|
+
taxonomy.name,
|
|
227
237
|
)
|
|
228
238
|
this.filters.taxonomies.push(taxonomies)
|
|
229
239
|
return Promise.resolve(taxonomies)
|
|
230
|
-
})
|
|
240
|
+
}),
|
|
231
241
|
)
|
|
232
242
|
},
|
|
233
243
|
loadSortOptions(sortingList) {
|
|
234
244
|
let opts = {
|
|
235
245
|
name: 'order',
|
|
236
246
|
title: 'Sort by',
|
|
237
|
-
terms: []
|
|
247
|
+
terms: [],
|
|
238
248
|
}
|
|
239
249
|
sortingList.forEach((sortOption) => {
|
|
240
250
|
opts.terms.push({
|
|
241
251
|
title: sortOption.label,
|
|
242
252
|
value: sortOption.order,
|
|
243
253
|
field: sortOption.field,
|
|
244
|
-
parent: sortOption.type
|
|
254
|
+
parent: sortOption.type,
|
|
245
255
|
})
|
|
246
256
|
})
|
|
247
257
|
this.filters.sorting.push(opts)
|
|
@@ -252,7 +262,7 @@ export default {
|
|
|
252
262
|
} else {
|
|
253
263
|
return {
|
|
254
264
|
sort: 'record_title',
|
|
255
|
-
order: 'asc'
|
|
265
|
+
order: 'asc',
|
|
256
266
|
}
|
|
257
267
|
}
|
|
258
268
|
},
|
|
@@ -301,14 +311,14 @@ export default {
|
|
|
301
311
|
|
|
302
312
|
window.scrollTo({
|
|
303
313
|
top,
|
|
304
|
-
behavior: 'smooth'
|
|
314
|
+
behavior: 'smooth',
|
|
305
315
|
})
|
|
306
316
|
}
|
|
307
317
|
},
|
|
308
318
|
resetSortLabels() {
|
|
309
319
|
this.filters.sorting = []
|
|
310
320
|
this.loadSortOptions(
|
|
311
|
-
this.DIR_CONFIG[this.options.field_directory_type].sorting
|
|
321
|
+
this.DIR_CONFIG[this.options.field_directory_type].sorting,
|
|
312
322
|
)
|
|
313
323
|
},
|
|
314
324
|
resetSearchFilters() {
|
|
@@ -317,15 +327,16 @@ export default {
|
|
|
317
327
|
record_type: this.options.field_directory_type,
|
|
318
328
|
rows: this.options.field_directory_rows,
|
|
319
329
|
start: 0,
|
|
320
|
-
...this.defaultSortOrderOption(this.options.field_directory_type)
|
|
330
|
+
...this.defaultSortOrderOption(this.options.field_directory_type),
|
|
321
331
|
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
332
|
+
},
|
|
333
|
+
},
|
|
324
334
|
}
|
|
325
335
|
</script>
|
|
326
336
|
|
|
327
337
|
<style lang="scss" scoped>
|
|
328
338
|
@import '../../../includes/scss/all';
|
|
339
|
+
|
|
329
340
|
.paragraph--directory {
|
|
330
341
|
&__loading-container {
|
|
331
342
|
min-height: 250px;
|
|
@@ -11,14 +11,14 @@ export default {
|
|
|
11
11
|
fields,
|
|
12
12
|
fieldsAr,
|
|
13
13
|
items,
|
|
14
|
-
itemsAr
|
|
14
|
+
itemsAr,
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
argTypes: {
|
|
18
18
|
isFixedWidth: {
|
|
19
19
|
control: 'boolean',
|
|
20
|
-
table: { disable: true }
|
|
21
|
-
}
|
|
20
|
+
table: { disable: true },
|
|
21
|
+
},
|
|
22
22
|
},
|
|
23
23
|
args: {
|
|
24
24
|
rtl: false,
|
|
@@ -28,13 +28,13 @@ export default {
|
|
|
28
28
|
fields: fields.links,
|
|
29
29
|
rtlFields: fieldsAr.links,
|
|
30
30
|
caption: 'The table caption',
|
|
31
|
-
|
|
31
|
+
sortBy: 'rank',
|
|
32
32
|
},
|
|
33
33
|
template: `<tabulated-data
|
|
34
34
|
v-bind="args"
|
|
35
35
|
:items="rtl ? args.rtlItems : args.items"
|
|
36
36
|
:fields="rtl ? args.rtlFields : args.fields"
|
|
37
|
-
/>
|
|
37
|
+
/> `,
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export const Default = {}
|
|
@@ -7,23 +7,43 @@
|
|
|
7
7
|
<div :class="isFluid ? 'table-scrolled' : ''">
|
|
8
8
|
<b-table
|
|
9
9
|
v-if="items"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
:items="items"
|
|
11
|
+
:fields="fields"
|
|
12
|
+
:class="`${rtl ? 'rtl' : ''} ${isFluid ? 'isScrolled' : ''}`"
|
|
13
|
+
class="table border"
|
|
14
|
+
:striped="true"
|
|
15
|
+
:sort-by="newSortBy"
|
|
16
|
+
:borderless="false"
|
|
17
|
+
:responsive="!isFluid"
|
|
18
|
+
:stacked="!isFluid ? 'sm' : false"
|
|
19
19
|
>
|
|
20
20
|
<template #head()="data">
|
|
21
|
-
<span
|
|
21
|
+
<span
|
|
22
|
+
class="iconHeader table-active"
|
|
23
|
+
tabindex="0"
|
|
24
|
+
@keypress.enter="accessSort(data.field)"
|
|
25
|
+
scope="colgroup"
|
|
26
|
+
>
|
|
22
27
|
{{ data.label }}
|
|
23
28
|
<span class="sortImg" v-if="data.field.sortable">
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
<img
|
|
30
|
+
v-if="data.field.thAttr['aria-sort'] === 'none'"
|
|
31
|
+
:src="sortIconNeutral"
|
|
32
|
+
alt="image indicating no sort"
|
|
33
|
+
style="width: 0.55rem; height: 0.9rem"
|
|
34
|
+
/>
|
|
35
|
+
<img
|
|
36
|
+
v-if="data.field.thAttr['aria-sort'] === 'ascending'"
|
|
37
|
+
:src="sortIconAsc"
|
|
38
|
+
alt="image indicating ascending sort"
|
|
39
|
+
style="width: 0.55rem; height: 0.9rem"
|
|
40
|
+
/>
|
|
41
|
+
<img
|
|
42
|
+
v-else-if="data.field.thAttr['aria-sort'] === 'descending'"
|
|
43
|
+
:src="sortIconDesc"
|
|
44
|
+
alt="image indicating descending sort"
|
|
45
|
+
style="width: 0.55rem; height: 0.9rem"
|
|
46
|
+
/>
|
|
27
47
|
</span>
|
|
28
48
|
</span>
|
|
29
49
|
</template>
|
|
@@ -42,64 +62,67 @@ import { BTable } from 'bootstrap-vue-next'
|
|
|
42
62
|
|
|
43
63
|
export default {
|
|
44
64
|
name: 'TabulatedData',
|
|
45
|
-
components: { SectionGroup, RichText, BTable},
|
|
65
|
+
components: { SectionGroup, RichText, BTable },
|
|
46
66
|
props: {
|
|
47
67
|
items: {
|
|
48
68
|
type: Array,
|
|
49
|
-
required: true
|
|
69
|
+
required: true,
|
|
50
70
|
},
|
|
51
71
|
fields: {
|
|
52
72
|
type: Array,
|
|
53
|
-
default: undefined
|
|
73
|
+
default: undefined,
|
|
54
74
|
},
|
|
55
75
|
rtl: {
|
|
56
76
|
type: Boolean,
|
|
57
|
-
default: false
|
|
77
|
+
default: false,
|
|
58
78
|
},
|
|
59
79
|
isFixedWidth: {
|
|
60
80
|
type: Boolean,
|
|
61
|
-
default: false
|
|
81
|
+
default: false,
|
|
62
82
|
},
|
|
63
83
|
caption: {
|
|
64
84
|
type: String,
|
|
65
85
|
default: '',
|
|
66
|
-
required: false
|
|
86
|
+
required: false,
|
|
67
87
|
},
|
|
68
|
-
|
|
88
|
+
sortBy: {
|
|
69
89
|
type: String,
|
|
70
90
|
default: undefined,
|
|
71
|
-
required: false
|
|
72
|
-
}
|
|
91
|
+
required: false,
|
|
92
|
+
},
|
|
73
93
|
},
|
|
74
94
|
data() {
|
|
75
95
|
return {
|
|
76
|
-
|
|
96
|
+
newSortBy: this.sortBy ? [{ key: this.sortBy, order: 'asc' }] : [],
|
|
77
97
|
//sortDesc: false,
|
|
78
98
|
sortIconNeutral:
|
|
79
99
|
"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' view-box='0 0 101 101' preserveAspectRatio='none'%3e%3cpath fill='black' opacity='.3' d='M51 1l25 23 24 22H1l25-22zM51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e",
|
|
80
100
|
sortIconDesc:
|
|
81
101
|
"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' view-box='0 0 101 101' preserveAspectRatio='none'%3e%3cpath fill='black' d='M51 1l25 23 24 22H1l25-22z'/%3e%3cpath fill='black' opacity='.3' d='M51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e",
|
|
82
102
|
sortIconAsc:
|
|
83
|
-
"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' view-box='0 0 101 101' preserveAspectRatio='none'%3e%3cpath fill='black' opacity='.3' d='M51 1l25 23 24 22H1l25-22z'/%3e%3cpath fill='black' d='M51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e"
|
|
103
|
+
"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='101' height='101' view-box='0 0 101 101' preserveAspectRatio='none'%3e%3cpath fill='black' opacity='.3' d='M51 1l25 23 24 22H1l25-22z'/%3e%3cpath fill='black' d='M51 101l25-23 24-22H1l25 22z'/%3e%3c/svg%3e",
|
|
84
104
|
}
|
|
85
105
|
},
|
|
86
106
|
computed: {
|
|
87
107
|
isFluid() {
|
|
88
108
|
return this.isFixedWidth
|
|
89
|
-
}
|
|
109
|
+
},
|
|
90
110
|
},
|
|
91
111
|
methods: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (
|
|
95
|
-
|
|
112
|
+
accessSort(fieldVar) {
|
|
113
|
+
//this.sortBy = fieldVar.key
|
|
114
|
+
if (
|
|
115
|
+
fieldVar.thAttr['aria-sort'] === 'none' ||
|
|
116
|
+
fieldVar.thAttr['aria-sort'] === 'descending'
|
|
117
|
+
) {
|
|
118
|
+
this.newSortBy = [{ key: fieldVar.key, order: 'asc' }]
|
|
96
119
|
//this.sortDesc = false
|
|
97
120
|
} else {
|
|
98
|
-
this.
|
|
121
|
+
this.newSortBy = [{ key: fieldVar.key, order: 'desc' }]
|
|
99
122
|
//this.sortDesc = true
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
},
|
|
103
126
|
}
|
|
104
127
|
</script>
|
|
105
128
|
|
|
@@ -144,7 +167,7 @@ export default {
|
|
|
144
167
|
}
|
|
145
168
|
|
|
146
169
|
.b-table-sortable-column svg {
|
|
147
|
-
display:none;
|
|
170
|
+
display: none;
|
|
148
171
|
}
|
|
149
172
|
}
|
|
150
173
|
</style>
|
|
@@ -26,7 +26,8 @@ export class AddresseFormElement extends BaseFormElement {
|
|
|
26
26
|
key,
|
|
27
27
|
type: 'textfield',
|
|
28
28
|
input: true,
|
|
29
|
-
customConditional:
|
|
29
|
+
customConditional:
|
|
30
|
+
"show = _.get(instance, 'parent.manualMode', false);",
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -40,23 +41,27 @@ export class AddresseFormElement extends BaseFormElement {
|
|
|
40
41
|
|
|
41
42
|
getCustomProperties() {
|
|
42
43
|
const autoCompletePath = '/places/api/v1/place/autocomplete/json'
|
|
43
|
-
|
|
44
|
+
// Uses WorkSafe PROD API for storybook site (ensure site is white listed)
|
|
45
|
+
const baseUrl =
|
|
46
|
+
window.origin.toLowerCase().indexOf('worksafe') === -1
|
|
47
|
+
? 'https://www.worksafe.vic.gov.au'
|
|
48
|
+
: window.origin
|
|
44
49
|
return {
|
|
45
50
|
provider: 'custom',
|
|
46
51
|
enableManualMode: this.webformElement['#flexbox'] !== '0',
|
|
47
52
|
providerOptions: {
|
|
48
53
|
params: {
|
|
49
54
|
types: this.isFullAddressSearch() ? 'address' : '(regions)',
|
|
50
|
-
components: 'country:au'
|
|
55
|
+
components: 'country:au',
|
|
51
56
|
},
|
|
52
57
|
url: `${baseUrl}${autoCompletePath}`,
|
|
53
58
|
queryProperty: 'input',
|
|
54
59
|
displayValueProperty: 'description',
|
|
55
|
-
responseProperty: 'predictions'
|
|
60
|
+
responseProperty: 'predictions',
|
|
56
61
|
},
|
|
57
62
|
switchToManualModeLabel: "Can't find address? Switch to manual mode.",
|
|
58
63
|
input: true,
|
|
59
|
-
components: this.getManualFields()
|
|
64
|
+
components: this.getManualFields(),
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
|
|
@@ -70,7 +75,7 @@ export class AddresseFormElement extends BaseFormElement {
|
|
|
70
75
|
if (isAutoComplete) {
|
|
71
76
|
const getVal = (key) =>
|
|
72
77
|
value?.geocode?.address_components.find(
|
|
73
|
-
(item) => item?.types?.[0] === key
|
|
78
|
+
(item) => item?.types?.[0] === key,
|
|
74
79
|
)?.long_name
|
|
75
80
|
const address1 = getComponents('address')
|
|
76
81
|
const city = getComponents('city')
|
|
@@ -84,12 +89,12 @@ export class AddresseFormElement extends BaseFormElement {
|
|
|
84
89
|
[city?.key]: getVal('locality'),
|
|
85
90
|
[state?.key]: getVal('administrative_area_level_1'),
|
|
86
91
|
[postcode?.key]: getVal('postal_code'),
|
|
87
|
-
[country?.key]: getVal('country')
|
|
88
|
-
}
|
|
92
|
+
[country?.key]: getVal('country'),
|
|
93
|
+
},
|
|
89
94
|
}
|
|
90
95
|
} else if (value.mode === 'manual') {
|
|
91
96
|
return {
|
|
92
|
-
[this.getKey()]: value.address
|
|
97
|
+
[this.getKey()]: value.address,
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
}
|
|
@@ -106,7 +111,11 @@ export class AddresseFormElement extends BaseFormElement {
|
|
|
106
111
|
value.geocode.formatted_address !== value.address.description)
|
|
107
112
|
) {
|
|
108
113
|
const geocodePath = '/places/api/v1/geocode/json'
|
|
109
|
-
|
|
114
|
+
// Uses WorkSafe PROD API for storybook site (ensure site is white listed)
|
|
115
|
+
const baseUrl =
|
|
116
|
+
window.origin.toLowerCase().indexOf('worksafe') === -1
|
|
117
|
+
? 'https://www.worksafe.vic.gov.au'
|
|
118
|
+
: window.origin
|
|
110
119
|
const qs = `?place_id=${value.address.place_id}`
|
|
111
120
|
const url = `${baseUrl}${geocodePath}${qs}`
|
|
112
121
|
|
|
@@ -114,11 +123,11 @@ export class AddresseFormElement extends BaseFormElement {
|
|
|
114
123
|
const results = response?.data?.results
|
|
115
124
|
if (Array.isArray(results) && results.length > 0) {
|
|
116
125
|
const postcode = results[0].address_components.find((item) =>
|
|
117
|
-
item.types.find((type) => type === 'postal_code')
|
|
126
|
+
item.types.find((type) => type === 'postal_code'),
|
|
118
127
|
)?.short_name
|
|
119
128
|
const fullAddress = value.address.description.replace(
|
|
120
129
|
/,(?=[^,]*$)/,
|
|
121
|
-
`, ${postcode}
|
|
130
|
+
`, ${postcode}`,
|
|
122
131
|
)
|
|
123
132
|
value.address.description = fullAddress
|
|
124
133
|
value.geocode = results[0]
|