@abi-software/map-side-bar 2.3.1 → 2.4.0-alpha-1

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 (43) hide show
  1. package/.eslintrc.js +12 -12
  2. package/.postcssrc.json +5 -5
  3. package/LICENSE +201 -201
  4. package/README.md +168 -168
  5. package/cypress.config.js +23 -23
  6. package/dist/data/pmr-sample.json +3181 -0
  7. package/dist/map-side-bar.js +15142 -9024
  8. package/dist/map-side-bar.umd.cjs +50 -103
  9. package/dist/style.css +1 -1
  10. package/package.json +77 -77
  11. package/public/data/pmr-sample.json +3181 -0
  12. package/reporter-config.json +9 -9
  13. package/src/App.vue +266 -265
  14. package/src/algolia/algolia.js +255 -242
  15. package/src/algolia/utils.js +100 -100
  16. package/src/assets/_variables.scss +43 -43
  17. package/src/assets/styles.scss +6 -6
  18. package/src/components/BadgesGroup.vue +124 -124
  19. package/src/components/ConnectivityInfo.vue +619 -619
  20. package/src/components/DatasetCard.vue +367 -357
  21. package/src/components/EventBus.js +3 -3
  22. package/src/components/ExternalResourceCard.vue +113 -113
  23. package/src/components/FlatmapDatasetCard.vue +171 -0
  24. package/src/components/ImageGallery.vue +542 -542
  25. package/src/components/PMRDatasetCard.vue +237 -0
  26. package/src/components/SearchFilters.vue +1023 -1006
  27. package/src/components/SearchHistory.vue +175 -175
  28. package/src/components/SideBar.vue +436 -436
  29. package/src/components/SidebarContent.vue +730 -603
  30. package/src/components/Tabs.vue +145 -145
  31. package/src/components/allPaths.js +5928 -0
  32. package/src/components/index.js +8 -8
  33. package/src/components/pmrTest.js +4 -0
  34. package/src/components/species-map.js +8 -8
  35. package/src/components.d.ts +2 -0
  36. package/src/exampleConnectivityInput.js +291 -291
  37. package/src/flatmapQueries/flatmapQueries.js +169 -0
  38. package/src/main.js +9 -9
  39. package/src/mixins/S3Bucket.vue +37 -37
  40. package/src/mixins/mixedPageCalculation.vue +78 -0
  41. package/static.json +6 -6
  42. package/vite.config.js +55 -55
  43. package/vuese-generator.js +65 -65
@@ -1,101 +1,101 @@
1
- /* eslint-disable no-alert, no-console */
2
-
3
- // Mapping between display categories and their Algolia index property path
4
- // Used for populating the Dataset Search Results facet menu dynamically
5
- export const facetPropPathMapping = [
6
- {
7
- label: 'Data Type',
8
- id: 'item.types',
9
- facetPropPath: 'item.types.name',
10
- facetSubpropPath: 'item.types.subcategory.name'
11
- },
12
- {
13
- label: 'Anatomical Structure',
14
- id: 'anatomy.organ.category',
15
- facetPropPath: 'anatomy.organ.category.name',
16
- facetSubpropPath: 'anatomy.organ.subcategory.name',
17
- facetFilterPath: 'anatomy.organ.name'
18
- },
19
- {
20
- label: 'Species',
21
- id: 'organisms.primary.species',
22
- facetPropPath: 'organisms.primary.species.name',
23
- facetSubpropPath: 'organisms.primary.species.subcategory.name'
24
- },
25
- {
26
- label: 'Experimental Approach',
27
- id: 'item.modalities',
28
- facetPropPath: 'item.modalities.keyword',
29
- facetSubpropPath: 'item.modalities.subcategory.name'
30
- },
31
- {
32
- label: 'Sex',
33
- id: 'attributes.subject.sex',
34
- facetPropPath: 'attributes.subject.sex.value',
35
- facetSubpropPath: 'attributes.subject.sex.subcategory.name'
36
- },
37
- {
38
- label: 'Age Categories',
39
- id: 'attributes.subject.ageCategory',
40
- facetPropPath: 'attributes.subject.ageCategory.value',
41
- facetSubpropPath: 'attributes.subject.ageCategory.subcategory.name'
42
- },
43
- ]
44
-
45
- // Same as above, but these show on the sidebar filters
46
- export const shownFilters = {
47
- 'anatomy.organ.name' : 'Anatomical Structure',
48
- 'organisms.primary.species.name' : 'Species',
49
- 'attributes.subject.sex.value' : 'Sex',
50
- 'attributes.subject.ageCategory.value' : 'Age Categories',
51
- 'item.types.name' : 'Data type',
52
- }
53
-
54
- /* Returns filter for searching algolia. All facets of the same category are joined with OR,
55
- * and each of those results is then joined with an AND.
56
- * i.e. (color:blue OR color:red) AND (shape:circle OR shape:red) */
57
- export function getFilters(selectedFacetArray=undefined) {
58
- // return all datasets if no filter
59
- if (selectedFacetArray === undefined) {
60
- return 'NOT item.published.status:embargo'
61
- }
62
-
63
- // Switch the 'term' attribute to 'label' if 'label' does not exist
64
- selectedFacetArray.forEach(f=>f.label=f.facet)
65
-
66
-
67
- let facets = removeShowAllFacets(selectedFacetArray)
68
-
69
- let filters = "NOT item.published.status:embargo";
70
- filters = `(${filters}) AND `;
71
- const facetPropPaths = facetPropPathMapping.map((f) => f.facetPropPath);
72
- facetPropPaths.map((facetPropPath) => {
73
- let facetsToBool = facets.filter(
74
- (facet) => facet.facetPropPath == facetPropPath
75
- );
76
- let orFilters = "";
77
- let andFilters = "";
78
- facetsToBool.map((facet) => {
79
- let facetPropPathToUse = facet.facetSubPropPath ? facet.facetSubPropPath : facetPropPath // Check if we have a subpath
80
- if (facet.AND){
81
- andFilters += `AND "${facetPropPathToUse}":"${facet.label}"`;
82
- } else {
83
- orFilters += `"${facetPropPathToUse}":"${facet.label}" OR `;
84
- }
85
- });
86
- if (orFilters == "" && andFilters =="") {
87
- return;
88
- }
89
- orFilters = `(${orFilters.substring(0, orFilters.lastIndexOf(" OR "))})` // remove last OR
90
-
91
- filters += `${orFilters + andFilters} AND `; // Put them together
92
- // (Note that we add an extra AND in case there are facets at a higher level)
93
-
94
- filters = filters.split('()AND ').join(''); // Handle case where there where no OR facets
95
- });
96
- return filters.substring(0, filters.lastIndexOf(" AND "));
97
- }
98
-
99
- function removeShowAllFacets(facetArray){
100
- return facetArray.filter( f => f.label !== 'Show all')
1
+ /* eslint-disable no-alert, no-console */
2
+
3
+ // Mapping between display categories and their Algolia index property path
4
+ // Used for populating the Dataset Search Results facet menu dynamically
5
+ export const facetPropPathMapping = [
6
+ {
7
+ label: 'Data Type',
8
+ id: 'item.types',
9
+ facetPropPath: 'item.types.name',
10
+ facetSubpropPath: 'item.types.subcategory.name'
11
+ },
12
+ {
13
+ label: 'Anatomical Structure',
14
+ id: 'anatomy.organ.category',
15
+ facetPropPath: 'anatomy.organ.category.name',
16
+ facetSubpropPath: 'anatomy.organ.subcategory.name',
17
+ facetFilterPath: 'anatomy.organ.name'
18
+ },
19
+ {
20
+ label: 'Species',
21
+ id: 'organisms.primary.species',
22
+ facetPropPath: 'organisms.primary.species.name',
23
+ facetSubpropPath: 'organisms.primary.species.subcategory.name'
24
+ },
25
+ {
26
+ label: 'Experimental Approach',
27
+ id: 'item.modalities',
28
+ facetPropPath: 'item.modalities.keyword',
29
+ facetSubpropPath: 'item.modalities.subcategory.name'
30
+ },
31
+ {
32
+ label: 'Sex',
33
+ id: 'attributes.subject.sex',
34
+ facetPropPath: 'attributes.subject.sex.value',
35
+ facetSubpropPath: 'attributes.subject.sex.subcategory.name'
36
+ },
37
+ {
38
+ label: 'Age Categories',
39
+ id: 'attributes.subject.ageCategory',
40
+ facetPropPath: 'attributes.subject.ageCategory.value',
41
+ facetSubpropPath: 'attributes.subject.ageCategory.subcategory.name'
42
+ },
43
+ ]
44
+
45
+ // Same as above, but these show on the sidebar filters
46
+ export const shownFilters = {
47
+ 'anatomy.organ.name' : 'Anatomical Structure',
48
+ 'organisms.primary.species.name' : 'Species',
49
+ 'attributes.subject.sex.value' : 'Sex',
50
+ 'attributes.subject.ageCategory.value' : 'Age Categories',
51
+ 'item.types.name' : 'Data type',
52
+ }
53
+
54
+ /* Returns filter for searching algolia. All facets of the same category are joined with OR,
55
+ * and each of those results is then joined with an AND.
56
+ * i.e. (color:blue OR color:red) AND (shape:circle OR shape:red) */
57
+ export function getFilters(selectedFacetArray=undefined) {
58
+ // return all datasets if no filter
59
+ if (selectedFacetArray === undefined) {
60
+ return 'NOT item.published.status:embargo'
61
+ }
62
+
63
+ // Switch the 'term' attribute to 'label' if 'label' does not exist
64
+ selectedFacetArray.forEach(f=>f.label=f.facet)
65
+
66
+
67
+ let facets = removeShowAllFacets(selectedFacetArray)
68
+
69
+ let filters = "NOT item.published.status:embargo";
70
+ filters = `(${filters}) AND `;
71
+ const facetPropPaths = facetPropPathMapping.map((f) => f.facetPropPath);
72
+ facetPropPaths.map((facetPropPath) => {
73
+ let facetsToBool = facets.filter(
74
+ (facet) => facet.facetPropPath == facetPropPath
75
+ );
76
+ let orFilters = "";
77
+ let andFilters = "";
78
+ facetsToBool.map((facet) => {
79
+ let facetPropPathToUse = facet.facetSubPropPath ? facet.facetSubPropPath : facetPropPath // Check if we have a subpath
80
+ if (facet.AND){
81
+ andFilters += `AND "${facetPropPathToUse}":"${facet.label}"`;
82
+ } else {
83
+ orFilters += `"${facetPropPathToUse}":"${facet.label}" OR `;
84
+ }
85
+ });
86
+ if (orFilters == "" && andFilters =="") {
87
+ return;
88
+ }
89
+ orFilters = `(${orFilters.substring(0, orFilters.lastIndexOf(" OR "))})` // remove last OR
90
+
91
+ filters += `${orFilters + andFilters} AND `; // Put them together
92
+ // (Note that we add an extra AND in case there are facets at a higher level)
93
+
94
+ filters = filters.split('()AND ').join(''); // Handle case where there where no OR facets
95
+ });
96
+ return filters.substring(0, filters.lastIndexOf(" AND "));
97
+ }
98
+
99
+ function removeShowAllFacets(facetArray){
100
+ return facetArray.filter( f => f.label !== 'Show all')
101
101
  }
@@ -1,43 +1,43 @@
1
- // Primary colors
2
- $purple: #8300BF;
3
- $darkBlue: #24245B;
4
- $grey: #303133;
5
-
6
- // Secondary colors
7
- $lightPurple: #BC00FC;
8
- $blue: #0026FF;
9
-
10
- // Status colors
11
- $success: #5e9f69;
12
- $warning: #FF8400;
13
- $danger: #b51d09;
14
-
15
- // Text colors
16
- $neutralGrey: #616161;
17
- $mediumGrey: #606266;
18
- $lightGrey: #909399;
19
-
20
- // Line colors
21
- $lineColor1: #DCDFE6;
22
- $lineColor2: #E4E7ED;
23
-
24
- // Background colors
25
- $background: #F5F7FA;
26
- $cochlear: #FFFFFF;
27
-
28
- //Search box colors
29
- $darkGrey: #606266;
30
-
31
- $app-primary-color: $purple;
32
- $app-secondary-color: $darkBlue;
33
- $text-color: $grey;
34
- $input-text: $grey;
35
-
36
- $system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
37
- $font-family: 'Asap', sans-serif;
38
-
39
- // Viewport Sizes
40
- $viewport-sm: 20rem;
41
- $viewport-md: 47rem;
42
- $viewport-lg: 64rem;
43
- $viewport-xlg: 120rem;
1
+ // Primary colors
2
+ $purple: #8300BF;
3
+ $darkBlue: #24245B;
4
+ $grey: #303133;
5
+
6
+ // Secondary colors
7
+ $lightPurple: #BC00FC;
8
+ $blue: #0026FF;
9
+
10
+ // Status colors
11
+ $success: #5e9f69;
12
+ $warning: #FF8400;
13
+ $danger: #b51d09;
14
+
15
+ // Text colors
16
+ $neutralGrey: #616161;
17
+ $mediumGrey: #606266;
18
+ $lightGrey: #909399;
19
+
20
+ // Line colors
21
+ $lineColor1: #DCDFE6;
22
+ $lineColor2: #E4E7ED;
23
+
24
+ // Background colors
25
+ $background: #F5F7FA;
26
+ $cochlear: #FFFFFF;
27
+
28
+ //Search box colors
29
+ $darkGrey: #606266;
30
+
31
+ $app-primary-color: $purple;
32
+ $app-secondary-color: $darkBlue;
33
+ $text-color: $grey;
34
+ $input-text: $grey;
35
+
36
+ $system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
37
+ $font-family: 'Asap', sans-serif;
38
+
39
+ // Viewport Sizes
40
+ $viewport-sm: 20rem;
41
+ $viewport-md: 47rem;
42
+ $viewport-lg: 64rem;
43
+ $viewport-xlg: 120rem;
@@ -1,6 +1,6 @@
1
- @import url('https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap');
2
-
3
- @import '_variables';
4
-
5
- /* icon font path, required */
6
- $--color-primary: $app-primary-color !default;
1
+ @import url('https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap');
2
+
3
+ @import '_variables';
4
+
5
+ /* icon font path, required */
6
+ $--color-primary: $app-primary-color !default;
@@ -1,124 +1,124 @@
1
- <template>
2
- <div v-if="categories['All'].size > 1" class="container" ref="container">
3
- <div>View data types:</div>
4
- <template v-for="(item, key) in categories">
5
- <el-button
6
- v-if="item.size > 0"
7
- :class="[{ active: key == active }, 'tag-button']"
8
- @click="categoryClicked(key)"
9
- size="small"
10
- :key="key"
11
- >{{ key + ' (' + item.size + ')' }}
12
- </el-button>
13
- </template>
14
- </div>
15
- </template>
16
-
17
- <script>
18
- /* eslint-disable no-alert, no-console */
19
- import { ElButton as Button } from 'element-plus'
20
-
21
- export default {
22
- name: 'BadgesGroup',
23
- components: { Button },
24
- props: {
25
- /**
26
- * Object containing information for
27
- * the required viewing.
28
- */
29
- additionalLinks: {
30
- type: Array,
31
- default: () => {
32
- return []
33
- },
34
- },
35
- datasetBiolucida: {
36
- type: Object,
37
- default: () => {
38
- return {}
39
- },
40
- },
41
- entry: {
42
- type: Object,
43
- default: () => {
44
- return {}
45
- },
46
- },
47
- },
48
- data: function () {
49
- return {
50
- //Always start with 1 image - the dataset thumbnail itself
51
- categories: { All: { size: 1 }, Dataset: { size: 1 } },
52
- active: 'All',
53
- }
54
- },
55
- methods: {
56
- addToCategories: function (array, name) {
57
- if (array && array.length > 0) {
58
- this.categories[name] = { size: array.length }
59
- this.categories['All'].size += array.length
60
- }
61
- },
62
- addSimulationsToCategories: function (array) {
63
- if (array && array.length > 0) {
64
- const size = 1
65
- this.categories['Simulations'] = { size }
66
- this.categories['All'].size += size
67
- }
68
- },
69
- categoryClicked: function (name) {
70
- this.active = name
71
- this.$emit('categoryChanged', name)
72
- },
73
- },
74
- watch: {
75
- datasetBiolucida: {
76
- deep: true,
77
- immediate: true,
78
- handler: function (biolucidaData) {
79
- if ('dataset_images' in biolucidaData) {
80
- this.addToCategories(biolucidaData['dataset_images'], 'Images')
81
- }
82
- },
83
- },
84
- entry: {
85
- deep: true,
86
- immediate: true,
87
- handler: function () {
88
- this.addToCategories(this.entry.scaffolds, 'Scaffolds')
89
- this.addToCategories(this.entry.segmentation, 'Segmentations')
90
- this.addToCategories(this.entry.plots, 'Plots')
91
- this.addSimulationsToCategories(this.entry.simulation)
92
- /** disable the following
93
- this.addToCategories(this.entry.images, 'Images');
94
- this.addToCategories(this.entry.videos, 'Videos');
95
- **/
96
- },
97
- },
98
- },
99
- }
100
- </script>
101
-
102
- <style lang="scss" scoped>
103
- .container {
104
- .tag-button.el-button {
105
- border-radius: 4px!important;
106
- font-size: 0.75rem!important;
107
- padding: 0.2rem 0.2rem!important;
108
- margin: 0.5rem 0 0 0!important;
109
- margin-right: 0.75rem !important;
110
- background: #f9f2fc!important;
111
- border: 1px solid $app-primary-color!important;
112
- color: $app-primary-color!important;
113
- &.active {
114
- background: $app-primary-color!important;
115
- border: 1px solid $app-primary-color!important;
116
- color: #fff!important;
117
- }
118
- }
119
-
120
- .tag-button + .tag-button {
121
- margin-left: 0!important;
122
- }
123
- }
124
- </style>
1
+ <template>
2
+ <div v-if="categories['All'].size > 1" class="container" ref="container">
3
+ <div>View data types:</div>
4
+ <template v-for="(item, key) in categories">
5
+ <el-button
6
+ v-if="item.size > 0"
7
+ :class="[{ active: key == active }, 'tag-button']"
8
+ @click="categoryClicked(key)"
9
+ size="small"
10
+ :key="key"
11
+ >{{ key + ' (' + item.size + ')' }}
12
+ </el-button>
13
+ </template>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ /* eslint-disable no-alert, no-console */
19
+ import { ElButton as Button } from 'element-plus'
20
+
21
+ export default {
22
+ name: 'BadgesGroup',
23
+ components: { Button },
24
+ props: {
25
+ /**
26
+ * Object containing information for
27
+ * the required viewing.
28
+ */
29
+ additionalLinks: {
30
+ type: Array,
31
+ default: () => {
32
+ return []
33
+ },
34
+ },
35
+ datasetBiolucida: {
36
+ type: Object,
37
+ default: () => {
38
+ return {}
39
+ },
40
+ },
41
+ entry: {
42
+ type: Object,
43
+ default: () => {
44
+ return {}
45
+ },
46
+ },
47
+ },
48
+ data: function () {
49
+ return {
50
+ //Always start with 1 image - the dataset thumbnail itself
51
+ categories: { All: { size: 1 }, Dataset: { size: 1 } },
52
+ active: 'All',
53
+ }
54
+ },
55
+ methods: {
56
+ addToCategories: function (array, name) {
57
+ if (array && array.length > 0) {
58
+ this.categories[name] = { size: array.length }
59
+ this.categories['All'].size += array.length
60
+ }
61
+ },
62
+ addSimulationsToCategories: function (array) {
63
+ if (array && array.length > 0) {
64
+ const size = 1
65
+ this.categories['Simulations'] = { size }
66
+ this.categories['All'].size += size
67
+ }
68
+ },
69
+ categoryClicked: function (name) {
70
+ this.active = name
71
+ this.$emit('categoryChanged', name)
72
+ },
73
+ },
74
+ watch: {
75
+ datasetBiolucida: {
76
+ deep: true,
77
+ immediate: true,
78
+ handler: function (biolucidaData) {
79
+ if ('dataset_images' in biolucidaData) {
80
+ this.addToCategories(biolucidaData['dataset_images'], 'Images')
81
+ }
82
+ },
83
+ },
84
+ entry: {
85
+ deep: true,
86
+ immediate: true,
87
+ handler: function () {
88
+ this.addToCategories(this.entry.scaffolds, 'Scaffolds')
89
+ this.addToCategories(this.entry.segmentation, 'Segmentations')
90
+ this.addToCategories(this.entry.plots, 'Plots')
91
+ this.addSimulationsToCategories(this.entry.simulation)
92
+ /** disable the following
93
+ this.addToCategories(this.entry.images, 'Images');
94
+ this.addToCategories(this.entry.videos, 'Videos');
95
+ **/
96
+ },
97
+ },
98
+ },
99
+ }
100
+ </script>
101
+
102
+ <style lang="scss" scoped>
103
+ .container {
104
+ .tag-button.el-button {
105
+ border-radius: 4px!important;
106
+ font-size: 0.75rem!important;
107
+ padding: 0.2rem 0.2rem!important;
108
+ margin: 0.5rem 0 0 0!important;
109
+ margin-right: 0.75rem !important;
110
+ background: #f9f2fc!important;
111
+ border: 1px solid $app-primary-color!important;
112
+ color: $app-primary-color!important;
113
+ &.active {
114
+ background: $app-primary-color!important;
115
+ border: 1px solid $app-primary-color!important;
116
+ color: #fff!important;
117
+ }
118
+ }
119
+
120
+ .tag-button + .tag-button {
121
+ margin-left: 0!important;
122
+ }
123
+ }
124
+ </style>