@abi-software/flatmapvuer 1.1.4 → 1.2.0
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/LICENSE +201 -201
- package/README.md +120 -120
- package/cypress.config.js +23 -23
- package/dist/flatmapvuer.js +43570 -38544
- package/dist/flatmapvuer.umd.cjs +182 -182
- package/dist/index.html +17 -17
- package/dist/style.css +1 -1
- package/package.json +95 -95
- package/public/index.html +17 -17
- package/reporter-config.json +9 -9
- package/src/App.vue +379 -379
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +5 -5
- package/src/components/AnnotationTool.vue +501 -501
- package/src/components/ConnectionDialog.vue +134 -134
- package/src/components/DrawTool.vue +502 -502
- package/src/components/EventBus.js +3 -3
- package/src/components/ExternalResourceCard.vue +109 -109
- package/src/components/FlatmapVuer.vue +3515 -3461
- package/src/components/HelpModeDialog.vue +360 -360
- package/src/components/MultiFlatmapVuer.vue +814 -814
- package/src/components/ProvenancePopup.vue +530 -530
- package/src/components/SelectionsGroup.vue +363 -363
- package/src/components/Tooltip.vue +50 -50
- package/src/components/TreeControls.vue +236 -236
- package/src/components/index.js +8 -8
- package/src/components/legends/DynamicLegends.vue +106 -106
- package/src/components/legends/SvgLegends.vue +112 -112
- package/src/icons/flatmap-marker.js +9 -9
- package/src/icons/fonts/mapicon-species.svg +14 -14
- package/src/icons/fonts/mapicon-species.ttf +0 -0
- package/src/icons/fonts/mapicon-species.woff +0 -0
- package/src/icons/mapicon-species-style.css +42 -42
- package/src/icons/yellowstar.js +5 -5
- package/src/legends/legend.svg +25 -25
- package/src/main.js +19 -19
- package/src/services/flatmapQueries.js +475 -475
- package/src/store/index.js +23 -23
- package/vite.config.js +73 -73
- package/vite.static-build.js +12 -12
- package/vuese-generator.js +64 -64
|
@@ -1,363 +1,363 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="selections-container">
|
|
3
|
-
<el-row>
|
|
4
|
-
<el-col :span="12">
|
|
5
|
-
<span class="checkall-display-text">{{ title }}</span>
|
|
6
|
-
<el-popover
|
|
7
|
-
width="250"
|
|
8
|
-
trigger="hover"
|
|
9
|
-
:teleported="false"
|
|
10
|
-
popper-class="popover-origin-help"
|
|
11
|
-
v-if="helpMessage"
|
|
12
|
-
>
|
|
13
|
-
<template v-if="helpMessage" #reference>
|
|
14
|
-
<el-icon class="info"><el-icon-warning /></el-icon>
|
|
15
|
-
</template>
|
|
16
|
-
<span style="word-break: keep-all">
|
|
17
|
-
{{ helpMessage }}
|
|
18
|
-
</span>
|
|
19
|
-
</el-popover>
|
|
20
|
-
</el-col>
|
|
21
|
-
<el-col :span="12">
|
|
22
|
-
<el-checkbox
|
|
23
|
-
v-if="selections && selections.length > 1"
|
|
24
|
-
class="all-checkbox"
|
|
25
|
-
:indeterminate="isIndeterminate"
|
|
26
|
-
v-model="checkAll"
|
|
27
|
-
@change="handleCheckAllChange"
|
|
28
|
-
@click="onAllCheckboxNativeChange"
|
|
29
|
-
>Display all</el-checkbox
|
|
30
|
-
>
|
|
31
|
-
</el-col>
|
|
32
|
-
</el-row>
|
|
33
|
-
<el-checkbox-group
|
|
34
|
-
v-model="checkedItems"
|
|
35
|
-
size="small"
|
|
36
|
-
class="checkbox-group"
|
|
37
|
-
@change="handleCheckedItemsChange"
|
|
38
|
-
>
|
|
39
|
-
<div class="checkbox-group-inner">
|
|
40
|
-
<el-row
|
|
41
|
-
v-for="item in selections"
|
|
42
|
-
:key="item[identifierKey]"
|
|
43
|
-
:label="item[identifierKey]"
|
|
44
|
-
>
|
|
45
|
-
<div class="checkbox-container"
|
|
46
|
-
@mouseenter="checkboxMouseEnterEmit(item[identifierKey], true)"
|
|
47
|
-
@mouseleave="checkboxMouseEnterEmit(item[identifierKey], false)"
|
|
48
|
-
>
|
|
49
|
-
<el-checkbox
|
|
50
|
-
class="my-checkbox"
|
|
51
|
-
:label="item[identifierKey]"
|
|
52
|
-
@change="visibilityToggle(item[identifierKey], $event)"
|
|
53
|
-
@click="onCheckboxNativeChange"
|
|
54
|
-
:checked="!('enabled' in item) || item.enabled === true"
|
|
55
|
-
>
|
|
56
|
-
<el-row class="checkbox-row">
|
|
57
|
-
<el-col :span="4" v-if="hasLineStyles(item)">
|
|
58
|
-
<div class="path-visual" :style="getLineStyles(item)"></div>
|
|
59
|
-
</el-col>
|
|
60
|
-
<el-col :span="20">
|
|
61
|
-
<div :style="getBackgroundStyles(item)">
|
|
62
|
-
{{ item[labelKey] }}
|
|
63
|
-
</div>
|
|
64
|
-
</el-col>
|
|
65
|
-
</el-row>
|
|
66
|
-
</el-checkbox>
|
|
67
|
-
</div>
|
|
68
|
-
</el-row>
|
|
69
|
-
</div>
|
|
70
|
-
</el-checkbox-group>
|
|
71
|
-
</div>
|
|
72
|
-
</template>
|
|
73
|
-
|
|
74
|
-
<script>
|
|
75
|
-
/* eslint-disable no-alert, no-console */
|
|
76
|
-
import {
|
|
77
|
-
Warning as ElIconWarning,
|
|
78
|
-
} from '@element-plus/icons-vue'
|
|
79
|
-
import {
|
|
80
|
-
ElCheckbox as Checkbox,
|
|
81
|
-
ElCheckboxGroup as CheckboxGroup,
|
|
82
|
-
ElIcon as Icon,
|
|
83
|
-
ElCol as Col,
|
|
84
|
-
ElRow as Row,
|
|
85
|
-
} from 'element-plus'
|
|
86
|
-
|
|
87
|
-
export default {
|
|
88
|
-
name: 'SelectionsGroup',
|
|
89
|
-
components: {
|
|
90
|
-
Checkbox,
|
|
91
|
-
CheckboxGroup,
|
|
92
|
-
Col,
|
|
93
|
-
Icon,
|
|
94
|
-
Row,
|
|
95
|
-
ElIconWarning,
|
|
96
|
-
},
|
|
97
|
-
methods: {
|
|
98
|
-
/**
|
|
99
|
-
* Function to toggle paths to default.
|
|
100
|
-
* Also called when the associated button is pressed.
|
|
101
|
-
*/
|
|
102
|
-
reset: function () {
|
|
103
|
-
this.checkAll = true
|
|
104
|
-
this.checkedItems = []
|
|
105
|
-
this.selections.forEach((item) => {
|
|
106
|
-
if (!('enabled' in item) || item.enabled === true) {
|
|
107
|
-
this.checkedItems.push(item[this.identifierKey])
|
|
108
|
-
} else {
|
|
109
|
-
this.checkAll = false
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
},
|
|
113
|
-
setCheckboxActionData: function (containerEl, option) {
|
|
114
|
-
// option = 'individual' or 'all'
|
|
115
|
-
if (containerEl) {
|
|
116
|
-
const checkboxEl = containerEl.querySelector('input[type="checkbox"]');
|
|
117
|
-
const checkboxLabelEl = containerEl.querySelector('.el-checkbox__label');
|
|
118
|
-
const selectionsContainerEl = containerEl.closest('.selections-container');
|
|
119
|
-
const selectionsTitleEl = selectionsContainerEl.querySelector('.checkall-display-text');
|
|
120
|
-
|
|
121
|
-
// change true/false to checked/unchecked for readability
|
|
122
|
-
let checkedLabel = '';
|
|
123
|
-
if (checkboxEl) {
|
|
124
|
-
checkedLabel = checkboxEl.checked ? 'checked' : 'unchecked';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
this.checkboxActionData = {
|
|
128
|
-
selectionsTitle: selectionsTitleEl ? selectionsTitleEl.innerText : '',
|
|
129
|
-
property: (checkboxEl && option !== 'all') ? checkboxEl.value : '',
|
|
130
|
-
label: checkboxLabelEl ? checkboxLabelEl.innerText : '',
|
|
131
|
-
checked: checkedLabel
|
|
132
|
-
};
|
|
133
|
-
} else {
|
|
134
|
-
// reset if no checkbox container found
|
|
135
|
-
this.checkboxActionData = {
|
|
136
|
-
selectionsTitle: '',
|
|
137
|
-
property: '',
|
|
138
|
-
label: '',
|
|
139
|
-
checked: '',
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
onCheckboxNativeChange: function (event) {
|
|
144
|
-
const checkboxContainerEl = event.target.closest('.checkbox-container');
|
|
145
|
-
this.setCheckboxActionData(checkboxContainerEl, 'individual');
|
|
146
|
-
},
|
|
147
|
-
onAllCheckboxNativeChange: function (event) {
|
|
148
|
-
const checkboxContainerEl = event.target.closest('.all-checkbox');
|
|
149
|
-
this.setCheckboxActionData(checkboxContainerEl, 'all');
|
|
150
|
-
},
|
|
151
|
-
visibilityToggle: function (key, value) {
|
|
152
|
-
this.$emit('changed', { key, value })
|
|
153
|
-
// emit event with checkbox data for tracking
|
|
154
|
-
if (key === this.checkboxActionData.property) {
|
|
155
|
-
// change true/false to checked/unchecked for readability
|
|
156
|
-
this.checkboxActionData.checked = value ? 'checked' : 'unchecked';
|
|
157
|
-
}
|
|
158
|
-
this.$emit('selections-data-changed', this.checkboxActionData);
|
|
159
|
-
},
|
|
160
|
-
checkboxMouseEnterEmit: function (key, value) {
|
|
161
|
-
// Update the stated to send to the emit
|
|
162
|
-
this.$emit('checkboxMouseEnter', { key: key, value: value, selections: this.selections, checked: this.checkedItems})
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
handleCheckedItemsChange: function (value) {
|
|
166
|
-
let checkedCount = value.length
|
|
167
|
-
this.checkAll = checkedCount === this.selections.length
|
|
168
|
-
},
|
|
169
|
-
handleCheckAllChange: function (val) {
|
|
170
|
-
this.checkedItems = val
|
|
171
|
-
? this.selections.map((a) => a[this.identifierKey])
|
|
172
|
-
: []
|
|
173
|
-
|
|
174
|
-
this.$emit('checkAll', {
|
|
175
|
-
keys: this.selections.map((a) => a[this.identifierKey]),
|
|
176
|
-
value: val,
|
|
177
|
-
})
|
|
178
|
-
// emit event with checkbox data for tracking
|
|
179
|
-
this.checkboxActionData.property = this.identifierKey;
|
|
180
|
-
// change true/false to checked/unchecked for readability
|
|
181
|
-
this.checkboxActionData.checked = val ? 'checked' : 'unchecked';
|
|
182
|
-
this.$emit('selections-data-changed', this.checkboxActionData);
|
|
183
|
-
},
|
|
184
|
-
getBackgroundStyles: function (item) {
|
|
185
|
-
if ('colour' in item && this.colourStyle === 'background') {
|
|
186
|
-
return { background: item.colour }
|
|
187
|
-
}
|
|
188
|
-
return {}
|
|
189
|
-
},
|
|
190
|
-
hasLineStyles: function(item) {
|
|
191
|
-
return 'colour' in item && this.colourStyle === 'line'
|
|
192
|
-
},
|
|
193
|
-
getLineStyles: function (item) {
|
|
194
|
-
if ('colour' in item && this.colourStyle === 'line') {
|
|
195
|
-
if ('dashed' in item && item.dashed === true) {
|
|
196
|
-
const background = `repeating-linear-gradient(90deg,${item.colour},${item.colour} 6px,transparent 0,transparent 9px)`
|
|
197
|
-
return { background }
|
|
198
|
-
} else {
|
|
199
|
-
return { background: item.colour }
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return { display: 'None' }
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
props: {
|
|
206
|
-
colourStyle: {
|
|
207
|
-
type: String,
|
|
208
|
-
default: 'line',
|
|
209
|
-
},
|
|
210
|
-
helpMessage: {
|
|
211
|
-
type: String,
|
|
212
|
-
default: '',
|
|
213
|
-
},
|
|
214
|
-
identifierKey: {
|
|
215
|
-
type: String,
|
|
216
|
-
default: 'id',
|
|
217
|
-
},
|
|
218
|
-
labelKey: {
|
|
219
|
-
type: String,
|
|
220
|
-
default: 'label',
|
|
221
|
-
},
|
|
222
|
-
title: {
|
|
223
|
-
type: String,
|
|
224
|
-
default: '',
|
|
225
|
-
},
|
|
226
|
-
selections: {
|
|
227
|
-
type: Array,
|
|
228
|
-
default: function () {
|
|
229
|
-
return []
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
computed: {
|
|
234
|
-
isIndeterminate: function () {
|
|
235
|
-
const count = this.checkedItems.length
|
|
236
|
-
if (count === 0 || this.checkAll) {
|
|
237
|
-
return false
|
|
238
|
-
}
|
|
239
|
-
return true
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
data: function () {
|
|
243
|
-
return {
|
|
244
|
-
checkedItems: [],
|
|
245
|
-
checkAll: true,
|
|
246
|
-
checkboxActionData: {
|
|
247
|
-
selectionsTitle: '',
|
|
248
|
-
property: '',
|
|
249
|
-
label: '',
|
|
250
|
-
checked: '',
|
|
251
|
-
},
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
mounted: function () {
|
|
255
|
-
this.reset()
|
|
256
|
-
},
|
|
257
|
-
}
|
|
258
|
-
</script>
|
|
259
|
-
|
|
260
|
-
<style lang="scss" scoped>
|
|
261
|
-
|
|
262
|
-
.path-visual {
|
|
263
|
-
margin: 3px 0;
|
|
264
|
-
height: 3px;
|
|
265
|
-
width: 25px;
|
|
266
|
-
margin-right: 5px;
|
|
267
|
-
display: inline-block;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.selections-container {
|
|
271
|
-
padding-top: 5px;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
.checkall-display-text {
|
|
275
|
-
width: 59px;
|
|
276
|
-
height: 20px;
|
|
277
|
-
color: rgb(48, 49, 51);
|
|
278
|
-
font-size: 14px;
|
|
279
|
-
font-weight: normal;
|
|
280
|
-
line-height: 20px;
|
|
281
|
-
margin-left: 8px;
|
|
282
|
-
white-space: nowrap;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.all-checkbox {
|
|
286
|
-
height:20px;
|
|
287
|
-
float: right;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.checkbox-container {
|
|
291
|
-
display: flex;
|
|
292
|
-
cursor: pointer;
|
|
293
|
-
width: 100%;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.checkbox-group {
|
|
297
|
-
width: 260px;
|
|
298
|
-
border: 1px solid rgb(144, 147, 153);
|
|
299
|
-
border-radius: 4px;
|
|
300
|
-
background: #ffffff;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.my-checkbox {
|
|
304
|
-
background-color: #fff;
|
|
305
|
-
width: 100%;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
.checkbox-group-inner {
|
|
309
|
-
padding: 18px;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
:deep(.el-checkbox__label) {
|
|
313
|
-
padding-left: 5px;
|
|
314
|
-
color: $app-primary-color;
|
|
315
|
-
font-size: 12px;
|
|
316
|
-
font-weight: 500;
|
|
317
|
-
letter-spacing: 0px;
|
|
318
|
-
line-height: 14px;
|
|
319
|
-
width: 100%;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
:deep(.el-checkbox__input) {
|
|
323
|
-
&.is-indeterminate,
|
|
324
|
-
&.is-checked {
|
|
325
|
-
.el-checkbox__inner {
|
|
326
|
-
background-color: $app-primary-color;
|
|
327
|
-
border-color: $app-primary-color;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
:deep(.el-row) {
|
|
333
|
-
height:20px;
|
|
334
|
-
margin-bottom: 0;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
:deep(.el-checkbox__label) {
|
|
338
|
-
color: $app-primary-color !important;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
.checkbox-row {
|
|
342
|
-
width: 100%;
|
|
343
|
-
top: 2px;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.info {
|
|
347
|
-
transform: rotate(180deg);
|
|
348
|
-
color: #8300bf;
|
|
349
|
-
margin-left: 8px;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
:deep(.popover-origin-help.el-popover) {
|
|
354
|
-
text-transform: none !important; // need to overide the tooltip text transform
|
|
355
|
-
border: 1px solid $app-primary-color;
|
|
356
|
-
.el-popper__arrow {
|
|
357
|
-
&:before {
|
|
358
|
-
border-color: $app-primary-color;
|
|
359
|
-
background-color: #ffffff;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="selections-container">
|
|
3
|
+
<el-row>
|
|
4
|
+
<el-col :span="12">
|
|
5
|
+
<span class="checkall-display-text">{{ title }}</span>
|
|
6
|
+
<el-popover
|
|
7
|
+
width="250"
|
|
8
|
+
trigger="hover"
|
|
9
|
+
:teleported="false"
|
|
10
|
+
popper-class="popover-origin-help"
|
|
11
|
+
v-if="helpMessage"
|
|
12
|
+
>
|
|
13
|
+
<template v-if="helpMessage" #reference>
|
|
14
|
+
<el-icon class="info"><el-icon-warning /></el-icon>
|
|
15
|
+
</template>
|
|
16
|
+
<span style="word-break: keep-all">
|
|
17
|
+
{{ helpMessage }}
|
|
18
|
+
</span>
|
|
19
|
+
</el-popover>
|
|
20
|
+
</el-col>
|
|
21
|
+
<el-col :span="12">
|
|
22
|
+
<el-checkbox
|
|
23
|
+
v-if="selections && selections.length > 1"
|
|
24
|
+
class="all-checkbox"
|
|
25
|
+
:indeterminate="isIndeterminate"
|
|
26
|
+
v-model="checkAll"
|
|
27
|
+
@change="handleCheckAllChange"
|
|
28
|
+
@click="onAllCheckboxNativeChange"
|
|
29
|
+
>Display all</el-checkbox
|
|
30
|
+
>
|
|
31
|
+
</el-col>
|
|
32
|
+
</el-row>
|
|
33
|
+
<el-checkbox-group
|
|
34
|
+
v-model="checkedItems"
|
|
35
|
+
size="small"
|
|
36
|
+
class="checkbox-group"
|
|
37
|
+
@change="handleCheckedItemsChange"
|
|
38
|
+
>
|
|
39
|
+
<div class="checkbox-group-inner">
|
|
40
|
+
<el-row
|
|
41
|
+
v-for="item in selections"
|
|
42
|
+
:key="item[identifierKey]"
|
|
43
|
+
:label="item[identifierKey]"
|
|
44
|
+
>
|
|
45
|
+
<div class="checkbox-container"
|
|
46
|
+
@mouseenter="checkboxMouseEnterEmit(item[identifierKey], true)"
|
|
47
|
+
@mouseleave="checkboxMouseEnterEmit(item[identifierKey], false)"
|
|
48
|
+
>
|
|
49
|
+
<el-checkbox
|
|
50
|
+
class="my-checkbox"
|
|
51
|
+
:label="item[identifierKey]"
|
|
52
|
+
@change="visibilityToggle(item[identifierKey], $event)"
|
|
53
|
+
@click="onCheckboxNativeChange"
|
|
54
|
+
:checked="!('enabled' in item) || item.enabled === true"
|
|
55
|
+
>
|
|
56
|
+
<el-row class="checkbox-row">
|
|
57
|
+
<el-col :span="4" v-if="hasLineStyles(item)">
|
|
58
|
+
<div class="path-visual" :style="getLineStyles(item)"></div>
|
|
59
|
+
</el-col>
|
|
60
|
+
<el-col :span="20">
|
|
61
|
+
<div :style="getBackgroundStyles(item)">
|
|
62
|
+
{{ item[labelKey] }}
|
|
63
|
+
</div>
|
|
64
|
+
</el-col>
|
|
65
|
+
</el-row>
|
|
66
|
+
</el-checkbox>
|
|
67
|
+
</div>
|
|
68
|
+
</el-row>
|
|
69
|
+
</div>
|
|
70
|
+
</el-checkbox-group>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script>
|
|
75
|
+
/* eslint-disable no-alert, no-console */
|
|
76
|
+
import {
|
|
77
|
+
Warning as ElIconWarning,
|
|
78
|
+
} from '@element-plus/icons-vue'
|
|
79
|
+
import {
|
|
80
|
+
ElCheckbox as Checkbox,
|
|
81
|
+
ElCheckboxGroup as CheckboxGroup,
|
|
82
|
+
ElIcon as Icon,
|
|
83
|
+
ElCol as Col,
|
|
84
|
+
ElRow as Row,
|
|
85
|
+
} from 'element-plus'
|
|
86
|
+
|
|
87
|
+
export default {
|
|
88
|
+
name: 'SelectionsGroup',
|
|
89
|
+
components: {
|
|
90
|
+
Checkbox,
|
|
91
|
+
CheckboxGroup,
|
|
92
|
+
Col,
|
|
93
|
+
Icon,
|
|
94
|
+
Row,
|
|
95
|
+
ElIconWarning,
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
/**
|
|
99
|
+
* Function to toggle paths to default.
|
|
100
|
+
* Also called when the associated button is pressed.
|
|
101
|
+
*/
|
|
102
|
+
reset: function () {
|
|
103
|
+
this.checkAll = true
|
|
104
|
+
this.checkedItems = []
|
|
105
|
+
this.selections.forEach((item) => {
|
|
106
|
+
if (!('enabled' in item) || item.enabled === true) {
|
|
107
|
+
this.checkedItems.push(item[this.identifierKey])
|
|
108
|
+
} else {
|
|
109
|
+
this.checkAll = false
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
},
|
|
113
|
+
setCheckboxActionData: function (containerEl, option) {
|
|
114
|
+
// option = 'individual' or 'all'
|
|
115
|
+
if (containerEl) {
|
|
116
|
+
const checkboxEl = containerEl.querySelector('input[type="checkbox"]');
|
|
117
|
+
const checkboxLabelEl = containerEl.querySelector('.el-checkbox__label');
|
|
118
|
+
const selectionsContainerEl = containerEl.closest('.selections-container');
|
|
119
|
+
const selectionsTitleEl = selectionsContainerEl.querySelector('.checkall-display-text');
|
|
120
|
+
|
|
121
|
+
// change true/false to checked/unchecked for readability
|
|
122
|
+
let checkedLabel = '';
|
|
123
|
+
if (checkboxEl) {
|
|
124
|
+
checkedLabel = checkboxEl.checked ? 'checked' : 'unchecked';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
this.checkboxActionData = {
|
|
128
|
+
selectionsTitle: selectionsTitleEl ? selectionsTitleEl.innerText : '',
|
|
129
|
+
property: (checkboxEl && option !== 'all') ? checkboxEl.value : '',
|
|
130
|
+
label: checkboxLabelEl ? checkboxLabelEl.innerText : '',
|
|
131
|
+
checked: checkedLabel
|
|
132
|
+
};
|
|
133
|
+
} else {
|
|
134
|
+
// reset if no checkbox container found
|
|
135
|
+
this.checkboxActionData = {
|
|
136
|
+
selectionsTitle: '',
|
|
137
|
+
property: '',
|
|
138
|
+
label: '',
|
|
139
|
+
checked: '',
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
onCheckboxNativeChange: function (event) {
|
|
144
|
+
const checkboxContainerEl = event.target.closest('.checkbox-container');
|
|
145
|
+
this.setCheckboxActionData(checkboxContainerEl, 'individual');
|
|
146
|
+
},
|
|
147
|
+
onAllCheckboxNativeChange: function (event) {
|
|
148
|
+
const checkboxContainerEl = event.target.closest('.all-checkbox');
|
|
149
|
+
this.setCheckboxActionData(checkboxContainerEl, 'all');
|
|
150
|
+
},
|
|
151
|
+
visibilityToggle: function (key, value) {
|
|
152
|
+
this.$emit('changed', { key, value })
|
|
153
|
+
// emit event with checkbox data for tracking
|
|
154
|
+
if (key === this.checkboxActionData.property) {
|
|
155
|
+
// change true/false to checked/unchecked for readability
|
|
156
|
+
this.checkboxActionData.checked = value ? 'checked' : 'unchecked';
|
|
157
|
+
}
|
|
158
|
+
this.$emit('selections-data-changed', this.checkboxActionData);
|
|
159
|
+
},
|
|
160
|
+
checkboxMouseEnterEmit: function (key, value) {
|
|
161
|
+
// Update the stated to send to the emit
|
|
162
|
+
this.$emit('checkboxMouseEnter', { key: key, value: value, selections: this.selections, checked: this.checkedItems})
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
handleCheckedItemsChange: function (value) {
|
|
166
|
+
let checkedCount = value.length
|
|
167
|
+
this.checkAll = checkedCount === this.selections.length
|
|
168
|
+
},
|
|
169
|
+
handleCheckAllChange: function (val) {
|
|
170
|
+
this.checkedItems = val
|
|
171
|
+
? this.selections.map((a) => a[this.identifierKey])
|
|
172
|
+
: []
|
|
173
|
+
|
|
174
|
+
this.$emit('checkAll', {
|
|
175
|
+
keys: this.selections.map((a) => a[this.identifierKey]),
|
|
176
|
+
value: val,
|
|
177
|
+
})
|
|
178
|
+
// emit event with checkbox data for tracking
|
|
179
|
+
this.checkboxActionData.property = this.identifierKey;
|
|
180
|
+
// change true/false to checked/unchecked for readability
|
|
181
|
+
this.checkboxActionData.checked = val ? 'checked' : 'unchecked';
|
|
182
|
+
this.$emit('selections-data-changed', this.checkboxActionData);
|
|
183
|
+
},
|
|
184
|
+
getBackgroundStyles: function (item) {
|
|
185
|
+
if ('colour' in item && this.colourStyle === 'background') {
|
|
186
|
+
return { background: item.colour }
|
|
187
|
+
}
|
|
188
|
+
return {}
|
|
189
|
+
},
|
|
190
|
+
hasLineStyles: function(item) {
|
|
191
|
+
return 'colour' in item && this.colourStyle === 'line'
|
|
192
|
+
},
|
|
193
|
+
getLineStyles: function (item) {
|
|
194
|
+
if ('colour' in item && this.colourStyle === 'line') {
|
|
195
|
+
if ('dashed' in item && item.dashed === true) {
|
|
196
|
+
const background = `repeating-linear-gradient(90deg,${item.colour},${item.colour} 6px,transparent 0,transparent 9px)`
|
|
197
|
+
return { background }
|
|
198
|
+
} else {
|
|
199
|
+
return { background: item.colour }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { display: 'None' }
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
props: {
|
|
206
|
+
colourStyle: {
|
|
207
|
+
type: String,
|
|
208
|
+
default: 'line',
|
|
209
|
+
},
|
|
210
|
+
helpMessage: {
|
|
211
|
+
type: String,
|
|
212
|
+
default: '',
|
|
213
|
+
},
|
|
214
|
+
identifierKey: {
|
|
215
|
+
type: String,
|
|
216
|
+
default: 'id',
|
|
217
|
+
},
|
|
218
|
+
labelKey: {
|
|
219
|
+
type: String,
|
|
220
|
+
default: 'label',
|
|
221
|
+
},
|
|
222
|
+
title: {
|
|
223
|
+
type: String,
|
|
224
|
+
default: '',
|
|
225
|
+
},
|
|
226
|
+
selections: {
|
|
227
|
+
type: Array,
|
|
228
|
+
default: function () {
|
|
229
|
+
return []
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
computed: {
|
|
234
|
+
isIndeterminate: function () {
|
|
235
|
+
const count = this.checkedItems.length
|
|
236
|
+
if (count === 0 || this.checkAll) {
|
|
237
|
+
return false
|
|
238
|
+
}
|
|
239
|
+
return true
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
data: function () {
|
|
243
|
+
return {
|
|
244
|
+
checkedItems: [],
|
|
245
|
+
checkAll: true,
|
|
246
|
+
checkboxActionData: {
|
|
247
|
+
selectionsTitle: '',
|
|
248
|
+
property: '',
|
|
249
|
+
label: '',
|
|
250
|
+
checked: '',
|
|
251
|
+
},
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
mounted: function () {
|
|
255
|
+
this.reset()
|
|
256
|
+
},
|
|
257
|
+
}
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<style lang="scss" scoped>
|
|
261
|
+
|
|
262
|
+
.path-visual {
|
|
263
|
+
margin: 3px 0;
|
|
264
|
+
height: 3px;
|
|
265
|
+
width: 25px;
|
|
266
|
+
margin-right: 5px;
|
|
267
|
+
display: inline-block;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.selections-container {
|
|
271
|
+
padding-top: 5px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.checkall-display-text {
|
|
275
|
+
width: 59px;
|
|
276
|
+
height: 20px;
|
|
277
|
+
color: rgb(48, 49, 51);
|
|
278
|
+
font-size: 14px;
|
|
279
|
+
font-weight: normal;
|
|
280
|
+
line-height: 20px;
|
|
281
|
+
margin-left: 8px;
|
|
282
|
+
white-space: nowrap;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.all-checkbox {
|
|
286
|
+
height:20px;
|
|
287
|
+
float: right;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.checkbox-container {
|
|
291
|
+
display: flex;
|
|
292
|
+
cursor: pointer;
|
|
293
|
+
width: 100%;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.checkbox-group {
|
|
297
|
+
width: 260px;
|
|
298
|
+
border: 1px solid rgb(144, 147, 153);
|
|
299
|
+
border-radius: 4px;
|
|
300
|
+
background: #ffffff;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.my-checkbox {
|
|
304
|
+
background-color: #fff;
|
|
305
|
+
width: 100%;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.checkbox-group-inner {
|
|
309
|
+
padding: 18px;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
:deep(.el-checkbox__label) {
|
|
313
|
+
padding-left: 5px;
|
|
314
|
+
color: $app-primary-color;
|
|
315
|
+
font-size: 12px;
|
|
316
|
+
font-weight: 500;
|
|
317
|
+
letter-spacing: 0px;
|
|
318
|
+
line-height: 14px;
|
|
319
|
+
width: 100%;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
:deep(.el-checkbox__input) {
|
|
323
|
+
&.is-indeterminate,
|
|
324
|
+
&.is-checked {
|
|
325
|
+
.el-checkbox__inner {
|
|
326
|
+
background-color: $app-primary-color;
|
|
327
|
+
border-color: $app-primary-color;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
:deep(.el-row) {
|
|
333
|
+
height:20px;
|
|
334
|
+
margin-bottom: 0;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
:deep(.el-checkbox__label) {
|
|
338
|
+
color: $app-primary-color !important;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.checkbox-row {
|
|
342
|
+
width: 100%;
|
|
343
|
+
top: 2px;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.info {
|
|
347
|
+
transform: rotate(180deg);
|
|
348
|
+
color: #8300bf;
|
|
349
|
+
margin-left: 8px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
:deep(.popover-origin-help.el-popover) {
|
|
354
|
+
text-transform: none !important; // need to overide the tooltip text transform
|
|
355
|
+
border: 1px solid $app-primary-color;
|
|
356
|
+
.el-popper__arrow {
|
|
357
|
+
&:before {
|
|
358
|
+
border-color: $app-primary-color;
|
|
359
|
+
background-color: #ffffff;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
</style>
|