@worksafevictoria/wcl7.5 1.6.0 → 1.7.1

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.
Files changed (34) hide show
  1. package/package.json +3 -2
  2. package/src/components/Common/CardGridItem/card-grid-item-icon.vue +15 -19
  3. package/src/components/Common/CardGridItem/index.vue +108 -139
  4. package/src/components/Global/AppFooter/styles.scss +3 -0
  5. package/src/components/Global/DirectoryFilters/index.vue +3 -0
  6. package/src/components/Paragraphs/Chart/Constants.js +479 -479
  7. package/src/components/Paragraphs/Directory/{Records/HSCP → HSCP/Records/SingleRecord}/index.stories.js +4 -3
  8. package/src/components/Paragraphs/Directory/HSCP/Records/SingleRecord/index.vue +322 -0
  9. package/src/components/Paragraphs/Directory/HSCP/Records/index.stories.js +19 -0
  10. package/src/components/Paragraphs/Directory/HSCP/Records/index.vue +343 -0
  11. package/src/components/Paragraphs/Directory/HSCP/Records/pagination.vue +179 -0
  12. package/src/components/Paragraphs/Directory/Records/CJ/index.vue +1 -1
  13. package/src/components/Paragraphs/Directory/Records/ISP/index.vue +1 -1
  14. package/src/components/Paragraphs/Directory/Records/PRS/index.stories.js +34 -0
  15. package/src/components/Paragraphs/Directory/Records/PRS/index.vue +5 -1
  16. package/src/components/Paragraphs/Directory/Records/index.storieshide.js +47 -0
  17. package/src/components/Paragraphs/Directory/Records/index.vue +18 -35
  18. package/src/components/Paragraphs/Directory/{Records/styles.scss → styles.scss} +4 -3
  19. package/src/components/Paragraphs/Map/Constants.js +4790 -0
  20. package/src/components/Paragraphs/Map/index.mdx +29 -0
  21. package/src/components/Paragraphs/Map/index.stories.js +15 -0
  22. package/src/components/Paragraphs/Map/index.vue +313 -0
  23. package/src/components/Paragraphs/Map/lga-map.json +33462 -0
  24. package/src/components/Paragraphs/Map/postcode_location.json +3543 -0
  25. package/src/components/Paragraphs/TabulatedData/index.vue +27 -36
  26. package/src/components/SubComponents/Breadcrumb/index.vue +4 -0
  27. package/src/components/SubComponents/FormInstance/components/renderer/index.vue +23 -7
  28. package/src/components/SubComponents/FormInstance/models/overrides/file.js +7 -2
  29. package/src/components/SubComponents/ResourceGroup/index.vue +158 -184
  30. package/src/components/SubComponents/ResourceGroup/styles.scss +2 -0
  31. package/src/components/SubComponents/Search/index.vue +8 -3
  32. package/src/index.js +4 -0
  33. package/src/mock/course-provider.js +273 -0
  34. package/src/components/Paragraphs/Directory/Records/HSCP/index.vue +0 -334
@@ -0,0 +1,29 @@
1
+ import { Canvas, Meta } from '@storybook/blocks';
2
+
3
+ import * as GeoStories from './index.stories';
4
+
5
+ <Meta of={GeoStories} />
6
+
7
+ # Map
8
+
9
+ Map support links
10
+
11
+ - [vue3-google-map](https://vue3-google-map.com/ 'Documentation') (package documentation)
12
+ - [Google-maps](https://developers.google.com/maps/documentation/javascript 'Google maps') (customisation documentation)
13
+
14
+ <Canvas of={GeoStories.Default} />
15
+
16
+ ## Map filters
17
+
18
+ Filtering options. These are passed to 'directory-filters' component.
19
+
20
+ ```tsx
21
+ ;[
22
+ { record_id: 'DEATH_DATE', name: 'Year', date: true }, // Primary
23
+ { record_id: 'GENDER', name: 'Gender' }, // Secondary
24
+ { record_id: 'AGE_RANGE', name: 'Age range' },
25
+ { record_id: 'CATEGORY', name: 'Category' },
26
+ { record_id: 'INDUSTRY', name: 'Industry' },
27
+ { record_id: 'SIZE_', name: 'Size of Organisation' },
28
+ ]
29
+ ```
@@ -0,0 +1,15 @@
1
+ import GeoChart from './index.vue'
2
+ import { filterFields, statsData } from './Constants'
3
+ export default {
4
+ title: 'Paragraphs/Map',
5
+ component: GeoChart,
6
+ }
7
+ export const Default = {
8
+ args: {
9
+ filterFields: filterFields,
10
+ statsData: statsData,
11
+ },
12
+ parameters: {
13
+ deepControls: { enabled: true },
14
+ },
15
+ }
@@ -0,0 +1,313 @@
1
+ <template>
2
+ <container>
3
+ <row>
4
+ <column class="pb-5">
5
+ <single-taxonomy
6
+ v-for="(t, i) in computedPropFilters"
7
+ :key="i"
8
+ :ref="`${t.record_id}`"
9
+ :data="t"
10
+ :results="filteredList.length"
11
+ :loading="isFiltering"
12
+ class="wcl-directory-filters__filterButton"
13
+ @onFilter="onFilter"
14
+ />
15
+ <filter-button
16
+ v-if="!hideReset"
17
+ :is-reset="true"
18
+ class="wcl-directory-filters__filterButton"
19
+ @clicked="reset"
20
+ />
21
+ </column>
22
+ </row>
23
+ <row>
24
+ <column>
25
+ <GoogleMap
26
+ api-key="AIzaSyD76GAmQQ6DuxKWf-aLXPZ9pwdz4nOvs2c"
27
+ map-id="18650d0e6b0daeb1"
28
+ :style="`width: 100%; height: ${mapHeight}`"
29
+ :center="center"
30
+ :zoom="zoom"
31
+ :zoom-control="true"
32
+ :mapTypeControl="false"
33
+ :streetViewControl="false"
34
+ :fullscreenControl="true"
35
+ >
36
+ <Polygon
37
+ v-for="(location, i) in lgaBoundaries"
38
+ :options="location"
39
+ :key="i + polygonKey"
40
+ />
41
+ <CustomControl position="BOTTOM_CENTER">
42
+ <h4 v-if="unknownLGA">
43
+ <BBadge variant="light"> Unknown LGA {{ unknownLGA }} </BBadge>
44
+ </h4>
45
+ </CustomControl>
46
+ <AdvancedMarker
47
+ v-for="(location, i) in centerLGA"
48
+ :options="{
49
+ position: location.center,
50
+ title: `${location.lga} (${location.deaths} ${location.deaths > 1 ? 'fatalities' : 'fatality'})`,
51
+ }"
52
+ :key="i"
53
+ :pin-options="{
54
+ background: '#fdcd59',
55
+ glyph: `${location.deaths}`,
56
+ glyphColor: 'black',
57
+ borderColor: '#000000',
58
+ scale: 1,
59
+ }"
60
+ />
61
+ </GoogleMap>
62
+ </column>
63
+ </row>
64
+ </container>
65
+ </template>
66
+
67
+ <script>
68
+ import lga from './lga-map.json'
69
+ import {
70
+ GoogleMap,
71
+ Marker,
72
+ MarkerCluster,
73
+ Circle,
74
+ CustomControl,
75
+ InfoWindow,
76
+ Polygon,
77
+ AdvancedMarker,
78
+ } from 'vue3-google-map'
79
+ import Container from '../../Containers/Container/index.vue'
80
+ import Column from '../../Containers/Column/index.vue'
81
+ import Row from '../../Containers/Row/index.vue'
82
+ import FilterButton from '../../Common/FilterButton/index.vue' // Reset
83
+ import SingleTaxonomy from '../../Global/DirectoryFilters/SingleTaxonomy/index.vue'
84
+ import { BFormGroup, BFormSelect, BButton, BBadge } from 'bootstrap-vue-next'
85
+
86
+ export default {
87
+ name: 'GeoChart',
88
+ components: {
89
+ Row,
90
+ Column,
91
+ Container,
92
+ FilterButton,
93
+ SingleTaxonomy,
94
+ BFormGroup,
95
+ BFormSelect,
96
+ GoogleMap,
97
+ Marker,
98
+ MarkerCluster,
99
+ Circle,
100
+ CustomControl,
101
+ InfoWindow,
102
+ BButton,
103
+ Polygon,
104
+ AdvancedMarker,
105
+ BBadge,
106
+ },
107
+ props: {
108
+ statsData: { type: Array, default: () => [] },
109
+ filterFields: { type: Array, default: () => [] },
110
+ chart: { type: Object, default: () => {} },
111
+ },
112
+ data() {
113
+ return {
114
+ lga,
115
+ zoom: 7,
116
+ mapHeight: '700px',
117
+ center: { lat: -36.5, lng: 145.3 },
118
+ hideReset: true,
119
+ isFiltering: false,
120
+ filters: {
121
+ taxonomies: [],
122
+ selected: {},
123
+ availableBundles: [],
124
+ },
125
+ unknownLGA: 0,
126
+ polygonKey: 1,
127
+ }
128
+ },
129
+ mounted() {
130
+ this.resize()
131
+ window.onresize = () => {
132
+ this.resize()
133
+ }
134
+ },
135
+ computed: {
136
+ graphOptions: function () {
137
+ return this.filterFields.slice(1).map((field) => {
138
+ if (!this.graphSelected) {
139
+ this.graphSelected = field.record_id
140
+ }
141
+ return { value: field.record_id, text: field.name }
142
+ })
143
+ },
144
+ computedPropFilters: function () {
145
+ let fields = this.filterFields.map((field) => {
146
+ let terms = null
147
+ if (field.date) {
148
+ terms = this.statsData
149
+ .map((item) => item[field.record_id].split('/')[2]) // Date field get year
150
+ .filter((value, index, self) => self.indexOf(value) === index)
151
+ .map((value) => {
152
+ return { tid: value, name: value, preselected: false }
153
+ })
154
+ .sort((a, b) => a.name.localeCompare(b.name))
155
+ } else {
156
+ terms = this.statsData
157
+ .map((item) => item[field.record_id])
158
+ .filter((value, index, self) => self.indexOf(value) === index)
159
+ .map((value) => {
160
+ return { tid: value, name: value, preselected: false }
161
+ })
162
+ .sort((a, b) => a.name.localeCompare(b.name))
163
+ }
164
+ return {
165
+ name: field.name,
166
+ record_id: field.record_id,
167
+ terms,
168
+ }
169
+ })
170
+ return fields
171
+ },
172
+ filteredList: function () {
173
+ let filterKeys = Object.keys(this.filters.selected).map((key) => key)
174
+ let list = this.statsData.filter((element) => {
175
+ let include = true
176
+ for (var i = 0, n = filterKeys.length; i < n; ++i) {
177
+ if (this.filters.selected[filterKeys[i]].length > 0) {
178
+ let filterType = this.filterFields.find(
179
+ (item) => item.record_id === filterKeys[i],
180
+ )
181
+ if (filterType.date) {
182
+ // Filter by year
183
+ if (
184
+ this.filters.selected[filterKeys[i]].indexOf(
185
+ element[filterKeys[i]].split('/')[2],
186
+ ) === -1
187
+ ) {
188
+ include = false
189
+ }
190
+ } else {
191
+ if (
192
+ this.filters.selected[filterKeys[i]].indexOf(
193
+ element[filterKeys[i]],
194
+ ) === -1
195
+ ) {
196
+ include = false
197
+ }
198
+ }
199
+ }
200
+ }
201
+ if (include) {
202
+ return element
203
+ }
204
+ })
205
+ return list
206
+ },
207
+ centerLGA: function () {
208
+ if (this.filteredList.length > 1) {
209
+ let location = {}
210
+ this.unknownLGA = 0
211
+ this.filteredList.forEach((item) => {
212
+ if (location[item.LGA]) {
213
+ location[item.LGA].deaths++
214
+ } else {
215
+ let pc = this.lga.find(
216
+ (obj) =>
217
+ obj.name ==
218
+ item.LGA.replace('-', ' ')
219
+ .toUpperCase()
220
+ .substring(0, obj.name.length),
221
+ )
222
+ if (pc) {
223
+ location[item.LGA] = {
224
+ center: { lat: pc.labelpoint[0], lng: pc.labelpoint[1] },
225
+ deaths: 1,
226
+ lga: pc.name,
227
+ }
228
+ } else {
229
+ this.unknownLGA++
230
+ }
231
+ }
232
+ })
233
+ return location
234
+ }
235
+ },
236
+ lgaBoundaries: function () {
237
+ let lgaData = lga.map((item) => {
238
+ return {
239
+ strokeColor: '#000000',
240
+ strokeOpacity: 0.8,
241
+ strokeWeight: 1,
242
+ fillColor: '#bababa',
243
+ fillOpacity: 0.5,
244
+ paths: item.boundaries.map((item) => {
245
+ return { lng: item[0], lat: item[1] }
246
+ }),
247
+ }
248
+ })
249
+ return lgaData
250
+ },
251
+ },
252
+ methods: {
253
+ resize() {
254
+ if (window.innerWidth > 980) {
255
+ this.zoom = 7
256
+ this.mapHeight = '700px'
257
+ } else if (window.innerWidth <= 980) {
258
+ this.zoom = 6
259
+ this.mapHeight = '500px'
260
+ }
261
+ },
262
+ onFilter(filters) {
263
+ this.hideReset = false
264
+ const allFiltersUnselected = Object.values(this.$refs).every(
265
+ (taxonomy) => {
266
+ return Object.values(taxonomy[0].selectedFilters).every(
267
+ (filter) => filter.filter((item) => !item.preselected).length === 0,
268
+ )
269
+ },
270
+ )
271
+ if (allFiltersUnselected) {
272
+ this.hideReset = true
273
+ }
274
+ Object.keys(filters).forEach((filter) => {
275
+ this.filters.selected[filter] = filters[filter].map((obj) => obj.tid)
276
+ })
277
+ },
278
+ reset() {
279
+ this.hideReset = true
280
+ Object.keys(this.$refs).forEach((key) => {
281
+ this.$refs[key][0].reset()
282
+ })
283
+ this.filters.selected = {}
284
+ },
285
+ noData() {
286
+ return [
287
+ [
288
+ { label: 'Results', type: 'string' },
289
+ { label: 'Results', type: 'number' },
290
+ { role: 'style', type: 'string' },
291
+ { role: 'annotation', type: 'string' },
292
+ ],
293
+ ['', 0, null, 'No results found'],
294
+ ]
295
+ },
296
+ },
297
+ }
298
+ </script>
299
+
300
+ <style lang="scss" scoped>
301
+ @import '../../../includes/scss/all';
302
+
303
+ .wcl-directory-filters {
304
+ &__filterButton {
305
+ display: inline-block;
306
+ padding-right: 16px;
307
+ line-height: 3;
308
+ &:last-child {
309
+ padding-right: 0px;
310
+ }
311
+ }
312
+ }
313
+ </style>