@abi-software/flatmapvuer 0.3.16 → 0.4.0-beta-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.
@@ -0,0 +1,225 @@
1
+ <template>
2
+ <div class="selections-container">
3
+ <el-row>
4
+ <el-col :span="12">
5
+ <div class="checkall-display-text">{{title}}</div>
6
+ </el-col>
7
+ <el-col :span="12">
8
+ <el-checkbox
9
+ v-if="selections && selections.length > 1"
10
+ class="all-checkbox"
11
+ :indeterminate="isIndeterminate"
12
+ v-model="checkAll"
13
+ @change="handleCheckAllChange"
14
+ >Display all</el-checkbox>
15
+ </el-col>
16
+ </el-row>
17
+ <el-checkbox-group
18
+ v-model="checkedItems"
19
+ size="small"
20
+ class="checkbox-group"
21
+ @change="handleCheckedItemsChange"
22
+ >
23
+ <div class="checkbox-group-inner">
24
+ <el-row v-for="item in selections" :key="item[identifierKey]" :label="item[identifierKey]">
25
+ <div class="checkbox-container">
26
+ <el-checkbox
27
+ class="my-checkbox"
28
+ :label="item[identifierKey]"
29
+ @change="visibilityToggle(item[identifierKey], $event)"
30
+ :checked="!(('enable' in item) && item.enable === false)">
31
+ <div class="path-visual" :style="getVisualStyles(item)"></div>
32
+ {{item[labelKey]}}
33
+ </el-checkbox>
34
+ </div>
35
+ </el-row>
36
+ </div>
37
+ </el-checkbox-group>
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ /* eslint-disable no-alert, no-console */
43
+ import Vue from "vue";
44
+ import {
45
+ Checkbox,
46
+ CheckboxGroup,
47
+ Col,
48
+ Row
49
+ } from "element-ui";
50
+ import lang from "element-ui/lib/locale/lang/en";
51
+ import locale from "element-ui/lib/locale";
52
+
53
+ locale.use(lang);
54
+ Vue.use(Checkbox);
55
+ Vue.use(CheckboxGroup);
56
+ Vue.use(Col);
57
+ Vue.use(Row);
58
+
59
+
60
+ export default {
61
+ name: "SelectionsGroup",
62
+ methods: {
63
+ /**
64
+ * Function to toggle paths to default.
65
+ * Also called when the associated button is pressed.
66
+ */
67
+ reset: function() {
68
+ this.checkAll = true;
69
+ this.checkedItems = [];
70
+ this.selections.forEach(item => {
71
+ if (!(('enable' in item) && item.enable === false)) {
72
+ this.checkedItems.push(item[this.identifierKey]);
73
+ } else {
74
+ this.checkAll = false;
75
+ }
76
+ });
77
+ },
78
+ visibilityToggle: function(key, value) {
79
+ this.$emit("changed", {key, value});
80
+ },
81
+ handleCheckedItemsChange: function(value) {
82
+ let checkedCount = value.length;
83
+ this.checkAll = checkedCount === this.selections.length;
84
+ },
85
+ handleCheckAllChange(val) {
86
+ this.checkedItems = val ? this.selections.map(a => a[this.identifierKey]) : [];
87
+ this.$emit("checkAll",
88
+ {
89
+ keys: this.selections.map(a => a[this.identifierKey]),
90
+ value: val
91
+ });
92
+ },
93
+ getVisualStyles(item) {
94
+ if ('colour' in item) {
95
+ if (('dashed' in item) && (item.dashed === true)) {
96
+ const background = `repeating-linear-gradient(90deg,${item.colour},${item.colour} 6px,transparent 0,transparent 9px)`;
97
+ return {'background':background};
98
+ }
99
+ else {
100
+ const background = item.colour;
101
+ return {background};
102
+ }
103
+ }
104
+ return {};
105
+ }
106
+ },
107
+ props: {
108
+ identifierKey: {
109
+ type: String,
110
+ default: "id"
111
+ },
112
+ labelKey: {
113
+ type: String,
114
+ default: "label"
115
+ },
116
+ title: {
117
+ type: String,
118
+ default: ""
119
+ },
120
+ selections: {
121
+ type: Array,
122
+ default: function() {
123
+ return [];
124
+ },
125
+ },
126
+ },
127
+ computed: {
128
+ isIndeterminate: function() {
129
+ const count = this.checkedItems.length;
130
+ if ((count === 0) || this.checkAll){
131
+ return false;
132
+ }
133
+ return true;
134
+ }
135
+ },
136
+ data: function() {
137
+ return {
138
+ checkedItems: [],
139
+ checkAll: true,
140
+ };
141
+ },
142
+ mounted: function() {
143
+ this.reset();
144
+ }
145
+ };
146
+ </script>
147
+
148
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
149
+ <style scoped lang="scss">
150
+ @import "~element-ui/packages/theme-chalk/src/checkbox";
151
+ @import "~element-ui/packages/theme-chalk/src/checkbox-group";
152
+ @import "~element-ui/packages/theme-chalk/src/row";
153
+
154
+ .selection-container {
155
+ margin-top:5px;
156
+ }
157
+
158
+ .path-visual {
159
+ margin: 3px 0;
160
+ height: 3px;
161
+ width: 25px;
162
+ margin-right: 5px;
163
+ display: inline-block;
164
+ }
165
+
166
+ .checkall-display-text {
167
+ width: 59px;
168
+ height: 20px;
169
+ color: rgb(48, 49, 51);
170
+ font-size: 14px;
171
+ font-weight: normal;
172
+ line-height: 20px;
173
+ margin-left: 8px;
174
+ }
175
+
176
+ .all-checkbox {
177
+ float: right;
178
+ }
179
+
180
+ .checkbox-container {
181
+ display: flex;
182
+ cursor: pointer;
183
+ }
184
+
185
+ .checkbox-group {
186
+ width: 260px;
187
+ border: 1px solid rgb(144, 147, 153);
188
+ border-radius: 4px;
189
+ background: #ffffff;
190
+ }
191
+
192
+ .my-checkbox {
193
+ background-color: #fff;
194
+ width: 100%;
195
+ }
196
+
197
+ .checkbox-group-inner {
198
+ padding: 18px;
199
+ }
200
+
201
+ ::v-deep .el-checkbox__label {
202
+ padding-left: 5px;
203
+ color: $app-primary-color;
204
+ font-size: 12px;
205
+ font-weight: 500;
206
+ letter-spacing: 0px;
207
+ line-height: 14px;
208
+ }
209
+
210
+ ::v-deep .el-checkbox__input {
211
+ &.is-indeterminate,
212
+ &.is-checked {
213
+ .el-checkbox__inner {
214
+ background-color: $app-primary-color;
215
+ border-color: $app-primary-color;
216
+ }
217
+ }
218
+ }
219
+
220
+ ::v-deep .el-checkbox__label {
221
+ color: $app-primary-color !important;
222
+ }
223
+
224
+ </style>
225
+
@@ -0,0 +1,112 @@
1
+ <template>
2
+ <div>
3
+ <el-row>
4
+ <el-col :span="12">
5
+ <div class="title-display-text">{{ title }}</div>
6
+ </el-col>
7
+ </el-row>
8
+ <div class="legends-group">
9
+ <el-row
10
+ v-for="item in lists"
11
+ :key="item[identifierKey]"
12
+ :label="item[identifierKey]"
13
+ >
14
+ <div class="legends-container">
15
+ <div
16
+ class="legends-visual"
17
+ :style="{ background: item[colourKey] }"
18
+ ></div>
19
+ <div class="label">
20
+ {{ capitalise(item[identifierKey]) }}
21
+ </div>
22
+ </div>
23
+ </el-row>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ /* eslint-disable no-alert, no-console */
30
+ import Vue from "vue";
31
+ import { Col, Row } from "element-ui";
32
+ import lang from "element-ui/lib/locale/lang/en";
33
+ import locale from "element-ui/lib/locale";
34
+
35
+ locale.use(lang);
36
+ Vue.use(Col);
37
+ Vue.use(Row);
38
+
39
+ export default {
40
+ name: "DynamicLegends",
41
+ props: {
42
+ identifierKey: {
43
+ type: String,
44
+ default: "id",
45
+ },
46
+ colourKey: {
47
+ type: String,
48
+ default: "colour",
49
+ },
50
+ title: {
51
+ type: String,
52
+ default: "",
53
+ },
54
+ lists: {
55
+ type: Array,
56
+ default: function () {
57
+ return [];
58
+ },
59
+ },
60
+ },
61
+ methods: {
62
+ capitalise: function (label) {
63
+ return label.charAt(0).toUpperCase() + label.slice(1).toLowerCase();
64
+ },
65
+ },
66
+ };
67
+ </script>
68
+
69
+ <!-- Add "scoped" attribute to limit CSS to this component only -->
70
+ <style scoped lang="scss">
71
+ @import "~element-ui/packages/theme-chalk/src/row";
72
+
73
+ .legends-visual {
74
+ margin: 2px;
75
+ width: 11px;
76
+ margin-right: 5px;
77
+ display: inline-block;
78
+ }
79
+
80
+ .title-display-text {
81
+ width: 59px;
82
+ height: 20px;
83
+ color: rgb(48, 49, 51);
84
+ font-size: 14px;
85
+ font-weight: normal;
86
+ line-height: 20px;
87
+ margin-left: 8px;
88
+ }
89
+
90
+ .label {
91
+ padding-left: 35px;
92
+ color: $app-primary-color;
93
+ font-size: 12px;
94
+ font-weight: 500;
95
+ letter-spacing: 0px;
96
+ line-height: 14px;
97
+ }
98
+
99
+ .legends-container {
100
+ display: flex;
101
+ cursor: pointer;
102
+ }
103
+
104
+ .legends-group {
105
+ width: 224;
106
+ border: 1px solid rgb(144, 147, 153);
107
+ border-radius: 4px;
108
+ background: #ffffff;
109
+ padding: 18px;
110
+ }
111
+ </style>
112
+