@nutui/nutui 4.0.10-beta.1 → 4.0.11

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +6316 -7237
  4. package/dist/nutui.umd.js +1 -1
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +95 -150
  59. package/dist/packages/_es/MenuItem.js +109 -154
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -437
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +123 -174
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/smartips/web-types.json +1 -1
  126. package/dist/style.css +1 -1
  127. package/dist/styles/themes/default.scss +148 -45
  128. package/dist/styles/themes/jdb.scss +148 -45
  129. package/dist/styles/themes/jddkh.scss +148 -45
  130. package/dist/styles/themes/jdt.scss +148 -45
  131. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  132. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  133. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  135. package/dist/types/__VUE/searchbar/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  138. package/dist/types/__VUE/table/common.d.ts +55 -2
  139. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  141. package/dist/types/index.d.ts +1 -1
  142. package/package.json +2 -2
  143. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  144. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  145. package/dist/packages/_es/common-b9a5e726.js +0 -145
  146. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  147. package/dist/packages/_es/index-29892cda.js +0 -33
  148. package/dist/packages/_es/index-43c34ac6.js +0 -30
  149. package/dist/packages/_es/index-54d03fc1.js +0 -8
  150. package/dist/packages/_es/index-79c5dc33.js +0 -10
  151. package/dist/packages/_es/index-7a7385e4.js +0 -67
  152. package/dist/packages/_es/index-87422be8.js +0 -942
  153. package/dist/packages/_es/index-da0a7662.js +0 -259
  154. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  155. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  156. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  157. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  158. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  159. package/dist/packages/_es/raf-729dad54.js +0 -25
  160. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,53 +1,40 @@
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";
1
+ var re = Object.defineProperty, me = Object.defineProperties;
2
+ var ce = Object.getOwnPropertyDescriptors;
3
+ var j = Object.getOwnPropertySymbols;
4
+ var ue = Object.prototype.hasOwnProperty, pe = Object.prototype.propertyIsEnumerable;
5
+ var M = Math.pow, H = (e, t, o) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, S = (e, t) => {
6
+ for (var o in t || (t = {}))
7
+ ue.call(t, o) && H(e, o, t[o]);
8
+ if (j)
9
+ for (var o of j(t))
10
+ pe.call(t, o) && H(e, o, t[o]);
11
+ return e;
12
+ }, P = (e, t) => me(e, ce(t));
13
+ var l = (e, t, o) => (H(e, typeof t != "symbol" ? t + "" : t, o), o);
14
+ import { reactive as G, computed as w, watch as Z, toRefs as J, resolveComponent as y, openBlock as p, createBlock as I, withCtx as R, createElementVNode as K, normalizeStyle as fe, createElementBlock as k, createCommentVNode as N, ref as ge, onMounted as ve, Fragment as de, renderList as he, toDisplayString as q, normalizeClass as we, renderSlot as ye, createVNode as Ce, nextTick as be, h as Te } from "vue";
15
+ import { c as Q, e as $, d as U, i as Se } from "./component-234624bc.js";
16
+ import { u as Pe } from "./index-192a3ef6.js";
17
+ import { u as $e } from "./index-53ec2d4d.js";
18
+ import B from "./Video.js";
19
+ import E from "./SwiperItem.js";
20
+ import { _ } from "./_plugin-vue_export-helper-dad06003.js";
21
+ import { CircleClose as Ie } from "@nutui/icons-vue";
22
+ import { P as L } from "./index-360c5092.js";
23
+ import A from "./Swiper.js";
24
+ import { f as Ne } from "./Interceptor-6e26b757.js";
36
25
  import "../locale/lang";
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 },
26
+ import { C as Xe } from "./mountComponent-6d4ff200.js";
27
+ import Ye from "./Overlay.js";
28
+ import "./index-fadb0974.js";
29
+ import "./raf-a74f1a06.js";
30
+ const x = {
31
+ show: { type: Boolean, default: !1 },
43
32
  initNo: { type: Number, default: 0 },
44
- showIndex: { type: Boolean, default: true },
33
+ showIndex: { type: Boolean, default: !0 },
45
34
  minZoom: { type: Number, default: 1 / 3 },
46
35
  maxZoom: { type: Number, default: 3 }
47
- };
48
- const { create: create$1 } = createComponent("image-preview-item");
49
- const _sfc_main$1 = create$1({
50
- props: __spreadProps(__spreadValues({}, baseProps), {
36
+ }, { create: ke } = Q("image-preview-item"), Ze = ke({
37
+ props: P(S({}, x), {
51
38
  image: {
52
39
  type: Object,
53
40
  default: () => ({})
@@ -66,253 +53,150 @@ const _sfc_main$1 = create$1({
66
53
  },
67
54
  contentClose: {
68
55
  type: Boolean,
69
- default: true
56
+ default: !0
70
57
  }
71
58
  }),
72
59
  emits: ["close", "scale"],
73
60
  components: {
74
- [Video.name]: Video,
75
- [SwiperItem.name]: SwiperItem
61
+ [B.name]: B,
62
+ [E.name]: E
76
63
  },
77
- setup(props, { emit }) {
78
- const state = reactive({
64
+ setup(e, { emit: t }) {
65
+ const o = G({
79
66
  scale: 1,
80
67
  moveX: 0,
81
68
  moveY: 0,
82
- moving: false,
83
- zooming: false,
69
+ moving: !1,
70
+ zooming: !1,
84
71
  imageRatio: 0,
85
72
  displayWidth: 0,
86
73
  displayHeight: 0
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"
74
+ }), a = $e(), v = w(() => {
75
+ const { rootWidth: n, rootHeight: s } = e, r = s / n;
76
+ return o.imageRatio > r;
77
+ }), C = w(() => {
78
+ const n = e.image;
79
+ if (n && n.src) {
80
+ const { scale: s, moveX: r, moveY: f, moving: h, zooming: z } = o, F = {
81
+ transitionDuration: z || h ? "0s" : ".3s"
100
82
  };
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)`;
83
+ if (s !== 1) {
84
+ const ae = r / s, le = f / s;
85
+ F.transform = `scale(${s}, ${s}) translate(${ae}px, ${le}px)`;
105
86
  }
106
- return style;
87
+ return F;
107
88
  }
108
89
  return {};
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);
90
+ }), c = w(() => {
91
+ if (o.imageRatio) {
92
+ const { rootWidth: n, rootHeight: s } = e, r = v.value ? s / o.imageRatio : n;
93
+ return Math.max(0, (o.scale * r - n) / 2);
115
94
  }
116
95
  return 0;
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);
96
+ }), u = w(() => {
97
+ if (o.imageRatio) {
98
+ const { rootWidth: n, rootHeight: s } = e, r = v.value ? s : n * o.imageRatio;
99
+ return Math.max(0, (o.scale * r - s) / 2);
123
100
  }
124
101
  return 0;
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
- });
102
+ }), m = (n) => {
103
+ const { naturalWidth: s, naturalHeight: r } = n.target;
104
+ o.imageRatio = r / s;
105
+ }, g = () => {
106
+ i(1), o.moveX = 0, o.moveY = 0;
107
+ }, i = (n) => {
108
+ n = $(n, +e.minZoom, +e.maxZoom + 1), n !== o.scale && (o.scale = n, t("scale", {
109
+ scale: n,
110
+ index: e.initNo
111
+ }));
112
+ }, d = () => {
113
+ const n = o.scale > 1 ? 1 : 2;
114
+ i(n), o.moveX = 0, o.moveY = 0;
115
+ }, D = (n) => Math.sqrt(M(n[0].clientX - n[1].clientX, 2) + M(n[0].clientY - n[1].clientY, 2));
116
+ let X, Y, W, V, b, O, T;
117
+ const oe = (n) => {
118
+ const { touches: s } = n, { offsetX: r } = a;
119
+ a.start(n), T = s.length, X = o.moveX, Y = o.moveY, O = Date.now(), o.moving = T === 1 && o.scale !== 1, o.zooming = T === 2 && !r.value, o.zooming && (W = o.scale, V = D(n.touches));
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);
143
125
  }
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);
126
+ if (o.zooming && s.length === 2) {
127
+ const r = D(s), f = W * r / V;
128
+ i(f);
191
129
  }
192
- };
193
- const checkTap = () => {
194
- if (fingerNum == 1 && props.video && props.video.source) {
195
- return;
196
- }
197
- if (fingerNum > 1) {
130
+ }, ne = () => {
131
+ if (T == 1 && e.video && e.video.source || T > 1)
198
132
  return;
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
- }
133
+ const { offsetX: n, offsetY: s } = a, r = Date.now() - O, f = 250, h = 5;
134
+ n.value < h && s.value < h && r < f && (b ? (clearTimeout(b), b = null, d()) : b = setTimeout(() => {
135
+ e.contentClose && t("close"), b = null;
136
+ }, f));
137
+ }, ie = (n) => {
138
+ let s = !1;
139
+ (o.moving || o.zooming) && (s = !0, o.moving && X === o.moveX && Y === o.moveY && (s = !1), n.touches.length || (o.zooming && (o.moveX = $(o.moveX, -c.value, c.value), o.moveY = $(o.moveY, -u.value, u.value), o.zooming = !1), o.moving = !1, X = 0, Y = 0, W = 1, o.scale < 1 && g(), o.scale > e.maxZoom && (o.scale = +e.maxZoom))), U(n, s), ne(), a.reset();
140
+ }, se = () => {
141
+ t("close");
218
142
  };
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
- }
143
+ return Z(() => e.initNo, g), Z(
144
+ () => e.show,
145
+ (n) => {
146
+ n || g();
243
147
  }
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
148
+ ), P(S({}, J(o)), {
149
+ onTouchStart: oe,
150
+ onTouchMove: te,
151
+ onTouchEnd: ie,
152
+ getDistance: D,
153
+ imageStyle: C,
154
+ imageLoad: m,
155
+ closeSwiper: se
268
156
  });
269
157
  }
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),
158
+ }), De = ["src"];
159
+ function We(e, t, o, a, v, C) {
160
+ const c = y("nut-video"), u = y("nut-swiper-item");
161
+ return p(), I(u, { onClick: e.closeSwiper }, {
162
+ default: R(() => [
163
+ K("view", {
164
+ style: fe(e.imageStyle),
279
165
  class: "nut-image-preview-box",
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))
166
+ onTouchstart: t[1] || (t[1] = (...m) => e.onTouchStart && e.onTouchStart(...m)),
167
+ onTouchmove: t[2] || (t[2] = (...m) => e.onTouchMove && e.onTouchMove(...m)),
168
+ onTouchend: t[3] || (t[3] = (...m) => e.onTouchEnd && e.onTouchEnd(...m)),
169
+ onTouchcancel: t[4] || (t[4] = (...m) => e.onTouchEnd && e.onTouchEnd(...m))
284
170
  }, [
285
- _ctx.image && _ctx.image.src ? (openBlock(), createElementBlock("img", {
171
+ e.image && e.image.src ? (p(), k("img", {
286
172
  key: 0,
287
- src: _ctx.image.src,
173
+ src: e.image.src,
288
174
  class: "nut-image-preview-img",
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, {
175
+ onLoad: t[0] || (t[0] = (...m) => e.imageLoad && e.imageLoad(...m))
176
+ }, null, 40, De)) : N("", !0),
177
+ e.video && e.video.source ? (p(), I(c, {
292
178
  key: 1,
293
- source: _ctx.video.source,
294
- options: _ctx.video.options
295
- }, null, 8, ["source", "options"])) : createCommentVNode("", true)
179
+ source: e.video.source,
180
+ options: e.video.options
181
+ }, null, 8, ["source", "options"])) : N("", !0)
296
182
  ], 36)
297
183
  ]),
298
184
  _: 1
299
185
  }, 8, ["onClick"]);
300
186
  }
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), {
187
+ const ze = /* @__PURE__ */ _(Ze, [["render", We]]), { create: He } = Q("image-preview"), Me = He({
188
+ props: P(S({}, x), {
305
189
  images: { type: Array, default: () => [] },
306
190
  videos: { type: Array, default: () => [] },
307
- contentClose: { type: Boolean, default: true },
308
- paginationVisible: { type: Boolean, default: false },
191
+ contentClose: { type: Boolean, default: !0 },
192
+ paginationVisible: { type: Boolean, default: !1 },
309
193
  paginationColor: { type: String, default: "#fff" },
310
194
  autoplay: { type: [Number, String], default: 0 },
311
195
  teleport: { type: [String, Element], default: "body" },
312
- teleportDisable: { ype: Boolean, default: false },
196
+ teleportDisable: { ype: Boolean, default: !1 },
313
197
  closeable: {
314
198
  type: Boolean,
315
- default: false
199
+ default: !1
316
200
  },
317
201
  closeIconPosition: {
318
202
  type: String,
@@ -322,212 +206,172 @@ const _sfc_main = create({
322
206
  beforeClose: Function,
323
207
  isLoop: {
324
208
  type: Boolean,
325
- default: true
209
+ default: !0
326
210
  }
327
211
  }),
328
212
  emits: ["close", "change"],
329
213
  components: {
330
- ImagePreviewItem,
331
- CircleClose,
332
- [Popup.name]: Popup,
333
- [Swiper.name]: Swiper
214
+ ImagePreviewItem: ze,
215
+ CircleClose: Ie,
216
+ [L.name]: L,
217
+ [A.name]: A
334
218
  },
335
- setup(props, { emit }) {
336
- const swipeRef = ref();
337
- const state = reactive({
338
- showPop: props.show,
219
+ setup(e, { emit: t }) {
220
+ const o = ge(), a = G({
221
+ showPop: e.show,
339
222
  active: 0,
340
223
  rootWidth: 0,
341
224
  rootHeight: 0
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()
225
+ }), v = w(() => {
226
+ const i = "nut-image-preview-close";
227
+ return `nut-image-preview-close-icon ${e.closeIconPosition == "top-right" ? `${i}-right` : `${i}-left`}`;
228
+ }), C = w(() => Se(e.videos) ? [].concat(e.videos).concat(e.images) : e.images), c = (i) => {
229
+ i !== a.active && (a.active = i, t("change", a.active));
230
+ }, u = () => {
231
+ Ne(e.beforeClose, {
232
+ args: [a.active],
233
+ done: () => m()
364
234
  });
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;
235
+ }, m = () => {
236
+ a.showPop = !1, t("close");
237
+ }, g = () => {
238
+ if (o.value) {
239
+ const i = Pe(o.value);
240
+ a.rootHeight = i.height, a.rootWidth = i.width;
375
241
  }
376
242
  };
377
- watch(
378
- () => props.show,
379
- (val) => {
380
- state.showPop = val;
381
- if (val) {
382
- setActive(props.initNo);
383
- init();
384
- }
243
+ return Z(
244
+ () => e.show,
245
+ (i) => {
246
+ a.showPop = i, i && (c(e.initNo), g());
385
247
  }
386
- );
387
- watch(
388
- () => props.initNo,
389
- (val) => {
390
- if (val != state.active)
391
- setActive(val);
248
+ ), Z(
249
+ () => e.initNo,
250
+ (i) => {
251
+ i != a.active && c(i);
392
252
  }
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
253
+ ), ve(() => {
254
+ c(e.initNo);
255
+ }), P(S({
256
+ swipeRef: o
257
+ }, J(a)), {
258
+ onClose: u,
259
+ mergeImages: C,
260
+ setActive: c,
261
+ iconClasses: v
404
262
  });
405
263
  }
406
- });
407
- const _hoisted_1 = {
264
+ }), Re = {
408
265
  class: "nut-image-preview",
409
266
  ref: "swipeRef"
410
- };
411
- const _hoisted_2 = {
267
+ }, Be = {
412
268
  key: 0,
413
269
  class: "nut-image-preview-index"
414
270
  };
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, {
271
+ function Ee(e, t, o, a, v, C) {
272
+ const c = y("image-preview-item"), u = y("nut-swiper"), m = y("CircleClose"), g = y("nut-popup");
273
+ return p(), I(g, {
421
274
  "pop-class": "nut-image-preview-custom-pop",
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,
275
+ visible: e.showPop,
276
+ "onUpdate:visible": t[1] || (t[1] = (i) => e.showPop = i),
277
+ teleportDisable: e.teleportDisable,
278
+ teleport: e.teleport,
279
+ onClosed: e.onClose,
427
280
  "lock-scroll": ""
428
281
  }, {
429
- default: withCtx(() => [
430
- createElementVNode("view", _hoisted_1, [
431
- _ctx.showPop ? (openBlock(), createBlock(_component_nut_swiper, {
282
+ default: R(() => [
283
+ K("view", Re, [
284
+ e.showPop ? (p(), I(u, {
432
285
  key: 0,
433
- "auto-play": _ctx.autoplay,
286
+ "auto-play": e.autoplay,
434
287
  class: "nut-image-preview-swiper",
435
- loop: _ctx.isLoop,
436
- "is-preventDefault": false,
288
+ loop: e.isLoop,
289
+ "is-preventDefault": !1,
437
290
  direction: "horizontal",
438
- onChange: _ctx.setActive,
439
- "init-page": _ctx.initNo,
440
- "pagination-visible": _ctx.paginationVisible,
441
- "pagination-color": _ctx.paginationColor
291
+ onChange: e.setActive,
292
+ "init-page": e.initNo,
293
+ "pagination-visible": e.paginationVisible,
294
+ "pagination-color": e.paginationColor
442
295
  }, {
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))
296
+ default: R(() => [
297
+ (p(!0), k(de, null, he(e.mergeImages, (i, d) => (p(), I(c, {
298
+ key: d,
299
+ video: d < e.videos.length ? i : {},
300
+ image: d >= e.videos.length ? i : {},
301
+ rootHeight: e.rootHeight,
302
+ rootWidth: e.rootWidth,
303
+ show: e.showPop,
304
+ "init-no": e.active + 1,
305
+ onClose: e.onClose,
306
+ "content-close": e.contentClose,
307
+ maxZoom: e.maxZoom,
308
+ minZoom: e.minZoom
309
+ }, null, 8, ["video", "image", "rootHeight", "rootWidth", "show", "init-no", "onClose", "content-close", "maxZoom", "minZoom"]))), 128))
459
310
  ]),
460
311
  _: 1
461
- }, 8, ["auto-play", "loop", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
312
+ }, 8, ["auto-play", "loop", "onChange", "init-page", "pagination-visible", "pagination-color"])) : N("", !0)
462
313
  ], 512),
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", {
314
+ e.showIndex ? (p(), k("view", Be, q(e.active + 1) + " / " + q(e.mergeImages.length), 1)) : N("", !0),
315
+ e.closeable ? (p(), k("view", {
465
316
  key: 1,
466
- class: normalizeClass(_ctx.iconClasses),
467
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClose && _ctx.onClose(...args))
317
+ class: we(e.iconClasses),
318
+ onClick: t[0] || (t[0] = (...i) => e.onClose && e.onClose(...i))
468
319
  }, [
469
- renderSlot(_ctx.$slots, "close-icon", {}, () => [
470
- createVNode(_component_CircleClose, { color: "#ffffff" })
320
+ ye(e.$slots, "close-icon", {}, () => [
321
+ Ce(m, { color: "#ffffff" })
471
322
  ])
472
- ], 2)) : createCommentVNode("", true)
323
+ ], 2)) : N("", !0)
473
324
  ]),
474
325
  _: 3
475
326
  }, 8, ["visible", "teleportDisable", "teleport", "onClosed"]);
476
327
  }
477
- const ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
478
- class ImagePreviewOptions {
328
+ const ee = /* @__PURE__ */ _(Me, [["render", Ee]]);
329
+ class Le {
479
330
  constructor() {
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");
331
+ l(this, "show", !1);
332
+ l(this, "images", []);
333
+ l(this, "videos", []);
334
+ l(this, "contentClose", !0);
335
+ l(this, "initNo", 0);
336
+ l(this, "paginationVisible", !1);
337
+ l(this, "paginationColor", "");
338
+ l(this, "autoplay", 0);
339
+ l(this, "isWrapTeleport", !1);
340
+ l(this, "showIndex", !0);
341
+ l(this, "closeable", !1);
342
+ l(this, "closeIcon", "circle-close");
343
+ l(this, "closeIconPosition", "top-right");
344
+ l(this, "beforeClose");
345
+ l(this, "maxZoom", 3);
346
+ l(this, "minZoom", 1 / 3);
347
+ l(this, "isLoop", !0);
348
+ l(this, "teleport", "body");
498
349
  }
499
350
  }
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, {
351
+ class Ae {
352
+ constructor(t) {
353
+ l(this, "options", new Le());
354
+ const o = Object.assign(this.options, t), { unmount: a } = Xe(o, {
505
355
  name: "image-preview",
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
- }
356
+ components: [L, B, A, E, Ye],
357
+ wrapper: () => ({
358
+ setup() {
359
+ return () => (o.onClose = () => {
360
+ o.show = !1, be(() => {
361
+ a();
362
+ });
363
+ }, Te(ee, o));
364
+ }
365
+ })
522
366
  });
523
367
  }
524
368
  }
525
- const showImagePreview = (options) => new ImagePreviewFunction(options);
526
- showImagePreview.install = (app) => {
527
- app.use(ImagePreview);
369
+ const Ve = (e) => new Ae(e);
370
+ Ve.install = (e) => {
371
+ e.use(ee);
528
372
  };
529
373
  export {
530
- ImagePreviewOptions,
531
- ImagePreview as default,
532
- showImagePreview
374
+ Le as ImagePreviewOptions,
375
+ ee as default,
376
+ Ve as showImagePreview
533
377
  };