@abi-software/flatmapvuer 1.10.1 → 1.10.2

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/flatmapvuer",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -17,8 +17,9 @@
17
17
  "serve": "vite --host --force",
18
18
  "build-bundle": "vite build",
19
19
  "build-static": "vite build -c vite.static-build.js",
20
- "test": "cypress run --component",
21
20
  "cypress:open": "cypress open",
21
+ "cypress:component": "cypress run --component",
22
+ "cypress:record": "cypress run --component --record",
22
23
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
23
24
  "release:minor": "npm version minor; npm publish",
24
25
  "release:patch": "npm version patch; npm publish",
@@ -637,7 +637,7 @@ import {
637
637
  import { capitalise } from './utilities.js'
638
638
  import yellowstar from '../icons/yellowstar'
639
639
  import ResizeSensor from 'css-element-queries/src/ResizeSensor'
640
- import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm'
640
+ import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.8/+esm'
641
641
  import { AnnotationService } from '@abi-software/sparc-annotation'
642
642
  import { mapState } from 'pinia'
643
643
  import { useMainStore } from '@/store/index'
@@ -1367,29 +1367,25 @@ export default {
1367
1367
  },
1368
1368
  resetMapFilter: function() {
1369
1369
  const alert = this.mapFilters.alert;
1370
- let filter = undefined;
1371
- if (alert.with) {
1372
- if (!alert.without) {
1373
- filter = {
1374
- HAS: 'alert',
1375
- };
1376
- }
1377
- } else {
1378
- if (alert.without) {
1379
- filter = {
1380
- NOT: { HAS: 'alert'},
1381
- };
1382
- } else {
1383
- filter = {
1384
- AND: [ {NOT: { HAS: 'alert'}}, { HAS: 'alert'}]
1385
- }
1386
- }
1387
- }
1388
- if (filter) {
1389
- this.mapImp.setVisibilityFilter(filter)
1390
- } else {
1391
- this.mapImp.clearVisibilityFilter()
1370
+ let filter;
1371
+ const isPathways = { 'tile-layer': 'pathways' };
1372
+ const notPathways = { NOT: isPathways };
1373
+
1374
+ if (alert.with && !alert.without) {
1375
+ // Show pathways with alert
1376
+ filter = {
1377
+ OR: [notPathways, { AND: [isPathways, { HAS: 'alert' }] }]
1378
+ };
1379
+ } else if (!alert.with && alert.without) {
1380
+ // Show pathways without alert
1381
+ filter = {
1382
+ OR: [notPathways, { AND: [isPathways, { NOT: { HAS: 'alert' } }] }]
1383
+ };
1384
+ } else if (!alert.with && !alert.without) {
1385
+ // Hide all pathways
1386
+ filter = notPathways;
1392
1387
  }
1388
+ this.setVisibilityFilter(filter)
1393
1389
  },
1394
1390
  /**
1395
1391
  * @public
@@ -1400,17 +1396,18 @@ export default {
1400
1396
  alertMouseEnterEmitted: function (payload) {
1401
1397
  if (this.mapImp) {
1402
1398
  if (payload.value) {
1403
- let filter = undefined;
1404
- if (payload.key === "alert") {
1405
- filter = {
1406
- HAS: 'alert',
1407
- }
1408
- } else if (payload.key === "withoutAlert") {
1409
- filter = {
1410
- NOT: {HAS: 'alert'},
1411
- }
1399
+ let filter;
1400
+ const isPathways = { 'tile-layer': 'pathways' };
1401
+ const notPathways = { NOT: isPathways };
1402
+
1403
+ if (payload.key === "alert" || payload.key === "withoutAlert") {
1404
+ const hasAlert = payload.key === "alert" ?
1405
+ { HAS: 'alert' } :
1406
+ { NOT: { HAS: 'alert' } };
1407
+
1408
+ filter = { OR: [notPathways, { AND: [isPathways, hasAlert] }] };
1412
1409
  }
1413
- this.mapImp.setVisibilityFilter(filter)
1410
+ this.setVisibilityFilter(filter)
1414
1411
  } else {
1415
1412
  this.resetMapFilter()
1416
1413
  }
@@ -1422,7 +1419,7 @@ export default {
1422
1419
  * by providing ``kay, value`` ``payload`` object ``{alertKey, true/false}``.
1423
1420
  * @arg {Object} `payload`
1424
1421
  */
1425
- alertSelected: function (payload) {
1422
+ alertSelected: function (payload) {
1426
1423
  if (this.mapImp) {
1427
1424
  if (payload.key === "alert") {
1428
1425
  if (payload.value) {
@@ -1446,7 +1443,7 @@ export default {
1446
1443
  * option by providing ``flag`` (true/false).
1447
1444
  * @arg {Boolean} `flag`
1448
1445
  */
1449
- checkAllAlerts: function (payload) {
1446
+ checkAllAlerts: function (payload) {
1450
1447
  if (this.mapImp) {
1451
1448
  if (payload.value) {
1452
1449
  this.mapFilters.alert.without = true
@@ -2762,12 +2759,13 @@ export default {
2762
2759
  label: "",
2763
2760
  children: []
2764
2761
  }
2762
+ let children = []
2765
2763
  if (key === "kind") {
2766
2764
  main.label = "Pathways"
2767
2765
  for (const facet of value) {
2768
2766
  const pathway = this.pathways.find(path => path.type === facet)
2769
2767
  if (pathway) {
2770
- main.children.push({
2768
+ children.push({
2771
2769
  key: `${main.key}.${facet}`,
2772
2770
  label: pathway.label,
2773
2771
  colour: pathway.colour,
@@ -2783,9 +2781,11 @@ export default {
2783
2781
  for (const facet of value) {
2784
2782
  const taxon = entityLabels.find(p => p.taxon === facet)
2785
2783
  if (taxon) {
2786
- main.children.push({
2784
+ children.push({
2787
2785
  key: `${main.key}.${facet}`,
2788
- label: taxon.label
2786
+ // space added at the end of label to make sure the display name will not be updated
2787
+ // prevent sidebar searchfilter convertReadableLabel
2788
+ label: `${taxon.label} `
2789
2789
  })
2790
2790
  }
2791
2791
  }
@@ -2793,28 +2793,17 @@ export default {
2793
2793
  } else if (key === "alert") {
2794
2794
  main.label = "Alert"
2795
2795
  for (const facet of ["with", "without"]) {
2796
- main.children.push({
2796
+ children.push({
2797
2797
  key: `${main.key}.${facet}`,
2798
2798
  label: `${facet} alerts`
2799
2799
  })
2800
2800
  }
2801
2801
  }
2802
+ main.children = children.sort((a, b) => a.label.localeCompare(b.label));
2802
2803
  if (main.label && main.children.length) {
2803
2804
  filterOptions.push(main)
2804
2805
  }
2805
2806
  }
2806
- // let hardcode = {
2807
- // key: "flatmap.connectivity.source",
2808
- // label: "Connectivity",
2809
- // children: []
2810
- // }
2811
- // for (const facet of ["Origins", "Components", "Destinations"]) {
2812
- // hardcode.children.push({
2813
- // key: `flatmap.connectivity.source.${facet}`,
2814
- // label: facet
2815
- // })
2816
- // }
2817
- // filterOptions.push(hardcode)
2818
2807
  return filterOptions
2819
2808
  }
2820
2809
  },
@@ -99,7 +99,7 @@
99
99
  import { markRaw } from 'vue'
100
100
  import EventBus from './EventBus'
101
101
  import FlatmapVuer from './FlatmapVuer.vue'
102
- import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.4/+esm'
102
+ import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.8/+esm'
103
103
  import {
104
104
  ElCol as Col,
105
105
  ElOption as Option,