@abi-software/mapintegratedvuer 1.9.1 → 1.9.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/mapintegratedvuer",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "license": "Apache-2.0",
5
5
  "scripts": {
6
6
  "serve": "vite --host --force",
@@ -50,8 +50,8 @@
50
50
  "*.js"
51
51
  ],
52
52
  "dependencies": {
53
- "@abi-software/flatmapvuer": "^1.9.1",
54
- "@abi-software/map-side-bar": "^2.8.1",
53
+ "@abi-software/flatmapvuer": "^1.9.2",
54
+ "@abi-software/map-side-bar": "^2.8.2",
55
55
  "@abi-software/map-utilities": "^1.5.0",
56
56
  "@abi-software/plotvuer": "1.0.4",
57
57
  "@abi-software/scaffoldvuer": "^1.9.0",
@@ -48,7 +48,10 @@ export default {
48
48
  },
49
49
  data: function() {
50
50
  return {
51
- styles: { }
51
+ styles: { },
52
+ query: "",
53
+ filter: [],
54
+ target: [],
52
55
  }
53
56
  },
54
57
  methods: {
@@ -230,6 +233,94 @@ export default {
230
233
  }
231
234
  }
232
235
  },
236
+ getSearchedId: function (flatmap, term) {
237
+ let ids = [];
238
+ const searchResult = flatmap.mapImp.search(term);
239
+ const featureIds = searchResult.__featureIds || searchResult.featureIds;
240
+ featureIds.forEach((id) => {
241
+ const annotation = flatmap.mapImp.annotation(id);
242
+ if (
243
+ annotation.label?.toLowerCase().includes(term.toLowerCase()) &&
244
+ annotation.models && !ids.includes(annotation.models)
245
+ ) {
246
+ ids.push(annotation.models);
247
+ }
248
+ });
249
+ return ids;
250
+ },
251
+ connectivityQueryFilter: async function (data) {
252
+ const activeContents = this.getActiveContents();
253
+ let searchResults = [];
254
+ let searchState = '';
255
+
256
+ for (const activeContent of activeContents) {
257
+ const viewer = activeContent.$refs.viewer;
258
+
259
+ if (viewer) {
260
+ const multiflatmap = viewer.$refs.multiflatmap;
261
+ const flatmap = viewer.$refs.flatmap;
262
+ let currentFlatmap = null;
263
+
264
+ if (multiflatmap) {
265
+ const _currentFlatmap = multiflatmap.getCurrentFlatmap();
266
+ if (_currentFlatmap && _currentFlatmap.mapImp) {
267
+ currentFlatmap = _currentFlatmap;
268
+ }
269
+ }
270
+
271
+ if (flatmap && flatmap.mapImp) {
272
+ currentFlatmap = flatmap;
273
+ }
274
+
275
+ const uniqueConnectivities = this.connectivitiesStore.getUniqueConnectivitiesByKeys;
276
+
277
+ if (currentFlatmap && currentFlatmap.$el.checkVisibility()) {
278
+ let payload = {
279
+ state: "default",
280
+ data: [...uniqueConnectivities],
281
+ };
282
+
283
+ if (data) {
284
+ if (data.type === "query-update") {
285
+ if (this.query !== data.value) this.target = [];
286
+ this.query = data.value;
287
+ } else if (data.type === "filter-update") {
288
+ this.filter = data.value;
289
+ }
290
+ }
291
+
292
+ if (this.query) {
293
+ payload.state = "processed";
294
+ let prom1 = [], options = {};
295
+ const searchTerms = this.query.split(",").map((term) => term.trim());
296
+ for (let index = 0; index < searchTerms.length; index++) {
297
+ prom1.push(this.getSearchedId(currentFlatmap, searchTerms[index]));
298
+ }
299
+ const nestedIds = await Promise.all(prom1);
300
+ const ids = [...new Set(nestedIds.flat())];
301
+ let paths = await currentFlatmap.retrieveConnectedPaths(ids, options);
302
+ paths = [...ids, ...paths.filter((path) => !ids.includes(path))];
303
+ let results = uniqueConnectivities.filter((item) => paths.includes(item.id));
304
+ payload.data = results;
305
+ }
306
+
307
+ searchState = payload.state;
308
+ searchResults = [...searchResults, ...payload.data];
309
+ }
310
+ }
311
+ }
312
+
313
+ const uniqueResults = Array.from(
314
+ new Map(searchResults.map((item) => [item.id, item])).values()
315
+ );
316
+
317
+ const connectivitiesPayload = {
318
+ state: searchState,
319
+ data: uniqueResults,
320
+ };
321
+
322
+ EventBus.emit("connectivity-knowledge", connectivitiesPayload);
323
+ },
233
324
  },
234
325
  computed: {
235
326
  ...mapStores(useSplitFlowStore, useConnectivitiesStore),
@@ -287,6 +378,9 @@ export default {
287
378
  EventBus.on('species-layout-connectivity-update', () => {
288
379
  this.onSpeciesLayoutConnectivityUpdate();
289
380
  })
381
+ EventBus.on("connectivity-query-filter", (payload) => {
382
+ this.connectivityQueryFilter(payload);
383
+ });
290
384
  },
291
385
  };
292
386
  </script>
@@ -146,6 +146,7 @@ export default {
146
146
  },
147
147
  methods: {
148
148
  onConnectivityExplorerClicked: function (payload) {
149
+ this.search = payload.id
149
150
  this.onDisplaySearch({ term: payload.id }, false, true);
150
151
  },
151
152
  /**
@@ -374,6 +375,7 @@ export default {
374
375
  this.filterTriggered = false; // reset for next action
375
376
  }
376
377
  } else if (data.id === 2) {
378
+ this.search = '';
377
379
  this.connectivityEntry = [];
378
380
  EventBus.emit("connectivity-query-filter", data);
379
381
  }
@@ -635,7 +637,15 @@ export default {
635
637
  }
636
638
  });
637
639
  EventBus.on('connectivity-info-open', payload => {
638
- this.connectivityEntry = payload;
640
+ if (!this.search || payload.length > 1) {
641
+ this.connectivityEntry = payload;
642
+ } else if (this.search && payload.length === 1) {
643
+ // if search exist, payload should always be an array of one element
644
+ // skip those payload not contain the search
645
+ if (payload[0].featureId[0] === this.search) {
646
+ this.connectivityEntry = payload;
647
+ }
648
+ }
639
649
  // click on the flatmap paths/features directly
640
650
  // or onDisplaySearch is performed
641
651
  if (!this.connectivityExplorerClicked.length) {
@@ -647,7 +657,7 @@ export default {
647
657
  this.onShowConnectivity(this.connectivityHighlight);
648
658
  }
649
659
  if (this.$refs.sideBar) {
650
- this.$refs.sideBar.tabClicked({id: 2, type: 'connectivityExplorer'});
660
+ this.$refs.sideBar.tabClicked({ id: 2, type: 'connectivityExplorer' });
651
661
  this.$refs.sideBar.setDrawerOpen(true);
652
662
  }
653
663
  }
@@ -22,6 +22,7 @@
22
22
  @connectivity-info-open="onConnectivityInfoOpen"
23
23
  @connectivity-error="onConnectivityError"
24
24
  @connectivity-info-close="onConnectivityInfoClose"
25
+ :connectivityInfoSidebar="connectivityInfoSidebar"
25
26
  :pathControls="true"
26
27
  ref="flatmap"
27
28
  @ready="flatmapReadyCall"
@@ -202,12 +203,6 @@ export default {
202
203
  currentFlatmap.showConnectivitiesByReference(payload);
203
204
  }
204
205
  });
205
- EventBus.on("connectivity-query-filter", (payload) => {
206
- const currentFlatmap = this.$refs.flatmap;
207
- if (currentFlatmap && currentFlatmap.mapImp) {
208
- this.connectivityQueryFilter(currentFlatmap, payload)
209
- }
210
- });
211
206
  },
212
207
  };
213
208
  </script>
@@ -505,14 +505,6 @@ export default {
505
505
  this.cardHoverHighlight();
506
506
  }
507
507
  });
508
- EventBus.on("connectivity-query-filter", (payload) => {
509
- if (this.flatmapReady && this.$refs.multiflatmap) {
510
- const currentFlatmap = this.$refs.multiflatmap.getCurrentFlatmap();
511
- if (currentFlatmap && currentFlatmap.mapImp) {
512
- this.connectivityQueryFilter(currentFlatmap, payload)
513
- }
514
- }
515
- });
516
508
  },
517
509
  };
518
510
  </script>
@@ -597,54 +597,6 @@ export default {
597
597
  // EventBus.emit("connectivity-knowledge", { data: this.connectivityKnowledge[uuid] });
598
598
  EventBus.emit('species-layout-connectivity-update');
599
599
  },
600
- getSearchedId: function (flatmap, term) {
601
- let ids = [];
602
- const searchResult = flatmap.mapImp.search(term);
603
- const featureIds = searchResult.__featureIds || searchResult.featureIds;
604
- featureIds.forEach((id) => {
605
- const annotation = flatmap.mapImp.annotation(id);
606
- if (
607
- annotation.label?.toLowerCase().includes(term.toLowerCase()) &&
608
- annotation.models && !ids.includes(annotation.models)
609
- ) {
610
- ids.push(annotation.models);
611
- }
612
- });
613
- return ids;
614
- },
615
- connectivityQueryFilter: async function (flatmap, data) {
616
- const uniqueConnectivities = this.connectivitiesStore.getUniqueConnectivitiesByKeys;
617
- // only for those flatmaps that are shown on the split screen
618
- if (flatmap.$el.checkVisibility()) {
619
- let payload = {
620
- state: "default",
621
- data: [...uniqueConnectivities],
622
- };
623
- if (data) {
624
- if (data.type === "query-update") {
625
- if (this.query !== data.value) this.target = [];
626
- this.query = data.value;
627
- } else if (data.type === "filter-update") {
628
- this.filter = data.value;
629
- }
630
- }
631
- if (this.query) {
632
- payload.state = "processed";
633
- let prom1 = [], options = {};
634
- const searchTerms = this.query.split(",").map((term) => term.trim());
635
- for (let index = 0; index < searchTerms.length; index++) {
636
- prom1.push(this.getSearchedId(flatmap, searchTerms[index]));
637
- }
638
- const nestedIds = await Promise.all(prom1);
639
- const ids = [...new Set(nestedIds.flat())];
640
- let paths = await flatmap.retrieveConnectedPaths(ids, options);
641
- paths = [...ids, ...paths.filter((path) => !ids.includes(path))];
642
- let results = uniqueConnectivities.filter((item) => paths.includes(item.id));
643
- payload.data = results;
644
- }
645
- EventBus.emit("connectivity-knowledge", payload);
646
- }
647
- }
648
600
  },
649
601
  data: function () {
650
602
  return {
@@ -666,8 +618,6 @@ export default {
666
618
  isInHelp: false,
667
619
  mapManager: undefined,
668
620
  connectivityKnowledge: {},
669
- query: "",
670
- filter: [],
671
621
  highlightDelay: undefined
672
622
  };
673
623
  },