@nutui/nutui 4.0.12-beta.1 → 4.0.12
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/nutui.es.js +1 -1
- package/dist/nutui.js +1 -1
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +50 -50
- package/dist/styles/themes/jdb.scss +50 -50
- package/dist/styles/themes/jddkh.scss +50 -50
- package/dist/styles/themes/jdt.scss +50 -50
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,40 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __pow = Math.pow;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __publicField = (obj, key, value) => {
|
|
22
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
23
|
+
return value;
|
|
24
|
+
};
|
|
25
|
+
import { reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, createElementBlock, createCommentVNode, ref, onMounted, Fragment, renderList, toDisplayString, normalizeClass, renderSlot, createVNode, nextTick, h } from "vue";
|
|
26
|
+
import { c as createComponent, e as clamp, d as preventDefault, i as isArray } from "./component-81a4c1d0.js";
|
|
27
|
+
import { u as useRect } from "./index-29892cda.js";
|
|
28
|
+
import { u as useTouch } from "./index-7a7385e4.js";
|
|
29
|
+
import Video from "./Video.js";
|
|
30
|
+
import SwiperItem from "./SwiperItem.js";
|
|
31
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
32
|
+
import { CircleClose } from "@nutui/icons-vue";
|
|
33
|
+
import { P as Popup } from "./index-da0a7662.js";
|
|
34
|
+
import Swiper from "./Swiper.js";
|
|
35
|
+
import { f as funInterceptor } from "./Interceptor-956b24fc.js";
|
|
25
36
|
import "../locale/lang";
|
|
26
|
-
import { C as
|
|
27
|
-
import
|
|
28
|
-
import "./index-
|
|
29
|
-
import "./raf-
|
|
30
|
-
const
|
|
31
|
-
show: { type: Boolean, default:
|
|
37
|
+
import { C as CreateComponent } from "./mountComponent-8b24c346.js";
|
|
38
|
+
import Overlay from "./Overlay.js";
|
|
39
|
+
import "./index-79c5dc33.js";
|
|
40
|
+
import "./raf-729dad54.js";
|
|
41
|
+
const baseProps = {
|
|
42
|
+
show: { type: Boolean, default: false },
|
|
32
43
|
initNo: { type: Number, default: 0 },
|
|
33
|
-
showIndex: { type: Boolean, default:
|
|
44
|
+
showIndex: { type: Boolean, default: true },
|
|
34
45
|
minZoom: { type: Number, default: 1 / 3 },
|
|
35
46
|
maxZoom: { type: Number, default: 3 }
|
|
36
|
-
}
|
|
37
|
-
|
|
47
|
+
};
|
|
48
|
+
const { create: create$1 } = createComponent("image-preview-item");
|
|
49
|
+
const _sfc_main$1 = create$1({
|
|
50
|
+
props: __spreadProps(__spreadValues({}, baseProps), {
|
|
38
51
|
image: {
|
|
39
52
|
type: Object,
|
|
40
53
|
default: () => ({})
|
|
@@ -53,150 +66,253 @@ const x = {
|
|
|
53
66
|
},
|
|
54
67
|
contentClose: {
|
|
55
68
|
type: Boolean,
|
|
56
|
-
default:
|
|
69
|
+
default: true
|
|
57
70
|
}
|
|
58
71
|
}),
|
|
59
72
|
emits: ["close", "scale"],
|
|
60
73
|
components: {
|
|
61
|
-
[
|
|
62
|
-
[
|
|
74
|
+
[Video.name]: Video,
|
|
75
|
+
[SwiperItem.name]: SwiperItem
|
|
63
76
|
},
|
|
64
|
-
setup(
|
|
65
|
-
const
|
|
77
|
+
setup(props, { emit }) {
|
|
78
|
+
const state = reactive({
|
|
66
79
|
scale: 1,
|
|
67
80
|
moveX: 0,
|
|
68
81
|
moveY: 0,
|
|
69
|
-
moving:
|
|
70
|
-
zooming:
|
|
82
|
+
moving: false,
|
|
83
|
+
zooming: false,
|
|
71
84
|
imageRatio: 0,
|
|
72
85
|
displayWidth: 0,
|
|
73
86
|
displayHeight: 0
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
});
|
|
88
|
+
const touch = useTouch();
|
|
89
|
+
const vertical = computed(() => {
|
|
90
|
+
const { rootWidth, rootHeight } = props;
|
|
91
|
+
const rootRatio = rootHeight / rootWidth;
|
|
92
|
+
return state.imageRatio > rootRatio;
|
|
93
|
+
});
|
|
94
|
+
const imageStyle = computed(() => {
|
|
95
|
+
const images = props.image;
|
|
96
|
+
if (images && images.src) {
|
|
97
|
+
const { scale, moveX, moveY, moving, zooming } = state;
|
|
98
|
+
const style = {
|
|
99
|
+
transitionDuration: zooming || moving ? "0s" : ".3s"
|
|
82
100
|
};
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
|
|
101
|
+
if (scale !== 1) {
|
|
102
|
+
const offsetX = moveX / scale;
|
|
103
|
+
const offsetY = moveY / scale;
|
|
104
|
+
style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
|
|
86
105
|
}
|
|
87
|
-
return
|
|
106
|
+
return style;
|
|
88
107
|
}
|
|
89
108
|
return {};
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
});
|
|
110
|
+
const maxMoveX = computed(() => {
|
|
111
|
+
if (state.imageRatio) {
|
|
112
|
+
const { rootWidth, rootHeight } = props;
|
|
113
|
+
const displayWidth = vertical.value ? rootHeight / state.imageRatio : rootWidth;
|
|
114
|
+
return Math.max(0, (state.scale * displayWidth - rootWidth) / 2);
|
|
94
115
|
}
|
|
95
116
|
return 0;
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
});
|
|
118
|
+
const maxMoveY = computed(() => {
|
|
119
|
+
if (state.imageRatio) {
|
|
120
|
+
const { rootWidth, rootHeight } = props;
|
|
121
|
+
const displayHeight = vertical.value ? rootHeight : rootWidth * state.imageRatio;
|
|
122
|
+
return Math.max(0, (state.scale * displayHeight - rootHeight) / 2);
|
|
100
123
|
}
|
|
101
124
|
return 0;
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}, te = (n) => {
|
|
121
|
-
const { touches: s } = n;
|
|
122
|
-
if (a.move(n), (o.moving || o.zooming) && U(n, !0), o.moving) {
|
|
123
|
-
const { deltaX: r, deltaY: f } = a, h = r.value + X, z = f.value + Y;
|
|
124
|
-
o.moveX = $(h, -c.value, c.value), o.moveY = $(z, -u.value, u.value);
|
|
125
|
+
});
|
|
126
|
+
const imageLoad = (event) => {
|
|
127
|
+
const { naturalWidth, naturalHeight } = event.target;
|
|
128
|
+
state.imageRatio = naturalHeight / naturalWidth;
|
|
129
|
+
};
|
|
130
|
+
const resetScale = () => {
|
|
131
|
+
setScale(1);
|
|
132
|
+
state.moveX = 0;
|
|
133
|
+
state.moveY = 0;
|
|
134
|
+
};
|
|
135
|
+
const setScale = (scale) => {
|
|
136
|
+
scale = clamp(scale, +props.minZoom, +props.maxZoom + 1);
|
|
137
|
+
if (scale !== state.scale) {
|
|
138
|
+
state.scale = scale;
|
|
139
|
+
emit("scale", {
|
|
140
|
+
scale,
|
|
141
|
+
index: props.initNo
|
|
142
|
+
});
|
|
125
143
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
144
|
+
};
|
|
145
|
+
const toggleScale = () => {
|
|
146
|
+
const scale = state.scale > 1 ? 1 : 2;
|
|
147
|
+
setScale(scale);
|
|
148
|
+
state.moveX = 0;
|
|
149
|
+
state.moveY = 0;
|
|
150
|
+
};
|
|
151
|
+
const getDistance = (touches) => Math.sqrt(__pow(touches[0].clientX - touches[1].clientX, 2) + __pow(touches[0].clientY - touches[1].clientY, 2));
|
|
152
|
+
let startMoveX;
|
|
153
|
+
let startMoveY;
|
|
154
|
+
let startScale;
|
|
155
|
+
let startDistance;
|
|
156
|
+
let doubleTapTimer;
|
|
157
|
+
let touchStartTime;
|
|
158
|
+
let fingerNum;
|
|
159
|
+
const onTouchStart = (event) => {
|
|
160
|
+
const { touches } = event;
|
|
161
|
+
const { offsetX } = touch;
|
|
162
|
+
touch.start(event);
|
|
163
|
+
fingerNum = touches.length;
|
|
164
|
+
startMoveX = state.moveX;
|
|
165
|
+
startMoveY = state.moveY;
|
|
166
|
+
touchStartTime = Date.now();
|
|
167
|
+
state.moving = fingerNum === 1 && state.scale !== 1;
|
|
168
|
+
state.zooming = fingerNum === 2 && !offsetX.value;
|
|
169
|
+
if (state.zooming) {
|
|
170
|
+
startScale = state.scale;
|
|
171
|
+
startDistance = getDistance(event.touches);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const onTouchMove = (event) => {
|
|
175
|
+
const { touches } = event;
|
|
176
|
+
touch.move(event);
|
|
177
|
+
if (state.moving || state.zooming) {
|
|
178
|
+
preventDefault(event, true);
|
|
179
|
+
}
|
|
180
|
+
if (state.moving) {
|
|
181
|
+
const { deltaX, deltaY } = touch;
|
|
182
|
+
const moveX = deltaX.value + startMoveX;
|
|
183
|
+
const moveY = deltaY.value + startMoveY;
|
|
184
|
+
state.moveX = clamp(moveX, -maxMoveX.value, maxMoveX.value);
|
|
185
|
+
state.moveY = clamp(moveY, -maxMoveY.value, maxMoveY.value);
|
|
186
|
+
}
|
|
187
|
+
if (state.zooming && touches.length === 2) {
|
|
188
|
+
const distance = getDistance(touches);
|
|
189
|
+
const scale = startScale * distance / startDistance;
|
|
190
|
+
setScale(scale);
|
|
129
191
|
}
|
|
130
|
-
}
|
|
131
|
-
|
|
192
|
+
};
|
|
193
|
+
const checkTap = () => {
|
|
194
|
+
if (fingerNum == 1 && props.video && props.video.source) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (fingerNum > 1) {
|
|
132
198
|
return;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
199
|
+
}
|
|
200
|
+
const { offsetX, offsetY } = touch;
|
|
201
|
+
const deltaTime = Date.now() - touchStartTime;
|
|
202
|
+
const TAP_TIME = 250;
|
|
203
|
+
const TAP_OFFSET = 5;
|
|
204
|
+
if (offsetX.value < TAP_OFFSET && offsetY.value < TAP_OFFSET && deltaTime < TAP_TIME) {
|
|
205
|
+
if (doubleTapTimer) {
|
|
206
|
+
clearTimeout(doubleTapTimer);
|
|
207
|
+
doubleTapTimer = null;
|
|
208
|
+
toggleScale();
|
|
209
|
+
} else {
|
|
210
|
+
doubleTapTimer = setTimeout(() => {
|
|
211
|
+
if (props.contentClose) {
|
|
212
|
+
emit("close");
|
|
213
|
+
}
|
|
214
|
+
doubleTapTimer = null;
|
|
215
|
+
}, TAP_TIME);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
142
218
|
};
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
(
|
|
146
|
-
|
|
219
|
+
const onTouchEnd = (event) => {
|
|
220
|
+
let stopPropagation = false;
|
|
221
|
+
if (state.moving || state.zooming) {
|
|
222
|
+
stopPropagation = true;
|
|
223
|
+
if (state.moving && startMoveX === state.moveX && startMoveY === state.moveY) {
|
|
224
|
+
stopPropagation = false;
|
|
225
|
+
}
|
|
226
|
+
if (!event.touches.length) {
|
|
227
|
+
if (state.zooming) {
|
|
228
|
+
state.moveX = clamp(state.moveX, -maxMoveX.value, maxMoveX.value);
|
|
229
|
+
state.moveY = clamp(state.moveY, -maxMoveY.value, maxMoveY.value);
|
|
230
|
+
state.zooming = false;
|
|
231
|
+
}
|
|
232
|
+
state.moving = false;
|
|
233
|
+
startMoveX = 0;
|
|
234
|
+
startMoveY = 0;
|
|
235
|
+
startScale = 1;
|
|
236
|
+
if (state.scale < 1) {
|
|
237
|
+
resetScale();
|
|
238
|
+
}
|
|
239
|
+
if (state.scale > props.maxZoom) {
|
|
240
|
+
state.scale = +props.maxZoom;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
147
243
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
244
|
+
preventDefault(event, stopPropagation);
|
|
245
|
+
checkTap();
|
|
246
|
+
touch.reset();
|
|
247
|
+
};
|
|
248
|
+
const closeSwiper = () => {
|
|
249
|
+
emit("close");
|
|
250
|
+
};
|
|
251
|
+
watch(() => props.initNo, resetScale);
|
|
252
|
+
watch(
|
|
253
|
+
() => props.show,
|
|
254
|
+
(value) => {
|
|
255
|
+
if (!value) {
|
|
256
|
+
resetScale();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
return __spreadProps(__spreadValues({}, toRefs(state)), {
|
|
261
|
+
onTouchStart,
|
|
262
|
+
onTouchMove,
|
|
263
|
+
onTouchEnd,
|
|
264
|
+
getDistance,
|
|
265
|
+
imageStyle,
|
|
266
|
+
imageLoad,
|
|
267
|
+
closeSwiper
|
|
156
268
|
});
|
|
157
269
|
}
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
270
|
+
});
|
|
271
|
+
const _hoisted_1$1 = ["src"];
|
|
272
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
273
|
+
const _component_nut_video = resolveComponent("nut-video");
|
|
274
|
+
const _component_nut_swiper_item = resolveComponent("nut-swiper-item");
|
|
275
|
+
return openBlock(), createBlock(_component_nut_swiper_item, { onClick: _ctx.closeSwiper }, {
|
|
276
|
+
default: withCtx(() => [
|
|
277
|
+
createElementVNode("view", {
|
|
278
|
+
style: normalizeStyle(_ctx.imageStyle),
|
|
165
279
|
class: "nut-image-preview-box",
|
|
166
|
-
onTouchstart:
|
|
167
|
-
onTouchmove:
|
|
168
|
-
onTouchend:
|
|
169
|
-
onTouchcancel:
|
|
280
|
+
onTouchstart: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
|
|
281
|
+
onTouchmove: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
|
|
282
|
+
onTouchend: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
|
|
283
|
+
onTouchcancel: _cache[4] || (_cache[4] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
|
|
170
284
|
}, [
|
|
171
|
-
|
|
285
|
+
_ctx.image && _ctx.image.src ? (openBlock(), createElementBlock("img", {
|
|
172
286
|
key: 0,
|
|
173
|
-
src:
|
|
287
|
+
src: _ctx.image.src,
|
|
174
288
|
class: "nut-image-preview-img",
|
|
175
|
-
onLoad:
|
|
176
|
-
}, null, 40,
|
|
177
|
-
|
|
289
|
+
onLoad: _cache[0] || (_cache[0] = (...args) => _ctx.imageLoad && _ctx.imageLoad(...args))
|
|
290
|
+
}, null, 40, _hoisted_1$1)) : createCommentVNode("", true),
|
|
291
|
+
_ctx.video && _ctx.video.source ? (openBlock(), createBlock(_component_nut_video, {
|
|
178
292
|
key: 1,
|
|
179
|
-
source:
|
|
180
|
-
options:
|
|
181
|
-
}, null, 8, ["source", "options"])) :
|
|
293
|
+
source: _ctx.video.source,
|
|
294
|
+
options: _ctx.video.options
|
|
295
|
+
}, null, 8, ["source", "options"])) : createCommentVNode("", true)
|
|
182
296
|
], 36)
|
|
183
297
|
]),
|
|
184
298
|
_: 1
|
|
185
299
|
}, 8, ["onClick"]);
|
|
186
300
|
}
|
|
187
|
-
const
|
|
188
|
-
|
|
301
|
+
const ImagePreviewItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
302
|
+
const { create } = createComponent("image-preview");
|
|
303
|
+
const _sfc_main = create({
|
|
304
|
+
props: __spreadProps(__spreadValues({}, baseProps), {
|
|
189
305
|
images: { type: Array, default: () => [] },
|
|
190
306
|
videos: { type: Array, default: () => [] },
|
|
191
|
-
contentClose: { type: Boolean, default:
|
|
192
|
-
paginationVisible: { type: Boolean, default:
|
|
307
|
+
contentClose: { type: Boolean, default: true },
|
|
308
|
+
paginationVisible: { type: Boolean, default: false },
|
|
193
309
|
paginationColor: { type: String, default: "#fff" },
|
|
194
310
|
autoplay: { type: [Number, String], default: 0 },
|
|
195
311
|
teleport: { type: [String, Element], default: "body" },
|
|
196
|
-
teleportDisable: { ype: Boolean, default:
|
|
312
|
+
teleportDisable: { ype: Boolean, default: false },
|
|
197
313
|
closeable: {
|
|
198
314
|
type: Boolean,
|
|
199
|
-
default:
|
|
315
|
+
default: false
|
|
200
316
|
},
|
|
201
317
|
closeIconPosition: {
|
|
202
318
|
type: String,
|
|
@@ -206,172 +322,212 @@ const ze = /* @__PURE__ */ _(Ze, [["render", We]]), { create: He } = Q("image-pr
|
|
|
206
322
|
beforeClose: Function,
|
|
207
323
|
isLoop: {
|
|
208
324
|
type: Boolean,
|
|
209
|
-
default:
|
|
325
|
+
default: true
|
|
210
326
|
}
|
|
211
327
|
}),
|
|
212
328
|
emits: ["close", "change"],
|
|
213
329
|
components: {
|
|
214
|
-
ImagePreviewItem
|
|
215
|
-
CircleClose
|
|
216
|
-
[
|
|
217
|
-
[
|
|
330
|
+
ImagePreviewItem,
|
|
331
|
+
CircleClose,
|
|
332
|
+
[Popup.name]: Popup,
|
|
333
|
+
[Swiper.name]: Swiper
|
|
218
334
|
},
|
|
219
|
-
setup(
|
|
220
|
-
const
|
|
221
|
-
|
|
335
|
+
setup(props, { emit }) {
|
|
336
|
+
const swipeRef = ref();
|
|
337
|
+
const state = reactive({
|
|
338
|
+
showPop: props.show,
|
|
222
339
|
active: 0,
|
|
223
340
|
rootWidth: 0,
|
|
224
341
|
rootHeight: 0
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
342
|
+
});
|
|
343
|
+
const iconClasses = computed(() => {
|
|
344
|
+
const pre = "nut-image-preview-close";
|
|
345
|
+
const iconn = props.closeIconPosition == "top-right" ? `${pre}-right` : `${pre}-left`;
|
|
346
|
+
return `nut-image-preview-close-icon ${iconn}`;
|
|
347
|
+
});
|
|
348
|
+
const mergeImages = computed(() => {
|
|
349
|
+
if (isArray(props.videos)) {
|
|
350
|
+
return [].concat(props.videos).concat(props.images);
|
|
351
|
+
}
|
|
352
|
+
return props.images;
|
|
353
|
+
});
|
|
354
|
+
const setActive = (active) => {
|
|
355
|
+
if (active !== state.active) {
|
|
356
|
+
state.active = active;
|
|
357
|
+
emit("change", state.active);
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
const onClose = () => {
|
|
361
|
+
funInterceptor(props.beforeClose, {
|
|
362
|
+
args: [state.active],
|
|
363
|
+
done: () => closeDone()
|
|
234
364
|
});
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
365
|
+
};
|
|
366
|
+
const closeDone = () => {
|
|
367
|
+
state.showPop = false;
|
|
368
|
+
emit("close");
|
|
369
|
+
};
|
|
370
|
+
const init = () => {
|
|
371
|
+
if (swipeRef.value) {
|
|
372
|
+
const rect = useRect(swipeRef.value);
|
|
373
|
+
state.rootHeight = rect.height;
|
|
374
|
+
state.rootWidth = rect.width;
|
|
241
375
|
}
|
|
242
376
|
};
|
|
243
|
-
|
|
244
|
-
() =>
|
|
245
|
-
(
|
|
246
|
-
|
|
377
|
+
watch(
|
|
378
|
+
() => props.show,
|
|
379
|
+
(val) => {
|
|
380
|
+
state.showPop = val;
|
|
381
|
+
if (val) {
|
|
382
|
+
setActive(props.initNo);
|
|
383
|
+
init();
|
|
384
|
+
}
|
|
247
385
|
}
|
|
248
|
-
)
|
|
249
|
-
|
|
250
|
-
(
|
|
251
|
-
|
|
386
|
+
);
|
|
387
|
+
watch(
|
|
388
|
+
() => props.initNo,
|
|
389
|
+
(val) => {
|
|
390
|
+
if (val != state.active)
|
|
391
|
+
setActive(val);
|
|
252
392
|
}
|
|
253
|
-
)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
393
|
+
);
|
|
394
|
+
onMounted(() => {
|
|
395
|
+
setActive(props.initNo);
|
|
396
|
+
});
|
|
397
|
+
return __spreadProps(__spreadValues({
|
|
398
|
+
swipeRef
|
|
399
|
+
}, toRefs(state)), {
|
|
400
|
+
onClose,
|
|
401
|
+
mergeImages,
|
|
402
|
+
setActive,
|
|
403
|
+
iconClasses
|
|
262
404
|
});
|
|
263
405
|
}
|
|
264
|
-
})
|
|
406
|
+
});
|
|
407
|
+
const _hoisted_1 = {
|
|
265
408
|
class: "nut-image-preview",
|
|
266
409
|
ref: "swipeRef"
|
|
267
|
-
}
|
|
410
|
+
};
|
|
411
|
+
const _hoisted_2 = {
|
|
268
412
|
key: 0,
|
|
269
413
|
class: "nut-image-preview-index"
|
|
270
414
|
};
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
|
|
415
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
416
|
+
const _component_image_preview_item = resolveComponent("image-preview-item");
|
|
417
|
+
const _component_nut_swiper = resolveComponent("nut-swiper");
|
|
418
|
+
const _component_CircleClose = resolveComponent("CircleClose");
|
|
419
|
+
const _component_nut_popup = resolveComponent("nut-popup");
|
|
420
|
+
return openBlock(), createBlock(_component_nut_popup, {
|
|
274
421
|
"pop-class": "nut-image-preview-custom-pop",
|
|
275
|
-
visible:
|
|
276
|
-
"onUpdate:visible":
|
|
277
|
-
teleportDisable:
|
|
278
|
-
teleport:
|
|
279
|
-
onClosed:
|
|
422
|
+
visible: _ctx.showPop,
|
|
423
|
+
"onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPop = $event),
|
|
424
|
+
teleportDisable: _ctx.teleportDisable,
|
|
425
|
+
teleport: _ctx.teleport,
|
|
426
|
+
onClosed: _ctx.onClose,
|
|
280
427
|
"lock-scroll": ""
|
|
281
428
|
}, {
|
|
282
|
-
default:
|
|
283
|
-
|
|
284
|
-
|
|
429
|
+
default: withCtx(() => [
|
|
430
|
+
createElementVNode("view", _hoisted_1, [
|
|
431
|
+
_ctx.showPop ? (openBlock(), createBlock(_component_nut_swiper, {
|
|
285
432
|
key: 0,
|
|
286
|
-
"auto-play":
|
|
433
|
+
"auto-play": _ctx.autoplay,
|
|
287
434
|
class: "nut-image-preview-swiper",
|
|
288
|
-
loop:
|
|
289
|
-
"is-preventDefault":
|
|
435
|
+
loop: _ctx.isLoop,
|
|
436
|
+
"is-preventDefault": false,
|
|
290
437
|
direction: "horizontal",
|
|
291
|
-
onChange:
|
|
292
|
-
"init-page":
|
|
293
|
-
"pagination-visible":
|
|
294
|
-
"pagination-color":
|
|
438
|
+
onChange: _ctx.setActive,
|
|
439
|
+
"init-page": _ctx.initNo,
|
|
440
|
+
"pagination-visible": _ctx.paginationVisible,
|
|
441
|
+
"pagination-color": _ctx.paginationColor
|
|
295
442
|
}, {
|
|
296
|
-
default:
|
|
297
|
-
(
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
443
|
+
default: withCtx(() => [
|
|
444
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.mergeImages, (item, index) => {
|
|
445
|
+
return openBlock(), createBlock(_component_image_preview_item, {
|
|
446
|
+
key: index,
|
|
447
|
+
video: index < _ctx.videos.length ? item : {},
|
|
448
|
+
image: index >= _ctx.videos.length ? item : {},
|
|
449
|
+
rootHeight: _ctx.rootHeight,
|
|
450
|
+
rootWidth: _ctx.rootWidth,
|
|
451
|
+
show: _ctx.showPop,
|
|
452
|
+
"init-no": _ctx.active + 1,
|
|
453
|
+
onClose: _ctx.onClose,
|
|
454
|
+
"content-close": _ctx.contentClose,
|
|
455
|
+
maxZoom: _ctx.maxZoom,
|
|
456
|
+
minZoom: _ctx.minZoom
|
|
457
|
+
}, null, 8, ["video", "image", "rootHeight", "rootWidth", "show", "init-no", "onClose", "content-close", "maxZoom", "minZoom"]);
|
|
458
|
+
}), 128))
|
|
310
459
|
]),
|
|
311
460
|
_: 1
|
|
312
|
-
}, 8, ["auto-play", "loop", "onChange", "init-page", "pagination-visible", "pagination-color"])) :
|
|
461
|
+
}, 8, ["auto-play", "loop", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
|
|
313
462
|
], 512),
|
|
314
|
-
|
|
315
|
-
|
|
463
|
+
_ctx.showIndex ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.active + 1) + " / " + toDisplayString(_ctx.mergeImages.length), 1)) : createCommentVNode("", true),
|
|
464
|
+
_ctx.closeable ? (openBlock(), createElementBlock("view", {
|
|
316
465
|
key: 1,
|
|
317
|
-
class:
|
|
318
|
-
onClick:
|
|
466
|
+
class: normalizeClass(_ctx.iconClasses),
|
|
467
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClose && _ctx.onClose(...args))
|
|
319
468
|
}, [
|
|
320
|
-
|
|
321
|
-
|
|
469
|
+
renderSlot(_ctx.$slots, "close-icon", {}, () => [
|
|
470
|
+
createVNode(_component_CircleClose, { color: "#ffffff" })
|
|
322
471
|
])
|
|
323
|
-
], 2)) :
|
|
472
|
+
], 2)) : createCommentVNode("", true)
|
|
324
473
|
]),
|
|
325
474
|
_: 3
|
|
326
475
|
}, 8, ["visible", "teleportDisable", "teleport", "onClosed"]);
|
|
327
476
|
}
|
|
328
|
-
const
|
|
329
|
-
class
|
|
477
|
+
const ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
478
|
+
class ImagePreviewOptions {
|
|
330
479
|
constructor() {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
480
|
+
__publicField(this, "show", false);
|
|
481
|
+
__publicField(this, "images", []);
|
|
482
|
+
__publicField(this, "videos", []);
|
|
483
|
+
__publicField(this, "contentClose", true);
|
|
484
|
+
__publicField(this, "initNo", 0);
|
|
485
|
+
__publicField(this, "paginationVisible", false);
|
|
486
|
+
__publicField(this, "paginationColor", "");
|
|
487
|
+
__publicField(this, "autoplay", 0);
|
|
488
|
+
__publicField(this, "isWrapTeleport", false);
|
|
489
|
+
__publicField(this, "showIndex", true);
|
|
490
|
+
__publicField(this, "closeable", false);
|
|
491
|
+
__publicField(this, "closeIcon", "circle-close");
|
|
492
|
+
__publicField(this, "closeIconPosition", "top-right");
|
|
493
|
+
__publicField(this, "beforeClose");
|
|
494
|
+
__publicField(this, "maxZoom", 3);
|
|
495
|
+
__publicField(this, "minZoom", 1 / 3);
|
|
496
|
+
__publicField(this, "isLoop", true);
|
|
497
|
+
__publicField(this, "teleport", "body");
|
|
349
498
|
}
|
|
350
499
|
}
|
|
351
|
-
class
|
|
352
|
-
constructor(
|
|
353
|
-
|
|
354
|
-
const
|
|
500
|
+
class ImagePreviewFunction {
|
|
501
|
+
constructor(_options) {
|
|
502
|
+
__publicField(this, "options", new ImagePreviewOptions());
|
|
503
|
+
const options = Object.assign(this.options, _options);
|
|
504
|
+
const { unmount } = CreateComponent(options, {
|
|
355
505
|
name: "image-preview",
|
|
356
|
-
components: [
|
|
357
|
-
wrapper: () =>
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
506
|
+
components: [Popup, Video, Swiper, SwiperItem, Overlay],
|
|
507
|
+
wrapper: () => {
|
|
508
|
+
return {
|
|
509
|
+
setup() {
|
|
510
|
+
return () => {
|
|
511
|
+
options.onClose = () => {
|
|
512
|
+
options.show = false;
|
|
513
|
+
nextTick(() => {
|
|
514
|
+
unmount();
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
return h(ImagePreview, options);
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
366
522
|
});
|
|
367
523
|
}
|
|
368
524
|
}
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
525
|
+
const showImagePreview = (options) => new ImagePreviewFunction(options);
|
|
526
|
+
showImagePreview.install = (app) => {
|
|
527
|
+
app.use(ImagePreview);
|
|
372
528
|
};
|
|
373
529
|
export {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
530
|
+
ImagePreviewOptions,
|
|
531
|
+
ImagePreview as default,
|
|
532
|
+
showImagePreview
|
|
377
533
|
};
|