@worksafevictoria/wcl7.5 1.1.0-beta.86 → 1.1.0-beta.88
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/Global/AppFooter/index.vue +11 -6
- package/src/components/Paragraphs/Accordion/AccordionItem/index.vue +8 -4
- package/src/components/Paragraphs/Accordion/StepperItem/index.vue +8 -4
- package/src/components/Paragraphs/Accordion/index.stories.js +21 -18
- package/src/components/Paragraphs/Accordion/index.vue +38 -34
- package/src/components/Paragraphs/BrowseContent/index.vue +204 -229
- package/src/index.js +15 -5
package/package.json
CHANGED
|
@@ -438,15 +438,20 @@ export default {
|
|
|
438
438
|
},
|
|
439
439
|
computed: {
|
|
440
440
|
updateDate() {
|
|
441
|
-
//
|
|
442
|
-
return
|
|
441
|
+
// Change to remove hydration date
|
|
442
|
+
return new Date(this.changedDate)
|
|
443
|
+
.toLocaleString('en-AU', {
|
|
444
|
+
timeZone: 'Australia/Sydney',
|
|
445
|
+
})
|
|
446
|
+
.split(',')[0]
|
|
443
447
|
},
|
|
444
448
|
isMobile() {
|
|
445
449
|
return this.windowWidth < 768
|
|
446
450
|
},
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
451
|
+
// Why send junk id
|
|
452
|
+
// processID() {
|
|
453
|
+
// return `${Date.now()}-${Math.floor(Math.random() * 10000)}`
|
|
454
|
+
// },
|
|
450
455
|
},
|
|
451
456
|
watch: {
|
|
452
457
|
$route() {
|
|
@@ -524,7 +529,7 @@ export default {
|
|
|
524
529
|
//title: this.$store?.state?.page?.content?.title,
|
|
525
530
|
title: this.$pageStore?.content?.title,
|
|
526
531
|
label: this.response.was_the_information_on_this_page_helpful_,
|
|
527
|
-
processID: this.processID,
|
|
532
|
+
// processID: this.processID, why send GTM junk id
|
|
528
533
|
}
|
|
529
534
|
if (this.$gtm) {
|
|
530
535
|
this.$gtm.push({
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
}"
|
|
11
11
|
>
|
|
12
12
|
<a
|
|
13
|
-
:id="'accordion' +
|
|
13
|
+
:id="'accordion' + itemid"
|
|
14
14
|
role="button"
|
|
15
15
|
:aria-expanded="showAccordion ? 'true' : 'false'"
|
|
16
16
|
class="accordion-item__title"
|
|
17
|
-
:aria-controls="'sect' +
|
|
17
|
+
:aria-controls="'sect' + itemid"
|
|
18
18
|
tabindex="0"
|
|
19
19
|
@click.prevent="toggleAccordion"
|
|
20
20
|
@keypress.enter="toggleAccordion"
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
<b-card-body v-if="content">
|
|
52
52
|
<div
|
|
53
53
|
v-show="showAccordion"
|
|
54
|
-
:id="'sect' +
|
|
54
|
+
:id="'sect' + itemid"
|
|
55
55
|
class="accordion-item__content"
|
|
56
56
|
role="region"
|
|
57
|
-
:aria-labelledby="'accordion' +
|
|
57
|
+
:aria-labelledby="'accordion' + itemid"
|
|
58
58
|
>
|
|
59
59
|
<rich-text :content="content" />
|
|
60
60
|
</div>
|
|
@@ -107,6 +107,10 @@ export default {
|
|
|
107
107
|
type: Array,
|
|
108
108
|
default: () => [],
|
|
109
109
|
},
|
|
110
|
+
itemid: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: 'Item',
|
|
113
|
+
},
|
|
110
114
|
},
|
|
111
115
|
data: () => ({
|
|
112
116
|
showAccordion: false,
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
>
|
|
11
11
|
<div>
|
|
12
12
|
<button
|
|
13
|
-
:id="'accordion' +
|
|
13
|
+
:id="'accordion' + itemid"
|
|
14
14
|
:aria-expanded="showAccordion ? 'true' : 'false'"
|
|
15
15
|
class="accordion-stepper__title"
|
|
16
|
-
:aria-controls="'sect' +
|
|
16
|
+
:aria-controls="'sect' + itemid"
|
|
17
17
|
@click="toggleAccordion"
|
|
18
18
|
>
|
|
19
19
|
<div
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
<b-card-body v-if="content">
|
|
51
51
|
<div
|
|
52
52
|
v-show="showAccordion"
|
|
53
|
-
:id="'sect' +
|
|
53
|
+
:id="'sect' + itemid"
|
|
54
54
|
class="accordion-stepper__content"
|
|
55
55
|
role="region"
|
|
56
|
-
:aria-labelledby="'accordion' +
|
|
56
|
+
:aria-labelledby="'accordion' + itemid"
|
|
57
57
|
>
|
|
58
58
|
<rich-text :content="content" />
|
|
59
59
|
</div>
|
|
@@ -107,6 +107,10 @@ export default {
|
|
|
107
107
|
type: Boolean,
|
|
108
108
|
default: false,
|
|
109
109
|
},
|
|
110
|
+
itemid: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: 'Item',
|
|
113
|
+
},
|
|
110
114
|
},
|
|
111
115
|
data: () => ({
|
|
112
116
|
showAccordion: false,
|
|
@@ -6,25 +6,28 @@ const mockAccordionItems = [
|
|
|
6
6
|
field_pre_heading: 'preheading text',
|
|
7
7
|
field_rich_text: {
|
|
8
8
|
value:
|
|
9
|
-
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>'
|
|
10
|
-
}
|
|
9
|
+
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>',
|
|
10
|
+
},
|
|
11
|
+
id: 'id-1',
|
|
11
12
|
},
|
|
12
13
|
{
|
|
13
14
|
field_title: 'Item two',
|
|
14
15
|
field_pre_heading: 'preheading text',
|
|
15
16
|
field_rich_text: {
|
|
16
17
|
value:
|
|
17
|
-
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>'
|
|
18
|
-
}
|
|
18
|
+
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>',
|
|
19
|
+
},
|
|
20
|
+
id: 'id-2',
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
field_title: 'Item three',
|
|
22
24
|
field_pre_heading: 'preheading text',
|
|
23
25
|
field_rich_text: {
|
|
24
26
|
value:
|
|
25
|
-
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>'
|
|
26
|
-
}
|
|
27
|
-
|
|
27
|
+
'<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>',
|
|
28
|
+
},
|
|
29
|
+
id: 'id-3',
|
|
30
|
+
},
|
|
28
31
|
]
|
|
29
32
|
|
|
30
33
|
export default {
|
|
@@ -34,26 +37,26 @@ export default {
|
|
|
34
37
|
argTypes: {
|
|
35
38
|
titleTag: {
|
|
36
39
|
control: 'select',
|
|
37
|
-
options: ['h2', 'h3', 'h4']
|
|
40
|
+
options: ['h2', 'h3', 'h4'],
|
|
38
41
|
},
|
|
39
42
|
isStepper: {
|
|
40
43
|
control: 'boolean',
|
|
41
|
-
table: { disable: true }
|
|
44
|
+
table: { disable: true },
|
|
42
45
|
},
|
|
43
46
|
|
|
44
47
|
showPreHeading: {
|
|
45
48
|
control: 'boolean',
|
|
46
|
-
table: { disable: true }
|
|
49
|
+
table: { disable: true },
|
|
47
50
|
},
|
|
48
51
|
option: {
|
|
49
52
|
control: 'select',
|
|
50
|
-
options: ['open-all', 'close-all', 'open-first']
|
|
53
|
+
options: ['open-all', 'close-all', 'open-first'],
|
|
51
54
|
},
|
|
52
55
|
size: {
|
|
53
56
|
control: 'text',
|
|
54
|
-
table: { disable: true }
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
+
table: { disable: true },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export const Standard = {
|
|
@@ -66,8 +69,8 @@ export const Standard = {
|
|
|
66
69
|
rtl: false,
|
|
67
70
|
option: 'open-first',
|
|
68
71
|
accordionList: mockAccordionItems,
|
|
69
|
-
size: 'content'
|
|
70
|
-
}
|
|
72
|
+
size: 'content',
|
|
73
|
+
},
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
export const Stepper = {
|
|
@@ -80,6 +83,6 @@ export const Stepper = {
|
|
|
80
83
|
rtl: false,
|
|
81
84
|
option: 'open-first',
|
|
82
85
|
accordionList: mockAccordionItems,
|
|
83
|
-
size: 'content'
|
|
84
|
-
}
|
|
86
|
+
size: 'content',
|
|
87
|
+
},
|
|
85
88
|
}
|
|
@@ -7,40 +7,44 @@
|
|
|
7
7
|
class="paragraph--accordion"
|
|
8
8
|
:no-padding-bottom="isStepper"
|
|
9
9
|
>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
10
|
+
<div>
|
|
11
|
+
<ol class="accordion-list">
|
|
12
|
+
<li
|
|
13
|
+
v-for="(item, index) in accordionList"
|
|
14
|
+
:key="item.id ? item.id : '' + index"
|
|
15
|
+
:class="{
|
|
16
|
+
workwell: isWorkwell,
|
|
17
|
+
rtl: rtl || item.field_rtl,
|
|
18
|
+
stepper: isStepper,
|
|
19
|
+
}"
|
|
20
|
+
class="accordion"
|
|
21
|
+
>
|
|
22
|
+
<stepper-item
|
|
23
|
+
v-if="isStepper"
|
|
24
|
+
:itemid="item.id ? item.id : '' + index"
|
|
25
|
+
:content="hasContent(item) ? item.field_rich_text.value : ''"
|
|
26
|
+
:title="item.field_title"
|
|
27
|
+
class="accordion__item stepper"
|
|
28
|
+
:rtl="rtl || item.field_rtl"
|
|
29
|
+
:open="isAccordionOpen(index)"
|
|
30
|
+
:number="index + 1"
|
|
31
|
+
:is-work-well="isWorkwell"
|
|
32
|
+
/>
|
|
33
|
+
<accordion-item
|
|
34
|
+
v-if="!isStepper"
|
|
35
|
+
:itemid="item.id ? item.id : '' + index"
|
|
36
|
+
:content="hasContent(item) ? item.field_rich_text.value : ''"
|
|
37
|
+
:title="item.field_title"
|
|
38
|
+
class="accordion__item"
|
|
39
|
+
:rtl="rtl || item.field_rtl"
|
|
40
|
+
:show-pre-heading="showPreHeading"
|
|
41
|
+
:pre-heading="item.field_pre_heading || ''"
|
|
42
|
+
:open="isAccordionOpen(index)"
|
|
43
|
+
:meta="Array.isArray(item.meta) ? item.meta : []"
|
|
44
|
+
/>
|
|
45
|
+
</li>
|
|
46
|
+
</ol>
|
|
47
|
+
</div>
|
|
44
48
|
</section-group>
|
|
45
49
|
</template>
|
|
46
50
|
|
|
@@ -38,251 +38,226 @@
|
|
|
38
38
|
</card-group>
|
|
39
39
|
</template>
|
|
40
40
|
|
|
41
|
-
<script>
|
|
41
|
+
<script setup>
|
|
42
42
|
import CardGroup from '../../SubComponents/CardGroup/index.vue'
|
|
43
43
|
import DirectoryFilters from '../../Global/DirectoryFilters/index.vue'
|
|
44
44
|
import Switcher from './switcher.vue'
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
const nuxtApp = useNuxtApp()
|
|
47
|
+
|
|
48
|
+
const hasMorePages = ref(false)
|
|
49
|
+
const displayedCards = ref([])
|
|
50
|
+
const loading = ref(true)
|
|
51
|
+
const bundleCache = ref({})
|
|
52
|
+
const displayLimit = ref(0)
|
|
53
|
+
const allCards = ref(undefined)
|
|
54
|
+
const filters = ref({
|
|
55
|
+
taxonomies: [],
|
|
56
|
+
selected: {},
|
|
57
|
+
availableBundles: [],
|
|
58
|
+
})
|
|
59
|
+
const props = defineProps({
|
|
60
|
+
background: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'grey',
|
|
52
63
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
default: 'grey',
|
|
57
|
-
},
|
|
58
|
-
title: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: '',
|
|
61
|
-
},
|
|
62
|
-
titleTag: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: 'h2',
|
|
65
|
-
},
|
|
66
|
-
bundle: {
|
|
67
|
-
type: Array,
|
|
68
|
-
default: () => [''],
|
|
69
|
-
},
|
|
70
|
-
columns: {
|
|
71
|
-
type: Number,
|
|
72
|
-
default: 0,
|
|
73
|
-
},
|
|
74
|
-
initialDisplyLimit: {
|
|
75
|
-
type: Number,
|
|
76
|
-
default: 0,
|
|
77
|
-
},
|
|
78
|
-
fetchContent: {
|
|
79
|
-
type: Function,
|
|
80
|
-
required: true,
|
|
81
|
-
},
|
|
82
|
-
fetchFilters: {
|
|
83
|
-
type: Function,
|
|
84
|
-
required: false,
|
|
85
|
-
default: null,
|
|
86
|
-
},
|
|
87
|
-
enableBundleFilter: {
|
|
88
|
-
type: Boolean,
|
|
89
|
-
},
|
|
90
|
-
getBundleAlias: {
|
|
91
|
-
type: Function,
|
|
92
|
-
required: false,
|
|
93
|
-
default: null,
|
|
94
|
-
},
|
|
95
|
-
showMore: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
},
|
|
98
|
-
type: {
|
|
99
|
-
type: String,
|
|
100
|
-
required: true,
|
|
101
|
-
},
|
|
64
|
+
title: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: '',
|
|
102
67
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
await this.loadFiltersAndContent()
|
|
107
|
-
}
|
|
68
|
+
titleTag: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: 'h2',
|
|
108
71
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// await this.loadFiltersAndContent()
|
|
113
|
-
// }
|
|
114
|
-
// },
|
|
115
|
-
data() {
|
|
116
|
-
return {
|
|
117
|
-
hasMorePages: false,
|
|
118
|
-
displayedCards: [],
|
|
119
|
-
loading: true,
|
|
120
|
-
bundleCache: {},
|
|
121
|
-
displayLimit: 0,
|
|
122
|
-
allCards: undefined,
|
|
123
|
-
filters: {
|
|
124
|
-
taxonomies: [],
|
|
125
|
-
selected: {},
|
|
126
|
-
availableBundles: [],
|
|
127
|
-
},
|
|
128
|
-
}
|
|
72
|
+
bundle: {
|
|
73
|
+
type: Array,
|
|
74
|
+
default: () => [''],
|
|
129
75
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
76
|
+
columns: {
|
|
77
|
+
type: Number,
|
|
78
|
+
default: 0,
|
|
79
|
+
},
|
|
80
|
+
initialDisplyLimit: {
|
|
81
|
+
type: Number,
|
|
82
|
+
default: 0,
|
|
83
|
+
},
|
|
84
|
+
fetchContent: {
|
|
85
|
+
type: Function,
|
|
86
|
+
required: true,
|
|
87
|
+
},
|
|
88
|
+
fetchFilters: {
|
|
89
|
+
type: Function,
|
|
90
|
+
required: false,
|
|
91
|
+
default: null,
|
|
92
|
+
},
|
|
93
|
+
enableBundleFilter: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
},
|
|
96
|
+
getBundleAlias: {
|
|
97
|
+
type: Function,
|
|
98
|
+
required: false,
|
|
99
|
+
default: null,
|
|
100
|
+
},
|
|
101
|
+
showMore: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
},
|
|
104
|
+
type: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: true,
|
|
107
|
+
},
|
|
108
|
+
})
|
|
159
109
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const attrs = {
|
|
171
|
-
group: this.$pageStore?.content?.title,
|
|
172
|
-
}
|
|
173
|
-
if (this.$gtm && !init) {
|
|
174
|
-
this.$gtm.push({ event: 'custom.interaction.showmore.click', ...attrs })
|
|
175
|
-
}
|
|
176
|
-
if (init) {
|
|
177
|
-
this.init()
|
|
178
|
-
}
|
|
179
|
-
this.loading = true
|
|
180
|
-
const addMoreBy = this.initialDisplyLimit
|
|
181
|
-
this.displayLimit += addMoreBy
|
|
182
|
-
const bundles =
|
|
183
|
-
this.filters.availableBundles.length > 0
|
|
184
|
-
? this.filters.availableBundles
|
|
185
|
-
: this.bundle
|
|
186
|
-
this.allCards = await this.fetchCards(
|
|
187
|
-
this.displayedCards,
|
|
188
|
-
this.allCards,
|
|
189
|
-
addMoreBy,
|
|
190
|
-
bundles,
|
|
191
|
-
)
|
|
192
|
-
this.hasMorePages = this.allCards.total > this.allCards.cards.length
|
|
193
|
-
this.displayedCards = this.allCards.cards.slice(0, this.displayLimit)
|
|
194
|
-
this.loading = false
|
|
195
|
-
},
|
|
196
|
-
getBundle(bundle, addMoreBy, index) {
|
|
197
|
-
let start
|
|
198
|
-
const rows = addMoreBy
|
|
199
|
-
const cache = (this.bundleCache[bundle] = this.bundleCache[bundle] || {
|
|
200
|
-
response: {
|
|
201
|
-
results: [],
|
|
202
|
-
numFound: 0,
|
|
203
|
-
},
|
|
204
|
-
qs: {
|
|
205
|
-
start,
|
|
206
|
-
},
|
|
207
|
-
})
|
|
110
|
+
await useAsyncData('fetchData', async () => {
|
|
111
|
+
try {
|
|
112
|
+
await Promise.all([
|
|
113
|
+
props.fetchFilters ? loadFilters() : Promise.resolve(),
|
|
114
|
+
loadMoreCards(true),
|
|
115
|
+
])
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.log('🚀 ~ err:', err)
|
|
118
|
+
}
|
|
119
|
+
})
|
|
208
120
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
121
|
+
function initial() {
|
|
122
|
+
allCards.value = {
|
|
123
|
+
total: 0,
|
|
124
|
+
cards: [],
|
|
125
|
+
}
|
|
126
|
+
displayLimit.value = 0
|
|
127
|
+
hasMorePages.value = false
|
|
128
|
+
displayedCards.value = []
|
|
129
|
+
bundleCache.value = {}
|
|
130
|
+
}
|
|
131
|
+
async function fetchCards(currentDisplayedCards, allCards, addMoreBy, bundles) {
|
|
132
|
+
const shouldMakeNewFetchCall =
|
|
133
|
+
currentDisplayedCards.length + addMoreBy > allCards.cards.length
|
|
134
|
+
if (shouldMakeNewFetchCall) {
|
|
135
|
+
const cardBundles = await Promise.all(
|
|
136
|
+
bundles.map((bundle, index) => getBundle(bundle, addMoreBy, index)),
|
|
137
|
+
)
|
|
138
|
+
allCards = getShuffledCards(cardBundles)
|
|
216
139
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
140
|
+
if (
|
|
141
|
+
props.type === 'paragraph--cards_group_latest' ||
|
|
142
|
+
props.type === 'paragraph--browse_content'
|
|
143
|
+
) {
|
|
144
|
+
allCards.cards = sortByDate(allCards.cards)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return allCards
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function loadMoreCards(init) {
|
|
151
|
+
const attrs = {
|
|
152
|
+
group: nuxtApp.$pageStore?.content?.title,
|
|
153
|
+
}
|
|
154
|
+
if (nuxtApp.$gtm && !init) {
|
|
155
|
+
nuxtApp.$gtm.push({ event: 'custom.interaction.showmore.click', ...attrs })
|
|
156
|
+
}
|
|
157
|
+
if (init) {
|
|
158
|
+
initial()
|
|
159
|
+
}
|
|
160
|
+
loading.value = true
|
|
161
|
+
const addMoreBy = props.initialDisplyLimit
|
|
162
|
+
displayLimit.value += addMoreBy
|
|
163
|
+
const bundles =
|
|
164
|
+
filters.value.availableBundles.length > 0
|
|
165
|
+
? filters.value.availableBundles
|
|
166
|
+
: props.bundle
|
|
167
|
+
allCards.value = await fetchCards(
|
|
168
|
+
displayedCards.value,
|
|
169
|
+
allCards.value,
|
|
170
|
+
addMoreBy,
|
|
171
|
+
bundles,
|
|
172
|
+
)
|
|
173
|
+
hasMorePages.value = allCards.value.total > allCards.value.cards.length
|
|
174
|
+
displayedCards.value = allCards.value.cards.slice(0, displayLimit.value)
|
|
175
|
+
loading.value = false
|
|
176
|
+
}
|
|
177
|
+
async function getBundle(bundle, addMoreBy, index) {
|
|
178
|
+
let start
|
|
179
|
+
const rows = addMoreBy
|
|
180
|
+
const cache = (bundleCache.value[bundle] = bundleCache.value[bundle] || {
|
|
181
|
+
response: {
|
|
182
|
+
results: [],
|
|
183
|
+
numFound: 0,
|
|
230
184
|
},
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
185
|
+
qs: {
|
|
186
|
+
start,
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
if (cache.qs.start === undefined) {
|
|
190
|
+
start = 0
|
|
191
|
+
} else if (cache.response.numFound > cache.response.results.length) {
|
|
192
|
+
start = cache.response.results.length
|
|
193
|
+
} else {
|
|
194
|
+
return Promise.resolve(cache.response)
|
|
195
|
+
}
|
|
196
|
+
const qs = {
|
|
197
|
+
bundle,
|
|
198
|
+
rows,
|
|
199
|
+
start,
|
|
200
|
+
}
|
|
201
|
+
let response = await props.fetchContent(qs, filters.value.selected)
|
|
202
|
+
cache.qs.start = qs.start
|
|
203
|
+
cache.response.numFound = response.numFound
|
|
204
|
+
cache.response.results.push(...response.results)
|
|
205
|
+
return cache.response
|
|
206
|
+
}
|
|
207
|
+
function getShuffledCards(cardBundles) {
|
|
208
|
+
const shuffled = []
|
|
209
|
+
const bundleWithMostCards = cardBundles.reduce(
|
|
210
|
+
(a, b) => (a.results.length > b.results.length ? a : b),
|
|
211
|
+
{ results: [] },
|
|
212
|
+
).results.length
|
|
237
213
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
})
|
|
214
|
+
for (let i = 0; i < bundleWithMostCards; i++) {
|
|
215
|
+
cardBundles.forEach((bundle) => {
|
|
216
|
+
if (bundle.results[i]) {
|
|
217
|
+
shuffled.push(bundle.results[i])
|
|
244
218
|
}
|
|
219
|
+
})
|
|
220
|
+
}
|
|
245
221
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
222
|
+
const total = cardBundles.reduce((acc, bundle) => {
|
|
223
|
+
return acc + bundle.numFound
|
|
224
|
+
}, 0)
|
|
249
225
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
},
|
|
226
|
+
return { cards: shuffled, total }
|
|
227
|
+
}
|
|
228
|
+
function loadFilters() {
|
|
229
|
+
return props.fetchFilters().then((taxonomies) => {
|
|
230
|
+
filters.value.taxonomies = taxonomies
|
|
231
|
+
|
|
232
|
+
return Promise.resolve(taxonomies)
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
const onFilter = (fltrs) => {
|
|
236
|
+
bundleCache.value = {}
|
|
237
|
+
Object.keys(fltrs).forEach((filter) => {
|
|
238
|
+
filters.values.selected[filter] = fltrs[filter].map((obj) => obj.tid)
|
|
239
|
+
})
|
|
240
|
+
loadMoreCards(true)
|
|
241
|
+
}
|
|
242
|
+
const onSwitcher = (switchToBundle) => {
|
|
243
|
+
filters.value.selected = {}
|
|
244
|
+
filters.value.availableBundles.length = 0
|
|
245
|
+
if (switchToBundle) {
|
|
246
|
+
filters.value.availableBundles.push(switchToBundle)
|
|
247
|
+
}
|
|
248
|
+
loadMoreCards(true)
|
|
249
|
+
}
|
|
250
|
+
const reset = async () => {
|
|
251
|
+
bundleCache.value = {}
|
|
252
|
+
filters.value.selected = {}
|
|
253
|
+
filters.value.availableBundles.length = 0
|
|
254
|
+
await loadMoreCards(true)
|
|
255
|
+
}
|
|
256
|
+
function sortByDate(cards) {
|
|
257
|
+
const sorted = cards.sort((a, b) => {
|
|
258
|
+
return new Date(b.dateSort) - new Date(a.dateSort)
|
|
259
|
+
})
|
|
260
|
+
return sorted
|
|
286
261
|
}
|
|
287
262
|
</script>
|
|
288
263
|
<style lang="scss" scoped>
|
package/src/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import RichText from './components/Paragraphs/RichText/index.vue'
|
|
|
25
25
|
import TextMedia from './components/Paragraphs/TextMedia/index.vue'
|
|
26
26
|
import Accordion from './components/Paragraphs/Accordion/index.vue'
|
|
27
27
|
import TabbedCards from './components/Paragraphs/TabbedCards/index.vue'
|
|
28
|
-
import BrowseContent from './components/Paragraphs/BrowseContent/index.vue'
|
|
28
|
+
// import BrowseContent from './components/Paragraphs/BrowseContent/index.vue'
|
|
29
29
|
import TaskFinder from './components/Paragraphs/TaskFinder/index.vue'
|
|
30
30
|
import ListGroup from './components/Paragraphs/ListGroup/index.vue'
|
|
31
31
|
import ScrollSpy from './components/Paragraphs/ScrollSpy/index.vue'
|
|
@@ -80,7 +80,7 @@ export {
|
|
|
80
80
|
BackToTop,
|
|
81
81
|
GlobalNotice,
|
|
82
82
|
ContrastMode,
|
|
83
|
-
CarouselComponent
|
|
83
|
+
CarouselComponent,
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
// Export Paragraphs
|
|
@@ -89,7 +89,7 @@ export {
|
|
|
89
89
|
TextMedia,
|
|
90
90
|
Accordion,
|
|
91
91
|
TabbedCards,
|
|
92
|
-
BrowseContent,
|
|
92
|
+
// BrowseContent, moved to FE
|
|
93
93
|
ListGroup,
|
|
94
94
|
ScrollSpy,
|
|
95
95
|
Directory,
|
|
@@ -102,7 +102,7 @@ export {
|
|
|
102
102
|
MarketingBanner,
|
|
103
103
|
RelatedInformation,
|
|
104
104
|
Calculator,
|
|
105
|
-
Chart
|
|
105
|
+
Chart,
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// Export Sub Components
|
|
@@ -116,5 +116,15 @@ export {
|
|
|
116
116
|
Breadcrumb,
|
|
117
117
|
Search,
|
|
118
118
|
VideoThumbnail,
|
|
119
|
-
ResourceGroup
|
|
119
|
+
ResourceGroup,
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Export for BrowseContent
|
|
123
|
+
import DirectoryFilters from './components/Global/DirectoryFilters/index.vue'
|
|
124
|
+
import Switcher from './components/Paragraphs/BrowseContent/switcher.vue'
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
// CardGroup, already imported
|
|
128
|
+
DirectoryFilters,
|
|
129
|
+
Switcher,
|
|
120
130
|
}
|