@worksafevictoria/wcl7.5 1.7.3 → 1.8.0-beta.2

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.7.3",
3
+ "version": "1.8.0-beta.2",
4
4
  "main": "src/index.js",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -52,13 +52,13 @@
52
52
  </template>
53
53
 
54
54
  <script>
55
- import Row from './../../Containers/Row/index.vue'
56
- import Column from './../../Containers/Column/index.vue'
57
- import SectionGroup from './../../Containers/SectionGroup/index.vue'
58
- import { debounce } from 'lodash-es'
55
+ import Row from "./../../Containers/Row/index.vue";
56
+ import Column from "./../../Containers/Column/index.vue";
57
+ import SectionGroup from "./../../Containers/SectionGroup/index.vue";
58
+ import { debounce } from "lodash-es";
59
59
 
60
60
  export default {
61
- name: 'CardGrid',
61
+ name: "CardGrid",
62
62
  components: { Row, Column, SectionGroup },
63
63
  props: {
64
64
  title: {
@@ -71,7 +71,7 @@ export default {
71
71
  },
72
72
  titleTag: {
73
73
  type: String,
74
- default: 'h2',
74
+ default: "h2",
75
75
  },
76
76
  cards: {
77
77
  type: Array,
@@ -99,9 +99,9 @@ export default {
99
99
  },
100
100
  size: {
101
101
  type: String,
102
- default: 'page',
102
+ default: "page",
103
103
  validator: (value) =>
104
- ['half-content', 'content', 'page', 'full'].indexOf(value) >= 0,
104
+ ["half-content", "content", "page", "full"].indexOf(value) >= 0,
105
105
  },
106
106
  isSelectable: {
107
107
  type: Boolean,
@@ -112,23 +112,17 @@ export default {
112
112
  },
113
113
  backgroundVariant: {
114
114
  type: String,
115
- default: 'none',
115
+ default: "none",
116
116
  validator: (value) =>
117
- [
118
- 'none',
119
- 'light',
120
- 'dark',
121
- 'grey',
122
- 'yellow',
123
- 'white',
124
- 'lightblue',
125
- ].indexOf(value) >= 0,
117
+ ["none", "light", "dark", "grey", "yellow", "white", "lightblue"].indexOf(
118
+ value
119
+ ) >= 0,
126
120
  },
127
121
  applyBackgroundOn: {
128
122
  type: String,
129
- default: 'section',
123
+ default: "section",
130
124
  validator: (value) =>
131
- ['content', 'block', 'container', 'section'].indexOf(value) >= 0,
125
+ ["content", "block", "container", "section"].indexOf(value) >= 0,
132
126
  },
133
127
  noPaddingTop: {
134
128
  type: Boolean,
@@ -138,8 +132,8 @@ export default {
138
132
  },
139
133
  rowSpacing: {
140
134
  type: String,
141
- default: 'large',
142
- validator: (value) => ['none', 'small', 'large'].indexOf(value) >= 0,
135
+ default: "large",
136
+ validator: (value) => ["none", "small", "large"].indexOf(value) >= 0,
143
137
  },
144
138
  rowClasses: {
145
139
  type: String,
@@ -147,12 +141,12 @@ export default {
147
141
  },
148
142
  columnSpacing: {
149
143
  type: String,
150
- default: 'default',
151
- validator: (value) => ['default', 'none'].indexOf(value) >= 0,
144
+ default: "default",
145
+ validator: (value) => ["default", "none"].indexOf(value) >= 0,
152
146
  },
153
147
  contentClass: {
154
148
  type: String,
155
- default: '',
149
+ default: "",
156
150
  },
157
151
  cardBrowseContent: {
158
152
  type: Boolean,
@@ -160,7 +154,7 @@ export default {
160
154
  },
161
155
  gridId: {
162
156
  type: String,
163
- default: 'default',
157
+ default: "default",
164
158
  },
165
159
  },
166
160
  data() {
@@ -168,89 +162,88 @@ export default {
168
162
  childCards: [],
169
163
  redrawCounter: 0,
170
164
  setColumnSizeDebounce: debounce(this.setColumnSize, 500),
171
- }
165
+ };
172
166
  },
173
167
  computed: {
174
168
  largeViewPort() {
175
169
  if (this.forceLgColumnsPerRow) {
176
- return 12 / this.forceLgColumnsPerRow
170
+ return 12 / this.forceLgColumnsPerRow;
177
171
  }
178
172
  return 12 / this.cards.length > 12 / (this.columnsPerRow || 3)
179
173
  ? 12 / this.cards.length
180
- : 12 / this.columnsPerRow
174
+ : 12 / this.columnsPerRow;
181
175
  },
182
176
  mediumViewPort() {
183
177
  if (this.forceMdColumnsPerRow) {
184
- return 12 / this.forceLgColumnsPerRow
178
+ return 12 / this.forceLgColumnsPerRow;
185
179
  }
186
180
  if (this.largeViewPort === 6) {
187
- return 6
181
+ return 6;
188
182
  }
189
- return 4
183
+ return 4;
190
184
  },
191
185
  smallViewPort() {
192
186
  if (this.forceSmColumnsPerRow) {
193
- return 12 / this.forceLgColumnsPerRow
187
+ return 12 / this.forceLgColumnsPerRow;
194
188
  }
195
- return 6
189
+ return 6;
196
190
  },
197
191
  },
198
192
  watch: {
199
193
  cards: {
200
194
  handler: function () {
201
- this.redrawCounter += 1
202
- this.setColumnSizeDebounce()
195
+ this.redrawCounter += 1;
196
+ this.setColumnSizeDebounce();
203
197
  },
204
198
  deep: true,
205
199
  },
206
200
  columnsPerRow: {
207
201
  handler: function () {
208
- this.setColumnSizeDebounce()
202
+ this.setColumnSizeDebounce();
209
203
  },
210
204
  },
211
205
  forceSmColumnsPerRow: {
212
206
  handler: function () {
213
- this.setColumnSizeDebounce()
207
+ this.setColumnSizeDebounce();
214
208
  },
215
209
  },
216
210
  forceMdColumnsPerRow: {
217
211
  handler: function () {
218
- this.setColumnSizeDebounce()
212
+ this.setColumnSizeDebounce();
219
213
  },
220
214
  },
221
215
  forceLgColumnsPerRow: {
222
216
  handler: function () {
223
- this.setColumnSizeDebounce()
217
+ this.setColumnSizeDebounce();
224
218
  },
225
219
  },
226
220
  },
227
221
  mounted() {
228
- window.addEventListener('resize', this.setColumnSizeDebounce)
229
- this.setColumnSizeDebounce()
222
+ window.addEventListener("resize", this.setColumnSizeDebounce);
223
+ this.setColumnSizeDebounce();
230
224
  },
231
225
  beforeDestroy() {
232
- window.removeEventListener('resize', this.setColumnSizeDebounce)
226
+ window.removeEventListener("resize", this.setColumnSizeDebounce);
233
227
  },
234
228
  methods: {
235
229
  cardTitleSelected(selectedCard, ev) {
236
- this.clearCards()
237
- selectedCard.selected = !!!selectedCard.selected
238
- const selectedCardModelIndex = this.getChildIndex(selectedCard)
230
+ this.clearCards();
231
+ selectedCard.selected = !!!selectedCard.selected;
232
+ const selectedCardModelIndex = this.getChildIndex(selectedCard);
239
233
 
240
- this.$emit('selected-title', {
241
- selectedCard: selectedCard.selected
242
- ? this.cards[selectedCardModelIndex]
243
- : null,
234
+ this.$emit("selected-title", {
235
+ selectedCard: selectedCard.selected ? this.cards[selectedCardModelIndex] : null,
244
236
  selectedCardModelIndex,
245
237
  ev,
246
- })
238
+ });
247
239
  },
248
240
  cardSelected(selectedCard, ev) {
249
- this.clearCards()
250
- selectedCard.selected = !!!selectedCard.selected
251
- const selectedCardModelIndex = this.getChildIndex(selectedCard)
241
+ debugger;
242
+ this.clearCards();
243
+ selectedCard.selected = !!!selectedCard.selected;
244
+ const selectedCardModelIndex = this.getChildIndex(selectedCard);
252
245
 
253
- this.$emit('selected', {
246
+ this.$emit("selected", {
254
247
  selectedCard: selectedCard.selected
255
248
  ? this.cardBrowseContent
256
249
  ? this.childCards[selectedCardModelIndex]
@@ -258,59 +251,59 @@ export default {
258
251
  : null,
259
252
  selectedCardModelIndex,
260
253
  ev,
261
- })
254
+ });
262
255
  },
263
256
  clearCards(selectedCard) {
264
257
  this.childCards.forEach((card) => {
265
- card.selected = false
258
+ card.selected = false;
266
259
  if (!selectedCard || selectedCard !== card) {
267
- card.selected = false
260
+ card.selected = false;
268
261
  }
269
- })
262
+ });
270
263
  },
271
264
  getChildIndex(selectedCard) {
272
- return this.childCards.findIndex((item) => item === selectedCard)
265
+ return this.childCards.findIndex((item) => item === selectedCard);
273
266
  },
274
267
  registerChild(child) {
275
- this.childCards.push(child)
276
- this.setColumnSizeDebounce()
268
+ this.childCards.push(child);
269
+ this.setColumnSizeDebounce();
277
270
  },
278
271
  deregisterChild(child) {
279
- const index = this.childCards.indexOf(child)
272
+ const index = this.childCards.indexOf(child);
280
273
  if (index > -1) {
281
- this.childCards.splice(index, 1)
274
+ this.childCards.splice(index, 1);
282
275
  }
283
276
  },
284
277
  setColumnSize() {
285
278
  setTimeout(() => {
286
- const columns = this.$refs.cardColumns
279
+ const columns = this.$refs.cardColumns;
287
280
  if (Array.isArray(columns) && columns.length > 0) {
288
- const row = this.$refs.cardRow
289
- const elementWidth = columns[0].$el.offsetWidth
290
- const parentWidth = row.$el.offsetWidth
291
- const gridColumnSize = parseInt(parentWidth / elementWidth)
292
- const isMobileView = parentWidth < 480
293
- const isTabletView = !isMobileView && parentWidth < 767
294
- this.$emit('isMobileView', isMobileView)
295
- this.$emit('isTabletView', isTabletView)
296
- this.$emit('isDesktopView', !isTabletView && !isMobileView)
297
- this.$emit('isMobileOrTabletView', isMobileView || isTabletView)
298
- this.$emit('gridColumnSize', gridColumnSize)
281
+ const row = this.$refs.cardRow;
282
+ const elementWidth = columns[0].$el.offsetWidth;
283
+ const parentWidth = row.$el.offsetWidth;
284
+ const gridColumnSize = parseInt(parentWidth / elementWidth);
285
+ const isMobileView = parentWidth < 480;
286
+ const isTabletView = !isMobileView && parentWidth < 767;
287
+ this.$emit("isMobileView", isMobileView);
288
+ this.$emit("isTabletView", isTabletView);
289
+ this.$emit("isDesktopView", !isTabletView && !isMobileView);
290
+ this.$emit("isMobileOrTabletView", isMobileView || isTabletView);
291
+ this.$emit("gridColumnSize", gridColumnSize);
299
292
  this.childCards.forEach((card) =>
300
- card.setGridMetaData(gridColumnSize, isMobileView, isTabletView),
301
- )
293
+ card.setGridMetaData(gridColumnSize, isMobileView, isTabletView)
294
+ );
302
295
  }
303
- })
296
+ });
304
297
  },
305
298
  handleFocus(ev) {
306
- this.$emit('focussed', ev)
299
+ this.$emit("focussed", ev);
307
300
  },
308
301
  },
309
- }
302
+ };
310
303
  </script>
311
304
 
312
305
  <style lang="scss" scoped>
313
- @import '../../../includes/scss/all';
306
+ @import "../../../includes/scss/all";
314
307
  .card-grid {
315
308
  &__column {
316
309
  &--default {
@@ -402,6 +402,8 @@ export default {
402
402
  },
403
403
  methods: {
404
404
  cardClicked(ev) {
405
+ debugger;
406
+ console.log("cardClicked this.isSelectable :- ", this.isSelectable);
405
407
  if (this.isSelectable) {
406
408
  this.parentGrid.cardSelected(this, ev);
407
409
  }
@@ -411,6 +413,7 @@ export default {
411
413
  }
412
414
  },
413
415
  cardTitleClicked(ev) {
416
+ debugger;
414
417
  if (this.isCardTitleSelectable) {
415
418
  this.parentGrid.cardTitleSelected(this, ev);
416
419
  }
@@ -13,6 +13,7 @@
13
13
  <label class="app-search__label font-weight-bold" for="app-search--search-input-box"
14
14
  >Search WorkSafe</label
15
15
  >
16
+ googleSearchFlag:- {{ googleSearchFlag }}
16
17
  <search
17
18
  ref="searchInputBox"
18
19
  :google-search-flag="googleSearchFlag"
@@ -10,7 +10,9 @@
10
10
  <img class="app-search__close-icon" width="22" height="18" :src="Close" />
11
11
  </button>
12
12
  <form @submit.prevent>
13
- <label class="app-search__label font-weight-bold" for="app-search--search-input-box"
13
+ <label
14
+ class="app-search__label font-weight-bold"
15
+ for="app-search--search-input-box"
14
16
  >Search WorkSafe</label
15
17
  >
16
18
  <search
@@ -30,40 +32,40 @@
30
32
  </template>
31
33
 
32
34
  <script>
33
- import Close from "../../../../assets/icons/close.svg?url";
34
- import Search from "../../../SubComponents/Search/index.vue";
35
+ import Close from '../../../../assets/icons/close.svg?url'
36
+ import Search from '../../../SubComponents/Search/index.vue'
35
37
 
36
38
  export default {
37
- name: "ModalSearch",
39
+ name: 'ModalSearch',
38
40
  components: { Search },
39
41
  props: {
40
42
  searchQuery: {
41
43
  type: String,
42
- default: "",
44
+ default: ''
43
45
  },
44
46
  contentParser: {
45
47
  type: Function,
46
- required: true,
48
+ required: true
47
49
  },
48
50
  googleSearchFlag: {
49
51
  type: String,
50
- default: "solar",
51
- },
52
+ default: 'googlerest'
53
+ }
52
54
  },
53
55
  data() {
54
56
  return {
55
57
  pageLimit: 20,
56
58
  pageNumber: 1,
57
59
  searchResults: null,
58
- Close,
59
- };
60
+ Close
61
+ }
60
62
  },
61
63
  mounted() {
62
- this.$refs.searchInputBox.$el.querySelector("input").focus();
63
- },
64
- };
64
+ this.$refs.searchInputBox.$el.querySelector('input').focus()
65
+ }
66
+ }
65
67
  </script>
66
68
 
67
69
  <style lang="scss" scoped>
68
- @import "./styles";
70
+ @import './styles';
69
71
  </style>
@@ -9,6 +9,7 @@
9
9
  </a>
10
10
  </column>
11
11
  <column md="2" sm="12" class="address" >
12
+ <div class="label">Office address</div>
12
13
  <a v-if="item.fullAddress" target="_blank" :href="gMapLink"><span class="sr-only visually-hidden">Address</span>
13
14
  {{ item.fullAddress }}
14
15
  </a>
@@ -101,23 +101,20 @@ export default {
101
101
  computed: {
102
102
 
103
103
  themeOptions() {
104
- // Requirement to remove certain values from original courses
105
- let allThemes = this.flatRecords.map(a => a.courses)
104
+ // Concatenate all themes, remove duplicates, sort and use for a drop-down list
105
+ let allThemes = this.flatRecords.map(a => a.themes)
106
106
  allThemes = allThemes.join(',')
107
- allThemes = allThemes.replace(/HSR initial/g, '')
108
- allThemes = allThemes.replace(/HSR Initial/g, '')
109
- allThemes = allThemes.replace(/HSR refresher - /g, '')
110
- allThemes = allThemes.replace(/HSR Refresher - /g, '')
111
- allThemes = allThemes.replace(/HSR refresher/g, '')
112
- allThemes = allThemes.replace(/HSR Refresher/g, '')
113
107
  allThemes = allThemes.trim()
114
108
  allThemes = allThemes.split(',')
109
+ // Change all themes to title case
110
+ for (var i = 0; i < allThemes.length; i++) {
111
+ let newVal = this.toTitleCase(allThemes[i])
112
+ allThemes[i] = newVal
113
+ }
115
114
  // Remove duplicates
116
115
  let s = new Set(allThemes)
117
116
  allThemes = [...s]
118
- // Remove blank values - not completely successful
119
- allThemes = allThemes.filter(n => n)
120
-
117
+
121
118
  // Sort the themes
122
119
  let sortedThemes = allThemes.sort((a, b) => {
123
120
  if (a.trim() < b.trim()) {
@@ -128,10 +125,8 @@ export default {
128
125
  }
129
126
  return 0;
130
127
  })
131
- if (sortedThemes[0].type === undefined) {
132
- sortedThemes.splice(0, 1)
133
- }
134
128
  allThemes = sortedThemes
129
+
135
130
  return allThemes
136
131
  },
137
132
 
@@ -152,7 +147,7 @@ export default {
152
147
  }
153
148
  if (this.searchThemes.length) {
154
149
  this.hideReset = false
155
- results = results.filter(item => item.courses.toLowerCase().includes(this.searchThemes.toLowerCase()))
150
+ results = results.filter(item => item.themes.toLowerCase().includes(this.searchThemes.toLowerCase()))
156
151
  }
157
152
  this.filteredItems = results
158
153
 
@@ -191,6 +186,7 @@ export default {
191
186
  email2: record.Contact_2_Email,
192
187
  phone2: record.Contact_2_Phone,
193
188
  courses: record.Training_courses.replace(/,$/, ''),
189
+ themes: record.Themes.replace(/,$/, ''),
194
190
  trainingVenues: record.Training_venues
195
191
  })
196
192
  })
@@ -240,6 +236,7 @@ export default {
240
236
  },
241
237
 
242
238
  reset() {
239
+ this.collapseOrgs('')
243
240
  this.hideReset = true
244
241
  this.searchOrg = ''
245
242
  this.searchCourse = ''
@@ -249,7 +246,17 @@ export default {
249
246
 
250
247
  pageChanged(ev) {
251
248
  this.page = ev - 1
252
-
249
+
250
+ if (this.searchOrg.length || this.searchSub.length || this.searchCourse.length || this.searchThemes.length) {
251
+ // don't set focus
252
+ this.collapseOrgs('')
253
+ } else {
254
+ // set focus to top element - used instead of scrollTo
255
+ this.collapseOrgs('Yes')
256
+ }
257
+ },
258
+
259
+ collapseOrgs(focusLink) {
253
260
  const aLinks = document.getElementsByName('titleLink')
254
261
  // Convert nodelist to array
255
262
  let linksArr = Array.from(aLinks)
@@ -258,14 +265,24 @@ export default {
258
265
  .filter((link) => link.getAttribute('aria-expanded') === 'true')
259
266
  .forEach((link) => link.click())
260
267
 
261
- if (this.searchOrg.length || this.searchSub.length || this.searchCourse.length || this.searchThemes.length) {
262
- // don't set focus
263
- } else {
264
- // set focus to top element - used instead of scrollTo
265
- console.log('setting focus.')
266
- linksArr[0].focus()
267
- }
268
+ if (focusLink === 'Yes') {
269
+ linksArr[0].focus()
270
+ }
268
271
  }
272
+
273
+ },
274
+
275
+ toTitleCase(strVal) {
276
+
277
+ let retVal = strVal.trim()
278
+
279
+ const firstChar = retVal.charAt(0)
280
+ const firstCharU = firstChar.toUpperCase()
281
+ const remChar = retVal.slice(1)
282
+
283
+ retVal = firstCharU + remChar
284
+
285
+ return retVal
269
286
  },
270
287
  }
271
288
  }
@@ -300,6 +317,7 @@ export default {
300
317
  margin-bottom: 16px;
301
318
  margin-right: 16px;
302
319
  transition: none;
320
+ width: 200px;
303
321
  }
304
322
 
305
323
  .grid-column {
@@ -27,8 +27,8 @@ export default {
27
27
  tags: ['autodocs']
28
28
  };
29
29
 
30
- export const CourseProvider = {};
30
+ export const PRS = {};
31
31
 
32
- CourseProvider.args = {
32
+ PRS.args = {
33
33
  item: cpData,
34
34
  };