@nutui/nutui 3.1.22 → 3.1.23-beta.2

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 (186) hide show
  1. package/dist/nutui.es.js +20643 -4214
  2. package/dist/nutui.umd.js +20750 -4216
  3. package/dist/packages/_es/ActionSheet.js +149 -17
  4. package/dist/packages/_es/Address.js +535 -110
  5. package/dist/packages/_es/AddressList.js +615 -113
  6. package/dist/packages/_es/Animate.js +59 -17
  7. package/dist/packages/_es/Audio.js +257 -53
  8. package/dist/packages/_es/AudioOperate.js +100 -13
  9. package/dist/packages/_es/Avatar.js +162 -38
  10. package/dist/packages/_es/AvatarGroup.js +73 -14
  11. package/dist/packages/_es/BackTop.js +156 -43
  12. package/dist/packages/_es/Badge.js +86 -14
  13. package/dist/packages/_es/Barrage.js +120 -41
  14. package/dist/packages/_es/Button.js +128 -23
  15. package/dist/packages/_es/Calendar.js +246 -30
  16. package/dist/packages/_es/CalendarItem.js +1 -1
  17. package/dist/packages/_es/Card.js +107 -10
  18. package/dist/packages/_es/Cascader.js +496 -147
  19. package/dist/packages/_es/Category.js +58 -15
  20. package/dist/packages/_es/CategoryPane.js +113 -11
  21. package/dist/packages/_es/Cell.js +108 -21
  22. package/dist/packages/_es/CellGroup.js +44 -9
  23. package/dist/packages/_es/Checkbox.js +143 -29
  24. package/dist/packages/_es/CheckboxGroup.js +79 -29
  25. package/dist/packages/_es/CircleProgress.js +150 -28
  26. package/dist/packages/_es/Col.js +56 -14
  27. package/dist/packages/_es/Collapse.js +109 -32
  28. package/dist/packages/_es/CollapseItem.js +253 -59
  29. package/dist/packages/_es/Comment.js +434 -64
  30. package/dist/packages/_es/ConfigProvider.js +20 -8
  31. package/dist/packages/_es/CountDown.js +238 -56
  32. package/dist/packages/_es/CountUp.js +539 -140
  33. package/dist/packages/_es/DatePicker.js +316 -98
  34. package/dist/packages/_es/Dialog.js +289 -60
  35. package/dist/packages/_es/Divider.js +65 -13
  36. package/dist/packages/_es/Drag.js +197 -56
  37. package/dist/packages/_es/Ecard.js +159 -24
  38. package/dist/packages/_es/Elevator.js +255 -58
  39. package/dist/packages/_es/Ellipsis.js +200 -58
  40. package/dist/packages/_es/Empty.js +71 -12
  41. package/dist/packages/_es/FixedNav.js +122 -15
  42. package/dist/packages/_es/Form.js +151 -64
  43. package/dist/packages/_es/FormItem.js +114 -15
  44. package/dist/packages/_es/Grid.js +6 -5
  45. package/dist/packages/_es/GridItem.js +144 -33
  46. package/dist/packages/_es/Icon.js +40 -15
  47. package/dist/packages/_es/Image.js +137 -26
  48. package/dist/packages/_es/ImagePreview.js +547 -76
  49. package/dist/packages/_es/Indicator.js +62 -15
  50. package/dist/packages/_es/InfiniteLoading.js +249 -57
  51. package/dist/packages/_es/Input.js +433 -51
  52. package/dist/packages/_es/InputNumber.js +160 -41
  53. package/dist/packages/_es/Layout.js +5 -4
  54. package/dist/packages/_es/List.js +106 -18
  55. package/dist/packages/_es/Menu.js +168 -44
  56. package/dist/packages/_es/MenuItem.js +173 -37
  57. package/dist/packages/_es/Navbar.js +192 -30
  58. package/dist/packages/_es/NoticeBar.js +380 -74
  59. package/dist/packages/_es/Notify.js +227 -72
  60. package/dist/packages/_es/NumberKeyboard.js +272 -41
  61. package/dist/packages/_es/OldPicker.js +457 -130
  62. package/dist/packages/_es/OverLay.js +98 -24
  63. package/dist/packages/_es/Pagination.js +157 -39
  64. package/dist/packages/_es/Picker.js +482 -129
  65. package/dist/packages/_es/Popover.js +957 -318
  66. package/dist/packages/_es/Popup.js +295 -55
  67. package/dist/packages/_es/Price.js +118 -16
  68. package/dist/packages/_es/Progress.js +146 -14
  69. package/dist/packages/_es/PullRefresh.js +339 -84
  70. package/dist/packages/_es/Radio.js +90 -22
  71. package/dist/packages/_es/RadioGroup.js +37 -8
  72. package/dist/packages/_es/Range.js +408 -83
  73. package/dist/packages/_es/Rate.js +192 -36
  74. package/dist/packages/_es/Row.js +64 -22
  75. package/dist/packages/_es/SearchBar.js +238 -37
  76. package/dist/packages/_es/ShortPassword.js +225 -35
  77. package/dist/packages/_es/SideNavBar.js +81 -24
  78. package/dist/packages/_es/SideNavBarItem.js +46 -11
  79. package/dist/packages/_es/Signature.js +160 -41
  80. package/dist/packages/_es/Skeleton.js +136 -20
  81. package/dist/packages/_es/Sku.js +491 -84
  82. package/dist/packages/_es/Step.js +115 -20
  83. package/dist/packages/_es/Steps.js +53 -18
  84. package/dist/packages/_es/Sticky.js +138 -53
  85. package/dist/packages/_es/SubSideNavBar.js +82 -17
  86. package/dist/packages/_es/Swipe.js +178 -41
  87. package/dist/packages/_es/Swiper.js +444 -121
  88. package/dist/packages/_es/SwiperItem.js +53 -22
  89. package/dist/packages/_es/Switch.js +124 -21
  90. package/dist/packages/_es/TabPane.js +39 -12
  91. package/dist/packages/_es/Tabbar.js +72 -17
  92. package/dist/packages/_es/TabbarItem.js +151 -29
  93. package/dist/packages/_es/Table.js +178 -18
  94. package/dist/packages/_es/Tabs.js +202 -43
  95. package/dist/packages/_es/Tag.js +97 -20
  96. package/dist/packages/_es/TextArea.js +160 -42
  97. package/dist/packages/_es/TimeDetail.js +79 -18
  98. package/dist/packages/_es/TimePannel.js +48 -14
  99. package/dist/packages/_es/TimeSelect.js +112 -15
  100. package/dist/packages/_es/Toast.js +310 -71
  101. package/dist/packages/_es/Uploader.js +455 -104
  102. package/dist/packages/_es/Video.js +332 -74
  103. package/dist/packages/_es/WaterMark.js +187 -0
  104. package/dist/packages/_es/common.js +128 -38
  105. package/dist/packages/_es/component.js +76 -35
  106. package/dist/packages/_es/index.js +6 -5
  107. package/dist/packages/_es/index2.js +30 -9
  108. package/dist/packages/_es/index3.js +8 -6
  109. package/dist/packages/_es/index4.js +64 -13
  110. package/dist/packages/_es/index5.js +781 -164
  111. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  112. package/dist/packages/_es/pxCheck.js +5 -3
  113. package/dist/packages/_es/raf.js +15 -8
  114. package/dist/packages/imagepreview/index.scss +5 -1
  115. package/dist/packages/locale/lang/baseLang.js +3 -3
  116. package/dist/packages/locale/lang/en-US.js +105 -5
  117. package/dist/packages/locale/lang/id-ID.js +105 -5
  118. package/dist/packages/locale/lang/index.js +38 -16
  119. package/dist/packages/locale/lang/zh-CN.js +105 -5
  120. package/dist/packages/locale/lang/zh-TW.js +105 -5
  121. package/dist/packages/picker/index.scss +14 -0
  122. package/dist/packages/watermark/index.scss +13 -0
  123. package/dist/smartips/attributes.json +68 -0
  124. package/dist/smartips/tags.json +23 -2
  125. package/dist/smartips/web-types.json +161 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +51 -50
  129. package/dist/styles/themes/jdb.scss +51 -50
  130. package/dist/styles/themes/jdt.scss +51 -50
  131. package/dist/styles/variables-jdb.scss +3 -1
  132. package/dist/styles/variables-jdt.scss +3 -1
  133. package/dist/styles/variables.scss +4 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +5 -5
  135. package/dist/types/__VUE/address/index.vue.d.ts +7 -7
  136. package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
  137. package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
  138. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/button/index.vue.d.ts +8 -8
  141. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  142. package/dist/types/__VUE/cascader/index.vue.d.ts +4 -4
  143. package/dist/types/__VUE/categorypane/index.vue.d.ts +1 -1
  144. package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
  145. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  146. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  147. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  148. package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
  149. package/dist/types/__VUE/datepicker/index.vue.d.ts +4 -4
  150. package/dist/types/__VUE/dialog/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/fixednav/index.vue.d.ts +4 -4
  152. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  153. package/dist/types/__VUE/image/index.vue.d.ts +4 -4
  154. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  155. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  156. package/dist/types/__VUE/input/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
  158. package/dist/types/__VUE/menu/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  160. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  161. package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
  162. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/oldpicker/index.vue.d.ts +5 -5
  164. package/dist/types/__VUE/picker/Column.vue.d.ts +2 -1
  165. package/dist/types/__VUE/picker/index.vue.d.ts +7 -6
  166. package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
  167. package/dist/types/__VUE/popup/index.vue.d.ts +8 -8
  168. package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
  169. package/dist/types/__VUE/range/index.vue.d.ts +4 -4
  170. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  171. package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
  172. package/dist/types/__VUE/sku/index.vue.d.ts +5 -5
  173. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
  175. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  176. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  177. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
  180. package/dist/types/__VUE/timeselect/index.vue.d.ts +2 -2
  181. package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
  182. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  183. package/dist/types/__VUE/watermark/index.vue.d.ts +143 -0
  184. package/dist/types/index.d.ts +1 -1
  185. package/dist/types/nutui.d.ts +2 -1
  186. package/package.json +8 -3
@@ -1,94 +1,349 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.2 Thu Jul 07 2022 19:06:52 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as e, toRefs as t, reactive as l, computed as a, onMounted as o, openBlock as u, createElementBlock as r, normalizeStyle as n, createElementVNode as s, normalizeClass as i, toDisplayString as v, renderSlot as c } from "vue";
7
- import { c as d } from "./component.js";
8
- import { _ as h } from "./plugin-vue_export-helper.js";
6
+ import { ref, toRefs, reactive, computed, onMounted, openBlock, createElementBlock, normalizeStyle, createElementVNode, normalizeClass, toDisplayString, renderSlot } 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
- function f(e2, t2) {
11
- (typeof e2.cancelable != "boolean" || e2.cancelable) && e2.preventDefault(), t2 && e2.stopPropagation();
10
+ const MIN_DISTANCE = 10;
11
+ function getDirection(x, y) {
12
+ if (x > y && x > MIN_DISTANCE) {
13
+ return "horizontal";
14
+ }
15
+ if (y > x && y > MIN_DISTANCE) {
16
+ return "vertical";
17
+ }
18
+ return "";
12
19
  }
13
- const { componentName: p, create: m } = d("pullrefresh"), g = m({ props: { useWindow: { type: Boolean, default: true }, containerId: { type: String, default: "" }, disabled: { type: Boolean, default: false }, direction: { type: String, default: "vertical" }, pullingText: { type: Object, default: { top: "\u4E0B\u62C9\u5237\u65B0", bottom: "\u4E0A\u62C9\u52A0\u8F7D", left: "\u5DE6\u6ED1\u5237\u65B0", right: "\u53F3\u6ED1\u52A0\u8F7D" } }, loosingText: { type: Object, default: { top: "\u677E\u624B\u91CA\u653E\u5237\u65B0", bottom: "\u677E\u624B\u91CA\u653E\u5237\u65B0", left: "\u91CA\u653E\u5237\u65B0", right: "\u52A0\u8F7D\u66F4\u591A" } }, loadingText: { type: Object, default: { top: "\u52A0\u8F7D\u4E2D...", bottom: "\u52A0\u8F7D\u4E2D...", left: "\u52A0\u8F7D\u4E2D...", right: "\u52A0\u8F7D\u4E2D..." } } }, emits: ["refresh", "downRefresh"], setup(u2, { emit: r2 }) {
14
- const { containerId: n2, useWindow: s2, direction: i2, disabled: v2 } = t(u2), c2 = e(false), d2 = e(false), h2 = e(false), p2 = e(false), m2 = l({ status: "normal", distance: 0, duration: 0 });
15
- let g2 = document.documentElement || document.body;
16
- const b2 = e(null), T2 = function() {
17
- const t2 = e(0), l2 = e(0), a2 = e(0), o2 = e(0), u3 = e(0), r3 = e(0), n3 = e(""), s3 = () => {
18
- a2.value = 0, o2.value = 0, u3.value = 0, r3.value = 0, n3.value = "";
19
- };
20
- return { move: (e2) => {
21
- const s4 = e2.touches[0];
22
- var i3, v3;
23
- a2.value = s4.clientX - t2.value, o2.value = s4.clientY - l2.value, u3.value = Math.abs(a2.value), r3.value = Math.abs(o2.value), n3.value || (n3.value = (i3 = u3.value) > (v3 = r3.value) && i3 > 10 ? "horizontal" : v3 > i3 && v3 > 10 ? "vertical" : "");
24
- }, start: (e2) => {
25
- s3(), t2.value = e2.touches[0].clientX, l2.value = e2.touches[0].clientY;
26
- }, reset: s3, startX: t2, startY: l2, deltaX: a2, deltaY: o2, offsetX: u3, offsetY: r3, direction: n3, isVertical: () => n3.value === "vertical", isHorizontal: () => n3.value === "horizontal" };
27
- }(), x = a(() => {
28
- let e2 = {};
29
- const { deltaY: t2, deltaX: l2 } = T2;
30
- return i2.value == "vertical" && (c2.value && t2.value > 0 || d2.value && t2.value < 0) && T2.isVertical() && (e2 = { transitionDuration: `${m2.duration}ms`, transform: m2.distance ? `translate3d(0,${m2.distance}px, 0)` : "translate3d(0,0,0)" }), i2.value == "horizontal" && (h2.value && l2.value > 0 || p2.value && l2.value < 0) && T2.isHorizontal() && (e2 = { transitionDuration: `${m2.duration}ms`, transform: m2.distance ? `translate3d(${m2.distance}px, 0,0)` : "translate3d(0,0,0)" }), e2;
31
- }), y = a(() => {
32
- let e2 = {};
33
- if (i2.value == "vertical" && d2.value && T2.deltaY.value < 0 && T2.isVertical()) {
34
- e2 = { height: (Math.abs(m2.distance) < 50 ? -m2.distance : 50) + "px" };
35
- }
36
- if (i2.value == "horizontal" && p2.value && T2.deltaX.value < 0 && T2.isVertical()) {
37
- e2 = { width: (Math.abs(m2.distance) < 50 ? -m2.distance : 50) + "px" };
20
+ function useTouch() {
21
+ const startX = ref(0);
22
+ const startY = ref(0);
23
+ const deltaX = ref(0);
24
+ const deltaY = ref(0);
25
+ const offsetX = ref(0);
26
+ const offsetY = ref(0);
27
+ const direction = ref("");
28
+ const isVertical = () => direction.value === "vertical";
29
+ const isHorizontal = () => direction.value === "horizontal";
30
+ const reset = () => {
31
+ deltaX.value = 0;
32
+ deltaY.value = 0;
33
+ offsetX.value = 0;
34
+ offsetY.value = 0;
35
+ direction.value = "";
36
+ };
37
+ const start = (event) => {
38
+ reset();
39
+ startX.value = event.touches[0].clientX;
40
+ startY.value = event.touches[0].clientY;
41
+ };
42
+ const move = (event) => {
43
+ const touch = event.touches[0];
44
+ deltaX.value = touch.clientX - startX.value;
45
+ deltaY.value = touch.clientY - startY.value;
46
+ offsetX.value = Math.abs(deltaX.value);
47
+ offsetY.value = Math.abs(deltaY.value);
48
+ if (!direction.value) {
49
+ direction.value = getDirection(offsetX.value, offsetY.value);
38
50
  }
39
- return e2;
40
- }), z = a(() => {
41
- const { status: e2, distance: t2 } = m2, l2 = i2.value == "vertical" ? "top" : "left";
42
- return e2 == "loading" && (c2.value || h2.value) && t2 > 0 ? u2.loadingText[l2] : e2 == "pulling" && (c2.value || h2.value) && t2 > 0 ? u2.pullingText[l2] : e2 == "loosing" && (c2.value || h2.value) && t2 > 0 ? u2.loosingText[l2] : "";
43
- }), M = a(() => {
44
- const { status: e2, distance: t2 } = m2, l2 = i2.value == "vertical" ? "bottom" : "right";
45
- return e2 == "loading" && (d2.value || p2.value) && t2 < 0 ? u2.loadingText[l2] : e2 == "pulling" && (d2.value || p2.value) && t2 < 0 ? u2.pullingText[l2] : e2 == "loosing" && (d2.value || p2.value) && t2 < 0 ? u2.loosingText[l2] : "";
46
- }), w = () => m2.status !== "loading" && !v2.value, S = (e2, t2) => {
47
- m2.distance = e2, t2 ? m2.status = "loading" : e2 === 0 ? m2.status = "normal" : Math.abs(e2) < 50 ? m2.status = "pulling" : m2.status = "loosing";
48
51
  };
49
- o(() => {
50
- const e2 = (t2 = b2, n2.value != "" ? document.querySelector(`#${n2.value}`) : t2 && t2.parentNode);
51
- var t2;
52
- let l2 = document.documentElement || document.body;
53
- s2.value === false && (l2 = e2), g2 = l2;
54
- });
55
- const X = (e2) => {
56
- const t2 = 50;
57
- return e2 > t2 && (e2 = e2 < 100 ? t2 + (e2 - t2) / 2 : 75 + (e2 - 100) / 4), Math.round(e2);
58
- }, Y = () => {
59
- S(0);
52
+ return {
53
+ move,
54
+ start,
55
+ reset,
56
+ startX,
57
+ startY,
58
+ deltaX,
59
+ deltaY,
60
+ offsetX,
61
+ offsetY,
62
+ direction,
63
+ isVertical,
64
+ isHorizontal
60
65
  };
61
- return { scroller: b2, touchStart: (e2) => {
62
- if (w())
63
- if (i2.value == "vertical") {
64
- const t2 = "scrollTop" in g2 ? g2.scrollTop : 0;
65
- c2.value = Math.max(t2, 0) == 0;
66
- const { scrollHeight: l2, clientHeight: a2, scrollTop: o2 } = g2;
67
- d2.value = a2 + o2 == l2, (c2.value || d2.value) && (m2.duration = 0, T2.start(e2));
68
- } else {
69
- const { scrollWidth: t2, clientWidth: l2, scrollLeft: a2 } = g2, o2 = "scrollLeft" in g2 ? g2.scrollLeft : 0;
70
- h2.value = Math.max(o2, 0) == 0, p2.value = l2 + a2 == t2, (h2.value || p2.value) && (m2.duration = 0, T2.start(e2));
71
- }
72
- else
73
- f(e2);
74
- }, touchMove: (e2) => {
75
- if (w()) {
76
- const { deltaY: t2, deltaX: l2 } = T2;
77
- T2.move(e2), i2.value == "vertical" && (d2.value && t2.value < 0 || c2.value && t2.value >= 0) && T2.isVertical() && (f(e2), S(X(t2.value))), i2.value == "horizontal" && (h2.value && l2.value >= 0 || p2.value && l2.value < 0) && T2.isHorizontal() && (f(e2), S(X(l2.value)));
78
- } else
79
- f(e2);
80
- }, touchEnd: () => {
81
- if (w()) {
82
- const { deltaY: e2, deltaX: t2 } = T2;
83
- if (m2.status === "loosing") {
84
- let l2 = 0;
85
- i2.value == "vertical" && c2.value && e2.value > 0 && (l2 = 50, r2("downRefresh", Y)), i2.value == "vertical" && d2.value && e2.value < 0 && (l2 = -50, r2("refresh", Y)), i2.value == "horizontal" && h2.value && t2.value > 0 && (l2 = 50, r2("downRefresh", Y)), i2.value == "horizontal" && p2.value && t2.value < 0 && (l2 = -50, r2("refresh", Y)), S(l2, true);
86
- } else
87
- S(0);
66
+ }
67
+ function preventDefault(event, isStopPropagation) {
68
+ if (typeof event.cancelable !== "boolean" || event.cancelable) {
69
+ event.preventDefault();
70
+ }
71
+ if (isStopPropagation)
72
+ event.stopPropagation();
73
+ }
74
+ const { componentName, create } = createComponent("pullrefresh");
75
+ const _sfc_main = create({
76
+ props: {
77
+ useWindow: {
78
+ type: Boolean,
79
+ default: true
80
+ },
81
+ containerId: {
82
+ type: String,
83
+ default: ""
84
+ },
85
+ disabled: {
86
+ type: Boolean,
87
+ default: false
88
+ },
89
+ direction: {
90
+ type: String,
91
+ default: "vertical"
92
+ },
93
+ pullingText: {
94
+ type: Object,
95
+ default: {
96
+ top: "\u4E0B\u62C9\u5237\u65B0",
97
+ bottom: "\u4E0A\u62C9\u52A0\u8F7D",
98
+ left: "\u5DE6\u6ED1\u5237\u65B0",
99
+ right: "\u53F3\u6ED1\u52A0\u8F7D"
100
+ }
101
+ },
102
+ loosingText: {
103
+ type: Object,
104
+ default: {
105
+ top: "\u677E\u624B\u91CA\u653E\u5237\u65B0",
106
+ bottom: "\u677E\u624B\u91CA\u653E\u5237\u65B0",
107
+ left: "\u91CA\u653E\u5237\u65B0",
108
+ right: "\u52A0\u8F7D\u66F4\u591A"
109
+ }
110
+ },
111
+ loadingText: {
112
+ type: Object,
113
+ default: {
114
+ top: "\u52A0\u8F7D\u4E2D...",
115
+ bottom: "\u52A0\u8F7D\u4E2D...",
116
+ left: "\u52A0\u8F7D\u4E2D...",
117
+ right: "\u52A0\u8F7D\u4E2D..."
118
+ }
88
119
  }
89
- }, getStyle: x, reachBottom: d2, reachTop: c2, reachRight: p2, reachLeft: h2, getBottomStyle: y, refreshTopTem: z, refreshBottomTem: M, ...t(m2) };
90
- } }), b = { class: "pullrefresh-content", ref: "pull" };
91
- var T = h(g, [["render", function(e2, t2, l2, a2, o2, d2) {
92
- return u(), r("view", { class: "nut-pullrefresh", ref: "scroller", style: n(e2.getStyle), 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)) }, [s("view", { class: i(["pullrefresh-top", e2.direction == "horizontal" ? "pullrefresh-top-h" : "pullrefresh-top-v"]) }, v(e2.refreshTopTem), 3), s("view", b, [c(e2.$slots, "default")], 512), s("view", { class: i(["pullrefresh-bottom", e2.direction == "horizontal" ? "pullrefresh-bottom-h" : "pullrefresh-bottom-v"]), style: n(e2.getBottomStyle) }, v(e2.refreshBottomTem), 7)], 36);
93
- }]]);
94
- export { T as default };
120
+ },
121
+ emits: ["refresh", "downRefresh"],
122
+ setup(props, { emit }) {
123
+ const { containerId, useWindow, direction, disabled } = toRefs(props);
124
+ const reachTop = ref(false);
125
+ const reachBottom = ref(false);
126
+ const reachLeft = ref(false);
127
+ const reachRight = ref(false);
128
+ const state = reactive({
129
+ status: "normal",
130
+ distance: 0,
131
+ duration: 0
132
+ });
133
+ let scrollEl = document.documentElement || document.body;
134
+ const scroller = ref(null);
135
+ const touch = useTouch();
136
+ const getStyle = computed(() => {
137
+ let style = {};
138
+ const { deltaY, deltaX } = touch;
139
+ if (direction.value == "vertical" && (reachTop.value && deltaY.value > 0 || reachBottom.value && deltaY.value < 0) && touch.isVertical()) {
140
+ style = {
141
+ transitionDuration: `${state.duration}ms`,
142
+ transform: state.distance ? `translate3d(0,${state.distance}px, 0)` : `translate3d(0,0,0)`
143
+ };
144
+ }
145
+ if (direction.value == "horizontal" && (reachLeft.value && deltaX.value > 0 || reachRight.value && deltaX.value < 0) && touch.isHorizontal()) {
146
+ style = {
147
+ transitionDuration: `${state.duration}ms`,
148
+ transform: state.distance ? `translate3d(${state.distance}px, 0,0)` : `translate3d(0,0,0)`
149
+ };
150
+ }
151
+ return style;
152
+ });
153
+ const getBottomStyle = computed(() => {
154
+ let style = {};
155
+ if (direction.value == "vertical" && reachBottom.value && touch.deltaY.value < 0 && touch.isVertical()) {
156
+ const dis = Math.abs(state.distance) < 50 ? -state.distance : 50;
157
+ style = {
158
+ height: dis + "px"
159
+ };
160
+ }
161
+ if (direction.value == "horizontal" && reachRight.value && touch.deltaX.value < 0 && touch.isVertical()) {
162
+ const dis = Math.abs(state.distance) < 50 ? -state.distance : 50;
163
+ style = {
164
+ width: dis + "px"
165
+ };
166
+ }
167
+ return style;
168
+ });
169
+ const refreshTopTem = computed(() => {
170
+ const { status, distance } = state;
171
+ const tag = direction.value == "vertical" ? "top" : "left";
172
+ if (status == "loading" && (reachTop.value || reachLeft.value) && distance > 0) {
173
+ return props.loadingText[tag];
174
+ }
175
+ if (status == "pulling" && (reachTop.value || reachLeft.value) && distance > 0) {
176
+ return props.pullingText[tag];
177
+ }
178
+ if (status == "loosing" && (reachTop.value || reachLeft.value) && distance > 0) {
179
+ return props.loosingText[tag];
180
+ }
181
+ return "";
182
+ });
183
+ const refreshBottomTem = computed(() => {
184
+ const { status, distance } = state;
185
+ const tag = direction.value == "vertical" ? "bottom" : "right";
186
+ if (status == "loading" && (reachBottom.value || reachRight.value) && distance < 0) {
187
+ return props.loadingText[tag];
188
+ }
189
+ if (status == "pulling" && (reachBottom.value || reachRight.value) && distance < 0) {
190
+ return props.pullingText[tag];
191
+ }
192
+ if (status == "loosing" && (reachBottom.value || reachRight.value) && distance < 0) {
193
+ return props.loosingText[tag];
194
+ }
195
+ return "";
196
+ });
197
+ const isTouchable = () => state.status !== "loading" && !disabled.value;
198
+ const setStatus = (distance, isLoading) => {
199
+ state.distance = distance;
200
+ if (isLoading) {
201
+ state.status = "loading";
202
+ } else if (distance === 0) {
203
+ state.status = "normal";
204
+ } else if (Math.abs(distance) < 50) {
205
+ state.status = "pulling";
206
+ } else {
207
+ state.status = "loosing";
208
+ }
209
+ };
210
+ const getParentElement = (el) => {
211
+ if (containerId.value != "") {
212
+ return document.querySelector(`#${containerId.value}`);
213
+ }
214
+ return el && el.parentNode;
215
+ };
216
+ onMounted(() => {
217
+ const parentElement = getParentElement(scroller);
218
+ let scrollElCopy = document.documentElement || document.body;
219
+ if (useWindow.value === false) {
220
+ scrollElCopy = parentElement;
221
+ }
222
+ scrollEl = scrollElCopy;
223
+ });
224
+ const ease = (distance) => {
225
+ const headHeight = 50;
226
+ if (distance > headHeight) {
227
+ if (distance < headHeight * 2) {
228
+ distance = headHeight + (distance - headHeight) / 2;
229
+ } else {
230
+ distance = headHeight * 1.5 + (distance - headHeight * 2) / 4;
231
+ }
232
+ }
233
+ return Math.round(distance);
234
+ };
235
+ const refreshDone = () => {
236
+ setStatus(0);
237
+ };
238
+ const touchStart = (event) => {
239
+ if (isTouchable()) {
240
+ if (direction.value == "vertical") {
241
+ const top = "scrollTop" in scrollEl ? scrollEl.scrollTop : 0;
242
+ reachTop.value = Math.max(top, 0) == 0 ? true : false;
243
+ const { scrollHeight, clientHeight, scrollTop } = scrollEl;
244
+ reachBottom.value = clientHeight + scrollTop == scrollHeight ? true : false;
245
+ if (reachTop.value || reachBottom.value) {
246
+ state.duration = 0;
247
+ touch.start(event);
248
+ }
249
+ } else {
250
+ const { scrollWidth, clientWidth, scrollLeft } = scrollEl;
251
+ const left = "scrollLeft" in scrollEl ? scrollEl.scrollLeft : 0;
252
+ reachLeft.value = Math.max(left, 0) == 0 ? true : false;
253
+ reachRight.value = clientWidth + scrollLeft == scrollWidth ? true : false;
254
+ if (reachLeft.value || reachRight.value) {
255
+ state.duration = 0;
256
+ touch.start(event);
257
+ }
258
+ }
259
+ } else {
260
+ preventDefault(event);
261
+ }
262
+ };
263
+ const touchMove = (event) => {
264
+ if (isTouchable()) {
265
+ const { deltaY, deltaX } = touch;
266
+ touch.move(event);
267
+ if (direction.value == "vertical" && (reachBottom.value && deltaY.value < 0 || reachTop.value && deltaY.value >= 0) && touch.isVertical()) {
268
+ preventDefault(event);
269
+ setStatus(ease(deltaY.value));
270
+ }
271
+ if (direction.value == "horizontal" && (reachLeft.value && deltaX.value >= 0 || reachRight.value && deltaX.value < 0) && touch.isHorizontal()) {
272
+ preventDefault(event);
273
+ setStatus(ease(deltaX.value));
274
+ }
275
+ } else {
276
+ preventDefault(event);
277
+ }
278
+ };
279
+ const touchEnd = () => {
280
+ if (isTouchable()) {
281
+ const { deltaY, deltaX } = touch;
282
+ if (state.status === "loosing") {
283
+ let dis = 0;
284
+ if (direction.value == "vertical" && reachTop.value && deltaY.value > 0) {
285
+ dis = 50;
286
+ emit("downRefresh", refreshDone);
287
+ }
288
+ if (direction.value == "vertical" && reachBottom.value && deltaY.value < 0) {
289
+ dis = -50;
290
+ emit("refresh", refreshDone);
291
+ }
292
+ if (direction.value == "horizontal" && reachLeft.value && deltaX.value > 0) {
293
+ dis = 50;
294
+ emit("downRefresh", refreshDone);
295
+ }
296
+ if (direction.value == "horizontal" && reachRight.value && deltaX.value < 0) {
297
+ dis = -50;
298
+ emit("refresh", refreshDone);
299
+ }
300
+ setStatus(dis, true);
301
+ } else {
302
+ setStatus(0);
303
+ }
304
+ }
305
+ };
306
+ return {
307
+ scroller,
308
+ touchStart,
309
+ touchMove,
310
+ touchEnd,
311
+ getStyle,
312
+ reachBottom,
313
+ reachTop,
314
+ reachRight,
315
+ reachLeft,
316
+ getBottomStyle,
317
+ refreshTopTem,
318
+ refreshBottomTem,
319
+ ...toRefs(state)
320
+ };
321
+ }
322
+ });
323
+ const _hoisted_1 = {
324
+ class: "pullrefresh-content",
325
+ ref: "pull"
326
+ };
327
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
328
+ return openBlock(), createElementBlock("view", {
329
+ class: "nut-pullrefresh",
330
+ ref: "scroller",
331
+ style: normalizeStyle(_ctx.getStyle),
332
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
333
+ onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.touchMove && _ctx.touchMove(...args)),
334
+ onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
335
+ }, [
336
+ createElementVNode("view", {
337
+ class: normalizeClass(["pullrefresh-top", _ctx.direction == "horizontal" ? "pullrefresh-top-h" : "pullrefresh-top-v"])
338
+ }, toDisplayString(_ctx.refreshTopTem), 3),
339
+ createElementVNode("view", _hoisted_1, [
340
+ renderSlot(_ctx.$slots, "default")
341
+ ], 512),
342
+ createElementVNode("view", {
343
+ class: normalizeClass(["pullrefresh-bottom", _ctx.direction == "horizontal" ? "pullrefresh-bottom-h" : "pullrefresh-bottom-v"]),
344
+ style: normalizeStyle(_ctx.getBottomStyle)
345
+ }, toDisplayString(_ctx.refreshBottomTem), 7)
346
+ ], 36);
347
+ }
348
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
349
+ export { index as default };
@@ -1,28 +1,96 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.2 Thu Jul 07 2022 19:06:52 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { inject as e, computed as a, h as t } from "vue";
7
- import { c as l } from "./component.js";
8
- import i from "./Icon.js";
6
+ import { inject, computed, h } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import _sfc_main$1 from "./Icon.js";
9
9
  import "../locale/lang";
10
10
  import "./pxCheck.js";
11
- const { componentName: n, create: o } = l("radio"), s = o({ props: { disabled: { type: Boolean, default: false }, shape: { type: String, default: "round" }, label: { type: [String, Number], default: "" }, iconName: { type: String, default: "check-normal" }, iconActiveName: { type: String, default: "check-checked" }, iconSize: { type: [String, Number], default: "" }, iconClassPrefix: { type: String, default: "nut-icon" }, iconFontClassName: { type: String, default: "nutui-iconfont" } }, setup(l2, { emit: o2, slots: s2 }) {
12
- let c = e("parent", null);
13
- const u = a(() => c.label.value == l2.label), r = a(() => l2.disabled ? "nut-radio__icon--disable" : u.value ? "nut-radio__icon" : "nut-radio__icon--unchecked"), d = a(() => c.position), p = () => {
14
- const { iconName: e2, iconSize: a2, iconActiveName: n2, iconClassPrefix: o3, iconFontClassName: s3 } = l2;
15
- return t(i, { name: u.value ? n2 : e2, size: a2, class: r.value, classPrefix: o3, fontClassName: s3 });
16
- }, m = () => {
17
- var _a;
18
- return t("view", { class: `${n}__label ${l2.disabled ? `${n}__label--disabled` : ""}` }, (_a = s2.default) == null ? void 0 : _a.call(s2));
19
- }, b = () => {
20
- u.value || l2.disabled || c.updateValue(l2.label);
21
- };
22
- let f = d.value === "left";
23
- return () => {
24
- var _a;
25
- return t("view", { class: `${n} ${n}--${l2.shape} ${f ? `${n}--reverse` : ""}`, onClick: b }, [l2.shape == "button" ? t("view", { class: `${n}__button ${u.value && `${n}__button--active`} ${l2.disabled ? `${n}__button--disabled` : ""}` }, (_a = s2.default) == null ? void 0 : _a.call(s2)) : f ? [m(), p()] : [p(), m()]]);
26
- };
27
- } });
28
- export { s as default };
11
+ const { componentName, create } = createComponent("radio");
12
+ const _sfc_main = create({
13
+ props: {
14
+ disabled: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ shape: {
19
+ type: String,
20
+ default: "round"
21
+ },
22
+ label: {
23
+ type: [String, Number],
24
+ default: ""
25
+ },
26
+ iconName: {
27
+ type: String,
28
+ default: "check-normal"
29
+ },
30
+ iconActiveName: {
31
+ type: String,
32
+ default: "check-checked"
33
+ },
34
+ iconSize: {
35
+ type: [String, Number],
36
+ default: ""
37
+ },
38
+ iconClassPrefix: {
39
+ type: String,
40
+ default: "nut-icon"
41
+ },
42
+ iconFontClassName: {
43
+ type: String,
44
+ default: "nutui-iconfont"
45
+ }
46
+ },
47
+ setup(props, { emit, slots }) {
48
+ let parent = inject("parent", null);
49
+ const isCurValue = computed(() => {
50
+ return parent.label.value == props.label;
51
+ });
52
+ const color = computed(() => {
53
+ return !props.disabled ? isCurValue.value ? "nut-radio__icon" : "nut-radio__icon--unchecked" : "nut-radio__icon--disable";
54
+ });
55
+ const position = computed(() => {
56
+ return parent.position;
57
+ });
58
+ const renderIcon = () => {
59
+ const { iconName, iconSize, iconActiveName, iconClassPrefix, iconFontClassName } = props;
60
+ return h(_sfc_main$1, {
61
+ name: isCurValue.value ? iconActiveName : iconName,
62
+ size: iconSize,
63
+ class: color.value,
64
+ classPrefix: iconClassPrefix,
65
+ fontClassName: iconFontClassName
66
+ });
67
+ };
68
+ const renderLabel = () => {
69
+ var _a;
70
+ return h("view", {
71
+ class: `${componentName}__label ${props.disabled ? `${componentName}__label--disabled` : ""}`
72
+ }, (_a = slots.default) == null ? void 0 : _a.call(slots));
73
+ };
74
+ const renderButton = () => {
75
+ var _a;
76
+ return h("view", {
77
+ class: `${componentName}__button ${isCurValue.value && `${componentName}__button--active`} ${props.disabled ? `${componentName}__button--disabled` : ""}`
78
+ }, (_a = slots.default) == null ? void 0 : _a.call(slots));
79
+ };
80
+ const handleClick = () => {
81
+ if (isCurValue.value || props.disabled)
82
+ return;
83
+ parent.updateValue(props.label);
84
+ };
85
+ let reverseState = position.value === "left";
86
+ return () => {
87
+ return h("view", {
88
+ class: `${componentName} ${componentName}--${props.shape} ${reverseState ? `${componentName}--reverse` : ""}`,
89
+ onClick: handleClick
90
+ }, [
91
+ props.shape == "button" ? renderButton() : reverseState ? [renderLabel(), renderIcon()] : [renderIcon(), renderLabel()]
92
+ ]);
93
+ };
94
+ }
95
+ });
96
+ export { _sfc_main as default };
@@ -1,13 +1,42 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.2 Thu Jul 07 2022 19:06:52 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { provide as e, readonly as t, computed as o, watch as a, h as l } from "vue";
7
- import { c as i } from "./component.js";
6
+ import { provide, readonly, computed, watch, h } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
8
  import "../locale/lang";
9
- const { componentName: r, create: n } = i("radiogroup"), p = n({ props: { modelValue: { type: [Number, String, Boolean], default: "" }, direction: { type: String, default: "vertical" }, textPosition: { type: String, default: "right" } }, emits: ["change", "update:modelValue"], setup: (i2, { emit: n2, slots: p2 }) => (e("parent", { label: t(o(() => i2.modelValue)), position: i2.textPosition, updateValue: (e2) => n2("update:modelValue", e2) }), a(() => i2.modelValue, (e2) => n2("change", e2)), () => {
10
- var _a;
11
- return l("view", { class: `${r} ${r}--${i2.direction}` }, (_a = p2.default) == null ? void 0 : _a.call(p2));
12
- }) });
13
- export { p as default };
9
+ const { componentName, create } = createComponent("radiogroup");
10
+ const _sfc_main = create({
11
+ props: {
12
+ modelValue: {
13
+ type: [Number, String, Boolean],
14
+ default: ""
15
+ },
16
+ direction: {
17
+ type: String,
18
+ default: "vertical"
19
+ },
20
+ textPosition: {
21
+ type: String,
22
+ default: "right"
23
+ }
24
+ },
25
+ emits: ["change", "update:modelValue"],
26
+ setup(props, { emit, slots }) {
27
+ const updateValue = (value) => emit("update:modelValue", value);
28
+ provide("parent", {
29
+ label: readonly(computed(() => props.modelValue)),
30
+ position: props.textPosition,
31
+ updateValue
32
+ });
33
+ watch(() => props.modelValue, (value) => emit("change", value));
34
+ return () => {
35
+ var _a;
36
+ return h("view", {
37
+ class: `${componentName} ${componentName}--${props.direction}`
38
+ }, (_a = slots.default) == null ? void 0 : _a.call(slots));
39
+ };
40
+ }
41
+ });
42
+ export { _sfc_main as default };