@abi-software/mapintegratedvuer 0.7.1-demo.0 → 0.7.2-vue3.0-alpha.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 (65) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +150 -142
  3. package/assets/gazelle-icons-no-background.css +32 -0
  4. package/assets/styleguide.css +19 -19
  5. package/cypress.config.js +23 -23
  6. package/dist/index.html +17 -17
  7. package/dist/mapintegratedvuer.js +60394 -59859
  8. package/dist/mapintegratedvuer.umd.cjs +515 -907
  9. package/dist/matterport.pdf +0 -0
  10. package/dist/style.css +1 -1
  11. package/dist/test.txt +0 -0
  12. package/package.json +135 -136
  13. package/public/index.html +17 -17
  14. package/public/matterport.pdf +0 -0
  15. package/public/test.txt +0 -0
  16. package/q.json +690 -0
  17. package/reporter-config.json +9 -9
  18. package/src/App.vue +245 -245
  19. package/src/assets/_variables.scss +43 -43
  20. package/src/assets/fonts/mapicon-species.eot +0 -0
  21. package/src/assets/fonts/mapicon-species.ttf +0 -0
  22. package/src/assets/fonts/mapicon-species.woff +0 -0
  23. package/src/assets/header-icon.scss +67 -67
  24. package/src/assets/mapicon-species-style.css +41 -41
  25. package/src/assets/styles.scss +9 -9
  26. package/src/components/ContentBar.vue +376 -376
  27. package/src/components/ContentVuer.vue +217 -217
  28. package/src/components/ContextCard.vue +385 -385
  29. package/src/components/ContextHelp.vue +73 -73
  30. package/src/components/CustomSplitter.vue +151 -151
  31. package/src/components/DatasetHeader.vue +97 -97
  32. package/src/components/DialogToolbarContent.vue +464 -464
  33. package/src/components/EventBus.js +3 -3
  34. package/src/components/FlatmapContextCard.vue +134 -134
  35. package/src/components/MapContent.vue +333 -285
  36. package/src/components/ResizeSensor.vue +47 -47
  37. package/src/components/SearchControls.vue +115 -115
  38. package/src/components/SimulatedData.js +721 -721
  39. package/src/components/SplitDialog.vue +287 -287
  40. package/src/components/SplitFlow.vue +414 -414
  41. package/src/components/index.js +7 -7
  42. package/src/components/markerZoomLevelsHardCoded.js +255 -255
  43. package/src/components/scripts/utilities.js +173 -173
  44. package/src/components/viewers/Flatmap.vue +145 -145
  45. package/src/components/viewers/Iframe.vue +31 -31
  46. package/src/components/viewers/MultiFlatmap.vue +384 -384
  47. package/src/components/viewers/Plot.vue +23 -23
  48. package/src/components/viewers/Scaffold.vue +198 -198
  49. package/src/components/viewers/Simulation.vue +21 -21
  50. package/src/icons/yellowstar.js +1 -1
  51. package/src/main.js +32 -22
  52. package/src/mixins/ContentMixin.js +438 -438
  53. package/src/mixins/DynamicMarkerMixin.js +88 -88
  54. package/src/mixins/RetrieveContextCardMixin.js +82 -0
  55. package/src/mixins/S3Bucket.vue +37 -37
  56. package/src/stores/entries.js +40 -40
  57. package/src/stores/index.js +24 -16
  58. package/src/stores/settings.js +144 -144
  59. package/src/stores/splitFlow.js +523 -523
  60. package/static.json +7 -7
  61. package/tsconfig.json +19 -0
  62. package/vite.config.js +70 -66
  63. package/vite.static-build.js +12 -12
  64. package/vitest.workspace.js +3 -3
  65. package/vuese-generator.js +65 -0
@@ -1,414 +1,414 @@
1
- <template>
2
- <el-container style="height: 100%; background: white">
3
- <el-header
4
- ref="header"
5
- style="text-align: left; font-size: 14px; padding: 0"
6
- height="32px"
7
- class="dialog-header"
8
- >
9
- <DialogToolbarContent
10
- :numberOfEntries="entries.length"
11
- @onFullscreen="onFullscreen"
12
- @local-search="onDisplaySearch"
13
- @fetch-suggestions="fetchSuggestions"
14
- ref="dialogToolbar"
15
- />
16
- </el-header>
17
- <el-main class="dialog-main">
18
- <div
19
- style="width: 100%; height: 100%; position: relative; overflow: hidden"
20
- >
21
- <SideBar
22
- ref="sideBar"
23
- :envVars="envVars"
24
- :visible="sideBarVisibility"
25
- :class="['side-bar', { 'start-up': startUp }]"
26
- :activeId="activeDockedId"
27
- :open-at-start="startUp"
28
- @actionClick="actionClick"
29
- @tabClicked="tabClicked"
30
- @search-changed="searchChanged($event)"
31
- @contextUpdate="contextUpdate($event)"
32
- />
33
- <SplitDialog
34
- :entries="entries"
35
- ref="splitdialog"
36
- @resource-selected="resourceSelected"
37
- />
38
- </div>
39
- </el-main>
40
- </el-container>
41
- </template>
42
-
43
- <script>
44
- /* eslint-disable no-alert, no-console */
45
- import DialogToolbarContent from "./DialogToolbarContent.vue";
46
- import EventBus from "./EventBus";
47
- import SplitDialog from "./SplitDialog.vue";
48
- // import contextCards from './context-cards'
49
- import { SideBar } from "@abi-software/map-side-bar";
50
- import { capitalise, getNewMapEntry, initialDefaultState } from "./scripts/utilities.js";
51
- import { mapStores } from 'pinia';
52
- import { useEntriesStore } from '../stores/entries';
53
- import { useSettingsStore } from '../stores/settings';
54
- import { useSplitFlowStore } from '../stores/splitFlow';
55
- import {
56
- ElContainer as Container,
57
- ElHeader as Header,
58
- ElMain as Main,
59
- } from "element-plus";
60
-
61
- import "@abi-software/map-side-bar/dist/style.css";
62
-
63
- /**
64
- * Component of the floating dialogs.
65
- */
66
- export default {
67
- name: "SplitFlow",
68
- components: {
69
- Container,
70
- Header,
71
- Main,
72
- DialogToolbarContent,
73
- SplitDialog,
74
- SideBar,
75
- },
76
- props: {
77
- state: {
78
- type: Object,
79
- default: undefined,
80
- }
81
- },
82
- data: function () {
83
- return {
84
- sideBarVisibility: true,
85
- startUp: true,
86
- search: '',
87
- activeDockedId : 1,
88
- }
89
- },
90
- watch: {
91
- state: {
92
- handler: function (value) {
93
- if (value) {
94
- if (!this._externalStateSet) this.setState(value);
95
- this._externalStateSet = true;
96
- }
97
- },
98
- immediate: true,
99
- },
100
- },
101
- methods: {
102
- /**
103
- * Callback when an action is performed (open new dialogs).
104
- */
105
- actionClick: function (action) {
106
- if (action) {
107
- if (action.type == "Search") {
108
- if (action.nervePath) {
109
- this.openSearch([action.filter], action.label);
110
- } else {
111
- this.openSearch([], action.term);
112
- }
113
- } else if (action.type == "URL") {
114
- window.open(action.resource, "_blank");
115
- } else if (action.type == "Facet") {
116
- if (this.$refs.sideBar) {
117
- this.$refs.sideBar.addFilter(action);
118
- }
119
- } else if (action.type == "Facets") {
120
- const facets = [];
121
- this.settingsStore.facets.species.forEach(e => {
122
- facets.push({
123
- facet: capitalise(e),
124
- term: "Species",
125
- facetPropPath: "organisms.primary.species.name",
126
- });
127
- });
128
- if (facets.length == 0)
129
- facets.push({
130
- facet: "Show All",
131
- term: "Species",
132
- facetPropPath: "organisms.primary.species.name",
133
- });
134
- facets.push(
135
- ...action.labels.map(val => ({
136
- facet: capitalise(val),
137
- term: "Anatomical structure",
138
- facetPropPath: "anatomy.organ.category.name",
139
- }))
140
- );
141
- if (this.$refs.sideBar) {
142
- this.$refs.sideBar.openSearch(facets, "");
143
- }
144
- } else {
145
- this.createNewEntry(action);
146
- }
147
- }
148
- },
149
- onDisplaySearch: function (payload) {
150
- let searchFound = false;
151
- //Search all active viewers when global callback is on
152
- let splitdialog = this.$refs.splitdialog;
153
- if (splitdialog) {
154
- const activeContents = splitdialog.getActiveContents();
155
- activeContents.forEach(content => {
156
- if (content.search(payload.term)) {
157
- searchFound = true;
158
- }
159
- });
160
- }
161
- this.$refs.dialogToolbar.setFailedSearch(searchFound ? undefined : payload.term);
162
- },
163
- fetchSuggestions: function(payload) {
164
- const suggestions = [];
165
- //Search all active viewers when global callback is on
166
- let splitdialog = this.$refs.splitdialog;
167
- const activeContents = splitdialog.getActiveContents();
168
- //Push new suggestions into the pre-existing suggestions array
169
- activeContents.forEach(content => content.searchSuggestions(payload.data.term, suggestions));
170
- const unique = new Set(suggestions);
171
- suggestions.length = 0;
172
- for (const item of unique) {
173
- suggestions.push({"value": "\"" + item +"\""});
174
- }
175
- payload.data.cb(suggestions);
176
- },
177
- searchChanged: function (data) {
178
- if (data && data.type == "query-update") {
179
- this.search = data.value;
180
- }
181
- if (data && data.type == "filter-update") {
182
- this.settingsStore.updateFacets(data.value);
183
- }
184
- if (data && data.type == "available-facets") {
185
- this.settingsStore.updateFacetLabels(data.value.labels);
186
- this.settingsStore.updateMarkers(data.value.uberons);
187
- EventBus.emit("markerUpdate");
188
- }
189
- },
190
- getNewEntryId: function() {
191
- if (this.entries.length) {
192
- return (this.entries[this.entries.length - 1]).id + 1;
193
- }
194
- return 1;
195
- },
196
- /**
197
- * Activate Synchronised workflow
198
- */
199
- activateSyncMap: function (data) {
200
- let newEntry = {};
201
- Object.assign(newEntry, data);
202
- newEntry.mode = "normal";
203
- newEntry.id = this.getNewEntryId();
204
- newEntry.state = undefined;
205
- newEntry.type = "Scaffold";
206
- newEntry.discoverId = data.discoverId;
207
- newEntry.rotation = "free";
208
- if (data.layout == "2vertpanel") newEntry.rotation = "horizontal";
209
- else if (data.layout == "2horpanel") newEntry.rotation = "vertical";
210
- this.entriesStore.addNewEntry(newEntry);
211
- this.splitFlowStore.setSyncMode({
212
- flag: true,
213
- newId: newEntry.id,
214
- layout: data.layout,
215
- });
216
- return newEntry.id;
217
- },
218
- /**
219
- * Add new entry which will sequentially create a
220
- * new dialog.
221
- */
222
- createNewEntry: function (data) {
223
- let newEntry = {};
224
- newEntry.viewUrl = undefined;
225
- newEntry.state = undefined;
226
- Object.assign(newEntry, data);
227
- newEntry.mode = "normal";
228
- newEntry.id = this.getNewEntryId();
229
- newEntry.discoverId = data.discoverId;
230
- this.entriesStore.addNewEntry(newEntry);
231
- this.splitFlowStore.setIdToPrimaryPane(newEntry.id);
232
- if (this.splitFlowStore.syncMode) {
233
- this.splitFlowStore.setSyncMode({ flag: false });
234
- }
235
-
236
- //close sidebar on entry creation to see the context card
237
- if (this.$refs.sideBar) {
238
- this.$refs.sideBar.setDrawerOpen(false);
239
- }
240
-
241
- return newEntry.id;
242
- },
243
- openNewMap: async function (type) {
244
- const entry = await getNewMapEntry(type, this.settingsStore.sparcApi);
245
- this.createNewEntry(entry);
246
- if (entry.contextCard) {
247
- EventBus.emit("contextUpdate", entry.contextCard);
248
- }
249
- },
250
- openSearch: function (facets, query) {
251
- // Keep the species facets currently unused
252
- // let facets = [{facet: "All species", facetPropPath: 'organisms.primary.species.name', term:'species'}];
253
- // this.settingsStore.facets.species.forEach(e => {
254
- // facets.push({facet: e, facetPropPath: 'organisms.primary.species.name', term:'species'});
255
- // });
256
- this.search = query;
257
- this._facets = facets;
258
- if (this.$refs && this.$refs.sideBar) {
259
- this.$refs.sideBar.openSearch(facets, query);
260
- }
261
- this.startUp = false;
262
- },
263
- onFullscreen: function (val) {
264
- this.$emit("onFullscreen", val);
265
- },
266
- resetApp: function () {
267
- this.setState(initialDefaultState());
268
- },
269
- setIdToPrimaryPane: function (id) {
270
- this.splitFlowStore.setIdToPrimaryPane(id);
271
- },
272
- setState: function (state) {
273
- this.entriesStore.setAll(state.entries);
274
- //Support both old and new permalink.
275
- if (state.splitFlow) this.splitFlowStore.setState(state.splitFlow);
276
- else this.entries.forEach(entry => this.splitFlowStore.setIdToPrimaryPane(entry.id));
277
- },
278
- getState: function () {
279
- let state = JSON.parse(JSON.stringify(this.entriesStore.$state));
280
- let splitdialog = this.$refs.splitdialog;
281
- let dialogStates = splitdialog.getContentsState();
282
- if (state.entries.length === dialogStates.length) {
283
- for (let i = 0; i < dialogStates.length; i++) {
284
- const entry = state.entries[i];
285
- entry.state = dialogStates[i];
286
- //We do not want to serialise the following properties
287
- if (entry.type === "Scaffold" && "viewUrl" in entry)
288
- delete entry.viewUrl;
289
- if (entry.type === "MultiFlatmap" && "uberonId" in entry)
290
- delete entry.uberonId;
291
- }
292
- }
293
- state.splitFlow = this.splitFlowStore.getState();
294
- return state;
295
- },
296
- removeEntry: function (id) {
297
- let index = this.entriesStore.findIndexOfId(id);
298
- this.entriesStore.destroyEntry(index);
299
- },
300
- resourceSelected: function (result) {
301
- this.$emit("resource-selected", result);
302
- if (this.splitFlowStore.globalCallback) {
303
- this.$refs.splitdialog.sendSynchronisedEvent(result);
304
- }
305
- },
306
- tabClicked: function (id) {
307
- this.activeDockedId = id;
308
- },
309
- toggleSyncMode: function (payload) {
310
- if (payload) {
311
- if (payload.flag) {
312
- if (payload.action) {
313
- this.activateSyncMap(payload.action);
314
- }
315
- } else {
316
- if (this.splitFlowStore.syncMode) {
317
- this.splitFlowStore.setSyncMode({
318
- flag: false,
319
- });
320
- }
321
- }
322
- }
323
- },
324
- contextUpdate: function (payload) {
325
- EventBus.emit("contextUpdate", payload);
326
- }
327
- },
328
- created: function () {
329
- this._facets = [];
330
- this._externalStateSet = false;
331
- },
332
- mounted: function () {
333
- EventBus.on("RemoveEntryRequest", id => {
334
- this.removeEntry(id);
335
- });
336
- EventBus.on("SyncModeRequest", payload => {
337
- this.toggleSyncMode(payload);
338
- });
339
- EventBus.on("PopoverActionClick", payload => {
340
- this.actionClick(payload);
341
- });
342
- EventBus.on("OpenNewMap", type => {
343
- this.openNewMap(type);
344
- });
345
- this.$nextTick(() => {
346
- if (this.search === "" && this._facets.length === 0) {
347
- if (this.$refs.sideBar) {
348
- this.$refs.sideBar.close();
349
- }
350
- setTimeout(() => {
351
- this.startUp = false;
352
- }, 2000);
353
- } else this.openSearch(this._facets, this.search);
354
- });
355
- },
356
- computed: {
357
- ...mapStores(useEntriesStore, useSettingsStore, useSplitFlowStore),
358
- envVars: function () {
359
- return {
360
- API_LOCATION: this.settingsStore.sparcApi,
361
- ALGOLIA_INDEX: this.settingsStore.algoliaIndex,
362
- ALGOLIA_KEY: this.settingsStore.algoliaKey,
363
- ALGOLIA_ID: this.settingsStore.algoliaId,
364
- PENNSIEVE_API_LOCATION: this.settingsStore.pennsieveApi,
365
- NL_LINK_PREFIX: this.settingsStore.nlLinkPrefix,
366
- ROOT_URL: this.settingsStore.rootUrl,
367
- };
368
- },
369
- entries: function() {
370
- return this.entriesStore.entries;
371
- },
372
- },
373
- };
374
- </script>
375
-
376
- <style scoped lang="scss">
377
- .dialog-header {
378
- color: #333;
379
- line-height: 20px;
380
- border-bottom: solid 0.7px #dcdfe6;
381
- background-color: #f5f7fa;
382
- }
383
-
384
- .dialog-main {
385
- padding: 0px;
386
- width: 100%;
387
- height: 100%;
388
- }
389
-
390
- .start-up {
391
- :deep(.el-drawer__open) {
392
- .el-drawer {
393
- &.rtl {
394
- animation: unset;
395
- }
396
- }
397
- }
398
- :deep(.el-drawer-fade-leave-active) {
399
- animation: unset;
400
- }
401
- :deep(.el-drawer) {
402
- &.rtl {
403
- animation: rtl-drawer-out 2s linear;
404
- }
405
- }
406
-
407
- :deep(.el-drawer__wrapper) {
408
- &.side-bar {
409
- display: block !important;
410
- }
411
- }
412
- }
413
-
414
- </style>
1
+ <template>
2
+ <el-container style="height: 100%; background: white">
3
+ <el-header
4
+ ref="header"
5
+ style="text-align: left; font-size: 14px; padding: 0"
6
+ height="32px"
7
+ class="dialog-header"
8
+ >
9
+ <DialogToolbarContent
10
+ :numberOfEntries="entries.length"
11
+ @onFullscreen="onFullscreen"
12
+ @local-search="onDisplaySearch"
13
+ @fetch-suggestions="fetchSuggestions"
14
+ ref="dialogToolbar"
15
+ />
16
+ </el-header>
17
+ <el-main class="dialog-main">
18
+ <div
19
+ style="width: 100%; height: 100%; position: relative; overflow: hidden"
20
+ >
21
+ <SideBar
22
+ ref="sideBar"
23
+ :envVars="envVars"
24
+ :visible="sideBarVisibility"
25
+ :class="['side-bar', { 'start-up': startUp }]"
26
+ :activeId="activeDockedId"
27
+ :open-at-start="startUp"
28
+ @actionClick="actionClick"
29
+ @tabClicked="tabClicked"
30
+ @search-changed="searchChanged($event)"
31
+ @contextUpdate="contextUpdate($event)"
32
+ />
33
+ <SplitDialog
34
+ :entries="entries"
35
+ ref="splitdialog"
36
+ @resource-selected="resourceSelected"
37
+ />
38
+ </div>
39
+ </el-main>
40
+ </el-container>
41
+ </template>
42
+
43
+ <script>
44
+ /* eslint-disable no-alert, no-console */
45
+ import DialogToolbarContent from "./DialogToolbarContent.vue";
46
+ import EventBus from "./EventBus";
47
+ import SplitDialog from "./SplitDialog.vue";
48
+ // import contextCards from './context-cards'
49
+ import { SideBar } from "@abi-software/map-side-bar";
50
+ import { capitalise, getNewMapEntry, initialDefaultState } from "./scripts/utilities.js";
51
+ import { mapStores } from 'pinia';
52
+ import { useEntriesStore } from '../stores/entries';
53
+ import { useSettingsStore } from '../stores/settings';
54
+ import { useSplitFlowStore } from '../stores/splitFlow';
55
+ import {
56
+ ElContainer as Container,
57
+ ElHeader as Header,
58
+ ElMain as Main,
59
+ } from "element-plus";
60
+
61
+ import "@abi-software/map-side-bar/dist/style.css";
62
+
63
+ /**
64
+ * Component of the floating dialogs.
65
+ */
66
+ export default {
67
+ name: "SplitFlow",
68
+ components: {
69
+ Container,
70
+ Header,
71
+ Main,
72
+ DialogToolbarContent,
73
+ SplitDialog,
74
+ SideBar,
75
+ },
76
+ props: {
77
+ state: {
78
+ type: Object,
79
+ default: undefined,
80
+ }
81
+ },
82
+ data: function () {
83
+ return {
84
+ sideBarVisibility: true,
85
+ startUp: true,
86
+ search: '',
87
+ activeDockedId : 1,
88
+ }
89
+ },
90
+ watch: {
91
+ state: {
92
+ handler: function (value) {
93
+ if (value) {
94
+ if (!this._externalStateSet) this.setState(value);
95
+ this._externalStateSet = true;
96
+ }
97
+ },
98
+ immediate: true,
99
+ },
100
+ },
101
+ methods: {
102
+ /**
103
+ * Callback when an action is performed (open new dialogs).
104
+ */
105
+ actionClick: function (action) {
106
+ if (action) {
107
+ if (action.type == "Search") {
108
+ if (action.nervePath) {
109
+ this.openSearch([action.filter], action.label);
110
+ } else {
111
+ this.openSearch([], action.term);
112
+ }
113
+ } else if (action.type == "URL") {
114
+ window.open(action.resource, "_blank");
115
+ } else if (action.type == "Facet") {
116
+ if (this.$refs.sideBar) {
117
+ this.$refs.sideBar.addFilter(action);
118
+ }
119
+ } else if (action.type == "Facets") {
120
+ const facets = [];
121
+ this.settingsStore.facets.species.forEach(e => {
122
+ facets.push({
123
+ facet: capitalise(e),
124
+ term: "Species",
125
+ facetPropPath: "organisms.primary.species.name",
126
+ });
127
+ });
128
+ if (facets.length == 0)
129
+ facets.push({
130
+ facet: "Show All",
131
+ term: "Species",
132
+ facetPropPath: "organisms.primary.species.name",
133
+ });
134
+ facets.push(
135
+ ...action.labels.map(val => ({
136
+ facet: capitalise(val),
137
+ term: "Anatomical structure",
138
+ facetPropPath: "anatomy.organ.category.name",
139
+ }))
140
+ );
141
+ if (this.$refs.sideBar) {
142
+ this.$refs.sideBar.openSearch(facets, "");
143
+ }
144
+ } else {
145
+ this.createNewEntry(action);
146
+ }
147
+ }
148
+ },
149
+ onDisplaySearch: function (payload) {
150
+ let searchFound = false;
151
+ //Search all active viewers when global callback is on
152
+ let splitdialog = this.$refs.splitdialog;
153
+ if (splitdialog) {
154
+ const activeContents = splitdialog.getActiveContents();
155
+ activeContents.forEach(content => {
156
+ if (content.search(payload.term)) {
157
+ searchFound = true;
158
+ }
159
+ });
160
+ }
161
+ this.$refs.dialogToolbar.setFailedSearch(searchFound ? undefined : payload.term);
162
+ },
163
+ fetchSuggestions: function(payload) {
164
+ const suggestions = [];
165
+ //Search all active viewers when global callback is on
166
+ let splitdialog = this.$refs.splitdialog;
167
+ const activeContents = splitdialog.getActiveContents();
168
+ //Push new suggestions into the pre-existing suggestions array
169
+ activeContents.forEach(content => content.searchSuggestions(payload.data.term, suggestions));
170
+ const unique = new Set(suggestions);
171
+ suggestions.length = 0;
172
+ for (const item of unique) {
173
+ suggestions.push({"value": "\"" + item +"\""});
174
+ }
175
+ payload.data.cb(suggestions);
176
+ },
177
+ searchChanged: function (data) {
178
+ if (data && data.type == "query-update") {
179
+ this.search = data.value;
180
+ }
181
+ if (data && data.type == "filter-update") {
182
+ this.settingsStore.updateFacets(data.value);
183
+ }
184
+ if (data && data.type == "available-facets") {
185
+ this.settingsStore.updateFacetLabels(data.value.labels);
186
+ this.settingsStore.updateMarkers(data.value.uberons);
187
+ EventBus.emit("markerUpdate");
188
+ }
189
+ },
190
+ getNewEntryId: function() {
191
+ if (this.entries.length) {
192
+ return (this.entries[this.entries.length - 1]).id + 1;
193
+ }
194
+ return 1;
195
+ },
196
+ /**
197
+ * Activate Synchronised workflow
198
+ */
199
+ activateSyncMap: function (data) {
200
+ let newEntry = {};
201
+ Object.assign(newEntry, data);
202
+ newEntry.mode = "normal";
203
+ newEntry.id = this.getNewEntryId();
204
+ newEntry.state = undefined;
205
+ newEntry.type = "Scaffold";
206
+ newEntry.discoverId = data.discoverId;
207
+ newEntry.rotation = "free";
208
+ if (data.layout == "2vertpanel") newEntry.rotation = "horizontal";
209
+ else if (data.layout == "2horpanel") newEntry.rotation = "vertical";
210
+ this.entriesStore.addNewEntry(newEntry);
211
+ this.splitFlowStore.setSyncMode({
212
+ flag: true,
213
+ newId: newEntry.id,
214
+ layout: data.layout,
215
+ });
216
+ return newEntry.id;
217
+ },
218
+ /**
219
+ * Add new entry which will sequentially create a
220
+ * new dialog.
221
+ */
222
+ createNewEntry: function (data) {
223
+ let newEntry = {};
224
+ newEntry.viewUrl = undefined;
225
+ newEntry.state = undefined;
226
+ Object.assign(newEntry, data);
227
+ newEntry.mode = "normal";
228
+ newEntry.id = this.getNewEntryId();
229
+ newEntry.discoverId = data.discoverId;
230
+ this.entriesStore.addNewEntry(newEntry);
231
+ this.splitFlowStore.setIdToPrimaryPane(newEntry.id);
232
+ if (this.splitFlowStore.syncMode) {
233
+ this.splitFlowStore.setSyncMode({ flag: false });
234
+ }
235
+
236
+ //close sidebar on entry creation to see the context card
237
+ if (this.$refs.sideBar) {
238
+ this.$refs.sideBar.setDrawerOpen(false);
239
+ }
240
+
241
+ return newEntry.id;
242
+ },
243
+ openNewMap: async function (type) {
244
+ const entry = await getNewMapEntry(type, this.settingsStore.sparcApi);
245
+ this.createNewEntry(entry);
246
+ if (entry.contextCard) {
247
+ EventBus.emit("contextUpdate", entry.contextCard);
248
+ }
249
+ },
250
+ openSearch: function (facets, query) {
251
+ // Keep the species facets currently unused
252
+ // let facets = [{facet: "All species", facetPropPath: 'organisms.primary.species.name', term:'species'}];
253
+ // this.settingsStore.facets.species.forEach(e => {
254
+ // facets.push({facet: e, facetPropPath: 'organisms.primary.species.name', term:'species'});
255
+ // });
256
+ this.search = query;
257
+ this._facets = facets;
258
+ if (this.$refs && this.$refs.sideBar) {
259
+ this.$refs.sideBar.openSearch(facets, query);
260
+ }
261
+ this.startUp = false;
262
+ },
263
+ onFullscreen: function (val) {
264
+ this.$emit("onFullscreen", val);
265
+ },
266
+ resetApp: function () {
267
+ this.setState(initialDefaultState());
268
+ },
269
+ setIdToPrimaryPane: function (id) {
270
+ this.splitFlowStore.setIdToPrimaryPane(id);
271
+ },
272
+ setState: function (state) {
273
+ this.entriesStore.setAll(state.entries);
274
+ //Support both old and new permalink.
275
+ if (state.splitFlow) this.splitFlowStore.setState(state.splitFlow);
276
+ else this.entries.forEach(entry => this.splitFlowStore.setIdToPrimaryPane(entry.id));
277
+ },
278
+ getState: function () {
279
+ let state = JSON.parse(JSON.stringify(this.entriesStore.$state));
280
+ let splitdialog = this.$refs.splitdialog;
281
+ let dialogStates = splitdialog.getContentsState();
282
+ if (state.entries.length === dialogStates.length) {
283
+ for (let i = 0; i < dialogStates.length; i++) {
284
+ const entry = state.entries[i];
285
+ entry.state = dialogStates[i];
286
+ //We do not want to serialise the following properties
287
+ if (entry.type === "Scaffold" && "viewUrl" in entry)
288
+ delete entry.viewUrl;
289
+ if (entry.type === "MultiFlatmap" && "uberonId" in entry)
290
+ delete entry.uberonId;
291
+ }
292
+ }
293
+ state.splitFlow = this.splitFlowStore.getState();
294
+ return state;
295
+ },
296
+ removeEntry: function (id) {
297
+ let index = this.entriesStore.findIndexOfId(id);
298
+ this.entriesStore.destroyEntry(index);
299
+ },
300
+ resourceSelected: function (result) {
301
+ this.$emit("resource-selected", result);
302
+ if (this.splitFlowStore.globalCallback) {
303
+ this.$refs.splitdialog.sendSynchronisedEvent(result);
304
+ }
305
+ },
306
+ tabClicked: function (id) {
307
+ this.activeDockedId = id;
308
+ },
309
+ toggleSyncMode: function (payload) {
310
+ if (payload) {
311
+ if (payload.flag) {
312
+ if (payload.action) {
313
+ this.activateSyncMap(payload.action);
314
+ }
315
+ } else {
316
+ if (this.splitFlowStore.syncMode) {
317
+ this.splitFlowStore.setSyncMode({
318
+ flag: false,
319
+ });
320
+ }
321
+ }
322
+ }
323
+ },
324
+ contextUpdate: function (payload) {
325
+ EventBus.emit("contextUpdate", payload);
326
+ }
327
+ },
328
+ created: function () {
329
+ this._facets = [];
330
+ this._externalStateSet = false;
331
+ },
332
+ mounted: function () {
333
+ EventBus.on("RemoveEntryRequest", id => {
334
+ this.removeEntry(id);
335
+ });
336
+ EventBus.on("SyncModeRequest", payload => {
337
+ this.toggleSyncMode(payload);
338
+ });
339
+ EventBus.on("PopoverActionClick", payload => {
340
+ this.actionClick(payload);
341
+ });
342
+ EventBus.on("OpenNewMap", type => {
343
+ this.openNewMap(type);
344
+ });
345
+ this.$nextTick(() => {
346
+ if (this.search === "" && this._facets.length === 0) {
347
+ if (this.$refs.sideBar) {
348
+ this.$refs.sideBar.close();
349
+ }
350
+ setTimeout(() => {
351
+ this.startUp = false;
352
+ }, 2000);
353
+ } else this.openSearch(this._facets, this.search);
354
+ });
355
+ },
356
+ computed: {
357
+ ...mapStores(useEntriesStore, useSettingsStore, useSplitFlowStore),
358
+ envVars: function () {
359
+ return {
360
+ API_LOCATION: this.settingsStore.sparcApi,
361
+ ALGOLIA_INDEX: this.settingsStore.algoliaIndex,
362
+ ALGOLIA_KEY: this.settingsStore.algoliaKey,
363
+ ALGOLIA_ID: this.settingsStore.algoliaId,
364
+ PENNSIEVE_API_LOCATION: this.settingsStore.pennsieveApi,
365
+ NL_LINK_PREFIX: this.settingsStore.nlLinkPrefix,
366
+ ROOT_URL: this.settingsStore.rootUrl,
367
+ };
368
+ },
369
+ entries: function() {
370
+ return this.entriesStore.entries;
371
+ },
372
+ },
373
+ };
374
+ </script>
375
+
376
+ <style scoped lang="scss">
377
+ .dialog-header {
378
+ color: #333;
379
+ line-height: 20px;
380
+ border-bottom: solid 0.7px #dcdfe6;
381
+ background-color: #f5f7fa;
382
+ }
383
+
384
+ .dialog-main {
385
+ padding: 0px;
386
+ width: 100%;
387
+ height: 100%;
388
+ }
389
+
390
+ .start-up {
391
+ :deep(.el-drawer__open) {
392
+ .el-drawer {
393
+ &.rtl {
394
+ animation: unset;
395
+ }
396
+ }
397
+ }
398
+ :deep(.el-drawer-fade-leave-active) {
399
+ animation: unset;
400
+ }
401
+ :deep(.el-drawer) {
402
+ &.rtl {
403
+ animation: rtl-drawer-out 2s linear;
404
+ }
405
+ }
406
+
407
+ :deep(.el-drawer__wrapper) {
408
+ &.side-bar {
409
+ display: block !important;
410
+ }
411
+ }
412
+ }
413
+
414
+ </style>