@worksafevictoria/wcl7.5 1.1.0-beta.112 → 1.1.0-beta.113

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.112",
3
+ "version": "1.1.0-beta.113",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -3,51 +3,51 @@
3
3
  <!-- Main details -->
4
4
  <container>
5
5
  <row class="records">
6
- <column md="2" sm="12" class="title" >
7
- <a v-if="item.title" href="javascript:void(0)" @click="this.visible = !this.visible">
8
- {{ item.title }}
9
- </a>
10
- </column>
11
- <column md="2" sm="12" class="address" >
12
- <a v-if="item.fullAddress" target="_blank" :href="gMapLink"><span class="sr-only visually-hidden">Address</span>
13
- {{ item.fullAddress }}
14
- </a>
15
- </column>
16
- <column md="2" sm="12" class="coldata longstring" >
17
- <div class="label">Email</div>
18
- <a v-if="item.email" target="_blank" :href="`mailto:${item.email}`"><span class="sr-only visually-hidden">Email address</span>
19
- {{ item.email }}
20
- </a>
21
- </column>
22
- <column md="3" sm="12" class="coldata longstring" >
23
- <div class="label">Website</div>
24
- <a v-if="item.website" target="_blank" :href="`${item.website}`"><span class="sr-only visually-hidden">Website address</span>
25
- {{ item.website }}
6
+ <column md="2" sm="12" class="title" >
7
+ <a name="titleLink" v-if="item.title" href="javascript:void(0)" :aria-expanded="visible ? 'true' : 'false'" @click="this.visible = !this.visible">
8
+ {{ item.title }}
9
+ </a>
10
+ </column>
11
+ <column md="2" sm="12" class="address" >
12
+ <a v-if="item.fullAddress" target="_blank" :href="gMapLink"><span class="sr-only visually-hidden">Address</span>
13
+ {{ item.fullAddress }}
14
+ </a>
15
+ </column>
16
+ <column md="2" sm="12" class="coldata longstring" >
17
+ <div class="label">Email</div>
18
+ <a v-if="item.email" target="_blank" :href="`mailto:${item.email}`"><span class="sr-only visually-hidden">Email address</span>
19
+ {{ item.email }}
20
+ </a>
21
+ </column>
22
+ <column md="3" sm="12" class="coldata longstring" >
23
+ <div class="label">Website</div>
24
+ <a v-if="item.website" target="_blank" :href="`${item.website}`"><span class="sr-only visually-hidden">Website address</span>
25
+ {{ item.website }}
26
+ </a>
27
+ </column>
28
+ <column md="2" sm="12" class="coldata" >
29
+ <div class="label">Phone</div>
30
+ <a v-if="item.tollfreePhone || item.workPhone" :href="`tel:${item.tollfreephone || item.workphone}`"><span class="sr-only visually-hidden">Phone number</span>
31
+ {{ item.tollfreePhone || item.workPhone }}
32
+ </a>
33
+ </column>
34
+ </row>
35
+ <div class="hscp-caret" >
36
+ <a v-if="visible" href="javascript:void(0)" @click="this.visible = false">
37
+ <img
38
+ :src="CaretUp"
39
+ height="12"
40
+ width="17"
41
+ alt="Expand Detail">
26
42
  </a>
27
- </column>
28
- <column md="2" sm="12" class="coldata" >
29
- <div class="label">Phone</div>
30
- <a v-if="item.tollfreePhone || item.workPhone" :href="`tel:${item.tollfreephone || item.workphone}`"><span class="sr-only visually-hidden">Phone number</span>
31
- {{ item.tollfreePhone || item.workPhone }}
43
+ <a v-if="!visible" href="javascript:void(0)" @click="this.visible = true">
44
+ <img
45
+ :src="CaretDown"
46
+ height="12"
47
+ width="17"
48
+ alt="Expand Detail">
32
49
  </a>
33
- </column>
34
- </row>
35
- <div class="hscp-caret" >
36
- <a v-if="visible" href="javascript:void(0)" @click="this.visible = false">
37
- <img
38
- :src="CaretUp"
39
- height="12"
40
- width="17"
41
- alt="Expand Detail">
42
- </a>
43
- <a v-if="!visible" href="javascript:void(0)" @click="this.visible = true">
44
- <img
45
- :src="CaretDown"
46
- height="12"
47
- width="17"
48
- alt="Expand Detail">
49
- </a>
50
- </div>
50
+ </div>
51
51
  </container>
52
52
 
53
53
  <!-- Additional Content -->
@@ -156,7 +156,7 @@ export default {
156
156
  item: {
157
157
  type: Object,
158
158
  required: true
159
- }
159
+ },
160
160
  },
161
161
  data() {
162
162
  return {
@@ -169,6 +169,7 @@ export default {
169
169
  gMapLink() {
170
170
  return `https://google.com/maps?q=${this.item.title}%20${this.item.fullAddress}`
171
171
  },
172
+
172
173
  },
173
174
  methods: {
174
175
  handleClick(title) {
@@ -42,9 +42,9 @@
42
42
  </column>
43
43
  </row>
44
44
  <!-- HSCP Records -->
45
- <div class="hscpRecords">
46
- <template v-for="(item, index) in resultChunks[page]">
47
- <hscp-record v-if="item.type === 'hscp'" :key="index" :item="item" />
45
+ <div class="hscpRecords" >
46
+ <template v-for="(item, index) in resultChunks[page]" >
47
+ <hscp-record v-if="item.type === 'hscp'" :key="index" :item="item"/>
48
48
  </template>
49
49
  </div>
50
50
  <div v-if="filteredRecords.length > 0" align-items="center">
@@ -137,7 +137,7 @@ export default {
137
137
 
138
138
  filteredRecords() {
139
139
  let results = this.flatRecords
140
-
140
+
141
141
  if (this.searchOrg.length) {
142
142
  this.hideReset = false
143
143
  results = results.filter(item => item.title.toLowerCase().includes(this.searchOrg.toLowerCase()))
@@ -155,6 +155,11 @@ export default {
155
155
  results = results.filter(item => item.courses.toLowerCase().includes(this.searchThemes.toLowerCase()))
156
156
  }
157
157
  this.filteredItems = results
158
+
159
+ if (this.searchOrg.length || this.searchSub.length || this.searchCourse.length || this.searchThemes.length) {
160
+ this.pageChanged(1)
161
+ }
162
+
158
163
  return results
159
164
  },
160
165
 
@@ -244,30 +249,18 @@ export default {
244
249
 
245
250
  pageChanged(ev) {
246
251
  this.page = ev - 1
247
- if (this.pageResultCount < this.perPage) {
248
- console.log('scroll to records')
249
- this.scrollToRecords()
250
- }
251
- },
252
- scrollToRecords() {
253
- if (this.$refs.records) {
254
- const element = this.$refs.records
255
- const top = element.offsetTop
256
-
257
- const buttons = [...element.querySelectorAll('button')]
258
- if (Array.isArray(buttons) && buttons.length > 0) {
259
- buttons
260
- .filter((button) => button.getAttribute('aria-expanded') === 'true')
261
- .forEach((button) => button.click())
262
-
263
- buttons[0].focus()
264
- }
252
+
253
+ const aLinks = document.getElementsByName('titleLink')
254
+ // Convert nodelist to array
255
+ let linksArr = Array.from(aLinks)
256
+ if (Array.isArray(linksArr) && linksArr.length > 0) {
257
+ linksArr
258
+ .filter((link) => link.getAttribute('aria-expanded') === 'true')
259
+ .forEach((link) => link.click())
265
260
 
266
- window.scrollTo({
267
- top,
268
- behavior: 'smooth',
269
- })
261
+ linksArr[0].focus()
270
262
  }
263
+
271
264
  },
272
265
  }
273
266
  }