@abi-software/flatmapvuer 0.4.2 → 0.4.3

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