@nutui/nutui 3.1.21 → 3.1.22-beta.5

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 (233) hide show
  1. package/dist/nutui.es.js +4203 -19263
  2. package/dist/nutui.umd.js +4208 -19368
  3. package/dist/packages/_es/ActionSheet.js +17 -167
  4. package/dist/packages/_es/Address.js +110 -552
  5. package/dist/packages/_es/AddressList.js +113 -613
  6. package/dist/packages/_es/Animate.js +22 -0
  7. package/dist/packages/_es/Audio.js +53 -274
  8. package/dist/packages/_es/AudioOperate.js +13 -121
  9. package/dist/packages/_es/Avatar.js +38 -177
  10. package/dist/packages/_es/AvatarGroup.js +14 -73
  11. package/dist/packages/_es/BackTop.js +43 -156
  12. package/dist/packages/_es/Badge.js +14 -86
  13. package/dist/packages/_es/Barrage.js +41 -120
  14. package/dist/packages/_es/Button.js +23 -128
  15. package/dist/packages/_es/Calendar.js +30 -237
  16. package/dist/packages/_es/CalendarItem.js +2 -1
  17. package/dist/packages/_es/Card.js +10 -107
  18. package/dist/packages/_es/Cascader.js +147 -523
  19. package/dist/packages/_es/Category.js +15 -58
  20. package/dist/packages/_es/CategoryPane.js +11 -111
  21. package/dist/packages/_es/Cell.js +21 -100
  22. package/dist/packages/_es/CellGroup.js +9 -44
  23. package/dist/packages/_es/Checkbox.js +31 -113
  24. package/dist/packages/_es/CheckboxGroup.js +29 -58
  25. package/dist/packages/_es/CircleProgress.js +28 -151
  26. package/dist/packages/_es/Col.js +14 -56
  27. package/dist/packages/_es/Collapse.js +32 -84
  28. package/dist/packages/_es/CollapseItem.js +59 -272
  29. package/dist/packages/_es/Comment.js +64 -434
  30. package/dist/packages/_es/ConfigProvider.js +13 -0
  31. package/dist/packages/_es/CountDown.js +56 -256
  32. package/dist/packages/_es/CountUp.js +140 -556
  33. package/dist/packages/_es/DatePicker.js +98 -332
  34. package/dist/packages/_es/Dialog.js +60 -271
  35. package/dist/packages/_es/Divider.js +13 -82
  36. package/dist/packages/_es/Drag.js +56 -197
  37. package/dist/packages/_es/Ecard.js +24 -159
  38. package/dist/packages/_es/Elevator.js +58 -212
  39. package/dist/packages/_es/Ellipsis.js +64 -0
  40. package/dist/packages/_es/Empty.js +12 -71
  41. package/dist/packages/_es/FixedNav.js +15 -122
  42. package/dist/packages/_es/Form.js +64 -151
  43. package/dist/packages/_es/FormItem.js +15 -110
  44. package/dist/packages/_es/Grid.js +5 -6
  45. package/dist/packages/_es/GridItem.js +33 -144
  46. package/dist/packages/_es/Icon.js +15 -40
  47. package/dist/packages/_es/Image.js +31 -0
  48. package/dist/packages/_es/ImagePreview.js +77 -309
  49. package/dist/packages/_es/Indicator.js +15 -62
  50. package/dist/packages/_es/InfiniteLoading.js +57 -268
  51. package/dist/packages/_es/Input.js +51 -413
  52. package/dist/packages/_es/InputNumber.js +41 -160
  53. package/dist/packages/_es/Layout.js +4 -5
  54. package/dist/packages/_es/List.js +18 -124
  55. package/dist/packages/_es/Menu.js +45 -118
  56. package/dist/packages/_es/MenuItem.js +37 -162
  57. package/dist/packages/_es/Navbar.js +30 -192
  58. package/dist/packages/_es/NoticeBar.js +74 -397
  59. package/dist/packages/_es/Notify.js +72 -246
  60. package/dist/packages/_es/NumberKeyboard.js +41 -272
  61. package/dist/packages/_es/OldPicker.js +131 -474
  62. package/dist/packages/_es/OverLay.js +24 -113
  63. package/dist/packages/_es/Pagination.js +39 -157
  64. package/dist/packages/_es/Picker.js +129 -469
  65. package/dist/packages/_es/Popover.js +318 -975
  66. package/dist/packages/_es/Popup.js +55 -313
  67. package/dist/packages/_es/Price.js +16 -118
  68. package/dist/packages/_es/Progress.js +14 -146
  69. package/dist/packages/_es/PullRefresh.js +84 -354
  70. package/dist/packages/_es/Radio.js +22 -90
  71. package/dist/packages/_es/RadioGroup.js +8 -37
  72. package/dist/packages/_es/Range.js +83 -427
  73. package/dist/packages/_es/Rate.js +35 -137
  74. package/dist/packages/_es/Row.js +22 -64
  75. package/dist/packages/_es/SearchBar.js +37 -257
  76. package/dist/packages/_es/ShortPassword.js +35 -225
  77. package/dist/packages/_es/SideNavBar.js +24 -99
  78. package/dist/packages/_es/SideNavBarItem.js +11 -46
  79. package/dist/packages/_es/Signature.js +41 -179
  80. package/dist/packages/_es/Skeleton.js +20 -136
  81. package/dist/packages/_es/Sku.js +84 -509
  82. package/dist/packages/_es/Step.js +20 -133
  83. package/dist/packages/_es/Steps.js +18 -53
  84. package/dist/packages/_es/Sticky.js +53 -138
  85. package/dist/packages/_es/SubSideNavBar.js +17 -100
  86. package/dist/packages/_es/Swipe.js +41 -197
  87. package/dist/packages/_es/Swiper.js +121 -433
  88. package/dist/packages/_es/SwiperItem.js +22 -53
  89. package/dist/packages/_es/Switch.js +21 -116
  90. package/dist/packages/_es/TabPane.js +12 -39
  91. package/dist/packages/_es/Tabbar.js +17 -72
  92. package/dist/packages/_es/TabbarItem.js +29 -151
  93. package/dist/packages/_es/Table.js +18 -196
  94. package/dist/packages/_es/Tabs.js +43 -217
  95. package/dist/packages/_es/Tag.js +20 -97
  96. package/dist/packages/_es/TextArea.js +42 -160
  97. package/dist/packages/_es/TimeDetail.js +18 -98
  98. package/dist/packages/_es/TimePannel.js +14 -66
  99. package/dist/packages/_es/TimeSelect.js +15 -103
  100. package/dist/packages/_es/Toast.js +71 -329
  101. package/dist/packages/_es/Uploader.js +104 -468
  102. package/dist/packages/_es/Video.js +74 -350
  103. package/dist/packages/_es/common.js +38 -128
  104. package/dist/packages/_es/component.js +35 -76
  105. package/dist/packages/_es/index.js +5 -6
  106. package/dist/packages/_es/index2.js +9 -30
  107. package/dist/packages/_es/index3.js +6 -8
  108. package/dist/packages/_es/index4.js +13 -58
  109. package/dist/packages/_es/index5.js +164 -682
  110. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  111. package/dist/packages/_es/pxCheck.js +3 -5
  112. package/dist/packages/_es/raf.js +8 -15
  113. package/dist/packages/animate/index.scss +299 -0
  114. package/dist/packages/button/index.scss +2 -1
  115. package/dist/packages/cell/index.scss +18 -1
  116. package/dist/packages/checkbox/index.scss +16 -0
  117. package/dist/packages/configprovider/index.scss +2 -0
  118. package/dist/packages/dialog/index.scss +1 -0
  119. package/dist/packages/elevator/index.scss +21 -0
  120. package/dist/packages/ellipsis/index.scss +12 -0
  121. package/dist/packages/formitem/index.scss +12 -0
  122. package/dist/packages/griditem/index.scss +11 -0
  123. package/dist/packages/image/index.scss +39 -0
  124. package/dist/packages/imagepreview/index.scss +21 -2
  125. package/dist/packages/input/index.scss +26 -1
  126. package/dist/packages/inputnumber/index.scss +21 -0
  127. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  128. package/dist/packages/locale/lang/baseLang.js +3 -3
  129. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  130. package/dist/packages/locale/lang/en-US.js +5 -97
  131. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  132. package/dist/packages/locale/lang/id-ID.js +5 -97
  133. package/dist/packages/locale/lang/index.js +16 -38
  134. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  135. package/dist/packages/locale/lang/zh-CN.js +5 -97
  136. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  137. package/dist/packages/locale/lang/zh-TW.js +5 -97
  138. package/dist/packages/menu/index.scss +45 -36
  139. package/dist/packages/menuitem/index.scss +4 -0
  140. package/dist/packages/navbar/index.scss +9 -0
  141. package/dist/packages/pagination/index.scss +19 -0
  142. package/dist/packages/radio/index.scss +19 -0
  143. package/dist/packages/range/index.scss +19 -0
  144. package/dist/packages/rate/index.scss +1 -1
  145. package/dist/packages/searchbar/index.scss +21 -0
  146. package/dist/packages/switch/index.scss +4 -3
  147. package/dist/packages/tabbar/index.scss +5 -0
  148. package/dist/packages/tabbaritem/index.scss +7 -0
  149. package/dist/packages/tabpane/index.scss +6 -0
  150. package/dist/packages/tabs/index.scss +22 -0
  151. package/dist/packages/textarea/index.scss +8 -0
  152. package/dist/smartips/attributes.json +192 -12
  153. package/dist/smartips/tags.json +70 -10
  154. package/dist/smartips/web-types.json +6945 -0
  155. package/dist/style.css +1 -1
  156. package/dist/style.es.js +1 -1
  157. package/dist/styles/font/config.json +3 -1
  158. package/dist/styles/font/demo_index.html +49 -3
  159. package/dist/styles/font/iconfont.css +11 -3
  160. package/dist/styles/font/iconfont.js +15 -15
  161. package/dist/styles/font/iconfont.json +14 -0
  162. package/dist/styles/font/iconfont.ttf +0 -0
  163. package/dist/styles/font/iconfont.woff +0 -0
  164. package/dist/styles/font/iconfont.woff2 +0 -0
  165. package/dist/styles/themes/default.scss +54 -50
  166. package/dist/styles/themes/jdb.scss +54 -50
  167. package/dist/styles/themes/jdt.scss +54 -50
  168. package/dist/styles/variables-jdb.scss +19 -1
  169. package/dist/styles/variables-jdt.scss +19 -1
  170. package/dist/styles/variables.scss +22 -1
  171. package/dist/types/__VUE/address/index.vue.d.ts +2 -2
  172. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  173. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  174. package/dist/types/__VUE/animate/type.d.ts +6 -0
  175. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  176. package/dist/types/__VUE/avatar/index.vue.d.ts +7 -7
  177. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/button/index.vue.d.ts +2 -2
  180. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  181. package/dist/types/__VUE/cell/index.vue.d.ts +13 -6
  182. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  183. package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
  184. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  185. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  186. package/dist/types/__VUE/collapse/index.vue.d.ts +5 -3
  187. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  188. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  189. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  190. package/dist/types/__VUE/datepicker/index.vue.d.ts +5 -5
  191. package/dist/types/__VUE/datepicker/type.d.ts +6 -0
  192. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  193. package/dist/types/__VUE/dialog/index.vue.d.ts +26 -17
  194. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  195. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  196. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  197. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  198. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  199. package/dist/types/__VUE/grid/common.d.ts +3 -3
  200. package/dist/types/__VUE/grid/index.vue.d.ts +5 -5
  201. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  202. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  203. package/dist/types/__VUE/image/type.d.ts +6 -0
  204. package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
  205. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  206. package/dist/types/__VUE/input/index.vue.d.ts +4 -4
  207. package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
  208. package/dist/types/__VUE/menuitem/index.vue.d.ts +16 -7
  209. package/dist/types/__VUE/menuitem/type.d.ts +8 -0
  210. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  211. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  212. package/dist/types/__VUE/picker/index.vue.d.ts +1 -1
  213. package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
  214. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  215. package/dist/types/__VUE/rate/common.d.ts +149 -0
  216. package/dist/types/__VUE/rate/index.vue.d.ts +17 -7
  217. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  218. package/dist/types/__VUE/skeleton/common.d.ts +2 -4
  219. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  220. package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
  221. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  222. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  223. package/dist/types/__VUE/tabs/common.d.ts +2 -2
  224. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  225. package/dist/types/__VUE/timeselect/index.vue.d.ts +8 -0
  226. package/dist/types/__VUE/toast/index.vue.d.ts +2 -2
  227. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  228. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  229. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  230. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  231. package/dist/types/index.d.ts +1 -1
  232. package/dist/types/nutui.d.ts +5 -1
  233. package/package.json +7 -3
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { reactive as r, useSlots as o, computed as e, watch as t, toRefs as i, resolveComponent as l, openBlock as s, createElementBlock as a, normalizeClass as n, normalizeStyle as d, createElementVNode as g, createBlock as c, createCommentVNode as u, renderSlot as m } from "vue";
7
+ import { c as p } from "./component.js";
8
+ import { p as f } from "./pxCheck.js";
9
+ import { _ as y } from "./plugin-vue_export-helper.js";
10
+ import "../locale/lang";
11
+ const { componentName: h, create: k } = p("image"), w = k({ props: { src: String, fit: { type: String, default: "fill" }, position: { type: String, default: "center" }, alt: { type: String, default: "" }, width: { type: String, default: "center" }, height: { type: String, default: "" }, round: { type: Boolean, default: false }, radius: [String, Number], showError: { type: Boolean, default: true }, showLoading: { type: Boolean, default: true } }, emits: ["click", "load", "error"], setup(l2, { emit: s2 }) {
12
+ const a2 = r({ loading: true, isError: false, slotLoding: o().loading, slotError: o().error }), n2 = e(() => ({ [h]: true, [`${h}-round`]: l2.round })), d2 = e(() => {
13
+ let r2 = {};
14
+ return l2.width && (r2.width = f(l2.width)), l2.height && (r2.height = f(l2.height)), l2.radius !== void 0 && l2.radius !== null && (r2.overflow = "hidden", r2.borderRadius = f(l2.radius)), r2;
15
+ }), g2 = e(() => ({ objectFit: l2.fit, objectPosition: l2.position }));
16
+ t(() => l2.src, (r2) => {
17
+ a2.isError = false, a2.loading = true;
18
+ });
19
+ return { ...i(a2), imageClick: (r2) => {
20
+ s2("click", r2);
21
+ }, classes: n2, styles: g2, stylebox: d2, error: () => {
22
+ a2.isError = true, a2.loading = false, s2("error");
23
+ }, load: () => {
24
+ a2.loading = false, s2("load");
25
+ } };
26
+ } }), v = ["src", "alt"], E = { key: 0, class: "nut-img-loading" }, S = { key: 1, class: "nut-img-error" };
27
+ var b = y(w, [["render", function(r2, o2, e2, t2, i2, p2) {
28
+ const f2 = l("nut-icon");
29
+ return s(), a("view", { class: n(r2.classes), style: d(r2.stylebox), onClick: o2[2] || (o2[2] = (...o3) => r2.imageClick && r2.imageClick(...o3)) }, [g("img", { class: "nut-img", src: r2.src, alt: r2.alt, onLoad: o2[0] || (o2[0] = (...o3) => r2.load && r2.load(...o3)), onError: o2[1] || (o2[1] = (...o3) => r2.error && r2.error(...o3)), style: d(r2.styles) }, null, 44, v), r2.loading ? (s(), a("view", E, [r2.slotLoding ? u("", true) : (s(), c(f2, { key: 0, name: "image" })), m(r2.$slots, "loading")])) : u("", true), r2.isError && !r2.loading ? (s(), a("view", S, [r2.slotError ? u("", true) : (s(), c(f2, { key: 0, name: "image-error" })), m(r2.$slots, "error")])) : u("", true)], 6);
30
+ }]]);
31
+ export { b as default };
@@ -1,326 +1,94 @@
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 __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
1
  /*!
21
- * @nutui/nutui v3.1.21 Mon May 30 2022 20:20:01 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
22
3
  * (c) 2022 @jdf2e.
23
4
  * Released under the MIT License.
24
5
  */
25
- import { toRefs, reactive, watch, onMounted, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, withModifiers, createElementBlock, Fragment, renderList, createVNode, createCommentVNode, toDisplayString, render, h } from "vue";
26
- import { c as createComponent } from "./component.js";
27
- import Popup from "./Popup.js";
28
- import Video from "./Video.js";
29
- import Swiper from "./Swiper.js";
30
- import SwiperItem from "./SwiperItem.js";
31
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { toRefs as e, reactive as o, computed as t, watch as i, onMounted as n, resolveComponent as s, openBlock as a, createBlock as l, withCtx as c, createElementVNode as r, withModifiers as p, createElementBlock as u, Fragment as m, renderList as g, createVNode as d, createCommentVNode as h, toDisplayString as f, normalizeStyle as v, render as y, h as w } from "vue";
7
+ import { c as b, a as C } from "./component.js";
8
+ import x from "./Popup.js";
9
+ import T from "./Video.js";
10
+ import I from "./Swiper.js";
11
+ import S from "./SwiperItem.js";
12
+ import j from "./Icon.js";
13
+ import { _ as N } from "./plugin-vue_export-helper.js";
32
14
  import "../locale/lang";
33
15
  import "./OverLay.js";
34
- import "./Icon.js";
35
16
  import "./pxCheck.js";
36
17
  import "./index3.js";
37
- const { componentName, create } = createComponent("imagepreview");
38
- const _sfc_main = create({
39
- props: {
40
- show: {
41
- type: Boolean,
42
- default: false
43
- },
44
- images: {
45
- type: Array,
46
- default: () => []
47
- },
48
- videos: {
49
- type: Array,
50
- default: () => []
51
- },
52
- contentClose: {
53
- type: Boolean,
54
- default: false
55
- },
56
- initNo: {
57
- type: Number,
58
- default: 1
59
- },
60
- paginationVisible: {
61
- type: Boolean,
62
- default: false
63
- },
64
- paginationColor: {
65
- type: String,
66
- default: "#fff"
67
- },
68
- autoplay: {
69
- type: [Number, String],
70
- default: 3e3
71
- },
72
- isWrapTeleport: {
73
- type: Boolean,
74
- default: false
18
+ const { componentName: k, create: E } = b("imagepreview"), P = E({ props: { show: { type: Boolean, default: false }, images: { type: Array, default: () => [] }, videos: { type: Array, default: () => [] }, contentClose: { type: Boolean, default: true }, initNo: { type: Number, default: 1 }, paginationVisible: { type: Boolean, default: false }, paginationColor: { type: String, default: "#fff" }, autoplay: { type: [Number, String], default: 3e3 }, isWrapTeleport: { type: Boolean, default: false }, showIndex: { type: Boolean, default: true }, closeable: { type: Boolean, default: false }, closeIcon: { type: String, default: "circle-close" }, closeIconPosition: { type: String, default: "top-right" }, beforeClose: Function }, emits: ["close", "change"], components: { [x.name]: x, [T.name]: T, [I.name]: I, [S.name]: S, [j.name]: j }, setup(s2, { emit: a2 }) {
19
+ e(s2);
20
+ const l2 = o({ showPop: false, active: 1, maxNo: 1, source: { src: "https://storage.jd.com/about/big-final.mp4?Expires=3730193075&AccessKey=3LoYX1dQWa6ZXzQl&Signature=ViMFjz%2BOkBxS%2FY1rjtUVqbopbJI%3D", type: "video/mp4" }, options: { muted: true, controls: true }, eleImg: null, store: { scale: 1, moveable: false }, lastTouchEndTime: 0 }), c2 = t(() => {
21
+ let e2 = {};
22
+ return s2.closeIconPosition == "top-right" ? e2.right = "10px" : e2.left = "10px", e2;
23
+ }), r2 = () => {
24
+ if (s2.beforeClose) {
25
+ const e2 = s2.beforeClose.apply(null, l2.active);
26
+ C(e2) ? e2.then((e3) => {
27
+ e3 && p2();
28
+ }) : e2 && p2();
29
+ } else
30
+ p2();
31
+ }, p2 = () => {
32
+ l2.showPop = false, l2.store.scale = 1, m2(), l2.active = 1, a2("close");
33
+ }, u2 = (e2, o2) => Math.hypot(Math.abs(o2.x - e2.x), Math.abs(o2.y - e2.y)), m2 = () => {
34
+ l2.eleImg.style.transform = "scale(" + l2.store.scale + ")";
35
+ }, g2 = (e2) => {
36
+ if (!l2.store.moveable)
37
+ return;
38
+ const o2 = l2.store;
39
+ var t2 = e2.touches, i2 = t2[0], n2 = t2[1];
40
+ if (n2) {
41
+ const e3 = u2({ x: i2.pageX, y: i2.pageY }, { x: n2.pageX, y: n2.pageY }) / o2.oriDistance;
42
+ o2.scale = o2.originScale * e3, o2.scale > 3 && (o2.scale = 3), m2();
75
43
  }
76
- },
77
- emits: ["close"],
78
- components: {
79
- [Popup.name]: Popup,
80
- [Video.name]: Video,
81
- [Swiper.name]: Swiper,
82
- [SwiperItem.name]: SwiperItem
83
- },
84
- setup(props, { emit }) {
85
- toRefs(props);
86
- const state = reactive({
87
- showPop: false,
88
- active: 1,
89
- maxNo: 1,
90
- source: {
91
- src: "https://storage.jd.com/about/big-final.mp4?Expires=3730193075&AccessKey=3LoYX1dQWa6ZXzQl&Signature=ViMFjz%2BOkBxS%2FY1rjtUVqbopbJI%3D",
92
- type: "video/mp4"
93
- },
94
- options: {
95
- muted: true,
96
- controls: true
97
- },
98
- eleImg: null,
99
- store: {
100
- scale: 1,
101
- moveable: false
102
- },
103
- lastTouchEndTime: 0
104
- });
105
- const slideChangeEnd = function(page) {
106
- state.active = page + 1;
107
- };
108
- const closeOnImg = () => {
109
- if (props.contentClose) {
110
- onClose();
111
- }
112
- };
113
- const onClose = () => {
114
- state.showPop = false;
115
- state.store.scale = 1;
116
- scaleNow();
117
- state.active = 1;
118
- emit("close");
119
- };
120
- const getDistance = (first, second) => {
121
- return Math.hypot(Math.abs(second.x - first.x), Math.abs(second.y - first.y));
122
- };
123
- const scaleNow = () => {
124
- state.eleImg.style.transform = "scale(" + state.store.scale + ")";
125
- };
126
- const onTouchStart = (event) => {
127
- const curTouchTime = new Date().getTime();
128
- if (curTouchTime - state.lastTouchEndTime < 300) {
129
- const store2 = state.store;
130
- if (store2.scale > 1) {
131
- store2.scale = 1;
132
- } else if (store2.scale == 1) {
133
- store2.scale = 2;
134
- }
135
- scaleNow();
136
- }
137
- var touches = event.touches;
138
- var events = touches[0];
139
- var events2 = touches[1];
140
- const store = state.store;
141
- store.moveable = true;
142
- if (events2) {
143
- store.oriDistance = getDistance({
144
- x: events.pageX,
145
- y: events.pageY
146
- }, {
147
- x: events2.pageX,
148
- y: events2.pageY
149
- });
150
- }
151
- store.originScale = store.scale || 1;
152
- };
153
- const onTouchMove = (event) => {
154
- if (!state.store.moveable) {
155
- return;
156
- }
157
- const store = state.store;
158
- var touches = event.touches;
159
- var events = touches[0];
160
- var events2 = touches[1];
161
- if (events2) {
162
- const curDistance = getDistance({
163
- x: events.pageX,
164
- y: events.pageY
165
- }, {
166
- x: events2.pageX,
167
- y: events2.pageY
168
- });
169
- const curScale = curDistance / store.oriDistance;
170
- store.scale = store.originScale * curScale;
171
- if (store.scale > 3) {
172
- store.scale = 3;
173
- }
174
- scaleNow();
175
- }
176
- };
177
- const onTouchEnd = () => {
178
- state.lastTouchEndTime = new Date().getTime();
179
- const store = state.store;
180
- store.moveable = false;
181
- if (store.scale < 1.1 && store.scale > 1 || store.scale < 1) {
182
- store.scale = 1;
183
- scaleNow();
184
- }
185
- };
186
- const init = () => {
187
- state.eleImg = document.querySelector(".nut-imagepreview");
188
- document.addEventListener("touchmove", onTouchMove);
189
- document.addEventListener("touchend", onTouchEnd);
190
- document.addEventListener("touchcancel", onTouchEnd);
191
- };
192
- watch(() => props.show, (val) => {
193
- state.showPop = val;
194
- init();
195
- });
196
- onMounted(() => {
197
- state.active = props.initNo;
198
- state.showPop = props.show;
199
- state.maxNo = props.images.length + props.videos.length;
200
- });
201
- return __spreadProps(__spreadValues({}, toRefs(state)), {
202
- slideChangeEnd,
203
- onClose,
204
- closeOnImg,
205
- onTouchStart,
206
- onTouchMove,
207
- onTouchEnd,
208
- getDistance,
209
- scaleNow
210
- });
211
- }
212
- });
213
- const _hoisted_1 = ["src"];
214
- const _hoisted_2 = { class: "nut-imagepreview-index" };
215
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
216
- const _component_nut_video = resolveComponent("nut-video");
217
- const _component_nut_swiper_item = resolveComponent("nut-swiper-item");
218
- const _component_nut_swiper = resolveComponent("nut-swiper");
219
- const _component_nut_popup = resolveComponent("nut-popup");
220
- return openBlock(), createBlock(_component_nut_popup, {
221
- "pop-class": "custom-pop",
222
- visible: _ctx.showPop,
223
- "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.showPop = $event),
224
- isWrapTeleport: _ctx.isWrapTeleport,
225
- onClick: _ctx.onClose,
226
- style: { "width": "100%" }
227
- }, {
228
- default: withCtx(() => [
229
- createElementVNode("view", {
230
- class: "nut-imagepreview",
231
- onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.closeOnImg && _ctx.closeOnImg(...args), ["stop"])),
232
- onTouchstartCapture: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args))
233
- }, [
234
- _ctx.showPop ? (openBlock(), createBlock(_component_nut_swiper, {
235
- key: 0,
236
- "auto-play": _ctx.autoplay,
237
- class: "nut-imagepreview-swiper",
238
- loop: true,
239
- "is-preventDefault": false,
240
- direction: "horizontal",
241
- onChange: _ctx.slideChangeEnd,
242
- "init-page": _ctx.initNo > _ctx.maxNo ? _ctx.maxNo - 1 : _ctx.initNo - 1,
243
- "pagination-visible": _ctx.paginationVisible,
244
- "pagination-color": _ctx.paginationColor
245
- }, {
246
- default: withCtx(() => [
247
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.videos, (item, index) => {
248
- return openBlock(), createBlock(_component_nut_swiper_item, { key: index }, {
249
- default: withCtx(() => [
250
- createVNode(_component_nut_video, {
251
- source: item.source,
252
- options: item.options
253
- }, null, 8, ["source", "options"])
254
- ]),
255
- _: 2
256
- }, 1024);
257
- }), 128)),
258
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.images, (item, index) => {
259
- return openBlock(), createBlock(_component_nut_swiper_item, { key: index }, {
260
- default: withCtx(() => [
261
- createElementVNode("img", {
262
- src: item.src,
263
- class: "nut-imagepreview-img"
264
- }, null, 8, _hoisted_1)
265
- ]),
266
- _: 2
267
- }, 1024);
268
- }), 128))
269
- ]),
270
- _: 1
271
- }, 8, ["auto-play", "onChange", "init-page", "pagination-visible", "pagination-color"])) : createCommentVNode("", true)
272
- ], 32),
273
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.active) + " / " + toDisplayString(_ctx.images.length + _ctx.videos.length), 1)
274
- ]),
275
- _: 1
276
- }, 8, ["visible", "isWrapTeleport", "onClick"]);
277
- }
278
- var ImagePreview = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
279
- class ImagePreviewOptions {
44
+ }, d2 = () => {
45
+ l2.lastTouchEndTime = new Date().getTime();
46
+ const e2 = l2.store;
47
+ e2.moveable = false, (e2.scale < 1.1 && e2.scale > 1 || e2.scale < 1) && (e2.scale = 1, m2());
48
+ };
49
+ return i(() => s2.show, (e2) => {
50
+ l2.showPop = e2, l2.eleImg = document.querySelector(".nut-imagepreview"), document.addEventListener("touchmove", g2), document.addEventListener("touchend", d2), document.addEventListener("touchcancel", d2);
51
+ }), n(() => {
52
+ l2.active = s2.initNo, l2.showPop = s2.show, l2.maxNo = s2.images.length + s2.videos.length;
53
+ }), { ...e(l2), slideChangeEnd: function(e2) {
54
+ l2.active = e2 + 1, a2("change", l2.active);
55
+ }, onClose: r2, closeOnImg: () => {
56
+ s2.contentClose && r2();
57
+ }, onTouchStart: (e2) => {
58
+ if (new Date().getTime() - l2.lastTouchEndTime < 300) {
59
+ const e3 = l2.store;
60
+ e3.scale > 1 ? e3.scale = 1 : e3.scale == 1 && (e3.scale = 2), m2();
61
+ }
62
+ var o2 = e2.touches, t2 = o2[0], i2 = o2[1];
63
+ const n2 = l2.store;
64
+ n2.moveable = true, i2 && (n2.oriDistance = u2({ x: t2.pageX, y: t2.pageY }, { x: i2.pageX, y: i2.pageY })), n2.originScale = n2.scale || 1;
65
+ }, onTouchMove: g2, onTouchEnd: d2, getDistance: u2, scaleNow: m2, styles: c2 };
66
+ } }), B = ["src"], D = { key: 0, class: "nut-imagepreview-index" };
67
+ var O = N(P, [["render", function(e2, o2, t2, i2, n2, y2) {
68
+ const w2 = s("nut-video"), b2 = s("nut-swiper-item"), C2 = s("nut-swiper"), x2 = s("nut-icon"), T2 = s("nut-popup");
69
+ return a(), l(T2, { "pop-class": "custom-pop", visible: e2.showPop, "onUpdate:visible": o2[3] || (o2[3] = (o3) => e2.showPop = o3), isWrapTeleport: e2.isWrapTeleport, onClick: e2.onClose, style: { width: "100%" } }, { default: c(() => [r("view", { class: "nut-imagepreview", onClick: o2[0] || (o2[0] = p((...o3) => e2.closeOnImg && e2.closeOnImg(...o3), ["stop"])), onTouchstartCapture: o2[1] || (o2[1] = (...o3) => e2.onTouchStart && e2.onTouchStart(...o3)) }, [e2.showPop ? (a(), l(C2, { key: 0, "auto-play": e2.autoplay, class: "nut-imagepreview-swiper", loop: true, "is-preventDefault": false, direction: "horizontal", onChange: e2.slideChangeEnd, "init-page": e2.initNo > e2.maxNo ? e2.maxNo - 1 : e2.initNo - 1, "pagination-visible": e2.paginationVisible, "pagination-color": e2.paginationColor }, { default: c(() => [(a(true), u(m, null, g(e2.videos, (e3, o3) => (a(), l(b2, { key: o3 }, { default: c(() => [d(w2, { source: e3.source, options: e3.options }, null, 8, ["source", "options"])]), _: 2 }, 1024))), 128)), (a(true), u(m, null, g(e2.images, (e3, o3) => (a(), l(b2, { key: o3 }, { default: c(() => [r("img", { src: e3.src, class: "nut-imagepreview-img" }, null, 8, B)]), _: 2 }, 1024))), 128))]), _: 1 }, 8, ["auto-play", "onChange", "init-page", "pagination-visible", "pagination-color"])) : h("", true)], 32), e2.showIndex ? (a(), u("view", D, f(e2.active) + " / " + f(e2.images.length + e2.videos.length), 1)) : h("", true), e2.closeable ? (a(), u("view", { key: 1, class: "nut-imagepreview-close-icon", onClick: o2[2] || (o2[2] = (...o3) => e2.handleCloseIcon && e2.handleCloseIcon(...o3)), style: v(e2.styles) }, [d(x2, { name: e2.closeIcon, color: "#ffffff" }, null, 8, ["name"])], 4)) : h("", true)]), _: 1 }, 8, ["visible", "isWrapTeleport", "onClick"]);
70
+ }]]);
71
+ class V {
280
72
  constructor() {
281
- this.show = false;
282
- this.images = [];
283
- this.initNo = 1;
284
- this.paginationVisible = false;
285
- this.paginationColor = "";
286
- this.teleport = "body";
287
- this.onClose = () => {
73
+ this.show = false, this.images = [], this.initNo = 1, this.paginationVisible = false, this.paginationColor = "", this.teleport = "body", this.onClose = () => {
288
74
  };
289
75
  }
290
76
  }
291
- class ImagePreviewFunction {
292
- constructor(_options) {
293
- this.options = new ImagePreviewOptions();
294
- let options = Object.assign(this.options, _options);
295
- let elWarp = document.body;
296
- let teleport = options.teleport;
297
- if (teleport != "body") {
298
- if (typeof teleport == "string") {
299
- elWarp = document.querySelector(teleport);
300
- } else {
301
- elWarp = options.teleport;
302
- }
303
- }
304
- const root = document.createElement("view");
305
- root.id = "imagepreview-" + new Date().getTime();
306
- const Wrapper = {
307
- setup() {
308
- options.teleport = `#${root.id}`;
309
- return () => {
310
- return h(ImagePreview, options);
311
- };
312
- }
313
- };
314
- const instance = createVNode(Wrapper);
315
- elWarp.appendChild(root);
316
- render(instance, root);
77
+ class X {
78
+ constructor(e2) {
79
+ this.options = new V();
80
+ let o2 = Object.assign(this.options, e2), t2 = document.body, i2 = o2.teleport;
81
+ i2 != "body" && (t2 = typeof i2 == "string" ? document.querySelector(i2) : o2.teleport);
82
+ const n2 = document.createElement("view");
83
+ n2.id = "imagepreview-" + new Date().getTime();
84
+ const s2 = d({ setup: () => (o2.teleport = `#${n2.id}`, () => w(O, o2)) });
85
+ t2.appendChild(n2), y(s2, n2);
317
86
  }
318
87
  }
319
- const _ImagePreview = function(options) {
320
- return new ImagePreviewFunction(options);
88
+ const Y = function(e2) {
89
+ return new X(e2);
321
90
  };
322
- _ImagePreview.install = (app) => {
323
- app.use(ImagePreview);
324
- app.config.globalProperties.$imagepreview = _ImagePreview;
91
+ Y.install = (e2) => {
92
+ e2.use(O), e2.config.globalProperties.$imagepreview = Y;
325
93
  };
326
- export { ImagePreview, ImagePreviewOptions, _ImagePreview as default };
94
+ export { O as ImagePreview, V as ImagePreviewOptions, Y as default };
@@ -1,67 +1,20 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.21 Mon May 30 2022 20:20:01 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { toRefs, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { toRefs as e, computed as r, openBlock as t, createElementBlock as l, normalizeClass as o, Fragment as n, renderList as a, toDisplayString as u } from "vue";
7
+ import { c } from "./component.js";
8
+ import { _ as s } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName, create } = createComponent("indicator");
11
- const _sfc_main = create({
12
- props: {
13
- size: {
14
- type: Number,
15
- default: 3,
16
- required: true
17
- },
18
- current: {
19
- type: Number,
20
- default: 1,
21
- required: true
22
- },
23
- block: {
24
- type: Boolean,
25
- default: false
26
- },
27
- align: {
28
- type: String,
29
- default: "center"
30
- },
31
- fillZero: {
32
- type: Boolean,
33
- default: true
34
- }
35
- },
36
- setup(props) {
37
- const { block, align } = toRefs(props);
38
- const classes = computed(() => {
39
- const prefixCls = componentName;
40
- return {
41
- [prefixCls]: true,
42
- [`${prefixCls}--block`]: block.value,
43
- [`${prefixCls}--align__${align.value}`]: block.value && align.value
44
- };
45
- });
46
- return { classes, componentName };
47
- }
48
- });
49
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
50
- return openBlock(), createElementBlock("view", {
51
- class: normalizeClass(_ctx.classes)
52
- }, [
53
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.size, (item) => {
54
- return openBlock(), createElementBlock(Fragment, { key: item }, [
55
- item === _ctx.current ? (openBlock(), createElementBlock("view", {
56
- key: 0,
57
- class: normalizeClass(`${_ctx.componentName}--number`)
58
- }, toDisplayString(_ctx.fillZero && item < 10 ? `0${item}` : item), 3)) : (openBlock(), createElementBlock("view", {
59
- key: 1,
60
- class: normalizeClass(`${_ctx.componentName}--dot`)
61
- }, null, 2))
62
- ], 64);
63
- }), 128))
64
- ], 2);
65
- }
66
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
67
- export { index as default };
10
+ const { componentName: i, create: p } = c("indicator");
11
+ var m = s(p({ props: { size: { type: Number, default: 3, required: true }, current: { type: Number, default: 1, required: true }, block: { type: Boolean, default: false }, align: { type: String, default: "center" }, fillZero: { type: Boolean, default: true } }, setup(t2) {
12
+ const { block: l2, align: o2 } = e(t2);
13
+ return { classes: r(() => {
14
+ const e2 = i;
15
+ return { [e2]: true, [`${e2}--block`]: l2.value, [`${e2}--align__${o2.value}`]: l2.value && o2.value };
16
+ }), componentName: i };
17
+ } }), [["render", function(e2, r2, c2, s2, i2, p2) {
18
+ return t(), l("view", { class: o(e2.classes) }, [(t(true), l(n, null, a(e2.size, (r3) => (t(), l(n, { key: r3 }, [r3 === e2.current ? (t(), l("view", { key: 0, class: o(`${e2.componentName}--number`) }, u(e2.fillZero && r3 < 10 ? `0${r3}` : r3), 3)) : (t(), l("view", { key: 1, class: o(`${e2.componentName}--dot`) }, null, 2))], 64))), 128))], 2);
19
+ }]]);
20
+ export { m as default };