@nutui/nutui 4.0.9 → 4.0.10

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 (168) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +15382 -0
  4. package/dist/nutui.umd.js +1 -7
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +96 -152
  59. package/dist/packages/_es/MenuItem.js +117 -172
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -441
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +130 -179
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/packages/col/index.scss +2 -2
  126. package/dist/packages/menuitem/index.scss +7 -10
  127. package/dist/packages/searchbar/index.scss +4 -0
  128. package/dist/smartips/web-types.json +2 -2
  129. package/dist/style.css +1 -1
  130. package/dist/styles/themes/default.scss +158 -55
  131. package/dist/styles/themes/jdb.scss +158 -55
  132. package/dist/styles/themes/jddkh.scss +158 -55
  133. package/dist/styles/themes/jdt.scss +158 -55
  134. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  135. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  138. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  139. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  141. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  142. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  143. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  144. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/table/common.d.ts +55 -2
  147. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  148. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  149. package/dist/types/index.d.ts +1 -1
  150. package/package.json +2 -2
  151. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  152. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  153. package/dist/packages/_es/common-b9a5e726.js +0 -145
  154. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  155. package/dist/packages/_es/index-29892cda.js +0 -33
  156. package/dist/packages/_es/index-43c34ac6.js +0 -30
  157. package/dist/packages/_es/index-54d03fc1.js +0 -8
  158. package/dist/packages/_es/index-79c5dc33.js +0 -10
  159. package/dist/packages/_es/index-7a7385e4.js +0 -67
  160. package/dist/packages/_es/index-87422be8.js +0 -942
  161. package/dist/packages/_es/index-da0a7662.js +0 -259
  162. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  163. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  164. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  165. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  166. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  167. package/dist/packages/_es/raf-729dad54.js +0 -25
  168. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,165 +1,107 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
- var __hasOwnProp = Object.prototype.hasOwnProperty;
4
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __spreadValues = (a, b) => {
7
- for (var prop in b || (b = {}))
8
- if (__hasOwnProp.call(b, prop))
9
- __defNormalProp(a, prop, b[prop]);
10
- if (__getOwnPropSymbols)
11
- for (var prop of __getOwnPropSymbols(b)) {
12
- if (__propIsEnum.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- }
15
- return a;
16
- };
17
- var __publicField = (obj, key, value) => {
18
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
19
- return value;
20
- };
21
- var __async = (__this, __arguments, generator) => {
22
- return new Promise((resolve, reject) => {
23
- var fulfilled = (value) => {
24
- try {
25
- step(generator.next(value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- };
30
- var rejected = (value) => {
31
- try {
32
- step(generator.throw(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
- step((generator = generator.apply(__this, __arguments)).next());
39
- });
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;
40
11
  };
41
- import { c as createComponent, T as TypeOfFun } from "./component-81a4c1d0.js";
42
- import { ref, onMounted, reactive, provide, computed, watch, onActivated, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, createElementVNode, normalizeStyle, renderSlot, Fragment, renderList, createCommentVNode, createVNode, toDisplayString } from "vue";
43
- import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
44
- import { u as useRect } from "./index-29892cda.js";
45
- import { r as requestAniFrame } from "./raf-729dad54.js";
46
- import { _ as _sfc_main$1 } from "./index.vue_vue_type_script_lang-cc5c4086.js";
47
- import { JoySmile } from "@nutui/icons-vue";
48
- import { u as useTouch } from "./index-7a7385e4.js";
49
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
50
- import "../locale/lang";
51
- const useTabContentTouch = (props, tabMethods, taro, useTaroRect) => {
52
- const tabsContentRef = ref();
53
- const tabsContentRefRect = ref({ width: 0, height: 0 });
54
- const initTaroWidth = () => __async(void 0, null, function* () {
55
- var _a, _b;
56
- if (taro && taro.getEnv() !== taro.ENV_TYPE.WEB) {
57
- let rect = yield useTaroRect(tabsContentRef, taro);
58
- tabsContentRefRect.value.width = rect.width || 0;
59
- tabsContentRefRect.value.height = rect.height || 0;
60
- } else {
61
- tabsContentRefRect.value.width = ((_a = tabsContentRef.value) == null ? void 0 : _a.clientWidth) || 0;
62
- tabsContentRefRect.value.height = ((_b = tabsContentRef.value) == null ? void 0 : _b.clientHeight) || 0;
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);
63
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";
38
+ import "../locale/lang";
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;
64
47
  });
65
- onMounted(() => {
48
+ le(() => {
66
49
  setTimeout(() => {
67
- initTaroWidth();
50
+ h();
68
51
  }, 100);
69
52
  });
70
- const touchState = reactive({
53
+ const a = he({
71
54
  offset: 0,
72
- moving: false
73
- });
74
- const touch = useTouch();
75
- let position = "";
76
- const setoffset = (deltaX, deltaY) => {
77
- var _a;
78
- let offset = deltaX;
79
- if (props.direction == "horizontal") {
80
- position = deltaX > 0 ? "right" : "left";
81
- offset = Math.abs(offset) / tabsContentRefRect.value.width * 100;
82
- } else {
83
- position = deltaY > 0 ? "bottom" : "top";
84
- offset = deltaY;
85
- offset = Math.abs(offset) / ((_a = tabsContentRefRect.value) == null ? void 0 : _a.height) * 100;
86
- }
87
- if (offset > 85) {
88
- offset = 85;
89
- }
90
- switch (position) {
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) {
91
62
  case "left":
92
63
  case "top":
93
- if (tabMethods.isEnd()) {
94
- offset = 0;
95
- touchState.moving = false;
96
- }
64
+ i.isEnd() && (s = 0, a.moving = !1);
97
65
  break;
98
66
  case "right":
99
67
  case "bottom":
100
- offset = -offset;
101
- if (tabMethods.isBegin()) {
102
- offset = 0;
103
- touchState.moving = false;
104
- }
68
+ s = -s, i.isBegin() && (s = 0, a.moving = !1);
105
69
  break;
106
70
  }
107
- touchState.offset = offset;
71
+ a.offset = s;
108
72
  };
109
- const touchMethods = {
110
- onTouchStart(event) {
111
- if (!props.swipeable)
112
- return;
113
- touch.start(event);
73
+ return { touchMethods: {
74
+ onTouchStart(u) {
75
+ e.swipeable && l.start(u);
114
76
  },
115
- onTouchMove(event) {
116
- if (!props.swipeable)
117
- return;
118
- touch.move(event);
119
- touchState.moving = true;
120
- setoffset(touch.deltaX.value, touch.deltaY.value);
121
- if (props.direction == "horizontal" && touch.isHorizontal()) {
122
- event.preventDefault();
123
- event.stopPropagation();
124
- }
125
- if (props.direction == "vertical" && touch.isVertical()) {
126
- event.preventDefault();
127
- event.stopPropagation();
128
- }
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()));
129
79
  },
130
80
  onTouchEnd() {
131
- if (touchState.moving) {
132
- touchState.moving = false;
133
- switch (position) {
81
+ if (a.moving)
82
+ switch (a.moving = !1, c) {
134
83
  case "left":
135
84
  case "top":
136
- if (touchState.offset > 35) {
137
- tabMethods.next();
138
- }
85
+ a.offset > 35 && i.next();
139
86
  break;
140
87
  case "right":
141
88
  case "bottom":
142
- if (touchState.offset < -35) {
143
- tabMethods.prev();
144
- }
89
+ a.offset < -35 && i.prev();
145
90
  break;
146
91
  }
147
- }
148
92
  }
149
- };
150
- return { touchMethods, touchState, tabsContentRef };
93
+ }, touchState: a, tabsContentRef: m };
151
94
  };
152
- class Title {
95
+ class Ke {
153
96
  constructor() {
154
- __publicField(this, "title", "");
155
- __publicField(this, "titleSlot");
156
- __publicField(this, "paneKey", "");
157
- __publicField(this, "disabled", false);
97
+ K(this, "title", "");
98
+ K(this, "titleSlot");
99
+ K(this, "paneKey", "");
100
+ K(this, "disabled", !1);
158
101
  }
159
102
  }
160
- const { create } = createComponent("tabs");
161
- const _sfc_main = create({
162
- components: { [_sfc_main$1.name]: _sfc_main$1, JoySmile },
103
+ const { create: Re } = pe("tabs"), Be = Re({
104
+ components: { [te.name]: te, JoySmile: Ce },
163
105
  props: {
164
106
  modelValue: {
165
107
  type: [String, Number],
@@ -185,19 +127,19 @@ const _sfc_main = create({
185
127
  },
186
128
  titleScroll: {
187
129
  type: Boolean,
188
- default: false
130
+ default: !1
189
131
  },
190
132
  ellipsis: {
191
133
  type: Boolean,
192
- default: true
134
+ default: !0
193
135
  },
194
136
  swipeable: {
195
137
  type: Boolean,
196
- default: false
138
+ default: !1
197
139
  },
198
140
  autoHeight: {
199
141
  type: Boolean,
200
- default: false
142
+ default: !1
201
143
  },
202
144
  background: {
203
145
  type: String,
@@ -213,7 +155,7 @@ const _sfc_main = create({
213
155
  },
214
156
  sticky: {
215
157
  type: Boolean,
216
- default: false
158
+ default: !1
217
159
  },
218
160
  top: {
219
161
  type: Number,
@@ -221,307 +163,217 @@ const _sfc_main = create({
221
163
  }
222
164
  },
223
165
  emits: ["update:modelValue", "click", "change"],
224
- setup(props, { emit, slots }) {
225
- const container = ref(null);
226
- let stickyFixed;
227
- provide("tabsOpiton", {
228
- activeKey: computed(() => props.modelValue || "0"),
229
- autoHeight: computed(() => props.autoHeight),
230
- animatedTime: computed(() => props.animatedTime)
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)
231
173
  });
232
- const titles = ref([]);
233
- const renderTitles = (vnodes) => {
234
- vnodes.forEach((vnode, index) => {
235
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
236
- let type = vnode.type;
237
- type = type.name || type;
238
- if (type == "nut-tab-pane") {
239
- let title = new Title();
240
- 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"])) {
241
- let paneKeyType = TypeOfFun((_d = vnode.props) == null ? void 0 : _d["pane-key"]);
242
- let paneIndex = paneKeyType == "number" || paneKeyType == "string" ? String((_e = vnode.props) == null ? void 0 : _e["pane-key"]) : null;
243
- let camelPaneKeyType = TypeOfFun((_f = vnode.props) == null ? void 0 : _f["paneKey"]);
244
- let camelPaneIndex = camelPaneKeyType == "number" || camelPaneKeyType == "string" ? String((_g = vnode.props) == null ? void 0 : _g["paneKey"]) : null;
245
- title.title = (_h = vnode.props) == null ? void 0 : _h.title;
246
- title.paneKey = paneIndex || camelPaneIndex || String(index);
247
- title.disabled = (_i = vnode.props) == null ? void 0 : _i.disabled;
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;
248
183
  }
249
- titles.value.push(title);
184
+ r.value.push(B);
250
185
  } else {
251
- if (vnode.children == " ") {
186
+ if (o.children == " ")
252
187
  return;
253
- }
254
- renderTitles(vnode.children);
188
+ h(o.children);
255
189
  }
256
190
  });
257
- };
258
- const currentIndex = ref(props.modelValue || 0);
259
- const findTabsIndex = (value) => {
260
- let index = titles.value.findIndex((item) => item.paneKey == value);
261
- if (titles.value.length == 0)
262
- ;
263
- else if (index == -1)
264
- ;
265
- else {
266
- currentIndex.value = index;
267
- }
268
- };
269
- const getScrollY = computed(() => {
270
- return props.titleScroll && props.direction === "vertical";
271
- });
272
- const navRef = ref();
273
- const titleRef = ref([]);
274
- const scrollIntoView = (immediate) => {
275
- const nav = navRef.value;
276
- const _titles = titleRef.value;
277
- if (!nav || !_titles || !_titles[currentIndex.value]) {
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])
278
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);
279
206
  }
280
- const title = _titles[currentIndex.value];
281
- let to = 0;
282
- if (props.direction === "vertical") {
283
- const runTop = title.offsetTop - nav.offsetTop + 10;
284
- to = runTop - (nav.offsetHeight - title.offsetHeight) / 2;
285
- } else {
286
- to = title.offsetLeft - (nav.offsetWidth - title.offsetWidth) / 2;
287
- }
288
- scrollDirection(nav, to, immediate ? 0 : 0.3, props.direction);
289
- };
290
- const scrollDirection = (nav, to, duration, direction) => {
291
- let count = 0;
292
- const from = direction === "horizontal" ? nav.scrollLeft : nav.scrollTop;
293
- const frames = duration === 0 ? 1 : Math.round(duration * 1e3 / 16);
294
- function animate() {
295
- if (direction === "horizontal") {
296
- nav.scrollLeft += (to - from) / frames;
297
- } else {
298
- nav.scrollTop += (to - from) / frames;
299
- }
300
- if (++count < frames) {
301
- requestAniFrame(animate);
302
- }
303
- }
304
- animate();
305
- };
306
- const init = (vnodes = ((_a) => (_a = slots.default) == null ? void 0 : _a.call(slots))()) => {
307
- titles.value = [];
308
- vnodes = vnodes == null ? void 0 : vnodes.filter((item) => typeof item.children !== "string");
309
- if (vnodes && vnodes.length) {
310
- renderTitles(vnodes);
311
- }
312
- findTabsIndex(props.modelValue);
313
- nextTick(() => {
314
- scrollIntoView();
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();
315
211
  });
212
+ }, R = (t) => {
213
+ m = t.fixed;
316
214
  };
317
- const onStickyScroll = (params) => {
318
- stickyFixed = params.fixed;
319
- };
320
- watch(
215
+ U(
321
216
  () => {
322
- var _a;
323
- return (_a = slots.default) == null ? void 0 : _a.call(slots);
217
+ var t;
218
+ return (t = n.default) == null ? void 0 : t.call(n);
324
219
  },
325
- (vnodes) => {
326
- init(vnodes);
220
+ (t) => {
221
+ s(t);
327
222
  }
328
223
  );
329
- const getScrollTopRoot = () => {
330
- return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
331
- };
332
- watch(
333
- () => props.modelValue,
334
- (value) => {
335
- findTabsIndex(value);
336
- scrollIntoView();
337
- if (stickyFixed) {
338
- let top = useRect(container.value).top + getScrollTopRoot();
339
- 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);
340
230
  window.scrollTo({
341
- top: value2,
231
+ top: f,
342
232
  behavior: "smooth"
343
233
  });
344
234
  }
345
235
  }
346
- );
347
- onMounted(init);
348
- onActivated(init);
349
- const tabMethods = {
350
- isBegin: () => {
351
- return currentIndex.value == 0;
352
- },
353
- isEnd: () => {
354
- return currentIndex.value == titles.value.length - 1;
355
- },
236
+ ), le(s), ve(s);
237
+ const $ = {
238
+ isBegin: () => a.value == 0,
239
+ isEnd: () => a.value == r.value.length - 1,
356
240
  next: () => {
357
- currentIndex.value += 1;
358
- tabMethods.updateValue(titles.value[currentIndex.value]);
241
+ a.value += 1, $.updateValue(r.value[a.value]);
359
242
  },
360
243
  prev: () => {
361
- currentIndex.value -= 1;
362
- tabMethods.updateValue(titles.value[currentIndex.value]);
244
+ a.value -= 1, $.updateValue(r.value[a.value]);
363
245
  },
364
- updateValue: (item) => {
365
- emit("update:modelValue", item.paneKey);
366
- emit("change", item);
246
+ updateValue: (t) => {
247
+ i("update:modelValue", t.paneKey), i("change", t);
367
248
  },
368
- tabChange: (item, index) => {
369
- emit("click", item);
370
- if (item.disabled || currentIndex.value == index) {
371
- return;
372
- }
373
- currentIndex.value = index;
374
- tabMethods.updateValue(item);
249
+ tabChange: (t, o) => {
250
+ i("click", t), !(t.disabled || a.value == o) && (a.value = o, $.updateValue(t));
375
251
  },
376
- setTabItemRef: (el, index) => {
377
- titleRef.value[index] = el;
378
- }
379
- };
380
- const { tabsContentRef, touchState, touchMethods } = useTabContentTouch(props, tabMethods);
381
- const contentStyle = computed(() => {
382
- let offsetPercent = currentIndex.value * 100;
383
- if (touchState.moving) {
384
- offsetPercent += touchState.offset;
252
+ setTabItemRef: (t, o) => {
253
+ I.value[o] = t;
385
254
  }
386
- let style = {
387
- transform: props.direction == "horizontal" ? `translate3d(-${offsetPercent}%, 0, 0)` : `translate3d( 0,-${offsetPercent}%, 0)`,
388
- transitionDuration: touchState.moving ? void 0 : `${props.animatedTime}ms`
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`
389
261
  };
390
- if (props.animatedTime == 0) {
391
- style = {};
392
- }
393
- return style;
394
- });
395
- const tabsNavStyle = computed(() => {
396
- return {
397
- background: props.background
398
- };
399
- });
400
- const tabsActiveStyle = computed(() => {
401
- return {
402
- color: props.type == "smile" ? props.color : "",
403
- background: props.type == "line" ? props.color : ""
404
- };
405
- });
406
- const titleStyle = computed(() => {
407
- if (!props.titleGutter)
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)
408
270
  return {};
409
- const px = pxCheck(props.titleGutter);
410
- if (props.direction === "vertical") {
411
- return { marginTop: px, marginBottom: px };
412
- }
413
- return { marginLeft: px, marginRight: px };
271
+ const t = ke(e.titleGutter);
272
+ return e.direction === "vertical" ? { marginTop: t, marginBottom: t } : { marginLeft: t, marginRight: t };
414
273
  });
415
- return __spreadValues(__spreadValues({
416
- navRef,
417
- tabsContentRef,
418
- titles,
419
- contentStyle,
420
- tabsNavStyle,
421
- titleStyle,
422
- tabsActiveStyle,
423
- container,
424
- getScrollY,
425
- onStickyScroll
426
- }, tabMethods), touchMethods);
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);
427
286
  }
428
- });
429
- const _hoisted_1 = ["onClick"];
430
- const _hoisted_2 = ["onClick"];
431
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
432
- const _component_JoySmile = resolveComponent("JoySmile");
433
- const _component_nut_sticky = resolveComponent("nut-sticky");
434
- return openBlock(), createElementBlock("view", {
435
- class: normalizeClass(["nut-tabs", [_ctx.direction]]),
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]]),
436
292
  ref: "container"
437
293
  }, [
438
- _ctx.sticky ? (openBlock(), createBlock(_component_nut_sticky, {
294
+ e.sticky ? (y(), Se(a, {
439
295
  key: 0,
440
- top: _ctx.top,
441
- container: _ctx.container,
442
- onScroll: _ctx.onStickyScroll
296
+ top: e.top,
297
+ container: e.container,
298
+ onScroll: e.onStickyScroll
443
299
  }, {
444
- default: withCtx(() => [
445
- createElementVNode("view", {
446
- class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, [_ctx.size]: _ctx.size }]),
447
- 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),
448
304
  ref: "navRef"
449
305
  }, [
450
- _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
451
- return openBlock(), createElementBlock("view", {
452
- class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
453
- style: normalizeStyle(_ctx.titleStyle),
454
- onClick: ($event) => _ctx.tabChange(item, index),
455
- 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)
456
321
  }, [
457
- _ctx.type == "line" ? (openBlock(), createElementBlock("view", {
458
- key: 0,
459
- class: "nut-tabs__titles-item__line",
460
- style: normalizeStyle(_ctx.tabsActiveStyle)
461
- }, null, 4)) : createCommentVNode("", true),
462
- _ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
463
- key: 1,
464
- class: "nut-tabs__titles-item__smile",
465
- style: normalizeStyle(_ctx.tabsActiveStyle)
466
- }, [
467
- createVNode(_component_JoySmile, { color: _ctx.color }, null, 8, ["color"])
468
- ], 4)) : createCommentVNode("", true),
469
- createElementVNode("view", {
470
- class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
471
- }, toDisplayString(item.title), 3)
472
- ], 14, _hoisted_1);
473
- }), 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))
474
328
  ], 6)
475
329
  ]),
476
330
  _: 3
477
- }, 8, ["top", "container", "onScroll"])) : (openBlock(), createElementBlock("view", {
331
+ }, 8, ["top", "container", "onScroll"])) : (y(), p("view", {
478
332
  key: 1,
479
- class: normalizeClass(["nut-tabs__titles", { [_ctx.type]: _ctx.type, scrollable: _ctx.titleScroll, "scroll-vertical": _ctx.getScrollY, [_ctx.size]: _ctx.size }]),
480
- 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),
481
335
  ref: "navRef"
482
336
  }, [
483
- _ctx.$slots.titles ? renderSlot(_ctx.$slots, "titles", { key: 0 }) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(_ctx.titles, (item, index) => {
484
- return openBlock(), createElementBlock("view", {
485
- class: normalizeClass(["nut-tabs__titles-item", { active: item.paneKey == _ctx.modelValue, disabled: item.disabled }]),
486
- style: normalizeStyle(_ctx.titleStyle),
487
- onClick: ($event) => _ctx.tabChange(item, index),
488
- key: item.paneKey,
489
- ref_for: true,
490
- ref: (e) => _ctx.setTabItemRef(e, index)
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)
491
354
  }, [
492
- _ctx.type == "line" ? (openBlock(), createElementBlock("view", {
493
- key: 0,
494
- class: "nut-tabs__titles-item__line",
495
- style: normalizeStyle(_ctx.tabsActiveStyle)
496
- }, null, 4)) : createCommentVNode("", true),
497
- _ctx.type == "smile" ? (openBlock(), createElementBlock("view", {
498
- key: 1,
499
- class: "nut-tabs__titles-item__smile",
500
- style: normalizeStyle(_ctx.tabsActiveStyle)
501
- }, [
502
- createVNode(_component_JoySmile, { color: _ctx.color }, null, 8, ["color"])
503
- ], 4)) : createCommentVNode("", true),
504
- createElementVNode("view", {
505
- class: normalizeClass(["nut-tabs__titles-item__text", { ellipsis: _ctx.ellipsis }])
506
- }, toDisplayString(item.title), 3)
507
- ], 14, _hoisted_2);
508
- }), 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))
509
361
  ], 6)),
510
- createElementVNode("view", {
362
+ N("view", {
511
363
  class: "nut-tabs__content",
512
364
  ref: "tabsContentRef",
513
- style: normalizeStyle(_ctx.contentStyle),
514
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
515
- onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
516
- onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args)),
517
- onTouchcancel: _cache[3] || (_cache[3] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
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))
518
370
  }, [
519
- renderSlot(_ctx.$slots, "default")
371
+ D(e.$slots, "default")
520
372
  ], 36)
521
373
  ], 2);
522
374
  }
523
- const Tabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
375
+ const qe = /* @__PURE__ */ $e(Be, [["render", Ie]]);
524
376
  export {
525
- Title,
526
- Tabs as default
377
+ Ke as Title,
378
+ qe as default
527
379
  };