@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worksafevictoria/wcl7.5",
3
- "version": "1.1.0-beta.86",
3
+ "version": "1.1.0-beta.88",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -438,15 +438,20 @@ export default {
438
438
  },
439
439
  computed: {
440
440
  updateDate() {
441
- // https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
442
- return format(new Date(this.changedDate), 'dd/MM/yyyy')
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
- processID() {
448
- return `${Date.now()}-${Math.floor(Math.random() * 10000)}`
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' + $.uid ? $.uid : ''"
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' + $.uid ? $.uid : ''"
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' + $.uid ? $.uid : ''"
54
+ :id="'sect' + itemid"
55
55
  class="accordion-item__content"
56
56
  role="region"
57
- :aria-labelledby="'accordion' + $.uid ? $.uid : ''"
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' + $.uid ? $.uid : ''"
13
+ :id="'accordion' + itemid"
14
14
  :aria-expanded="showAccordion ? 'true' : 'false'"
15
15
  class="accordion-stepper__title"
16
- :aria-controls="'sect' + $.uid ? $.uid : ''"
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' + $.uid ? $.uid : ''"
53
+ :id="'sect' + itemid"
54
54
  class="accordion-stepper__content"
55
55
  role="region"
56
- :aria-labelledby="'accordion' + $.uid ? $.uid : ''"
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
- <ol class="accordion-list">
11
- <li
12
- v-for="(item, index) in accordionList"
13
- :key="$.uid ? $.uid : '' + index"
14
- :class="{
15
- workwell: isWorkwell,
16
- rtl: rtl || item.field_rtl,
17
- stepper: isStepper,
18
- }"
19
- class="accordion"
20
- >
21
- <stepper-item
22
- v-if="isStepper"
23
- :content="hasContent(item) ? item.field_rich_text.value : ''"
24
- :title="item.field_title"
25
- class="accordion__item stepper"
26
- :rtl="rtl || item.field_rtl"
27
- :open="isAccordionOpen(index)"
28
- :number="index + 1"
29
- :is-work-well="isWorkwell"
30
- />
31
- <accordion-item
32
- v-if="!isStepper"
33
- :content="hasContent(item) ? item.field_rich_text.value : ''"
34
- :title="item.field_title"
35
- class="accordion__item"
36
- :rtl="rtl || item.field_rtl"
37
- :show-pre-heading="showPreHeading"
38
- :pre-heading="item.field_pre_heading || ''"
39
- :open="isAccordionOpen(index)"
40
- :meta="Array.isArray(item.meta) ? item.meta : []"
41
- />
42
- </li>
43
- </ol>
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
- export default {
47
- name: 'BrowseContent',
48
- components: {
49
- CardGroup,
50
- DirectoryFilters,
51
- Switcher,
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
- props: {
54
- background: {
55
- type: String,
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
- // Temp use of mounted to replace fetch
104
- async mounted() {
105
- if (this.displayedCards.length === 0) {
106
- await this.loadFiltersAndContent()
107
- }
68
+ titleTag: {
69
+ type: String,
70
+ default: 'h2',
108
71
  },
109
- // TODO useAsyncData <script setup>
110
- // async fetch() {
111
- // if (this.displayedCards.length === 0) {
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
- fetchOnServer: true,
131
- fetchKey: 'ws-browscontent',
132
- methods: {
133
- async loadFiltersAndContent() {
134
- await Promise.all([
135
- this.fetchFilters ? this.loadFilters() : Promise.resolve(),
136
- this.loadMoreCards(true),
137
- ])
138
- },
139
- init() {
140
- this.allCards = {
141
- total: 0,
142
- cards: [],
143
- }
144
- this.displayLimit = 0
145
- this.hasMorePages = false
146
- this.displayedCards = []
147
- this.bundleCache = {}
148
- },
149
- async fetchCards(currentDisplayedCards, allCards, addMoreBy, bundles) {
150
- const shouldMakeNewFetchCall =
151
- currentDisplayedCards.length + addMoreBy > allCards.cards.length
152
- if (shouldMakeNewFetchCall) {
153
- const cardBundles = await Promise.all(
154
- bundles.map((bundle, index) =>
155
- this.getBundle(bundle, addMoreBy, index),
156
- ),
157
- )
158
- allCards = this.getShuffledCards(cardBundles)
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
- if (
161
- this.type === 'paragraph--cards_group_latest' ||
162
- this.type === 'paragraph--browse_content'
163
- ) {
164
- allCards.cards = this.sortByDate(allCards.cards)
165
- }
166
- }
167
- return allCards
168
- },
169
- async loadMoreCards(init) {
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
- if (cache.qs.start === undefined) {
210
- start = 0
211
- } else if (cache.response.numFound > cache.response.results.length) {
212
- start = cache.response.results.length
213
- } else {
214
- return Promise.resolve(cache.response)
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
- const qs = {
218
- bundle,
219
- rows,
220
- start,
221
- }
222
- return this.fetchContent(qs, this.filters.selected, index).then(
223
- (response) => {
224
- cache.qs.start = qs.start
225
- cache.response.numFound = response.numFound
226
- cache.response.results.push(...response.results)
227
- return cache.response
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
- getShuffledCards(cardBundles) {
232
- const shuffled = []
233
- const bundleWithMostCards = cardBundles.reduce(
234
- (a, b) => (a.results.length > b.results.length ? a : b),
235
- { results: [] },
236
- ).results.length
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
- for (let i = 0; i < bundleWithMostCards; i++) {
239
- cardBundles.forEach((bundle) => {
240
- if (bundle.results[i]) {
241
- shuffled.push(bundle.results[i])
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
- const total = cardBundles.reduce((acc, bundle) => {
247
- return acc + bundle.numFound
248
- }, 0)
222
+ const total = cardBundles.reduce((acc, bundle) => {
223
+ return acc + bundle.numFound
224
+ }, 0)
249
225
 
250
- return { cards: shuffled, total }
251
- },
252
- loadFilters() {
253
- return this.fetchFilters().then((taxonomies) => {
254
- this.filters.taxonomies = taxonomies
255
- return Promise.resolve(taxonomies)
256
- })
257
- },
258
- onFilter(filters) {
259
- this.bundleCache = {}
260
- Object.keys(filters).forEach((filter) => {
261
- this.filters.selected[filter] = filters[filter].map((obj) => obj.tid)
262
- })
263
- this.loadMoreCards(true)
264
- },
265
- onSwitcher(switchToBundle) {
266
- this.filters.selected = {}
267
- this.filters.availableBundles.length = 0
268
- if (switchToBundle) {
269
- this.filters.availableBundles.push(switchToBundle)
270
- }
271
- this.loadMoreCards(true)
272
- },
273
- async reset() {
274
- this.bundleCache = {}
275
- this.filters.selected = {}
276
- this.filters.availableBundles.length = 0
277
- await this.loadMoreCards(true)
278
- },
279
- sortByDate(cards) {
280
- const sorted = cards.sort((a, b) => {
281
- return new Date(b.dateSort) - new Date(a.dateSort)
282
- })
283
- return sorted
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
  }