@nutui/nutui 3.1.22-beta.0 → 3.1.22

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 (237) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +4203 -19263
  4. package/dist/nutui.umd.js +4208 -19368
  5. package/dist/packages/_es/ActionSheet.js +17 -167
  6. package/dist/packages/_es/Address.js +110 -552
  7. package/dist/packages/_es/AddressList.js +113 -613
  8. package/dist/packages/_es/Animate.js +22 -0
  9. package/dist/packages/_es/Audio.js +53 -274
  10. package/dist/packages/_es/AudioOperate.js +13 -121
  11. package/dist/packages/_es/Avatar.js +38 -177
  12. package/dist/packages/_es/AvatarGroup.js +14 -73
  13. package/dist/packages/_es/BackTop.js +43 -156
  14. package/dist/packages/_es/Badge.js +14 -86
  15. package/dist/packages/_es/Barrage.js +41 -120
  16. package/dist/packages/_es/Button.js +23 -128
  17. package/dist/packages/_es/Calendar.js +30 -237
  18. package/dist/packages/_es/CalendarItem.js +2 -1
  19. package/dist/packages/_es/Card.js +10 -107
  20. package/dist/packages/_es/Cascader.js +147 -523
  21. package/dist/packages/_es/Category.js +15 -58
  22. package/dist/packages/_es/CategoryPane.js +11 -111
  23. package/dist/packages/_es/Cell.js +21 -100
  24. package/dist/packages/_es/CellGroup.js +9 -44
  25. package/dist/packages/_es/Checkbox.js +31 -113
  26. package/dist/packages/_es/CheckboxGroup.js +29 -58
  27. package/dist/packages/_es/CircleProgress.js +28 -151
  28. package/dist/packages/_es/Col.js +14 -56
  29. package/dist/packages/_es/Collapse.js +32 -84
  30. package/dist/packages/_es/CollapseItem.js +59 -272
  31. package/dist/packages/_es/Comment.js +64 -434
  32. package/dist/packages/_es/ConfigProvider.js +13 -0
  33. package/dist/packages/_es/CountDown.js +56 -256
  34. package/dist/packages/_es/CountUp.js +140 -556
  35. package/dist/packages/_es/DatePicker.js +98 -332
  36. package/dist/packages/_es/Dialog.js +60 -271
  37. package/dist/packages/_es/Divider.js +13 -82
  38. package/dist/packages/_es/Drag.js +56 -197
  39. package/dist/packages/_es/Ecard.js +24 -159
  40. package/dist/packages/_es/Elevator.js +58 -212
  41. package/dist/packages/_es/Ellipsis.js +64 -0
  42. package/dist/packages/_es/Empty.js +12 -71
  43. package/dist/packages/_es/FixedNav.js +15 -122
  44. package/dist/packages/_es/Form.js +64 -151
  45. package/dist/packages/_es/FormItem.js +15 -110
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +33 -144
  48. package/dist/packages/_es/Icon.js +15 -40
  49. package/dist/packages/_es/Image.js +31 -0
  50. package/dist/packages/_es/ImagePreview.js +77 -309
  51. package/dist/packages/_es/Indicator.js +15 -62
  52. package/dist/packages/_es/InfiniteLoading.js +57 -268
  53. package/dist/packages/_es/Input.js +51 -413
  54. package/dist/packages/_es/InputNumber.js +41 -160
  55. package/dist/packages/_es/Layout.js +4 -5
  56. package/dist/packages/_es/List.js +18 -124
  57. package/dist/packages/_es/Menu.js +45 -118
  58. package/dist/packages/_es/MenuItem.js +37 -162
  59. package/dist/packages/_es/Navbar.js +30 -192
  60. package/dist/packages/_es/NoticeBar.js +74 -397
  61. package/dist/packages/_es/Notify.js +72 -246
  62. package/dist/packages/_es/NumberKeyboard.js +41 -272
  63. package/dist/packages/_es/OldPicker.js +131 -474
  64. package/dist/packages/_es/OverLay.js +24 -113
  65. package/dist/packages/_es/Pagination.js +39 -157
  66. package/dist/packages/_es/Picker.js +129 -469
  67. package/dist/packages/_es/Popover.js +318 -975
  68. package/dist/packages/_es/Popup.js +55 -313
  69. package/dist/packages/_es/Price.js +16 -118
  70. package/dist/packages/_es/Progress.js +14 -146
  71. package/dist/packages/_es/PullRefresh.js +84 -354
  72. package/dist/packages/_es/Radio.js +22 -90
  73. package/dist/packages/_es/RadioGroup.js +8 -37
  74. package/dist/packages/_es/Range.js +83 -427
  75. package/dist/packages/_es/Rate.js +35 -137
  76. package/dist/packages/_es/Row.js +22 -64
  77. package/dist/packages/_es/SearchBar.js +37 -257
  78. package/dist/packages/_es/ShortPassword.js +35 -225
  79. package/dist/packages/_es/SideNavBar.js +24 -99
  80. package/dist/packages/_es/SideNavBarItem.js +11 -46
  81. package/dist/packages/_es/Signature.js +41 -179
  82. package/dist/packages/_es/Skeleton.js +20 -136
  83. package/dist/packages/_es/Sku.js +84 -509
  84. package/dist/packages/_es/Step.js +20 -133
  85. package/dist/packages/_es/Steps.js +18 -53
  86. package/dist/packages/_es/Sticky.js +53 -138
  87. package/dist/packages/_es/SubSideNavBar.js +17 -100
  88. package/dist/packages/_es/Swipe.js +41 -197
  89. package/dist/packages/_es/Swiper.js +121 -433
  90. package/dist/packages/_es/SwiperItem.js +22 -53
  91. package/dist/packages/_es/Switch.js +21 -116
  92. package/dist/packages/_es/TabPane.js +12 -39
  93. package/dist/packages/_es/Tabbar.js +17 -72
  94. package/dist/packages/_es/TabbarItem.js +29 -151
  95. package/dist/packages/_es/Table.js +18 -196
  96. package/dist/packages/_es/Tabs.js +43 -217
  97. package/dist/packages/_es/Tag.js +20 -97
  98. package/dist/packages/_es/TextArea.js +42 -160
  99. package/dist/packages/_es/TimeDetail.js +18 -98
  100. package/dist/packages/_es/TimePannel.js +14 -66
  101. package/dist/packages/_es/TimeSelect.js +15 -103
  102. package/dist/packages/_es/Toast.js +71 -329
  103. package/dist/packages/_es/Uploader.js +104 -468
  104. package/dist/packages/_es/Video.js +74 -350
  105. package/dist/packages/_es/common.js +38 -128
  106. package/dist/packages/_es/component.js +35 -76
  107. package/dist/packages/_es/index.js +5 -6
  108. package/dist/packages/_es/index2.js +9 -30
  109. package/dist/packages/_es/index3.js +6 -8
  110. package/dist/packages/_es/index4.js +13 -58
  111. package/dist/packages/_es/index5.js +164 -682
  112. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  113. package/dist/packages/_es/pxCheck.js +3 -5
  114. package/dist/packages/_es/raf.js +8 -15
  115. package/dist/packages/animate/index.scss +299 -0
  116. package/dist/packages/button/index.scss +2 -1
  117. package/dist/packages/cell/index.scss +18 -1
  118. package/dist/packages/checkbox/index.scss +16 -0
  119. package/dist/packages/configprovider/index.scss +2 -0
  120. package/dist/packages/dialog/index.scss +1 -0
  121. package/dist/packages/elevator/index.scss +21 -0
  122. package/dist/packages/ellipsis/index.scss +12 -0
  123. package/dist/packages/formitem/index.scss +12 -0
  124. package/dist/packages/griditem/index.scss +11 -0
  125. package/dist/packages/image/index.scss +39 -0
  126. package/dist/packages/imagepreview/index.scss +21 -2
  127. package/dist/packages/input/index.scss +26 -1
  128. package/dist/packages/inputnumber/index.scss +21 -0
  129. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  130. package/dist/packages/locale/lang/baseLang.js +3 -3
  131. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  132. package/dist/packages/locale/lang/en-US.js +5 -97
  133. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  134. package/dist/packages/locale/lang/id-ID.js +5 -97
  135. package/dist/packages/locale/lang/index.js +16 -38
  136. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  137. package/dist/packages/locale/lang/zh-CN.js +5 -97
  138. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  139. package/dist/packages/locale/lang/zh-TW.js +5 -97
  140. package/dist/packages/menu/index.scss +45 -36
  141. package/dist/packages/menuitem/index.scss +4 -0
  142. package/dist/packages/navbar/index.scss +9 -0
  143. package/dist/packages/pagination/index.scss +19 -0
  144. package/dist/packages/radio/index.scss +19 -0
  145. package/dist/packages/range/index.scss +19 -0
  146. package/dist/packages/rate/index.scss +1 -1
  147. package/dist/packages/searchbar/index.scss +21 -0
  148. package/dist/packages/switch/index.scss +4 -3
  149. package/dist/packages/tabbar/index.scss +5 -0
  150. package/dist/packages/tabbaritem/index.scss +7 -0
  151. package/dist/packages/tabpane/index.scss +6 -0
  152. package/dist/packages/tabs/index.scss +22 -0
  153. package/dist/packages/textarea/index.scss +8 -0
  154. package/dist/smartips/attributes.json +192 -12
  155. package/dist/smartips/tags.json +70 -10
  156. package/dist/smartips/web-types.json +6945 -0
  157. package/dist/style.css +1 -1
  158. package/dist/style.es.js +1 -1
  159. package/dist/styles/font/config.json +3 -1
  160. package/dist/styles/font/demo_index.html +49 -3
  161. package/dist/styles/font/iconfont.css +11 -3
  162. package/dist/styles/font/iconfont.js +15 -15
  163. package/dist/styles/font/iconfont.json +14 -0
  164. package/dist/styles/font/iconfont.ttf +0 -0
  165. package/dist/styles/font/iconfont.woff +0 -0
  166. package/dist/styles/font/iconfont.woff2 +0 -0
  167. package/dist/styles/themes/default.scss +54 -50
  168. package/dist/styles/themes/jdb.scss +54 -50
  169. package/dist/styles/themes/jdt.scss +54 -50
  170. package/dist/styles/variables-jdb.scss +22 -1
  171. package/dist/styles/variables-jdt.scss +22 -1
  172. package/dist/styles/variables.scss +22 -1
  173. package/dist/types/__VUE/actionsheet/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  175. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  176. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  177. package/dist/types/__VUE/animate/type.d.ts +6 -0
  178. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  179. package/dist/types/__VUE/avatar/index.vue.d.ts +5 -5
  180. package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
  181. package/dist/types/__VUE/badge/index.vue.d.ts +4 -4
  182. package/dist/types/__VUE/button/index.vue.d.ts +6 -6
  183. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  184. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  185. package/dist/types/__VUE/cell/index.vue.d.ts +11 -4
  186. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  187. package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
  188. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  189. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  190. package/dist/types/__VUE/collapse/index.vue.d.ts +3 -1
  191. package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
  192. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  193. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  194. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  195. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  196. package/dist/types/__VUE/dialog/index.vue.d.ts +25 -10
  197. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  198. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  199. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  200. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  201. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  202. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  203. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  204. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  205. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  206. package/dist/types/__VUE/image/type.d.ts +6 -0
  207. package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
  208. package/dist/types/__VUE/input/index.vue.d.ts +6 -6
  209. package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
  210. package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
  211. package/dist/types/__VUE/menuitem/index.vue.d.ts +12 -3
  212. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  213. package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
  214. package/dist/types/__VUE/oldpicker/index.vue.d.ts +2 -2
  215. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  216. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  217. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  218. package/dist/types/__VUE/popup/index.vue.d.ts +2 -2
  219. package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
  220. package/dist/types/__VUE/range/index.vue.d.ts +4 -4
  221. package/dist/types/__VUE/rate/common.d.ts +149 -0
  222. package/dist/types/__VUE/rate/index.vue.d.ts +15 -5
  223. package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
  224. package/dist/types/__VUE/sku/index.vue.d.ts +2 -2
  225. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  226. package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
  227. package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
  228. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
  230. package/dist/types/__VUE/timeselect/index.vue.d.ts +10 -2
  231. package/dist/types/__VUE/toast/index.vue.d.ts +5 -5
  232. package/dist/types/__VUE/uploader/index.vue.d.ts +6 -6
  233. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  234. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  235. package/dist/types/index.d.ts +1 -1
  236. package/dist/types/nutui.d.ts +5 -1
  237. package/package.json +6 -3
@@ -1,449 +1,137 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { reactive, ref, computed, provide, onDeactivated, onBeforeUnmount, watch, nextTick, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { u as useExpose } from "./index3.js";
9
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { reactive as e, ref as t, computed as a, provide as o, onDeactivated as i, onBeforeUnmount as l, watch as n, nextTick as r, openBlock as c, createElementBlock as u, normalizeClass as s, createElementVNode as h, normalizeStyle as d, renderSlot as v, Fragment as p, renderList as f, createCommentVNode as m } from "vue";
7
+ import { c as g } from "./component.js";
8
+ import { u as y } from "./index3.js";
9
+ import { _ as N } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const DISTANCE = 5;
12
- function useTouch() {
13
- const state = reactive({
14
- startX: 0,
15
- startY: 0,
16
- deltaX: 0,
17
- deltaY: 0,
18
- offsetX: 0,
19
- offsetY: 0,
20
- direction: ""
21
- });
22
- const getDirection = (x, y) => {
23
- if (x > y && x > DISTANCE)
24
- return "horizontal";
25
- if (y > x && y > DISTANCE)
26
- return "vertical";
27
- return "";
28
- };
29
- const reset = () => {
30
- state.startX = 0;
31
- state.startY = 0;
32
- state.deltaX = 0;
33
- state.deltaY = 0;
34
- state.offsetX = 0;
35
- state.offsetY = 0;
36
- state.direction = "";
37
- };
38
- const start = (e) => {
39
- reset();
40
- state.startX = e.touches[0].clientX;
41
- state.startY = e.touches[0].clientY;
42
- };
43
- const move = (e) => {
44
- state.deltaX = e.touches[0].clientX - state.startX;
45
- state.deltaY = e.touches[0].clientY - state.startY;
46
- state.offsetX = Math.abs(state.deltaX);
47
- state.offsetY = Math.abs(state.deltaY);
48
- if (!state.direction) {
49
- state.direction = getDirection(state.offsetX, state.offsetY);
11
+ const { create: w, componentName: T } = g("swiper");
12
+ var b = N(w({ props: { width: { type: [Number, String], default: window.innerWidth }, height: { type: [Number, String], default: 0 }, direction: { type: [String], default: "horizontal" }, paginationVisible: { type: Boolean, default: false }, paginationColor: { type: String, default: "#fff" }, loop: { type: Boolean, default: true }, duration: { type: [Number, String], default: 500 }, autoPlay: { type: [Number, String], default: 0 }, initPage: { type: [Number, String], default: 0 }, touchable: { type: Boolean, default: true }, isPreventDefault: { type: Boolean, default: true }, isStopPropagation: { type: Boolean, default: true } }, emits: ["change"], setup(c2, { emit: u2, slots: s2 }) {
13
+ const h2 = t(), d2 = e({ active: 0, num: 0, rect: null, width: 0, height: 0, moving: false, offset: 0, touchTime: 0, autoplayTimer: 0, children: [], childrenVNode: [], style: {} }), v2 = function() {
14
+ const t2 = e({ startX: 0, startY: 0, deltaX: 0, deltaY: 0, offsetX: 0, offsetY: 0, direction: "" }), a2 = () => {
15
+ t2.startX = 0, t2.startY = 0, t2.deltaX = 0, t2.deltaY = 0, t2.offsetX = 0, t2.offsetY = 0, t2.direction = "";
16
+ };
17
+ return { state: t2, start: (e2) => {
18
+ a2(), t2.startX = e2.touches[0].clientX, t2.startY = e2.touches[0].clientY;
19
+ }, reset: a2, move: (e2) => {
20
+ var a3, o2;
21
+ t2.deltaX = e2.touches[0].clientX - t2.startX, t2.deltaY = e2.touches[0].clientY - t2.startY, t2.offsetX = Math.abs(t2.deltaX), t2.offsetY = Math.abs(t2.deltaY), t2.direction || (t2.direction = (a3 = t2.offsetX) > (o2 = t2.offsetY) && a3 > 5 ? "horizontal" : o2 > a3 && o2 > 5 ? "vertical" : "");
22
+ } };
23
+ }(), p2 = a(() => ({ [T]: true })), f2 = a(() => c2.direction === "vertical"), m2 = a(() => f2.value ? v2.state.deltaY : v2.state.deltaX), g2 = a(() => v2.state.direction === c2.direction), N2 = a(() => d2.children.length), w2 = a(() => d2[f2.value ? "height" : "width"]), b2 = a(() => N2.value * w2.value), x = a(() => {
24
+ if (d2.rect) {
25
+ return (f2.value ? d2.rect.height : d2.rect.width) - w2.value * N2.value;
50
26
  }
51
- };
52
- return {
53
- state,
54
- start,
55
- reset,
56
- move
57
- };
58
- }
59
- const { create, componentName } = createComponent("swiper");
60
- const _sfc_main = create({
61
- props: {
62
- width: {
63
- type: [Number, String],
64
- default: window.innerWidth
65
- },
66
- height: {
67
- type: [Number, String],
68
- default: 0
69
- },
70
- direction: {
71
- type: [String],
72
- default: "horizontal"
73
- },
74
- paginationVisible: {
75
- type: Boolean,
76
- default: false
77
- },
78
- paginationColor: {
79
- type: String,
80
- default: "#fff"
81
- },
82
- loop: {
83
- type: Boolean,
84
- default: true
85
- },
86
- duration: {
87
- type: [Number, String],
88
- default: 500
89
- },
90
- autoPlay: {
91
- type: [Number, String],
92
- default: 0
93
- },
94
- initPage: {
95
- type: [Number, String],
96
- default: 0
97
- },
98
- touchable: {
99
- type: Boolean,
100
- default: true
101
- },
102
- isPreventDefault: {
103
- type: Boolean,
104
- default: true
105
- },
106
- isStopPropagation: {
107
- type: Boolean,
108
- default: true
109
- }
110
- },
111
- emits: ["change"],
112
- setup(props, { emit, slots }) {
113
- const container = ref();
114
- const state = reactive({
115
- active: 0,
116
- num: 0,
117
- rect: null,
118
- width: 0,
119
- height: 0,
120
- moving: false,
121
- offset: 0,
122
- touchTime: 0,
123
- autoplayTimer: 0,
124
- children: [],
125
- childrenVNode: [],
126
- style: {}
127
- });
128
- const touch = useTouch();
129
- const classes = computed(() => {
130
- const prefixCls = componentName;
131
- return {
132
- [prefixCls]: true
133
- };
134
- });
135
- const isVertical = computed(() => props.direction === "vertical");
136
- const delTa = computed(() => {
137
- return isVertical.value ? touch.state.deltaY : touch.state.deltaX;
138
- });
139
- const isCorrectDirection = computed(() => {
140
- return touch.state.direction === props.direction;
141
- });
142
- const childCount = computed(() => state.children.length);
143
- const size = computed(() => state[isVertical.value ? "height" : "width"]);
144
- const trackSize = computed(() => childCount.value * size.value);
145
- const minOffset = computed(() => {
146
- if (state.rect) {
147
- const base = isVertical.value ? state.rect.height : state.rect.width;
148
- return base - size.value * childCount.value;
149
- }
150
- return 0;
151
- });
152
- const activePagination = computed(() => (state.active + childCount.value) % childCount.value);
153
- const getStyle = () => {
154
- state.style = {
155
- transitionDuration: `${state.moving ? 0 : props.duration}ms`,
156
- transform: `translate${isVertical.value ? "Y" : "X"}(${state.offset}px)`,
157
- [isVertical.value ? "height" : "width"]: `${size.value * childCount.value}px`,
158
- [isVertical.value ? "width" : "height"]: `${isVertical.value ? state.width : state.height}px`
159
- };
160
- };
161
- const relation = (child) => {
162
- var _a;
163
- let children = [];
164
- let slot = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots);
165
- slot = slot.filter((item) => item.children && Array.isArray(item.children));
166
- slot.forEach((item) => {
167
- children = children.concat(item.children);
168
- });
169
- if (!state.childrenVNode.length) {
170
- state.childrenVNode = children.slice();
171
- child.proxy && state.children.push(child.proxy);
172
- } else {
173
- if (state.childrenVNode.length > children.length) {
174
- state.children = state.children.filter((item) => child.proxy !== item);
175
- } else if (state.childrenVNode.length < children.length) {
176
- for (let i = 0; i < state.childrenVNode.length; i++) {
177
- if (children[i].key !== state.childrenVNode[i].key) {
178
- child.proxy && state.children.splice(i, 0, child.proxy);
179
- child.vnode && state.childrenVNode.splice(i, 0, child.vnode);
180
- break;
181
- }
182
- }
183
- if (state.childrenVNode.length !== children.length) {
184
- child.proxy && state.children.push(child.proxy);
185
- child.vnode && state.childrenVNode.push(child.vnode);
186
- }
187
- } else {
188
- state.childrenVNode = children.slice();
189
- child.proxy && state.children.push(child.proxy);
190
- }
191
- }
192
- };
193
- const range = (num, min, max) => {
194
- return Math.min(Math.max(num, min), max);
195
- };
196
- const requestFrame = (fn) => {
197
- window.requestAnimationFrame.call(window, fn);
198
- };
199
- const getOffset = (active, offset = 0) => {
200
- let currentPosition = active * size.value;
201
- if (!props.loop) {
202
- currentPosition = Math.min(currentPosition, -minOffset.value);
203
- }
204
- let targetOffset = offset - currentPosition;
205
- if (!props.loop) {
206
- targetOffset = range(targetOffset, minOffset.value, 0);
207
- }
208
- return targetOffset;
209
- };
210
- const getActive = (pace) => {
211
- const { active } = state;
212
- if (pace) {
213
- if (props.loop) {
214
- return range(active + pace, -1, childCount.value);
215
- }
216
- return range(active + pace, 0, childCount.value - 1);
217
- }
218
- return active;
219
- };
220
- const move = ({ pace = 0, offset = 0, isEmit = false }) => {
221
- if (childCount.value <= 1)
222
- return;
223
- const { active } = state;
224
- const targetActive = getActive(pace);
225
- const targetOffset = getOffset(targetActive, offset);
226
- if (props.loop) {
227
- if (state.children[0] && targetOffset !== minOffset.value) {
228
- const rightBound = targetOffset < minOffset.value;
229
- state.children[0].setOffset(rightBound ? trackSize.value : 0);
230
- }
231
- if (state.children[childCount.value - 1] && targetOffset !== 0) {
232
- const leftBound = targetOffset > 0;
233
- state.children[childCount.value - 1].setOffset(leftBound ? -trackSize.value : 0);
234
- }
27
+ return 0;
28
+ }), X = a(() => (d2.active + N2.value) % N2.value), Y = () => {
29
+ d2.style = { transitionDuration: `${d2.moving ? 0 : c2.duration}ms`, transform: `translate${f2.value ? "Y" : "X"}(${d2.offset}px)`, [f2.value ? "height" : "width"]: w2.value * N2.value + "px", [f2.value ? "width" : "height"]: `${f2.value ? d2.width : d2.height}px` };
30
+ }, V = (e2, t2, a2) => Math.min(Math.max(e2, t2), a2), P = (e2) => {
31
+ window.requestAnimationFrame.call(window, e2);
32
+ }, M = (e2, t2 = 0) => {
33
+ let a2 = e2 * w2.value;
34
+ c2.loop || (a2 = Math.min(a2, -x.value));
35
+ let o2 = t2 - a2;
36
+ return c2.loop || (o2 = V(o2, x.value, 0)), o2;
37
+ }, S = ({ pace: e2 = 0, offset: t2 = 0, isEmit: a2 = false }) => {
38
+ if (N2.value <= 1)
39
+ return;
40
+ const { active: o2 } = d2, i2 = ((e3) => {
41
+ const { active: t3 } = d2;
42
+ return e3 ? c2.loop ? V(t3 + e3, -1, N2.value) : V(t3 + e3, 0, N2.value - 1) : t3;
43
+ })(e2), l2 = M(i2, t2);
44
+ if (c2.loop) {
45
+ if (d2.children[0] && l2 !== x.value) {
46
+ const e3 = l2 < x.value;
47
+ d2.children[0].setOffset(e3 ? b2.value : 0);
235
48
  }
236
- state.active = targetActive;
237
- state.offset = targetOffset;
238
- if (isEmit && active !== state.active) {
239
- emit("change", activePagination.value);
49
+ if (d2.children[N2.value - 1] && l2 !== 0) {
50
+ const e3 = l2 > 0;
51
+ d2.children[N2.value - 1].setOffset(e3 ? -b2.value : 0);
240
52
  }
241
- getStyle();
242
- };
243
- const resettPosition = () => {
244
- state.moving = true;
245
- if (state.active <= -1) {
246
- move({ pace: childCount.value });
247
- }
248
- if (state.active >= childCount.value) {
249
- move({ pace: -childCount.value });
250
- }
251
- };
252
- const stopAutoPlay = () => {
253
- clearTimeout(state.autoplayTimer);
254
- };
255
- const prev = () => {
256
- resettPosition();
257
- touch.reset();
258
- requestFrame(() => {
259
- requestFrame(() => {
260
- state.moving = false;
261
- move({
262
- pace: -1,
263
- isEmit: true
264
- });
265
- });
266
- });
267
- };
268
- const next = () => {
269
- resettPosition();
270
- touch.reset();
271
- requestFrame(() => {
272
- requestFrame(() => {
273
- state.moving = false;
274
- move({
275
- pace: 1,
276
- isEmit: true
277
- });
278
- });
53
+ }
54
+ d2.active = i2, d2.offset = l2, a2 && o2 !== d2.active && u2("change", X.value), Y();
55
+ }, E = () => {
56
+ d2.moving = true, d2.active <= -1 && S({ pace: N2.value }), d2.active >= N2.value && S({ pace: -N2.value });
57
+ }, $ = () => {
58
+ clearTimeout(d2.autoplayTimer);
59
+ }, k = () => {
60
+ E(), v2.reset(), P(() => {
61
+ P(() => {
62
+ d2.moving = false, S({ pace: 1, isEmit: true });
279
63
  });
280
- };
281
- const to = (index) => {
282
- resettPosition();
283
- touch.reset();
284
- requestFrame(() => {
285
- requestFrame(() => {
286
- state.moving = false;
287
- let targetIndex;
288
- if (props.loop && childCount.value === index) {
289
- targetIndex = state.active === 0 ? 0 : index;
290
- } else {
291
- targetIndex = index % childCount.value;
64
+ });
65
+ }, B = () => {
66
+ c2.autoPlay <= 0 || N2.value <= 1 || ($(), d2.autoplayTimer = setTimeout(() => {
67
+ k(), B();
68
+ }, Number(c2.autoPlay)));
69
+ }, D = (e2 = +c2.initPage) => {
70
+ $(), d2.rect = h2.value.getBoundingClientRect(), e2 = Math.min(N2.value - 1, e2), d2.width = c2.width ? +c2.width : d2.rect.width, d2.height = c2.height ? +c2.height : d2.rect.height, d2.active = e2, d2.offset = M(d2.active), d2.moving = true, Y(), B();
71
+ };
72
+ return o("parent", { props: c2, size: w2, relation: (e2) => {
73
+ var _a;
74
+ let t2 = [], a2 = (_a = s2 == null ? void 0 : s2.default) == null ? void 0 : _a.call(s2);
75
+ if (a2 = a2.filter((e3) => e3.children && Array.isArray(e3.children)), a2.forEach((e3) => {
76
+ t2 = t2.concat(e3.children);
77
+ }), d2.childrenVNode.length)
78
+ if (d2.childrenVNode.length > t2.length)
79
+ d2.children = d2.children.filter((t3) => e2.proxy !== t3);
80
+ else if (d2.childrenVNode.length < t2.length) {
81
+ for (let a3 = 0; a3 < d2.childrenVNode.length; a3++)
82
+ if (t2[a3].key !== d2.childrenVNode[a3].key) {
83
+ e2.proxy && d2.children.splice(a3, 0, e2.proxy), e2.vnode && d2.childrenVNode.splice(a3, 0, e2.vnode);
84
+ break;
292
85
  }
293
- move({
294
- pace: targetIndex - state.active,
295
- isEmit: true
296
- });
297
- });
86
+ d2.childrenVNode.length !== t2.length && (e2.proxy && d2.children.push(e2.proxy), e2.vnode && d2.childrenVNode.push(e2.vnode));
87
+ } else
88
+ d2.childrenVNode = t2.slice(), e2.proxy && d2.children.push(e2.proxy);
89
+ else
90
+ d2.childrenVNode = t2.slice(), e2.proxy && d2.children.push(e2.proxy);
91
+ } }), y({ prev: () => {
92
+ E(), v2.reset(), P(() => {
93
+ P(() => {
94
+ d2.moving = false, S({ pace: -1, isEmit: true });
298
95
  });
299
- };
300
- const autoplay = () => {
301
- if (props.autoPlay <= 0 || childCount.value <= 1)
302
- return;
303
- stopAutoPlay();
304
- state.autoplayTimer = setTimeout(() => {
305
- next();
306
- autoplay();
307
- }, Number(props.autoPlay));
308
- };
309
- const init = (active = +props.initPage) => {
310
- stopAutoPlay();
311
- state.rect = container.value.getBoundingClientRect();
312
- active = Math.min(childCount.value - 1, active);
313
- state.width = props.width ? +props.width : state.rect.width;
314
- state.height = props.height ? +props.height : state.rect.height;
315
- state.active = active;
316
- state.offset = getOffset(state.active);
317
- state.moving = true;
318
- getStyle();
319
- autoplay();
320
- };
321
- const onTouchStart = (e) => {
322
- if (props.isPreventDefault)
323
- e.preventDefault();
324
- if (props.isStopPropagation)
325
- e.stopPropagation();
326
- if (!props.touchable)
327
- return;
328
- touch.start(e);
329
- state.touchTime = Date.now();
330
- stopAutoPlay();
331
- resettPosition();
332
- };
333
- const onTouchMove = (e) => {
334
- if (props.touchable && state.moving) {
335
- touch.move(e);
336
- if (isCorrectDirection.value) {
337
- move({
338
- offset: delTa.value
339
- });
340
- }
341
- }
342
- };
343
- const onTouchEnd = (e) => {
344
- if (!props.touchable || !state.moving)
345
- return;
346
- const speed = delTa.value / (Date.now() - state.touchTime);
347
- const isShouldMove = Math.abs(speed) > 0.3 || Math.abs(delTa.value) > +(size.value / 2).toFixed(2);
348
- if (isShouldMove && isCorrectDirection.value) {
349
- let pace = 0;
350
- const offset = isVertical.value ? touch.state.offsetY : touch.state.offsetX;
351
- if (props.loop) {
352
- pace = offset > 0 ? delTa.value > 0 ? -1 : 1 : 0;
353
- } else {
354
- pace = -Math[delTa.value > 0 ? "ceil" : "floor"](delTa.value / size.value);
355
- }
356
- move({
357
- pace,
358
- isEmit: true
359
- });
360
- } else if (delTa.value) {
361
- move({ pace: 0 });
362
- }
363
- state.moving = false;
364
- getStyle();
365
- autoplay();
366
- };
367
- provide("parent", {
368
- props,
369
- size,
370
- relation
371
- });
372
- useExpose({
373
- prev,
374
- next,
375
- to
376
- });
377
- onDeactivated(() => {
378
- stopAutoPlay();
379
96
  });
380
- onBeforeUnmount(() => {
381
- stopAutoPlay();
382
- });
383
- watch(() => props.initPage, (val) => {
384
- nextTick(() => {
385
- init(Number(val));
97
+ }, next: k, to: (e2) => {
98
+ E(), v2.reset(), P(() => {
99
+ P(() => {
100
+ let t2;
101
+ d2.moving = false, t2 = c2.loop && N2.value === e2 ? d2.active === 0 ? 0 : e2 : e2 % N2.value, S({ pace: t2 - d2.active, isEmit: true });
386
102
  });
387
103
  });
388
- watch(() => state.children.length, () => {
389
- nextTick(() => {
390
- init();
391
- });
104
+ } }), i(() => {
105
+ $();
106
+ }), l(() => {
107
+ $();
108
+ }), n(() => c2.initPage, (e2) => {
109
+ r(() => {
110
+ D(Number(e2));
392
111
  });
393
- watch(() => props.autoPlay, (val) => {
394
- val > 0 ? autoplay() : stopAutoPlay();
112
+ }), n(() => d2.children.length, () => {
113
+ r(() => {
114
+ D();
395
115
  });
396
- return {
397
- state,
398
- classes,
399
- container,
400
- componentName,
401
- isVertical,
402
- slots,
403
- activePagination,
404
- onTouchStart,
405
- onTouchMove,
406
- onTouchEnd
407
- };
408
- }
409
- });
410
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
411
- return openBlock(), createElementBlock("view", {
412
- ref: "container",
413
- class: normalizeClass(_ctx.classes),
414
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
415
- onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
416
- onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
417
- onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
418
- }, [
419
- createElementVNode("view", {
420
- class: normalizeClass({
421
- [`${_ctx.componentName}-inner`]: true,
422
- [`${_ctx.componentName}-vertical`]: _ctx.isVertical
423
- }),
424
- style: normalizeStyle(_ctx.state.style)
425
- }, [
426
- renderSlot(_ctx.$slots, "default")
427
- ], 6),
428
- renderSlot(_ctx.$slots, "page"),
429
- _ctx.paginationVisible && !_ctx.slots.page ? (openBlock(), createElementBlock("view", {
430
- key: 0,
431
- class: normalizeClass({
432
- [`${_ctx.componentName}-pagination`]: true,
433
- [`${_ctx.componentName}-pagination-vertical`]: _ctx.isVertical
434
- })
435
- }, [
436
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.state.children.length, (item, index) => {
437
- return openBlock(), createElementBlock("i", {
438
- style: normalizeStyle({
439
- backgroundColor: _ctx.activePagination === index ? _ctx.paginationColor : "#ddd"
440
- }),
441
- class: normalizeClass({ active: _ctx.activePagination === index }),
442
- key: index
443
- }, null, 6);
444
- }), 128))
445
- ], 2)) : createCommentVNode("", true)
446
- ], 34);
447
- }
448
- var Swiper = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
449
- export { Swiper as default };
116
+ }), n(() => c2.autoPlay, (e2) => {
117
+ e2 > 0 ? B() : $();
118
+ }), { state: d2, classes: p2, container: h2, componentName: T, isVertical: f2, slots: s2, activePagination: X, onTouchStart: (e2) => {
119
+ c2.isPreventDefault && e2.preventDefault(), c2.isStopPropagation && e2.stopPropagation(), c2.touchable && (v2.start(e2), d2.touchTime = Date.now(), $(), E());
120
+ }, onTouchMove: (e2) => {
121
+ c2.touchable && d2.moving && (v2.move(e2), g2.value && S({ offset: m2.value }));
122
+ }, onTouchEnd: (e2) => {
123
+ if (!c2.touchable || !d2.moving)
124
+ return;
125
+ const t2 = m2.value / (Date.now() - d2.touchTime);
126
+ if ((Math.abs(t2) > 0.3 || Math.abs(m2.value) > +(w2.value / 2).toFixed(2)) && g2.value) {
127
+ let e3 = 0;
128
+ const t3 = f2.value ? v2.state.offsetY : v2.state.offsetX;
129
+ e3 = c2.loop ? t3 > 0 ? m2.value > 0 ? -1 : 1 : 0 : -Math[m2.value > 0 ? "ceil" : "floor"](m2.value / w2.value), S({ pace: e3, isEmit: true });
130
+ } else
131
+ m2.value && S({ pace: 0 });
132
+ d2.moving = false, Y(), B();
133
+ } };
134
+ } }), [["render", function(e2, t2, a2, o2, i2, l2) {
135
+ return c(), u("view", { ref: "container", class: s(e2.classes), onTouchstart: t2[0] || (t2[0] = (...t3) => e2.onTouchStart && e2.onTouchStart(...t3)), onTouchmove: t2[1] || (t2[1] = (...t3) => e2.onTouchMove && e2.onTouchMove(...t3)), onTouchend: t2[2] || (t2[2] = (...t3) => e2.onTouchEnd && e2.onTouchEnd(...t3)), onTouchcancel: t2[3] || (t2[3] = (...t3) => e2.onTouchEnd && e2.onTouchEnd(...t3)) }, [h("view", { class: s({ [`${e2.componentName}-inner`]: true, [`${e2.componentName}-vertical`]: e2.isVertical }), style: d(e2.state.style) }, [v(e2.$slots, "default")], 6), v(e2.$slots, "page"), e2.paginationVisible && !e2.slots.page ? (c(), u("view", { key: 0, class: s({ [`${e2.componentName}-pagination`]: true, [`${e2.componentName}-pagination-vertical`]: e2.isVertical }) }, [(c(true), u(p, null, f(e2.state.children.length, (t3, a3) => (c(), u("i", { style: d({ backgroundColor: e2.activePagination === a3 ? e2.paginationColor : "#ddd" }), class: s({ active: e2.activePagination === a3 }), key: a3 }, null, 6))), 128))], 2)) : m("", true)], 34);
136
+ }]]);
137
+ export { b as default };
@@ -1,58 +1,27 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { inject, getCurrentInstance, reactive, computed, onUnmounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { u as useExpose } from "./index3.js";
9
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { inject as e, getCurrentInstance as t, reactive as s, computed as o, onUnmounted as r, openBlock as n, createElementBlock as a, normalizeClass as l, normalizeStyle as i, renderSlot as f } from "vue";
7
+ import { c as p } from "./component.js";
8
+ import { u as m } from "./index3.js";
9
+ import { _ as u } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { create, componentName } = createComponent("swiper-item");
12
- const _sfc_main = create({
13
- setup(props, { slots }) {
14
- const parent = inject("parent");
15
- parent["relation"](getCurrentInstance());
16
- const state = reactive({
17
- offset: 0
18
- });
19
- const classes = computed(() => {
20
- const prefixCls = componentName;
21
- return {
22
- [prefixCls]: true
23
- };
24
- });
25
- const style = computed(() => {
26
- const style2 = {};
27
- const direction = parent == null ? void 0 : parent.props.direction;
28
- if (parent == null ? void 0 : parent.size.value) {
29
- style2[direction === "horizontal" ? "width" : "height"] = `${parent == null ? void 0 : parent.size.value}px`;
30
- }
31
- if (state.offset) {
32
- style2["transform"] = `translate${direction === "horizontal" ? "X" : "Y"}(${state.offset}px)`;
33
- }
34
- return style2;
35
- });
36
- const setOffset = (offset) => {
37
- state.offset = offset;
38
- };
39
- onUnmounted(() => {
40
- parent["relation"](getCurrentInstance(), "unmount");
41
- });
42
- useExpose({ setOffset });
43
- return {
44
- style,
45
- classes
46
- };
47
- }
48
- });
49
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
50
- return openBlock(), createElementBlock("view", {
51
- class: normalizeClass(_ctx.classes),
52
- style: normalizeStyle(_ctx.style)
53
- }, [
54
- renderSlot(_ctx.$slots, "default")
55
- ], 6);
56
- }
57
- var SwiperItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
58
- export { SwiperItem as default };
11
+ const { create: c, componentName: d } = p("swiper-item");
12
+ var h = u(c({ setup(n2, { slots: a2 }) {
13
+ const l2 = e("parent");
14
+ l2.relation(t());
15
+ const i2 = s({ offset: 0 }), f2 = o(() => ({ [d]: true })), p2 = o(() => {
16
+ const e2 = {}, t2 = l2 == null ? void 0 : l2.props.direction;
17
+ return (l2 == null ? void 0 : l2.size.value) && (e2[t2 === "horizontal" ? "width" : "height"] = `${l2 == null ? void 0 : l2.size.value}px`), i2.offset && (e2.transform = `translate${t2 === "horizontal" ? "X" : "Y"}(${i2.offset}px)`), e2;
18
+ });
19
+ return r(() => {
20
+ l2.relation(t(), "unmount");
21
+ }), m({ setOffset: (e2) => {
22
+ i2.offset = e2;
23
+ } }), { style: p2, classes: f2 };
24
+ } }), [["render", function(e2, t2, s2, o2, r2, p2) {
25
+ return n(), a("view", { class: l(e2.classes), style: i(e2.style) }, [f(e2.$slots, "default")], 6);
26
+ }]]);
27
+ export { h as default };