@nutui/nutui 3.1.22-beta.5 → 3.1.23-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 (168) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20412 -4214
  4. package/dist/nutui.umd.js +20518 -4216
  5. package/dist/packages/_es/ActionSheet.js +149 -17
  6. package/dist/packages/_es/Address.js +535 -110
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +59 -17
  9. package/dist/packages/_es/Audio.js +257 -53
  10. package/dist/packages/_es/AudioOperate.js +100 -13
  11. package/dist/packages/_es/Avatar.js +162 -38
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -30
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -147
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +109 -32
  30. package/dist/packages/_es/CollapseItem.js +253 -59
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +20 -8
  33. package/dist/packages/_es/CountDown.js +238 -56
  34. package/dist/packages/_es/CountUp.js +539 -140
  35. package/dist/packages/_es/DatePicker.js +315 -98
  36. package/dist/packages/_es/Dialog.js +289 -60
  37. package/dist/packages/_es/Divider.js +65 -13
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -58
  41. package/dist/packages/_es/Ellipsis.js +200 -58
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +137 -26
  50. package/dist/packages/_es/ImagePreview.js +547 -76
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -57
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -18
  57. package/dist/packages/_es/Menu.js +168 -44
  58. package/dist/packages/_es/MenuItem.js +173 -37
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -74
  61. package/dist/packages/_es/Notify.js +227 -72
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -130
  64. package/dist/packages/_es/OverLay.js +98 -24
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +454 -129
  67. package/dist/packages/_es/Popover.js +957 -318
  68. package/dist/packages/_es/Popup.js +299 -55
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -84
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -83
  75. package/dist/packages/_es/Rate.js +192 -36
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -37
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -24
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -41
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -84
  84. package/dist/packages/_es/Step.js +115 -20
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -17
  88. package/dist/packages/_es/Swipe.js +178 -41
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -18
  96. package/dist/packages/_es/Tabs.js +202 -43
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -18
  100. package/dist/packages/_es/TimePannel.js +48 -14
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -71
  103. package/dist/packages/_es/Uploader.js +455 -104
  104. package/dist/packages/_es/Video.js +332 -74
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +780 -164
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/imagepreview/index.scss +6 -1
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.js +105 -5
  118. package/dist/packages/locale/lang/id-ID.js +105 -5
  119. package/dist/packages/locale/lang/index.js +38 -16
  120. package/dist/packages/locale/lang/zh-CN.js +105 -5
  121. package/dist/packages/locale/lang/zh-TW.js +105 -5
  122. package/dist/packages/picker/index.scss +13 -0
  123. package/dist/smartips/attributes.json +8 -0
  124. package/dist/smartips/tags.json +3 -1
  125. package/dist/smartips/web-types.json +19 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +49 -49
  129. package/dist/styles/themes/jdb.scss +49 -49
  130. package/dist/styles/themes/jdt.scss +49 -49
  131. package/dist/styles/variables-jdb.scss +4 -1
  132. package/dist/styles/variables-jdt.scss +4 -1
  133. package/dist/styles/variables.scss +1 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  135. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  136. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  137. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  138. package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  149. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  153. package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  155. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  156. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  162. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  165. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
  167. package/dist/types/index.d.ts +1 -1
  168. package/package.json +1 -2
@@ -1,20 +1,67 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { toRefs as e, computed as r, openBlock as t, createElementBlock as l, normalizeClass as o, Fragment as n, renderList as a, toDisplayString as u } from "vue";
7
- import { c } from "./component.js";
8
- import { _ as s } from "./plugin-vue_export-helper.js";
6
+ import { toRefs, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName: i, create: p } = c("indicator");
11
- var m = s(p({ props: { size: { type: Number, default: 3, required: true }, current: { type: Number, default: 1, required: true }, block: { type: Boolean, default: false }, align: { type: String, default: "center" }, fillZero: { type: Boolean, default: true } }, setup(t2) {
12
- const { block: l2, align: o2 } = e(t2);
13
- return { classes: r(() => {
14
- const e2 = i;
15
- return { [e2]: true, [`${e2}--block`]: l2.value, [`${e2}--align__${o2.value}`]: l2.value && o2.value };
16
- }), componentName: i };
17
- } }), [["render", function(e2, r2, c2, s2, i2, p2) {
18
- return t(), l("view", { class: o(e2.classes) }, [(t(true), l(n, null, a(e2.size, (r3) => (t(), l(n, { key: r3 }, [r3 === e2.current ? (t(), l("view", { key: 0, class: o(`${e2.componentName}--number`) }, u(e2.fillZero && r3 < 10 ? `0${r3}` : r3), 3)) : (t(), l("view", { key: 1, class: o(`${e2.componentName}--dot`) }, null, 2))], 64))), 128))], 2);
19
- }]]);
20
- export { m as default };
10
+ const { componentName, create } = createComponent("indicator");
11
+ const _sfc_main = create({
12
+ props: {
13
+ size: {
14
+ type: Number,
15
+ default: 3,
16
+ required: true
17
+ },
18
+ current: {
19
+ type: Number,
20
+ default: 1,
21
+ required: true
22
+ },
23
+ block: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ align: {
28
+ type: String,
29
+ default: "center"
30
+ },
31
+ fillZero: {
32
+ type: Boolean,
33
+ default: true
34
+ }
35
+ },
36
+ setup(props) {
37
+ const { block, align } = toRefs(props);
38
+ const classes = computed(() => {
39
+ const prefixCls = componentName;
40
+ return {
41
+ [prefixCls]: true,
42
+ [`${prefixCls}--block`]: block.value,
43
+ [`${prefixCls}--align__${align.value}`]: block.value && align.value
44
+ };
45
+ });
46
+ return { classes, componentName };
47
+ }
48
+ });
49
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
50
+ return openBlock(), createElementBlock("view", {
51
+ class: normalizeClass(_ctx.classes)
52
+ }, [
53
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.size, (item) => {
54
+ return openBlock(), createElementBlock(Fragment, { key: item }, [
55
+ item === _ctx.current ? (openBlock(), createElementBlock("view", {
56
+ key: 0,
57
+ class: normalizeClass(`${_ctx.componentName}--number`)
58
+ }, toDisplayString(_ctx.fillZero && item < 10 ? `0${item}` : item), 3)) : (openBlock(), createElementBlock("view", {
59
+ key: 1,
60
+ class: normalizeClass(`${_ctx.componentName}--dot`)
61
+ }, null, 2))
62
+ ], 64);
63
+ }), 128))
64
+ ], 2);
65
+ }
66
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
67
+ export { index as default };
@@ -1,64 +1,256 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { reactive as e, computed as t, onMounted as o, onUnmounted as n, ref as s, onActivated as l, onDeactivated as i, toRefs as r, resolveComponent as a, openBlock as c, createElementBlock as u, normalizeClass as d, createElementVNode as f, normalizeStyle as p, createVNode as h, toDisplayString as g, renderSlot as m, Fragment as w, createCommentVNode as T } from "vue";
7
- import { c as y } from "./component.js";
8
- import { _ as v } from "./plugin-vue_export-helper.js";
6
+ import { reactive, computed, onMounted, onUnmounted, ref, onActivated, onDeactivated, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createVNode, toDisplayString, renderSlot, Fragment, createCommentVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName: b, create: x, translate: E } = y("infiniteloading"), S = x({ props: { hasMore: { type: Boolean, default: true }, threshold: { type: Number, default: 200 }, pullIcon: { type: String, default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png" }, pullTxt: { type: String, default: "" }, loadIcon: { type: String, default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png" }, loadTxt: { type: String, default: "" }, loadMoreTxt: { type: String, default: "" }, useWindow: { type: Boolean, default: true }, containerId: { type: String, default: "" }, useCapture: { type: Boolean, default: false }, isOpenRefresh: { type: Boolean, default: false } }, emits: ["scroll-change", "load-more", "refresh"], setup(a2, { emit: c2, slots: u2 }) {
11
- const d2 = e({ scrollEl: window, scroller: null, refreshTop: null, beforeScrollTop: 0, isTouching: false, isInfiniting: false, refreshMaxH: 0, y: 0, x: 0, distance: 0 }), f2 = t(() => ({ [b]: true })), p2 = t(() => ({ height: d2.distance < 0 ? "0px" : `${d2.distance}px`, transition: d2.isTouching ? "height 0s cubic-bezier(0.25,0.1,0.25,1)" : "height 0.2s cubic-bezier(0.25,0.1,0.25,1)" })), h2 = (e2) => e2 ? e2.offsetTop + h2(e2.offsetParent) : 0, g2 = () => {
12
- let e2 = 0, t2 = 0, o2 = "down";
13
- const n2 = window.pageYOffset !== void 0 ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
14
- if (a2.useWindow)
15
- d2.scroller && (e2 = h2(d2.scroller) + d2.scroller.offsetHeight - n2 - window.innerHeight), t2 = n2;
16
- else {
17
- const { scrollHeight: o3, clientHeight: n3, scrollTop: s2 } = d2.scrollEl;
18
- e2 = o3 - n3 - s2, t2 = s2;
10
+ const { componentName, create, translate } = createComponent("infiniteloading");
11
+ const _sfc_main = create({
12
+ props: {
13
+ hasMore: {
14
+ type: Boolean,
15
+ default: true
16
+ },
17
+ threshold: {
18
+ type: Number,
19
+ default: 200
20
+ },
21
+ pullIcon: {
22
+ type: String,
23
+ default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png"
24
+ },
25
+ pullTxt: {
26
+ type: String,
27
+ default: ""
28
+ },
29
+ loadIcon: {
30
+ type: String,
31
+ default: "https://img10.360buyimg.com/imagetools/jfs/t1/169863/6/4565/6306/60125948E7e92774e/40b3a0cf42852bcb.png"
32
+ },
33
+ loadTxt: {
34
+ type: String,
35
+ default: ""
36
+ },
37
+ loadMoreTxt: {
38
+ type: String,
39
+ default: ""
40
+ },
41
+ useWindow: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ containerId: {
46
+ type: String,
47
+ default: ""
48
+ },
49
+ useCapture: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ isOpenRefresh: {
54
+ type: Boolean,
55
+ default: false
19
56
  }
20
- return o2 = d2.beforeScrollTop > t2 ? "up" : "down", d2.beforeScrollTop = t2, c2("scroll-change", t2), e2 <= a2.threshold && o2 == "down";
21
- }, m2 = () => {
22
- d2.isInfiniting = false;
23
- }, w2 = () => {
24
- (window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(e2) {
25
- window.setTimeout(e2, 1e3 / 60);
26
- })(() => {
27
- if (!g2() || !a2.hasMore || d2.isInfiniting)
28
- return false;
29
- d2.isInfiniting = true, c2("load-more", m2);
57
+ },
58
+ emits: ["scroll-change", "load-more", "refresh"],
59
+ setup(props, { emit, slots }) {
60
+ const state = reactive({
61
+ scrollEl: window,
62
+ scroller: null,
63
+ refreshTop: null,
64
+ beforeScrollTop: 0,
65
+ isTouching: false,
66
+ isInfiniting: false,
67
+ refreshMaxH: 0,
68
+ y: 0,
69
+ x: 0,
70
+ distance: 0
30
71
  });
31
- }, T2 = () => {
32
- d2.scrollEl.addEventListener("scroll", w2, a2.useCapture);
33
- }, y2 = () => {
34
- d2.distance = 0, d2.isTouching = false;
35
- };
36
- o(() => {
37
- const e2 = (t2 = d2.scroller, a2.containerId ? document.querySelector(`#${a2.containerId}`) : t2 && t2.parentNode);
38
- var t2;
39
- d2.scrollEl = a2.useWindow ? window : e2, T2();
40
- }), n(() => {
41
- d2.scrollEl.removeEventListener("scroll", w2, a2.useCapture);
42
- });
43
- const v2 = s(false);
44
- return l(() => {
45
- v2.value && (v2.value = false, T2());
46
- }), i(() => {
47
- v2.value = true, d2.scrollEl.removeEventListener("scroll", w2, a2.useCapture);
48
- }), { classes: f2, ...r(d2), touchStart: (e2) => {
49
- if (d2.beforeScrollTop == 0 && !d2.isTouching && a2.isOpenRefresh) {
50
- d2.y = e2.touches[0].pageY, d2.isTouching = true;
51
- const t2 = d2.refreshTop.firstElementChild.offsetHeight;
52
- d2.refreshMaxH = Math.floor(1 * t2 + 10);
53
- }
54
- }, touchMove: (e2) => {
55
- d2.distance = e2.touches[0].pageY - d2.y, d2.distance > 0 && d2.isTouching ? (e2.preventDefault(), d2.distance >= d2.refreshMaxH && (d2.distance = d2.refreshMaxH)) : (d2.distance = 0, d2.isTouching = false);
56
- }, touchEnd: () => {
57
- d2.distance && (d2.distance < d2.refreshMaxH ? d2.distance = 0 : c2("refresh", y2));
58
- }, getStyle: p2, translate: E, slots: u2 };
59
- } }), M = { class: "top-box" }, I = { class: "top-text" }, H = { class: "nut-infinite-container" }, k = { class: "nut-infinite-bottom" }, C = { key: 0, class: "bottom-box" }, $ = { class: "bottom-text" }, j = { key: 0, class: "tips" };
60
- var B = v(S, [["render", function(e2, t2, o2, n2, s2, l2) {
61
- const i2 = a("nut-icon");
62
- return c(), u("view", { class: d(e2.classes), ref: "scroller", onTouchstart: t2[0] || (t2[0] = (...t3) => e2.touchStart && e2.touchStart(...t3)), onTouchmove: t2[1] || (t2[1] = (...t3) => e2.touchMove && e2.touchMove(...t3)), onTouchend: t2[2] || (t2[2] = (...t3) => e2.touchEnd && e2.touchEnd(...t3)) }, [f("view", { class: "nut-infinite-top", ref: "refreshTop", style: p(e2.getStyle) }, [f("view", M, [h(i2, { class: "top-img", name: e2.pullIcon }, null, 8, ["name"]), f("view", I, g(e2.pullTxt || e2.translate("pullTxt")), 1)])], 4), f("view", H, [m(e2.$slots, "default")]), f("view", k, [e2.isInfiniting ? (c(), u("view", C, [e2.slots.loading ? m(e2.$slots, "loading", { key: 1 }) : (c(), u(w, { key: 0 }, [h(i2, { class: "bottom-img", name: e2.loadIcon }, null, 8, ["name"]), f("view", $, g(e2.loadTxt || e2.translate("loading")), 1)], 64))])) : e2.hasMore ? T("", true) : (c(), u(w, { key: 1 }, [e2.slots.finished ? m(e2.$slots, "finished", { key: 1 }) : (c(), u("view", j, g(e2.loadMoreTxt || e2.translate("loadMoreTxt")), 1))], 64))])], 34);
63
- }]]);
64
- export { B as default };
72
+ const classes = computed(() => {
73
+ const prefixCls = componentName;
74
+ return {
75
+ [prefixCls]: true
76
+ };
77
+ });
78
+ const getStyle = computed(() => {
79
+ return {
80
+ height: state.distance < 0 ? `0px` : `${state.distance}px`,
81
+ transition: state.isTouching ? `height 0s cubic-bezier(0.25,0.1,0.25,1)` : `height 0.2s cubic-bezier(0.25,0.1,0.25,1)`
82
+ };
83
+ });
84
+ const requestAniFrame = () => {
85
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
86
+ window.setTimeout(callback, 1e3 / 60);
87
+ };
88
+ };
89
+ const getWindowScrollTop = () => {
90
+ return window.pageYOffset !== void 0 ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
91
+ };
92
+ const calculateTopPosition = (el) => {
93
+ return !el ? 0 : el.offsetTop + calculateTopPosition(el.offsetParent);
94
+ };
95
+ const isScrollAtBottom = () => {
96
+ let offsetDistance = 0;
97
+ let resScrollTop = 0;
98
+ let direction = "down";
99
+ const windowScrollTop = getWindowScrollTop();
100
+ if (props.useWindow) {
101
+ if (state.scroller) {
102
+ offsetDistance = calculateTopPosition(state.scroller) + state.scroller.offsetHeight - windowScrollTop - window.innerHeight;
103
+ }
104
+ resScrollTop = windowScrollTop;
105
+ } else {
106
+ const { scrollHeight, clientHeight, scrollTop } = state.scrollEl;
107
+ offsetDistance = scrollHeight - clientHeight - scrollTop;
108
+ resScrollTop = scrollTop;
109
+ }
110
+ if (state.beforeScrollTop > resScrollTop) {
111
+ direction = "up";
112
+ } else {
113
+ direction = "down";
114
+ }
115
+ state.beforeScrollTop = resScrollTop;
116
+ emit("scroll-change", resScrollTop);
117
+ return offsetDistance <= props.threshold && direction == "down";
118
+ };
119
+ const infiniteDone = () => {
120
+ state.isInfiniting = false;
121
+ };
122
+ const handleScroll = () => {
123
+ requestAniFrame()(() => {
124
+ if (!isScrollAtBottom() || !props.hasMore || state.isInfiniting) {
125
+ return false;
126
+ } else {
127
+ state.isInfiniting = true;
128
+ emit("load-more", infiniteDone);
129
+ }
130
+ });
131
+ };
132
+ const scrollListener = () => {
133
+ state.scrollEl.addEventListener("scroll", handleScroll, props.useCapture);
134
+ };
135
+ const refreshDone = () => {
136
+ state.distance = 0;
137
+ state.isTouching = false;
138
+ };
139
+ const touchStart = (event) => {
140
+ if (state.beforeScrollTop == 0 && !state.isTouching && props.isOpenRefresh) {
141
+ state.y = event.touches[0].pageY;
142
+ state.isTouching = true;
143
+ const childHeight = state.refreshTop.firstElementChild.offsetHeight;
144
+ state.refreshMaxH = Math.floor(childHeight * 1 + 10);
145
+ }
146
+ };
147
+ const touchMove = (event) => {
148
+ state.distance = event.touches[0].pageY - state.y;
149
+ if (state.distance > 0 && state.isTouching) {
150
+ event.preventDefault();
151
+ if (state.distance >= state.refreshMaxH)
152
+ state.distance = state.refreshMaxH;
153
+ } else {
154
+ state.distance = 0;
155
+ state.isTouching = false;
156
+ }
157
+ };
158
+ const touchEnd = () => {
159
+ if (state.distance) {
160
+ if (state.distance < state.refreshMaxH) {
161
+ state.distance = 0;
162
+ } else {
163
+ emit("refresh", refreshDone);
164
+ }
165
+ }
166
+ };
167
+ const getParentElement = (el) => {
168
+ return !!props.containerId ? document.querySelector(`#${props.containerId}`) : el && el.parentNode;
169
+ };
170
+ onMounted(() => {
171
+ const parentElement = getParentElement(state.scroller);
172
+ state.scrollEl = props.useWindow ? window : parentElement;
173
+ scrollListener();
174
+ console.log(slots);
175
+ });
176
+ onUnmounted(() => {
177
+ state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
178
+ });
179
+ const isKeepAlive = ref(false);
180
+ onActivated(() => {
181
+ if (isKeepAlive.value) {
182
+ isKeepAlive.value = false;
183
+ scrollListener();
184
+ }
185
+ });
186
+ onDeactivated(() => {
187
+ isKeepAlive.value = true;
188
+ state.scrollEl.removeEventListener("scroll", handleScroll, props.useCapture);
189
+ });
190
+ return {
191
+ classes,
192
+ ...toRefs(state),
193
+ touchStart,
194
+ touchMove,
195
+ touchEnd,
196
+ getStyle,
197
+ translate,
198
+ slots
199
+ };
200
+ }
201
+ });
202
+ const _hoisted_1 = { class: "top-box" };
203
+ const _hoisted_2 = { class: "top-text" };
204
+ const _hoisted_3 = { class: "nut-infinite-container" };
205
+ const _hoisted_4 = { class: "nut-infinite-bottom" };
206
+ const _hoisted_5 = {
207
+ key: 0,
208
+ class: "bottom-box"
209
+ };
210
+ const _hoisted_6 = { class: "bottom-text" };
211
+ const _hoisted_7 = {
212
+ key: 0,
213
+ class: "tips"
214
+ };
215
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
216
+ const _component_nut_icon = resolveComponent("nut-icon");
217
+ return openBlock(), createElementBlock("view", {
218
+ class: normalizeClass(_ctx.classes),
219
+ ref: "scroller",
220
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
221
+ onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.touchMove && _ctx.touchMove(...args)),
222
+ onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
223
+ }, [
224
+ createElementVNode("view", {
225
+ class: "nut-infinite-top",
226
+ ref: "refreshTop",
227
+ style: normalizeStyle(_ctx.getStyle)
228
+ }, [
229
+ createElementVNode("view", _hoisted_1, [
230
+ createVNode(_component_nut_icon, {
231
+ class: "top-img",
232
+ name: _ctx.pullIcon
233
+ }, null, 8, ["name"]),
234
+ createElementVNode("view", _hoisted_2, toDisplayString(_ctx.pullTxt || _ctx.translate("pullTxt")), 1)
235
+ ])
236
+ ], 4),
237
+ createElementVNode("view", _hoisted_3, [
238
+ renderSlot(_ctx.$slots, "default")
239
+ ]),
240
+ createElementVNode("view", _hoisted_4, [
241
+ _ctx.isInfiniting ? (openBlock(), createElementBlock("view", _hoisted_5, [
242
+ !_ctx.slots.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
243
+ createVNode(_component_nut_icon, {
244
+ class: "bottom-img",
245
+ name: _ctx.loadIcon
246
+ }, null, 8, ["name"]),
247
+ createElementVNode("view", _hoisted_6, toDisplayString(_ctx.loadTxt || _ctx.translate("loading")), 1)
248
+ ], 64)) : renderSlot(_ctx.$slots, "loading", { key: 1 })
249
+ ])) : !_ctx.hasMore ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
250
+ !_ctx.slots.finished ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.loadMoreTxt || _ctx.translate("loadMoreTxt")), 1)) : renderSlot(_ctx.$slots, "finished", { key: 1 })
251
+ ], 64)) : createCommentVNode("", true)
252
+ ])
253
+ ], 34);
254
+ }
255
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
256
+ export { index as default };