@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,116 +1,174 @@
1
- import { ref, reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, Fragment, renderList, renderSlot } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ var j = Object.defineProperty, G = Object.defineProperties;
2
+ var J = Object.getOwnPropertyDescriptors;
3
+ var C = Object.getOwnPropertySymbols;
4
+ var K = Object.prototype.hasOwnProperty, O = Object.prototype.propertyIsEnumerable;
5
+ var D = (e, o, i) => o in e ? j(e, o, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[o] = i, E = (e, o) => {
6
+ for (var i in o || (o = {}))
7
+ K.call(o, i) && D(e, i, o[i]);
8
+ if (C)
9
+ for (var i of C(o))
10
+ O.call(o, i) && D(e, i, o[i]);
11
+ return e;
12
+ }, N = (e, o) => G(e, J(o));
13
+ import { ref as p, reactive as Q, computed as f, watch as $, toRefs as U, openBlock as S, createElementBlock as y, normalizeClass as W, normalizeStyle as H, createElementVNode as z, Fragment as X, renderList as Y, renderSlot as Z } from "vue";
14
+ import { c as R } from "./component-234624bc.js";
15
+ import { u as _ } from "./index-192a3ef6.js";
16
+ import { _ as tt } from "./_plugin-vue_export-helper-dad06003.js";
4
17
  import "../locale/lang";
5
- const { componentName, create } = createComponent("list");
6
- const clientHeight = document.documentElement.clientHeight || document.body.clientHeight || 667;
7
- const _sfc_main = create({
18
+ var b = /* @__PURE__ */ ((e) => (e[e.eq = 1] = "eq", e[e.lt = 2] = "lt", e[e.gt = 3] = "gt", e))(b || {});
19
+ function et(e, o, i) {
20
+ let m = 0, l = e.length - 1, t = null;
21
+ for (; m <= l; ) {
22
+ t = Math.floor((m + l) / 2);
23
+ const r = e[t], h = i(r, o);
24
+ if (h === 1)
25
+ return t;
26
+ h === 2 ? m = t + 1 : h === 3 && (l = t - 1);
27
+ }
28
+ return t;
29
+ }
30
+ const { componentName: nt, create: ot } = R("list"), M = document.documentElement.clientHeight || document.body.clientHeight || 667, it = ot({
8
31
  props: {
9
- height: {
10
- type: [Number],
11
- default: 50
12
- },
13
32
  listData: {
14
33
  type: Array,
15
- default: () => {
16
- return [];
17
- }
34
+ default: () => []
35
+ },
36
+ bufferSize: {
37
+ type: Number,
38
+ default: 5
18
39
  },
19
40
  containerHeight: {
20
41
  type: [Number],
21
- default: clientHeight
42
+ default: M
43
+ },
44
+ height: {
45
+ type: Number,
46
+ default: 80
47
+ },
48
+ margin: {
49
+ type: Number,
50
+ default: 10
22
51
  }
23
52
  },
24
- emits: ["scroll", "scroll-bottom"],
25
- setup(props, { emit }) {
26
- const list = ref(null);
27
- const state = reactive({
28
- startOffset: 0,
53
+ emits: ["scroll-up", "scroll-down", "scroll-bottom"],
54
+ setup(e, { emit: o }) {
55
+ const i = p(null), m = p(null), l = p(null), t = Q({
29
56
  start: 0,
30
- list: props.listData.slice()
31
- });
32
- const getContainerHeight = computed(() => {
33
- return Math.min(props.containerHeight, clientHeight);
34
- });
35
- const visibleCount = computed(() => {
36
- return Math.ceil(getContainerHeight.value / props.height);
37
- });
38
- const end = computed(() => {
39
- return state.start + visibleCount.value;
40
- });
41
- const getTransform = computed(() => {
42
- return `translate3d(0, ${state.startOffset}px, 0)`;
43
- });
44
- const classes = computed(() => {
45
- const prefixCls = componentName;
46
- return {
47
- [prefixCls]: true
48
- };
49
- });
50
- const listHeight = computed(() => {
51
- return state.list.length * props.height;
52
- });
53
- const visibleData = computed(() => {
54
- return state.list.slice(state.start, Math.min(end.value, state.list.length));
55
- });
56
- const handleScrollEvent = () => {
57
- var _a;
58
- const scrollTop = (_a = list.value) == null ? void 0 : _a.scrollTop;
59
- state.start = Math.floor(scrollTop / props.height);
60
- if (end.value >= state.list.length) {
61
- emit("scroll-bottom");
57
+ originStartIndex: 0,
58
+ scrollTop: 0,
59
+ list: e.listData.slice(),
60
+ cachePositions: [],
61
+ phantomHeight: e.height * e.listData.length
62
+ }), r = f(() => Math.min(e.containerHeight, M)), h = f(() => Math.ceil(r.value / e.height)), I = f(() => Math.min(t.originStartIndex + h.value + e.bufferSize, t.list.length)), w = f(() => ({
63
+ [nt]: !0
64
+ })), k = f(() => t.list.slice(t.start, I.value)), q = () => {
65
+ if (l.value)
66
+ return `translate3d(0, ${t.start >= 1 ? t.cachePositions[t.start - 1].bottom : 0}px, 0)`;
67
+ }, x = () => {
68
+ t.cachePositions = [];
69
+ for (let n = 0; n < t.list.length; ++n)
70
+ t.cachePositions[n] = {
71
+ index: n,
72
+ height: e.height,
73
+ top: n * e.height,
74
+ bottom: (n + 1) * (e.height + e.margin),
75
+ dValue: 0
76
+ };
77
+ }, V = () => {
78
+ let n = l.value.childNodes;
79
+ n = Array.from(n).filter((s) => s.nodeType === 1);
80
+ const u = n[0];
81
+ n.forEach((s, c) => {
82
+ if (!s)
83
+ return;
84
+ const F = _(s), { height: T } = F, v = t.cachePositions[c + t.start].height - T;
85
+ v && (t.cachePositions[c + t.start].bottom -= v, t.cachePositions[c + t.start].height = T, t.cachePositions[c + t.start].dValue = v);
86
+ });
87
+ let a = 0;
88
+ u && (a = t.start);
89
+ const d = t.cachePositions.length;
90
+ let g = t.cachePositions[a].dValue;
91
+ t.cachePositions[a].dValue = 0;
92
+ for (let s = a + 1; s < d; ++s) {
93
+ const c = t.cachePositions[s];
94
+ t.cachePositions[s].top = t.cachePositions[s - 1].bottom, t.cachePositions[s].bottom = t.cachePositions[s].bottom - g, c.dValue !== 0 && (g += c.dValue, c.dValue = 0);
62
95
  }
63
- state.startOffset = scrollTop - scrollTop % props.height;
96
+ const P = t.cachePositions[d - 1].bottom;
97
+ t.phantomHeight = P;
98
+ }, A = (n = 0) => {
99
+ let u = et(
100
+ t.cachePositions,
101
+ n,
102
+ (d, g) => {
103
+ const P = d.bottom;
104
+ return P === g ? b.eq : P < g ? b.lt : b.gt;
105
+ }
106
+ );
107
+ return t.cachePositions[u].bottom < n && (u += 1), u;
108
+ }, B = () => {
109
+ t.originStartIndex = 0, t.start = 0, t.scrollTop = 0, i.value.scrollTop = 0, x(), t.phantomHeight = e.height * t.list.length;
110
+ }, L = () => {
111
+ var d;
112
+ const n = (d = i.value) == null ? void 0 : d.scrollTop, { originStartIndex: u } = t, a = A(n);
113
+ a !== u && (t.originStartIndex = a, t.start = Math.max(t.originStartIndex - e.bufferSize, 0), I.value >= t.list.length - 1 && o("scroll-bottom")), o(n > t.scrollTop ? "scroll-up" : "scroll-down", n), t.scrollTop = n;
64
114
  };
65
- watch(
66
- () => props.listData,
115
+ return $(
116
+ () => e.listData,
117
+ (n) => {
118
+ if (t.list = n.slice(), t.list.length === n.length)
119
+ x(), V();
120
+ else {
121
+ B();
122
+ return;
123
+ }
124
+ }
125
+ ), $(
126
+ () => t.start,
67
127
  () => {
68
- state.list = props.listData.slice();
128
+ l.value && t.list.length > 0 && V();
69
129
  }
70
- );
71
- return {
72
- ...toRefs(state),
73
- list,
74
- getTransform,
75
- listHeight,
76
- visibleData,
77
- classes,
78
- getContainerHeight,
79
- handleScrollEvent
80
- };
130
+ ), N(E({}, U(t)), {
131
+ list: i,
132
+ phantom: m,
133
+ actualContent: l,
134
+ getTransform: q,
135
+ visibleData: k,
136
+ classes: w,
137
+ getContainerHeight: r,
138
+ handleScrollEvent: L
139
+ });
81
140
  }
82
141
  });
83
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
84
- return openBlock(), createElementBlock("div", {
85
- class: normalizeClass(_ctx.classes),
86
- style: normalizeStyle({ height: `${_ctx.getContainerHeight}px` }),
87
- onScrollPassive: _cache[0] || (_cache[0] = (...args) => _ctx.handleScrollEvent && _ctx.handleScrollEvent(...args)),
142
+ function st(e, o, i, m, l, t) {
143
+ return S(), y("div", {
144
+ class: W(e.classes),
145
+ style: H({ height: `${e.getContainerHeight}px` }),
146
+ onScrollPassive: o[0] || (o[0] = (...r) => e.handleScrollEvent && e.handleScrollEvent(...r)),
88
147
  ref: "list"
89
148
  }, [
90
- createElementVNode("div", {
149
+ z("div", {
91
150
  class: "nut-list-phantom",
92
- style: normalizeStyle({ height: _ctx.listHeight + "px" })
151
+ style: H({ height: e.phantomHeight + "px" }),
152
+ ref: "phantom"
93
153
  }, null, 4),
94
- createElementVNode("div", {
154
+ z("div", {
95
155
  class: "nut-list-container",
96
- style: normalizeStyle({ transform: _ctx.getTransform })
156
+ style: H({ transform: e.getTransform() }),
157
+ ref: "actualContent"
97
158
  }, [
98
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index2) => {
99
- return openBlock(), createElementBlock("div", {
100
- class: "nut-list-item",
101
- style: normalizeStyle({ height: _ctx.height + "px" }),
102
- key: item
103
- }, [
104
- renderSlot(_ctx.$slots, "default", {
105
- item,
106
- index: index2
107
- })
108
- ], 4);
109
- }), 128))
159
+ (S(!0), y(X, null, Y(e.visibleData, (r, h) => (S(), y("div", {
160
+ class: "nut-list-item",
161
+ key: r
162
+ }, [
163
+ Z(e.$slots, "default", {
164
+ item: r,
165
+ index: h + e.start
166
+ })
167
+ ]))), 128))
110
168
  ], 4)
111
169
  ], 38);
112
170
  }
113
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
171
+ const mt = /* @__PURE__ */ tt(it, [["render", st]]);
114
172
  export {
115
- index as default
173
+ mt as default
116
174
  };
@@ -1,14 +1,13 @@
1
- import { ref, computed, onMounted, onUnmounted, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, renderSlot, createBlock } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { u as useRect } from "./index-29892cda.js";
4
- import { ArrowUp2, ArrowDown2 } from "@nutui/icons-vue";
5
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { ref as v, computed as y, onMounted as N, onUnmounted as P, reactive as _, provide as T, resolveComponent as k, openBlock as i, createElementBlock as g, normalizeClass as u, createElementVNode as p, Fragment as D, renderList as I, normalizeStyle as U, toDisplayString as R, renderSlot as b, createBlock as x } from "vue";
2
+ import { c as z } from "./component-234624bc.js";
3
+ import { u as M } from "./index-192a3ef6.js";
4
+ import { ArrowUp2 as j, ArrowDown2 as H } from "@nutui/icons-vue";
5
+ import { _ as V } from "./_plugin-vue_export-helper-dad06003.js";
6
6
  import "../locale/lang";
7
- const { componentName, create } = createComponent("menu");
8
- const _sfc_main = create({
7
+ const { componentName: W, create: Y } = z("menu"), q = Y({
9
8
  components: {
10
- ArrowUp2,
11
- ArrowDown2
9
+ ArrowUp2: j,
10
+ ArrowDown2: H
12
11
  },
13
12
  props: {
14
13
  activeColor: {
@@ -17,20 +16,19 @@ const _sfc_main = create({
17
16
  },
18
17
  overlay: {
19
18
  type: Boolean,
20
- default: true
19
+ default: !0
21
20
  },
22
21
  lockScroll: {
23
22
  type: Boolean,
24
- default: true
23
+ default: !0
25
24
  },
26
25
  duration: {
27
26
  type: [Number, String],
28
- default: 0
27
+ default: 0.3
29
28
  },
30
- titleIcon: String,
31
29
  closeOnClickOverlay: {
32
30
  type: Boolean,
33
- default: true
31
+ default: !0
34
32
  },
35
33
  direction: {
36
34
  type: String,
@@ -38,162 +36,108 @@ const _sfc_main = create({
38
36
  },
39
37
  scrollFixed: {
40
38
  type: [Boolean, String, Number],
41
- default: false
39
+ default: !1
42
40
  },
43
41
  titleClass: [String]
44
42
  },
45
- setup(props, { emit, slots }) {
46
- const barRef = ref();
47
- const offset = ref(0);
48
- const isScrollFixed = ref(false);
49
- const useChildren = () => {
50
- const publicChildren = reactive([]);
51
- const internalChildren = reactive([]);
52
- const linkChildren2 = (value) => {
53
- const link = (child) => {
54
- if (child.proxy) {
55
- internalChildren.push(child);
56
- publicChildren.push(child.proxy);
57
- }
58
- };
59
- const removeLink = (child) => {
60
- if (child.proxy) {
61
- let internalIndex = internalChildren.indexOf(child);
62
- if (internalIndex > -1) {
63
- internalChildren.splice(internalIndex, 1);
64
- }
65
- let publicIndex = publicChildren.indexOf(child.proxy);
66
- if (internalIndex > -1) {
67
- publicChildren.splice(publicIndex, 1);
68
- }
69
- }
70
- };
71
- provide(
72
- "menuParent",
73
- Object.assign(
74
- {
75
- removeLink,
76
- link,
77
- children: publicChildren,
78
- internalChildren
79
- },
80
- value
81
- )
82
- );
83
- };
84
- return {
85
- children: publicChildren,
86
- linkChildren: linkChildren2
87
- };
88
- };
89
- const { children, linkChildren } = useChildren();
90
- const opened = computed(() => children.some((item) => item.state.showWrapper));
91
- const classes = computed(() => {
92
- const prefixCls = componentName;
43
+ setup(o, { emit: S, slots: $ }) {
44
+ const c = v(), a = v(0), f = v(!1), m = () => {
45
+ const e = _([]), t = _([]);
93
46
  return {
94
- [prefixCls]: true,
95
- "scroll-fixed": isScrollFixed.value
96
- };
97
- });
98
- const updateOffset = () => {
99
- if (barRef.value) {
100
- const rect = useRect(barRef);
101
- if (props.direction === "down") {
102
- offset.value = rect.bottom;
103
- } else {
104
- offset.value = window.innerHeight - rect.top;
47
+ children: e,
48
+ linkChildren: (E) => {
49
+ T(
50
+ "menuParent",
51
+ Object.assign(
52
+ {
53
+ removeLink: (r) => {
54
+ if (r.proxy) {
55
+ let w = t.indexOf(r);
56
+ w > -1 && t.splice(w, 1);
57
+ let L = e.indexOf(r.proxy);
58
+ w > -1 && e.splice(L, 1);
59
+ }
60
+ },
61
+ link: (r) => {
62
+ r.proxy && (t.push(r), e.push(r.proxy));
63
+ },
64
+ children: e,
65
+ internalChildren: t
66
+ },
67
+ E
68
+ )
69
+ );
105
70
  }
71
+ };
72
+ }, { children: s, linkChildren: n } = m(), d = y(() => s.some((e) => e.state.showWrapper)), h = y(() => ({
73
+ [W]: !0,
74
+ "scroll-fixed": f.value
75
+ })), B = () => {
76
+ if (c.value) {
77
+ const e = M(c);
78
+ o.direction === "down" ? a.value = e.bottom : a.value = window.innerHeight - e.top;
106
79
  }
107
80
  };
108
- linkChildren({ props, offset });
109
- const toggleItem = (active) => {
110
- children.forEach((item, index2) => {
111
- if (index2 === active) {
112
- updateOffset();
113
- item.toggle();
114
- } else if (item.state.showPopup) {
115
- item.toggle(false, { immediate: true });
116
- }
81
+ n({ props: o, offset: a });
82
+ const O = (e) => {
83
+ s.forEach((t, l) => {
84
+ l === e ? (B(), t.toggle()) : t.state.showPopup && t.toggle(!1, { immediate: !0 });
117
85
  });
86
+ }, A = (e) => Math.max(0, "scrollTop" in e ? e.scrollTop : e.pageYOffset), C = () => {
87
+ const { scrollFixed: e } = o, t = A(window);
88
+ f.value = t > (typeof e == "boolean" ? 30 : Number(e));
89
+ }, F = (e) => {
90
+ let t = "";
91
+ const { titleClass: l } = o;
92
+ return e && (t += "active"), l && (t += ` ${l}`), t;
118
93
  };
119
- const getScrollTop = (el) => {
120
- return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
121
- };
122
- const onScroll = () => {
123
- const { scrollFixed } = props;
124
- const scrollTop = getScrollTop(window);
125
- isScrollFixed.value = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
126
- };
127
- const getClasses = (showPopup) => {
128
- let str = "";
129
- const { titleClass } = props;
130
- if (showPopup) {
131
- str += "active";
132
- }
133
- if (titleClass) {
134
- str += ` ${titleClass}`;
135
- }
136
- return str;
137
- };
138
- onMounted(() => {
139
- const { scrollFixed } = props;
140
- if (scrollFixed) {
141
- window.addEventListener("scroll", onScroll);
142
- }
143
- });
144
- onUnmounted(() => {
145
- const { scrollFixed } = props;
146
- if (scrollFixed) {
147
- window.removeEventListener("scroll", onScroll);
148
- }
149
- });
150
- return {
151
- toggleItem,
152
- children,
153
- opened,
154
- classes,
155
- barRef,
156
- getClasses
94
+ return N(() => {
95
+ const { scrollFixed: e } = o;
96
+ e && window.addEventListener("scroll", C);
97
+ }), P(() => {
98
+ const { scrollFixed: e } = o;
99
+ e && window.removeEventListener("scroll", C);
100
+ }), {
101
+ toggleItem: O,
102
+ children: s,
103
+ opened: d,
104
+ classes: h,
105
+ barRef: c,
106
+ getClasses: F
157
107
  };
158
108
  }
159
- });
160
- const _hoisted_1 = ["onClick"];
161
- const _hoisted_2 = { class: "nut-menu__title-text" };
162
- const _hoisted_3 = { class: "nut-menu__title-icon" };
163
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
164
- const _component_ArrowUp2 = resolveComponent("ArrowUp2");
165
- const _component_ArrowDown2 = resolveComponent("ArrowDown2");
166
- return openBlock(), createElementBlock("view", {
167
- class: normalizeClass(_ctx.classes)
109
+ }), G = ["onClick"], J = { class: "nut-menu__title-text" }, K = { class: "nut-menu__title-icon" };
110
+ function Q(o, S, $, c, a, f) {
111
+ const m = k("ArrowUp2"), s = k("ArrowDown2");
112
+ return i(), g("view", {
113
+ class: u(o.classes)
168
114
  }, [
169
- createElementVNode("view", {
170
- class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
115
+ p("view", {
116
+ class: u(["nut-menu__bar", { opened: o.opened }]),
171
117
  ref: "barRef"
172
118
  }, [
173
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
174
- return openBlock(), createElementBlock("view", {
175
- key: index2,
176
- class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
177
- onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
178
- style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
119
+ (i(!0), g(D, null, I(o.children, (n, d) => (i(), g("view", {
120
+ key: d,
121
+ class: u(["nut-menu__item", { disabled: n.disabled, active: n.state.showPopup }]),
122
+ onClick: (h) => !n.disabled && o.toggleItem(d),
123
+ style: U({ color: n.state.showPopup ? o.activeColor : "" })
124
+ }, [
125
+ p("view", {
126
+ class: u(["nut-menu__title", o.getClasses(n.state.showPopup)])
179
127
  }, [
180
- createElementVNode("view", {
181
- class: normalizeClass(["nut-menu__title", _ctx.getClasses(item.state.showPopup)])
182
- }, [
183
- createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
184
- createElementVNode("span", _hoisted_3, [
185
- renderSlot(_ctx.$slots, "icon", {}, () => [
186
- _ctx.direction === "up" ? (openBlock(), createBlock(_component_ArrowUp2, { key: 0 })) : (openBlock(), createBlock(_component_ArrowDown2, { key: 1 }))
187
- ])
128
+ p("view", J, R(n.renderTitle()), 1),
129
+ p("span", K, [
130
+ b(o.$slots, "icon", {}, () => [
131
+ o.direction === "up" ? (i(), x(m, { key: 0 })) : (i(), x(s, { key: 1 }))
188
132
  ])
189
- ], 2)
190
- ], 14, _hoisted_1);
191
- }), 128))
133
+ ])
134
+ ], 2)
135
+ ], 14, G))), 128))
192
136
  ], 2),
193
- renderSlot(_ctx.$slots, "default")
137
+ b(o.$slots, "default")
194
138
  ], 2);
195
139
  }
196
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
140
+ const le = /* @__PURE__ */ V(q, [["render", Q]]);
197
141
  export {
198
- index as default
142
+ le as default
199
143
  };