@opentinyvue/vue-image-viewer 2.21.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.
- package/LICENSE +22 -0
- package/index.d.ts +13 -0
- package/lib/index.js +148 -0
- package/lib/mobile-first.js +671 -0
- package/lib/mobile.js +348 -0
- package/lib/pc.js +186 -0
- package/package.json +26 -0
- package/src/index.d.ts +2 -0
- package/src/mobile-first.vue.d.ts +2 -0
- package/src/mobile.vue.d.ts +2 -0
- package/src/mobileTouch.d.ts +2 -0
- package/src/pc.vue.d.ts +2 -0
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/image-viewer/vue';
|
|
2
|
+
import { directive, defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import { isObject } from '@opentinyvue/vue-renderless/common/type';
|
|
4
|
+
import Dropdown from '@opentinyvue/vue-dropdown';
|
|
5
|
+
import DropdownMenu from '@opentinyvue/vue-dropdown-menu';
|
|
6
|
+
import DropdownItem from '@opentinyvue/vue-dropdown-item';
|
|
7
|
+
import ActionSheet from '@opentinyvue/vue-action-sheet';
|
|
8
|
+
import { iconClose, iconChevronLeft, iconChevronRight, iconZoomOut, iconZoomIn, iconFullscreen, iconMinscreen, iconRepeat, iconRefres, iconDel, iconDownload, iconArrowLeft, iconArrowRight, iconEditorMenuRight, iconPicture } from '@opentinyvue/vue-icon';
|
|
9
|
+
|
|
10
|
+
var TinyTouch = /* @__PURE__ */ function() {
|
|
11
|
+
function TinyTouch2(element, tinyBinding, type) {
|
|
12
|
+
var that = this;
|
|
13
|
+
that.element = element;
|
|
14
|
+
that.tinyBinding = tinyBinding;
|
|
15
|
+
that.touchType = type;
|
|
16
|
+
that.tinyVueTouches = {
|
|
17
|
+
x: 0,
|
|
18
|
+
y: 0
|
|
19
|
+
};
|
|
20
|
+
that.tinyVueMoves = true;
|
|
21
|
+
that.tinyVueLeave = true;
|
|
22
|
+
that.tinyLongTouch = true;
|
|
23
|
+
that.tinyVueCallBack = isObject(tinyBinding.value) ? tinyBinding.value.fn : tinyBinding.value;
|
|
24
|
+
that.element.addEventListener("touchstart", function(e) {
|
|
25
|
+
that.start(e);
|
|
26
|
+
});
|
|
27
|
+
that.element.addEventListener("touchend", function(e) {
|
|
28
|
+
that.end(e);
|
|
29
|
+
});
|
|
30
|
+
that.element.addEventListener("touchmove", function(e) {
|
|
31
|
+
that.move(e);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
var _proto = TinyTouch2.prototype;
|
|
35
|
+
_proto.start = function start(e) {
|
|
36
|
+
var _this = this;
|
|
37
|
+
if (e.touches >= 2) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.tinyVueMoves = true;
|
|
41
|
+
this.tinyVueLeave = true;
|
|
42
|
+
this.tinyLongTouch = true;
|
|
43
|
+
this.tinyVueTouches = {
|
|
44
|
+
x: e.changedTouches[0].pageX,
|
|
45
|
+
y: e.changedTouches[0].pageY
|
|
46
|
+
};
|
|
47
|
+
this.time = setTimeout(function() {
|
|
48
|
+
if (_this.tinyVueLeave && _this.tinyVueMoves) {
|
|
49
|
+
_this.touchType == "longtap" && _this.tinyVueCallBack(_this.tinyBinding.value, e);
|
|
50
|
+
_this.tinyLongTouch = false;
|
|
51
|
+
}
|
|
52
|
+
}, 1e3);
|
|
53
|
+
};
|
|
54
|
+
_proto.end = function end(e) {
|
|
55
|
+
if (e.touches >= 2) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
var disX = e.changedTouches[0].pageX - this.tinyVueTouches.x;
|
|
59
|
+
var disY = e.changedTouches[0].pageY - this.tinyVueTouches.y;
|
|
60
|
+
clearTimeout(this.time);
|
|
61
|
+
if (Math.abs(disX) > 10 || Math.abs(disY) > 100) {
|
|
62
|
+
this.touchType == "swipe" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
63
|
+
if (Math.abs(disX) > Math.abs(disY)) {
|
|
64
|
+
if (disX > 10) {
|
|
65
|
+
this.touchType == "swiperight" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
66
|
+
}
|
|
67
|
+
if (disX < -10) {
|
|
68
|
+
this.touchType == "swipeleft" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
if (disY > 10) {
|
|
72
|
+
this.touchType == "swipedown" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
73
|
+
}
|
|
74
|
+
if (disY < -10) {
|
|
75
|
+
this.touchType == "swipeup" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
if (this.tinyLongTouch && this.tinyVueMoves) {
|
|
80
|
+
this.touchType == "tap" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
81
|
+
this.tinyVueLeave = false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
_proto.move = function move() {
|
|
86
|
+
this.tinyVueMoves = false;
|
|
87
|
+
};
|
|
88
|
+
return TinyTouch2;
|
|
89
|
+
}();
|
|
90
|
+
var mapDirective = function mapDirective2() {
|
|
91
|
+
var deactives = {};
|
|
92
|
+
var names = ["tap", "swipe", "swipeleft", "swiperight", "swipedown", "swipeup", "longtap"];
|
|
93
|
+
names.forEach(function(name) {
|
|
94
|
+
deactives[name] = directive({
|
|
95
|
+
vTouch: {
|
|
96
|
+
bind: function bind(el, tinyBinding) {
|
|
97
|
+
new TinyTouch(el, tinyBinding, name);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}).vTouch;
|
|
101
|
+
});
|
|
102
|
+
return deactives;
|
|
103
|
+
};
|
|
104
|
+
var touchDeactives = mapDirective();
|
|
105
|
+
|
|
106
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
107
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
108
|
+
if (render) {
|
|
109
|
+
options.render = render;
|
|
110
|
+
options.staticRenderFns = staticRenderFns;
|
|
111
|
+
options._compiled = true;
|
|
112
|
+
}
|
|
113
|
+
var hook;
|
|
114
|
+
if (injectStyles) {
|
|
115
|
+
hook = injectStyles;
|
|
116
|
+
}
|
|
117
|
+
if (hook) {
|
|
118
|
+
if (options.functional) {
|
|
119
|
+
options._injectStyles = hook;
|
|
120
|
+
var originalRender = options.render;
|
|
121
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
122
|
+
hook.call(context);
|
|
123
|
+
return originalRender(h, context);
|
|
124
|
+
};
|
|
125
|
+
} else {
|
|
126
|
+
var existing = options.beforeCreate;
|
|
127
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
exports: scriptExports,
|
|
132
|
+
options
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function _extends() {
|
|
137
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
138
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
139
|
+
var t = arguments[e];
|
|
140
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
141
|
+
}
|
|
142
|
+
return n;
|
|
143
|
+
}, _extends.apply(null, arguments);
|
|
144
|
+
}
|
|
145
|
+
var __vue2_script = defineComponent({
|
|
146
|
+
emits: ["close", "update:preview-visible", "delete", "change", "newImageList"],
|
|
147
|
+
props: [].concat(props, ["urlList", "zIndex", "onSwitch", "onClose", "showIndex", "isThumbnail", "isMenuView", "modalView", "modalHeight", "bgColor", "keepStyle"]),
|
|
148
|
+
components: {
|
|
149
|
+
TinyActionSheet: ActionSheet,
|
|
150
|
+
TinyDropdown: Dropdown,
|
|
151
|
+
TinyDropdownMenu: DropdownMenu,
|
|
152
|
+
TinyDropdownItem: DropdownItem,
|
|
153
|
+
IconClose: iconClose(),
|
|
154
|
+
IconChevronLeft: iconChevronLeft(),
|
|
155
|
+
IconChevronRight: iconChevronRight(),
|
|
156
|
+
IconZoomOut: iconZoomOut(),
|
|
157
|
+
IconZoomIn: iconZoomIn(),
|
|
158
|
+
IconFullscreen: iconFullscreen(),
|
|
159
|
+
IconMinscreen: iconMinscreen(),
|
|
160
|
+
IconRepeat: iconRepeat(),
|
|
161
|
+
IconRefres: iconRefres(),
|
|
162
|
+
IconDel: iconDel(),
|
|
163
|
+
IconDownload: iconDownload(),
|
|
164
|
+
IconArrowLeft: iconArrowLeft(),
|
|
165
|
+
IconArrowRight: iconArrowRight(),
|
|
166
|
+
IconEditorMenuRight: iconEditorMenuRight(),
|
|
167
|
+
IconPicture: iconPicture()
|
|
168
|
+
},
|
|
169
|
+
directives: _extends({}, touchDeactives),
|
|
170
|
+
setup: function setup$1(props2, context) {
|
|
171
|
+
return setup({
|
|
172
|
+
props: props2,
|
|
173
|
+
context,
|
|
174
|
+
renderless,
|
|
175
|
+
api
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
var render = function render2() {
|
|
180
|
+
var _vm = this;
|
|
181
|
+
var _h = _vm.$createElement;
|
|
182
|
+
var _c = _vm._self._c || _h;
|
|
183
|
+
return _vm.state.showImageViewer ? _c("div", {
|
|
184
|
+
attrs: {
|
|
185
|
+
"data-tag": "tiny-image-viewer"
|
|
186
|
+
}
|
|
187
|
+
}, [_c("transition", {
|
|
188
|
+
attrs: {
|
|
189
|
+
"name": "viewer-fade"
|
|
190
|
+
}
|
|
191
|
+
}, [_vm.state.showImageViewer ? _c("div", {
|
|
192
|
+
class: ["left-0 right-0 top-0 bottom-0 hidden sm:flex z-10", _vm.modalView ? "" : "fixed"],
|
|
193
|
+
style: {
|
|
194
|
+
"z-index": _vm.state.zIndex,
|
|
195
|
+
"height": _vm.modalView && _vm.modalHeight + "px"
|
|
196
|
+
},
|
|
197
|
+
attrs: {
|
|
198
|
+
"data-tag": "tiny-image-body"
|
|
199
|
+
}
|
|
200
|
+
}, [_vm.state.isThumbnail ? _c("div", {
|
|
201
|
+
ref: "isThumbnailContent",
|
|
202
|
+
class: ["flex-none w-[12%] h-full flex flex-col overflow-y-scroll items-center scrollbar-size-0", _vm.bgColor !== "white" ? "bg-color-icon-primary" : ""],
|
|
203
|
+
style: {
|
|
204
|
+
backgroundColor: _vm.bgColor === "white" && _vm.bgColor
|
|
205
|
+
},
|
|
206
|
+
attrs: {
|
|
207
|
+
"data-tag": "tiny-isthumbnail"
|
|
208
|
+
}
|
|
209
|
+
}, _vm._l(_vm.state.urlList, function(item, i) {
|
|
210
|
+
return _c("div", {
|
|
211
|
+
key: i,
|
|
212
|
+
ref: "isThumbnail_" + i,
|
|
213
|
+
refInFor: true,
|
|
214
|
+
staticClass: "w-[88%] [&:not(:last-child)]:mb-2 [&:first-of-type]:mt-2"
|
|
215
|
+
}, [_c("div", {
|
|
216
|
+
class: ["rounded cursor-pointer p-1", {
|
|
217
|
+
"bg-color-brand": _vm.state.currentIndex === i
|
|
218
|
+
}],
|
|
219
|
+
on: {
|
|
220
|
+
"click": function click($event) {
|
|
221
|
+
return _vm.activeItems(i);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}, [_c("img", {
|
|
225
|
+
ref: "img_" + i,
|
|
226
|
+
refInFor: true,
|
|
227
|
+
staticClass: "max-h-full max-w-full aspect-square bg-current rounded",
|
|
228
|
+
attrs: {
|
|
229
|
+
"src": item.url
|
|
230
|
+
}
|
|
231
|
+
}), _c("div", {
|
|
232
|
+
class: ["px-1 mt-1 sm:text-xs text-sm leading-5 overflow-hidden whitespace-nowrap text-ellipsis", _vm.bgColor === "white" ? _vm.state.currentIndex !== i ? "text-color-text-primary" : "text-color-bg-1" : "text-color-bg-1"],
|
|
233
|
+
attrs: {
|
|
234
|
+
"title": item.name || item.url
|
|
235
|
+
}
|
|
236
|
+
}, [_vm._v(" " + _vm._s(item.name) + " ")])])]);
|
|
237
|
+
}), 0) : _vm._e(), _vm.state.isMenuView ? _c("div", {
|
|
238
|
+
ref: "isMenuViewContent",
|
|
239
|
+
class: ["flex-none w-[12%] h-full flex flex-col overflow-y-scroll items-center scrollbar-size-0", _vm.bgColor !== "white" ? "bg-color-icon-primary" : "bg-color-bg-1"],
|
|
240
|
+
attrs: {
|
|
241
|
+
"data-tag": "tiny-is-menu-view"
|
|
242
|
+
}
|
|
243
|
+
}, _vm._l(_vm.state.urlList, function(items, i) {
|
|
244
|
+
return _c("div", {
|
|
245
|
+
key: i,
|
|
246
|
+
staticClass: "w-[88%]"
|
|
247
|
+
}, [_c("div", {
|
|
248
|
+
ref: "isMenuView_" + i,
|
|
249
|
+
refInFor: true,
|
|
250
|
+
class: ["[&:first-of-type]:mt-2.5 rounded cursor-pointer flex mx-1 h-9 items-center", {
|
|
251
|
+
"bg-color-brand": _vm.state.currentIndex === i
|
|
252
|
+
}],
|
|
253
|
+
on: {
|
|
254
|
+
"click": function click($event) {
|
|
255
|
+
return _vm.activeItems(i);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}, [_c("icon-picture", {
|
|
259
|
+
ref: "img_" + i,
|
|
260
|
+
refInFor: true,
|
|
261
|
+
class: ["max-h-full max-w-full w-[9%] h-auto my-2.5 mx-1.5 object-none", _vm.bgColor === "white" ? _vm.state.menuItemIndex !== i ? "fill-color-text-primary" : "fill-color-bg-1" : "fill-color-bg-1"],
|
|
262
|
+
attrs: {
|
|
263
|
+
"src": items.url
|
|
264
|
+
}
|
|
265
|
+
}), _c("div", {
|
|
266
|
+
class: ["w-[67%] sm:text-xs text-sm leading-5 overflow-hidden whitespace-nowrap text-ellipsis", _vm.bgColor === "white" ? _vm.state.menuItemIndex !== i ? "text-color-text-primary" : "text-color-bg-1" : "text-color-bg-1"],
|
|
267
|
+
attrs: {
|
|
268
|
+
"title": items.name || items.url
|
|
269
|
+
}
|
|
270
|
+
}, [_vm._v(" " + _vm._s(items.name) + " ")])], 1)]);
|
|
271
|
+
}), 0) : _vm._e(), _c("div", {
|
|
272
|
+
staticClass: "flex-auto h-full relative",
|
|
273
|
+
attrs: {
|
|
274
|
+
"data-tag": "tiny-image-tools"
|
|
275
|
+
}
|
|
276
|
+
}, [_c("div", {
|
|
277
|
+
staticClass: "absolute w-full h-full top-0 left-0 bg-color-bg-7",
|
|
278
|
+
attrs: {
|
|
279
|
+
"data-tag": "tiny-image-pc-mask"
|
|
280
|
+
}
|
|
281
|
+
}), _vm.modalView || !_vm.state.isThumbnail && !_vm.state.isMenuView ? _c("span", {
|
|
282
|
+
staticClass: "z-[1] flex absolute items-center justify-center rounded-full box-border select-none top-20 right-20 bottom-10 text-xl cursor-pointer w-8 h-8 hover:bg-color-text-primary active:bg-color-border fill-color-bg-1 bg-color-border",
|
|
283
|
+
attrs: {
|
|
284
|
+
"data-tag": "tiny-image-pc-close"
|
|
285
|
+
},
|
|
286
|
+
on: {
|
|
287
|
+
"click": _vm.hide
|
|
288
|
+
}
|
|
289
|
+
}, [_c("icon-close", {
|
|
290
|
+
staticClass: "fill-color-bg-1 cursor-pointer"
|
|
291
|
+
})], 1) : _vm._e(), _c("div", {
|
|
292
|
+
staticClass: "z-[1] absolute inline-flex items-center justify-center box-border select-none left-1/2 bottom-12 -translate-x-1/2 w-80 h-10 px-4 bg-color-bg-7 rounded cursor-pointer",
|
|
293
|
+
attrs: {
|
|
294
|
+
"data-tag": "tiny-image-pc-actions"
|
|
295
|
+
}
|
|
296
|
+
}, [_c("div", {
|
|
297
|
+
staticClass: "w-full h-full text-justify cursor-default text-2xl flex items-center justify-between fill-color-bg-1"
|
|
298
|
+
}, [_c(_vm.state.mode.icon, {
|
|
299
|
+
tag: "component",
|
|
300
|
+
staticClass: "cursor-pointer",
|
|
301
|
+
on: {
|
|
302
|
+
"click": _vm.toggleMode
|
|
303
|
+
}
|
|
304
|
+
}), _c("icon-zoom-out", {
|
|
305
|
+
staticClass: "cursor-pointer",
|
|
306
|
+
on: {
|
|
307
|
+
"click": function click($event) {
|
|
308
|
+
return _vm.handleActions("zoomOut");
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}), _c("icon-zoom-in", {
|
|
312
|
+
staticClass: "cursor-pointer",
|
|
313
|
+
on: {
|
|
314
|
+
"click": function click($event) {
|
|
315
|
+
return _vm.handleActions("zoomIn");
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}), _c("icon-refres", {
|
|
319
|
+
staticClass: "cursor-pointer",
|
|
320
|
+
on: {
|
|
321
|
+
"click": function click($event) {
|
|
322
|
+
return _vm.handleActions("clocelise");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}), _c("icon-repeat", {
|
|
326
|
+
staticClass: "cursor-pointer",
|
|
327
|
+
on: {
|
|
328
|
+
"click": function click($event) {
|
|
329
|
+
return _vm.handleActions("anticlocelise");
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}), _c("icon-del", {
|
|
333
|
+
staticClass: "cursor-pointer",
|
|
334
|
+
on: {
|
|
335
|
+
"click": function click($event) {
|
|
336
|
+
return _vm.handleActions("delImage");
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}), _c("a", {
|
|
340
|
+
staticClass: "cursor-pointer inline-flex fill-color-bg-1",
|
|
341
|
+
attrs: {
|
|
342
|
+
"href": "" + _vm.state.currentImg,
|
|
343
|
+
"target": "_blank",
|
|
344
|
+
"rel": "noopener noreferrer",
|
|
345
|
+
"download": ""
|
|
346
|
+
}
|
|
347
|
+
}, [_c("icon-download")], 1), _c("tiny-dropdown", {
|
|
348
|
+
staticClass: "flex",
|
|
349
|
+
attrs: {
|
|
350
|
+
"show-self-icon": ""
|
|
351
|
+
},
|
|
352
|
+
on: {
|
|
353
|
+
"item-click": _vm.itemClick
|
|
354
|
+
},
|
|
355
|
+
scopedSlots: _vm._u([{
|
|
356
|
+
key: "dropdown",
|
|
357
|
+
fn: function fn() {
|
|
358
|
+
return [_c("tiny-dropdown-menu", {
|
|
359
|
+
attrs: {
|
|
360
|
+
"checked-status": "",
|
|
361
|
+
"placement": "top"
|
|
362
|
+
},
|
|
363
|
+
scopedSlots: _vm._u([{
|
|
364
|
+
key: "default",
|
|
365
|
+
fn: function fn2(_ref) {
|
|
366
|
+
var selectedIndex = _ref.selectedIndex;
|
|
367
|
+
return [_c("tiny-dropdown-item", {
|
|
368
|
+
attrs: {
|
|
369
|
+
"current-index": 0,
|
|
370
|
+
"selected": selectedIndex === "0" && !_vm.state.isThumbnail && !_vm.state.isMenuView,
|
|
371
|
+
"item-data": !_vm.state.isThumbnail && !_vm.state.isMenuView ? "4" : "1"
|
|
372
|
+
}
|
|
373
|
+
}, [_vm._v(_vm._s(_vm.state.isThumbnail || _vm.state.isMenuView ? _vm.t("ui.imageViewer.hide") : _vm.t("ui.imageViewer.show")))]), _c("tiny-dropdown-item", {
|
|
374
|
+
attrs: {
|
|
375
|
+
"current-index": 1,
|
|
376
|
+
"selected": selectedIndex === "1" || _vm.state.isThumbnail,
|
|
377
|
+
"item-data": "2"
|
|
378
|
+
}
|
|
379
|
+
}, [_vm._v(_vm._s(_vm.t("ui.imageViewer.thumbnail")))]), _c("tiny-dropdown-item", {
|
|
380
|
+
attrs: {
|
|
381
|
+
"current-index": 2,
|
|
382
|
+
"selected": selectedIndex === "2" || _vm.state.isMenuView,
|
|
383
|
+
"item-data": "3"
|
|
384
|
+
}
|
|
385
|
+
}, [_vm._v(_vm._s(_vm.t("ui.imageViewer.menu")))])];
|
|
386
|
+
}
|
|
387
|
+
}], null, false, 1242418640)
|
|
388
|
+
})];
|
|
389
|
+
},
|
|
390
|
+
proxy: true
|
|
391
|
+
}], null, false, 849811104)
|
|
392
|
+
}, [_c("span", [_c("icon-editor-menu-right")], 1)]), _c("icon-arrow-left", {
|
|
393
|
+
class: ["cursor-pointer", {
|
|
394
|
+
"is-disabled": !_vm.state.infinite && _vm.state.isFirst
|
|
395
|
+
}],
|
|
396
|
+
on: {
|
|
397
|
+
"click": _vm.prev
|
|
398
|
+
}
|
|
399
|
+
}), _c("icon-arrow-right", {
|
|
400
|
+
class: ["cursor-pointer", {
|
|
401
|
+
"is-disabled": !_vm.state.infinite && _vm.state.isLast
|
|
402
|
+
}],
|
|
403
|
+
on: {
|
|
404
|
+
"click": _vm.next
|
|
405
|
+
}
|
|
406
|
+
})], 1)]), _vm.showIndex ? _c("div", {
|
|
407
|
+
staticClass: "z-10 absolute flex items-center justify-center box-border left-1/2 -translate-x-1/2 px-4 bottom-5",
|
|
408
|
+
attrs: {
|
|
409
|
+
"data-tag": "tiny-image-pc-index"
|
|
410
|
+
}
|
|
411
|
+
}, [_c("span", {
|
|
412
|
+
staticClass: "h-4.5 inline-flex items-center text-color-text-primary"
|
|
413
|
+
}, [_vm._v(" " + _vm._s(_vm.state.index + 1 + "/" + _vm.state.urlList.length) + " ")])]) : _vm._e(), _c("div", {
|
|
414
|
+
staticClass: "z-10 flex w-full h-full items-center justify-center",
|
|
415
|
+
attrs: {
|
|
416
|
+
"data-tag": "tiny-image-pc-canvas"
|
|
417
|
+
}
|
|
418
|
+
}, [_vm._l(_vm.state.urlList, function(url, i) {
|
|
419
|
+
return [i === _vm.state.index ? _c("img", {
|
|
420
|
+
key: i,
|
|
421
|
+
ref: "img_" + i,
|
|
422
|
+
refInFor: true,
|
|
423
|
+
style: _vm.state.imgStyle,
|
|
424
|
+
attrs: {
|
|
425
|
+
"src": _vm.state.currentImg
|
|
426
|
+
},
|
|
427
|
+
on: {
|
|
428
|
+
"error": _vm.handleImgError,
|
|
429
|
+
"mousedown": _vm.handleMouseDown,
|
|
430
|
+
"load": _vm.handleImgLoad
|
|
431
|
+
}
|
|
432
|
+
}) : _vm._e()];
|
|
433
|
+
})], 2)])]) : _vm._e()]), _c("transition", {
|
|
434
|
+
attrs: {
|
|
435
|
+
"name": "viewer-fade"
|
|
436
|
+
}
|
|
437
|
+
}, [_vm.state.isThumbnail ? _c("div", {
|
|
438
|
+
class: ["w-screen h-screen fixed top-0 left-0 sm:hidden z-40", {
|
|
439
|
+
"hidden": _vm.state.hiddenThumbnail
|
|
440
|
+
}],
|
|
441
|
+
attrs: {
|
|
442
|
+
"data-tag": "tiny-image-mobile-thumbnail-list"
|
|
443
|
+
}
|
|
444
|
+
}, [_c("div", {
|
|
445
|
+
staticClass: "bg-color-bg-1 w-screen h-screen overflow-auto"
|
|
446
|
+
}, _vm._l(_vm.state.urlList, function(item, i) {
|
|
447
|
+
return _c("div", {
|
|
448
|
+
key: i,
|
|
449
|
+
staticClass: "px-4 pt-4 [&:last-of-type]:mb-5 cursor-pointer",
|
|
450
|
+
on: {
|
|
451
|
+
"touchstart": function touchstart($event) {
|
|
452
|
+
return _vm.imagePreview(i);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}, [_c("img", {
|
|
456
|
+
ref: "img_" + i,
|
|
457
|
+
refInFor: true,
|
|
458
|
+
staticClass: "bg-current w-full h-auto",
|
|
459
|
+
attrs: {
|
|
460
|
+
"src": item.url
|
|
461
|
+
}
|
|
462
|
+
}), _c("div", {
|
|
463
|
+
staticClass: "color-text-primary mt-2 sm:text-xs text-sm leading-5 overflow-hidden whitespace-nowrap text-ellipsis text-color-text-primary",
|
|
464
|
+
attrs: {
|
|
465
|
+
"title": item.name || item.url
|
|
466
|
+
}
|
|
467
|
+
}, [_vm._v(" " + _vm._s(item.name) + " ")])]);
|
|
468
|
+
}), 0)]) : !_vm.state.isMenuView ? _c("div", {
|
|
469
|
+
staticClass: "w-screen h-screen fixed top-0 left-0 z-50 sm:hidden",
|
|
470
|
+
attrs: {
|
|
471
|
+
"data-tag": "tiny-image-mobile-common"
|
|
472
|
+
}
|
|
473
|
+
}, [_c("div", {
|
|
474
|
+
staticClass: "absolute w-full h-full top-0 left-0 bg-black",
|
|
475
|
+
attrs: {
|
|
476
|
+
"data-tag": "tiny-image-mobile-mask"
|
|
477
|
+
}
|
|
478
|
+
}), _c("div", {
|
|
479
|
+
directives: [{
|
|
480
|
+
name: "swipeleft",
|
|
481
|
+
rawName: "v-swipeleft",
|
|
482
|
+
value: _vm.swipeLeft,
|
|
483
|
+
expression: "swipeLeft"
|
|
484
|
+
}, {
|
|
485
|
+
name: "swiperight",
|
|
486
|
+
rawName: "v-swiperight",
|
|
487
|
+
value: _vm.swipeRight,
|
|
488
|
+
expression: "swipeRight"
|
|
489
|
+
}],
|
|
490
|
+
staticClass: "left-0 right-0 top-0 bottom-0 fixed",
|
|
491
|
+
attrs: {
|
|
492
|
+
"data-tag": "tiny-image-mobile-index"
|
|
493
|
+
}
|
|
494
|
+
}, [_vm.showIndex ? _c("div", {
|
|
495
|
+
staticClass: "absolute flex items-center justify-center box-border left-1/2 -translate-x-1/2 px-4 bottom-12"
|
|
496
|
+
}, [_c("span", {
|
|
497
|
+
staticClass: "h-4.5 inline-flex items-center text-color-bg-1"
|
|
498
|
+
}, [_vm._v(" " + _vm._s(_vm.state.index + 1 + "/" + _vm.state.urlList.length) + " ")])]) : _vm._e(), _c("div", {
|
|
499
|
+
ref: "canvasBox",
|
|
500
|
+
staticClass: "w-full h-full",
|
|
501
|
+
attrs: {
|
|
502
|
+
"data-tag": "tiny-image-mobile-canvas"
|
|
503
|
+
}
|
|
504
|
+
}, [_c("div", {
|
|
505
|
+
staticClass: "h-full flex items-center justify-center",
|
|
506
|
+
style: {
|
|
507
|
+
"width": _vm.state.imageAllWidth + "px",
|
|
508
|
+
"transition-duration": _vm.state.imageTransition + "ms",
|
|
509
|
+
transform: "translateX(" + _vm.state.imageTransformSize + "px)"
|
|
510
|
+
}
|
|
511
|
+
}, _vm._l(_vm.urlList, function(url, i) {
|
|
512
|
+
return _c("div", {
|
|
513
|
+
key: i,
|
|
514
|
+
ref: "viewerItem",
|
|
515
|
+
refInFor: true,
|
|
516
|
+
staticClass: "relative shrink h-full",
|
|
517
|
+
style: Object.assign({
|
|
518
|
+
width: _vm.state.imageItemWidth + "px"
|
|
519
|
+
}, i === _vm.state.index ? _vm.state.imgStyle : ""),
|
|
520
|
+
attrs: {
|
|
521
|
+
"data-tag": "tiny-image-mobile-viewer-item"
|
|
522
|
+
}
|
|
523
|
+
}, [_c("div", {
|
|
524
|
+
staticClass: "absolute top-0 left-0 right-0 bottom-0 text-center transition-transform inline-block duration-300"
|
|
525
|
+
}, [i === _vm.state.index ? _c("img", {
|
|
526
|
+
key: i,
|
|
527
|
+
ref: "img_" + i,
|
|
528
|
+
refInFor: true,
|
|
529
|
+
class: ["block w-full h-full object-contain", {
|
|
530
|
+
"object-fill": _vm.state.fullScreen
|
|
531
|
+
}],
|
|
532
|
+
style: _vm.state.imgStyle,
|
|
533
|
+
attrs: {
|
|
534
|
+
"src": _vm.state.currentImg
|
|
535
|
+
},
|
|
536
|
+
on: {
|
|
537
|
+
"mousedown": _vm.handleMouseDown,
|
|
538
|
+
"error": _vm.handleImgError,
|
|
539
|
+
"load": _vm.handleImgLoad,
|
|
540
|
+
"touchstart": _vm.touchstart,
|
|
541
|
+
"touchmove": _vm.touchmove,
|
|
542
|
+
"touchend": _vm.touchend
|
|
543
|
+
}
|
|
544
|
+
}) : _vm._e()])]);
|
|
545
|
+
}), 0)])])]) : _vm._e()]), _c("transition", {
|
|
546
|
+
attrs: {
|
|
547
|
+
"name": "viewer-fade"
|
|
548
|
+
}
|
|
549
|
+
}, [_vm.state.isImagePreview ? _c("div", {
|
|
550
|
+
staticClass: "w-screen h-screen fixed top-0 left-0 z-50 sm:hidden",
|
|
551
|
+
attrs: {
|
|
552
|
+
"data-tag": "tiny-image-isthumbnail-preview"
|
|
553
|
+
}
|
|
554
|
+
}, [_c("div", {
|
|
555
|
+
staticClass: "absolute w-full h-full top-0 left-0 bg-black",
|
|
556
|
+
attrs: {
|
|
557
|
+
"data-tag": "tiny-image-mobile-mask"
|
|
558
|
+
}
|
|
559
|
+
}), _c("div", {
|
|
560
|
+
directives: [{
|
|
561
|
+
name: "swipeleft",
|
|
562
|
+
rawName: "v-swipeleft",
|
|
563
|
+
value: _vm.swipeLeft,
|
|
564
|
+
expression: "swipeLeft"
|
|
565
|
+
}, {
|
|
566
|
+
name: "swiperight",
|
|
567
|
+
rawName: "v-swiperight",
|
|
568
|
+
value: _vm.swipeRight,
|
|
569
|
+
expression: "swipeRight"
|
|
570
|
+
}],
|
|
571
|
+
staticClass: "left-0 right-0 top-0 bottom-0 fixed",
|
|
572
|
+
attrs: {
|
|
573
|
+
"data-tag": "tiny-image-isthumbnail-index"
|
|
574
|
+
}
|
|
575
|
+
}, [_vm.showIndex ? _c("div", {
|
|
576
|
+
staticClass: "absolute flex items-center justify-center box-border left-1/2 -translate-x-1/2 px-4 bottom-12"
|
|
577
|
+
}, [_c("span", {
|
|
578
|
+
staticClass: "h-4.5 inline-flex items-center text-color-bg-1"
|
|
579
|
+
}, [_vm._v(" " + _vm._s(_vm.state.index + 1 + "/" + _vm.state.urlList.length) + " ")])]) : _vm._e(), _c("div", {
|
|
580
|
+
ref: "thumbnailCanvasBox",
|
|
581
|
+
staticClass: "w-full h-full",
|
|
582
|
+
attrs: {
|
|
583
|
+
"data-tag": "tiny-image-isthumbnail-canvas"
|
|
584
|
+
}
|
|
585
|
+
}, [_c("div", {
|
|
586
|
+
staticClass: "h-full flex items-center justify-center",
|
|
587
|
+
style: {
|
|
588
|
+
"width": _vm.state.imageAllWidth + "px",
|
|
589
|
+
"transition-duration": _vm.state.imageTransition + "ms",
|
|
590
|
+
transform: "translateX(" + _vm.state.imageTransformSize + "px)"
|
|
591
|
+
}
|
|
592
|
+
}, _vm._l(_vm.state.urlList, function(url, i) {
|
|
593
|
+
return _c("div", {
|
|
594
|
+
key: i,
|
|
595
|
+
ref: "viewerItem",
|
|
596
|
+
refInFor: true,
|
|
597
|
+
staticClass: "relative shrink h-full",
|
|
598
|
+
style: Object.assign({
|
|
599
|
+
width: _vm.state.imageItemWidth + "px"
|
|
600
|
+
}, i === _vm.state.index ? _vm.state.imgStyle : ""),
|
|
601
|
+
attrs: {
|
|
602
|
+
"data-tag": "tiny-image-isthumbnail-viewer-item"
|
|
603
|
+
}
|
|
604
|
+
}, [_c("div", {
|
|
605
|
+
staticClass: "absolute top-0 left-0 right-0 bottom-0 text-center transition-transform inline-block duration-300"
|
|
606
|
+
}, [_c("img", {
|
|
607
|
+
key: i,
|
|
608
|
+
ref: "img_" + i,
|
|
609
|
+
refInFor: true,
|
|
610
|
+
class: ["block w-full h-full object-contain", {
|
|
611
|
+
"object-fill": _vm.state.fullScreen
|
|
612
|
+
}],
|
|
613
|
+
style: _vm.state.imgStyle,
|
|
614
|
+
attrs: {
|
|
615
|
+
"src": _vm.state.currentImg
|
|
616
|
+
},
|
|
617
|
+
on: {
|
|
618
|
+
"mousedown": _vm.handleMouseDown,
|
|
619
|
+
"error": _vm.handleImgError,
|
|
620
|
+
"load": _vm.handleImgLoad,
|
|
621
|
+
"touchstart": _vm.touchstart,
|
|
622
|
+
"touchmove": _vm.touchmove,
|
|
623
|
+
"touchend": _vm.touchend
|
|
624
|
+
}
|
|
625
|
+
})])]);
|
|
626
|
+
}), 0)])])]) : _vm._e()]), _c("tiny-action-sheet", {
|
|
627
|
+
attrs: {
|
|
628
|
+
"type": "action",
|
|
629
|
+
"menus": [{
|
|
630
|
+
type: "save",
|
|
631
|
+
label: _vm.t("ui.imageViewer.save")
|
|
632
|
+
}, {
|
|
633
|
+
type: "thumbnail",
|
|
634
|
+
label: _vm.t("ui.imageViewer.thumbnail")
|
|
635
|
+
}, {
|
|
636
|
+
type: "del",
|
|
637
|
+
label: _vm.t("ui.imageViewer.del")
|
|
638
|
+
}],
|
|
639
|
+
"visible": _vm.state.boxVisibility
|
|
640
|
+
},
|
|
641
|
+
on: {
|
|
642
|
+
"update:visible": function updateVisible($event) {
|
|
643
|
+
_vm.state.boxVisibility = $event;
|
|
644
|
+
},
|
|
645
|
+
"click": _vm.selectOption
|
|
646
|
+
},
|
|
647
|
+
scopedSlots: _vm._u([{
|
|
648
|
+
key: "default",
|
|
649
|
+
fn: function fn(data) {
|
|
650
|
+
return [_c("div", {
|
|
651
|
+
class: [{
|
|
652
|
+
"text-color-error": data.data.type === "del"
|
|
653
|
+
}]
|
|
654
|
+
}, [_vm._v(_vm._s(data.data.label))])];
|
|
655
|
+
}
|
|
656
|
+
}], null, false, 852563897)
|
|
657
|
+
})], 1) : _vm._e();
|
|
658
|
+
};
|
|
659
|
+
var staticRenderFns = [];
|
|
660
|
+
var __cssModules = {};
|
|
661
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
662
|
+
function __vue2_injectStyles(context) {
|
|
663
|
+
for (var o in __cssModules) {
|
|
664
|
+
this[o] = __cssModules[o];
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
var mobileFirst = /* @__PURE__ */ function() {
|
|
668
|
+
return __component__.exports;
|
|
669
|
+
}();
|
|
670
|
+
|
|
671
|
+
export { mobileFirst as default };
|