@abi-software/map-utilities 1.2.1-beta.1 → 1.2.1-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.2.1-beta.1",
3
+ "version": "1.2.1-beta.3",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -106,9 +106,11 @@
106
106
  </div>
107
107
  </div>
108
108
 
109
- <div class="connectivity-graph-error" v-if="errorMessage || errorConnectivities">
110
- <strong v-if="errorConnectivities">{{ errorConnectivities }}</strong>
111
- {{ errorMessage }}
109
+ <div v-if="connectivityError" class="connectivity-graph-error">
110
+ <strong v-if="connectivityError.errorConnectivities">
111
+ {{ connectivityError.errorConnectivities }}
112
+ </strong>
113
+ {{ connectivityError.errorMessage }}
112
114
  </div>
113
115
 
114
116
  </div>
@@ -164,8 +166,8 @@ export default {
164
166
  zoomOutLabel: ZOOM_OUT_LABEL,
165
167
  iconColor: APP_PRIMARY_COLOR,
166
168
  zoomEnabled: false,
167
- errorMessage: '',
168
- errorConnectivities: '',
169
+ connectivityError: null,
170
+ timeoutID: undefined,
169
171
  };
170
172
  },
171
173
  mounted() {
@@ -426,40 +428,15 @@ export default {
426
428
  this.zoomLockLabel = this.zoomEnabled ? ZOOM_UNLOCK_LABEL : ZOOM_LOCK_LABEL;
427
429
  this.connectivityGraph.enableZoom(!this.zoomEnabled);
428
430
  },
429
- getErrorConnectivities: function (errorData) {
430
- const errorDataToEmit = [...new Set(errorData)];
431
- let errorConnectivities = '';
432
-
433
- errorDataToEmit.forEach((connectivity, i) => {
434
- const { label } = connectivity;
435
- errorConnectivities += (i === 0) ? capitalise(label) : label;
436
-
437
- if (errorDataToEmit.length > 1) {
438
- if ((i + 2) === errorDataToEmit.length) {
439
- errorConnectivities += ' and ';
440
- } else if ((i + 1) < errorDataToEmit.length) {
441
- errorConnectivities += ', ';
442
- }
443
- }
444
- });
431
+ showErrorMessage: function (connectivityError) {
432
+ this.connectivityError = {...connectivityError};
445
433
 
446
- return errorConnectivities;
447
- },
448
- /**
449
- * Function to show error message.
450
- * `errorInfo` includes `errorData` array (optional) for error connectivities
451
- * and `errorMessage` for error message.
452
- * @arg `errorInfo`
453
- */
454
- showErrorMessage: function (errorInfo) {
455
- const { errorData, errorMessage } = errorInfo;
456
- this.errorConnectivities = this.getErrorConnectivities(errorData);
457
- this.errorMessage = errorMessage;
458
-
459
- // Show error for 3 seconds
460
- setTimeout(() => {
461
- this.errorConnectivities = '';
462
- this.errorMessage = '';
434
+ if (this.timeoutID) {
435
+ clearTimeout(this.timeoutID);
436
+ }
437
+
438
+ this.timeoutID = setTimeout(() => {
439
+ this.connectivityError = null;
463
440
  }, ERROR_TIMEOUT);
464
441
  },
465
442
  },
@@ -258,14 +258,7 @@ const GRAPH_STYLE = [
258
258
  }
259
259
  },
260
260
  {
261
- 'selector': 'node:active',
262
- 'style': {
263
- 'border-color': APP_PRIMARY_COLOR,
264
- 'border-width': 2
265
- }
266
- },
267
- {
268
- 'selector': 'node:selected',
261
+ 'selector': 'node.active',
269
262
  'style': {
270
263
  'border-color': APP_PRIMARY_COLOR,
271
264
  'background-color': BG_COLOR,
@@ -350,7 +343,6 @@ class CytoscapeGraph extends EventTarget
350
343
  }).on('mouseover', 'node', this.overNode.bind(this))
351
344
  .on('mouseout', 'node', this.exitNode.bind(this))
352
345
  .on('position', 'node', this.moveNode.bind(this))
353
- .on('tap', this.tapNode.bind(this))
354
346
 
355
347
  this.tooltip = document.createElement('div')
356
348
  this.tooltip.className = 'cy-graph-tooltip'
@@ -393,6 +385,8 @@ class CytoscapeGraph extends EventTarget
393
385
  this.tooltip.hidden = false
394
386
 
395
387
  this.checkRightBoundary(event.renderedPosition.x)
388
+
389
+ this.tapNode(event, true)
396
390
  }
397
391
 
398
392
  moveNode(event)
@@ -408,16 +402,21 @@ class CytoscapeGraph extends EventTarget
408
402
  //==============
409
403
  {
410
404
  this.tooltip.hidden = true
405
+
406
+ this.tapNode(event, false)
411
407
  }
412
408
 
413
- tapNode(event)
409
+ tapNode(event, show)
414
410
  //============
415
411
  {
416
412
  const node = event.target
417
413
  const data = node.data()
418
414
  let { label } = data
419
415
 
420
- if (label && node.isNode() && node.selected()) {
416
+ if (show) {
417
+ node.addClass('active')
418
+ } else {
419
+ node.removeClass('active')
421
420
  label = ''
422
421
  setTimeout(() => {
423
422
  node.unselect()
@@ -11,7 +11,7 @@
11
11
  <el-input
12
12
  class="tree-filter-input"
13
13
  v-model="filterText"
14
- placeholder="Filter keyword"
14
+ :placeholder="'Filter ' + title"
15
15
  />
16
16
  </div>
17
17
  </el-col>