@abi-software/flatmapvuer 1.10.3-beta.0 → 1.10.3-beta.10
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/dist/flatmapvuer.js +3187 -3081
- package/dist/flatmapvuer.umd.cjs +10 -10
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/components/FlatmapVuer.vue +128 -103
- package/src/components/MultiFlatmapVuer.vue +1 -5
- package/src/components/SelectionsGroup.vue +4 -2
- package/src/components/legends/DynamicLegends.vue +82 -65
- package/src/services/flatmapQueries.js +36 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.10.3-beta.
|
|
3
|
+
"version": "1.10.3-beta.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"./src/*": "./src/*"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@abi-software/map-utilities": "^1.6.1-beta.
|
|
47
|
+
"@abi-software/map-utilities": "^1.6.1-beta.6",
|
|
48
48
|
"@abi-software/sparc-annotation": "0.3.2",
|
|
49
49
|
"@abi-software/svg-sprite": "^1.0.1",
|
|
50
50
|
"@element-plus/icons-vue": "^2.3.1",
|
|
@@ -260,8 +260,17 @@ Please use `const` to assign meaningful names to them...
|
|
|
260
260
|
:style="{ 'max-height': pathwaysMaxHeight + 'px' }"
|
|
261
261
|
v-popover:checkBoxPopover
|
|
262
262
|
>
|
|
263
|
-
<svg-legends v-if="!isFC" class="svg-legends-container" />
|
|
264
|
-
<
|
|
263
|
+
<!-- <svg-legends v-if="!isFC" class="svg-legends-container" /> -->
|
|
264
|
+
<dynamic-legends
|
|
265
|
+
v-if="!isFC"
|
|
266
|
+
identifierKey="prompt"
|
|
267
|
+
colourKey="colour"
|
|
268
|
+
styleKey="style"
|
|
269
|
+
:legends="flatmapLegends"
|
|
270
|
+
:showStarInLegend="showStarInLegend"
|
|
271
|
+
class="svg-legends-container"
|
|
272
|
+
/>
|
|
273
|
+
<!-- <template v-if="showStarInLegend">
|
|
265
274
|
<el-popover
|
|
266
275
|
content="Location of the featured dataset"
|
|
267
276
|
placement="right"
|
|
@@ -283,7 +292,7 @@ Please use `const` to assign meaningful names to them...
|
|
|
283
292
|
></div>
|
|
284
293
|
</template>
|
|
285
294
|
</el-popover>
|
|
286
|
-
</template>
|
|
295
|
+
</template> -->
|
|
287
296
|
<!-- The line below places the yellowstar svg on the left, and the text "Featured markers on the right" with css so they are both centered in the div -->
|
|
288
297
|
<el-popover
|
|
289
298
|
content="Find these markers for data. The number inside the markers is the number of datasets available for each marker."
|
|
@@ -611,6 +620,7 @@ import SelectionsGroup from './SelectionsGroup.vue'
|
|
|
611
620
|
import { MapSvgIcon, MapSvgSpriteColor } from '@abi-software/svg-sprite'
|
|
612
621
|
import '@abi-software/svg-sprite/dist/style.css'
|
|
613
622
|
import SvgLegends from './legends/SvgLegends.vue'
|
|
623
|
+
import DynamicLegends from './legends/DynamicLegends.vue'
|
|
614
624
|
import {
|
|
615
625
|
ElButton as Button,
|
|
616
626
|
ElCol as Col,
|
|
@@ -640,7 +650,7 @@ import {
|
|
|
640
650
|
import { capitalise } from './utilities.js'
|
|
641
651
|
import yellowstar from '../icons/yellowstar'
|
|
642
652
|
import ResizeSensor from 'css-element-queries/src/ResizeSensor'
|
|
643
|
-
import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.
|
|
653
|
+
import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.10/+esm'
|
|
644
654
|
import { AnnotationService } from '@abi-software/sparc-annotation'
|
|
645
655
|
import { mapState } from 'pinia'
|
|
646
656
|
import { useMainStore } from '@/store/index'
|
|
@@ -755,11 +765,6 @@ export default {
|
|
|
755
765
|
return { annotator }
|
|
756
766
|
},
|
|
757
767
|
methods: {
|
|
758
|
-
enableFeatureResetOnClick: function (enable) {
|
|
759
|
-
if (this.mapImp) {
|
|
760
|
-
this.mapImp.enableFeatureResetOnClick(enable)
|
|
761
|
-
}
|
|
762
|
-
},
|
|
763
768
|
/**
|
|
764
769
|
*
|
|
765
770
|
* @param filter format should follow #makeStyleFilter (flatmap-viewer)
|
|
@@ -1333,6 +1338,13 @@ export default {
|
|
|
1333
1338
|
* @arg {string} `pathId` or `anatomicalId`
|
|
1334
1339
|
*/
|
|
1335
1340
|
retrieveConnectedPaths: async function (payload, options = {}) {
|
|
1341
|
+
// query all connected paths CQ
|
|
1342
|
+
if (this.viewingMode === 'Neuron Connection' && this.connectionType.toLowerCase() === 'all') {
|
|
1343
|
+
const sourceId = this.mapImp.uuid;
|
|
1344
|
+
const connectedPaths = await queryAllConnectedPaths(this.flatmapAPI, sourceId, payload);
|
|
1345
|
+
return connectedPaths;
|
|
1346
|
+
}
|
|
1347
|
+
// query all connected paths from flatmap
|
|
1336
1348
|
if (this.mapImp) {
|
|
1337
1349
|
let connectedPaths = [];
|
|
1338
1350
|
let connectedTarget = options.target?.length ? options.target : [];
|
|
@@ -1931,7 +1943,18 @@ export default {
|
|
|
1931
1943
|
this.emitConnectivityError(errorData);
|
|
1932
1944
|
|
|
1933
1945
|
// highlight all available features
|
|
1934
|
-
const
|
|
1946
|
+
const connectivityFeatures = featuresToHighlight.reduce((arr, path) => {
|
|
1947
|
+
const connectivityObj = this.mapImp.pathways.paths[path];
|
|
1948
|
+
const connectivities = connectivityObj ? connectivityObj.connectivity : null;
|
|
1949
|
+
if (connectivities) {
|
|
1950
|
+
const flatFeatures = connectivities.flat(Infinity);
|
|
1951
|
+
arr.push(...flatFeatures);
|
|
1952
|
+
}
|
|
1953
|
+
return arr;
|
|
1954
|
+
}, []);
|
|
1955
|
+
const uniqueConnectivityFeatures = [...new Set(connectivityFeatures)];
|
|
1956
|
+
const combinedFeatures = [...featuresToHighlight, ...uniqueConnectivityFeatures];
|
|
1957
|
+
const featureIdsToHighlight = this.mapImp.modelFeatureIdList(combinedFeatures);
|
|
1935
1958
|
const allFeaturesToHighlight = [
|
|
1936
1959
|
...featureIdsToHighlight,
|
|
1937
1960
|
...geojsonHighlights
|
|
@@ -2051,9 +2074,6 @@ export default {
|
|
|
2051
2074
|
// the card should be opened without doing other functions
|
|
2052
2075
|
else if (this.viewingMode === 'Neuron Connection' && !connectivityExplorerClicked) {
|
|
2053
2076
|
const resources = data.map(tooltip => tooltip.resource[0]);
|
|
2054
|
-
// TODO: to remove pathsQueryAPI
|
|
2055
|
-
// the new query, queryPathsByRoute, is used in mapviewer for CQ
|
|
2056
|
-
// let pathsQueryAPI = this.retrieveConnectedPaths(resources); // TODO: to replace with queryAllConnectedPaths
|
|
2057
2077
|
|
|
2058
2078
|
// filter out paths
|
|
2059
2079
|
const featureId = resources.find(resource => !resource.startsWith('ilxtr:'));
|
|
@@ -2067,29 +2087,18 @@ export default {
|
|
|
2067
2087
|
const featureId = data[0].feature?.featureId;
|
|
2068
2088
|
const annotation = this.mapImp.annotations.get(featureId);
|
|
2069
2089
|
const anatomicalNodes = annotation?.['anatomical-nodes'];
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
// search by unique placement before competency API is ready for this
|
|
2083
|
-
// pathsQueryAPI = filterPathsByViaFromKnowledge(uniqueResource);
|
|
2084
|
-
// } else if (this.connectionType === 'Destination') {
|
|
2085
|
-
// Competency Query API
|
|
2086
|
-
// pathsQueryAPI = queryPathsByDestination(this.flatmapAPI, this.mapImp.knowledgeSource, resources);
|
|
2087
|
-
|
|
2088
|
-
// search by unique placement before competency API is ready for this
|
|
2089
|
-
// pathsQueryAPI = filterPathsByDestinationFromKnowledge(uniqueResource);
|
|
2090
|
-
// } else {
|
|
2091
|
-
// pathsQueryAPI = queryAllConnectedPaths(this.flatmapAPI, this.mapImp.knowledgeSource, resources);
|
|
2092
|
-
// }
|
|
2090
|
+
let anatomicalNode;
|
|
2091
|
+
let uniqueResource = transformResources;
|
|
2092
|
+
const models = annotation?.['models'];
|
|
2093
|
+
if (anatomicalNodes?.length) {
|
|
2094
|
+
anatomicalNode = anatomicalNodes[anatomicalNodes.length - 1];
|
|
2095
|
+
}
|
|
2096
|
+
if (anatomicalNode) {
|
|
2097
|
+
uniqueResource = JSON.parse(anatomicalNode);
|
|
2098
|
+
} else if (models) {
|
|
2099
|
+
uniqueResource = [models, []];
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2093
2102
|
const terms = uniqueResource.flat(Infinity);
|
|
2094
2103
|
const uniqueTerms = [...new Set(terms)];
|
|
2095
2104
|
const fetchResults = await fetchLabels(this.flatmapAPI, uniqueTerms);
|
|
@@ -2116,64 +2125,39 @@ export default {
|
|
|
2116
2125
|
term: this.connectionType
|
|
2117
2126
|
};
|
|
2118
2127
|
// check for existing item
|
|
2119
|
-
const isNewFilterItemExist = this.
|
|
2128
|
+
const isNewFilterItemExist = this.connectivityFilters.some((connectivityfilter) => (
|
|
2120
2129
|
connectivityfilter.facet === newConnectivityfilter.facet &&
|
|
2121
2130
|
connectivityfilter.facetPropPath === newConnectivityfilter.facetPropPath
|
|
2122
2131
|
));
|
|
2123
2132
|
|
|
2124
2133
|
if (!isNewFilterItemExist) {
|
|
2125
|
-
this.
|
|
2134
|
+
this.connectivityFilters.push(newConnectivityfilter);
|
|
2126
2135
|
}
|
|
2127
|
-
// TODO: to remove "neuron-connection-click"
|
|
2128
|
-
this.$emit('neuron-connection-feature-click', this.connectivityfilters);
|
|
2129
|
-
}
|
|
2130
2136
|
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
// })
|
|
2156
|
-
// }
|
|
2157
|
-
// }
|
|
2158
|
-
// this.tooltipEntry = await Promise.all(prom1)
|
|
2159
|
-
// // Emit placeholders first.
|
|
2160
|
-
// this.$emit('connectivity-info-open', this.tooltipEntry);
|
|
2161
|
-
|
|
2162
|
-
// /**
|
|
2163
|
-
// * This event is emitted to highlight the same paths on other display maps.
|
|
2164
|
-
// */
|
|
2165
|
-
// this.$emit('neuron-connection-click', paths);
|
|
2166
|
-
|
|
2167
|
-
// // loading data
|
|
2168
|
-
// for (let i = 0; i < filteredPathsWithData.length; i++) {
|
|
2169
|
-
// const pathData = filteredPathsWithData[i];
|
|
2170
|
-
// const tooltipEntryData = await this.getKnowledgeTooltip(pathData);
|
|
2171
|
-
// prom2.push(tooltipEntryData)
|
|
2172
|
-
// }
|
|
2173
|
-
// this.tooltipEntry = await Promise.all(prom2)
|
|
2174
|
-
// this.displayTooltip(filteredPaths)
|
|
2175
|
-
// }
|
|
2176
|
-
// })
|
|
2137
|
+
if (this.connectionType.toLowerCase() === 'all') {
|
|
2138
|
+
const searchTerms = uniqueTerms.join();
|
|
2139
|
+
this.$emit('neuron-connection-feature-click', {
|
|
2140
|
+
filters: [],
|
|
2141
|
+
search: searchTerms,
|
|
2142
|
+
});
|
|
2143
|
+
} else {
|
|
2144
|
+
this.$emit('neuron-connection-feature-click', {
|
|
2145
|
+
filters: this.connectivityFilters,
|
|
2146
|
+
search: '',
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
} else {
|
|
2150
|
+
// clicking on paths
|
|
2151
|
+
// do nothing for origin, destination, via
|
|
2152
|
+
const searchTerms = resources.join();
|
|
2153
|
+
|
|
2154
|
+
if (this.connectionType.toLowerCase() === 'all') {
|
|
2155
|
+
this.$emit('neuron-connection-feature-click', {
|
|
2156
|
+
filters: [],
|
|
2157
|
+
search: searchTerms,
|
|
2158
|
+
});
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2177
2161
|
} else {
|
|
2178
2162
|
// load and store knowledge
|
|
2179
2163
|
loadAndStoreKnowledge(this.mapImp, this.flatmapQueries);
|
|
@@ -2208,14 +2192,14 @@ export default {
|
|
|
2208
2192
|
*/
|
|
2209
2193
|
updateConnectivityFilters: function (payload) {
|
|
2210
2194
|
if (!payload.length) return;
|
|
2211
|
-
this.
|
|
2195
|
+
this.connectivityFilters = payload.filter((filterItem) => (
|
|
2212
2196
|
filterItem.facet.toLowerCase() !== 'show all'
|
|
2213
2197
|
));
|
|
2214
2198
|
},
|
|
2215
2199
|
resetConnectivityfilters: function (payload) {
|
|
2216
2200
|
if (payload.length) {
|
|
2217
2201
|
// remove not found items
|
|
2218
|
-
this.
|
|
2202
|
+
this.connectivityFilters = this.connectivityFilters.filter((connectivityfilter) =>
|
|
2219
2203
|
payload.some((notFoundItem) => (
|
|
2220
2204
|
notFoundItem.facetPropPath === connectivityfilter.facetPropPath &&
|
|
2221
2205
|
notFoundItem.facet !== connectivityfilter.facet
|
|
@@ -2223,7 +2207,7 @@ export default {
|
|
|
2223
2207
|
)
|
|
2224
2208
|
} else {
|
|
2225
2209
|
// full reset
|
|
2226
|
-
this.
|
|
2210
|
+
this.connectivityFilters = [];
|
|
2227
2211
|
}
|
|
2228
2212
|
},
|
|
2229
2213
|
getKnowledgeTooltip: async function (data) {
|
|
@@ -2929,7 +2913,7 @@ export default {
|
|
|
2929
2913
|
}
|
|
2930
2914
|
return filterSources
|
|
2931
2915
|
},
|
|
2932
|
-
getFilterOptions: async function (
|
|
2916
|
+
getFilterOptions: async function (providedKnowledge) {
|
|
2933
2917
|
let filterOptions = [];
|
|
2934
2918
|
if (this.mapImp) {
|
|
2935
2919
|
const filterRanges = this.mapImp.featureFilterRanges()
|
|
@@ -2985,16 +2969,39 @@ export default {
|
|
|
2985
2969
|
}
|
|
2986
2970
|
}
|
|
2987
2971
|
const connectionFilters = [];
|
|
2988
|
-
const
|
|
2989
|
-
const
|
|
2990
|
-
const
|
|
2991
|
-
|
|
2972
|
+
const baseFlatmapKnowledge = providedKnowledge || this.getFlatmapKnowledge();
|
|
2973
|
+
const mapKnowledge = this.mapImp.pathways.paths;
|
|
2974
|
+
const flatmapKnowledge = baseFlatmapKnowledge.reduce((arr, knowledge) => {
|
|
2975
|
+
const id = knowledge.id;
|
|
2976
|
+
if (id) {
|
|
2977
|
+
const mapKnowledgeObj = mapKnowledge[id];
|
|
2978
|
+
if (mapKnowledgeObj && mapKnowledgeObj.connectivity && mapKnowledgeObj['node-phenotypes']) {
|
|
2979
|
+
const mapConnectivity = mapKnowledgeObj.connectivity;
|
|
2980
|
+
const mapNodePhenotypes = mapKnowledgeObj['node-phenotypes'];
|
|
2981
|
+
// take only map connectivity
|
|
2982
|
+
knowledge.connectivity = [...mapConnectivity];
|
|
2983
|
+
for (let key in knowledge['node-phenotypes']) {
|
|
2984
|
+
if (mapNodePhenotypes[key]) {
|
|
2985
|
+
// take only map node-phenotypes
|
|
2986
|
+
knowledge['node-phenotypes'][key] = [...mapNodePhenotypes[key]];
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
// to avoid mutation
|
|
2990
|
+
arr.push(JSON.parse(JSON.stringify(knowledge)));
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
return arr;
|
|
2994
|
+
}, []);
|
|
2995
|
+
const knowledgeSource = this.mapImp.knowledgeSource;
|
|
2996
|
+
const originItems = await extractOriginItems(this.flatmapAPI, knowledgeSource, flatmapKnowledge);
|
|
2997
|
+
const viaItems = await extractViaItems(this.flatmapAPI, knowledgeSource, flatmapKnowledge);
|
|
2998
|
+
const destinationItems = await extractDestinationItems(this.flatmapAPI, knowledgeSource, flatmapKnowledge);
|
|
2992
2999
|
|
|
2993
3000
|
const transformItem = (facet, item) => {
|
|
2994
3001
|
const key = JSON.stringify(item.key);
|
|
2995
3002
|
return {
|
|
2996
3003
|
key: `flatmap.connectivity.source.${facet}.${key}`,
|
|
2997
|
-
label: item.label
|
|
3004
|
+
label: item.label || key
|
|
2998
3005
|
};
|
|
2999
3006
|
}
|
|
3000
3007
|
|
|
@@ -3008,14 +3015,30 @@ export default {
|
|
|
3008
3015
|
childrenList = destinationItems.map((item) => transformItem(facet, item));
|
|
3009
3016
|
}
|
|
3010
3017
|
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3018
|
+
// Those without label but key should be below
|
|
3019
|
+
childrenList = childrenList.sort((a, b) => {
|
|
3020
|
+
const isAlpha = (str) => /^[a-zA-Z]/.test(str);
|
|
3021
|
+
const aAlpha = isAlpha(a.label);
|
|
3022
|
+
const bAlpha = isAlpha(b.label);
|
|
3023
|
+
|
|
3024
|
+
if (aAlpha && !bAlpha) return -1;
|
|
3025
|
+
if (!aAlpha && bAlpha) return 1;
|
|
3026
|
+
|
|
3027
|
+
return a.label.localeCompare(b.label);
|
|
3028
|
+
});
|
|
3029
|
+
|
|
3030
|
+
if (childrenList.length) {
|
|
3031
|
+
connectionFilters.push({
|
|
3032
|
+
key: `flatmap.connectivity.source.${facet}`,
|
|
3033
|
+
label: facet,
|
|
3034
|
+
children: childrenList,
|
|
3035
|
+
})
|
|
3036
|
+
}
|
|
3016
3037
|
}
|
|
3017
3038
|
|
|
3018
|
-
|
|
3039
|
+
if (connectionFilters.length) {
|
|
3040
|
+
filterOptions.push(...connectionFilters)
|
|
3041
|
+
}
|
|
3019
3042
|
}
|
|
3020
3043
|
return filterOptions;
|
|
3021
3044
|
},
|
|
@@ -3041,6 +3064,7 @@ export default {
|
|
|
3041
3064
|
//Async, pass the state for checking
|
|
3042
3065
|
this.processTaxon(this.mapImp.taxonIdentifiers, state ? state['taxonSelection'] : undefined)
|
|
3043
3066
|
this.containsAlert = "alert" in this.mapImp.featureFilterRanges()
|
|
3067
|
+
this.flatmapLegends = this.mapImp.flatmapLegend
|
|
3044
3068
|
this.addResizeButtonToMinimap()
|
|
3045
3069
|
this.loading = false
|
|
3046
3070
|
this.computePathControlsMaximumHeight()
|
|
@@ -3518,7 +3542,8 @@ export default {
|
|
|
3518
3542
|
}),
|
|
3519
3543
|
searchTerm: "",
|
|
3520
3544
|
taxonLeaveDelay: undefined,
|
|
3521
|
-
|
|
3545
|
+
connectivityFilters: [],
|
|
3546
|
+
flatmapLegends: [],
|
|
3522
3547
|
}
|
|
3523
3548
|
},
|
|
3524
3549
|
computed: {
|
|
@@ -70,7 +70,6 @@
|
|
|
70
70
|
@connectivity-info-open="onConnectivityInfoOpen"
|
|
71
71
|
@connectivity-info-close="onConnectivityInfoClose"
|
|
72
72
|
@connectivity-error="onConnectivityError"
|
|
73
|
-
@neuron-connection-click="onNeuronConnectionClick"
|
|
74
73
|
@neuron-connection-feature-click="onNeuronConnectionFeatureClick"
|
|
75
74
|
@open-map="$emit('open-map', $event)"
|
|
76
75
|
@pathway-selection-changed="onSelectionsDataChanged"
|
|
@@ -101,7 +100,7 @@
|
|
|
101
100
|
import { markRaw } from 'vue'
|
|
102
101
|
import EventBus from './EventBus'
|
|
103
102
|
import FlatmapVuer from './FlatmapVuer.vue'
|
|
104
|
-
import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.
|
|
103
|
+
import * as flatmap from 'https://cdn.jsdelivr.net/npm/@abi-software/flatmap-viewer@4.2.10/+esm'
|
|
105
104
|
import {
|
|
106
105
|
ElCol as Col,
|
|
107
106
|
ElOption as Option,
|
|
@@ -307,9 +306,6 @@ export default {
|
|
|
307
306
|
onConnectivityError: function (errorInfo) {
|
|
308
307
|
this.$emit('connectivity-error', errorInfo);
|
|
309
308
|
},
|
|
310
|
-
onNeuronConnectionClick: function (payload) {
|
|
311
|
-
this.$emit('neuron-connection-click', payload);
|
|
312
|
-
},
|
|
313
309
|
onNeuronConnectionFeatureClick: function (payload) {
|
|
314
310
|
this.$emit('neuron-connection-feature-click', payload);
|
|
315
311
|
},
|
|
@@ -31,10 +31,9 @@
|
|
|
31
31
|
</el-col>
|
|
32
32
|
</el-row>
|
|
33
33
|
<el-checkbox-group
|
|
34
|
-
:class="{ 'show-as-legend': showAsLegend }"
|
|
34
|
+
:class="{ 'show-as-legend': showAsLegend, 'checkbox-group': !showAsLegend }"
|
|
35
35
|
v-model="checkedItems"
|
|
36
36
|
size="small"
|
|
37
|
-
class="checkbox-group"
|
|
38
37
|
@change="handleCheckedItemsChange"
|
|
39
38
|
>
|
|
40
39
|
<div class="checkbox-group-inner">
|
|
@@ -395,5 +394,8 @@ export default {
|
|
|
395
394
|
:deep(.el-checkbox__input) {
|
|
396
395
|
display: none;
|
|
397
396
|
}
|
|
397
|
+
.checkbox-group-inner {
|
|
398
|
+
padding: 5px;
|
|
399
|
+
}
|
|
398
400
|
}
|
|
399
401
|
</style>
|
|
@@ -1,106 +1,123 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
v-
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
</el-row>
|
|
2
|
+
<div class="legend-group">
|
|
3
|
+
<div
|
|
4
|
+
class="legend-container"
|
|
5
|
+
v-for="item in legends"
|
|
6
|
+
:key="item[identifierKey]"
|
|
7
|
+
:label="item[identifierKey]"
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
v-if="legendStyle(item) === 'yellow-star'"
|
|
11
|
+
:class="legendStyle(item)"
|
|
12
|
+
v-html="showStarInLegend ? yellowstar : ''"
|
|
13
|
+
></div>
|
|
14
|
+
<div v-else class="legend-item">
|
|
15
|
+
<div
|
|
16
|
+
:class="legendStyle(item)"
|
|
17
|
+
:style="{ 'background-color': item[colourKey] }"
|
|
18
|
+
></div>
|
|
19
|
+
<div class="label">{{ capitalise(item[identifierKey]) }}</div>
|
|
20
|
+
</div>
|
|
24
21
|
</div>
|
|
25
22
|
</div>
|
|
26
23
|
</template>
|
|
27
24
|
|
|
28
25
|
<script>
|
|
26
|
+
import yellowstar from "../../icons/yellowstar";
|
|
29
27
|
/* eslint-disable no-alert, no-console */
|
|
30
|
-
import Vue from 'vue'
|
|
31
|
-
import { ElCol as Col, ElRow as Row } from 'element-plus'
|
|
32
|
-
Vue.use(Col)
|
|
33
|
-
Vue.use(Row)
|
|
34
|
-
|
|
35
28
|
export default {
|
|
36
|
-
name:
|
|
29
|
+
name: "DynamicLegends",
|
|
37
30
|
props: {
|
|
38
31
|
identifierKey: {
|
|
39
32
|
type: String,
|
|
40
|
-
default:
|
|
33
|
+
default: "id",
|
|
41
34
|
},
|
|
42
35
|
colourKey: {
|
|
43
36
|
type: String,
|
|
44
|
-
default:
|
|
37
|
+
default: "colour",
|
|
38
|
+
},
|
|
39
|
+
styleKey: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "style",
|
|
45
42
|
},
|
|
46
43
|
title: {
|
|
47
44
|
type: String,
|
|
48
|
-
default:
|
|
45
|
+
default: "",
|
|
49
46
|
},
|
|
50
|
-
|
|
47
|
+
legends: {
|
|
51
48
|
type: Array,
|
|
52
49
|
default: function () {
|
|
53
|
-
return []
|
|
50
|
+
return [];
|
|
54
51
|
},
|
|
55
52
|
},
|
|
53
|
+
showStarInLegend: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
data: function () {
|
|
59
|
+
return {
|
|
60
|
+
yellowstar: yellowstar,
|
|
61
|
+
};
|
|
56
62
|
},
|
|
57
63
|
methods: {
|
|
58
64
|
capitalise: function (label) {
|
|
59
|
-
return label.charAt(0).toUpperCase() + label.slice(1).toLowerCase()
|
|
65
|
+
return label.charAt(0).toUpperCase() + label.slice(1).toLowerCase();
|
|
66
|
+
},
|
|
67
|
+
legendStyle: function (item) {
|
|
68
|
+
if (item[this.styleKey] === "star") {
|
|
69
|
+
if (item[this.identifierKey] === "Featured dataset marker") {
|
|
70
|
+
return "yellow-star";
|
|
71
|
+
} else if (item[this.identifierKey] === "Gaglionated nerve plexus") {
|
|
72
|
+
return "hexagon-star";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return item[this.styleKey];
|
|
60
76
|
},
|
|
61
77
|
},
|
|
62
|
-
}
|
|
78
|
+
};
|
|
63
79
|
</script>
|
|
64
80
|
|
|
65
81
|
<style lang="scss" scoped>
|
|
66
|
-
|
|
82
|
+
.legend-group {
|
|
83
|
+
padding: 6px 0;
|
|
84
|
+
}
|
|
67
85
|
|
|
68
|
-
.
|
|
69
|
-
|
|
70
|
-
width: 11px;
|
|
71
|
-
margin-right: 5px;
|
|
72
|
-
display: inline-block;
|
|
86
|
+
.legend-container {
|
|
87
|
+
width: max-content;
|
|
73
88
|
}
|
|
74
89
|
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
font-size: 14px;
|
|
80
|
-
font-weight: normal;
|
|
81
|
-
line-height: 20px;
|
|
82
|
-
margin-left: 8px;
|
|
90
|
+
.legend-item {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
margin: 8px 12.5px;
|
|
83
94
|
}
|
|
84
95
|
|
|
85
|
-
.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
line-height: 14px;
|
|
96
|
+
.circle {
|
|
97
|
+
height: 20px;
|
|
98
|
+
width: 20px;
|
|
99
|
+
background-color: #ffffff;
|
|
100
|
+
border-radius: 50%;
|
|
101
|
+
display: inline-block;
|
|
92
102
|
}
|
|
93
103
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
// hexagon
|
|
105
|
+
.hexagon-star {
|
|
106
|
+
width: 21px;
|
|
107
|
+
height: 25px;
|
|
108
|
+
background-color: #ffffff;
|
|
109
|
+
opacity: 0.64;
|
|
110
|
+
clip-path: path(
|
|
111
|
+
"M10.48 0.76 c-2.12 3.72 -6.12 6.04 -10.44 6.04 l-0.16 0.24 c2.04 3.6 2.04 8 0 11.6 l0.16 0.24 c4.28 0 8.32 2.32 10.44 6.04 c2.12 -3.72 6.12 -6.04 10.44 -6.04 c-2.12 -3.72 -2.12 -8.36 0 -12.16 C16.64 6.84 12.68 4.52 10.48 0.76z"
|
|
112
|
+
);
|
|
113
|
+
-webkit-clip-path: path(
|
|
114
|
+
"M10.48 0.76 c-2.12 3.72 -6.12 6.04 -10.44 6.04 l-0.16 0.24 c2.04 3.6 2.04 8 0 11.6 l0.16 0.24 c4.28 0 8.32 2.32 10.44 6.04 c2.12 -3.72 6.12 -6.04 10.44 -6.04 c-2.12 -3.72 -2.12 -8.36 0 -12.16 C16.64 6.84 12.68 4.52 10.48 0.76z"
|
|
115
|
+
);
|
|
97
116
|
}
|
|
98
117
|
|
|
99
|
-
.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
background: #ffffff;
|
|
104
|
-
padding: 18px;
|
|
118
|
+
.label {
|
|
119
|
+
margin-left: 14px;
|
|
120
|
+
font-size: 12px;
|
|
121
|
+
color: rgb(48, 49, 51);
|
|
105
122
|
}
|
|
106
123
|
</style>
|