@abi-software/gallery 0.1.5 → 0.2.1-beta-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.
- package/.browserslistrc +3 -3
- package/.eslintrc.js +31 -31
- package/.prettierrc +6 -6
- package/LICENSE +201 -201
- package/Meeting-plan.txt +4 -0
- package/README.md +35 -35
- package/babel.config.js +3 -3
- package/dist/gallery.common.js +318 -1880
- package/dist/gallery.common.js.map +1 -1
- package/dist/gallery.umd.js +322 -1884
- package/dist/gallery.umd.js.map +1 -1
- package/dist/gallery.umd.min.js +1 -1
- package/dist/gallery.umd.min.js.map +1 -1
- package/dist/img/logo.82b9c7a5.png +0 -0
- package/jest.config.js +3 -3
- package/package.json +41 -40
- package/public/index.html +17 -17
- package/src/App.vue +34 -28
- package/src/components/Card.vue +128 -137
- package/src/components/Gallery.vue +208 -218
- package/src/components/IndexIndicator.vue +45 -45
- package/src/delete.json +39 -0
- package/src/index.js +2 -2
- package/src/main.js +8 -2
- package/tests/unit/example.spec.js +12 -12
- package/vue.config.js +4 -4
- package/.eslintignore +0 -1
|
@@ -1,218 +1,208 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="myButton" class="gallery">
|
|
3
|
-
<div class="gallery-strip">
|
|
4
|
-
<a href="#" :class="['oval', 'prev', { disabled: !isPrevPossible }]" @click.prevent="goPrev">
|
|
5
|
-
<span class="progress-button">‹</span>
|
|
6
|
-
</a>
|
|
7
|
-
<div class="filler" />
|
|
8
|
-
<div class="card-line">
|
|
9
|
-
<span
|
|
10
|
-
v-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
let
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
.
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
a.prev:not(.underline),
|
|
210
|
-
a.next:not(.underline) {
|
|
211
|
-
text-decoration: none;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.disabled {
|
|
215
|
-
opacity: 0.5;
|
|
216
|
-
pointer-events: none;
|
|
217
|
-
}
|
|
218
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="myButton" class="gallery">
|
|
3
|
+
<div class="gallery-strip">
|
|
4
|
+
<a href="#" :class="['oval', 'prev', { disabled: !isPrevPossible }]" @click.prevent="goPrev">
|
|
5
|
+
<span class="progress-button">‹</span>
|
|
6
|
+
</a>
|
|
7
|
+
<div class="filler" />
|
|
8
|
+
<div class="card-line">
|
|
9
|
+
<span v-for="(item, index) in windowedItems" :key="'card_' + index" :class="['key-image-span', { active: isActive(index) }]">
|
|
10
|
+
<card v-if="item" :entry="item" :width="cardWidth" :height="cardHeight" :show-card-details="showCardDetails" />
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="filler" />
|
|
14
|
+
<a href="#" :class="['oval', 'next', { disabled: !isNextPossible }]" @click.prevent="goNext">
|
|
15
|
+
<span class="progress-button">›</span>
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
<div v-if="canShowIndicatorBar" class="bottom-spacer" />
|
|
19
|
+
<index-indicator v-if="canShowIndicatorBar" :count="itemCount" :current="currentIndex" @clicked="indicatorClicked" />
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
import IndexIndicator from './IndexIndicator'
|
|
25
|
+
import Card from './Card'
|
|
26
|
+
|
|
27
|
+
function convertRemToPixels(rem) {
|
|
28
|
+
if (typeof window !== 'undefined') {
|
|
29
|
+
return rem * parseFloat(window.getComputedStyle(document.documentElement).fontSize)
|
|
30
|
+
}
|
|
31
|
+
return rem * 16
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'Gallery',
|
|
36
|
+
components: { IndexIndicator, Card },
|
|
37
|
+
props: {
|
|
38
|
+
items: {
|
|
39
|
+
type: Array,
|
|
40
|
+
default: () => {
|
|
41
|
+
return []
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
maxWidth: {
|
|
45
|
+
type: Number,
|
|
46
|
+
required: true,
|
|
47
|
+
},
|
|
48
|
+
cardWidth: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 13.8,
|
|
51
|
+
},
|
|
52
|
+
showIndicatorBar: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true,
|
|
55
|
+
},
|
|
56
|
+
highlightActive: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: true,
|
|
59
|
+
},
|
|
60
|
+
showCardDetails: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: true,
|
|
63
|
+
},
|
|
64
|
+
metaData: {
|
|
65
|
+
type: Object,
|
|
66
|
+
default: () => {
|
|
67
|
+
return {
|
|
68
|
+
datasetVersion: -1,
|
|
69
|
+
datasetId: -1,
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
description: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
data() {
|
|
79
|
+
return {
|
|
80
|
+
count: 0,
|
|
81
|
+
currentIndex: 0,
|
|
82
|
+
controlHeight: 2,
|
|
83
|
+
controlWidth: 2,
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
computed: {
|
|
87
|
+
itemCount() {
|
|
88
|
+
return this.items.length
|
|
89
|
+
},
|
|
90
|
+
isPrevPossible() {
|
|
91
|
+
return this.currentIndex > 0
|
|
92
|
+
},
|
|
93
|
+
isNextPossible() {
|
|
94
|
+
return this.currentIndex < this.itemCount - 1
|
|
95
|
+
},
|
|
96
|
+
cardHeight() {
|
|
97
|
+
return 0.78 * this.cardWidth
|
|
98
|
+
},
|
|
99
|
+
cardLineWidth() {
|
|
100
|
+
const cardSpacing = 0.25
|
|
101
|
+
return this.itemCount * (this.cardWidth + cardSpacing) - cardSpacing
|
|
102
|
+
},
|
|
103
|
+
numberOfItemsVisible() {
|
|
104
|
+
// The maximum width we are allowed minus two buttons for next and previous
|
|
105
|
+
// divided by the width of a card.
|
|
106
|
+
// const n = this.itemCount - 1
|
|
107
|
+
const cardSpacingPx = convertRemToPixels(0.5)
|
|
108
|
+
const buttonPx = convertRemToPixels(2)
|
|
109
|
+
const cardWidthPx = convertRemToPixels(this.cardWidth)
|
|
110
|
+
const cardItems = (this.maxWidth - 2 * buttonPx - 2 * cardSpacingPx) / (1.1 * cardWidthPx)
|
|
111
|
+
return Math.floor(cardItems)
|
|
112
|
+
},
|
|
113
|
+
canShowIndicatorBar() {
|
|
114
|
+
const indicatorWidth = convertRemToPixels(1)
|
|
115
|
+
const indicatorAllowance = this.maxWidth / (indicatorWidth * this.itemCount)
|
|
116
|
+
return this.showIndicatorBar && indicatorAllowance > 0.1
|
|
117
|
+
},
|
|
118
|
+
valueAdjustment() {
|
|
119
|
+
const halfWindow = Math.floor(this.numberOfItemsVisible / 2)
|
|
120
|
+
let valueAdjust = this.currentIndex - halfWindow
|
|
121
|
+
if (valueAdjust < 0) {
|
|
122
|
+
valueAdjust = 0
|
|
123
|
+
} else if (valueAdjust + this.numberOfItemsVisible > this.itemCount) {
|
|
124
|
+
valueAdjust = this.itemCount - this.numberOfItemsVisible
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return valueAdjust
|
|
128
|
+
},
|
|
129
|
+
windowedItems() {
|
|
130
|
+
let myArray = []
|
|
131
|
+
for (let i = 0; i < this.numberOfItemsVisible; i++) {
|
|
132
|
+
myArray.push(this.items[i + this.valueAdjustment])
|
|
133
|
+
}
|
|
134
|
+
return myArray
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
isActive(index) {
|
|
139
|
+
return this.currentIndex - this.valueAdjustment === index && this.highlightActive
|
|
140
|
+
},
|
|
141
|
+
goNext() {
|
|
142
|
+
this.currentIndex += 1
|
|
143
|
+
},
|
|
144
|
+
goPrev() {
|
|
145
|
+
this.currentIndex -= 1
|
|
146
|
+
},
|
|
147
|
+
indicatorClicked(index) {
|
|
148
|
+
if (this.currentIndex !== index) {
|
|
149
|
+
this.currentIndex = index
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<style scoped>
|
|
157
|
+
.oval {
|
|
158
|
+
width: 2rem;
|
|
159
|
+
height: 2rem;
|
|
160
|
+
line-height: 2rem;
|
|
161
|
+
box-shadow: 0 0.125rem 0.25rem 0 rgba(0, 0, 0, 0.25);
|
|
162
|
+
border: solid 1px var(--pale-grey);
|
|
163
|
+
background-color: #ffffff;
|
|
164
|
+
border-radius: 1rem;
|
|
165
|
+
display: flex;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
user-select: none;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.gallery-strip,
|
|
171
|
+
.card-line {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-wrap: nowrap;
|
|
174
|
+
justify-content: space-around;
|
|
175
|
+
align-items: center;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.card-line {
|
|
179
|
+
flex-grow: 2;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.progress-button {
|
|
183
|
+
font-size: 1.5rem;
|
|
184
|
+
font-weight: bold;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.bottom-spacer {
|
|
188
|
+
min-height: 4rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.filler {
|
|
192
|
+
flex-grow: 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.key-image-span.active {
|
|
196
|
+
transform: scale(1.1);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
a.prev:not(.underline),
|
|
200
|
+
a.next:not(.underline) {
|
|
201
|
+
text-decoration: none;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.disabled {
|
|
205
|
+
opacity: 0.5;
|
|
206
|
+
pointer-events: none;
|
|
207
|
+
}
|
|
208
|
+
</style>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="indicator-container">
|
|
3
|
-
<div
|
|
4
|
-
v-for="(number, index) in count"
|
|
5
|
-
:key="'indicator_' + number"
|
|
6
|
-
:class="['indicator', { active: current === index }]"
|
|
7
|
-
@click="$emit('clicked', index)"
|
|
8
|
-
/>
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
export default {
|
|
14
|
-
name: 'IndexIndicator',
|
|
15
|
-
props: {
|
|
16
|
-
count: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 0,
|
|
19
|
-
},
|
|
20
|
-
current: {
|
|
21
|
-
type: Number,
|
|
22
|
-
default: 0,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style scoped>
|
|
29
|
-
.indicator-container {
|
|
30
|
-
display: flex;
|
|
31
|
-
justify-content: center;
|
|
32
|
-
}
|
|
33
|
-
.indicator {
|
|
34
|
-
width: 1rem;
|
|
35
|
-
height: 1rem;
|
|
36
|
-
border-radius: 50%;
|
|
37
|
-
background-color: #e4e7ed;
|
|
38
|
-
margin-left: 0.25rem;
|
|
39
|
-
margin-right: 0.25rem;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.indicator.active {
|
|
43
|
-
background-color: #8300bf;
|
|
44
|
-
}
|
|
45
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="indicator-container">
|
|
3
|
+
<div
|
|
4
|
+
v-for="(number, index) in count"
|
|
5
|
+
:key="'indicator_' + number"
|
|
6
|
+
:class="['indicator', { active: current === index }]"
|
|
7
|
+
@click="$emit('clicked', index)"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'IndexIndicator',
|
|
15
|
+
props: {
|
|
16
|
+
count: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0,
|
|
19
|
+
},
|
|
20
|
+
current: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 0,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style scoped>
|
|
29
|
+
.indicator-container {
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
.indicator {
|
|
34
|
+
width: 1rem;
|
|
35
|
+
height: 1rem;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
background-color: #e4e7ed;
|
|
38
|
+
margin-left: 0.25rem;
|
|
39
|
+
margin-right: 0.25rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.indicator.active {
|
|
43
|
+
background-color: #8300bf;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
package/src/delete.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"size": 20,
|
|
3
|
+
"from": 0,
|
|
4
|
+
"query": {
|
|
5
|
+
"bool": {
|
|
6
|
+
"must": [ {
|
|
7
|
+
"match_phrase": {
|
|
8
|
+
"existing_ids.curie": {
|
|
9
|
+
"query": "UBERON:0000948"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
} ]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
"size": 20,
|
|
19
|
+
"from": 0,
|
|
20
|
+
"query": {
|
|
21
|
+
"bool": {
|
|
22
|
+
"must": [ {
|
|
23
|
+
"match_phrase": {
|
|
24
|
+
"label.aggregate": {
|
|
25
|
+
"query": "heart"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"term": {
|
|
31
|
+
"type": {
|
|
32
|
+
"value": "term"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} ]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"_source": ["label","existing_ids.curie"]
|
|
39
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import Gallery from './components/Gallery.vue'
|
|
2
|
-
export default Gallery
|
|
1
|
+
import Gallery from './components/Gallery.vue'
|
|
2
|
+
export default Gallery
|
package/src/main.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils'
|
|
2
|
-
import HelloWorld from '@/components/HelloWorld.vue'
|
|
3
|
-
|
|
4
|
-
describe('HelloWorld.vue', () => {
|
|
5
|
-
it('renders props.msg when passed', () => {
|
|
6
|
-
const msg = 'new message'
|
|
7
|
-
const wrapper = shallowMount(HelloWorld, {
|
|
8
|
-
propsData: { msg },
|
|
9
|
-
})
|
|
10
|
-
expect(wrapper.text()).toMatch(msg)
|
|
11
|
-
})
|
|
12
|
-
})
|
|
1
|
+
import { shallowMount } from '@vue/test-utils'
|
|
2
|
+
import HelloWorld from '@/components/HelloWorld.vue'
|
|
3
|
+
|
|
4
|
+
describe('HelloWorld.vue', () => {
|
|
5
|
+
it('renders props.msg when passed', () => {
|
|
6
|
+
const msg = 'new message'
|
|
7
|
+
const wrapper = shallowMount(HelloWorld, {
|
|
8
|
+
propsData: { msg },
|
|
9
|
+
})
|
|
10
|
+
expect(wrapper.text()).toMatch(msg)
|
|
11
|
+
})
|
|
12
|
+
})
|
package/vue.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// vue.config.js
|
|
2
|
-
module.exports = {
|
|
3
|
-
css: { extract: false },
|
|
4
|
-
}
|
|
1
|
+
// vue.config.js
|
|
2
|
+
module.exports = {
|
|
3
|
+
css: { extract: false },
|
|
4
|
+
}
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
svg-sprite.common.js
|