@worksafevictoria/wcl7.5 1.1.0-beta.39 → 1.1.0-beta.40
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/components/Containers/HomepageHeader/index.vue +25 -11
- package/src/components/Global/AppHeader/index.vue +52 -54
- 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/SubComponents/ResourceGroup/index.vue +91 -69
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
:class="{
|
|
48
48
|
[`card_group__card--${card.colour}`]: card.pillText,
|
|
49
49
|
[`card_group__card--none`]: !card.pillText,
|
|
50
|
-
[`card_group__card--${cardResourseType}`]:
|
|
50
|
+
[`card_group__card--${cardResourseType}`]:
|
|
51
|
+
'card_group__card--resourse-group',
|
|
51
52
|
}"
|
|
52
53
|
:card-header-title="card.title"
|
|
53
54
|
:caret="getCaret(card)"
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
:taxonomies="{
|
|
62
63
|
industry: card.industry,
|
|
63
64
|
topic: card.topic,
|
|
64
|
-
language: card.language
|
|
65
|
+
language: card.language,
|
|
65
66
|
}"
|
|
66
67
|
>
|
|
67
68
|
<template v-slot:cardTop>
|
|
@@ -85,9 +86,9 @@
|
|
|
85
86
|
<template
|
|
86
87
|
v-if="
|
|
87
88
|
loader ||
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
(displayedCards.length === 0 && !loader) ||
|
|
90
|
+
$slots.cardGroupFooter ||
|
|
91
|
+
(!loader && showLoadMore && hasMorePages)
|
|
91
92
|
"
|
|
92
93
|
v-slot:cardGridFooter
|
|
93
94
|
>
|
|
@@ -129,7 +130,7 @@ import Switcher from './switcher.vue'
|
|
|
129
130
|
import {
|
|
130
131
|
isAbsoluteUrl,
|
|
131
132
|
navigateToPath,
|
|
132
|
-
isGovSite
|
|
133
|
+
isGovSite,
|
|
133
134
|
} from './../../../../lib/utility'
|
|
134
135
|
import { BSpinner } from 'bootstrap-vue-next'
|
|
135
136
|
|
|
@@ -145,80 +146,92 @@ export default {
|
|
|
145
146
|
CtaButton,
|
|
146
147
|
DirectoryFilters,
|
|
147
148
|
Switcher,
|
|
148
|
-
BSpinner
|
|
149
|
+
BSpinner,
|
|
149
150
|
},
|
|
150
151
|
props: {
|
|
151
152
|
background: {
|
|
152
153
|
type: String,
|
|
153
|
-
default: 'white'
|
|
154
|
+
default: 'white',
|
|
154
155
|
},
|
|
155
156
|
title: {
|
|
156
157
|
type: String,
|
|
157
|
-
default: ''
|
|
158
|
+
default: '',
|
|
158
159
|
},
|
|
159
160
|
titleTag: {
|
|
160
161
|
type: String,
|
|
161
|
-
default: 'h2'
|
|
162
|
+
default: 'h2',
|
|
162
163
|
},
|
|
163
164
|
rtl: {
|
|
164
165
|
type: Boolean,
|
|
165
|
-
default: false
|
|
166
|
+
default: false,
|
|
166
167
|
},
|
|
167
168
|
bundle: {
|
|
168
169
|
type: Array,
|
|
169
|
-
default: () => ['']
|
|
170
|
+
default: () => [''],
|
|
170
171
|
},
|
|
171
172
|
columns: {
|
|
172
173
|
type: Number,
|
|
173
|
-
default: 3
|
|
174
|
+
default: 3,
|
|
174
175
|
},
|
|
175
176
|
initialDisplyLimit: {
|
|
176
177
|
type: Number,
|
|
177
|
-
default: 0
|
|
178
|
+
default: 0,
|
|
178
179
|
},
|
|
179
180
|
fetchContent: {
|
|
180
181
|
type: Function,
|
|
181
|
-
required: true
|
|
182
|
+
required: true,
|
|
182
183
|
},
|
|
183
184
|
fetchFilters: {
|
|
184
185
|
type: Function,
|
|
185
186
|
required: false,
|
|
186
|
-
default: null
|
|
187
|
+
default: null,
|
|
187
188
|
},
|
|
188
189
|
enableBundleFilter: {
|
|
189
|
-
type: Boolean
|
|
190
|
+
type: Boolean,
|
|
190
191
|
},
|
|
191
192
|
getBundleAlias: {
|
|
192
193
|
type: Function,
|
|
193
194
|
required: false,
|
|
194
|
-
default: null
|
|
195
|
+
default: null,
|
|
195
196
|
},
|
|
196
197
|
type: {
|
|
197
198
|
type: String,
|
|
198
|
-
required: true
|
|
199
|
+
required: true,
|
|
199
200
|
},
|
|
200
201
|
resourceType: {
|
|
201
202
|
type: String,
|
|
202
|
-
default: 'resource-group'
|
|
203
|
+
default: 'resource-group',
|
|
203
204
|
},
|
|
204
205
|
showLoadMore: {
|
|
205
206
|
type: Boolean,
|
|
206
|
-
default: false
|
|
207
|
+
default: false,
|
|
207
208
|
},
|
|
208
209
|
emptyCardsText: {
|
|
209
210
|
type: String,
|
|
210
|
-
default: 'No results returned'
|
|
211
|
+
default: 'No results returned',
|
|
211
212
|
},
|
|
212
213
|
loading: {
|
|
213
214
|
type: Boolean,
|
|
214
|
-
default: false
|
|
215
|
-
}
|
|
215
|
+
default: false,
|
|
216
|
+
},
|
|
216
217
|
},
|
|
217
|
-
|
|
218
|
+
// Temp use of mounted to replace fetch
|
|
219
|
+
async mounted() {
|
|
218
220
|
if (this.displayedCards.length === 0) {
|
|
221
|
+
console.log(
|
|
222
|
+
'🚀 ~ mounted ~ this.displayedCards.length:',
|
|
223
|
+
this.displayedCards.length,
|
|
224
|
+
)
|
|
219
225
|
await this.loadFiltersAndContent()
|
|
220
226
|
}
|
|
221
227
|
},
|
|
228
|
+
// TODO useAsyncData <script setup>
|
|
229
|
+
// async fetch() {
|
|
230
|
+
// if (this.displayedCards.length === 0) {
|
|
231
|
+
// await this.loadFiltersAndContent()
|
|
232
|
+
// }
|
|
233
|
+
// },
|
|
234
|
+
|
|
222
235
|
data() {
|
|
223
236
|
return {
|
|
224
237
|
loader: this.loading,
|
|
@@ -231,8 +244,8 @@ export default {
|
|
|
231
244
|
filters: {
|
|
232
245
|
taxonomies: [],
|
|
233
246
|
selected: {},
|
|
234
|
-
availableBundles: []
|
|
235
|
-
}
|
|
247
|
+
availableBundles: [],
|
|
248
|
+
},
|
|
236
249
|
}
|
|
237
250
|
},
|
|
238
251
|
computed: {
|
|
@@ -241,7 +254,7 @@ export default {
|
|
|
241
254
|
return this.rtl
|
|
242
255
|
}
|
|
243
256
|
return this.displayedCards.every((card) => this.rtl || card.rtl)
|
|
244
|
-
}
|
|
257
|
+
},
|
|
245
258
|
},
|
|
246
259
|
fetchOnServer: true,
|
|
247
260
|
fetchKey: 'wcl-card-group',
|
|
@@ -249,13 +262,17 @@ export default {
|
|
|
249
262
|
async loadFiltersAndContent() {
|
|
250
263
|
await Promise.all([
|
|
251
264
|
this.fetchFilters ? this.loadFilters() : Promise.resolve(),
|
|
252
|
-
this.loadMoreCards(true)
|
|
265
|
+
this.loadMoreCards(true),
|
|
253
266
|
])
|
|
267
|
+
console.log(
|
|
268
|
+
'🚀 ~ loadFiltersAndContent ~ this.fetchFilters:',
|
|
269
|
+
this.fetchFilters,
|
|
270
|
+
)
|
|
254
271
|
},
|
|
255
272
|
init() {
|
|
256
273
|
this.allCards = {
|
|
257
274
|
total: 0,
|
|
258
|
-
cards: []
|
|
275
|
+
cards: [],
|
|
259
276
|
}
|
|
260
277
|
this.displayLimit = 0
|
|
261
278
|
this.hasMorePages = false
|
|
@@ -269,8 +286,8 @@ export default {
|
|
|
269
286
|
if (shouldMakeNewFetchCall) {
|
|
270
287
|
const cardBundles = await Promise.all(
|
|
271
288
|
bundles.map((bundle, index) =>
|
|
272
|
-
this.getBundle(bundle, addMoreBy, index)
|
|
273
|
-
)
|
|
289
|
+
this.getBundle(bundle, addMoreBy, index),
|
|
290
|
+
),
|
|
274
291
|
)
|
|
275
292
|
|
|
276
293
|
allCards = this.getShuffledCards(cardBundles)
|
|
@@ -288,7 +305,7 @@ export default {
|
|
|
288
305
|
},
|
|
289
306
|
async loadMoreCards(init) {
|
|
290
307
|
const attrs = {
|
|
291
|
-
group: this.$store?.state?.page?.content?.title
|
|
308
|
+
group: this.$store?.state?.page?.content?.title,
|
|
292
309
|
}
|
|
293
310
|
if (this.$gtm && !init) {
|
|
294
311
|
this.$gtm.push({ event: 'custom.interaction.showmore.click', ...attrs })
|
|
@@ -307,7 +324,7 @@ export default {
|
|
|
307
324
|
this.displayedCards,
|
|
308
325
|
this.allCards,
|
|
309
326
|
addMoreBy,
|
|
310
|
-
bundles
|
|
327
|
+
bundles,
|
|
311
328
|
)
|
|
312
329
|
|
|
313
330
|
this.hasMorePages = this.allCards.total > this.allCards.cards.length
|
|
@@ -321,11 +338,11 @@ export default {
|
|
|
321
338
|
const cache = (this.bundleCache[bundle] = this.bundleCache[bundle] || {
|
|
322
339
|
response: {
|
|
323
340
|
results: [],
|
|
324
|
-
numFound: 0
|
|
341
|
+
numFound: 0,
|
|
325
342
|
},
|
|
326
343
|
qs: {
|
|
327
|
-
start
|
|
328
|
-
}
|
|
344
|
+
start,
|
|
345
|
+
},
|
|
329
346
|
})
|
|
330
347
|
|
|
331
348
|
if (cache.qs.start === undefined) {
|
|
@@ -339,7 +356,7 @@ export default {
|
|
|
339
356
|
const qs = {
|
|
340
357
|
bundle,
|
|
341
358
|
rows,
|
|
342
|
-
start
|
|
359
|
+
start,
|
|
343
360
|
}
|
|
344
361
|
return this.fetchContent(qs, this.filters.selected, index).then(
|
|
345
362
|
(response) => {
|
|
@@ -347,14 +364,14 @@ export default {
|
|
|
347
364
|
cache.response.numFound = response.numFound
|
|
348
365
|
cache.response.results.push(...response.results)
|
|
349
366
|
return cache.response
|
|
350
|
-
}
|
|
367
|
+
},
|
|
351
368
|
)
|
|
352
369
|
},
|
|
353
370
|
getShuffledCards(cardBundles) {
|
|
354
371
|
const shuffled = []
|
|
355
372
|
const bundleWithMostCards = cardBundles.reduce(
|
|
356
373
|
(a, b) => (a.results.length > b.results.length ? a : b),
|
|
357
|
-
{ results: [] }
|
|
374
|
+
{ results: [] },
|
|
358
375
|
).results.length
|
|
359
376
|
|
|
360
377
|
for (let i = 0; i < bundleWithMostCards; i++) {
|
|
@@ -373,6 +390,7 @@ export default {
|
|
|
373
390
|
},
|
|
374
391
|
loadFilters() {
|
|
375
392
|
return this.fetchFilters().then((taxonomies) => {
|
|
393
|
+
console.log('🚀 ~ returnthis.fetchFilters ~ taxonomies:', taxonomies)
|
|
376
394
|
this.filters.taxonomies = taxonomies
|
|
377
395
|
return Promise.resolve(taxonomies)
|
|
378
396
|
})
|
|
@@ -425,31 +443,31 @@ export default {
|
|
|
425
443
|
navigateToPath.call(
|
|
426
444
|
this,
|
|
427
445
|
card?.selectedCard?.link,
|
|
428
|
-
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
|
|
446
|
+
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
|
|
429
447
|
)
|
|
430
448
|
}
|
|
431
449
|
} else {
|
|
432
450
|
navigateToPath.call(
|
|
433
451
|
this,
|
|
434
452
|
card?.selectedCard?.link,
|
|
435
|
-
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true
|
|
453
|
+
card?.ev?.ctrlKey === true || card?.ev?.metaKey === true,
|
|
436
454
|
)
|
|
437
455
|
}
|
|
438
456
|
},
|
|
439
457
|
focussed(ev) {
|
|
440
458
|
const path = ev.path || (ev.composedPath && ev.composedPath())
|
|
441
459
|
const theTabbedCards = path.find(
|
|
442
|
-
(el) => el['_prevClass'] === 'tabbed-cards'
|
|
460
|
+
(el) => el['_prevClass'] === 'tabbed-cards',
|
|
443
461
|
)
|
|
444
462
|
if (ev.shiftKey && theTabbedCards) {
|
|
445
463
|
ev.preventDefault()
|
|
446
|
-
let selectedTabbedCards =
|
|
447
|
-
'isSelected'
|
|
448
|
-
)
|
|
464
|
+
let selectedTabbedCards =
|
|
465
|
+
theTabbedCards.getElementsByClassName('isSelected')
|
|
449
466
|
let selectedCard = selectedTabbedCards[0].getElementsByTagName('button')
|
|
450
|
-
let thePrevLGItem =
|
|
451
|
-
|
|
452
|
-
|
|
467
|
+
let thePrevLGItem =
|
|
468
|
+
ev.target?.parentElement?.parentElement?.previousSibling?.getElementsByTagName(
|
|
469
|
+
'button',
|
|
470
|
+
)
|
|
453
471
|
if (thePrevLGItem) {
|
|
454
472
|
thePrevLGItem[0].focus()
|
|
455
473
|
} else {
|
|
@@ -457,15 +475,16 @@ export default {
|
|
|
457
475
|
}
|
|
458
476
|
} else if (!ev.shiftKey && theTabbedCards) {
|
|
459
477
|
ev.preventDefault()
|
|
460
|
-
let selectedTabbedCards =
|
|
461
|
-
'isSelected'
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
let theNextLGItem =
|
|
467
|
-
|
|
468
|
-
|
|
478
|
+
let selectedTabbedCards =
|
|
479
|
+
theTabbedCards.getElementsByClassName('isSelected')
|
|
480
|
+
let nextTabbedCard =
|
|
481
|
+
selectedTabbedCards[0]?.parentElement?.nextSibling?.getElementsByTagName(
|
|
482
|
+
'button',
|
|
483
|
+
)
|
|
484
|
+
let theNextLGItem =
|
|
485
|
+
ev.target?.parentElement?.parentElement?.nextSibling?.getElementsByTagName(
|
|
486
|
+
'button',
|
|
487
|
+
)
|
|
469
488
|
if (theNextLGItem) {
|
|
470
489
|
theNextLGItem[0].focus()
|
|
471
490
|
} else if (nextTabbedCard) {
|
|
@@ -489,7 +508,7 @@ export default {
|
|
|
489
508
|
'button:not([disabled]):not([tabindex="-1"])',
|
|
490
509
|
'input:not([disabled]):not([tabindex="-1"])',
|
|
491
510
|
'select:not([disabled]):not([tabindex="-1"])',
|
|
492
|
-
'[tabindex]:not([disabled]):not([tabindex="-1"])'
|
|
511
|
+
'[tabindex]:not([disabled]):not([tabindex="-1"])',
|
|
493
512
|
/* add custom queries here */
|
|
494
513
|
].join(','),
|
|
495
514
|
queryResult = Array.prototype.filter.call(
|
|
@@ -501,7 +520,7 @@ export default {
|
|
|
501
520
|
elem.offsetHeight > 0 ||
|
|
502
521
|
elem === activeElem
|
|
503
522
|
)
|
|
504
|
-
}
|
|
523
|
+
},
|
|
505
524
|
),
|
|
506
525
|
indexedList = queryResult
|
|
507
526
|
.slice()
|
|
@@ -515,20 +534,20 @@ export default {
|
|
|
515
534
|
? a.tabIndex < b.tabIndex
|
|
516
535
|
? -1
|
|
517
536
|
: b.tabIndex < a.tabIndex
|
|
518
|
-
|
|
519
|
-
|
|
537
|
+
? 1
|
|
538
|
+
: 0
|
|
520
539
|
: a.tabIndex != 0
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
540
|
+
? -1
|
|
541
|
+
: b.tabIndex != 0
|
|
542
|
+
? 1
|
|
543
|
+
: 0
|
|
525
544
|
}),
|
|
526
545
|
focusable = [].concat(
|
|
527
546
|
indexedList,
|
|
528
547
|
queryResult.filter((elem) => {
|
|
529
548
|
/* filter out all indexes above 0 */
|
|
530
549
|
return elem.tabIndex == 0 || elem.tabIndex == -1 ? true : false
|
|
531
|
-
})
|
|
550
|
+
}),
|
|
532
551
|
)
|
|
533
552
|
|
|
534
553
|
/* if reverse is true return the previous focusable element
|
|
@@ -537,8 +556,8 @@ export default {
|
|
|
537
556
|
? focusable[focusable.indexOf(activeElem) - 1] ||
|
|
538
557
|
focusable[focusable.length - 1]
|
|
539
558
|
: focusable[focusable.indexOf(activeElem) + 1] || focusable[0]
|
|
540
|
-
}
|
|
541
|
-
}
|
|
559
|
+
},
|
|
560
|
+
},
|
|
542
561
|
}
|
|
543
562
|
</script>
|
|
544
563
|
<style lang="scss" scoped>
|
|
@@ -551,6 +570,7 @@ $borderRadius: 8px;
|
|
|
551
570
|
&--resource-list {
|
|
552
571
|
:deep(.section-group__content) {
|
|
553
572
|
display: flex;
|
|
573
|
+
|
|
554
574
|
> .row {
|
|
555
575
|
flex: 0 0 70%;
|
|
556
576
|
}
|
|
@@ -558,6 +578,7 @@ $borderRadius: 8px;
|
|
|
558
578
|
}
|
|
559
579
|
}
|
|
560
580
|
}
|
|
581
|
+
|
|
561
582
|
.card_group {
|
|
562
583
|
&--resource-list {
|
|
563
584
|
:deep(.card-body) {
|
|
@@ -566,6 +587,7 @@ $borderRadius: 8px;
|
|
|
566
587
|
}
|
|
567
588
|
}
|
|
568
589
|
}
|
|
590
|
+
|
|
569
591
|
.card_group__card--resource-group {
|
|
570
592
|
:deep(.card-body) {
|
|
571
593
|
padding-left: $cardTextPadding !important;
|