@nutui/nutui-react-taro 3.0.19-cpp.25 → 3.0.19-cpp.26-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 (138) hide show
  1. package/dist/cjs/locales/base.d.ts +3 -0
  2. package/dist/cjs/locales/en-US.js +4 -1
  3. package/dist/cjs/locales/id-ID.js +4 -1
  4. package/dist/cjs/locales/ja-JP.js +4 -1
  5. package/dist/cjs/locales/tr-TR.js +4 -1
  6. package/dist/cjs/locales/zh-CN.js +4 -1
  7. package/dist/cjs/locales/zh-TW.js +4 -1
  8. package/dist/cjs/locales/zh-UG.js +4 -1
  9. package/dist/cjs/packages/actionsheet/style/style.harmony.css +45 -24
  10. package/dist/cjs/packages/address/style/style.harmony.css +45 -24
  11. package/dist/cjs/packages/calendar/style/style.harmony.css +45 -24
  12. package/dist/cjs/packages/cascader/style/style.harmony.css +45 -24
  13. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  14. package/dist/cjs/packages/datepicker/style/style.harmony.css +46 -25
  15. package/dist/cjs/packages/imagepreview/style/style.harmony.css +45 -24
  16. package/dist/cjs/packages/numberkeyboard/style/style.css +1 -1
  17. package/dist/cjs/packages/numberkeyboard/style/style.harmony.css +46 -25
  18. package/dist/cjs/packages/nutui.react.build.d.ts +3 -1
  19. package/dist/cjs/packages/nutui.react.build.js +18 -14
  20. package/dist/cjs/packages/nutui.react.d.ts +4 -1
  21. package/dist/cjs/packages/nutui.react.js +19 -14
  22. package/dist/cjs/packages/nutui.react.scss.d.ts +1 -0
  23. package/dist/cjs/packages/nutui.react.scss.js +1 -0
  24. package/dist/cjs/packages/overlay/overlay.js +11 -17
  25. package/dist/cjs/packages/picker/style/style.css +1 -1
  26. package/dist/cjs/packages/picker/style/style.harmony.css +46 -25
  27. package/dist/cjs/packages/popover/style/style.harmony.css +45 -24
  28. package/dist/cjs/packages/popup/popup.js +171 -99
  29. package/dist/cjs/packages/popup/style/popup.scss +29 -9
  30. package/dist/cjs/packages/popup/style/style.css +45 -24
  31. package/dist/cjs/packages/popup/style/style.harmony.css +45 -24
  32. package/dist/cjs/packages/popup/style-jmapp/popup.scss +29 -9
  33. package/dist/cjs/packages/popup/style-jmapp/style.css +29 -8
  34. package/dist/cjs/packages/popup/style-jrkf/popup.scss +29 -9
  35. package/dist/cjs/packages/popup/style-jrkf/style.css +29 -8
  36. package/dist/cjs/packages/quickenter/index.d.ts +3 -0
  37. package/dist/cjs/packages/quickenter/index.js +13 -0
  38. package/dist/cjs/packages/quickenter/quickenter.d.ts +4 -0
  39. package/dist/cjs/packages/quickenter/quickenter.js +147 -0
  40. package/dist/cjs/packages/quickenter/style/css.js +2 -0
  41. package/dist/cjs/packages/quickenter/style/index.js +2 -0
  42. package/dist/cjs/packages/quickenter/style/quickenter.scss +110 -0
  43. package/dist/cjs/packages/quickenter/style/style.css +99 -0
  44. package/dist/cjs/packages/quickenter/style/style.harmony.css +500 -0
  45. package/dist/cjs/packages/quickenter/style-jmapp/css.js +2 -0
  46. package/dist/cjs/packages/quickenter/style-jmapp/index.js +2 -0
  47. package/dist/cjs/packages/quickenter/style-jmapp/quickenter.scss +110 -0
  48. package/dist/cjs/packages/quickenter/style-jmapp/style.css +99 -0
  49. package/dist/cjs/packages/quickenter/style-jrkf/css.js +2 -0
  50. package/dist/cjs/packages/quickenter/style-jrkf/index.js +2 -0
  51. package/dist/cjs/packages/quickenter/style-jrkf/quickenter.scss +110 -0
  52. package/dist/cjs/packages/quickenter/style-jrkf/style.css +99 -0
  53. package/dist/cjs/packages/shortpassword/style/style.harmony.css +45 -24
  54. package/dist/cjs/packages/timeselect/style/style.harmony.css +45 -24
  55. package/dist/cjs/packages/tour/style/style.harmony.css +45 -24
  56. package/dist/cjs/types/index.d.ts +3 -0
  57. package/dist/cjs/types/index.js +3 -0
  58. package/dist/cjs/types/spec/quickenter/base.d.ts +26 -0
  59. package/dist/cjs/types/spec/quickenter/base.js +4 -0
  60. package/dist/cjs/types/spec/quickenter/h5.d.ts +5 -0
  61. package/dist/cjs/types/spec/quickenter/h5.js +4 -0
  62. package/dist/cjs/types/spec/quickenter/taro.d.ts +5 -0
  63. package/dist/cjs/types/spec/quickenter/taro.js +4 -0
  64. package/dist/cjs/utils/taro/ConfigurableCSSTransition.d.ts +15 -0
  65. package/dist/cjs/utils/taro/ConfigurableCSSTransition.js +90 -0
  66. package/dist/es/locales/base.d.ts +3 -0
  67. package/dist/es/locales/en-US.js +4 -1
  68. package/dist/es/locales/id-ID.js +4 -1
  69. package/dist/es/locales/ja-JP.js +4 -1
  70. package/dist/es/locales/tr-TR.js +4 -1
  71. package/dist/es/locales/zh-CN.js +4 -1
  72. package/dist/es/locales/zh-TW.js +4 -1
  73. package/dist/es/locales/zh-UG.js +4 -1
  74. package/dist/es/packages/actionsheet/style/style.harmony.css +45 -24
  75. package/dist/es/packages/address/style/style.harmony.css +45 -24
  76. package/dist/es/packages/calendar/style/style.harmony.css +45 -24
  77. package/dist/es/packages/cascader/style/style.harmony.css +45 -24
  78. package/dist/es/packages/configprovider/types.d.ts +1 -1
  79. package/dist/es/packages/datepicker/style/style.harmony.css +46 -25
  80. package/dist/es/packages/imagepreview/style/style.harmony.css +45 -24
  81. package/dist/es/packages/numberkeyboard/style/style.css +1 -1
  82. package/dist/es/packages/numberkeyboard/style/style.harmony.css +46 -25
  83. package/dist/es/packages/nutui.react.build.d.ts +3 -1
  84. package/dist/es/packages/nutui.react.build.js +3 -1
  85. package/dist/es/packages/overlay/overlay.js +11 -17
  86. package/dist/es/packages/picker/style/style.css +1 -1
  87. package/dist/es/packages/picker/style/style.harmony.css +46 -25
  88. package/dist/es/packages/popover/style/style.harmony.css +45 -24
  89. package/dist/es/packages/popup/popup.js +172 -101
  90. package/dist/es/packages/popup/style/popup.scss +29 -9
  91. package/dist/es/packages/popup/style/style.css +45 -24
  92. package/dist/es/packages/popup/style/style.harmony.css +45 -24
  93. package/dist/es/packages/popup/style-jmapp/popup.scss +29 -9
  94. package/dist/es/packages/popup/style-jmapp/style.css +29 -8
  95. package/dist/es/packages/popup/style-jrkf/popup.scss +29 -9
  96. package/dist/es/packages/popup/style-jrkf/style.css +29 -8
  97. package/dist/es/packages/quickenter/index.d.ts +3 -0
  98. package/dist/es/packages/quickenter/index.js +2 -0
  99. package/dist/es/packages/quickenter/quickenter.d.ts +4 -0
  100. package/dist/es/packages/quickenter/quickenter.js +135 -0
  101. package/dist/es/packages/quickenter/style/css.js +2 -0
  102. package/dist/es/packages/quickenter/style/index.js +2 -0
  103. package/dist/es/packages/quickenter/style/quickenter.scss +110 -0
  104. package/dist/es/packages/quickenter/style/style.css +99 -0
  105. package/dist/es/packages/quickenter/style/style.harmony.css +500 -0
  106. package/dist/es/packages/quickenter/style-jmapp/css.js +2 -0
  107. package/dist/es/packages/quickenter/style-jmapp/index.js +2 -0
  108. package/dist/es/packages/quickenter/style-jmapp/quickenter.scss +110 -0
  109. package/dist/es/packages/quickenter/style-jmapp/style.css +99 -0
  110. package/dist/es/packages/quickenter/style-jrkf/css.js +2 -0
  111. package/dist/es/packages/quickenter/style-jrkf/index.js +2 -0
  112. package/dist/es/packages/quickenter/style-jrkf/quickenter.scss +110 -0
  113. package/dist/es/packages/quickenter/style-jrkf/style.css +99 -0
  114. package/dist/es/packages/shortpassword/style/style.harmony.css +45 -24
  115. package/dist/es/packages/timeselect/style/style.harmony.css +45 -24
  116. package/dist/es/packages/tour/style/style.harmony.css +45 -24
  117. package/dist/es/types/index.d.ts +3 -0
  118. package/dist/es/types/index.js +3 -0
  119. package/dist/es/types/spec/quickenter/base.d.ts +44 -0
  120. package/dist/es/types/spec/quickenter/base.js +1 -0
  121. package/dist/es/types/spec/quickenter/h5.d.ts +5 -0
  122. package/dist/es/types/spec/quickenter/h5.js +1 -0
  123. package/dist/es/types/spec/quickenter/taro.d.ts +5 -0
  124. package/dist/es/types/spec/quickenter/taro.js +1 -0
  125. package/dist/es/utils/taro/ConfigurableCSSTransition.d.ts +15 -0
  126. package/dist/es/utils/taro/ConfigurableCSSTransition.js +79 -0
  127. package/dist/nutui.react.umd.js +631 -332
  128. package/dist/style-jmapp.css +1 -1
  129. package/dist/style-jmapp.scss +35 -34
  130. package/dist/style-jrkf.css +1 -1
  131. package/dist/style-jrkf.scss +34 -33
  132. package/dist/style.css +1 -1
  133. package/dist/style.scss +35 -34
  134. package/dist/styles/variables-daojia.scss +36 -0
  135. package/dist/styles/variables-jmapp.scss +36 -0
  136. package/dist/styles/variables-jrkf.scss +36 -0
  137. package/dist/styles/variables.scss +37 -1
  138. package/package.json +1 -1
@@ -71,7 +71,7 @@
71
71
  align-items: center;
72
72
  justify-content: center;
73
73
  border-bottom: var(--nutui-popup-title-border-bottom, 0);
74
- padding: var(--nutui-popup-title-padding, 16px);
74
+ padding: var(--nutui-popup-title-padding, 11px);
75
75
  position: relative;
76
76
  }
77
77
  .nut-popup-title-wrapper {
@@ -84,7 +84,6 @@
84
84
  color: var(--nutui-color-title, #1a1a1a);
85
85
  font-weight: var(--nutui-font-weight-bold, 600);
86
86
  font-size: var(--nutui-popup-title-font-size, var(--nutui-font-size-xl, 18px));
87
- line-height: var(--nutui-popup-title-font-size, var(--nutui-font-size-xl, 18px));
88
87
  }
89
88
  .nut-popup-title-description {
90
89
  color: var(--nutui-color-text, #505259);
@@ -96,13 +95,13 @@
96
95
  }
97
96
  .nut-popup-title-left {
98
97
  position: absolute;
99
- top: var(--nutui-popup-title-padding, 16px);
100
- left: var(--nutui-popup-title-padding, 16px);
98
+ top: var(--nutui-popup-title-padding, 11px);
99
+ left: var(--nutui-popup-title-padding, 11px);
101
100
  }
102
101
  .nut-popup-title-right {
103
102
  position: absolute;
104
- top: var(--nutui-popup-title-padding, 16px);
105
- right: var(--nutui-popup-title-padding, 16px);
103
+ top: var(--nutui-popup-title-padding, 11px);
104
+ right: var(--nutui-popup-title-padding, 11px);
106
105
  z-index: 1;
107
106
  width: var(--nutui-popup-icon-size, 20px);
108
107
  height: var(--nutui-popup-icon-size, 20px);
@@ -113,20 +112,22 @@
113
112
  opacity: 0.7;
114
113
  }
115
114
  .nut-popup-title-right-top-left {
116
- top: var(--nutui-popup-title-padding, 16px);
117
- left: var(--nutui-popup-title-padding, 16px);
115
+ top: var(--nutui-popup-title-padding, 11px);
116
+ left: var(--nutui-popup-title-padding, 11px);
118
117
  }
119
118
  .nut-popup-title-right-bottom-left {
120
- bottom: var(--nutui-popup-title-padding, 16px);
121
- left: var(--nutui-popup-title-padding, 16px);
119
+ bottom: var(--nutui-popup-title-padding, 11px);
120
+ left: var(--nutui-popup-title-padding, 11px);
122
121
  }
123
122
  .nut-popup-title-right-bottom-right {
124
- right: var(--nutui-popup-title-padding, 16px);
125
- bottom: var(--nutui-popup-title-padding, 16px);
123
+ right: var(--nutui-popup-title-padding, 11px);
124
+ bottom: var(--nutui-popup-title-padding, 11px);
126
125
  }
127
126
  .nut-popup-center {
128
127
  top: 50%;
129
128
  left: 50%;
129
+ right: auto;
130
+ bottom: auto;
130
131
  min-height: 10%;
131
132
  max-width: 295px;
132
133
  transform: translate(-50%, -50%);
@@ -137,6 +138,8 @@
137
138
  .nut-popup-bottom {
138
139
  bottom: 0;
139
140
  left: 0;
141
+ right: auto;
142
+ top: auto;
140
143
  width: 100%;
141
144
  }
142
145
  .nut-popup-bottom.nut-popup-round {
@@ -148,6 +151,8 @@
148
151
  .nut-popup-right {
149
152
  top: 0;
150
153
  right: 0;
154
+ left: auto;
155
+ bottom: auto;
151
156
  width: 100px;
152
157
  height: 100%;
153
158
  }
@@ -157,6 +162,8 @@
157
162
  .nut-popup-left {
158
163
  top: 0;
159
164
  left: 0;
165
+ right: auto;
166
+ bottom: auto;
160
167
  width: 100px;
161
168
  height: 100%;
162
169
  }
@@ -166,6 +173,8 @@
166
173
  .nut-popup-top {
167
174
  top: 0;
168
175
  left: 0;
176
+ right: auto;
177
+ bottom: auto;
169
178
  width: 100%;
170
179
  }
171
180
  .nut-popup-top.nut-popup-round {
@@ -242,6 +251,9 @@
242
251
  }
243
252
  }
244
253
  @keyframes popup-slide-top-exit {
254
+ from {
255
+ transform: translate3d(0, 0%, 0);
256
+ }
245
257
  to {
246
258
  transform: translate3d(0, -100%, 0);
247
259
  }
@@ -266,6 +278,9 @@
266
278
  }
267
279
  }
268
280
  @keyframes popup-slide-right-exit {
281
+ from {
282
+ transform: translate3d(0%, 0, 0);
283
+ }
269
284
  to {
270
285
  transform: translate3d(100%, 0, 0);
271
286
  }
@@ -276,7 +291,7 @@
276
291
  animation-name: popup-slide-right-enter;
277
292
  animation-duration: var(--nutui-popup-animation-duration, 0.3s);
278
293
  }
279
- .nut-popup-slide-right-exit {
294
+ .nut-popup-slide-right-exit-active {
280
295
  animation-fill-mode: both;
281
296
  animation-name: popup-slide-right-exit;
282
297
  animation-duration: var(--nutui-popup-animation-duration, 0.3s);
@@ -289,20 +304,23 @@
289
304
  transform: translate3d(0, 0%, 0);
290
305
  }
291
306
  }
292
- @keyframes slide-bottom-exit {
307
+ @keyframes popup-slide-bottom-exit {
308
+ from {
309
+ transform: translate3d(0, 0%, 0);
310
+ }
293
311
  to {
294
312
  transform: translate3d(0, 100%, 0);
295
313
  }
296
314
  }
297
315
  .nut-popup-slide-bottom-enter-active, .nut-popup-slide-bottom-appear-active {
298
- transform: translate(0, 0);
316
+ transform: translate3d(0, 0, 0);
299
317
  animation-fill-mode: both;
300
318
  animation-name: popup-slide-bottom-enter;
301
319
  animation-duration: var(--nutui-popup-animation-duration, 0.3s);
302
320
  }
303
- .nut-popup-slide-bottom-exit {
321
+ .nut-popup-slide-bottom-exit-active {
304
322
  animation-fill-mode: both;
305
- animation-name: slide-bottom-exit;
323
+ animation-name: popup-slide-bottom-exit;
306
324
  animation-duration: var(--nutui-popup-animation-duration, 0.3s);
307
325
  }
308
326
  @keyframes popup-slide-left-enter {
@@ -314,17 +332,20 @@
314
332
  }
315
333
  }
316
334
  @keyframes popup-slide-left-exit {
335
+ from {
336
+ transform: translate3d(0%, 0, 0);
337
+ }
317
338
  to {
318
339
  transform: translate3d(-100%, 0, 0);
319
340
  }
320
341
  }
321
342
  .nut-popup-slide-left-enter-active, .nut-popup-slide-left-appear-active {
322
- transform: translate(0, 0);
343
+ transform: translate3d(0, 0, 0);
323
344
  animation-fill-mode: both;
324
345
  animation-name: popup-slide-left-enter;
325
346
  animation-duration: var(--nutui-popup-animation-duration, 0.3s);
326
347
  }
327
- .nut-popup-slide-left-exit-active, .nut-popup-slide-left-exit-done {
348
+ .nut-popup-slide-left-exit-active {
328
349
  animation-fill-mode: both;
329
350
  animation-name: popup-slide-left-exit;
330
351
  animation-duration: var(--nutui-popup-animation-duration, 0.3s);
@@ -339,27 +360,27 @@
339
360
  [dir=rtl] .nut-popup-title-left,
340
361
  .nut-rtl .nut-popup-title-left {
341
362
  left: auto;
342
- right: var(--nutui-popup-title-padding, 16px);
363
+ right: var(--nutui-popup-title-padding, 11px);
343
364
  }
344
365
  [dir=rtl] .nut-popup-title-right,
345
366
  .nut-rtl .nut-popup-title-right {
346
367
  right: auto;
347
- left: var(--nutui-popup-title-padding, 16px);
368
+ left: var(--nutui-popup-title-padding, 11px);
348
369
  }
349
370
  [dir=rtl] .nut-popup-title-right-top-left,
350
371
  .nut-rtl .nut-popup-title-right-top-left {
351
372
  left: auto;
352
- right: var(--nutui-popup-title-padding, 16px);
373
+ right: var(--nutui-popup-title-padding, 11px);
353
374
  }
354
375
  [dir=rtl] .nut-popup-title-right-bottom-left,
355
376
  .nut-rtl .nut-popup-title-right-bottom-left {
356
377
  left: auto;
357
- right: var(--nutui-popup-title-padding, 16px);
378
+ right: var(--nutui-popup-title-padding, 11px);
358
379
  }
359
380
  [dir=rtl] .nut-popup-title-right-bottom-right,
360
381
  .nut-rtl .nut-popup-title-right-bottom-right {
361
382
  right: auto;
362
- left: var(--nutui-popup-title-padding, 16px);
383
+ left: var(--nutui-popup-title-padding, 11px);
363
384
  }
364
385
  [dir=rtl] .nut-popup-title .nut-icon-ArrowLeft,
365
386
  .nut-rtl .nut-popup-title .nut-icon-ArrowLeft {
@@ -22,6 +22,7 @@ var _reactdom = require("react-dom");
22
22
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
23
23
  var _iconsreacttaro = require("@nutui/icons-react-taro");
24
24
  var _components = require("@tarojs/components");
25
+ var _ConfigurableCSSTransition = /*#__PURE__*/ _interop_require_default._(require("../../utils/taro/ConfigurableCSSTransition"));
25
26
  var _getrect = require("../../utils/taro/get-rect");
26
27
  var _overlay = require("../overlay/overlay");
27
28
  var _index = /*#__PURE__*/ _interop_require_default._(require("../overlay/index"));
@@ -59,54 +60,57 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _overla
59
60
  var _zIndex = 1100;
60
61
  var Popup = function Popup(props) {
61
62
  var _$_object_spread = (0, _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, top = _$_object_spread.top, 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, closeAriaLabel = _$_object_spread.closeAriaLabel;
62
- var innerIndex = zIndex || _zIndex;
63
- var _useState = (0, _sliced_to_array._)((0, _react.useState)(innerIndex), 2), index = _useState[0], setIndex = _useState[1];
63
+ var locale = (0, _configprovider.useConfig)().locale;
64
+ var _useState = (0, _sliced_to_array._)((0, _react.useState)(zIndex || _zIndex), 2), index = _useState[0], setIndex = _useState[1];
64
65
  var _useState1 = (0, _sliced_to_array._)((0, _react.useState)(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
65
66
  var _useState2 = (0, _sliced_to_array._)((0, _react.useState)(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
66
- var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
67
67
  var nodeRef = (0, _uselockscoll.useLockScrollTaro)(innerVisible && lockScroll);
68
- var topNodeRef = _react.default.useRef(null);
68
+ var topNodeRef = (0, _react.useRef)(null);
69
69
  var rootRect = (0, _react.useRef)(null);
70
70
  var touchStartRef = (0, _react.useRef)(0);
71
71
  var touchMoveDistanceRef = (0, _react.useRef)(0);
72
72
  var heightRef = (0, _react.useRef)(0);
73
73
  var defaultHeightRef = (0, _react.useRef)(0);
74
74
  var isTouching = (0, _react.useRef)(false);
75
- var locale = (0, _configprovider.useConfig)().locale;
76
75
  var classPrefix = 'nut-popup';
77
- var overlayStyles = (0, _object_spread._)({}, overlayStyle);
78
- var contentZIndex = (0, _platform.harmony)() ? index + 1 : index // 解决harmony层级问题
79
- ;
80
- var popStyles = (0, _object_spread._)({
81
- zIndex: contentZIndex,
82
- minHeight: minHeight
83
- }, style);
84
- var _obj;
85
- var popClassName = (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
86
- var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), popupHeight = _useState4[0], setPopupHeight = _useState4[1];
87
- var _useState5 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), topBottom = _useState5[0], setTopBottom = _useState5[1];
88
- var resizeStyles = function resizeStyles() {
89
- if (popupHeight !== '') {
90
- return {
91
- height: popupHeight
92
- };
93
- }
94
- };
95
- var open = function open() {
96
- if (!innerVisible) {
97
- // 当高度改变后,再次打开时,将高度置为初始高度
98
- if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
99
- setPopupHeight((0, _pxtransform.pxTransform)(defaultHeightRef.current));
100
- }
101
- setInnerVisible(true);
102
- setIndex(++innerIndex);
103
- }
104
- if (destroyOnClose) {
105
- setShowChildren(true);
106
- }
107
- onOpen && onOpen();
108
- };
109
- var getPopupHeight = function getPopupHeight() {
76
+ var transitionName = (0, _react.useMemo)(function() {
77
+ return transition || "".concat(classPrefix, "-slide-").concat(position);
78
+ }, [
79
+ transition,
80
+ position
81
+ ]);
82
+ var overlayStyles = (0, _react.useMemo)(function() {
83
+ return (0, _object_spread._)({}, overlayStyle);
84
+ }, [
85
+ overlayStyle
86
+ ]);
87
+ var contentZIndex = (0, _react.useMemo)(function() {
88
+ return (0, _platform.harmony)() ? index + 1 : index // 解决harmony层级问题
89
+ ;
90
+ }, [
91
+ index
92
+ ]);
93
+ var popStyles = (0, _react.useMemo)(function() {
94
+ return (0, _object_spread._)({
95
+ zIndex: contentZIndex,
96
+ minHeight: minHeight
97
+ }, style);
98
+ }, [
99
+ contentZIndex,
100
+ minHeight,
101
+ style
102
+ ]);
103
+ var popClassName = (0, _react.useMemo)(function() {
104
+ var _obj;
105
+ return (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-round"), round || position === 'bottom'), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(position), true), _obj), className);
106
+ }, [
107
+ round,
108
+ position,
109
+ className
110
+ ]);
111
+ var _useState3 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), popupHeight = _useState3[0], setPopupHeight = _useState3[1];
112
+ var _useState4 = (0, _sliced_to_array._)((0, _react.useState)(''), 2), topBottom = _useState4[0], setTopBottom = _useState4[1];
113
+ var getPopupHeight = (0, _react.useCallback)(function() {
110
114
  return (0, _async_to_generator._)(function() {
111
115
  var _nodeRef_current, rect, height;
112
116
  return (0, _ts_generator._)(this, function(_state) {
@@ -126,19 +130,36 @@ var Popup = function Popup(props) {
126
130
  }
127
131
  });
128
132
  })();
129
- };
130
- (0, _react.useEffect)(function() {
131
- if (innerVisible && topNodeRef.current && nodeRef.current) {
132
- (0, _taro.nextTick)(function() {
133
- (0, _taro.nextTick)(function() {
134
- getPopupHeight();
135
- });
133
+ }, [
134
+ nodeRef
135
+ ]);
136
+ var open = (0, _react.useCallback)(function() {
137
+ if (!innerVisible) {
138
+ // 当高度改变后,再次打开时,将高度置为初始高度
139
+ if (position === 'bottom' && resizable && nodeRef.current && heightRef.current) {
140
+ setPopupHeight((0, _pxtransform.pxTransform)(defaultHeightRef.current));
141
+ }
142
+ setInnerVisible(true);
143
+ setIndex(function(prev) {
144
+ return prev + 1;
136
145
  });
137
146
  }
147
+ if (destroyOnClose) {
148
+ setShowChildren(true);
149
+ }
150
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
138
151
  }, [
139
- innerVisible
152
+ innerVisible,
153
+ position,
154
+ resizable,
155
+ destroyOnClose,
156
+ onOpen,
157
+ nodeRef,
158
+ setInnerVisible,
159
+ setIndex,
160
+ setShowChildren
140
161
  ]);
141
- var close = function close() {
162
+ var close = (0, _react.useCallback)(function() {
142
163
  if (innerVisible) {
143
164
  setInnerVisible(false);
144
165
  if (destroyOnClose) {
@@ -146,28 +167,70 @@ var Popup = function Popup(props) {
146
167
  setShowChildren(false);
147
168
  }, Number(duration));
148
169
  }
149
- onClose && onClose();
170
+ onClose === null || onClose === void 0 ? void 0 : onClose();
150
171
  }
151
- };
152
- var handleOverlayClick = function handleOverlayClick(e) {
172
+ }, [
173
+ innerVisible,
174
+ destroyOnClose,
175
+ duration,
176
+ onClose,
177
+ setInnerVisible,
178
+ setShowChildren
179
+ ]);
180
+ (0, _react.useEffect)(function() {
181
+ visible ? open() : close();
182
+ }, [
183
+ visible,
184
+ open,
185
+ close
186
+ ]);
187
+ (0, _react.useEffect)(function() {
188
+ if (innerVisible && topNodeRef.current && nodeRef.current) {
189
+ (0, _taro.nextTick)(function() {
190
+ (0, _taro.nextTick)(function() {
191
+ getPopupHeight();
192
+ });
193
+ });
194
+ }
195
+ }, [
196
+ innerVisible,
197
+ getPopupHeight,
198
+ nodeRef
199
+ ]);
200
+ var handleOverlayClick = (0, _react.useCallback)(function(e) {
153
201
  e.stopPropagation();
154
202
  if (closeOnOverlayClick && onOverlayClick(e)) {
155
203
  close();
156
204
  }
157
- };
158
- var handleCloseIconClick = function handleCloseIconClick(e) {
205
+ }, [
206
+ closeOnOverlayClick,
207
+ onOverlayClick,
208
+ close
209
+ ]);
210
+ var handleCloseIconClick = (0, _react.useCallback)(function(e) {
159
211
  onCloseIconClick(e) && close();
160
- };
161
- var renderCloseIcon = function renderCloseIcon() {
212
+ }, [
213
+ onCloseIconClick,
214
+ close
215
+ ]);
216
+ var renderCloseIcon = (0, _react.useCallback)(function() {
217
+ if (!closeable) return null;
162
218
  var closeClasses = (0, _classnames.default)("".concat(classPrefix, "-title-right"), "".concat(classPrefix, "-title-right-").concat(closeIconPosition));
163
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, closeable && /*#__PURE__*/ _react.default.createElement(_components.View, {
219
+ return /*#__PURE__*/ _react.default.createElement(_components.View, {
164
220
  className: closeClasses,
165
221
  onClick: handleCloseIconClick,
166
222
  ariaRole: "button",
167
223
  ariaLabel: closeAriaLabel || locale.close
168
- }, /*#__PURE__*/ _react.default.isValidElement(closeIcon) ? closeIcon : /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, null)));
169
- };
170
- var renderTop = function renderTop() {
224
+ }, /*#__PURE__*/ _react.default.isValidElement(closeIcon) ? closeIcon : /*#__PURE__*/ _react.default.createElement(_iconsreacttaro.Close, null));
225
+ }, [
226
+ closeable,
227
+ closeIconPosition,
228
+ handleCloseIconClick,
229
+ closeAriaLabel,
230
+ locale.close,
231
+ closeIcon
232
+ ]);
233
+ var renderTop = (0, _react.useCallback)(function() {
171
234
  if (!top) return null;
172
235
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
173
236
  className: "".concat(classPrefix, "-bottom-top"),
@@ -176,8 +239,11 @@ var Popup = function Popup(props) {
176
239
  bottom: topBottom
177
240
  }
178
241
  }, top);
179
- };
180
- var renderTitle = function renderTitle() {
242
+ }, [
243
+ top,
244
+ topBottom
245
+ ]);
246
+ var renderTitle = (0, _react.useCallback)(function() {
181
247
  if (left || title || description) {
182
248
  return /*#__PURE__*/ _react.default.createElement(_components.View, {
183
249
  className: "".concat(classPrefix, "-title")
@@ -194,8 +260,15 @@ var Popup = function Popup(props) {
194
260
  if (closeable) {
195
261
  return renderCloseIcon();
196
262
  }
197
- };
198
- var handleTouchStart = function handleTouchStart(event) {
263
+ }, [
264
+ left,
265
+ title,
266
+ description,
267
+ position,
268
+ closeable,
269
+ renderCloseIcon
270
+ ]);
271
+ var handleTouchStart = (0, _react.useCallback)(function(event) {
199
272
  return (0, _async_to_generator._)(function() {
200
273
  var _nodeRef_current, _rootRect_current, e, rect;
201
274
  return (0, _ts_generator._)(this, function(_state) {
@@ -225,8 +298,13 @@ var Popup = function Popup(props) {
225
298
  }
226
299
  });
227
300
  })();
228
- };
229
- var handleTouchMove = function handleTouchMove(event) {
301
+ }, [
302
+ position,
303
+ resizable,
304
+ onTouchStart,
305
+ nodeRef
306
+ ]);
307
+ var handleTouchMove = (0, _react.useCallback)(function(event) {
230
308
  if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
231
309
  var e = event;
232
310
  e.stopPropagation();
@@ -245,21 +323,42 @@ var Popup = function Popup(props) {
245
323
  }
246
324
  };
247
325
  requestAnimationFrame(handleMove);
248
- };
249
- var handleTouchEnd = function handleTouchEnd(event) {
326
+ }, [
327
+ position,
328
+ resizable,
329
+ minHeight,
330
+ onTouchMove,
331
+ nodeRef
332
+ ]);
333
+ var handleTouchEnd = (0, _react.useCallback)(function(event) {
250
334
  if (position !== 'bottom' || !resizable || !nodeRef.current || !rootRect.current) return;
251
335
  var e = event;
252
336
  isTouching.current = false;
253
337
  var min = typeof minHeight === 'number' ? minHeight : parseInt(String(minHeight || 0), 10) || 0;
254
338
  var currentHeight = Math.max(min, heightRef.current - touchMoveDistanceRef.current);
255
339
  onTouchEnd === null || onTouchEnd === void 0 ? void 0 : onTouchEnd(currentHeight, e);
256
- };
340
+ }, [
341
+ position,
342
+ resizable,
343
+ minHeight,
344
+ onTouchEnd,
345
+ nodeRef
346
+ ]);
257
347
  var renderPop = function renderPop() {
258
- return /*#__PURE__*/ _react.default.createElement(_components.View, {
348
+ return /*#__PURE__*/ _react.default.createElement(_ConfigurableCSSTransition.default, {
349
+ nodeRef: nodeRef,
350
+ classNames: transitionName,
351
+ mountOnEnter: true,
352
+ unmountOnExit: destroyOnClose,
353
+ timeout: Number(duration),
354
+ in: innerVisible,
355
+ onEntered: afterShow,
356
+ onExited: afterClose
357
+ }, /*#__PURE__*/ _react.default.createElement(_components.View, {
259
358
  ref: nodeRef,
260
- style: (0, _object_spread._)((0, _object_spread_props._)((0, _object_spread._)({}, popStyles), {
261
- display: innerVisible ? (popStyles === null || popStyles === void 0 ? void 0 : popStyles.display) || 'block' : 'none'
262
- }), resizeStyles()),
359
+ style: (0, _object_spread._)({}, popStyles, popupHeight ? {
360
+ height: popupHeight
361
+ } : {}),
263
362
  className: popClassName,
264
363
  onClick: onClick,
265
364
  catchMove: lockScroll,
@@ -267,24 +366,8 @@ var Popup = function Popup(props) {
267
366
  onTouchMove: handleTouchMove,
268
367
  onTouchEnd: handleTouchEnd,
269
368
  onTouchCancel: handleTouchEnd
270
- }, renderTop(), renderTitle(), showChildren ? children : null);
369
+ }, renderTop(), renderTitle(), showChildren ? children : null));
271
370
  };
272
- // const renderPop = () => {
273
- // return (
274
- // <CSSTransition
275
- // nodeRef={nodeRef}
276
- // classNames={transitionName}
277
- // mountOnEnter
278
- // unmountOnExit={destroyOnClose}
279
- // timeout={duration}
280
- // in={innerVisible}
281
- // onEntered={afterShow}
282
- // onExited={afterClose}
283
- // >
284
- // {renderContent()}
285
- // </CSSTransition>
286
- // )
287
- // }
288
371
  var renderNode = function renderNode() {
289
372
  return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, overlay ? /*#__PURE__*/ _react.default.createElement(_index.default, {
290
373
  zIndex: index,
@@ -297,17 +380,6 @@ var Popup = function Popup(props) {
297
380
  onClick: handleOverlayClick
298
381
  }) : null, renderPop());
299
382
  };
300
- (0, _react.useEffect)(function() {
301
- visible ? open() : close();
302
- }, [
303
- visible
304
- ]);
305
- (0, _react.useEffect)(function() {
306
- setTransitionName(transition || "".concat(classPrefix, "-slide-").concat(position));
307
- }, [
308
- position,
309
- transition
310
- ]);
311
383
  var resolveContainer = function resolveContainer(getContainer) {
312
384
  return (typeof getContainer === 'function' ? getContainer() : getContainer) || document.body;
313
385
  };