@nutui/nutui-react 3.0.17 → 3.0.19-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 (241) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/hooks/taro/use-custom-event.js +5 -5
  3. package/dist/cjs/hooks/use-ref-state.js +3 -3
  4. package/dist/cjs/hooks/use-touch.js +1 -2
  5. package/dist/cjs/locales/ja-JP.d.ts +3 -0
  6. package/dist/cjs/locales/ja-JP.js +168 -0
  7. package/dist/cjs/packages/address/address.js +3 -3
  8. package/dist/cjs/packages/address/utils.js +3 -3
  9. package/dist/cjs/packages/avatarcropper/avatarcropper.js +4 -7
  10. package/dist/cjs/packages/badge/style/badge.scss +1 -1
  11. package/dist/cjs/packages/badge/style/style.css +1 -1
  12. package/dist/cjs/packages/badge/style-jmapp/badge.scss +1 -1
  13. package/dist/cjs/packages/badge/style-jmapp/style.css +1 -1
  14. package/dist/cjs/packages/badge/style-jrkf/badge.scss +1 -1
  15. package/dist/cjs/packages/badge/style-jrkf/style.css +1 -1
  16. package/dist/cjs/packages/calendar/utils.js +8 -8
  17. package/dist/cjs/packages/calendarcard/icon.js +5 -5
  18. package/dist/cjs/packages/calendarcard/utils.js +6 -6
  19. package/dist/cjs/packages/cascader/cascader.js +12 -21
  20. package/dist/cjs/packages/cascader/utils.js +3 -3
  21. package/dist/cjs/packages/col/col.js +16 -11
  22. package/dist/cjs/packages/collapseitem/collapseitem.js +4 -7
  23. package/dist/cjs/packages/configprovider/configprovider.js +7 -7
  24. package/dist/cjs/packages/configprovider/index.js +6 -6
  25. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  26. package/dist/cjs/packages/countdown/countdown.js +1 -2
  27. package/dist/cjs/packages/countdown/style/countdown.scss +1 -1
  28. package/dist/cjs/packages/countdown/style/style.css +1 -1
  29. package/dist/cjs/packages/countdown/style-jmapp/countdown.scss +1 -1
  30. package/dist/cjs/packages/countdown/style-jmapp/style.css +1 -1
  31. package/dist/cjs/packages/countdown/style-jrkf/countdown.scss +1 -1
  32. package/dist/cjs/packages/countdown/style-jrkf/style.css +1 -1
  33. package/dist/cjs/packages/datepicker/datepicker.js +1 -1
  34. package/dist/cjs/packages/datepicker/utils.js +9 -9
  35. package/dist/cjs/packages/dialog/content.js +3 -3
  36. package/dist/cjs/packages/dialog/dialog.js +4 -7
  37. package/dist/cjs/packages/dialog/style/dialog.scss +9 -1
  38. package/dist/cjs/packages/dialog/style/style.css +8 -1
  39. package/dist/cjs/packages/dialog/style-jmapp/dialog.scss +9 -1
  40. package/dist/cjs/packages/dialog/style-jmapp/style.css +8 -1
  41. package/dist/cjs/packages/dialog/style-jrkf/dialog.scss +9 -1
  42. package/dist/cjs/packages/dialog/style-jrkf/style.css +8 -1
  43. package/dist/cjs/packages/elevator/elevator.js +3 -3
  44. package/dist/cjs/packages/form/index.js +0 -2
  45. package/dist/cjs/packages/form/useform.js +50 -57
  46. package/dist/cjs/packages/infiniteloading/infiniteloading.js +8 -14
  47. package/dist/cjs/packages/inputnumber/inputnumber.js +16 -28
  48. package/dist/cjs/packages/lottie/animation/dark/global.gif +0 -0
  49. package/dist/cjs/packages/lottie/animation/dark/global.json +0 -0
  50. package/dist/cjs/packages/lottie/animation/dark/loading.gif +0 -0
  51. package/dist/cjs/packages/lottie/animation/dark/loading.json +0 -0
  52. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh-white.gif +0 -0
  53. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh-white.json +0 -0
  54. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh.gif +0 -0
  55. package/dist/cjs/packages/lottie/animation/dark/pulltorefresh.json +0 -0
  56. package/dist/cjs/packages/lottie/animation/light/global.gif +0 -0
  57. package/dist/cjs/packages/lottie/animation/light/global.json +0 -0
  58. package/dist/cjs/packages/lottie/animation/light/loading.gif +0 -0
  59. package/dist/cjs/packages/lottie/animation/light/loading.json +0 -0
  60. package/dist/cjs/packages/lottie/animation/light/pulltorefresh.gif +0 -0
  61. package/dist/cjs/packages/lottie/animation/light/pulltorefresh.json +0 -0
  62. package/dist/cjs/packages/lottie/types.js +0 -2
  63. package/dist/cjs/packages/noticebar/style/noticebar.scss +6 -0
  64. package/dist/cjs/packages/noticebar/style/style.css +6 -0
  65. package/dist/cjs/packages/noticebar/style-jmapp/noticebar.scss +6 -0
  66. package/dist/cjs/packages/noticebar/style-jmapp/style.css +6 -0
  67. package/dist/cjs/packages/noticebar/style-jrkf/noticebar.scss +6 -0
  68. package/dist/cjs/packages/noticebar/style-jrkf/style.css +6 -0
  69. package/dist/cjs/packages/notify/notify.d.ts +1 -1
  70. package/dist/cjs/packages/notify/notify.js +5 -2
  71. package/dist/cjs/packages/nutui.react.build.js +105 -105
  72. package/dist/cjs/packages/nutui.react.js +105 -105
  73. package/dist/cjs/packages/overlay/overlay.js +3 -3
  74. package/dist/cjs/packages/pickerview/pickerview.js +1 -2
  75. package/dist/cjs/packages/pickerview/utils.js +3 -3
  76. package/dist/cjs/packages/popup/popup.d.ts +1 -1
  77. package/dist/cjs/packages/popup/popup.js +59 -4
  78. package/dist/cjs/packages/popup/style/popup.scss +0 -5
  79. package/dist/cjs/packages/popup/style/style.css +0 -3
  80. package/dist/cjs/packages/popup/style-jmapp/popup.scss +0 -5
  81. package/dist/cjs/packages/popup/style-jmapp/style.css +0 -3
  82. package/dist/cjs/packages/popup/style-jrkf/popup.scss +0 -5
  83. package/dist/cjs/packages/popup/style-jrkf/style.css +0 -3
  84. package/dist/cjs/packages/price/price.js +42 -14
  85. package/dist/cjs/packages/price/style/price.scss +3 -3
  86. package/dist/cjs/packages/price/style/style.css +3 -3
  87. package/dist/cjs/packages/price/style-jmapp/price.scss +3 -3
  88. package/dist/cjs/packages/price/style-jmapp/style.css +3 -3
  89. package/dist/cjs/packages/price/style-jrkf/price.scss +3 -3
  90. package/dist/cjs/packages/price/style-jrkf/style.css +3 -3
  91. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +41 -51
  92. package/dist/cjs/packages/radio/index.js +0 -2
  93. package/dist/cjs/packages/range/utils.js +3 -3
  94. package/dist/cjs/packages/rate/style/rate.scss +1 -1
  95. package/dist/cjs/packages/rate/style/style.css +1 -1
  96. package/dist/cjs/packages/rate/style-jmapp/rate.scss +1 -1
  97. package/dist/cjs/packages/rate/style-jmapp/style.css +1 -1
  98. package/dist/cjs/packages/rate/style-jrkf/rate.scss +1 -1
  99. package/dist/cjs/packages/rate/style-jrkf/style.css +1 -1
  100. package/dist/cjs/packages/searchbar/searchbar.js +3 -3
  101. package/dist/cjs/packages/shortpassword/shortpassword.js +3 -3
  102. package/dist/cjs/packages/skeleton/skeleton.js +2 -4
  103. package/dist/cjs/packages/swiper/effects/focus.js +4 -4
  104. package/dist/cjs/packages/swiper/index.js +0 -1
  105. package/dist/cjs/packages/switch/switch.js +4 -7
  106. package/dist/cjs/packages/uploader/uploader.js +31 -39
  107. package/dist/cjs/packages/virtuallist/utils.js +6 -6
  108. package/dist/cjs/packages/watermark/watermark.js +4 -8
  109. package/dist/cjs/types/spec/address/base.js +0 -2
  110. package/dist/cjs/types/spec/avatar/taro.d.ts +7 -1
  111. package/dist/cjs/types/spec/popup/base.d.ts +5 -0
  112. package/dist/cjs/types/spec/price/base.d.ts +8 -2
  113. package/dist/cjs/types/spec/price/base.js +12 -0
  114. package/dist/cjs/types/spec/searchbar/h5.d.ts +2 -1
  115. package/dist/cjs/types/spec/searchbar/taro.d.ts +1 -0
  116. package/dist/cjs/utils/date.js +5 -5
  117. package/dist/cjs/utils/event-mocker.js +10 -18
  118. package/dist/cjs/utils/get-rect.js +4 -4
  119. package/dist/cjs/utils/get-scroll-parent.js +3 -3
  120. package/dist/cjs/utils/merge-props.js +3 -3
  121. package/dist/cjs/utils/merge.js +6 -6
  122. package/dist/cjs/utils/raf.js +3 -3
  123. package/dist/cjs/utils/render.js +5 -9
  124. package/dist/cjs/utils/rubberband.js +3 -3
  125. package/dist/cjs/utils/taro/get-rect.d.ts +1 -0
  126. package/dist/cjs/utils/taro/get-rect.js +39 -13
  127. package/dist/cjs/utils/taro/get-system-info.js +4 -4
  128. package/dist/cjs/utils/taro/platform.js +5 -5
  129. package/dist/es/hooks/use-touch.js +1 -1
  130. package/dist/es/locales/ja-JP.d.ts +3 -0
  131. package/dist/es/locales/ja-JP.js +158 -0
  132. package/dist/es/packages/avatarcropper/avatarcropper.js +4 -7
  133. package/dist/es/packages/badge/style/badge.scss +1 -1
  134. package/dist/es/packages/badge/style/style.css +1 -1
  135. package/dist/es/packages/badge/style-jmapp/badge.scss +1 -1
  136. package/dist/es/packages/badge/style-jmapp/style.css +1 -1
  137. package/dist/es/packages/badge/style-jrkf/badge.scss +1 -1
  138. package/dist/es/packages/badge/style-jrkf/style.css +1 -1
  139. package/dist/es/packages/cascader/cascader.js +12 -21
  140. package/dist/es/packages/col/col.js +17 -12
  141. package/dist/es/packages/collapseitem/collapseitem.js +4 -7
  142. package/dist/es/packages/configprovider/types.d.ts +1 -1
  143. package/dist/es/packages/countdown/countdown.js +1 -2
  144. package/dist/es/packages/countdown/style/countdown.scss +1 -1
  145. package/dist/es/packages/countdown/style/style.css +1 -1
  146. package/dist/es/packages/countdown/style-jmapp/countdown.scss +1 -1
  147. package/dist/es/packages/countdown/style-jmapp/style.css +1 -1
  148. package/dist/es/packages/countdown/style-jrkf/countdown.scss +1 -1
  149. package/dist/es/packages/countdown/style-jrkf/style.css +1 -1
  150. package/dist/es/packages/datepicker/datepicker.js +1 -1
  151. package/dist/es/packages/dialog/dialog.js +4 -7
  152. package/dist/es/packages/dialog/style/dialog.scss +9 -1
  153. package/dist/es/packages/dialog/style/style.css +8 -1
  154. package/dist/es/packages/dialog/style-jmapp/dialog.scss +9 -1
  155. package/dist/es/packages/dialog/style-jmapp/style.css +8 -1
  156. package/dist/es/packages/dialog/style-jrkf/dialog.scss +9 -1
  157. package/dist/es/packages/dialog/style-jrkf/style.css +8 -1
  158. package/dist/es/packages/form/index.js +0 -1
  159. package/dist/es/packages/form/useform.js +46 -53
  160. package/dist/es/packages/infiniteloading/infiniteloading.js +8 -14
  161. package/dist/es/packages/inputnumber/inputnumber.js +16 -28
  162. package/dist/es/packages/lottie/animation/dark/global.gif +0 -0
  163. package/dist/es/packages/lottie/animation/dark/global.json +0 -0
  164. package/dist/es/packages/lottie/animation/dark/loading.gif +0 -0
  165. package/dist/es/packages/lottie/animation/dark/loading.json +0 -0
  166. package/dist/es/packages/lottie/animation/dark/pulltorefresh-white.gif +0 -0
  167. package/dist/es/packages/lottie/animation/dark/pulltorefresh-white.json +0 -0
  168. package/dist/es/packages/lottie/animation/dark/pulltorefresh.gif +0 -0
  169. package/dist/es/packages/lottie/animation/dark/pulltorefresh.json +0 -0
  170. package/dist/es/packages/lottie/animation/light/global.gif +0 -0
  171. package/dist/es/packages/lottie/animation/light/global.json +0 -0
  172. package/dist/es/packages/lottie/animation/light/loading.gif +0 -0
  173. package/dist/es/packages/lottie/animation/light/loading.json +0 -0
  174. package/dist/es/packages/lottie/animation/light/pulltorefresh.gif +0 -0
  175. package/dist/es/packages/lottie/animation/light/pulltorefresh.json +0 -0
  176. package/dist/es/packages/lottie/types.js +1 -1
  177. package/dist/es/packages/noticebar/style/noticebar.scss +6 -0
  178. package/dist/es/packages/noticebar/style/style.css +6 -0
  179. package/dist/es/packages/noticebar/style-jmapp/noticebar.scss +6 -0
  180. package/dist/es/packages/noticebar/style-jmapp/style.css +6 -0
  181. package/dist/es/packages/noticebar/style-jrkf/noticebar.scss +6 -0
  182. package/dist/es/packages/noticebar/style-jrkf/style.css +6 -0
  183. package/dist/es/packages/notify/notify.d.ts +1 -1
  184. package/dist/es/packages/notify/notify.js +5 -2
  185. package/dist/es/packages/pickerview/pickerview.js +1 -2
  186. package/dist/es/packages/popup/popup.d.ts +1 -1
  187. package/dist/es/packages/popup/popup.js +60 -5
  188. package/dist/es/packages/popup/style/popup.scss +0 -5
  189. package/dist/es/packages/popup/style/style.css +0 -3
  190. package/dist/es/packages/popup/style-jmapp/popup.scss +0 -5
  191. package/dist/es/packages/popup/style-jmapp/style.css +0 -3
  192. package/dist/es/packages/popup/style-jrkf/popup.scss +0 -5
  193. package/dist/es/packages/popup/style-jrkf/style.css +0 -3
  194. package/dist/es/packages/price/price.js +41 -14
  195. package/dist/es/packages/price/style/price.scss +3 -3
  196. package/dist/es/packages/price/style/style.css +3 -3
  197. package/dist/es/packages/price/style-jmapp/price.scss +3 -3
  198. package/dist/es/packages/price/style-jmapp/style.css +3 -3
  199. package/dist/es/packages/price/style-jrkf/price.scss +3 -3
  200. package/dist/es/packages/price/style-jrkf/style.css +3 -3
  201. package/dist/es/packages/pulltorefresh/pulltorefresh.js +41 -51
  202. package/dist/es/packages/radio/index.js +0 -1
  203. package/dist/es/packages/rate/style/rate.scss +1 -1
  204. package/dist/es/packages/rate/style/style.css +1 -1
  205. package/dist/es/packages/rate/style-jmapp/rate.scss +1 -1
  206. package/dist/es/packages/rate/style-jmapp/style.css +1 -1
  207. package/dist/es/packages/rate/style-jrkf/rate.scss +1 -1
  208. package/dist/es/packages/rate/style-jrkf/style.css +1 -1
  209. package/dist/es/packages/searchbar/searchbar.js +3 -3
  210. package/dist/es/packages/skeleton/skeleton.js +2 -4
  211. package/dist/es/packages/swiper/index.js +0 -1
  212. package/dist/es/packages/switch/switch.js +4 -7
  213. package/dist/es/packages/uploader/uploader.js +31 -39
  214. package/dist/es/packages/watermark/watermark.js +4 -8
  215. package/dist/es/types/spec/address/base.js +1 -1
  216. package/dist/es/types/spec/avatar/taro.d.ts +7 -1
  217. package/dist/es/types/spec/popup/base.d.ts +20 -0
  218. package/dist/es/types/spec/price/base.d.ts +10 -4
  219. package/dist/es/types/spec/price/base.js +6 -1
  220. package/dist/es/types/spec/searchbar/h5.d.ts +2 -1
  221. package/dist/es/types/spec/searchbar/taro.d.ts +1 -0
  222. package/dist/es/utils/event-mocker.js +4 -12
  223. package/dist/es/utils/render.js +2 -6
  224. package/dist/es/utils/taro/get-rect.d.ts +1 -0
  225. package/dist/es/utils/taro/get-rect.js +34 -10
  226. package/dist/nutui.react.umd.js +1521 -1500
  227. package/dist/style-jmapp.css +1 -1
  228. package/dist/style-jmapp.scss +46 -46
  229. package/dist/style-jrkf.css +1 -1
  230. package/dist/style-jrkf.scss +31 -31
  231. package/dist/style.css +1 -1
  232. package/dist/style.scss +38 -38
  233. package/dist/styles/jd-font.scss +4 -4
  234. package/dist/styles/theme-dark.scss +90 -56
  235. package/dist/styles/theme-default.scss +94 -60
  236. package/dist/styles/themes/dark.css +1 -1
  237. package/dist/styles/themes/default.css +1 -1
  238. package/dist/styles/variables-jmapp.scss +4 -0
  239. package/dist/styles/variables-jrkf.scss +4 -0
  240. package/dist/styles/variables.scss +4 -0
  241. package/package.json +1 -72
@@ -51,6 +51,9 @@
51
51
  min-width: $noticebar-left-icon-width;
52
52
  margin-right: $noticebar-icon-gap;
53
53
  background-size: 100% 100%;
54
+ .nut-icon {
55
+ color: $noticebar-color;
56
+ }
54
57
  }
55
58
 
56
59
  &-right-icon {
@@ -63,12 +66,14 @@
63
66
  .nut-icon {
64
67
  width: 12px;
65
68
  height: 12px;
69
+ color: $noticebar-color;
66
70
  }
67
71
  }
68
72
 
69
73
  &-wrap {
70
74
  display: flex;
71
75
  flex: 1;
76
+ align-items: center;
72
77
  height: $noticebar-line-height;
73
78
  line-height: $noticebar-line-height;
74
79
  overflow: hidden;
@@ -77,6 +82,7 @@
77
82
  .nut-noticebar-box-wrap-content {
78
83
  position: absolute;
79
84
  white-space: nowrap;
85
+ color: $noticebar-color;
80
86
 
81
87
  &.nut-ellipsis {
82
88
  max-width: 100%;
@@ -45,6 +45,9 @@
45
45
  margin-right: var(--nutui-noticebar-icon-gap, 4px);
46
46
  background-size: 100% 100%;
47
47
  }
48
+ .nut-noticebar .nut-noticebar-box-left-icon .nut-icon {
49
+ color: var(--nutui-noticebar-color, #d9500b);
50
+ }
48
51
  .nut-noticebar .nut-noticebar-box-right-icon {
49
52
  display: flex;
50
53
  align-items: center;
@@ -55,10 +58,12 @@
55
58
  .nut-noticebar .nut-noticebar-box-right-icon .nut-icon {
56
59
  width: 12px;
57
60
  height: 12px;
61
+ color: var(--nutui-noticebar-color, #d9500b);
58
62
  }
59
63
  .nut-noticebar .nut-noticebar-box-wrap {
60
64
  display: flex;
61
65
  flex: 1;
66
+ align-items: center;
62
67
  height: var(--nutui-noticebar-line-height, 24px);
63
68
  line-height: var(--nutui-noticebar-line-height, 24px);
64
69
  overflow: hidden;
@@ -67,6 +72,7 @@
67
72
  .nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content {
68
73
  position: absolute;
69
74
  white-space: nowrap;
75
+ color: var(--nutui-noticebar-color, #d9500b);
70
76
  }
71
77
  .nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content.nut-ellipsis {
72
78
  max-width: 100%;
@@ -51,6 +51,9 @@
51
51
  min-width: $noticebar-left-icon-width;
52
52
  margin-right: $noticebar-icon-gap;
53
53
  background-size: 100% 100%;
54
+ .nut-icon {
55
+ color: $noticebar-color;
56
+ }
54
57
  }
55
58
 
56
59
  &-right-icon {
@@ -63,12 +66,14 @@
63
66
  .nut-icon {
64
67
  width: 12px;
65
68
  height: 12px;
69
+ color: $noticebar-color;
66
70
  }
67
71
  }
68
72
 
69
73
  &-wrap {
70
74
  display: flex;
71
75
  flex: 1;
76
+ align-items: center;
72
77
  height: $noticebar-line-height;
73
78
  line-height: $noticebar-line-height;
74
79
  overflow: hidden;
@@ -77,6 +82,7 @@
77
82
  .nut-noticebar-box-wrap-content {
78
83
  position: absolute;
79
84
  white-space: nowrap;
85
+ color: $noticebar-color;
80
86
 
81
87
  &.nut-ellipsis {
82
88
  max-width: 100%;
@@ -45,6 +45,9 @@
45
45
  margin-right: var(--nutui-noticebar-icon-gap, 4px);
46
46
  background-size: 100% 100%;
47
47
  }
48
+ .nut-noticebar .nut-noticebar-box-left-icon .nut-icon {
49
+ color: var(--nutui-noticebar-color, #d9500b);
50
+ }
48
51
  .nut-noticebar .nut-noticebar-box-right-icon {
49
52
  display: flex;
50
53
  align-items: center;
@@ -55,10 +58,12 @@
55
58
  .nut-noticebar .nut-noticebar-box-right-icon .nut-icon {
56
59
  width: 12px;
57
60
  height: 12px;
61
+ color: var(--nutui-noticebar-color, #d9500b);
58
62
  }
59
63
  .nut-noticebar .nut-noticebar-box-wrap {
60
64
  display: flex;
61
65
  flex: 1;
66
+ align-items: center;
62
67
  height: var(--nutui-noticebar-line-height, 24px);
63
68
  line-height: var(--nutui-noticebar-line-height, 24px);
64
69
  overflow: hidden;
@@ -67,6 +72,7 @@
67
72
  .nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content {
68
73
  position: absolute;
69
74
  white-space: nowrap;
75
+ color: var(--nutui-noticebar-color, #d9500b);
70
76
  }
71
77
  .nut-noticebar .nut-noticebar-box-wrap .nut-noticebar-box-wrap-content.nut-ellipsis {
72
78
  max-width: 100%;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  declare const _default: {
3
- text(message: string | React.ReactNode, option?: {}): void;
3
+ text(message: string | React.ReactNode, option?: {}): Promise<void>;
4
4
  hide(): void;
5
5
  };
6
6
  export default _default;
@@ -27,8 +27,11 @@ function getInstance(props, callback) {
27
27
  }
28
28
  function notice(opts) {
29
29
  opts = _object_spread({}, options, opts);
30
- getInstance(opts, function(notification) {
31
- messageInstance = notification;
30
+ return new Promise(function(resolve) {
31
+ getInstance(opts, function(notification) {
32
+ messageInstance = notification;
33
+ resolve();
34
+ });
32
35
  });
33
36
  }
34
37
  var errorMsg = function(message) {
@@ -53,8 +53,7 @@ var InternalPickerView = function(props, ref) {
53
53
  var index = currentOptions.findIndex(function(columnItem) {
54
54
  return columnItem.value === currentValue;
55
55
  });
56
- columnOptions = currentOptions[index === -1 ? 0 : index] // 如果未找到,默认取第一个
57
- ;
56
+ columnOptions = currentOptions[index === -1 ? 0 : index]; // 如果未找到,默认取第一个
58
57
  } else {
59
58
  return "break" // 如果 currentValue 不存在,终止循环
60
59
  ;
@@ -1,3 +1,3 @@
1
1
  import React, { FunctionComponent } from 'react';
2
2
  import { WebPopupProps } from "../../types";
3
- export declare const Popup: FunctionComponent<Partial<WebPopupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>>;
3
+ export declare const Popup: FunctionComponent<Partial<WebPopupProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'title' | 'onTouchStart' | 'onTouchMove' | 'onTouchEnd'>>;
@@ -2,7 +2,7 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
- import React, { useEffect, useState } from "react";
5
+ import React, { useEffect, useState, useRef } from "react";
6
6
  import { createPortal } from "react-dom";
7
7
  import { CSSTransition } from "react-transition-group";
8
8
  import classNames from "classnames";
@@ -22,6 +22,8 @@ var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps),
22
22
  portal: null,
23
23
  overlay: true,
24
24
  round: false,
25
+ resizable: false,
26
+ minHeight: '',
25
27
  onOpen: function() {},
26
28
  onClose: function() {},
27
29
  onOverlayClick: function() {
@@ -29,28 +31,42 @@ var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps),
29
31
  },
30
32
  onCloseIconClick: function() {
31
33
  return true;
32
- }
34
+ },
35
+ onTouchStart: function() {},
36
+ onTouchMove: function() {},
37
+ onTouchEnd: function() {}
33
38
  });
34
39
  // 默认1000,参看variables
35
40
  var _zIndex = 1100;
36
41
  export var Popup = function(props) {
37
- var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left = _$_object_spread.left, title = _$_object_spread.title, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick;
42
+ var _$_object_spread = _object_spread({}, defaultProps, props), children = _$_object_spread.children, visible = _$_object_spread.visible, overlay = _$_object_spread.overlay, closeOnOverlayClick = _$_object_spread.closeOnOverlayClick, overlayStyle = _$_object_spread.overlayStyle, overlayClassName = _$_object_spread.overlayClassName, zIndex = _$_object_spread.zIndex, lockScroll = _$_object_spread.lockScroll, duration = _$_object_spread.duration, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, left = _$_object_spread.left, title = _$_object_spread.title, description = _$_object_spread.description, style = _$_object_spread.style, transition = _$_object_spread.transition, round = _$_object_spread.round, position = _$_object_spread.position, className = _$_object_spread.className, destroyOnClose = _$_object_spread.destroyOnClose, portal = _$_object_spread.portal, resizable = _$_object_spread.resizable, minHeight = _$_object_spread.minHeight, onOpen = _$_object_spread.onOpen, onClose = _$_object_spread.onClose, onOverlayClick = _$_object_spread.onOverlayClick, onCloseIconClick = _$_object_spread.onCloseIconClick, afterShow = _$_object_spread.afterShow, afterClose = _$_object_spread.afterClose, onClick = _$_object_spread.onClick, onTouchStart = _$_object_spread.onTouchStart, onTouchMove = _$_object_spread.onTouchMove, onTouchEnd = _$_object_spread.onTouchEnd;
38
43
  var nodeRef = React.useRef(null);
39
44
  var innerIndex = zIndex || _zIndex;
40
45
  var _useState = _sliced_to_array(useState(innerIndex), 2), index = _useState[0], setIndex = _useState[1];
41
46
  var _useState1 = _sliced_to_array(useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
42
47
  var _useState2 = _sliced_to_array(useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
43
48
  var _useState3 = _sliced_to_array(useState(''), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
49
+ var touchStartRef = useRef(0);
50
+ var touchMoveDistanceRef = useRef(0);
51
+ var heightRef = useRef(0);
52
+ // 首次可调整时记录的默认高度
53
+ var defaultHeightRef = useRef(0);
54
+ var isTouching = useRef(false);
44
55
  useLockScroll(nodeRef, innerVisible && lockScroll);
45
56
  var classPrefix = 'nut-popup';
46
57
  var overlayStyles = _object_spread({}, overlayStyle);
47
58
  var popStyles = _object_spread_props(_object_spread({}, style), {
48
- zIndex: index
59
+ zIndex: index,
60
+ minHeight: minHeight
49
61
  });
50
62
  var _obj;
51
63
  var popClassName = classNames(classPrefix, (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), _define_property(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
52
64
  var open = function() {
53
65
  if (!innerVisible) {
66
+ // 当高度改变后,再次打开时,将高度置为初始高度
67
+ if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
68
+ nodeRef.current.style.height = "".concat(defaultHeightRef.current, "px");
69
+ }
54
70
  setInnerVisible(true);
55
71
  setIndex(++innerIndex);
56
72
  }
@@ -104,6 +120,41 @@ export var Popup = function(props) {
104
120
  return renderCloseIcon();
105
121
  }
106
122
  };
123
+ var handleTouchStart = function(event) {
124
+ var _nodeRef_current;
125
+ if (position !== 'bottom' || !resizable || !nodeRef.current) return;
126
+ // 开始touch,记录下touch的pageY,用以判断是向上滑动还是向下滑动
127
+ touchStartRef.current = event.touches[0].pageY;
128
+ // 标记开始滑动
129
+ isTouching.current = true;
130
+ // 标记当前popup的高度
131
+ heightRef.current = ((_nodeRef_current = nodeRef.current) === null || _nodeRef_current === void 0 ? void 0 : _nodeRef_current.offsetHeight) || 0;
132
+ if (!defaultHeightRef.current) defaultHeightRef.current = heightRef.current;
133
+ onTouchStart === null || onTouchStart === void 0 ? void 0 : onTouchStart(heightRef.current, event);
134
+ };
135
+ var handleTouchMove = function(event) {
136
+ if (position !== 'bottom' || !resizable || !nodeRef.current) return;
137
+ event.stopPropagation();
138
+ // move过程中,当前的pageY 与 start值比较
139
+ touchMoveDistanceRef.current = event.touches[0].pageY - touchStartRef.current;
140
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
141
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
142
+ nodeRef.current.style.height = "".concat(currentHeight, "px");
143
+ // 向下滑动
144
+ if (touchMoveDistanceRef.current > 0) {
145
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, event, 'down');
146
+ } else {
147
+ // 向上滑动
148
+ onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(currentHeight, event, 'up');
149
+ }
150
+ };
151
+ var handleTouchEnd = function(event) {
152
+ if (position !== 'bottom' || !resizable || !nodeRef.current) return;
153
+ isTouching.current = false;
154
+ var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
155
+ var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
156
+ onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(currentHeight, event);
157
+ };
107
158
  var renderPop = function() {
108
159
  return /*#__PURE__*/ React.createElement(CSSTransition, {
109
160
  nodeRef: nodeRef,
@@ -118,7 +169,11 @@ export var Popup = function(props) {
118
169
  ref: nodeRef,
119
170
  style: popStyles,
120
171
  className: popClassName,
121
- onClick: onClick
172
+ onClick: onClick,
173
+ onTouchStart: handleTouchStart,
174
+ onTouchMove: handleTouchMove,
175
+ onTouchEnd: handleTouchEnd,
176
+ onTouchCancel: handleTouchEnd
122
177
  }, renderTitle(), showChildren && children));
123
178
  };
124
179
  var renderNode = function() {
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, var(--nutui-radius-xl, 12px));
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, 12px);
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -88,11 +88,6 @@
88
88
  }
89
89
  }
90
90
 
91
- &-bottom,
92
- &-top {
93
- max-height: 87%;
94
- }
95
-
96
91
  &-bottom {
97
92
  bottom: 0;
98
93
  left: 0;
@@ -80,9 +80,6 @@
80
80
  .nut-popup-center.nut-popup-round {
81
81
  border-radius: var(--nutui-popup-border-radius, 12px);
82
82
  }
83
- .nut-popup-bottom, .nut-popup-top {
84
- max-height: 87%;
85
- }
86
83
  .nut-popup-bottom {
87
84
  bottom: 0;
88
85
  left: 0;
@@ -2,10 +2,11 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
4
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
5
- import React from "react";
5
+ import React, { useMemo } from "react";
6
6
  import classNames from "classnames";
7
7
  import { ComponentDefaults } from "../../utils/typings";
8
8
  import { useRtl } from "../configprovider/index";
9
+ import { PriceColorEnum } from "../../types";
9
10
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
10
11
  color: 'primary',
11
12
  price: 0,
@@ -17,7 +18,7 @@ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
17
18
  line: false
18
19
  });
19
20
  export var Price = function(props) {
20
- var _ref = _object_spread({}, defaultProps, props), color = _ref.color, price = _ref.price, symbol = _ref.symbol, digits = _ref.digits, thousands = _ref.thousands, position = _ref.position, size = _ref.size, line = _ref.line, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
21
+ var _ref = _object_spread({}, defaultProps, props), color = _ref.color, originalPrice = _ref.price, symbol = _ref.symbol, digits = _ref.digits, thousands = _ref.thousands, position = _ref.position, size = _ref.size, line = _ref.line, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
21
22
  "color",
22
23
  "price",
23
24
  "symbol",
@@ -31,6 +32,25 @@ export var Price = function(props) {
31
32
  ]);
32
33
  var classPrefix = 'nut-price';
33
34
  var rtl = useRtl();
35
+ var price = useMemo(function() {
36
+ return originalPrice.toString().replace(/[^\d.]/g, '');
37
+ }, [
38
+ originalPrice
39
+ ]);
40
+ var isCustomPriceColor = useMemo(function() {
41
+ var specificPriceColor = Object.values(PriceColorEnum);
42
+ return !specificPriceColor.includes(color);
43
+ }, [
44
+ color
45
+ ]);
46
+ var priceColorStyle = useMemo(function() {
47
+ return isCustomPriceColor ? {
48
+ color: color
49
+ } : {};
50
+ }, [
51
+ isCustomPriceColor,
52
+ color
53
+ ]);
34
54
  var checkPoint = function(price) {
35
55
  return String(price).indexOf('.') > 0;
36
56
  };
@@ -52,14 +72,17 @@ export var Price = function(props) {
52
72
  decimalNum = 0;
53
73
  }
54
74
  if (checkPoint(decimalNum)) {
55
- decimalNum = Number(decimalNum).toFixed(digits);
56
- decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || 0;
75
+ decimalNum = digits ? Number(decimalNum).toFixed(digits) : "".concat(decimalNum);
76
+ decimalNum = typeof decimalNum.split('.') === 'string' ? 0 : decimalNum.split('.')[1] || '';
57
77
  } else {
58
- decimalNum = 0;
78
+ decimalNum = '';
79
+ }
80
+ if (digits) {
81
+ var result = "0.".concat(decimalNum);
82
+ var resultFixed = Number(result).toFixed(digits);
83
+ return String(resultFixed).substring(2, resultFixed.length);
59
84
  }
60
- var result = "0.".concat(decimalNum);
61
- var resultFixed = Number(result).toFixed(digits);
62
- return String(resultFixed).substring(2, resultFixed.length);
85
+ return decimalNum;
63
86
  };
64
87
  var renderSymbol = function() {
65
88
  var _obj;
@@ -69,20 +92,24 @@ export var Price = function(props) {
69
92
  "".concat(classPrefix, "-symbol-").concat(size),
70
93
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-line"), line), _define_property(_obj, "".concat(classPrefix, "-rtl"), rtl), _obj)
71
94
  ]),
95
+ style: priceColorStyle,
72
96
  dangerouslySetInnerHTML: {
73
97
  __html: symbol || ''
74
98
  }
75
99
  });
76
100
  };
77
101
  return /*#__PURE__*/ React.createElement("div", _object_spread({
78
- className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(color, " ").concat(className),
102
+ className: "".concat(classPrefix, " ").concat(classPrefix, "-").concat(isCustomPriceColor ? 'custom' : color, " ").concat(className),
79
103
  style: style
80
104
  }, rest), symbol && position === 'before' ? renderSymbol() : null, /*#__PURE__*/ React.createElement("div", {
81
- className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
82
- }, formatThousands(price)), digits ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
83
- className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
84
- }, "."), /*#__PURE__*/ React.createElement("div", {
85
- className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : '')
105
+ className: "".concat(classPrefix, "-integer ").concat(classPrefix, "-integer-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
106
+ style: priceColorStyle
107
+ }, formatThousands(price)), digits !== 0 ? /*#__PURE__*/ React.createElement(React.Fragment, null, checkPoint(price) || digits ? /*#__PURE__*/ React.createElement("div", {
108
+ className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
109
+ style: priceColorStyle
110
+ }, ".") : null, /*#__PURE__*/ React.createElement("div", {
111
+ className: "".concat(classPrefix, "-decimal ").concat(classPrefix, "-decimal-").concat(size, " ").concat(line ? "".concat(classPrefix, "-line") : ''),
112
+ style: priceColorStyle
86
113
  }, formatDecimal(price))) : null, symbol && position === 'after' ? renderSymbol() : null);
87
114
  };
88
115
  Price.displayName = 'NutPrice';
@@ -9,7 +9,7 @@
9
9
  &-integer,
10
10
  &-decimal {
11
11
  color: $price-color;
12
- font-family: 'JD';
12
+ font-family: 'JDZH-Bold';
13
13
  line-height: 1;
14
14
  }
15
15
 
@@ -18,7 +18,7 @@
18
18
  &-symbol,
19
19
  &-integer,
20
20
  &-decimal {
21
- font-family: 'JD-Bold';
21
+ font-family: 'JDZH-Bold';
22
22
  color: $price-darkgray-color;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@
29
29
  &-symbol,
30
30
  &-integer,
31
31
  &-decimal {
32
- font-family: 'JD-Bold';
32
+ font-family: 'JDZH-Bold';
33
33
  color: $price-primary-color;
34
34
  }
35
35
  }
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary, #ff0f23));
24
24
  }
25
25
  .nut-price-symbol {
@@ -9,7 +9,7 @@
9
9
  &-integer,
10
10
  &-decimal {
11
11
  color: $price-color;
12
- font-family: 'JD';
12
+ font-family: 'JDZH-Bold';
13
13
  line-height: 1;
14
14
  }
15
15
 
@@ -18,7 +18,7 @@
18
18
  &-symbol,
19
19
  &-integer,
20
20
  &-decimal {
21
- font-family: 'JD-Bold';
21
+ font-family: 'JDZH-Bold';
22
22
  color: $price-darkgray-color;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@
29
29
  &-symbol,
30
30
  &-integer,
31
31
  &-decimal {
32
- font-family: 'JD-Bold';
32
+ font-family: 'JDZH-Bold';
33
33
  color: $price-primary-color;
34
34
  }
35
35
  }
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary));
24
24
  }
25
25
  .nut-price-symbol {
@@ -9,7 +9,7 @@
9
9
  &-integer,
10
10
  &-decimal {
11
11
  color: $price-color;
12
- font-family: 'JD';
12
+ font-family: 'JDZH-Bold';
13
13
  line-height: 1;
14
14
  }
15
15
 
@@ -18,7 +18,7 @@
18
18
  &-symbol,
19
19
  &-integer,
20
20
  &-decimal {
21
- font-family: 'JD-Bold';
21
+ font-family: 'JDZH-Bold';
22
22
  color: $price-darkgray-color;
23
23
  }
24
24
  }
@@ -29,7 +29,7 @@
29
29
  &-symbol,
30
30
  &-integer,
31
31
  &-decimal {
32
- font-family: 'JD-Bold';
32
+ font-family: 'JDZH-Bold';
33
33
  color: $price-primary-color;
34
34
  }
35
35
  }
@@ -11,15 +11,15 @@
11
11
  }
12
12
  .nut-price-symbol, .nut-price-integer, .nut-price-decimal {
13
13
  color: var(--nutui-price-color, var(--nutui-color-text-help));
14
- font-family: "JD";
14
+ font-family: "JDZH-Bold";
15
15
  line-height: 1;
16
16
  }
17
17
  .nut-price-darkgray .nut-price-symbol, .nut-price-darkgray .nut-price-integer, .nut-price-darkgray .nut-price-decimal {
18
- font-family: "JD-Bold";
18
+ font-family: "JDZH-Bold";
19
19
  color: var(--nutui-price-darkgray-color, var(--nutui-gray-7));
20
20
  }
21
21
  .nut-price-primary .nut-price-symbol, .nut-price-primary .nut-price-integer, .nut-price-primary .nut-price-decimal {
22
- font-family: "JD-Bold";
22
+ font-family: "JDZH-Bold";
23
23
  color: var(--nutui-price-color, var(--nutui-color-primary, #ff6666));
24
24
  }
25
25
  .nut-price-symbol {