@abi-software/mapintegratedvuer 1.1.0-beta.5 → 1.1.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.
Files changed (31) hide show
  1. package/README.md +15 -2
  2. package/dist/{ContentMixin-C35Jowvp.js → ContentMixin-Belbk7R9.js} +97 -61
  3. package/dist/Flatmap-BEStr9DR.js +146 -0
  4. package/dist/{Iframe-fcNscihB.js → Iframe-CNeqS04g.js} +2 -2
  5. package/dist/{MultiFlatmap-BIT2tVyE.js → MultiFlatmap-CFF8nyw2.js} +81 -64
  6. package/dist/{Plot-B9xsWP2v.js → Plot-BpS4tvSe.js} +2 -2
  7. package/dist/{Scaffold-DYoxAJI0.js → Scaffold-BXY9_HO6.js} +10925 -10528
  8. package/dist/{Simulation-s1KOrb80.js → Simulation-Di2xaBxJ.js} +2 -2
  9. package/dist/{flatmapvuer-BM5z_95w.js → flatmapvuer-C67b_5lI.js} +11707 -11453
  10. package/dist/{index-DIFC-Q9x.js → index-CpppckRD.js} +4349 -4325
  11. package/dist/mapintegratedvuer.js +1 -1
  12. package/dist/mapintegratedvuer.umd.cjs +479 -479
  13. package/dist/style-CdEDV2B6.js +62 -0
  14. package/dist/style.css +1 -1
  15. package/package.json +7 -4
  16. package/src/App.vue +10 -1
  17. package/src/components/FlatmapContextCard.vue +22 -10
  18. package/src/components/MapContent.vue +20 -2
  19. package/src/components/SplitDialog.vue +4 -4
  20. package/src/components/SplitFlow.vue +6 -9
  21. package/src/components/viewers/Flatmap.vue +23 -5
  22. package/src/components/viewers/MultiFlatmap.vue +31 -11
  23. package/src/components/viewers/Scaffold.vue +17 -2
  24. package/src/components.d.ts +0 -1
  25. package/src/mixins/ContentMixin.js +72 -3
  26. package/src/mixins/DynamicMarkerMixin.js +44 -25
  27. package/src/services/tagging.js +3 -4
  28. package/src/stores/settings.js +5 -1
  29. package/src/stores/splitFlow.js +42 -30
  30. package/dist/Flatmap-9P71mP5D.js +0 -128
  31. package/dist/style-B-Ps72EF.js +0 -50
@@ -4,13 +4,36 @@ import { mapStores } from 'pinia';
4
4
  import { useSettingsStore } from '../stores/settings';
5
5
 
6
6
 
7
- // remove duplicates by stringifying the objects
8
- const removeDuplicates = function (arrayOfAnything) {
9
- if (!arrayOfAnything) return []
10
- return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
11
- JSON.parse(e)
12
- )
13
- }
7
+ /*
8
+ * Function to check markers visibility at the given zoom level.
9
+ * I have modified it to make sure the marker is displayed
10
+ * if the uberon is not present in the hardcoded zoom-level list.
11
+ */
12
+ const checkMarkersAtZoomLevel = (flatmapImp, markers, zoomLevel, hoveredMarkers) => {
13
+ if (markers) {
14
+ markers.forEach(id => {
15
+ let foundInArray = false;
16
+ // First check if uberon is in the list, check for zoom level
17
+ // if true. Note: markerZoomLevels is imported.
18
+ for (let i = 0; i < markerZoomLevels.length; i++) {
19
+ if (markerZoomLevels[i].id === id) {
20
+ foundInArray = true;
21
+ if (zoomLevel >= markerZoomLevels[i].showAtZoom) {
22
+ let markerClass = "standard-marker"
23
+ if (hoveredMarkers.includes(id)) markerClass = "hovered-marker"
24
+ flatmapImp.addMarker(id, { className: markerClass, cluster: false});
25
+ }
26
+ break;
27
+ }
28
+ }
29
+ // Did not match, add it regardless so we do not lose any
30
+ // markers.
31
+ if (!foundInArray) {
32
+ flatmapImp.addMarker(id, {className: "standard-marker", cluster: false});
33
+ }
34
+ });
35
+ }
36
+ };
14
37
 
15
38
  /* eslint-disable no-alert, no-console */
16
39
  export default {
@@ -26,14 +49,16 @@ export default {
26
49
  payload: payload,
27
50
  type: this.entry.type,
28
51
  };
52
+ this.flatmapMarkerZoomUpdate(false, undefined);
29
53
  this.$emit("resource-selected", result);
30
54
  }
31
55
  },
32
56
  /**
33
57
  * Function used for updating the flatmap markers.
34
- * We set the markers based on what was searched and the flatmap clusters them.
58
+ * It will only update the markers if zoom level has changed or
59
+ * the force flag is true.
35
60
  */
36
- flatmapMarkerUpdate(flatmap) {
61
+ flatmapMarkerZoomUpdate(force, flatmap) {
37
62
  if (!this.flatmapReady) return;
38
63
 
39
64
  let flatmapImp = flatmap;
@@ -41,22 +66,16 @@ export default {
41
66
  flatmapImp = this.getFlatmapImp();
42
67
 
43
68
  if (flatmapImp) {
44
- let markers = this.settingsStore.markers;
45
- let hoveredMarkers = this.settingsStore.hoveredMarkers
46
- markers = removeDuplicates(markers);
47
- hoveredMarkers = removeDuplicates(hoveredMarkers);
48
- flatmapImp.clearMarkers();
49
- markers.forEach(id => {
50
- let markerClass = "standard-marker"
51
- let markerCluster = true
52
- if (hoveredMarkers.includes(id)) {
53
- markerClass += " hovered" // Space-separated CSS class names
54
- markerCluster = false // Disable cluster when related dataset is hovered
69
+ let currentZoom = flatmapImp.getZoom()["zoom"];
70
+ if (force || this.zoomLevel !== currentZoom) {
71
+ this.zoomLevel = currentZoom;
72
+ flatmapImp.clearMarkers();
73
+ let markers = this.settingsStore.markers;
74
+ let hoveredMarkers = this.settingsStore.hoveredMarkers;
75
+ checkMarkersAtZoomLevel(flatmapImp, markers, this.zoomLevel, hoveredMarkers);
76
+ if (this.entry.type === "MultiFlatmap") {
77
+ this.restoreFeaturedMarkers(flatmapImp);
55
78
  }
56
- flatmapImp.addMarker(id, { className: markerClass, cluster: markerCluster })
57
- })
58
- if (this.entry.type === "MultiFlatmap") {
59
- this.restoreFeaturedMarkers(flatmapImp);
60
79
  }
61
80
  }
62
81
  },
@@ -65,7 +84,7 @@ export default {
65
84
  flatmap.enablePanZoomEvents(true); // Use zoom events for dynamic markers
66
85
  this.flatmapReady = true;
67
86
  const flatmapImp = flatmap.mapImp;
68
- this.flatmapMarkerUpdate(flatmapImp);
87
+ this.flatmapMarkerZoomUpdate(true, flatmapImp);
69
88
  }
70
89
  },
71
90
  }
@@ -1,3 +1,4 @@
1
+ import EventBus from '../components/EventBus';
1
2
  export default {
2
3
  sendEvent: function(data) {
3
4
  const taggingData = {
@@ -20,9 +21,7 @@ export default {
20
21
  console.table(taggingData);
21
22
  }
22
23
 
23
- // push to dataLayer for GTM
24
- if (typeof dataLayer !== 'undefined') {
25
- dataLayer.push(taggingData);
26
- }
24
+ // Emit data for GTM
25
+ EventBus.emit('trackEvent', taggingData);
27
26
  }
28
27
  }
@@ -24,6 +24,7 @@ export const useSettingsStore = defineStore('settings', {
24
24
  featuredMarkerSpecies: [],
25
25
  featuredDatasetIdentifiers: [],
26
26
  helpDelay: 0,
27
+ useHelpModeDialog: false,
27
28
  }
28
29
  },
29
30
  getters: {
@@ -143,6 +144,9 @@ export const useSettingsStore = defineStore('settings', {
143
144
  },
144
145
  updateFacetLabels(facetLabels) {
145
146
  this.facetLabels = facetLabels;
146
- }
147
+ },
148
+ updateUseHelpModeDialog(helpModeOption) {
149
+ this.useHelpModeDialog = helpModeOption;
150
+ },
147
151
  }
148
152
  });
@@ -127,38 +127,42 @@ const findKeyWithId = (layout, id) => {
127
127
  return Object.keys(layout).find(key => layout[key]["id"] === id);
128
128
  }
129
129
 
130
+ const getOriginalState = () => {
131
+ return {
132
+ activeView: "singlepanel",
133
+ viewIcons: [
134
+ { icon: "singlepanel", name: "Single view", min: 1 },
135
+ { icon: "2horpanel", name: "Horizontal split", min: 2 },
136
+ { icon: "2vertpanel", name: "Vertical split", min: 2 },
137
+ { icon: "3panel", name: "Three panes", min: 3 },
138
+ { icon: "4panel", name: "Four panes", min: 4 },
139
+ { icon: "5panel", name: "Five panes", min: 5 },
140
+ { icon: "6panel", name: "Six (horizontal)", min: 6 },
141
+ { icon: "6panelVertical", name: "Six (vertical)", min: 6 },
142
+ //{ icon: "customise", name: "Customise", min: 2 }
143
+ ],
144
+ customLayout: {
145
+ "split-1": {content: false, horizontal: false, children: ["pane-1"]},
146
+ "pane-1": {content: true, id: 1},
147
+ /*
148
+ Example layout
149
+
150
+ "split-1": {content: false, horizontal: true, children: ["split-2", "pane-1"]},
151
+ "split-2": {content: false, horizontal: false, children: ["pane-2", "pane-3"]},
152
+ "pane-1": {content: true, id: 1},
153
+ "pane-2": {content: true, id: 2},
154
+ "pane-3": {content: true, id: 3},
155
+ */
156
+ },
157
+ splitters: { "first": 50, "second": 50, "third": 50 },
158
+ globalCallback: false,
159
+ syncMode: false,
160
+ };
161
+ }
162
+
130
163
  export const useSplitFlowStore = defineStore('splitFlow', {
131
164
  state: () => {
132
- return {
133
- activeView: "singlepanel",
134
- viewIcons: [
135
- { icon: "singlepanel", name: "Single view", min: 1 },
136
- { icon: "2horpanel", name: "Horizontal split", min: 2 },
137
- { icon: "2vertpanel", name: "Vertical split", min: 2 },
138
- { icon: "3panel", name: "Three panes", min: 3 },
139
- { icon: "4panel", name: "Four panes", min: 4 },
140
- { icon: "5panel", name: "Five panes", min: 5 },
141
- { icon: "6panel", name: "Six (horizontal)", min: 6 },
142
- { icon: "6panelVertical", name: "Six (vertical)", min: 6 },
143
- //{ icon: "customise", name: "Customise", min: 2 }
144
- ],
145
- customLayout: {
146
- "split-1": {content: false, horizontal: false, children: ["pane-1"]},
147
- "pane-1": {content: true, id: 1},
148
- /*
149
- Example layout
150
-
151
- "split-1": {content: false, horizontal: true, children: ["split-2", "pane-1"]},
152
- "split-2": {content: false, horizontal: false, children: ["pane-2", "pane-3"]},
153
- "pane-1": {content: true, id: 1},
154
- "pane-2": {content: true, id: 2},
155
- "pane-3": {content: true, id: 3},
156
- */
157
- },
158
- splitters: { "first": 50, "second": 50, "third": 50 },
159
- globalCallback: false,
160
- syncMode: false,
161
- }
165
+ return getOriginalState();
162
166
  },
163
167
  getters: {
164
168
  getPaneNameById: (state) => (id) => {
@@ -318,6 +322,14 @@ export const useSplitFlowStore = defineStore('splitFlow', {
318
322
  }
319
323
  }
320
324
  },
325
+ reset() {
326
+ const original = getOriginalState();
327
+ this.activeView = original.activeView;
328
+ this.customLayout = original.customLayout;
329
+ this.splitters = original.splitters;
330
+ this.globalCallback = original.globalCallback;
331
+ this.syncMode = original.syncMode;
332
+ },
321
333
  closeSlot(payload) {
322
334
  if (payload) {
323
335
  this.syncMode = false;
@@ -1,128 +0,0 @@
1
- import { B as p } from "./flatmapvuer-BM5z_95w.js";
2
- import { _ as m, t as f, E as s } from "./index-DIFC-Q9x.js";
3
- import { C as c } from "./ContentMixin-C35Jowvp.js";
4
- import { D as u } from "./style-B-Ps72EF.js";
5
- import { resolveComponent as h, openBlock as d, createBlock as g } from "vue";
6
- const y = {
7
- name: "Flatmap",
8
- mixins: [c, u],
9
- components: {
10
- FlatmapVuer: p
11
- },
12
- methods: {
13
- getState: function() {
14
- return this.$refs.flatmap.getState();
15
- },
16
- /**
17
- * Perform a local search on this contentvuer
18
- */
19
- search: function(e) {
20
- return this.$refs.flatmap.searchAndShowResult(e);
21
- },
22
- getFlatmapImp() {
23
- return this.$refs.flatmap.mapImp;
24
- },
25
- flatmaprResourceSelected: function(e, t) {
26
- if (this.resourceSelected(
27
- e,
28
- t,
29
- this.$refs.map.viewingMode === "Exploration"
30
- ), t.eventType === "click" && t.feature.type === "feature") {
31
- const n = {
32
- label: t.label || "",
33
- id: t.feature.id || "",
34
- featureId: t.feature.featureId || "",
35
- taxonomy: t.taxonomy || "",
36
- resources: t.resource.join(", ")
37
- }, a = f(n);
38
- Tagging.sendEvent({
39
- event: "interaction_event",
40
- event_name: "portal_maps_connectivity",
41
- category: a,
42
- location: e + " " + this.$refs.map.viewingMode
43
- });
44
- }
45
- },
46
- flatmapReadyCall: function(e) {
47
- let t = { id: this.entry.id, prov: this.getFlatmapImp().provenance };
48
- s.emit("mapImpProv", t), this.$emit("flatmap-provenance-ready", t), this.getAvailableTerms(), this.entry.resource === "FunctionalConnectivity" && this.flatmapReadyForMarkerUpdates(e);
49
- },
50
- onPathwaySelectionChanged: function(e) {
51
- const { label: t, property: n, checked: a, selectionsTitle: o } = e;
52
- Tagging.sendEvent({
53
- event: "interaction_event",
54
- event_name: "portal_maps_pathway_change",
55
- category: t + " [" + n + "] " + a,
56
- location: o
57
- });
58
- },
59
- highlightFeatures: function(e) {
60
- let t = e.name;
61
- const n = this.$refs.flatmap.mapImp;
62
- if (t) {
63
- const a = n.search(t);
64
- a.featureIds[0] && n.highlightFeatures([
65
- n.modelForFeature(a.featureIds[0])
66
- ]);
67
- }
68
- },
69
- /**
70
- * Append the list of suggested terms to suggestions
71
- */
72
- searchSuggestions: function(e, t) {
73
- e && this.$refs.flatmap.mapImp && this.$refs.flatmap.mapImp.search(e).__featureIds.forEach((a) => {
74
- const o = this.$refs.flatmap.mapImp.annotation(a);
75
- o && o.label && t.push(o.label);
76
- });
77
- },
78
- zoomToFeatures: function(e, t) {
79
- let n = e.name;
80
- const a = this.$refs.flatmap.mapImp;
81
- if (n) {
82
- const o = a.search(n);
83
- if (o.featureIds.length) {
84
- let r = a.modelForFeature(o.featureIds[0]);
85
- r ? (t && a.selectFeatures(r), a.zoomToFeatures(r)) : a.clearSearchResults();
86
- }
87
- } else
88
- a.clearSearchResults();
89
- }
90
- },
91
- computed: {
92
- facetSpecies() {
93
- return this.settingsStore.facets.species;
94
- }
95
- },
96
- mounted: function() {
97
- this.getAvailableTerms(), s.on("markerUpdate", () => {
98
- this.flatmapMarkerUpdate(void 0);
99
- });
100
- }
101
- };
102
- function v(e, t, n, a, o, r) {
103
- const i = h("FlatmapVuer");
104
- return d(), g(i, {
105
- state: e.entry.state,
106
- entry: e.entry.resource,
107
- onResourceSelected: t[0] || (t[0] = (l) => r.flatmaprResourceSelected(e.entry.type, l)),
108
- onPanZoomCallback: e.flatmapPanZoomCallback,
109
- name: e.entry.resource,
110
- style: { height: "100%", width: "100%" },
111
- minZoom: e.entry.minZoom,
112
- helpMode: e.helpMode,
113
- pathControls: !0,
114
- ref: "flatmap",
115
- onReady: r.flatmapReadyCall,
116
- displayMinimap: !1,
117
- displayWarning: !0,
118
- enableOpenMapUI: !0,
119
- flatmapAPI: e.flatmapAPI,
120
- sparcAPI: e.apiLocation,
121
- onOpenMap: e.openMap,
122
- onPathwaySelectionChanged: r.onPathwaySelectionChanged
123
- }, null, 8, ["state", "entry", "onPanZoomCallback", "name", "minZoom", "helpMode", "onReady", "flatmapAPI", "sparcAPI", "onOpenMap", "onPathwaySelectionChanged"]);
124
- }
125
- const P = /* @__PURE__ */ m(y, [["render", v], ["__scopeId", "data-v-e72d1ef1"]]);
126
- export {
127
- P as default
128
- };
@@ -1,50 +0,0 @@
1
- import { mapStores as p } from "pinia";
2
- import { u as n } from "./index-DIFC-Q9x.js";
3
- const o = function(t) {
4
- return t ? [...new Set(t.map((e) => JSON.stringify(e)))].map(
5
- (e) => JSON.parse(e)
6
- ) : [];
7
- }, f = {
8
- computed: {
9
- ...p(n)
10
- },
11
- methods: {
12
- flatmapPanZoomCallback: function(t) {
13
- if (this.mouseHovered) {
14
- const e = {
15
- paneIndex: this.entry.id,
16
- eventType: "panZoom",
17
- payload: t,
18
- type: this.entry.type
19
- };
20
- this.$emit("resource-selected", e);
21
- }
22
- },
23
- /**
24
- * Function used for updating the flatmap markers.
25
- * We set the markers based on what was searched and the flatmap clusters them.
26
- */
27
- flatmapMarkerUpdate(t) {
28
- if (!this.flatmapReady)
29
- return;
30
- let e = t;
31
- if (e || (e = this.getFlatmapImp()), e) {
32
- let r = this.settingsStore.markers, a = this.settingsStore.hoveredMarkers;
33
- r = o(r), a = o(a), e.clearMarkers(), r.forEach((s) => {
34
- let i = "standard-marker", m = !0;
35
- a.includes(s) && (i += " hovered", m = !1), e.addMarker(s, { className: i, cluster: m });
36
- }), this.entry.type === "MultiFlatmap" && this.restoreFeaturedMarkers(e);
37
- }
38
- },
39
- flatmapReadyForMarkerUpdates: function(t) {
40
- if (t) {
41
- t.enablePanZoomEvents(!0), this.flatmapReady = !0;
42
- const e = t.mapImp;
43
- this.flatmapMarkerUpdate(e);
44
- }
45
- }
46
- }
47
- };
48
- export {
49
- f as D
50
- };