@nutui/nutui 3.2.7 → 3.2.8-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/dist/nutui.es.js +1932 -3372
  2. package/dist/nutui.umd.js +1929 -3370
  3. package/dist/packages/_es/ActionSheet.js +2 -5
  4. package/dist/packages/_es/Address.js +162 -250
  5. package/dist/packages/_es/AddressList.js +229 -307
  6. package/dist/packages/_es/Animate.js +1 -1
  7. package/dist/packages/_es/Audio.js +1 -1
  8. package/dist/packages/_es/AudioOperate.js +1 -1
  9. package/dist/packages/_es/Avatar.js +1 -1
  10. package/dist/packages/_es/AvatarGroup.js +1 -1
  11. package/dist/packages/_es/BackTop.js +1 -1
  12. package/dist/packages/_es/Badge.js +1 -1
  13. package/dist/packages/_es/Barrage.js +1 -1
  14. package/dist/packages/_es/Button.js +1 -1
  15. package/dist/packages/_es/Calendar.js +1 -1
  16. package/dist/packages/_es/CalendarItem.js +1 -1
  17. package/dist/packages/_es/Card.js +1 -1
  18. package/dist/packages/_es/Cascader.js +2 -5
  19. package/dist/packages/_es/Category.js +1 -1
  20. package/dist/packages/_es/CategoryPane.js +1 -1
  21. package/dist/packages/_es/Cell.js +1 -1
  22. package/dist/packages/_es/CellGroup.js +1 -1
  23. package/dist/packages/_es/Checkbox.js +1 -1
  24. package/dist/packages/_es/CheckboxGroup.js +1 -1
  25. package/dist/packages/_es/CircleProgress.js +2 -2
  26. package/dist/packages/_es/Col.js +1 -1
  27. package/dist/packages/_es/Collapse.js +4 -11
  28. package/dist/packages/_es/CollapseItem.js +8 -5
  29. package/dist/packages/_es/Comment.js +1 -1
  30. package/dist/packages/_es/ConfigProvider.js +1 -1
  31. package/dist/packages/_es/CountDown.js +2 -10
  32. package/dist/packages/_es/CountUp.js +1 -1
  33. package/dist/packages/_es/DatePicker.js +8 -17
  34. package/dist/packages/_es/Dialog.js +38 -63
  35. package/dist/packages/_es/Divider.js +1 -1
  36. package/dist/packages/_es/Drag.js +1 -1
  37. package/dist/packages/_es/Ecard.js +1 -1
  38. package/dist/packages/_es/Elevator.js +2 -2
  39. package/dist/packages/_es/Ellipsis.js +1 -1
  40. package/dist/packages/_es/Empty.js +1 -1
  41. package/dist/packages/_es/FixedNav.js +1 -1
  42. package/dist/packages/_es/Form.js +39 -31
  43. package/dist/packages/_es/FormItem.js +1 -1
  44. package/dist/packages/_es/Grid.js +2 -2
  45. package/dist/packages/_es/GridItem.js +1 -1
  46. package/dist/packages/_es/Icon.js +1 -1
  47. package/dist/packages/_es/Image.js +1 -1
  48. package/dist/packages/_es/ImagePreview.js +126 -220
  49. package/dist/packages/_es/Indicator.js +4 -4
  50. package/dist/packages/_es/InfiniteLoading.js +1 -1
  51. package/dist/packages/_es/Input.js +107 -123
  52. package/dist/packages/_es/InputNumber.js +1 -1
  53. package/dist/packages/_es/Invoice.js +1 -1
  54. package/dist/packages/_es/Layout.js +1 -1
  55. package/dist/packages/_es/List.js +1 -1
  56. package/dist/packages/_es/Menu.js +14 -1
  57. package/dist/packages/_es/MenuItem.js +10 -7
  58. package/dist/packages/_es/Navbar.js +1 -1
  59. package/dist/packages/_es/NoticeBar.js +1 -1
  60. package/dist/packages/_es/Notify.js +5 -7
  61. package/dist/packages/_es/NumberKeyboard.js +4 -4
  62. package/dist/packages/_es/OverLay.js +60 -63
  63. package/dist/packages/_es/Pagination.js +1 -1
  64. package/dist/packages/_es/Picker.js +25 -50
  65. package/dist/packages/_es/Popover.js +111 -930
  66. package/dist/packages/_es/Popup.js +105 -217
  67. package/dist/packages/_es/Price.js +1 -1
  68. package/dist/packages/_es/Progress.js +1 -1
  69. package/dist/packages/_es/Radio.js +1 -1
  70. package/dist/packages/_es/RadioGroup.js +1 -1
  71. package/dist/packages/_es/Range.js +1 -1
  72. package/dist/packages/_es/Rate.js +1 -1
  73. package/dist/packages/_es/Row.js +1 -1
  74. package/dist/packages/_es/SearchBar.js +1 -1
  75. package/dist/packages/_es/ShortPassword.js +4 -4
  76. package/dist/packages/_es/SideNavBar.js +1 -1
  77. package/dist/packages/_es/SideNavBarItem.js +1 -1
  78. package/dist/packages/_es/Signature.js +1 -1
  79. package/dist/packages/_es/Skeleton.js +1 -1
  80. package/dist/packages/_es/Sku.js +4 -7
  81. package/dist/packages/_es/Step.js +1 -1
  82. package/dist/packages/_es/Steps.js +1 -1
  83. package/dist/packages/_es/Sticky.js +1 -1
  84. package/dist/packages/_es/SubSideNavBar.js +1 -1
  85. package/dist/packages/_es/Swipe.js +1 -1
  86. package/dist/packages/_es/Swiper.js +1 -1
  87. package/dist/packages/_es/SwiperItem.js +1 -1
  88. package/dist/packages/_es/Switch.js +1 -1
  89. package/dist/packages/_es/TabPane.js +1 -1
  90. package/dist/packages/_es/Tabbar.js +1 -1
  91. package/dist/packages/_es/TabbarItem.js +2 -2
  92. package/dist/packages/_es/Table.js +1 -1
  93. package/dist/packages/_es/Tabs.js +2 -2
  94. package/dist/packages/_es/Tag.js +1 -1
  95. package/dist/packages/_es/TextArea.js +1 -1
  96. package/dist/packages/_es/TimeDetail.js +1 -1
  97. package/dist/packages/_es/TimePannel.js +1 -1
  98. package/dist/packages/_es/TimeSelect.js +4 -4
  99. package/dist/packages/_es/Toast.js +5 -6
  100. package/dist/packages/_es/TrendArrow.js +1 -1
  101. package/dist/packages/_es/Uploader.js +2 -2
  102. package/dist/packages/_es/Video.js +1 -1
  103. package/dist/packages/_es/WaterMark.js +1 -1
  104. package/dist/packages/_es/common.js +1 -1
  105. package/dist/packages/_es/component.js +22 -2
  106. package/dist/packages/_es/index.js +1 -1
  107. package/dist/packages/_es/index2.js +1 -1
  108. package/dist/packages/_es/index3.js +1 -1
  109. package/dist/packages/_es/index4.js +1 -1
  110. package/dist/packages/_es/index5.js +1 -1
  111. package/dist/packages/_es/interceptor.js +32 -0
  112. package/dist/packages/_es/mountComponent.js +42 -0
  113. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  114. package/dist/packages/_es/props.js +80 -0
  115. package/dist/packages/_es/pxCheck.js +1 -1
  116. package/dist/packages/_es/raf.js +1 -1
  117. package/dist/packages/_es/style.css +1 -1
  118. package/dist/packages/address/index.scss +7 -2
  119. package/dist/packages/addresslist/index.scss +61 -101
  120. package/dist/packages/imagepreview/index.scss +9 -1
  121. package/dist/packages/inputnumber/index.scss +5 -1
  122. package/dist/packages/locale/lang/baseLang.js +1 -1
  123. package/dist/packages/locale/lang/en-US.js +1 -1
  124. package/dist/packages/locale/lang/id-ID.js +1 -1
  125. package/dist/packages/locale/lang/index.js +1 -1
  126. package/dist/packages/locale/lang/zh-CN.js +1 -1
  127. package/dist/packages/locale/lang/zh-TW.js +1 -1
  128. package/dist/packages/menuitem/index.scss +0 -15
  129. package/dist/packages/notify/index.scss +2 -2
  130. package/dist/packages/overlay/index.scss +2 -1
  131. package/dist/packages/picker/index.scss +20 -12
  132. package/dist/packages/popover/index.scss +191 -363
  133. package/dist/packages/popup/index.scss +3 -14
  134. package/dist/smartips/attributes.json +59 -55
  135. package/dist/smartips/tags.json +16 -19
  136. package/dist/smartips/web-types.json +115 -113
  137. package/dist/style.css +1 -1
  138. package/dist/styles/themes/default.scss +54 -55
  139. package/dist/styles/themes/jdb.scss +54 -55
  140. package/dist/styles/themes/jddkh.scss +54 -55
  141. package/dist/styles/themes/jdt.scss +54 -55
  142. package/dist/styles/variables.scss +9 -0
  143. package/dist/types/__VUE/actionsheet/index.vue.d.ts +61 -57
  144. package/dist/types/__VUE/address/index.vue.d.ts +74 -94
  145. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +29 -9
  146. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +4 -13
  147. package/dist/types/__VUE/addresslist/components/SwipeShell.vue.d.ts +9 -9
  148. package/dist/types/__VUE/addresslist/index.vue.d.ts +23 -20
  149. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  150. package/dist/types/__VUE/cascader/index.vue.d.ts +49 -54
  151. package/dist/types/__VUE/cell/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/countdown/index.vue.d.ts +0 -1
  153. package/dist/types/__VUE/countdown/util.d.ts +0 -1
  154. package/dist/types/__VUE/datepicker/index.vue.d.ts +57 -62
  155. package/dist/types/__VUE/dialog/index.d.ts +0 -3
  156. package/dist/types/__VUE/dialog/index.vue.d.ts +52 -61
  157. package/dist/types/__VUE/divider/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/fixednav/index.vue.d.ts +1 -1
  159. package/dist/types/__VUE/form/common.d.ts +4 -2
  160. package/dist/types/__VUE/form/index.vue.d.ts +4 -4
  161. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  162. package/dist/types/__VUE/image/index.vue.d.ts +1 -1
  163. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +27 -20
  164. package/dist/types/__VUE/imagepreview/index.d.ts +19 -5
  165. package/dist/types/__VUE/imagepreview/index.vue.d.ts +57 -43
  166. package/dist/types/__VUE/imagepreview/types.d.ts +44 -0
  167. package/dist/types/__VUE/indicator/index.vue.d.ts +1 -0
  168. package/dist/types/__VUE/input/index.vue.d.ts +35 -23
  169. package/dist/types/__VUE/inputnumber/index.vue.d.ts +1 -1
  170. package/dist/types/__VUE/invoice/index.vue.d.ts +1 -1
  171. package/dist/types/__VUE/menu/index.vue.d.ts +1 -1
  172. package/dist/types/__VUE/menuitem/index.vue.d.ts +3 -3
  173. package/dist/types/__VUE/notify/index.vue.d.ts +3 -3
  174. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +4 -4
  175. package/dist/types/__VUE/overlay/index.vue.d.ts +12 -13
  176. package/dist/types/__VUE/picker/Column.vue.d.ts +0 -2
  177. package/dist/types/__VUE/picker/index.vue.d.ts +59 -66
  178. package/dist/types/__VUE/popover/index.vue.d.ts +40 -143
  179. package/dist/types/__VUE/popup/common.d.ts +103 -0
  180. package/dist/types/__VUE/popup/index.vue.d.ts +57 -1593
  181. package/dist/types/__VUE/popup/props.d.ts +82 -0
  182. package/dist/types/__VUE/rate/index.vue.d.ts +1 -1
  183. package/dist/types/__VUE/shortpassword/index.vue.d.ts +5 -5
  184. package/dist/types/__VUE/sku/index.vue.d.ts +59 -64
  185. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  186. package/dist/types/__VUE/switch/index.vue.d.ts +1 -1
  187. package/dist/types/__VUE/tabbar/index.vue.d.ts +1 -1
  188. package/dist/types/__VUE/timeselect/index.vue.d.ts +3 -3
  189. package/dist/types/__VUE/video/index.vue.d.ts +2 -2
  190. package/dist/types/index.d.ts +1 -1
  191. package/dist/types/nutui.d.ts +1 -2
  192. package/package.json +2 -3
  193. package/dist/packages/_es/PullRefresh.js +0 -349
  194. package/dist/packages/pullrefresh/index.scss +0 -71
  195. package/dist/types/__VUE/addresslist/components/LongPressShell.vue.d.ts +0 -47
  196. package/dist/types/__VUE/datepicker/utils.d.ts +0 -5
  197. package/dist/types/__VUE/popup/use-lock-scroll.d.ts +0 -5
  198. package/dist/types/__VUE/pullrefresh/index.vue.d.ts +0 -128
  199. package/dist/types/__VUE/pullrefresh/use-touch.d.ts +0 -20
  200. package/dist/types/__VUE/pullrefresh/util.d.ts +0 -6
@@ -1,29 +1,36 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.7 Fri Nov 18 2022 19:57:44 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.8-beta.1 Fri Dec 02 2022 14:18:21 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementBlock, normalizeStyle, createElementVNode, createCommentVNode, createVNode, ref, onMounted, Fragment, renderList, toDisplayString, mergeProps, render, h } from "vue";
7
- import { c as createComponent, i as isPromise } from "./component.js";
6
+ import { reactive, computed, watch, toRefs, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, createElementBlock, createCommentVNode, ref, onMounted, Fragment, renderList, toDisplayString, normalizeClass, createVNode, mergeProps, h } from "vue";
7
+ import { c as createComponent, a as preventDefault, j as isArray } from "./component.js";
8
+ import { u as useRect } from "./index2.js";
9
+ import { u as useTouch } from "./index4.js";
10
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
11
+ import { f as funInterceptor } from "./interceptor.js";
12
+ import "../locale/lang";
13
+ import { C as CreateComponent } from "./mountComponent.js";
8
14
  import Popup from "./Popup.js";
9
15
  import Video from "./Video.js";
10
16
  import Swiper from "./Swiper.js";
11
17
  import SwiperItem from "./SwiperItem.js";
12
18
  import _sfc_main$2 from "./Icon.js";
13
- import { u as useTouch } from "./index4.js";
14
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
15
- import "../locale/lang";
16
- import "./OverLay.js";
17
- import "./pxCheck.js";
19
+ import OverLay from "./OverLay.js";
20
+ import "./props.js";
18
21
  import "./index3.js";
22
+ import "./pxCheck.js";
23
+ const baseProps = {
24
+ show: { type: Boolean, default: false },
25
+ initNo: { type: Number, default: 0 },
26
+ showIndex: { type: Boolean, default: true },
27
+ minZoom: { type: Number, default: 1 / 3 },
28
+ maxZoom: { type: Number, default: 3 }
29
+ };
19
30
  const { create: create$1 } = createComponent("imagepreviewitem");
20
31
  const _sfc_main$1 = create$1({
21
32
  props: {
22
- show: {
23
- type: Boolean,
24
- default: false
25
- },
26
- initNo: Number,
33
+ ...baseProps,
27
34
  image: {
28
35
  type: Object,
29
36
  default: () => ({})
@@ -32,10 +39,6 @@ const _sfc_main$1 = create$1({
32
39
  type: Object,
33
40
  default: () => ({})
34
41
  },
35
- showIndex: {
36
- type: Boolean,
37
- default: true
38
- },
39
42
  rootWidth: {
40
43
  type: Number,
41
44
  default: 0
@@ -43,24 +46,10 @@ const _sfc_main$1 = create$1({
43
46
  rootHeight: {
44
47
  type: Number,
45
48
  default: 0
46
- },
47
- minZoom: {
48
- type: Number,
49
- default: 1 / 3
50
- },
51
- maxZoom: {
52
- type: Number,
53
- default: 3
54
49
  }
55
50
  },
56
51
  emits: ["close", "scale"],
57
- components: {
58
- [Popup.name]: Popup,
59
- [Video.name]: Video,
60
- [Swiper.name]: Swiper,
61
- [SwiperItem.name]: SwiperItem,
62
- [_sfc_main$2.name]: _sfc_main$2
63
- },
52
+ components: {},
64
53
  setup(props, { emit }) {
65
54
  const state = reactive({
66
55
  scale: 1,
@@ -79,16 +68,20 @@ const _sfc_main$1 = create$1({
79
68
  return state.imageRatio > rootRatio;
80
69
  });
81
70
  const imageStyle = computed(() => {
82
- const { scale, moveX, moveY, moving, zooming } = state;
83
- const style = {
84
- transitionDuration: zooming || moving ? "0s" : ".3s"
85
- };
86
- if (scale !== 1) {
87
- const offsetX = moveX / scale;
88
- const offsetY = moveY / scale;
89
- style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
71
+ const images = props.image;
72
+ if (images && images.src) {
73
+ const { scale, moveX, moveY, moving, zooming } = state;
74
+ const style = {
75
+ transitionDuration: zooming || moving ? "0s" : ".3s"
76
+ };
77
+ if (scale !== 1) {
78
+ const offsetX = moveX / scale;
79
+ const offsetY = moveY / scale;
80
+ style.transform = `scale(${scale}, ${scale}) translate(${offsetX}px, ${offsetY}px)`;
81
+ }
82
+ return style;
90
83
  }
91
- return style;
84
+ return {};
92
85
  });
93
86
  const maxMoveX = computed(() => {
94
87
  if (state.imageRatio) {
@@ -198,7 +191,6 @@ const _sfc_main$1 = create$1({
198
191
  }
199
192
  };
200
193
  const onTouchEnd = (event) => {
201
- console.log("ontauchend");
202
194
  let stopPropagation = false;
203
195
  if (state.moving || state.zooming) {
204
196
  stopPropagation = true;
@@ -227,17 +219,8 @@ const _sfc_main$1 = create$1({
227
219
  checkTap();
228
220
  touch.reset();
229
221
  };
230
- const preventDefault = (event, isStopPropagation) => {
231
- if (typeof event.cancelable !== "boolean" || event.cancelable) {
232
- event.preventDefault();
233
- }
234
- if (isStopPropagation) {
235
- event.stopPropagation();
236
- }
237
- };
238
222
  const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
239
- const closeSwiper = (event) => {
240
- console.log("\u5173\u95ED\u89C6\u9891");
223
+ const closeSwiper = () => {
241
224
  emit("close");
242
225
  };
243
226
  watch(() => props.initNo, resetScale);
@@ -267,8 +250,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
267
250
  const _component_nut_swiper_item = resolveComponent("nut-swiper-item");
268
251
  return openBlock(), createBlock(_component_nut_swiper_item, { onClick: _ctx.closeSwiper }, {
269
252
  default: withCtx(() => [
270
- _ctx.image && _ctx.image.src ? (openBlock(), createElementBlock("view", {
271
- key: 0,
253
+ createElementVNode("view", {
272
254
  style: normalizeStyle(_ctx.imageStyle),
273
255
  class: "nut-imagepreview-box",
274
256
  onTouchstart: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
@@ -276,26 +258,18 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
276
258
  onTouchend: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
277
259
  onTouchcancel: _cache[4] || (_cache[4] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
278
260
  }, [
279
- createElementVNode("img", {
261
+ _ctx.image && _ctx.image.src ? (openBlock(), createElementBlock("img", {
262
+ key: 0,
280
263
  src: _ctx.image.src,
281
264
  class: "nut-imagepreview-img",
282
265
  onLoad: _cache[0] || (_cache[0] = (...args) => _ctx.imageLoad && _ctx.imageLoad(...args))
283
- }, null, 40, _hoisted_1$1)
284
- ], 36)) : createCommentVNode("", true),
285
- _ctx.video && _ctx.video.source ? (openBlock(), createElementBlock("view", {
286
- key: 1,
287
- class: "nut-imagepreview-box",
288
- onClick: _cache[5] || (_cache[5] = (...args) => _ctx.videoClick && _ctx.videoClick(...args)),
289
- onTouchstart: _cache[6] || (_cache[6] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
290
- onTouchmove: _cache[7] || (_cache[7] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
291
- onTouchend: _cache[8] || (_cache[8] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
292
- onTouchcancel: _cache[9] || (_cache[9] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
293
- }, [
294
- createVNode(_component_nut_video, {
266
+ }, null, 40, _hoisted_1$1)) : createCommentVNode("", true),
267
+ _ctx.video && _ctx.video.source ? (openBlock(), createBlock(_component_nut_video, {
268
+ key: 1,
295
269
  source: _ctx.video.source,
296
270
  options: _ctx.video.options
297
- }, null, 8, ["source", "options"])
298
- ], 32)) : createCommentVNode("", true)
271
+ }, null, 8, ["source", "options"])) : createCommentVNode("", true)
272
+ ], 36)
299
273
  ]),
300
274
  _: 1
301
275
  }, 8, ["onClick"]);
@@ -304,46 +278,15 @@ var ImagePreviewItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc
304
278
  const { create } = createComponent("imagepreview");
305
279
  const _sfc_main = create({
306
280
  props: {
307
- show: {
308
- type: Boolean,
309
- default: false
310
- },
311
- images: {
312
- type: Array,
313
- default: () => []
314
- },
315
- videos: {
316
- type: Array,
317
- default: () => []
318
- },
319
- contentClose: {
320
- type: Boolean,
321
- default: true
322
- },
323
- initNo: {
324
- type: Number,
325
- default: 1
326
- },
327
- paginationVisible: {
328
- type: Boolean,
329
- default: false
330
- },
331
- paginationColor: {
332
- type: String,
333
- default: "#fff"
334
- },
335
- autoplay: {
336
- type: [Number, String],
337
- default: 0
338
- },
339
- isWrapTeleport: {
340
- type: Boolean,
341
- default: false
342
- },
343
- showIndex: {
344
- type: Boolean,
345
- default: true
346
- },
281
+ ...baseProps,
282
+ images: { type: Array, default: () => [] },
283
+ videos: { type: Array, default: () => [] },
284
+ contentClose: { type: Boolean, default: true },
285
+ paginationVisible: { type: Boolean, default: false },
286
+ paginationColor: { type: String, default: "#fff" },
287
+ autoplay: { type: [Number, String], default: 0 },
288
+ teleport: { type: [String, Element], default: "body" },
289
+ teleportDisable: { ype: Boolean, default: false },
347
290
  closeable: {
348
291
  type: Boolean,
349
292
  default: false
@@ -357,14 +300,6 @@ const _sfc_main = create({
357
300
  default: "top-right"
358
301
  },
359
302
  beforeClose: Function,
360
- minZoom: {
361
- type: Number,
362
- default: 1 / 3
363
- },
364
- maxZoom: {
365
- type: Number,
366
- default: 3
367
- },
368
303
  isLoop: {
369
304
  type: Boolean,
370
305
  default: true
@@ -372,62 +307,49 @@ const _sfc_main = create({
372
307
  },
373
308
  emits: ["close", "change"],
374
309
  components: {
375
- [Popup.name]: Popup,
376
- [Video.name]: Video,
377
- [Swiper.name]: Swiper,
378
- [SwiperItem.name]: SwiperItem,
379
- [_sfc_main$2.name]: _sfc_main$2,
380
310
  ImagePreviewItem
381
311
  },
382
312
  setup(props, { emit }) {
383
313
  const swipeRef = ref();
384
314
  const state = reactive({
385
- showPop: false,
386
- active: 1,
315
+ showPop: props.show,
316
+ active: 0,
387
317
  rootWidth: 0,
388
318
  rootHeight: 0
389
319
  });
390
- const styles = computed(() => {
391
- let style = {};
392
- if (props.closeIconPosition == "top-right") {
393
- style.right = "10px";
394
- } else {
395
- style.left = "10px";
320
+ const iconClasses = computed(() => {
321
+ const pre = "nut-imagepreview-close";
322
+ const iconn = props.closeIconPosition == "top-right" ? `${pre}-right` : `${pre}-left`;
323
+ return `nut-imagepreview-close-icon ${iconn}`;
324
+ });
325
+ const mergeImages = computed(() => {
326
+ if (isArray(props.videos)) {
327
+ return [].concat(props.videos).concat(props.images);
396
328
  }
397
- return style;
329
+ return props.images;
398
330
  });
399
- const slideChangeEnd = function(page) {
400
- state.active = page + 1;
401
- emit("change", state.active);
331
+ const setActive = (active) => {
332
+ if (active !== state.active) {
333
+ state.active = active;
334
+ emit("change", state.active);
335
+ }
402
336
  };
403
337
  const onClose = () => {
404
- if (props.beforeClose) {
405
- const returnVal = props.beforeClose.apply(null, state.active);
406
- if (isPromise(returnVal)) {
407
- returnVal.then((value) => {
408
- if (value) {
409
- closeDone();
410
- }
411
- });
412
- } else if (returnVal) {
413
- closeDone();
414
- }
415
- } else {
416
- closeDone();
417
- }
338
+ funInterceptor(props.beforeClose, {
339
+ args: [state.active],
340
+ done: () => closeDone()
341
+ });
418
342
  };
419
343
  const closeDone = () => {
420
344
  state.showPop = false;
421
345
  emit("close");
422
346
  };
423
- const handleCloseIcon = () => {
424
- onClose();
425
- };
426
347
  const init = () => {
427
- setTimeout(() => {
428
- state.rootHeight = swipeRef.value.offsetHeight;
429
- state.rootWidth = swipeRef.value.offsetWidth;
430
- }, 100);
348
+ if (swipeRef.value) {
349
+ const rect = useRect(swipeRef.value);
350
+ state.rootHeight = rect.height;
351
+ state.rootWidth = rect.width;
352
+ }
431
353
  };
432
354
  watch(
433
355
  () => props.show,
@@ -439,28 +361,20 @@ const _sfc_main = create({
439
361
  watch(
440
362
  () => props.initNo,
441
363
  (val) => {
442
- if (val != state.active) {
443
- state.active = val;
444
- }
364
+ if (val != state.active)
365
+ setActive(val);
445
366
  }
446
367
  );
447
- const initPage = computed(() => {
448
- const maxNo = props.images.length + props.videos.length;
449
- const _initPage = props.initNo > maxNo ? maxNo - 1 : props.initNo - 1;
450
- return _initPage >= 0 ? _initPage : 0;
451
- });
452
368
  onMounted(() => {
453
- state.active = props.initNo;
454
- state.showPop = props.show;
369
+ setActive(props.initNo);
455
370
  });
456
371
  return {
457
372
  swipeRef,
458
373
  ...toRefs(state),
459
- initPage,
460
- slideChangeEnd,
461
374
  onClose,
462
- handleCloseIcon,
463
- styles
375
+ mergeImages,
376
+ setActive,
377
+ iconClasses
464
378
  };
465
379
  }
466
380
  });
@@ -478,12 +392,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
478
392
  const _component_nut_icon = resolveComponent("nut-icon");
479
393
  const _component_nut_popup = resolveComponent("nut-popup");
480
394
  return openBlock(), createBlock(_component_nut_popup, {
481
- "pop-class": "custom-pop",
395
+ "pop-class": "nut-imagepreview-custom-pop",
482
396
  visible: _ctx.showPop,
483
397
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPop = $event),
484
- isWrapTeleport: _ctx.isWrapTeleport,
398
+ teleportDisable: _ctx.teleportDisable,
399
+ teleport: _ctx.teleport,
485
400
  onClosed: _ctx.onClose,
486
- style: { "width": "100%" },
487
401
  "lock-scroll": ""
488
402
  }, {
489
403
  default: withCtx(() => [
@@ -495,97 +409,89 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
495
409
  loop: _ctx.isLoop,
496
410
  "is-preventDefault": false,
497
411
  direction: "horizontal",
498
- onChange: _ctx.slideChangeEnd,
499
- "init-page": _ctx.initPage,
412
+ onChange: _ctx.setActive,
413
+ "init-page": _ctx.initNo,
500
414
  "pagination-visible": _ctx.paginationVisible,
501
415
  "pagination-color": _ctx.paginationColor
502
416
  }, {
503
417
  default: withCtx(() => [
504
- _ctx.videos.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.videos, (item, index) => {
418
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.mergeImages, (item, index) => {
505
419
  return openBlock(), createBlock(_component_image_preview_item, {
506
420
  key: index,
507
- video: item,
421
+ video: index < _ctx.videos.length ? item : {},
422
+ image: index >= _ctx.videos.length ? item : {},
508
423
  rootHeight: _ctx.rootHeight,
509
424
  rootWidth: _ctx.rootWidth,
510
425
  show: _ctx.showPop,
511
- "init-no": _ctx.active,
426
+ "init-no": _ctx.active + 1,
512
427
  onClose: _ctx.onClose,
513
428
  maxZoom: _ctx.maxZoom,
514
429
  minZoom: _ctx.minZoom
515
- }, null, 8, ["video", "rootHeight", "rootWidth", "show", "init-no", "onClose", "maxZoom", "minZoom"]);
516
- }), 128)) : createCommentVNode("", true),
517
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.images, (item, index) => {
518
- return openBlock(), createBlock(_component_image_preview_item, {
519
- key: index,
520
- image: item,
521
- rootHeight: _ctx.rootHeight,
522
- rootWidth: _ctx.rootWidth,
523
- show: _ctx.showPop,
524
- "init-no": _ctx.active,
525
- onClose: _ctx.onClose
526
- }, null, 8, ["image", "rootHeight", "rootWidth", "show", "init-no", "onClose"]);
430
+ }, null, 8, ["video", "image", "rootHeight", "rootWidth", "show", "init-no", "onClose", "maxZoom", "minZoom"]);
527
431
  }), 128))
528
432
  ]),
529
433
  _: 1
530
434
  }, 8, ["auto-play", "loop", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
531
435
  ], 512),
532
- _ctx.showIndex ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.active) + " / " + toDisplayString(_ctx.images.length + _ctx.videos.length), 1)) : createCommentVNode("", true),
436
+ _ctx.showIndex ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.active + 1) + " / " + toDisplayString(_ctx.mergeImages.length), 1)) : createCommentVNode("", true),
533
437
  _ctx.closeable ? (openBlock(), createElementBlock("view", {
534
438
  key: 1,
535
- class: "nut-imagepreview-close-icon",
536
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleCloseIcon && _ctx.handleCloseIcon(...args)),
537
- style: normalizeStyle(_ctx.styles)
439
+ class: normalizeClass(_ctx.iconClasses),
440
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClose && _ctx.onClose(...args))
538
441
  }, [
539
442
  createVNode(_component_nut_icon, mergeProps({ name: _ctx.closeIcon }, _ctx.$attrs, { color: "#ffffff" }), null, 16, ["name"])
540
- ], 4)) : createCommentVNode("", true)
443
+ ], 2)) : createCommentVNode("", true)
541
444
  ]),
542
445
  _: 1
543
- }, 8, ["visible", "isWrapTeleport", "onClosed"]);
446
+ }, 8, ["visible", "teleportDisable", "teleport", "onClosed"]);
544
447
  }
545
448
  var ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
546
449
  class ImagePreviewOptions {
547
450
  constructor() {
548
451
  this.show = false;
549
452
  this.images = [];
550
- this.initNo = 1;
453
+ this.videos = [];
454
+ this.contentClose = true;
455
+ this.initNo = 0;
551
456
  this.paginationVisible = false;
552
457
  this.paginationColor = "";
553
- this.teleport = "body";
458
+ this.autoplay = 0;
459
+ this.isWrapTeleport = false;
460
+ this.showIndex = true;
461
+ this.closeable = false;
462
+ this.closeIcon = "circle-close";
463
+ this.closeIconPosition = "top-right";
464
+ this.maxZoom = 3;
465
+ this.minZoom = 1 / 3;
466
+ this.isLoop = true;
554
467
  this.onClose = () => {
555
468
  };
469
+ this.teleport = "body";
556
470
  }
557
471
  }
558
472
  class ImagePreviewFunction {
559
473
  constructor(_options) {
560
474
  this.options = new ImagePreviewOptions();
561
475
  const options = Object.assign(this.options, _options);
562
- let elWarp = document.body;
563
- const teleport = options.teleport;
564
- if (teleport != "body") {
565
- if (typeof teleport == "string") {
566
- elWarp = document.querySelector(teleport);
567
- } else {
568
- elWarp = options.teleport;
569
- }
570
- }
571
- const root = document.createElement("view");
572
- root.id = "imagepreview-" + new Date().getTime();
573
- const Wrapper = {
574
- setup() {
575
- options.teleport = `#${root.id}`;
576
- return () => {
577
- return h(ImagePreview, options);
476
+ const { instance, unmount } = CreateComponent(options, {
477
+ name: "imagepreview",
478
+ components: [Popup, Video, Swiper, SwiperItem, _sfc_main$2, OverLay],
479
+ wrapper: () => {
480
+ return {
481
+ setup() {
482
+ return () => {
483
+ options.onClose = () => {
484
+ unmount();
485
+ };
486
+ return h(ImagePreview, options);
487
+ };
488
+ }
578
489
  };
579
490
  }
580
- };
581
- const instance = createVNode(Wrapper);
582
- elWarp.appendChild(root);
583
- render(instance, root);
491
+ });
584
492
  }
585
493
  }
586
- const _ImagePreview = (options) => {
587
- return new ImagePreviewFunction(options);
588
- };
494
+ const _ImagePreview = (options) => new ImagePreviewFunction(options);
589
495
  _ImagePreview.install = (app) => {
590
496
  app.use(ImagePreview);
591
497
  app.config.globalProperties.$imagepreview = _ImagePreview;
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.7 Fri Nov 18 2022 19:57:44 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.8-beta.1 Fri Dec 02 2022 14:18:21 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { toRefs, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
7
- import { c as createComponent } from "./component.js";
7
+ import { p as padZero, c as createComponent } from "./component.js";
8
8
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
10
  const { componentName, create } = createComponent("indicator");
@@ -43,7 +43,7 @@ const _sfc_main = create({
43
43
  [`${prefixCls}--align__${align.value}`]: block.value && align.value
44
44
  };
45
45
  });
46
- return { classes, componentName };
46
+ return { classes, componentName, padZero };
47
47
  }
48
48
  });
49
49
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -55,7 +55,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
55
55
  item === _ctx.current ? (openBlock(), createElementBlock("view", {
56
56
  key: 0,
57
57
  class: normalizeClass(`${_ctx.componentName}--number`)
58
- }, toDisplayString(_ctx.fillZero && item < 10 ? `0${item}` : item), 3)) : (openBlock(), createElementBlock("view", {
58
+ }, toDisplayString(_ctx.fillZero && _ctx.padZero(item) || item), 3)) : (openBlock(), createElementBlock("view", {
59
59
  key: 1,
60
60
  class: normalizeClass(`${_ctx.componentName}--dot`)
61
61
  }, null, 2))
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.2.7 Fri Nov 18 2022 19:57:44 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.2.8-beta.1 Fri Dec 02 2022 14:18:21 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */