@nutui/nutui 4.0.0 → 4.0.1-2.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 (285) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/README.md +34 -65
  3. package/dist/nutui.es.js +10 -17
  4. package/dist/nutui.js +16202 -0
  5. package/dist/nutui.umd.js +1 -7
  6. package/dist/packages/_es/ActionSheet.js +79 -94
  7. package/dist/packages/_es/Address.js +260 -345
  8. package/dist/packages/_es/AddressList.js +269 -354
  9. package/dist/packages/_es/Animate.js +46 -38
  10. package/dist/packages/_es/Audio.js +128 -180
  11. package/dist/packages/_es/AudioOperate.js +60 -52
  12. package/dist/packages/_es/Avatar.js +67 -75
  13. package/dist/packages/_es/AvatarGroup.js +23 -31
  14. package/dist/packages/_es/Backtop.js +59 -99
  15. package/dist/packages/_es/Badge.js +39 -46
  16. package/dist/packages/_es/Barrage.js +68 -145
  17. package/dist/packages/_es/Button.js +47 -66
  18. package/dist/packages/_es/Calendar.js +135 -152
  19. package/dist/packages/_es/CalendarItem.js +6 -6
  20. package/dist/packages/_es/Card.js +42 -56
  21. package/dist/packages/_es/Cascader.js +323 -433
  22. package/dist/packages/_es/Category.js +29 -39
  23. package/dist/packages/_es/CategoryPane.js +57 -83
  24. package/dist/packages/_es/Cell.js +56 -71
  25. package/dist/packages/_es/CellGroup.js +19 -27
  26. package/dist/packages/_es/Checkbox.js +109 -138
  27. package/dist/packages/_es/CheckboxGroup.js +38 -61
  28. package/dist/packages/_es/CircleProgress.js +67 -96
  29. package/dist/packages/_es/Col.js +23 -31
  30. package/dist/packages/_es/Collapse.js +37 -67
  31. package/dist/packages/_es/CollapseItem.js +91 -184
  32. package/dist/packages/_es/Comment.js +207 -279
  33. package/dist/packages/_es/ConfigProvider.js +38 -56
  34. package/dist/packages/_es/Countdown.js +100 -194
  35. package/dist/packages/_es/Countup.js +232 -428
  36. package/dist/packages/_es/DatePicker.js +169 -245
  37. package/dist/packages/_es/Dialog.js +163 -188
  38. package/dist/packages/_es/Divider.js +42 -40
  39. package/dist/packages/_es/Drag.js +70 -153
  40. package/dist/packages/_es/Ecard.js +64 -104
  41. package/dist/packages/_es/Elevator.js +144 -201
  42. package/dist/packages/_es/Ellipsis.js +95 -159
  43. package/dist/packages/_es/Empty.js +23 -39
  44. package/dist/packages/_es/FixedNav.js +93 -116
  45. package/dist/packages/_es/Form.js +108 -164
  46. package/dist/packages/_es/FormItem.js +48 -61
  47. package/dist/packages/_es/Grid.js +5 -6
  48. package/dist/packages/_es/GridItem.js +58 -84
  49. package/dist/packages/_es/Image.js +98 -88
  50. package/dist/packages/_es/ImagePreview.js +262 -392
  51. package/dist/packages/_es/Indicator.js +30 -34
  52. package/dist/packages/_es/InfiniteLoading.js +83 -117
  53. package/dist/packages/_es/Input.js +176 -223
  54. package/dist/packages/_es/InputNumber.js +81 -117
  55. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  56. package/dist/packages/_es/Invoice.js +105 -113
  57. package/dist/packages/_es/Layout.js +3 -4
  58. package/dist/packages/_es/List.js +147 -89
  59. package/dist/packages/_es/Menu.js +96 -152
  60. package/dist/packages/_es/MenuItem.js +117 -153
  61. package/dist/packages/_es/Navbar.js +103 -119
  62. package/dist/packages/_es/Noticebar.js +207 -273
  63. package/dist/packages/_es/Notify.js +110 -147
  64. package/dist/packages/_es/NumberKeyboard.js +127 -202
  65. package/dist/packages/_es/Overlay.js +53 -66
  66. package/dist/packages/_es/Pagination.js +70 -100
  67. package/dist/packages/_es/Picker.js +276 -425
  68. package/dist/packages/_es/Popover.js +122 -225
  69. package/dist/packages/_es/Popup.js +4 -4
  70. package/dist/packages/_es/Price.js +47 -80
  71. package/dist/packages/_es/Progress.js +63 -79
  72. package/dist/packages/_es/PullRefresh.js +96 -157
  73. package/dist/packages/_es/Radio.js +4 -4
  74. package/dist/packages/_es/RadioGroup.js +3 -3
  75. package/dist/packages/_es/Range.js +205 -329
  76. package/dist/packages/_es/Rate.js +93 -122
  77. package/dist/packages/_es/Row.js +21 -27
  78. package/dist/packages/_es/Searchbar.js +130 -160
  79. package/dist/packages/_es/ShortPassword.js +69 -93
  80. package/dist/packages/_es/SideNavbar.js +49 -59
  81. package/dist/packages/_es/SideNavbarItem.js +22 -32
  82. package/dist/packages/_es/Signature.js +83 -128
  83. package/dist/packages/_es/Skeleton.js +110 -130
  84. package/dist/packages/_es/Sku.js +251 -326
  85. package/dist/packages/_es/Step.js +60 -69
  86. package/dist/packages/_es/Steps.js +26 -31
  87. package/dist/packages/_es/Sticky.js +4 -4
  88. package/dist/packages/_es/SubSideNavbar.js +52 -56
  89. package/dist/packages/_es/Swipe.js +84 -137
  90. package/dist/packages/_es/Swiper.js +175 -310
  91. package/dist/packages/_es/SwiperItem.js +28 -44
  92. package/dist/packages/_es/Switch.js +55 -67
  93. package/dist/packages/_es/TabPane.js +32 -20
  94. package/dist/packages/_es/Tabbar.js +41 -52
  95. package/dist/packages/_es/TabbarItem.js +61 -81
  96. package/dist/packages/_es/Table.js +110 -148
  97. package/dist/packages/_es/Tabs.js +284 -205
  98. package/dist/packages/_es/Tag.js +44 -61
  99. package/dist/packages/_es/Textarea.js +80 -124
  100. package/dist/packages/_es/TimeDetail.js +49 -57
  101. package/dist/packages/_es/TimePannel.js +35 -31
  102. package/dist/packages/_es/TimeSelect.js +47 -68
  103. package/dist/packages/_es/Toast.js +150 -203
  104. package/dist/packages/_es/Tour.js +139 -175
  105. package/dist/packages/_es/TrendArrow.js +57 -58
  106. package/dist/packages/_es/Uploader.js +235 -359
  107. package/dist/packages/_es/Video.js +191 -298
  108. package/dist/packages/_es/Watermark.js +84 -98
  109. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  110. package/dist/packages/_es/common-d218746f.js +116 -0
  111. package/dist/packages/_es/component-234624bc.js +89 -0
  112. package/dist/packages/_es/index-14dfadc4.js +561 -0
  113. package/dist/packages/_es/index-192a3ef6.js +29 -0
  114. package/dist/packages/_es/index-360c5092.js +210 -0
  115. package/dist/packages/_es/index-496e6e05.js +24 -0
  116. package/dist/packages/_es/index-50eed3d9.js +7 -0
  117. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  118. package/dist/packages/_es/index-fadb0974.js +8 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  121. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  122. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  123. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  124. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  125. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  126. package/dist/packages/actionsheet/index.scss +2 -0
  127. package/dist/packages/actionsheet/style.mjs +0 -2
  128. package/dist/packages/address/index.scss +5 -2
  129. package/dist/packages/address/style.mjs +0 -3
  130. package/dist/packages/addresslist/index.scss +3 -0
  131. package/dist/packages/addresslist/style.mjs +0 -2
  132. package/dist/packages/audio/index.scss +2 -0
  133. package/dist/packages/audio/style.mjs +0 -1
  134. package/dist/packages/audiooperate/index.scss +2 -0
  135. package/dist/packages/audiooperate/style.mjs +0 -1
  136. package/dist/packages/badge/index.scss +3 -0
  137. package/dist/packages/button/index.scss +1 -1
  138. package/dist/packages/calendar/index.scss +3 -0
  139. package/dist/packages/calendar/style.mjs +0 -3
  140. package/dist/packages/card/index.scss +3 -0
  141. package/dist/packages/card/style.mjs +0 -2
  142. package/dist/packages/cascader/index.scss +4 -0
  143. package/dist/packages/cascader/style.mjs +0 -5
  144. package/dist/packages/cellgroup/index.scss +1 -1
  145. package/dist/packages/checkbox/index.scss +41 -0
  146. package/dist/packages/col/index.scss +2 -2
  147. package/dist/packages/comment/index.scss +2 -0
  148. package/dist/packages/comment/style.mjs +0 -1
  149. package/dist/packages/datepicker/index.scss +1 -2
  150. package/dist/packages/datepicker/style.mjs +0 -3
  151. package/dist/packages/dialog/index.scss +11 -0
  152. package/dist/packages/dialog/style.mjs +0 -3
  153. package/dist/packages/ecard/index.scss +2 -0
  154. package/dist/packages/ecard/style.mjs +0 -1
  155. package/dist/packages/fixednav/index.scss +2 -0
  156. package/dist/packages/fixednav/style.mjs +0 -1
  157. package/dist/packages/form/index.scss +1 -2
  158. package/dist/packages/form/style.mjs +0 -1
  159. package/dist/packages/formitem/index.scss +3 -0
  160. package/dist/packages/formitem/style.mjs +0 -1
  161. package/dist/packages/imagepreview/index.scss +5 -5
  162. package/dist/packages/imagepreview/style.mjs +0 -5
  163. package/dist/packages/input/index.scss +13 -13
  164. package/dist/packages/invoice/index.scss +6 -0
  165. package/dist/packages/invoice/style.mjs +0 -7
  166. package/dist/packages/list/index.scss +8 -8
  167. package/dist/packages/menuitem/index.scss +9 -10
  168. package/dist/packages/menuitem/style.mjs +0 -2
  169. package/dist/packages/navbar/index.scss +0 -1
  170. package/dist/packages/noticebar/index.scss +12 -2
  171. package/dist/packages/notify/index.scss +2 -0
  172. package/dist/packages/notify/style.mjs +0 -2
  173. package/dist/packages/numberkeyboard/index.scss +2 -0
  174. package/dist/packages/numberkeyboard/style.mjs +0 -2
  175. package/dist/packages/picker/index.scss +4 -9
  176. package/dist/packages/picker/style.mjs +0 -2
  177. package/dist/packages/popover/index.scss +2 -0
  178. package/dist/packages/popover/style.mjs +0 -2
  179. package/dist/packages/popup/index.scss +2 -0
  180. package/dist/packages/popup/style.mjs +0 -1
  181. package/dist/packages/price/index.scss +5 -10
  182. package/dist/packages/rate/index.scss +6 -9
  183. package/dist/packages/searchbar/index.scss +4 -0
  184. package/dist/packages/shortpassword/index.scss +18 -0
  185. package/dist/packages/shortpassword/style.mjs +0 -2
  186. package/dist/packages/signature/index.scss +2 -0
  187. package/dist/packages/signature/style.mjs +0 -1
  188. package/dist/packages/skeleton/index.scss +2 -0
  189. package/dist/packages/skeleton/style.mjs +0 -1
  190. package/dist/packages/sku/index.scss +4 -0
  191. package/dist/packages/sku/style.mjs +0 -4
  192. package/dist/packages/tabbaritem/index.scss +2 -0
  193. package/dist/packages/tabbaritem/style.mjs +0 -1
  194. package/dist/packages/tabs/index.scss +36 -2
  195. package/dist/packages/tabs/style.mjs +0 -1
  196. package/dist/packages/textarea/index.scss +2 -0
  197. package/dist/packages/timeselect/index.scss +2 -0
  198. package/dist/packages/timeselect/style.mjs +0 -2
  199. package/dist/packages/tour/index.scss +2 -0
  200. package/dist/packages/tour/style.mjs +0 -3
  201. package/dist/packages/uploader/index.scss +10 -2
  202. package/dist/packages/uploader/style.mjs +0 -2
  203. package/dist/resolver/index.d.ts +6 -0
  204. package/dist/resolver/index.js +1 -0
  205. package/dist/resolver/index.mjs +24 -0
  206. package/dist/resolver/package.json +20 -0
  207. package/dist/smartips/web-types.json +114 -15
  208. package/dist/style.css +1 -1
  209. package/dist/styles/themes/default.scss +155 -52
  210. package/dist/styles/themes/jdb.scss +155 -52
  211. package/dist/styles/themes/jddkh.scss +155 -52
  212. package/dist/styles/themes/jdt.scss +155 -52
  213. package/dist/styles/variables-jdb.scss +9 -1
  214. package/dist/styles/variables-jddkh.scss +9 -1
  215. package/dist/styles/variables-jdt.scss +9 -1
  216. package/dist/styles/variables.scss +8 -0
  217. package/dist/types/__VUE/address/index.vue.d.ts +2 -1
  218. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +1 -1
  219. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -1
  220. package/dist/types/__VUE/addresslist/index.vue.d.ts +1 -1
  221. package/dist/types/__VUE/animate/index.vue.d.ts +6 -0
  222. package/dist/types/__VUE/audiooperate/index.vue.d.ts +4 -4
  223. package/dist/types/__VUE/badge/index.vue.d.ts +9 -0
  224. package/dist/types/__VUE/button/type.d.ts +1 -0
  225. package/dist/types/__VUE/calendaritem/type.d.ts +1 -0
  226. package/dist/types/__VUE/collapse/index.vue.d.ts +31 -5
  227. package/dist/types/__VUE/collapseitem/index.vue.d.ts +117 -11
  228. package/dist/types/__VUE/configprovider/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/datepicker/index.vue.d.ts +1 -1
  230. package/dist/types/__VUE/dialog/index.d.ts +1 -0
  231. package/dist/types/__VUE/dialog/index.vue.d.ts +1 -0
  232. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  233. package/dist/types/__VUE/image/index.vue.d.ts +14 -3
  234. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +9 -0
  235. package/dist/types/__VUE/imagepreview/index.vue.d.ts +1 -1
  236. package/dist/types/__VUE/input/index.vue.d.ts +27 -2
  237. package/dist/types/__VUE/list/index.vue.d.ts +42 -13
  238. package/dist/types/__VUE/list/type.d.ts +13 -0
  239. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  240. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  241. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  242. package/dist/types/__VUE/noticebar/index.vue.d.ts +5 -2
  243. package/dist/types/__VUE/picker/common.d.ts +2 -0
  244. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  245. package/dist/types/__VUE/price/index.vue.d.ts +9 -0
  246. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  247. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  248. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  249. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  250. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  251. package/dist/types/__VUE/switch/index.vue.d.ts +1 -0
  252. package/dist/types/__VUE/table/common.d.ts +55 -2
  253. package/dist/types/__VUE/tabpane/index.vue.d.ts +1 -4
  254. package/dist/types/__VUE/tabs/hooks.d.ts +12 -0
  255. package/dist/types/__VUE/tabs/index.vue.d.ts +35 -5
  256. package/dist/types/__VUE/tabs/types.d.ts +12 -0
  257. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  258. package/dist/types/__VUE/toast/index.vue.d.ts +11 -4
  259. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  260. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  261. package/dist/types/index.d.ts +1 -2
  262. package/dist/types/resolver/index.d.ts +6 -0
  263. package/dist/types/utils/date.d.ts +4 -0
  264. package/dist/types/utils/useTaroRect/index.d.ts +1 -1
  265. package/dist/types/utils/util.d.ts +1 -1
  266. package/package.json +13 -6
  267. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  268. package/dist/packages/_es/common-b9a5e726.js +0 -145
  269. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  270. package/dist/packages/_es/index-29892cda.js +0 -33
  271. package/dist/packages/_es/index-2ae3ae87.js +0 -846
  272. package/dist/packages/_es/index-43c34ac6.js +0 -30
  273. package/dist/packages/_es/index-54d03fc1.js +0 -8
  274. package/dist/packages/_es/index-79c5dc33.js +0 -10
  275. package/dist/packages/_es/index-7a7385e4.js +0 -67
  276. package/dist/packages/_es/index-991c279f.js +0 -244
  277. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  278. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  279. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  280. package/dist/packages/_es/interceptor-956b24fc.js +0 -29
  281. package/dist/packages/_es/mountComponent-1ece4110.js +0 -39
  282. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  283. package/dist/packages/_es/raf-729dad54.js +0 -25
  284. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
  285. /package/dist/types/utils/{interceptor.d.ts → Interceptor.d.ts} +0 -0
@@ -1,28 +1,107 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
1
+ var de = Object.defineProperty;
2
+ var q = Object.getOwnPropertySymbols;
3
+ var me = Object.prototype.hasOwnProperty, ye = Object.prototype.propertyIsEnumerable;
4
+ var H = (e, i, n) => i in e ? de(e, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[i] = n, P = (e, i) => {
5
+ for (var n in i || (i = {}))
6
+ me.call(i, n) && H(e, n, i[n]);
7
+ if (q)
8
+ for (var n of q(i))
9
+ ye.call(i, n) && H(e, n, i[n]);
10
+ return e;
6
11
  };
7
- import { c as createComponent, T as TypeOfFun } from "./component-81a4c1d0.js";
8
- import { ref, provide, computed, watch, onMounted, onActivated, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode, createVNode, toDisplayString } from "vue";
9
- import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
10
- import { u as useRect } from "./index-29892cda.js";
11
- import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_lang-cc5c4086.js";
12
- import { JoySmile } from "@nutui/icons-vue";
13
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
12
+ var K = (e, i, n) => (H(e, typeof i != "symbol" ? i + "" : i, n), n);
13
+ var j = (e, i, n) => new Promise((T, m) => {
14
+ var r = (l) => {
15
+ try {
16
+ a(n.next(l));
17
+ } catch (c) {
18
+ m(c);
19
+ }
20
+ }, h = (l) => {
21
+ try {
22
+ a(n.throw(l));
23
+ } catch (c) {
24
+ m(c);
25
+ }
26
+ }, a = (l) => l.done ? T(l.value) : Promise.resolve(l.value).then(r, h);
27
+ a((n = n.apply(e, i)).next());
28
+ });
29
+ import { c as pe, T as Q } from "./component-234624bc.js";
30
+ import { ref as V, onMounted as le, reactive as he, provide as be, computed as S, watch as U, onActivated as ve, nextTick as ge, resolveComponent as X, openBlock as y, createElementBlock as p, normalizeClass as w, createBlock as Se, withCtx as Te, createElementVNode as N, normalizeStyle as b, renderSlot as D, Fragment as Z, renderList as _, createCommentVNode as M, createVNode as x, toDisplayString as ee } from "vue";
31
+ import { p as ke } from "./pxCheck-38173291.js";
32
+ import { u as we } from "./index-192a3ef6.js";
33
+ import { r as Ve } from "./raf-a74f1a06.js";
34
+ import { _ as te } from "./index.vue_vue_type_script_lang-f44c159d.js";
35
+ import { JoySmile as Ce } from "@nutui/icons-vue";
36
+ import { u as Ee } from "./index-53ec2d4d.js";
37
+ import { _ as $e } from "./_plugin-vue_export-helper-dad06003.js";
14
38
  import "../locale/lang";
15
- class Title {
39
+ const ze = (e, i, n, T) => {
40
+ const m = V(), r = V({ width: 0, height: 0 }), h = () => j(void 0, null, function* () {
41
+ var u, k;
42
+ if (n && n.getEnv() !== n.ENV_TYPE.WEB) {
43
+ let s = yield T(m, n);
44
+ r.value.width = s.width || 0, r.value.height = s.height || 0;
45
+ } else
46
+ r.value.width = ((u = m.value) == null ? void 0 : u.clientWidth) || 0, r.value.height = ((k = m.value) == null ? void 0 : k.clientHeight) || 0;
47
+ });
48
+ le(() => {
49
+ setTimeout(() => {
50
+ h();
51
+ }, 100);
52
+ });
53
+ const a = he({
54
+ offset: 0,
55
+ moving: !1
56
+ }), l = Ee();
57
+ let c = "";
58
+ const v = (u, k) => {
59
+ var R;
60
+ let s = u;
61
+ switch (e.direction == "horizontal" ? (c = u > 0 ? "right" : "left", s = Math.abs(s) / r.value.width * 100) : (c = k > 0 ? "bottom" : "top", s = k, s = Math.abs(s) / ((R = r.value) == null ? void 0 : R.height) * 100), s > 85 && (s = 85), c) {
62
+ case "left":
63
+ case "top":
64
+ i.isEnd() && (s = 0, a.moving = !1);
65
+ break;
66
+ case "right":
67
+ case "bottom":
68
+ s = -s, i.isBegin() && (s = 0, a.moving = !1);
69
+ break;
70
+ }
71
+ a.offset = s;
72
+ };
73
+ return { touchMethods: {
74
+ onTouchStart(u) {
75
+ e.swipeable && l.start(u);
76
+ },
77
+ onTouchMove(u) {
78
+ e.swipeable && (l.move(u), a.moving = !0, v(l.deltaX.value, l.deltaY.value), e.direction == "horizontal" && l.isHorizontal() && (u.preventDefault(), u.stopPropagation()), e.direction == "vertical" && l.isVertical() && (u.preventDefault(), u.stopPropagation()));
79
+ },
80
+ onTouchEnd() {
81
+ if (a.moving)
82
+ switch (a.moving = !1, c) {
83
+ case "left":
84
+ case "top":
85
+ a.offset > 35 && i.next();
86
+ break;
87
+ case "right":
88
+ case "bottom":
89
+ a.offset < -35 && i.prev();
90
+ break;
91
+ }
92
+ }
93
+ }, touchState: a, tabsContentRef: m };
94
+ };
95
+ class Ke {
16
96
  constructor() {
17
- __publicField(this, "title", "");
18
- __publicField(this, "titleSlot");
19
- __publicField(this, "paneKey", "");
20
- __publicField(this, "disabled", false);
97
+ K(this, "title", "");
98
+ K(this, "titleSlot");
99
+ K(this, "paneKey", "");
100
+ K(this, "disabled", !1);
21
101
  }
22
102
  }
23
- const { create } = createComponent("tabs");
24
- const _sfc_main = create({
25
- components: { [_sfc_main$1.name]: _sfc_main$1, JoySmile },
103
+ const { create: Re } = pe("tabs"), Be = Re({
104
+ components: { [te.name]: te, JoySmile: Ce },
26
105
  props: {
27
106
  modelValue: {
28
107
  type: [String, Number],
@@ -48,15 +127,19 @@ const _sfc_main = create({
48
127
  },
49
128
  titleScroll: {
50
129
  type: Boolean,
51
- default: false
130
+ default: !1
52
131
  },
53
132
  ellipsis: {
54
133
  type: Boolean,
55
- default: true
134
+ default: !0
135
+ },
136
+ swipeable: {
137
+ type: Boolean,
138
+ default: !1
56
139
  },
57
140
  autoHeight: {
58
141
  type: Boolean,
59
- default: false
142
+ default: !1
60
143
  },
61
144
  background: {
62
145
  type: String,
@@ -72,7 +155,7 @@ const _sfc_main = create({
72
155
  },
73
156
  sticky: {
74
157
  type: Boolean,
75
- default: false
158
+ default: !1
76
159
  },
77
160
  top: {
78
161
  type: Number,
@@ -80,221 +163,217 @@ const _sfc_main = create({
80
163
  }
81
164
  },
82
165
  emits: ["update:modelValue", "click", "change"],
83
- setup(props, { emit, slots }) {
84
- const container = ref(null);
85
- let stickyFixed;
86
- provide("activeKey", { activeKey: computed(() => props.modelValue) });
87
- provide("autoHeight", { autoHeight: computed(() => props.autoHeight) });
88
- const titles = ref([]);
89
- const renderTitles = (vnodes) => {
90
- vnodes.forEach((vnode, index) => {
91
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
92
- let type = vnode.type;
93
- type = type.name || type;
94
- if (type == "nut-tab-pane") {
95
- let title = new Title();
96
- if (((_a = vnode.props) == null ? void 0 : _a.title) || ((_b = vnode.props) == null ? void 0 : _b["pane-key"]) || ((_c = vnode.props) == null ? void 0 : _c["paneKey"])) {
97
- let paneKeyType = TypeOfFun((_d = vnode.props) == null ? void 0 : _d["pane-key"]);
98
- let paneIndex = paneKeyType == "number" || paneKeyType == "string" ? String((_e = vnode.props) == null ? void 0 : _e["pane-key"]) : null;
99
- let camelPaneKeyType = TypeOfFun((_f = vnode.props) == null ? void 0 : _f["paneKey"]);
100
- let camelPaneIndex = camelPaneKeyType == "number" || camelPaneKeyType == "string" ? String((_g = vnode.props) == null ? void 0 : _g["paneKey"]) : null;
101
- title.title = (_h = vnode.props) == null ? void 0 : _h.title;
102
- title.paneKey = paneIndex || camelPaneIndex || String(index);
103
- title.disabled = (_i = vnode.props) == null ? void 0 : _i.disabled;
166
+ setup(e, { emit: i, slots: n }) {
167
+ const T = V(null);
168
+ let m;
169
+ be("tabsOpiton", {
170
+ activeKey: S(() => e.modelValue || "0"),
171
+ autoHeight: S(() => e.autoHeight),
172
+ animatedTime: S(() => e.animatedTime)
173
+ });
174
+ const r = V([]), h = (t) => {
175
+ t.forEach((o, f) => {
176
+ var g, C, E, z, L, W, F, Y, G;
177
+ let d = o.type;
178
+ if (d = d.name || d, d == "nut-tab-pane") {
179
+ let B = new Ke();
180
+ if ((g = o.props) != null && g.title || (C = o.props) != null && C["pane-key"] || (E = o.props) != null && E.paneKey) {
181
+ let J = Q((z = o.props) == null ? void 0 : z["pane-key"]), ce = J == "number" || J == "string" ? String((L = o.props) == null ? void 0 : L["pane-key"]) : null, O = Q((W = o.props) == null ? void 0 : W.paneKey), fe = O == "number" || O == "string" ? String((F = o.props) == null ? void 0 : F.paneKey) : null;
182
+ B.title = (Y = o.props) == null ? void 0 : Y.title, B.paneKey = ce || fe || String(f), B.disabled = (G = o.props) == null ? void 0 : G.disabled;
104
183
  }
105
- titles.value.push(title);
184
+ r.value.push(B);
106
185
  } else {
107
- if (vnode.children == " ") {
186
+ if (o.children == " ")
108
187
  return;
109
- }
110
- renderTitles(vnode.children);
188
+ h(o.children);
111
189
  }
112
190
  });
113
- };
114
- const currentIndex = ref(props.modelValue || 0);
115
- const findTabsIndex = (value) => {
116
- let index = titles.value.findIndex((item) => item.paneKey == value);
117
- if (titles.value.length == 0) {
118
- console.error("[NutUI] <Tabs> 当前未找到 TabPane 组件元素 , 请检查 .");
119
- } else if (index == -1)
120
- ;
121
- else {
122
- currentIndex.value = index;
191
+ }, a = V(e.modelValue || 0), l = (t) => {
192
+ let o = r.value.findIndex((f) => f.paneKey == t);
193
+ r.value.length == 0 || o == -1 || (a.value = o);
194
+ }, c = S(() => e.titleScroll && e.direction === "vertical"), v = V(), I = V([]), u = (t) => {
195
+ const o = v.value, f = I.value;
196
+ if (!o || !f || !f[a.value])
197
+ return;
198
+ const d = f[a.value];
199
+ let g = 0;
200
+ e.direction === "vertical" ? g = d.offsetTop - o.offsetTop + 10 - (o.offsetHeight - d.offsetHeight) / 2 : g = d.offsetLeft - (o.offsetWidth - d.offsetWidth) / 2, k(o, g, t ? 0 : 0.3, e.direction);
201
+ }, k = (t, o, f, d) => {
202
+ let g = 0;
203
+ const C = d === "horizontal" ? t.scrollLeft : t.scrollTop, E = f === 0 ? 1 : Math.round(f * 1e3 / 16);
204
+ function z() {
205
+ d === "horizontal" ? t.scrollLeft += (o - C) / E : t.scrollTop += (o - C) / E, ++g < E && Ve(z);
123
206
  }
207
+ z();
208
+ }, s = (t = ((o) => (o = n.default) == null ? void 0 : o.call(n))()) => {
209
+ r.value = [], t = t == null ? void 0 : t.filter((f) => typeof f.children != "string"), t && t.length && h(t), l(e.modelValue), ge(() => {
210
+ u();
211
+ });
212
+ }, R = (t) => {
213
+ m = t.fixed;
124
214
  };
125
- const init = (vnodes = ((_a) => (_a = slots.default) == null ? void 0 : _a.call(slots))()) => {
126
- titles.value = [];
127
- vnodes = vnodes == null ? void 0 : vnodes.filter((item) => typeof item.children !== "string");
128
- if (vnodes && vnodes.length) {
129
- renderTitles(vnodes);
130
- }
131
- findTabsIndex(props.modelValue);
132
- };
133
- const onStickyScroll = (params) => {
134
- stickyFixed = params.fixed;
135
- };
136
- watch(
215
+ U(
137
216
  () => {
138
- var _a;
139
- return (_a = slots.default) == null ? void 0 : _a.call(slots);
217
+ var t;
218
+ return (t = n.default) == null ? void 0 : t.call(n);
140
219
  },
141
- (vnodes) => {
142
- init(vnodes);
220
+ (t) => {
221
+ s(t);
143
222
  }
144
223
  );
145
- const getScrollTopRoot = () => {
146
- return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
147
- };
148
- watch(
149
- () => props.modelValue,
150
- (value) => {
151
- findTabsIndex(value);
152
- if (stickyFixed) {
153
- let top = useRect(container.value).top + getScrollTopRoot();
154
- let value2 = Math.ceil(top - props.top);
224
+ const oe = () => window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
225
+ U(
226
+ () => e.modelValue,
227
+ (t) => {
228
+ if (l(t), u(), m) {
229
+ let o = we(T.value).top + oe(), f = Math.ceil(o - e.top);
155
230
  window.scrollTo({
156
- top: value2,
231
+ top: f,
157
232
  behavior: "smooth"
158
233
  });
159
234
  }
160
235
  }
161
- );
162
- onMounted(init);
163
- onActivated(init);
164
- const contentStyle = computed(() => {
165
- return {
166
- transform: props.direction == "horizontal" ? `translate3d(-${currentIndex.value * 100}%, 0, 0)` : `translate3d( 0,-${currentIndex.value * 100}%, 0)`,
167
- transitionDuration: `${props.animatedTime}ms`
168
- };
169
- });
170
- const tabsNavStyle = computed(() => {
171
- return {
172
- background: props.background
173
- };
174
- });
175
- const tabsActiveStyle = computed(() => {
176
- return {
177
- color: props.type == "smile" ? props.color : "",
178
- background: props.type == "line" ? props.color : ""
179
- };
180
- });
181
- const titleStyle = computed(() => {
182
- return {
183
- marginLeft: pxCheck(props.titleGutter),
184
- marginRight: pxCheck(props.titleGutter)
236
+ ), le(s), ve(s);
237
+ const $ = {
238
+ isBegin: () => a.value == 0,
239
+ isEnd: () => a.value == r.value.length - 1,
240
+ next: () => {
241
+ a.value += 1, $.updateValue(r.value[a.value]);
242
+ },
243
+ prev: () => {
244
+ a.value -= 1, $.updateValue(r.value[a.value]);
245
+ },
246
+ updateValue: (t) => {
247
+ i("update:modelValue", t.paneKey), i("change", t);
248
+ },
249
+ tabChange: (t, o) => {
250
+ i("click", t), !(t.disabled || a.value == o) && (a.value = o, $.updateValue(t));
251
+ },
252
+ setTabItemRef: (t, o) => {
253
+ I.value[o] = t;
254
+ }
255
+ }, { tabsContentRef: ie, touchState: A, touchMethods: ne } = ze(e, $), ae = S(() => {
256
+ let t = a.value * 100;
257
+ A.moving && (t += A.offset);
258
+ let o = {
259
+ transform: e.direction == "horizontal" ? `translate3d(-${t}%, 0, 0)` : `translate3d( 0,-${t}%, 0)`,
260
+ transitionDuration: A.moving ? void 0 : `${e.animatedTime}ms`
185
261
  };
262
+ return e.animatedTime == 0 && (o = {}), o;
263
+ }), se = S(() => ({
264
+ background: e.background
265
+ })), re = S(() => ({
266
+ color: e.type == "smile" ? e.color : "",
267
+ background: e.type == "line" ? e.color : ""
268
+ })), ue = S(() => {
269
+ if (!e.titleGutter)
270
+ return {};
271
+ const t = ke(e.titleGutter);
272
+ return e.direction === "vertical" ? { marginTop: t, marginBottom: t } : { marginLeft: t, marginRight: t };
186
273
  });
187
- const methods = {
188
- tabChange: (item, index) => {
189
- emit("click", item);
190
- if (item.disabled) {
191
- return;
192
- }
193
- currentIndex.value = index;
194
- emit("update:modelValue", item.paneKey);
195
- emit("change", item);
196
- }
197
- };
198
- return {
199
- titles,
200
- contentStyle,
201
- tabsNavStyle,
202
- titleStyle,
203
- tabsActiveStyle,
204
- container,
205
- onStickyScroll,
206
- ...methods
207
- };
274
+ return P(P({
275
+ navRef: v,
276
+ tabsContentRef: ie,
277
+ titles: r,
278
+ contentStyle: ae,
279
+ tabsNavStyle: se,
280
+ titleStyle: ue,
281
+ tabsActiveStyle: re,
282
+ container: T,
283
+ getScrollY: c,
284
+ onStickyScroll: R
285
+ }, $), ne);
208
286
  }
209
- });
210
- const _hoisted_1 = ["onClick"];
211
- const _hoisted_2 = ["onClick"];
212
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
213
- const _component_JoySmile = resolveComponent("JoySmile");
214
- const _component_nut_sticky = resolveComponent("nut-sticky");
215
- return openBlock(), createElementBlock("view", {
216
- class: normalizeClass(["nut-tabs", [_ctx.direction]]),
217
- ref: "container",
218
- id: "container"
287
+ }), Ne = ["onClick"], Me = ["onClick"];
288
+ function Ie(e, i, n, T, m, r) {
289
+ const h = X("JoySmile"), a = X("nut-sticky");
290
+ return y(), p("view", {
291
+ class: w(["nut-tabs", [e.direction]]),
292
+ ref: "container"
219
293
  }, [
220
- _ctx.sticky ? (openBlock(), createBlock(_component_nut_sticky, {
294
+ e.sticky ? (y(), Se(a, {
221
295
  key: 0,
222
- top: _ctx.top,
223
- container: _ctx.container,
224
- onScroll: _ctx.onStickyScroll
296
+ top: e.top,
297
+ container: e.container,
298
+ onScroll: e.onStickyScroll
225
299
  }, {
226
- default: withCtx(() => [
227
- createElementVNode("view", {
228
- class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
229
- style: normalizeStyle(_ctx.tabsNavStyle)
300
+ default: Te(() => [
301
+ N("view", {
302
+ class: w(["nut-tabs__titles", { [e.type]: e.type, scrollable: e.titleScroll, [e.size]: e.size }]),
303
+ style: b(e.tabsNavStyle),
304
+ ref: "navRef"
230
305
  }, [
231
- _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
232
- return openBlock(), createElementBlock("view", {
233
- class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
234
- style: normalizeStyle(_ctx.titleStyle),
235
- onClick: ($event) => _ctx.tabChange(item, index),
236
- key: item.paneKey
306
+ e.$slots.titles ? D(e.$slots, "titles", { key: 0 }) : (y(!0), p(Z, { key: 1 }, _(e.titles, (l, c) => (y(), p("view", {
307
+ class: w(["nut-tabs__titles-item", { active: l.paneKey == e.modelValue, disabled: l.disabled }]),
308
+ style: b(e.titleStyle),
309
+ onClick: (v) => e.tabChange(l, c),
310
+ key: l.paneKey
311
+ }, [
312
+ e.type == "line" ? (y(), p("view", {
313
+ key: 0,
314
+ class: "nut-tabs__titles-item__line",
315
+ style: b(e.tabsActiveStyle)
316
+ }, null, 4)) : M("", !0),
317
+ e.type == "smile" ? (y(), p("view", {
318
+ key: 1,
319
+ class: "nut-tabs__titles-item__smile",
320
+ style: b(e.tabsActiveStyle)
237
321
  }, [
238
- _ctx.type == "line" ? (openBlock(), createElementBlock("view", {
239
- key: 0,
240
- class: "nut-tabs__titles-item__line",
241
- style: normalizeStyle(_ctx.tabsActiveStyle)
242
- }, null, 4)) : createCommentVNode("", true),
243
- _ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
244
- key: 1,
245
- class: "nut-tabs__titles-item__smile",
246
- style: normalizeStyle(_ctx.tabsActiveStyle)
247
- }, [
248
- createVNode(_component_JoySmile, { color: _ctx.color }, null, 8, ["color"])
249
- ], 4)) : createCommentVNode("", true),
250
- createElementVNode("view", {
251
- class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
252
- }, toDisplayString(item.title), 3)
253
- ], 14, _hoisted_1);
254
- }), 128))
322
+ x(h, { color: e.color }, null, 8, ["color"])
323
+ ], 4)) : M("", !0),
324
+ N("view", {
325
+ class: w(["nut-tabs__titles-item__text", { ellipsis: e.ellipsis }])
326
+ }, ee(l.title), 3)
327
+ ], 14, Ne))), 128))
255
328
  ], 6)
256
329
  ]),
257
330
  _: 3
258
- }, 8, ["top", "container", "onScroll"])) : (openBlock(), createElementBlock("view", {
331
+ }, 8, ["top", "container", "onScroll"])) : (y(), p("view", {
259
332
  key: 1,
260
- class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
261
- style: normalizeStyle(_ctx.tabsNavStyle)
333
+ class: w(["nut-tabs__titles", { [e.type]: e.type, scrollable: e.titleScroll, "scroll-vertical": e.getScrollY, [e.size]: e.size }]),
334
+ style: b(e.tabsNavStyle),
335
+ ref: "navRef"
262
336
  }, [
263
- _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
264
- return openBlock(), createElementBlock("view", {
265
- class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
266
- style: normalizeStyle(_ctx.titleStyle),
267
- onClick: ($event) => _ctx.tabChange(item, index),
268
- key: item.paneKey
337
+ e.$slots.titles ? D(e.$slots, "titles", { key: 0 }) : (y(!0), p(Z, { key: 1 }, _(e.titles, (l, c) => (y(), p("view", {
338
+ class: w(["nut-tabs__titles-item", { active: l.paneKey == e.modelValue, disabled: l.disabled }]),
339
+ style: b(e.titleStyle),
340
+ onClick: (v) => e.tabChange(l, c),
341
+ key: l.paneKey,
342
+ ref_for: !0,
343
+ ref: (v) => e.setTabItemRef(v, c)
344
+ }, [
345
+ e.type == "line" ? (y(), p("view", {
346
+ key: 0,
347
+ class: "nut-tabs__titles-item__line",
348
+ style: b(e.tabsActiveStyle)
349
+ }, null, 4)) : M("", !0),
350
+ e.type == "smile" ? (y(), p("view", {
351
+ key: 1,
352
+ class: "nut-tabs__titles-item__smile",
353
+ style: b(e.tabsActiveStyle)
269
354
  }, [
270
- _ctx.type == "line" ? (openBlock(), createElementBlock("view", {
271
- key: 0,
272
- class: "nut-tabs__titles-item__line",
273
- style: normalizeStyle(_ctx.tabsActiveStyle)
274
- }, null, 4)) : createCommentVNode("", true),
275
- _ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
276
- key: 1,
277
- class: "nut-tabs__titles-item__smile",
278
- style: normalizeStyle(_ctx.tabsActiveStyle)
279
- }, [
280
- createVNode(_component_JoySmile, { color: _ctx.color }, null, 8, ["color"])
281
- ], 4)) : createCommentVNode("", true),
282
- createElementVNode("view", {
283
- class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
284
- }, toDisplayString(item.title), 3)
285
- ], 14, _hoisted_2);
286
- }), 128))
355
+ x(h, { color: e.color }, null, 8, ["color"])
356
+ ], 4)) : M("", !0),
357
+ N("view", {
358
+ class: w(["nut-tabs__titles-item__text", { ellipsis: e.ellipsis }])
359
+ }, ee(l.title), 3)
360
+ ], 14, Me))), 128))
287
361
  ], 6)),
288
- createElementVNode("view", {
362
+ N("view", {
289
363
  class: "nut-tabs__content",
290
- style: normalizeStyle(_ctx.contentStyle)
364
+ ref: "tabsContentRef",
365
+ style: b(e.contentStyle),
366
+ onTouchstart: i[0] || (i[0] = (...l) => e.onTouchStart && e.onTouchStart(...l)),
367
+ onTouchmove: i[1] || (i[1] = (...l) => e.onTouchMove && e.onTouchMove(...l)),
368
+ onTouchend: i[2] || (i[2] = (...l) => e.onTouchEnd && e.onTouchEnd(...l)),
369
+ onTouchcancel: i[3] || (i[3] = (...l) => e.onTouchEnd && e.onTouchEnd(...l))
291
370
  }, [
292
- renderSlot(_ctx.$slots, "default")
293
- ], 4)
371
+ D(e.$slots, "default")
372
+ ], 36)
294
373
  ], 2);
295
374
  }
296
- const Tabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
375
+ const qe = /* @__PURE__ */ $e(Be, [["render", Ie]]);
297
376
  export {
298
- Title,
299
- Tabs as default
377
+ Ke as Title,
378
+ qe as default
300
379
  };