@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
package/lib/mobile.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/image-viewer/vue';
|
|
2
|
+
import { directive, defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import { iconClose, iconChevronLeft, iconChevronRight, iconZoomOut, iconZoomIn, iconRepeat, iconRefres, iconDel } from '@opentinyvue/vue-icon';
|
|
4
|
+
import { isObject } from '@opentinyvue/vue-renderless/common/type';
|
|
5
|
+
import '@opentinyvue/vue-theme-mobile/image-viewer/index.css';
|
|
6
|
+
|
|
7
|
+
var TinyTouch = /* @__PURE__ */ function() {
|
|
8
|
+
function TinyTouch2(element, tinyBinding, type) {
|
|
9
|
+
var that = this;
|
|
10
|
+
that.element = element;
|
|
11
|
+
that.tinyBinding = tinyBinding;
|
|
12
|
+
that.touchType = type;
|
|
13
|
+
that.tinyVueTouches = {
|
|
14
|
+
x: 0,
|
|
15
|
+
y: 0
|
|
16
|
+
};
|
|
17
|
+
that.tinyVueMoves = true;
|
|
18
|
+
that.tinyVueLeave = true;
|
|
19
|
+
that.tinyLongTouch = true;
|
|
20
|
+
that.tinyVueCallBack = isObject(tinyBinding.value) ? tinyBinding.value.fn : tinyBinding.value;
|
|
21
|
+
that.element.addEventListener("touchstart", function(e) {
|
|
22
|
+
that.start(e);
|
|
23
|
+
});
|
|
24
|
+
that.element.addEventListener("touchend", function(e) {
|
|
25
|
+
that.end(e);
|
|
26
|
+
});
|
|
27
|
+
that.element.addEventListener("touchmove", function(e) {
|
|
28
|
+
that.move(e);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
var _proto = TinyTouch2.prototype;
|
|
32
|
+
_proto.start = function start(e) {
|
|
33
|
+
var _this = this;
|
|
34
|
+
if (e.touches >= 2) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.tinyVueMoves = true;
|
|
38
|
+
this.tinyVueLeave = true;
|
|
39
|
+
this.tinyLongTouch = true;
|
|
40
|
+
this.tinyVueTouches = {
|
|
41
|
+
x: e.changedTouches[0].pageX,
|
|
42
|
+
y: e.changedTouches[0].pageY
|
|
43
|
+
};
|
|
44
|
+
this.time = setTimeout(function() {
|
|
45
|
+
if (_this.tinyVueLeave && _this.tinyVueMoves) {
|
|
46
|
+
_this.touchType == "longtap" && _this.tinyVueCallBack(_this.tinyBinding.value, e);
|
|
47
|
+
_this.tinyLongTouch = false;
|
|
48
|
+
}
|
|
49
|
+
}, 1e3);
|
|
50
|
+
};
|
|
51
|
+
_proto.end = function end(e) {
|
|
52
|
+
if (e.touches >= 2) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
var disX = e.changedTouches[0].pageX - this.tinyVueTouches.x;
|
|
56
|
+
var disY = e.changedTouches[0].pageY - this.tinyVueTouches.y;
|
|
57
|
+
clearTimeout(this.time);
|
|
58
|
+
if (Math.abs(disX) > 10 || Math.abs(disY) > 100) {
|
|
59
|
+
this.touchType == "swipe" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
60
|
+
if (Math.abs(disX) > Math.abs(disY)) {
|
|
61
|
+
if (disX > 10) {
|
|
62
|
+
this.touchType == "swiperight" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
63
|
+
}
|
|
64
|
+
if (disX < -10) {
|
|
65
|
+
this.touchType == "swipeleft" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
if (disY > 10) {
|
|
69
|
+
this.touchType == "swipedown" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
70
|
+
}
|
|
71
|
+
if (disY < -10) {
|
|
72
|
+
this.touchType == "swipeup" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
if (this.tinyLongTouch && this.tinyVueMoves) {
|
|
77
|
+
this.touchType == "tap" && this.tinyVueCallBack(this.tinyBinding.value, e);
|
|
78
|
+
this.tinyVueLeave = false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
_proto.move = function move() {
|
|
83
|
+
this.tinyVueMoves = false;
|
|
84
|
+
};
|
|
85
|
+
return TinyTouch2;
|
|
86
|
+
}();
|
|
87
|
+
var mapDirective = function mapDirective2() {
|
|
88
|
+
var deactives = {};
|
|
89
|
+
var names = ["tap", "swipe", "swipeleft", "swiperight", "swipedown", "swipeup", "longtap"];
|
|
90
|
+
names.forEach(function(name) {
|
|
91
|
+
deactives[name] = directive({
|
|
92
|
+
vTouch: {
|
|
93
|
+
bind: function bind(el, tinyBinding) {
|
|
94
|
+
new TinyTouch(el, tinyBinding, name);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}).vTouch;
|
|
98
|
+
});
|
|
99
|
+
return deactives;
|
|
100
|
+
};
|
|
101
|
+
var touchDeactives = mapDirective();
|
|
102
|
+
|
|
103
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
104
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
105
|
+
if (render) {
|
|
106
|
+
options.render = render;
|
|
107
|
+
options.staticRenderFns = staticRenderFns;
|
|
108
|
+
options._compiled = true;
|
|
109
|
+
}
|
|
110
|
+
var hook;
|
|
111
|
+
if (injectStyles) {
|
|
112
|
+
hook = injectStyles;
|
|
113
|
+
}
|
|
114
|
+
if (hook) {
|
|
115
|
+
if (options.functional) {
|
|
116
|
+
options._injectStyles = hook;
|
|
117
|
+
var originalRender = options.render;
|
|
118
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
119
|
+
hook.call(context);
|
|
120
|
+
return originalRender(h, context);
|
|
121
|
+
};
|
|
122
|
+
} else {
|
|
123
|
+
var existing = options.beforeCreate;
|
|
124
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
exports: scriptExports,
|
|
129
|
+
options
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function _extends() {
|
|
134
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
135
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
136
|
+
var t = arguments[e];
|
|
137
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
138
|
+
}
|
|
139
|
+
return n;
|
|
140
|
+
}, _extends.apply(null, arguments);
|
|
141
|
+
}
|
|
142
|
+
var __vue2_script = defineComponent({
|
|
143
|
+
props: [].concat(props, ["urlList", "zIndex", "onSwitch", "onClose", "previewVisible", "closeShow", "arrowShow", "toolShow", "showIndex", "imageFullCurrent", "startPosition", "asyncClose", "deleteButton"]),
|
|
144
|
+
components: {
|
|
145
|
+
IconClose: iconClose(),
|
|
146
|
+
IconChevronLeft: iconChevronLeft(),
|
|
147
|
+
IconChevronRight: iconChevronRight(),
|
|
148
|
+
IconZoomOut: iconZoomOut(),
|
|
149
|
+
IconZoomIn: iconZoomIn(),
|
|
150
|
+
IconRepeat: iconRepeat(),
|
|
151
|
+
IconRefres: iconRefres(),
|
|
152
|
+
IconDel: iconDel()
|
|
153
|
+
},
|
|
154
|
+
directives: _extends({}, touchDeactives),
|
|
155
|
+
setup: function setup$1(props2, context) {
|
|
156
|
+
return setup({
|
|
157
|
+
props: props2,
|
|
158
|
+
context,
|
|
159
|
+
renderless,
|
|
160
|
+
api
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
var render = function render2() {
|
|
165
|
+
var _vm = this;
|
|
166
|
+
var _h = _vm.$createElement;
|
|
167
|
+
var _c = _vm._self._c || _h;
|
|
168
|
+
return _c("transition", {
|
|
169
|
+
attrs: {
|
|
170
|
+
"name": "viewer-fade"
|
|
171
|
+
}
|
|
172
|
+
}, [_c("div", {
|
|
173
|
+
directives: [{
|
|
174
|
+
name: "show",
|
|
175
|
+
rawName: "v-show",
|
|
176
|
+
value: _vm.state.previewVisible,
|
|
177
|
+
expression: "state.previewVisible"
|
|
178
|
+
}, {
|
|
179
|
+
name: "swipeleft",
|
|
180
|
+
rawName: "v-swipeleft",
|
|
181
|
+
value: _vm.swipeLeft,
|
|
182
|
+
expression: "swipeLeft"
|
|
183
|
+
}, {
|
|
184
|
+
name: "swiperight",
|
|
185
|
+
rawName: "v-swiperight",
|
|
186
|
+
value: _vm.swipeRight,
|
|
187
|
+
expression: "swipeRight"
|
|
188
|
+
}],
|
|
189
|
+
ref: "imagePreview",
|
|
190
|
+
staticClass: "tiny-mobile-image-viewer__wrapper",
|
|
191
|
+
style: {
|
|
192
|
+
"z-index": _vm.zIndex
|
|
193
|
+
},
|
|
194
|
+
on: {
|
|
195
|
+
"click": _vm.handleVisible
|
|
196
|
+
}
|
|
197
|
+
}, [_c("div", {
|
|
198
|
+
staticClass: "tiny-mobile-image-viewer__mask"
|
|
199
|
+
}), _vm.closeShow ? _c("span", {
|
|
200
|
+
staticClass: "tiny-mobile-image-viewer__btn tiny-mobile-image-viewer__close",
|
|
201
|
+
on: {
|
|
202
|
+
"click": function click($event) {
|
|
203
|
+
$event.stopPropagation();
|
|
204
|
+
return _vm.handleVisible.apply(null, arguments);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, [_c("icon-close", {
|
|
208
|
+
staticClass: "tiny-svg-size"
|
|
209
|
+
})], 1) : _vm._e(), _vm.showIndex ? _c("div", {
|
|
210
|
+
staticClass: "tiny-mobile-image-viewer__btn tiny-mobile-image-viewer__index"
|
|
211
|
+
}, [_vm._t("index", function() {
|
|
212
|
+
return [_c("span", {
|
|
213
|
+
staticClass: "tiny-mobile-image-viewer__index--curren"
|
|
214
|
+
}, [_vm._v(_vm._s(_vm.state.index + 1))]), _c("span", [_vm._v("/")]), _c("span", {
|
|
215
|
+
staticClass: "tiny-mobile-image-viewer__index--total"
|
|
216
|
+
}, [_vm._v(_vm._s(_vm.urlList.length))])];
|
|
217
|
+
}, {
|
|
218
|
+
"value": _vm.state.index + 1
|
|
219
|
+
})], 2) : _vm._e(), !_vm.state.isSingle && _vm.arrowShow ? [_c("span", {
|
|
220
|
+
staticClass: "tiny-mobile-image-viewer__btn tiny-mobile-image-viewer__prev",
|
|
221
|
+
class: {
|
|
222
|
+
"is-disabled": !_vm.state.infinite && _vm.state.isFirst,
|
|
223
|
+
"is-arrow-disabled": _vm.state.arrowStyle === "N"
|
|
224
|
+
},
|
|
225
|
+
on: {
|
|
226
|
+
"click": function click($event) {
|
|
227
|
+
$event.stopPropagation();
|
|
228
|
+
return _vm.swipeRight.apply(null, arguments);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, [_c("icon-chevron-left", {
|
|
232
|
+
staticClass: "tiny-svg-size"
|
|
233
|
+
})], 1), _c("span", {
|
|
234
|
+
staticClass: "tiny-mobile-image-viewer__btn tiny-mobile-image-viewer__next",
|
|
235
|
+
class: {
|
|
236
|
+
"is-disabled": !_vm.state.infinite && _vm.state.isLast,
|
|
237
|
+
"is-arrow-disabled": _vm.state.arrowStyle === "Y"
|
|
238
|
+
},
|
|
239
|
+
on: {
|
|
240
|
+
"click": function click($event) {
|
|
241
|
+
$event.stopPropagation();
|
|
242
|
+
return _vm.swipeLeft.apply(null, arguments);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, [_c("icon-chevron-right", {
|
|
246
|
+
staticClass: "tiny-svg-size"
|
|
247
|
+
})], 1)] : _vm._e(), _vm.toolShow ? _c("div", {
|
|
248
|
+
staticClass: "tiny-mobile-image-viewer__btn tiny-mobile-image-viewer__actions"
|
|
249
|
+
}, [_c("div", {
|
|
250
|
+
staticClass: "tiny-mobile-image-viewer__actions-inner"
|
|
251
|
+
}, [_vm._t("tool", function() {
|
|
252
|
+
return [_c("icon-zoom-out", {
|
|
253
|
+
staticClass: "tiny-svg-size",
|
|
254
|
+
on: {
|
|
255
|
+
"click": function click($event) {
|
|
256
|
+
$event.stopPropagation();
|
|
257
|
+
return _vm.handleActions("zoomOut");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}), _c("icon-zoom-in", {
|
|
261
|
+
staticClass: "tiny-svg-size",
|
|
262
|
+
on: {
|
|
263
|
+
"click": function click($event) {
|
|
264
|
+
$event.stopPropagation();
|
|
265
|
+
return _vm.handleActions("zoomIn");
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}), _c("icon-repeat", {
|
|
269
|
+
staticClass: "tiny-svg-size",
|
|
270
|
+
on: {
|
|
271
|
+
"click": function click($event) {
|
|
272
|
+
$event.stopPropagation();
|
|
273
|
+
return _vm.handleActions("anticlocelise");
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}), _c("icon-refres", {
|
|
277
|
+
staticClass: "tiny-svg-size",
|
|
278
|
+
on: {
|
|
279
|
+
"click": function click($event) {
|
|
280
|
+
$event.stopPropagation();
|
|
281
|
+
return _vm.handleActions("clocelise");
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}), _vm.deleteButton ? _c("icon-del", {
|
|
285
|
+
staticClass: "tiny-svg-size",
|
|
286
|
+
on: {
|
|
287
|
+
"click": function click($event) {
|
|
288
|
+
$event.stopPropagation();
|
|
289
|
+
return _vm.handleDelete();
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}) : _vm._e()];
|
|
293
|
+
})], 2)]) : _vm._e(), _c("div", {
|
|
294
|
+
staticClass: "tiny-mobile-image-viewer__canvas"
|
|
295
|
+
}, [_c("div", {
|
|
296
|
+
staticClass: "tiny-mobile-image-viewer__wrap",
|
|
297
|
+
style: {
|
|
298
|
+
width: _vm.state.iamgeAllWidth + "px",
|
|
299
|
+
"transition-duration": _vm.state.imageTransition + "ms",
|
|
300
|
+
transform: "translateX(" + _vm.state.imageTransformSize + "px)"
|
|
301
|
+
}
|
|
302
|
+
}, _vm._l(_vm.state.urlList, function(url, i) {
|
|
303
|
+
return _c("div", {
|
|
304
|
+
key: i,
|
|
305
|
+
staticClass: "tiny-mobile-image-viewer__item",
|
|
306
|
+
style: Object.assign({
|
|
307
|
+
width: _vm.state.imageItemWidth + "px"
|
|
308
|
+
}, i === _vm.state.index ? _vm.state.imgStyle : "")
|
|
309
|
+
}, [_c("div", {
|
|
310
|
+
staticClass: "tiny-mobile-image-viewer__detail",
|
|
311
|
+
staticStyle: {
|
|
312
|
+
"transition-duration": "0.3s"
|
|
313
|
+
}
|
|
314
|
+
}, [_c("img", {
|
|
315
|
+
key: url,
|
|
316
|
+
ref: "img_" + i,
|
|
317
|
+
refInFor: true,
|
|
318
|
+
staticClass: "tiny-mobile-image-viewer__img",
|
|
319
|
+
class: {
|
|
320
|
+
"is-full-screen": _vm.state.fullScreen
|
|
321
|
+
},
|
|
322
|
+
attrs: {
|
|
323
|
+
"src": url
|
|
324
|
+
},
|
|
325
|
+
on: {
|
|
326
|
+
"load": _vm.handleImgLoad,
|
|
327
|
+
"error": _vm.handleImgError,
|
|
328
|
+
"mousedown": _vm.handleMouseDown,
|
|
329
|
+
"touchstart": _vm.touchstart,
|
|
330
|
+
"touchmove": _vm.touchmove,
|
|
331
|
+
"touchend": _vm.touchend
|
|
332
|
+
}
|
|
333
|
+
})])]);
|
|
334
|
+
}), 0)])], 2)]);
|
|
335
|
+
};
|
|
336
|
+
var staticRenderFns = [];
|
|
337
|
+
var __cssModules = {};
|
|
338
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
339
|
+
function __vue2_injectStyles(context) {
|
|
340
|
+
for (var o in __cssModules) {
|
|
341
|
+
this[o] = __cssModules[o];
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
var mobile = /* @__PURE__ */ function() {
|
|
345
|
+
return __component__.exports;
|
|
346
|
+
}();
|
|
347
|
+
|
|
348
|
+
export { mobile as default };
|
package/lib/pc.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { renderless, api } from '@opentinyvue/vue-renderless/image-viewer/vue';
|
|
2
|
+
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
|
+
import { iconClose, iconChevronLeft, iconChevronRight, iconZoomOut, iconZoomIn, iconFullscreen, iconMinscreen, iconRepeat, iconRefres } from '@opentinyvue/vue-icon';
|
|
4
|
+
import '@opentinyvue/vue-theme/image-viewer/index.css';
|
|
5
|
+
|
|
6
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
7
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
8
|
+
if (render) {
|
|
9
|
+
options.render = render;
|
|
10
|
+
options.staticRenderFns = staticRenderFns;
|
|
11
|
+
options._compiled = true;
|
|
12
|
+
}
|
|
13
|
+
var hook;
|
|
14
|
+
if (injectStyles) {
|
|
15
|
+
hook = injectStyles;
|
|
16
|
+
}
|
|
17
|
+
if (hook) {
|
|
18
|
+
if (options.functional) {
|
|
19
|
+
options._injectStyles = hook;
|
|
20
|
+
var originalRender = options.render;
|
|
21
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
22
|
+
hook.call(context);
|
|
23
|
+
return originalRender(h, context);
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
var existing = options.beforeCreate;
|
|
27
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
exports: scriptExports,
|
|
32
|
+
options
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var __vue2_script = defineComponent({
|
|
37
|
+
emits: ["close", "update:preview-visible", "delete", "change", "newImageList"],
|
|
38
|
+
props: [].concat(props, ["urlList", "zIndex", "onSwitch", "onClose", "keepStyle", "showIndex"]),
|
|
39
|
+
components: {
|
|
40
|
+
IconClose: iconClose(),
|
|
41
|
+
IconChevronLeft: iconChevronLeft(),
|
|
42
|
+
IconChevronRight: iconChevronRight(),
|
|
43
|
+
IconZoomOut: iconZoomOut(),
|
|
44
|
+
IconZoomIn: iconZoomIn(),
|
|
45
|
+
IconFullscreen: iconFullscreen(),
|
|
46
|
+
IconMinscreen: iconMinscreen(),
|
|
47
|
+
IconRepeat: iconRepeat(),
|
|
48
|
+
IconRefres: iconRefres()
|
|
49
|
+
},
|
|
50
|
+
setup: function setup$1(props2, context) {
|
|
51
|
+
return setup({
|
|
52
|
+
props: props2,
|
|
53
|
+
context,
|
|
54
|
+
renderless,
|
|
55
|
+
api
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
var render = function render2() {
|
|
60
|
+
var _vm = this;
|
|
61
|
+
var _h = _vm.$createElement;
|
|
62
|
+
var _c = _vm._self._c || _h;
|
|
63
|
+
return _c("transition", {
|
|
64
|
+
attrs: {
|
|
65
|
+
"name": "viewer-fade"
|
|
66
|
+
}
|
|
67
|
+
}, [_c("div", {
|
|
68
|
+
staticClass: "tiny-image-viewer tiny-image-viewer__wrapper",
|
|
69
|
+
style: {
|
|
70
|
+
"z-index": _vm.state.zIndex
|
|
71
|
+
},
|
|
72
|
+
on: {
|
|
73
|
+
"mousewheel": function mousewheel($event) {
|
|
74
|
+
$event.preventDefault();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, [_c("div", {
|
|
78
|
+
staticClass: "tiny-image-viewer__mask"
|
|
79
|
+
}), _c("span", {
|
|
80
|
+
staticClass: "tiny-image-viewer__btn tiny-image-viewer__close",
|
|
81
|
+
on: {
|
|
82
|
+
"click": _vm.hide
|
|
83
|
+
}
|
|
84
|
+
}, [_c("icon-close", {
|
|
85
|
+
staticClass: "tiny-svg-size"
|
|
86
|
+
})], 1), !_vm.state.isSingle ? [_c("span", {
|
|
87
|
+
staticClass: "tiny-image-viewer__btn tiny-image-viewer__prev",
|
|
88
|
+
class: {
|
|
89
|
+
"is-disabled": !_vm.state.infinite && _vm.state.isFirst
|
|
90
|
+
},
|
|
91
|
+
on: {
|
|
92
|
+
"click": _vm.prev
|
|
93
|
+
}
|
|
94
|
+
}, [_c("icon-chevron-left", {
|
|
95
|
+
staticClass: "tiny-svg-size"
|
|
96
|
+
})], 1), _c("span", {
|
|
97
|
+
staticClass: "tiny-image-viewer__btn tiny-image-viewer__next",
|
|
98
|
+
class: {
|
|
99
|
+
"is-disabled": !_vm.state.infinite && _vm.state.isLast
|
|
100
|
+
},
|
|
101
|
+
on: {
|
|
102
|
+
"click": _vm.next
|
|
103
|
+
}
|
|
104
|
+
}, [_c("icon-chevron-right", {
|
|
105
|
+
staticClass: "tiny-svg-size"
|
|
106
|
+
})], 1)] : _vm._e(), _c("div", {
|
|
107
|
+
staticClass: "tiny-image-viewer__btn tiny-image-viewer__actions"
|
|
108
|
+
}, [_c("div", {
|
|
109
|
+
staticClass: "tiny-image-viewer__actions-inner"
|
|
110
|
+
}, [_c("icon-zoom-out", {
|
|
111
|
+
staticClass: "tiny-svg-size",
|
|
112
|
+
on: {
|
|
113
|
+
"click": function click($event) {
|
|
114
|
+
return _vm.handleActions("zoomOut");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}), _c("icon-zoom-in", {
|
|
118
|
+
staticClass: "tiny-svg-size",
|
|
119
|
+
on: {
|
|
120
|
+
"click": function click($event) {
|
|
121
|
+
return _vm.handleActions("zoomIn");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}), _c("i", {
|
|
125
|
+
staticClass: "tiny-image-viewer__actions-divider"
|
|
126
|
+
}), _c(_vm.state.mode.icon, {
|
|
127
|
+
tag: "component",
|
|
128
|
+
staticClass: "tiny-svg-size",
|
|
129
|
+
on: {
|
|
130
|
+
"click": _vm.toggleMode
|
|
131
|
+
}
|
|
132
|
+
}), _c("i", {
|
|
133
|
+
staticClass: "tiny-image-viewer__actions-divider"
|
|
134
|
+
}), _c("icon-repeat", {
|
|
135
|
+
staticClass: "tiny-svg-size",
|
|
136
|
+
on: {
|
|
137
|
+
"click": function click($event) {
|
|
138
|
+
return _vm.handleActions("anticlocelise");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}), _c("icon-refres", {
|
|
142
|
+
staticClass: "tiny-svg-size",
|
|
143
|
+
on: {
|
|
144
|
+
"click": function click($event) {
|
|
145
|
+
return _vm.handleActions("clocelise");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}), _vm._t("count", function() {
|
|
149
|
+
return [_vm.showIndex ? _c("span", {
|
|
150
|
+
staticClass: "tiny-image-viewer__actions-count"
|
|
151
|
+
}, [_vm._v(_vm._s(_vm.state.index + 1) + "/" + _vm._s(_vm.urlList.length))]) : _vm._e()];
|
|
152
|
+
}, {
|
|
153
|
+
"index": _vm.state.index
|
|
154
|
+
})], 2)]), _c("div", {
|
|
155
|
+
staticClass: "tiny-image-viewer__canvas"
|
|
156
|
+
}, [_vm._l(_vm.urlList, function(url, i) {
|
|
157
|
+
return [i === _vm.state.index ? _c("img", {
|
|
158
|
+
key: url,
|
|
159
|
+
ref: "img_" + i,
|
|
160
|
+
refInFor: true,
|
|
161
|
+
staticClass: "tiny-image-viewer__img",
|
|
162
|
+
style: _vm.state.imgStyle,
|
|
163
|
+
attrs: {
|
|
164
|
+
"src": _vm.state.currentImg
|
|
165
|
+
},
|
|
166
|
+
on: {
|
|
167
|
+
"error": _vm.handleImgError,
|
|
168
|
+
"mousedown": _vm.handleMouseDown,
|
|
169
|
+
"load": _vm.handleImgLoad
|
|
170
|
+
}
|
|
171
|
+
}) : _vm._e()];
|
|
172
|
+
})], 2)], 2)]);
|
|
173
|
+
};
|
|
174
|
+
var staticRenderFns = [];
|
|
175
|
+
var __cssModules = {};
|
|
176
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
177
|
+
function __vue2_injectStyles(context) {
|
|
178
|
+
for (var o in __cssModules) {
|
|
179
|
+
this[o] = __cssModules[o];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
var pc = /* @__PURE__ */ function() {
|
|
183
|
+
return __component__.exports;
|
|
184
|
+
}();
|
|
185
|
+
|
|
186
|
+
export { pc as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentinyvue/vue-image-viewer",
|
|
3
|
+
"version": "2.21.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./lib/index.js",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"type": "module",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@opentinyvue/vue-common": "~2.21.0",
|
|
11
|
+
"@opentinyvue/vue-icon": "~2.21.0",
|
|
12
|
+
"@opentinyvue/vue-renderless": "~3.21.0",
|
|
13
|
+
"@opentinyvue/vue-dropdown": "~2.21.0",
|
|
14
|
+
"@opentinyvue/vue-dropdown-menu": "~2.21.0",
|
|
15
|
+
"@opentinyvue/vue-dropdown-item": "~2.21.0",
|
|
16
|
+
"@opentinyvue/vue-action-sheet": "~2.21.0",
|
|
17
|
+
"@opentinyvue/vue-theme-mobile": "~3.21.0",
|
|
18
|
+
"@opentinyvue/vue-theme": "~3.21.0"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"types": "index.d.ts",
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "pnpm -w build:ui $npm_package_name",
|
|
24
|
+
"//postversion": "pnpm build"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/index.d.ts
ADDED
package/src/pc.vue.d.ts
ADDED