@worksafevictoria/wcl7.5 1.9.0-beta.15 → 1.9.0-beta.17

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.
@@ -4,31 +4,43 @@
4
4
  <row style="column-gap: 16px">
5
5
  <!-- Keyword Filters -->
6
6
  <column xxl="2" xl="3" md="4" sm="6">
7
- <label class="visually-hidden" for="search-directory">
7
+ <label class="col-form-label visually-hidden" for="search-keyword">
8
8
  Search by keyword (typed keyword automatically filters below results)
9
9
  </label>
10
10
  <input
11
+ id="search-keyword"
11
12
  type="text"
12
13
  v-model="searchOrg"
13
14
  placeholder="Organisation"
15
+ aria-label="Search by keyword (typed keyword automatically filters below results)"
14
16
  class="search"
15
17
  />
16
18
  </column>
17
19
  <column xxl="2" xl="3" md="4" sm="6">
18
- <label class="visually-hidden" for="search-directory">
20
+ <label class="col-form-label visually-hidden" for="search-suburb">
19
21
  Search by suburb (typed suburb automatically filters below results)
20
22
  </label>
21
23
  <input
24
+ id="search-suburb"
22
25
  type="text"
23
26
  v-model="searchSub"
24
27
  placeholder="Training location"
28
+ aria-label="Search by suburb (typed suburb automatically filters below results)"
25
29
  class="search"
26
30
  />
27
31
  </column>
28
32
  <!-- Other Filters -->
29
33
  <column xxl="2" xl="3" md="4" sm="6">
30
- <label class="visually-hidden" for="filterType"> Filter Type </label>
31
- <select id="filterType" v-model="searchCourse" name="filter" class="selectClass">
34
+ <label class="col-form-label visually-hidden" for="filterType">
35
+ Filter Type
36
+ </label>
37
+ <select
38
+ id="filterType"
39
+ v-model="searchCourse"
40
+ name="filter"
41
+ aria-label="Filter Type"
42
+ class="selectClass"
43
+ >
32
44
  <option class="placeholder" value="" disabled hidden selected>
33
45
  Course type
34
46
  </option>
@@ -43,7 +55,9 @@
43
55
  name="filter1"
44
56
  class="selectClass"
45
57
  >
46
- <option class="placeholder" value="" disabled hidden selected>Theme</option>
58
+ <option class="placeholder" value="" disabled hidden selected>
59
+ Theme
60
+ </option>
47
61
  <option v-for="(opt, i) in themeOptions" :key="i" :value="opt">
48
62
  {{ opt }}
49
63
  </option>
@@ -79,14 +93,14 @@
79
93
  </template>
80
94
 
81
95
  <script>
82
- import hscpRecord from "./SingleRecord/index.vue";
83
- import searchIcon from "./../../../../../assets/icons/search.svg?url";
84
- import SectionGroup from "../../../../Containers/SectionGroup/index.vue";
85
- import FilterButton from "../../../../Common/FilterButton/index.vue"; //Reset
86
- import Pagination from "./pagination.vue";
96
+ import hscpRecord from './SingleRecord/index.vue'
97
+ import searchIcon from './../../../../../assets/icons/search.svg?url'
98
+ import SectionGroup from '../../../../Containers/SectionGroup/index.vue'
99
+ import FilterButton from '../../../../Common/FilterButton/index.vue' //Reset
100
+ import Pagination from './pagination.vue'
87
101
 
88
102
  export default {
89
- name: "HSCP",
103
+ name: 'HSCP',
90
104
  components: {
91
105
  hscpRecord,
92
106
  SectionGroup,
@@ -95,16 +109,16 @@ export default {
95
109
  },
96
110
  data() {
97
111
  return {
98
- searchOrg: "",
99
- searchSub: "",
100
- searchCourse: "",
101
- searchThemes: "",
112
+ searchOrg: '',
113
+ searchSub: '',
114
+ searchCourse: '',
115
+ searchThemes: '',
102
116
  filteredItems: null,
103
117
  perPage: 10,
104
118
  page: 0,
105
119
  searchIcon,
106
120
  hideReset: true,
107
- };
121
+ }
108
122
  },
109
123
  props: {
110
124
  items: {
@@ -116,62 +130,64 @@ export default {
116
130
  computed: {
117
131
  themeOptions() {
118
132
  // Concatenate all themes, remove duplicates, sort and use for a drop-down list
119
- let allThemes = this.flatRecords.map((a) => a.themes);
120
- allThemes = allThemes.join(",");
121
- allThemes = allThemes.trim();
122
- allThemes = allThemes.split(",");
133
+ let allThemes = this.flatRecords.map((a) => a.themes)
134
+ allThemes = allThemes.join(',')
135
+ allThemes = allThemes.trim()
136
+ allThemes = allThemes.split(',')
123
137
  // Change all themes to title case
124
138
  for (var i = 0; i < allThemes.length; i++) {
125
- let newVal = this.toTitleCase(allThemes[i]);
126
- allThemes[i] = newVal;
139
+ let newVal = this.toTitleCase(allThemes[i])
140
+ allThemes[i] = newVal
127
141
  }
128
142
  // Remove duplicates
129
- let s = new Set(allThemes);
130
- allThemes = [...s];
143
+ let s = new Set(allThemes)
144
+ allThemes = [...s]
131
145
 
132
146
  // Sort the themes
133
147
  let sortedThemes = allThemes.sort((a, b) => {
134
148
  if (a.trim() < b.trim()) {
135
- return -1;
149
+ return -1
136
150
  }
137
151
  if (a.trim() > b.trim()) {
138
- return 1;
152
+ return 1
139
153
  }
140
- return 0;
141
- });
142
- allThemes = sortedThemes;
154
+ return 0
155
+ })
156
+ allThemes = sortedThemes
143
157
 
144
- return allThemes;
158
+ return allThemes
145
159
  },
146
160
 
147
161
  filteredRecords() {
148
- let results = this.flatRecords;
162
+ let results = this.flatRecords
149
163
 
150
164
  if (this.searchOrg.length) {
151
- this.hideReset = false;
165
+ this.hideReset = false
152
166
  results = results.filter((item) =>
153
- item.title.toLowerCase().includes(this.searchOrg.toLowerCase())
154
- );
167
+ item.title.toLowerCase().includes(this.searchOrg.toLowerCase()),
168
+ )
155
169
  }
156
170
  if (this.searchSub.length) {
157
- this.hideReset = false;
171
+ this.hideReset = false
158
172
  results = results.filter((item) =>
159
- item.trainingVenues.toLowerCase().includes(this.searchSub.toLowerCase())
160
- );
173
+ item.trainingVenues
174
+ .toLowerCase()
175
+ .includes(this.searchSub.toLowerCase()),
176
+ )
161
177
  }
162
178
  if (this.searchCourse.length) {
163
- this.hideReset = false;
179
+ this.hideReset = false
164
180
  results = results.filter((item) =>
165
- item.courses.toLowerCase().includes(this.searchCourse.toLowerCase())
166
- );
181
+ item.courses.toLowerCase().includes(this.searchCourse.toLowerCase()),
182
+ )
167
183
  }
168
184
  if (this.searchThemes.length) {
169
- this.hideReset = false;
185
+ this.hideReset = false
170
186
  results = results.filter((item) =>
171
- item.themes.toLowerCase().includes(this.searchThemes.toLowerCase())
172
- );
187
+ item.themes.toLowerCase().includes(this.searchThemes.toLowerCase()),
188
+ )
173
189
  }
174
- this.filteredItems = results;
190
+ this.filteredItems = results
175
191
 
176
192
  if (
177
193
  this.searchOrg.length ||
@@ -179,26 +195,26 @@ export default {
179
195
  this.searchCourse.length ||
180
196
  this.searchThemes.length
181
197
  ) {
182
- this.pageChanged(1);
198
+ this.pageChanged(1)
183
199
  }
184
200
 
185
- return results;
201
+ return results
186
202
  },
187
203
 
188
204
  flatRecords() {
189
- let flatRecords = [];
205
+ let flatRecords = []
190
206
  const sortedItems = this.items.sort((a, b) => {
191
207
  if (a.Organisation < b.Organisation) {
192
- return -1;
208
+ return -1
193
209
  }
194
210
  if (a.Organisation > b.Organisation) {
195
- return 1;
211
+ return 1
196
212
  }
197
- return 0;
198
- });
213
+ return 0
214
+ })
199
215
  sortedItems.forEach((record) => {
200
216
  flatRecords.push({
201
- type: "hscp",
217
+ type: 'hscp',
202
218
  title: record.Organisation,
203
219
  fullAddress: record.Main_office_address,
204
220
  orgAcronym: record.Organisation_acronym,
@@ -212,73 +228,73 @@ export default {
212
228
  contact2: record.Contact_2_Name,
213
229
  email2: record.Contact_2_Email,
214
230
  phone2: record.Contact_2_Phone,
215
- courses: record.Training_courses.replace(/,$/, ""),
216
- themes: record.Themes.replace(/,$/, ""),
231
+ courses: record.Training_courses.replace(/,$/, ''),
232
+ themes: record.Themes.replace(/,$/, ''),
217
233
  trainingVenues: record.Training_venues,
218
- });
219
- });
220
- return flatRecords;
234
+ })
235
+ })
236
+ return flatRecords
221
237
  },
222
238
  resultChunks() {
223
- return this.chunkify(this.filteredItems || this.items, this.perPage);
239
+ return this.chunkify(this.filteredItems || this.items, this.perPage)
224
240
  },
225
241
  noRecordsFound() {
226
- return this.resultChunks[0].length === 0;
242
+ return this.resultChunks[0].length === 0
227
243
  },
228
244
  totalResults() {
229
- return Array.isArray(this.filteredItems) ? this.filteredItems.length : 0;
245
+ return Array.isArray(this.filteredItems) ? this.filteredItems.length : 0
230
246
  },
231
247
  totalPages() {
232
- return this.resultChunks.length;
248
+ return this.resultChunks.length
233
249
  },
234
250
  pageResultCount() {
235
- return this.resultChunks[this.page].length;
251
+ return this.resultChunks[this.page].length
236
252
  },
237
253
  },
238
254
 
239
255
  methods: {
240
256
  formatWebsite(url) {
241
- let startUrl = url.slice(0, 3);
242
- let returnUrl = url;
243
- if (startUrl.toLowerCase() === "www") {
244
- returnUrl = "https://" + url;
257
+ let startUrl = url.slice(0, 3)
258
+ let returnUrl = url
259
+ if (startUrl.toLowerCase() === 'www') {
260
+ returnUrl = 'https://' + url
245
261
  }
246
262
  if (
247
- startUrl.toLowerCase() !== "htt" &&
248
- startUrl.toLowerCase() !== "www" &&
249
- url !== ""
263
+ startUrl.toLowerCase() !== 'htt' &&
264
+ startUrl.toLowerCase() !== 'www' &&
265
+ url !== ''
250
266
  ) {
251
- returnUrl = "https://www." + url;
267
+ returnUrl = 'https://www.' + url
252
268
  }
253
- return returnUrl;
269
+ return returnUrl
254
270
  },
255
271
 
256
272
  chunkify(arr, n) {
257
273
  if (arr) {
258
274
  const chunked = arr.reduce(
259
275
  (chunk, val) => {
260
- if (chunk[chunk.length - 1].length === n) chunk.push([]);
261
- chunk[chunk.length - 1].push(val);
262
- return chunk;
276
+ if (chunk[chunk.length - 1].length === n) chunk.push([])
277
+ chunk[chunk.length - 1].push(val)
278
+ return chunk
263
279
  },
264
- [[]]
265
- );
266
- return chunked;
280
+ [[]],
281
+ )
282
+ return chunked
267
283
  }
268
- return [[]];
284
+ return [[]]
269
285
  },
270
286
 
271
287
  reset() {
272
- this.collapseOrgs("No");
273
- this.hideReset = true;
274
- this.searchOrg = "";
275
- this.searchCourse = "";
276
- this.searchSub = "";
277
- this.searchThemes = "";
288
+ this.collapseOrgs('No')
289
+ this.hideReset = true
290
+ this.searchOrg = ''
291
+ this.searchCourse = ''
292
+ this.searchSub = ''
293
+ this.searchThemes = ''
278
294
  },
279
295
 
280
296
  pageChanged(ev) {
281
- this.page = ev - 1;
297
+ this.page = ev - 1
282
298
 
283
299
  if (
284
300
  this.searchOrg.length ||
@@ -290,41 +306,41 @@ export default {
290
306
  // don't collapseOrgs
291
307
  } else {
292
308
  // set focus to top element - used instead of scrollTo
293
- this.collapseOrgs("Yes");
309
+ this.collapseOrgs('Yes')
294
310
  }
295
311
  },
296
312
 
297
313
  collapseOrgs(focusLink) {
298
314
  // called by pageChanged and reset. pageChanged called by filter and by pagination links
299
- const aLinks = document.getElementsByName("titleLink");
315
+ const aLinks = document.getElementsByName('titleLink')
300
316
  // Convert nodelist to array
301
- let linksArr = Array.from(aLinks);
317
+ let linksArr = Array.from(aLinks)
302
318
  if (Array.isArray(linksArr) && linksArr.length > 0) {
303
319
  linksArr
304
- .filter((link) => link.getAttribute("aria-expanded") === "true")
305
- .forEach((link) => link.click());
320
+ .filter((link) => link.getAttribute('aria-expanded') === 'true')
321
+ .forEach((link) => link.click())
306
322
 
307
- if (focusLink === "Yes") {
308
- linksArr[0].focus();
323
+ if (focusLink === 'Yes') {
324
+ linksArr[0].focus()
309
325
  }
310
326
  }
311
327
  },
312
328
 
313
329
  toTitleCase(strVal) {
314
- let retVal = strVal.trim();
330
+ let retVal = strVal.trim()
315
331
 
316
- const firstChar = retVal.charAt(0);
317
- const firstCharU = firstChar.toUpperCase();
318
- const remChar = retVal.slice(1);
332
+ const firstChar = retVal.charAt(0)
333
+ const firstCharU = firstChar.toUpperCase()
334
+ const remChar = retVal.slice(1)
319
335
 
320
- retVal = firstCharU + remChar;
336
+ retVal = firstCharU + remChar
321
337
 
322
- return retVal;
338
+ return retVal
323
339
  },
324
340
  },
325
- };
341
+ }
326
342
  </script>
327
343
 
328
344
  <style lang="scss" scoped>
329
- @import "../styles.scss";
345
+ @import '../styles.scss';
330
346
  </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <card-grid
3
3
  :title="title"
4
- :title-tag="headingTag"
4
+ :title-tag="headingTag || 'h3'"
5
5
  :cards="itemList"
6
6
  :rtl="rtl"
7
7
  :force-md-columns-per-row="columns < 3 ? 3 : columns"
@@ -9,7 +9,7 @@
9
9
  class="statistics__grid"
10
10
  >
11
11
  <template v-slot:cardItem="{ card }">
12
- <hr class="statistics__hr" />
12
+ <hr class="statistics__hr" aria-hidden="true" />
13
13
  <card-grid-item
14
14
  :card-header-title="card.statistic"
15
15
  :header-tag="'div'"
@@ -47,25 +47,25 @@ export default {
47
47
  props: {
48
48
  title: {
49
49
  type: String,
50
- default: null
50
+ default: null,
51
51
  },
52
52
  headingTag: {
53
53
  type: String,
54
- default: 'h2'
54
+ default: 'h2',
55
55
  },
56
56
  itemList: {
57
57
  type: Array,
58
- required: true
58
+ required: true,
59
59
  },
60
60
  rtl: {
61
61
  type: Boolean,
62
- default: false
62
+ default: false,
63
63
  },
64
64
  columns: {
65
65
  type: Number,
66
- default: 3
67
- }
68
- }
66
+ default: 3,
67
+ },
68
+ },
69
69
  }
70
70
  </script>
71
71
 
@@ -17,6 +17,12 @@
17
17
  :responsive="!isFluid"
18
18
  :stacked="!isFluid ? 'sm' : false"
19
19
  :must-sort="true"
20
+ :tbody-tr-attrs="
21
+ () => ({
22
+ role: 'button',
23
+ tabindex: 0,
24
+ })
25
+ "
20
26
  >
21
27
  <template #head()="data">
22
28
  <span
@@ -17,11 +17,13 @@
17
17
  :aria-expanded="
18
18
  isMobile || isResourceGroup
19
19
  ? cardMenuIsOpen
20
- ? 'true'
21
- : 'false'
20
+ ? true
21
+ : false
22
22
  : false
23
23
  "
24
24
  role="button"
25
+ :aria-controls="`menu-panel-${card.ItemId}`"
26
+ tabindex="0"
25
27
  class="card_item-menu__title--link nolink"
26
28
  >
27
29
  <img
@@ -54,7 +56,10 @@
54
56
  >
55
57
  {{ card.fileTypeTitle }}
56
58
  <column class="card_item__meta card_item__meta--filetype">
57
- <rich-text :content="card.fileType" :without-container="true" />
59
+ <rich-text
60
+ :content="card.fileType"
61
+ :without-container="true"
62
+ />
58
63
  </column>
59
64
  </li>
60
65
  <li
@@ -66,7 +71,10 @@
66
71
  >
67
72
  {{ card.fileSizeTitle }}
68
73
  <column class="card_item__meta card_item__meta--filesize">
69
- <rich-text :content="card.fileSize" :without-container="true" />
74
+ <rich-text
75
+ :content="card.fileSize"
76
+ :without-container="true"
77
+ />
70
78
  </column>
71
79
  </li>
72
80
  <li
@@ -78,7 +86,10 @@
78
86
  >
79
87
  {{ card.fileLengthTitle }}
80
88
  <column class="card_item__meta card_item__meta--filelength">
81
- <rich-text :content="card.fileLength" :without-container="true" />
89
+ <rich-text
90
+ :content="card.fileLength"
91
+ :without-container="true"
92
+ />
82
93
  </column>
83
94
  </li>
84
95
  <li
@@ -90,7 +101,10 @@
90
101
  >
91
102
  {{ card.readingLevelTitle }}
92
103
  <column class="card_item__meta card_item__meta--readinglevel">
93
- <rich-text :content="card.readingLevel" :without-container="true" />
104
+ <rich-text
105
+ :content="card.readingLevel"
106
+ :without-container="true"
107
+ />
94
108
  </column>
95
109
  </li>
96
110
  </ul>
@@ -107,13 +121,13 @@
107
121
  </template>
108
122
 
109
123
  <script>
110
- import Row from "../../Containers/Row/index.vue";
111
- import Column from "../../Containers/Column/index.vue";
112
- import CardFooter from "./cardfooter.vue";
113
- import documentsvg from "../../../assets/icons/document.svg?url";
114
- import CaretUp from "../../../assets/icons/caret-up.svg?url";
115
- import CaretDown from "../../../assets/icons/caret-down.svg?url";
116
- import RichText from "../../Paragraphs/RichText/index.vue";
124
+ import Row from '../../Containers/Row/index.vue'
125
+ import Column from '../../Containers/Column/index.vue'
126
+ import CardFooter from './cardfooter.vue'
127
+ import documentsvg from '../../../assets/icons/document.svg?url'
128
+ import CaretUp from '../../../assets/icons/caret-up.svg?url'
129
+ import CaretDown from '../../../assets/icons/caret-down.svg?url'
130
+ import RichText from '../../Paragraphs/RichText/index.vue'
117
131
 
118
132
  export default {
119
133
  components: {
@@ -129,7 +143,7 @@ export default {
129
143
  },
130
144
  resourceType: {
131
145
  type: String,
132
- default: "resource-group",
146
+ default: 'resource-group',
133
147
  },
134
148
  },
135
149
  data() {
@@ -141,35 +155,35 @@ export default {
141
155
  CaretUp,
142
156
  CaretDown,
143
157
  windowWidth: 0,
144
- };
158
+ }
145
159
  },
146
160
  computed: {
147
161
  isMobile() {
148
- return this.windowWidth < 768;
162
+ return this.windowWidth < 768
149
163
  },
150
164
  isResourceGroup() {
151
- return this.cardResourseType === "resource-group" ? true : false;
165
+ return this.cardResourseType === 'resource-group' ? true : false
152
166
  },
153
167
  },
154
168
  mounted() {
155
169
  this.$nextTick(() => {
156
- window.addEventListener("resize", this.onResize);
157
- });
158
- this.onResize();
170
+ window.addEventListener('resize', this.onResize)
171
+ })
172
+ this.onResize()
159
173
  },
160
174
  beforeDestroy() {
161
- window.removeEventListener("resize", this.onResize);
175
+ window.removeEventListener('resize', this.onResize)
162
176
  },
163
177
  methods: {
164
178
  handleMenuItemClick(menuItem) {
165
179
  if (this.isMobile || this.isResourceGroup) {
166
180
  for (let i = 0; i < menuItem.length; i++) {
167
- let newMenuItem = menuItem[i];
181
+ let newMenuItem = menuItem[i]
168
182
 
169
- this.cardMenuIsOpen = !this.cardMenuIsOpen;
183
+ this.cardMenuIsOpen = !this.cardMenuIsOpen
170
184
 
171
- newMenuItem.isOpen = false;
172
- menuItem.splice(i, 1, newMenuItem);
185
+ newMenuItem.isOpen = false
186
+ menuItem.splice(i, 1, newMenuItem)
173
187
  }
174
188
  }
175
189
  },
@@ -177,33 +191,33 @@ export default {
177
191
  if (this.isMobile || this.isResourceGroup) {
178
192
  if (event.keyCode === 32 || event.keyCode === 13) {
179
193
  for (let i = 0; i < menuItem.length; i++) {
180
- let newMenuItem = menuItem[i];
181
- this.cardMenuIsOpen = !this.cardMenuIsOpen;
182
- newMenuItem.isOpen = false;
183
- menuItem.splice(i, 1, newMenuItem);
194
+ let newMenuItem = menuItem[i]
195
+ this.cardMenuIsOpen = !this.cardMenuIsOpen
196
+ newMenuItem.isOpen = false
197
+ menuItem.splice(i, 1, newMenuItem)
184
198
  }
185
199
  }
186
200
  }
187
201
  },
188
202
  onResize() {
189
- this.windowWidth = window.innerWidth;
190
- let titles = document.getElementsByClassName("card_item-menu__title");
203
+ this.windowWidth = window.innerWidth
204
+ let titles = document.getElementsByClassName('card_item-menu__title')
191
205
  if (Array.isArray(titles)) {
192
206
  if (this.isMobile || this.isResourceGroup) {
193
207
  titles.forEach((t) => {
194
- t.setAttribute("tabIndex", "0");
195
- });
208
+ t.setAttribute('tabIndex', '0')
209
+ })
196
210
  } else {
197
211
  titles.forEach((t) => {
198
- t.removeAttribute("tabIndex");
199
- });
212
+ t.removeAttribute('tabIndex')
213
+ })
200
214
  }
201
215
  }
202
216
  },
203
217
  },
204
- };
218
+ }
205
219
  </script>
206
220
  <style lang="scss" scoped>
207
- @import "../../../includes/scss/all";
208
- @import "./styles";
221
+ @import '../../../includes/scss/all';
222
+ @import './styles';
209
223
  </style>