@abi-software/gallery 0.3.0 → 0.3.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/dist/gallery.common.js +107 -60
- package/dist/gallery.common.js.map +1 -1
- package/dist/gallery.css +1 -1
- package/dist/gallery.umd.js +107 -60
- 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/package.json +1 -1
- package/src/components/Card.vue +49 -2
- package/src/components/Gallery.vue +2 -1
package/package.json
CHANGED
package/src/components/Card.vue
CHANGED
|
@@ -24,10 +24,19 @@
|
|
|
24
24
|
<p v-if="!data.hideType">
|
|
25
25
|
<b>{{ data.type }}</b>
|
|
26
26
|
</p>
|
|
27
|
-
<el-popover
|
|
28
|
-
|
|
27
|
+
<el-popover
|
|
28
|
+
ref="galleryPopover"
|
|
29
|
+
:disabled="disableTooltip"
|
|
30
|
+
:content="data.title"
|
|
31
|
+
placement="top"
|
|
32
|
+
trigger="hover"
|
|
33
|
+
popper-class="gallery-popper"
|
|
34
|
+
/>
|
|
35
|
+
<!--use v-show here to make sure el popover always have a starting location -->
|
|
36
|
+
<p v-show="!data.hideTitle" ref="titleText" class="title" v-popover:galleryPopover>
|
|
29
37
|
{{ data.title }}
|
|
30
38
|
</p>
|
|
39
|
+
<p v-show="data.hideTitle" class="title text-placeholder" />
|
|
31
40
|
<el-button class="button" @click.prevent="cardClicked"> View {{ data.type }}</el-button>
|
|
32
41
|
</div>
|
|
33
42
|
</div>
|
|
@@ -102,6 +111,8 @@ export default {
|
|
|
102
111
|
triangleSize: 4,
|
|
103
112
|
thumbnail: undefined,
|
|
104
113
|
useDefaultImg: false,
|
|
114
|
+
disableTooltip: false,
|
|
115
|
+
tooltipCalculated: false,
|
|
105
116
|
}
|
|
106
117
|
},
|
|
107
118
|
computed: {
|
|
@@ -131,6 +142,8 @@ export default {
|
|
|
131
142
|
handler: function () {
|
|
132
143
|
this.thumbnail = undefined
|
|
133
144
|
this.useDefaultImg = false
|
|
145
|
+
this.tooltipCalculated = false
|
|
146
|
+
this.disableTooltip = false
|
|
134
147
|
if (this.data.thumbnail) {
|
|
135
148
|
if (isValidHttpUrl(this.data.thumbnail) && this.data.mimetype) {
|
|
136
149
|
this.downloadThumbnail(this.data.thumbnail, { fetchAttempts: 0 })
|
|
@@ -140,6 +153,10 @@ export default {
|
|
|
140
153
|
} else {
|
|
141
154
|
this.useDefaultImg = true
|
|
142
155
|
}
|
|
156
|
+
//Dynamically check title length to determine if popover should be shown
|
|
157
|
+
this.$nextTick(() => {
|
|
158
|
+
this.calculateShowTooltip()
|
|
159
|
+
})
|
|
143
160
|
},
|
|
144
161
|
},
|
|
145
162
|
},
|
|
@@ -188,6 +205,32 @@ export default {
|
|
|
188
205
|
}
|
|
189
206
|
)
|
|
190
207
|
},
|
|
208
|
+
//dynamically calculate if tooltip is required
|
|
209
|
+
calculateShowTooltip: function () {
|
|
210
|
+
if (this.data.hideTitle) {
|
|
211
|
+
this.disableTooltip = true
|
|
212
|
+
this.tooltipCalculated = true
|
|
213
|
+
} else {
|
|
214
|
+
const ele = this.$refs.titleText
|
|
215
|
+
//Check if title text is rendered yet
|
|
216
|
+
if (ele && ele.offsetParent) {
|
|
217
|
+
this.tooltipCalculated = true
|
|
218
|
+
if (ele.offsetWidth >= ele.scrollWidth) this.disableTooltip = true
|
|
219
|
+
else this.disableTooltip = false
|
|
220
|
+
} else {
|
|
221
|
+
//text not rendered yet
|
|
222
|
+
if (this.data.title.length > 20) this.disableTooltip = false
|
|
223
|
+
else this.disableTooltip = true
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
updated: function () {
|
|
229
|
+
if (!this.tooltipCalculated) {
|
|
230
|
+
this.$nextTick(() => {
|
|
231
|
+
this.calculateShowTooltip()
|
|
232
|
+
})
|
|
233
|
+
}
|
|
191
234
|
},
|
|
192
235
|
}
|
|
193
236
|
</script>
|
|
@@ -224,6 +267,10 @@ export default {
|
|
|
224
267
|
text-align: left;
|
|
225
268
|
}
|
|
226
269
|
|
|
270
|
+
.text-placeholder {
|
|
271
|
+
height: 1rem;
|
|
272
|
+
}
|
|
273
|
+
|
|
227
274
|
.title {
|
|
228
275
|
overflow-x: hidden;
|
|
229
276
|
text-overflow: ellipsis;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<div class="card-line">
|
|
10
10
|
<span v-for="(item, index) in windowedItems" :key="'card_' + index" :class="['key-image-span', { active: isActive(index) }]">
|
|
11
11
|
<card
|
|
12
|
+
v-if="item"
|
|
12
13
|
:data="item"
|
|
13
14
|
:body-style="bodyStyle"
|
|
14
15
|
:image-container-style="imageContainerStyle"
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
</a>
|
|
28
29
|
<div v-else style="width: 2rem" />
|
|
29
30
|
</div>
|
|
30
|
-
<div
|
|
31
|
+
<div :style="bottomSpacer" />
|
|
31
32
|
<index-indicator v-if="canShowIndicatorBar" :count="itemCount" :current="currentIndex" @clicked="indicatorClicked" />
|
|
32
33
|
</div>
|
|
33
34
|
</template>
|