@nutui/nutui-react 3.0.0 → 3.0.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 (207) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/hooks/use-client-rect.js +1 -0
  3. package/dist/cjs/packages/actionsheet/style/style.css +12 -0
  4. package/dist/cjs/packages/address/style/style.css +12 -0
  5. package/dist/cjs/packages/calendar/style/style.css +12 -0
  6. package/dist/cjs/packages/cascader/style/style.css +12 -0
  7. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  8. package/dist/cjs/packages/datepicker/datepicker.js +8 -6
  9. package/dist/cjs/packages/datepicker/style/style.css +82 -0
  10. package/dist/cjs/packages/datepickerview/datepickerview.d.ts +3 -0
  11. package/dist/cjs/packages/datepickerview/datepickerview.js +118 -0
  12. package/dist/cjs/packages/datepickerview/index.d.ts +3 -0
  13. package/dist/cjs/packages/{subsidenavbar → datepickerview}/index.js +2 -2
  14. package/dist/cjs/packages/datepickerview/style/datepickerview.scss +4 -0
  15. package/dist/cjs/packages/datepickerview/style/index.js +2 -0
  16. package/dist/cjs/packages/datepickerview/style/style.css +78 -0
  17. package/dist/cjs/packages/datepickerview/types.d.ts +15 -0
  18. package/dist/cjs/packages/datepickerview/types.js +4 -0
  19. package/dist/cjs/packages/dialog/dialogwrap.js +3 -0
  20. package/dist/cjs/packages/dialog/style/dialog.scss +0 -1
  21. package/dist/cjs/packages/dialog/style/style.css +0 -1
  22. package/dist/cjs/packages/drag/style/drag.scss +1 -0
  23. package/dist/cjs/packages/drag/style/style.css +1 -0
  24. package/dist/cjs/packages/fixednav/fixednav.js +20 -14
  25. package/dist/cjs/packages/fixednav/style/fixednav.scss +0 -15
  26. package/dist/cjs/packages/fixednav/style/style.css +0 -14
  27. package/dist/cjs/packages/form/__tests__/merge.spec.d.ts +1 -0
  28. package/dist/cjs/packages/form/__tests__/merge.spec.js +545 -0
  29. package/dist/cjs/packages/form/form.d.ts +2 -0
  30. package/dist/cjs/packages/form/form.js +9 -2
  31. package/dist/cjs/packages/form/index.d.ts +2 -1
  32. package/dist/cjs/packages/form/index.js +1 -0
  33. package/dist/cjs/packages/form/style/form.scss +0 -66
  34. package/dist/cjs/packages/form/style/style.css +31 -21
  35. package/dist/cjs/packages/form/types.d.ts +2 -1
  36. package/dist/cjs/packages/form/useform.d.ts +2 -1
  37. package/dist/cjs/packages/form/useform.js +342 -278
  38. package/dist/cjs/packages/formitem/formitem.d.ts +1 -0
  39. package/dist/cjs/packages/formitem/formitem.js +55 -44
  40. package/dist/cjs/packages/formitem/style/formitem.scss +101 -21
  41. package/dist/cjs/packages/formitem/style/style.css +89 -12
  42. package/dist/cjs/packages/imagepreview/style/style.css +12 -0
  43. package/dist/cjs/packages/input/style/input.scss +6 -4
  44. package/dist/cjs/packages/input/style/style.css +4 -0
  45. package/dist/cjs/packages/numberkeyboard/style/style.css +12 -0
  46. package/dist/cjs/packages/nutui.react.build.d.ts +11 -15
  47. package/dist/cjs/packages/nutui.react.build.js +8 -16
  48. package/dist/cjs/packages/nutui.react.d.ts +16 -22
  49. package/dist/cjs/packages/nutui.react.js +13 -23
  50. package/dist/cjs/packages/nutui.react.scss.d.ts +5 -7
  51. package/dist/cjs/packages/nutui.react.scss.js +5 -7
  52. package/dist/cjs/packages/overlay/style/overlay.scss +0 -4
  53. package/dist/cjs/packages/picker/style/index.js +1 -0
  54. package/dist/cjs/packages/picker/style/style.css +82 -0
  55. package/dist/cjs/packages/popover/style/style.css +12 -0
  56. package/dist/cjs/packages/popup/style/popup.scss +12 -4
  57. package/dist/cjs/packages/popup/style/style.css +12 -0
  58. package/dist/cjs/packages/shortpassword/shortpassword.js +5 -7
  59. package/dist/cjs/packages/shortpassword/style/shortpassword.scss +10 -0
  60. package/dist/cjs/packages/shortpassword/style/style.css +21 -0
  61. package/dist/cjs/packages/swipe/style/style.css +3 -3
  62. package/dist/cjs/packages/swipe/style/swipe.scss +7 -3
  63. package/dist/cjs/packages/tabbar/style/style.css +6 -0
  64. package/dist/cjs/packages/tabbaritem/style/style.css +6 -0
  65. package/dist/cjs/packages/tabbaritem/style/tabbaritem.scss +6 -0
  66. package/dist/cjs/packages/timeselect/style/style.css +12 -0
  67. package/dist/cjs/packages/tour/style/style.css +12 -0
  68. package/dist/cjs/utils/get-rect-by-taro.d.ts +1 -1
  69. package/dist/cjs/utils/get-rect-by-taro.js +4 -1
  70. package/dist/cjs/utils/get-system-info.js +4 -5
  71. package/dist/cjs/utils/merge.d.ts +14 -0
  72. package/dist/cjs/utils/merge.js +98 -0
  73. package/dist/cjs/utils/platform-taro.js +4 -5
  74. package/dist/cjs/utils/to-array.d.ts +1 -0
  75. package/dist/cjs/utils/to-array.js +18 -0
  76. package/dist/es/hooks/use-client-rect.js +1 -0
  77. package/dist/es/packages/actionsheet/style/style.css +12 -0
  78. package/dist/es/packages/address/style/style.css +12 -0
  79. package/dist/es/packages/calendar/style/style.css +12 -0
  80. package/dist/es/packages/cascader/style/style.css +12 -0
  81. package/dist/es/packages/configprovider/types.d.ts +1 -1
  82. package/dist/es/packages/datepicker/datepicker.js +8 -6
  83. package/dist/es/packages/datepicker/style/style.css +82 -0
  84. package/dist/es/packages/datepickerview/datepickerview.d.ts +3 -0
  85. package/dist/es/packages/datepickerview/datepickerview.js +106 -0
  86. package/dist/es/packages/datepickerview/index.d.ts +3 -0
  87. package/dist/es/packages/datepickerview/index.js +2 -0
  88. package/dist/es/packages/datepickerview/style/datepickerview.scss +4 -0
  89. package/dist/es/packages/datepickerview/style/index.js +2 -0
  90. package/dist/es/packages/datepickerview/style/style.css +78 -0
  91. package/dist/es/packages/datepickerview/types.d.ts +15 -0
  92. package/dist/es/packages/datepickerview/types.js +1 -0
  93. package/dist/es/packages/dialog/dialogwrap.js +3 -0
  94. package/dist/es/packages/dialog/style/dialog.scss +0 -1
  95. package/dist/es/packages/dialog/style/style.css +0 -1
  96. package/dist/es/packages/drag/style/drag.scss +1 -0
  97. package/dist/es/packages/drag/style/style.css +1 -0
  98. package/dist/es/packages/fixednav/fixednav.js +20 -14
  99. package/dist/es/packages/fixednav/style/fixednav.scss +0 -15
  100. package/dist/es/packages/fixednav/style/style.css +0 -14
  101. package/dist/es/packages/form/__tests__/merge.spec.d.ts +1 -0
  102. package/dist/es/packages/form/__tests__/merge.spec.js +541 -0
  103. package/dist/es/packages/form/form.d.ts +10 -0
  104. package/dist/es/packages/form/form.js +9 -2
  105. package/dist/es/packages/form/index.d.ts +2 -1
  106. package/dist/es/packages/form/index.js +2 -1
  107. package/dist/es/packages/form/style/form.scss +0 -66
  108. package/dist/es/packages/form/style/style.css +31 -21
  109. package/dist/es/packages/form/types.d.ts +2 -1
  110. package/dist/es/packages/form/useform.d.ts +2 -1
  111. package/dist/es/packages/form/useform.js +340 -279
  112. package/dist/es/packages/formitem/formitem.d.ts +1 -0
  113. package/dist/es/packages/formitem/formitem.js +55 -44
  114. package/dist/es/packages/formitem/style/formitem.scss +101 -21
  115. package/dist/es/packages/formitem/style/style.css +89 -12
  116. package/dist/es/packages/imagepreview/style/style.css +12 -0
  117. package/dist/es/packages/input/style/input.scss +6 -4
  118. package/dist/es/packages/input/style/style.css +4 -0
  119. package/dist/es/packages/numberkeyboard/style/style.css +12 -0
  120. package/dist/es/packages/nutui.react.build.d.ts +11 -15
  121. package/dist/es/packages/nutui.react.build.js +11 -15
  122. package/dist/es/packages/overlay/style/overlay.scss +0 -4
  123. package/dist/es/packages/picker/style/index.js +1 -0
  124. package/dist/es/packages/picker/style/style.css +82 -0
  125. package/dist/es/packages/popover/style/style.css +12 -0
  126. package/dist/es/packages/popup/style/popup.scss +12 -4
  127. package/dist/es/packages/popup/style/style.css +12 -0
  128. package/dist/es/packages/shortpassword/shortpassword.js +5 -7
  129. package/dist/es/packages/shortpassword/style/shortpassword.scss +10 -0
  130. package/dist/es/packages/shortpassword/style/style.css +21 -0
  131. package/dist/es/packages/swipe/style/style.css +3 -3
  132. package/dist/es/packages/swipe/style/swipe.scss +7 -3
  133. package/dist/es/packages/tabbar/style/style.css +6 -0
  134. package/dist/es/packages/tabbaritem/style/style.css +6 -0
  135. package/dist/es/packages/tabbaritem/style/tabbaritem.scss +6 -0
  136. package/dist/es/packages/timeselect/style/style.css +12 -0
  137. package/dist/es/packages/tour/style/style.css +12 -0
  138. package/dist/es/utils/get-rect-by-taro.d.ts +1 -1
  139. package/dist/es/utils/get-rect-by-taro.js +4 -1
  140. package/dist/es/utils/get-system-info.js +4 -4
  141. package/dist/es/utils/merge.d.ts +14 -0
  142. package/dist/es/utils/merge.js +68 -0
  143. package/dist/es/utils/platform-taro.js +4 -4
  144. package/dist/es/utils/to-array.d.ts +1 -0
  145. package/dist/es/utils/to-array.js +8 -0
  146. package/dist/nutui.react.umd.js +1483 -1416
  147. package/dist/style.css +1 -1
  148. package/dist/style.scss +33 -35
  149. package/dist/styles/variables-jmapp.scss +0 -50
  150. package/dist/styles/variables-jrkf.scss +0 -50
  151. package/dist/styles/variables.scss +0 -49
  152. package/package.json +1 -1
  153. package/dist/cjs/packages/sidenavbar/context.d.ts +0 -1
  154. package/dist/cjs/packages/sidenavbar/context.js +0 -12
  155. package/dist/cjs/packages/sidenavbar/index.d.ts +0 -3
  156. package/dist/cjs/packages/sidenavbar/index.js +0 -12
  157. package/dist/cjs/packages/sidenavbar/sidenavbar.d.ts +0 -14
  158. package/dist/cjs/packages/sidenavbar/sidenavbar.js +0 -70
  159. package/dist/cjs/packages/sidenavbar/style/index.js +0 -2
  160. package/dist/cjs/packages/sidenavbar/style/sidenavbar.scss +0 -89
  161. package/dist/cjs/packages/sidenavbar/style/style.css +0 -443
  162. package/dist/cjs/packages/sidenavbar/utils.d.ts +0 -3
  163. package/dist/cjs/packages/sidenavbar/utils.js +0 -23
  164. package/dist/cjs/packages/sidenavbaritem/index.d.ts +0 -3
  165. package/dist/cjs/packages/sidenavbaritem/index.js +0 -12
  166. package/dist/cjs/packages/sidenavbaritem/sidenavbaritem.d.ts +0 -11
  167. package/dist/cjs/packages/sidenavbaritem/sidenavbaritem.js +0 -34
  168. package/dist/cjs/packages/sidenavbaritem/style/index.js +0 -1
  169. package/dist/cjs/packages/sidenavbaritem/style/sidenavbaritem.scss +0 -13
  170. package/dist/cjs/packages/sidenavbaritem/style/style.css +0 -14
  171. package/dist/cjs/packages/subsidenavbar/index.d.ts +0 -3
  172. package/dist/cjs/packages/subsidenavbar/style/css.js +0 -1
  173. package/dist/cjs/packages/subsidenavbar/style/index.js +0 -1
  174. package/dist/cjs/packages/subsidenavbar/style/style.css +0 -20
  175. package/dist/cjs/packages/subsidenavbar/style/subsidenavbar.scss +0 -26
  176. package/dist/cjs/packages/subsidenavbar/subsidenavbar.d.ts +0 -13
  177. package/dist/cjs/packages/subsidenavbar/subsidenavbar.js +0 -88
  178. package/dist/es/packages/sidenavbar/context.d.ts +0 -1
  179. package/dist/es/packages/sidenavbar/context.js +0 -2
  180. package/dist/es/packages/sidenavbar/index.d.ts +0 -3
  181. package/dist/es/packages/sidenavbar/index.js +0 -2
  182. package/dist/es/packages/sidenavbar/sidenavbar.d.ts +0 -38
  183. package/dist/es/packages/sidenavbar/sidenavbar.js +0 -58
  184. package/dist/es/packages/sidenavbar/style/css.js +0 -1
  185. package/dist/es/packages/sidenavbar/style/index.js +0 -2
  186. package/dist/es/packages/sidenavbar/style/sidenavbar.scss +0 -89
  187. package/dist/es/packages/sidenavbar/style/style.css +0 -443
  188. package/dist/es/packages/sidenavbar/utils.d.ts +0 -3
  189. package/dist/es/packages/sidenavbar/utils.js +0 -14
  190. package/dist/es/packages/sidenavbaritem/index.d.ts +0 -3
  191. package/dist/es/packages/sidenavbaritem/index.js +0 -2
  192. package/dist/es/packages/sidenavbaritem/sidenavbaritem.d.ts +0 -11
  193. package/dist/es/packages/sidenavbaritem/sidenavbaritem.js +0 -23
  194. package/dist/es/packages/sidenavbaritem/style/css.js +0 -1
  195. package/dist/es/packages/sidenavbaritem/style/index.js +0 -1
  196. package/dist/es/packages/sidenavbaritem/style/sidenavbaritem.scss +0 -13
  197. package/dist/es/packages/sidenavbaritem/style/style.css +0 -14
  198. package/dist/es/packages/subsidenavbar/index.d.ts +0 -3
  199. package/dist/es/packages/subsidenavbar/index.js +0 -2
  200. package/dist/es/packages/subsidenavbar/style/css.js +0 -1
  201. package/dist/es/packages/subsidenavbar/style/index.js +0 -1
  202. package/dist/es/packages/subsidenavbar/style/style.css +0 -20
  203. package/dist/es/packages/subsidenavbar/style/subsidenavbar.scss +0 -26
  204. package/dist/es/packages/subsidenavbar/subsidenavbar.d.ts +0 -13
  205. package/dist/es/packages/subsidenavbar/subsidenavbar.js +0 -77
  206. /package/dist/cjs/packages/{sidenavbar → datepickerview}/style/css.js +0 -0
  207. /package/dist/{cjs/packages/sidenavbaritem → es/packages/datepickerview}/style/css.js +0 -0
@@ -1182,7 +1182,7 @@ Check the top-level render call using <` + t + ">.");
1182
1182
  style: {}
1183
1183
  };
1184
1184
  var prefixCls$2 = "nut-button";
1185
- var defaultProps$1B = _object_spread_props(_object_spread({}, ComponentDefaults), {
1185
+ var defaultProps$1A = _object_spread_props(_object_spread({}, ComponentDefaults), {
1186
1186
  color: "",
1187
1187
  type: "default",
1188
1188
  size: "normal",
@@ -1198,7 +1198,7 @@ Check the top-level render call using <` + t + ">.");
1198
1198
  }
1199
1199
  });
1200
1200
  var Button = /* @__PURE__ */ React.forwardRef(function(props, ref) {
1201
- var _ref = _object_spread({}, defaultProps$1B, props), color = _ref.color, shape = _ref.shape, fill = _ref.fill, loading = _ref.loading, disabled = _ref.disabled, type2 = _ref.type, size = _ref.size, block = _ref.block, icon = _ref.icon, rightIcon = _ref.rightIcon, children = _ref.children, className = _ref.className, style = _ref.style, nativeType = _ref.nativeType, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
1201
+ var _ref = _object_spread({}, defaultProps$1A, props), color = _ref.color, shape = _ref.shape, fill = _ref.fill, loading = _ref.loading, disabled = _ref.disabled, type2 = _ref.type, size = _ref.size, block = _ref.block, icon = _ref.icon, rightIcon = _ref.rightIcon, children = _ref.children, className = _ref.className, style = _ref.style, nativeType = _ref.nativeType, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
1202
1202
  "color",
1203
1203
  "shape",
1204
1204
  "fill",
@@ -1234,7 +1234,7 @@ Check the top-level render call using <` + t + ">.");
1234
1234
  color,
1235
1235
  props.fill
1236
1236
  ]);
1237
- var handleClick2 = React.useCallback(function(e2) {
1237
+ var handleClick = React.useCallback(function(e2) {
1238
1238
  if (!loading && !disabled && onClick) {
1239
1239
  onClick(e2);
1240
1240
  }
@@ -1250,7 +1250,7 @@ Check the top-level render call using <` + t + ">.");
1250
1250
  type: nativeType,
1251
1251
  className: buttonClassNames,
1252
1252
  style: _object_spread({}, getStyle, style),
1253
- onClick: handleClick2
1253
+ onClick: handleClick
1254
1254
  }), /* @__PURE__ */ React.createElement("div", {
1255
1255
  className: "nut-button-wrap"
1256
1256
  }, loading && /* @__PURE__ */ React.createElement(s, {
@@ -1261,14 +1261,14 @@ Check the top-level render call using <` + t + ">.");
1261
1261
  });
1262
1262
  Button.displayName = "NutButton";
1263
1263
  var CellGroupContext = React.createContext(null);
1264
- var defaultProps$1A = _object_spread_props(_object_spread({}, ComponentDefaults), {
1264
+ var defaultProps$1z = _object_spread_props(_object_spread({}, ComponentDefaults), {
1265
1265
  title: "",
1266
1266
  description: "",
1267
1267
  divider: true
1268
1268
  });
1269
1269
  var classPrefix$v = "nut-cell-group";
1270
1270
  var CellGroup = function(props) {
1271
- var _ref = _object_spread({}, defaultProps$1A, props), children = _ref.children, className = _ref.className, title = _ref.title, description = _ref.description, divider = _ref.divider, rest = _object_without_properties(_ref, [
1271
+ var _ref = _object_spread({}, defaultProps$1z, props), children = _ref.children, className = _ref.className, title = _ref.title, description = _ref.description, divider = _ref.divider, rest = _object_without_properties(_ref, [
1272
1272
  "children",
1273
1273
  "className",
1274
1274
  "title",
@@ -1900,7 +1900,7 @@ Check the top-level render call using <` + t + ">.");
1900
1900
  }, children));
1901
1901
  };
1902
1902
  ConfigProvider.displayName = "NutConfigProvider";
1903
- var defaultProps$1z = _object_spread_props(_object_spread({}, ComponentDefaults), {
1903
+ var defaultProps$1y = _object_spread_props(_object_spread({}, ComponentDefaults), {
1904
1904
  title: null,
1905
1905
  description: null,
1906
1906
  extra: null,
@@ -1914,7 +1914,7 @@ Check the top-level render call using <` + t + ">.");
1914
1914
  var classPrefix$t = "nut-cell";
1915
1915
  var Cell = function(props) {
1916
1916
  var ctx2 = React.useContext(CellGroupContext);
1917
- var _ref = _object_spread({}, defaultProps$1z, props), children = _ref.children, clickable = _ref.clickable, onClick = _ref.onClick, title = _ref.title, description = _ref.description, extra = _ref.extra, radius = _ref.radius, align = _ref.align, isLast = _ref.isLast, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
1917
+ var _ref = _object_spread({}, defaultProps$1y, props), children = _ref.children, clickable = _ref.clickable, onClick = _ref.onClick, title = _ref.title, description = _ref.description, extra = _ref.extra, radius = _ref.radius, align = _ref.align, isLast = _ref.isLast, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
1918
1918
  "children",
1919
1919
  "clickable",
1920
1920
  "onClick",
@@ -1928,7 +1928,7 @@ Check the top-level render call using <` + t + ">.");
1928
1928
  "style"
1929
1929
  ]);
1930
1930
  var rtl = useRtl();
1931
- var handleClick2 = function(event) {
1931
+ var handleClick = function(event) {
1932
1932
  onClick(event);
1933
1933
  };
1934
1934
  var baseStyle = _object_spread_props(_object_spread({}, style), {
@@ -1943,7 +1943,7 @@ Check the top-level render call using <` + t + ">.");
1943
1943
  _define_property({}, "".concat(classPrefix$t, "-group-item"), ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.group)
1944
1944
  ], clickable ? "".concat(classPrefix$t, "-clickable") : "")),
1945
1945
  onClick: function(event) {
1946
- return handleClick2(event);
1946
+ return handleClick(event);
1947
1947
  },
1948
1948
  style: baseStyle
1949
1949
  }, rest), children || /* @__PURE__ */ React.createElement(React.Fragment, null, title || description ? /* @__PURE__ */ React.createElement("div", {
@@ -2010,7 +2010,7 @@ Check the top-level render call using <` + t + ">.");
2010
2010
  function _sliced_to_array(arr, i2) {
2011
2011
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i2) || _unsupported_iterable_to_array(arr, i2) || _non_iterable_rest();
2012
2012
  }
2013
- var defaultProps$1y = _object_spread_props(_object_spread({}, ComponentDefaults), {
2013
+ var defaultProps$1x = _object_spread_props(_object_spread({}, ComponentDefaults), {
2014
2014
  fit: "fill",
2015
2015
  position: "center",
2016
2016
  alt: "",
@@ -2022,7 +2022,7 @@ Check the top-level render call using <` + t + ">.");
2022
2022
  });
2023
2023
  var classPrefix$s = "nut-image";
2024
2024
  var Image$1 = function(props) {
2025
- var _$_object_spread = _object_spread({}, defaultProps$1y, props), className = _$_object_spread.className, style = _$_object_spread.style, src = _$_object_spread.src, fit = _$_object_spread.fit, position2 = _$_object_spread.position, alt = _$_object_spread.alt, width2 = _$_object_spread.width, height2 = _$_object_spread.height, radius = _$_object_spread.radius, error = _$_object_spread.error, loading = _$_object_spread.loading, lazy = _$_object_spread.lazy, draggable = _$_object_spread.draggable, onClick = _$_object_spread.onClick, onLoad = _$_object_spread.onLoad, onError = _$_object_spread.onError;
2025
+ var _$_object_spread = _object_spread({}, defaultProps$1x, props), className = _$_object_spread.className, style = _$_object_spread.style, src = _$_object_spread.src, fit = _$_object_spread.fit, position2 = _$_object_spread.position, alt = _$_object_spread.alt, width2 = _$_object_spread.width, height2 = _$_object_spread.height, radius = _$_object_spread.radius, error = _$_object_spread.error, loading = _$_object_spread.loading, lazy = _$_object_spread.lazy, draggable = _$_object_spread.draggable, onClick = _$_object_spread.onClick, onLoad = _$_object_spread.onLoad, onError = _$_object_spread.onError;
2026
2026
  var _useState = _sliced_to_array(React.useState(false), 2), innerLoading = _useState[0], setInnerLoading = _useState[1];
2027
2027
  var _useState1 = _sliced_to_array(React.useState(false), 2), isError = _useState1[0], setIsError = _useState1[1];
2028
2028
  var _useState2 = _sliced_to_array(React.useState(false), 2), complete = _useState2[0], setComplete = _useState2[1];
@@ -4125,7 +4125,7 @@ Check the top-level render call using <` + t + ">.");
4125
4125
  var styles = _object_spread_props(_object_spread({}, style), {
4126
4126
  zIndex
4127
4127
  });
4128
- var handleClick2 = function(e2) {
4128
+ var handleClick = function(e2) {
4129
4129
  if (closeOnOverlayClick) {
4130
4130
  onClick && onClick(e2);
4131
4131
  }
@@ -4143,17 +4143,17 @@ Check the top-level render call using <` + t + ">.");
4143
4143
  className: classes,
4144
4144
  style: styles
4145
4145
  }, rest), {
4146
- onClick: handleClick2
4146
+ onClick: handleClick
4147
4147
  }), children));
4148
4148
  };
4149
4149
  Overlay.displayName = "NutOverlay";
4150
- var defaultProps$1x = _object_spread_props(_object_spread({}, ComponentDefaults), {
4150
+ var defaultProps$1w = _object_spread_props(_object_spread({}, ComponentDefaults), {
4151
4151
  contentPosition: "center",
4152
4152
  direction: "horizontal"
4153
4153
  });
4154
4154
  var classPrefix$r = "nut-divider";
4155
4155
  var Divider = function(props) {
4156
- var _ref = _object_spread({}, defaultProps$1x, props), children = _ref.children, contentPosition = _ref.contentPosition, style = _ref.style, className = _ref.className, direction = _ref.direction, rest = _object_without_properties(_ref, [
4156
+ var _ref = _object_spread({}, defaultProps$1w, props), children = _ref.children, contentPosition = _ref.contentPosition, style = _ref.style, className = _ref.className, direction = _ref.direction, rest = _object_without_properties(_ref, [
4157
4157
  "children",
4158
4158
  "contentPosition",
4159
4159
  "style",
@@ -4191,7 +4191,7 @@ Check the top-level render call using <` + t + ">.");
4191
4191
  var pxCheck = function(value2) {
4192
4192
  return parseFloat(value2.toString());
4193
4193
  };
4194
- var defaultProps$1w = {
4194
+ var defaultProps$1v = {
4195
4195
  text: "",
4196
4196
  columns: 4,
4197
4197
  gap: 9,
@@ -4201,7 +4201,7 @@ Check the top-level render call using <` + t + ">.");
4201
4201
  direction: "vertical"
4202
4202
  };
4203
4203
  var GridItem = function(props) {
4204
- var _ref = _object_spread({}, defaultProps$1w, props), children = _ref.children, style = _ref.style, columns = _ref.columns, index2 = _ref.index, gap = _ref.gap, square = _ref.square, text2 = _ref.text, center = _ref.center, reverse = _ref.reverse, direction = _ref.direction, className = _ref.className, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
4204
+ var _ref = _object_spread({}, defaultProps$1v, props), children = _ref.children, style = _ref.style, columns = _ref.columns, index2 = _ref.index, gap = _ref.gap, square = _ref.square, text2 = _ref.text, center = _ref.center, reverse = _ref.reverse, direction = _ref.direction, className = _ref.className, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
4205
4205
  "children",
4206
4206
  "style",
4207
4207
  "columns",
@@ -4246,7 +4246,7 @@ Check the top-level render call using <` + t + ">.");
4246
4246
  var _obj;
4247
4247
  return classNames("".concat(classPrefix2, "-text"), (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-text-reverse"), reverse && direction !== "horizontal"), _define_property(_obj, "".concat(classPrefix2, "-text-horizontal"), direction === "horizontal"), _define_property(_obj, "".concat(classPrefix2, "-text-horizontal-reverse"), reverse && direction === "horizontal"), _obj));
4248
4248
  };
4249
- var handleClick2 = function(e2) {
4249
+ var handleClick = function(e2) {
4250
4250
  onClick && onClick(e2);
4251
4251
  context2.onClick && context2.onClick({
4252
4252
  text: text2,
@@ -4263,7 +4263,7 @@ Check the top-level render call using <` + t + ">.");
4263
4263
  className: classes,
4264
4264
  style: rootStyle()
4265
4265
  }, rest), {
4266
- onClick: handleClick2
4266
+ onClick: handleClick
4267
4267
  }), /* @__PURE__ */ React.createElement("div", {
4268
4268
  className: contentClass()
4269
4269
  }, children && /* @__PURE__ */ React.createElement(React.Fragment, null, children), text2 && /* @__PURE__ */ React.createElement("div", {
@@ -4271,7 +4271,7 @@ Check the top-level render call using <` + t + ">.");
4271
4271
  }, text2)));
4272
4272
  };
4273
4273
  GridItem.displayName = "NutGridItem";
4274
- var defaultProps$1v = {
4274
+ var defaultProps$1u = {
4275
4275
  columns: 4,
4276
4276
  gap: 9,
4277
4277
  center: true,
@@ -4280,7 +4280,7 @@ Check the top-level render call using <` + t + ">.");
4280
4280
  direction: "vertical"
4281
4281
  };
4282
4282
  var Grid = function(props) {
4283
- var _ref = _object_spread({}, defaultProps$1v, props), children = _ref.children, columns = _ref.columns, gap = _ref.gap, center = _ref.center, square = _ref.square, reverse = _ref.reverse, direction = _ref.direction, style = _ref.style, className = _ref.className, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
4283
+ var _ref = _object_spread({}, defaultProps$1u, props), children = _ref.children, columns = _ref.columns, gap = _ref.gap, center = _ref.center, square = _ref.square, reverse = _ref.reverse, direction = _ref.direction, style = _ref.style, className = _ref.className, onClick = _ref.onClick, rest = _object_without_properties(_ref, [
4284
4284
  "children",
4285
4285
  "columns",
4286
4286
  "gap",
@@ -4332,7 +4332,7 @@ Check the top-level render call using <` + t + ">.");
4332
4332
  };
4333
4333
  Layout.displayName = "NutLayout";
4334
4334
  var DataContext$1 = React.createContext({});
4335
- var defaultProps$1u = _object_spread_props(_object_spread({}, ComponentDefaults), {
4335
+ var defaultProps$1t = _object_spread_props(_object_spread({}, ComponentDefaults), {
4336
4336
  span: "24",
4337
4337
  offset: "0",
4338
4338
  gutter: "0",
@@ -4340,7 +4340,7 @@ Check the top-level render call using <` + t + ">.");
4340
4340
  isLast: false
4341
4341
  });
4342
4342
  var Col = function(props) {
4343
- var _$_object_spread = _object_spread({}, defaultProps$1u, props), className = _$_object_spread.className, style = _$_object_spread.style, span = _$_object_spread.span, offset = _$_object_spread.offset, children = _$_object_spread.children, isFirst = _$_object_spread.isFirst, isLast = _$_object_spread.isLast, onClick = _$_object_spread.onClick;
4343
+ var _$_object_spread = _object_spread({}, defaultProps$1t, props), className = _$_object_spread.className, style = _$_object_spread.style, span = _$_object_spread.span, offset = _$_object_spread.offset, children = _$_object_spread.children, isFirst = _$_object_spread.isFirst, isLast = _$_object_spread.isLast, onClick = _$_object_spread.onClick;
4344
4344
  var _useState = _sliced_to_array(React.useState(""), 2), colName = _useState[0], setColName = _useState[1];
4345
4345
  var _useState1 = _sliced_to_array(React.useState({}), 2), colStyle = _useState1[0], setColStyle = _useState1[1];
4346
4346
  var gutter = React.useContext(DataContext$1).gutter;
@@ -4376,7 +4376,7 @@ Check the top-level render call using <` + t + ">.");
4376
4376
  };
4377
4377
  Col.displayName = "NutCol";
4378
4378
  var classPrefix$q = "nut-row";
4379
- var defaultProps$1t = _object_spread_props(_object_spread({}, ComponentDefaults), {
4379
+ var defaultProps$1s = _object_spread_props(_object_spread({}, ComponentDefaults), {
4380
4380
  type: "",
4381
4381
  justify: "start",
4382
4382
  align: "flex-start",
@@ -4384,7 +4384,7 @@ Check the top-level render call using <` + t + ">.");
4384
4384
  gutter: "0"
4385
4385
  });
4386
4386
  var Row = function(props) {
4387
- var _$_object_spread = _object_spread({}, defaultProps$1t, props), className = _$_object_spread.className, style = _$_object_spread.style, children = _$_object_spread.children, type2 = _$_object_spread.type, justify = _$_object_spread.justify, align = _$_object_spread.align, wrap = _$_object_spread.wrap, gutter = _$_object_spread.gutter, onClick = _$_object_spread.onClick;
4387
+ var _$_object_spread = _object_spread({}, defaultProps$1s, props), className = _$_object_spread.className, style = _$_object_spread.style, children = _$_object_spread.children, type2 = _$_object_spread.type, justify = _$_object_spread.justify, align = _$_object_spread.align, wrap = _$_object_spread.wrap, gutter = _$_object_spread.gutter, onClick = _$_object_spread.onClick;
4388
4388
  var getClass = function(prefix2, type3) {
4389
4389
  var classType = type3 ? "nut-row-".concat(prefix2, "-").concat(type3) : "";
4390
4390
  if (prefix2) return classType;
@@ -4414,12 +4414,19 @@ Check the top-level render call using <` + t + ">.");
4414
4414
  })));
4415
4415
  };
4416
4416
  Row.displayName = "NutRow";
4417
+ var classPrefix$p = "nut-safe-area";
4418
+ var SafeArea = function(props) {
4419
+ return /* @__PURE__ */ React.createElement("div", {
4420
+ className: classNames(classPrefix$p, "".concat(classPrefix$p, "-position-").concat(props.position))
4421
+ });
4422
+ };
4423
+ SafeArea.displayName = "NutSafeArea";
4417
4424
  var prefixCls$1 = "nut-space";
4418
- var defaultProps$1s = {
4425
+ var defaultProps$1r = {
4419
4426
  direction: "horizontal"
4420
4427
  };
4421
4428
  var Space = function(props) {
4422
- var _$_object_spread = _object_spread({}, defaultProps$1s, props), className = _$_object_spread.className, style = _$_object_spread.style, children = _$_object_spread.children, wrap = _$_object_spread.wrap, align = _$_object_spread.align, direction = _$_object_spread.direction, justify = _$_object_spread.justify;
4429
+ var _$_object_spread = _object_spread({}, defaultProps$1r, props), className = _$_object_spread.className, style = _$_object_spread.style, children = _$_object_spread.children, wrap = _$_object_spread.wrap, align = _$_object_spread.align, direction = _$_object_spread.direction, justify = _$_object_spread.justify;
4423
4430
  var _obj;
4424
4431
  var cls = classNames(prefixCls$1, (_obj = {}, _define_property(_obj, "".concat(prefixCls$1, "-").concat(direction), direction), _define_property(_obj, "".concat(prefixCls$1, "-").concat(direction, "-wrap"), wrap), _define_property(_obj, "".concat(prefixCls$1, "-align-").concat(align), align), _define_property(_obj, "".concat(prefixCls$1, "-justify-").concat(justify), justify), _define_property(_obj, "".concat(className), className), _obj));
4425
4432
  var _obj1;
@@ -4454,6 +4461,7 @@ Check the top-level render call using <` + t + ">.");
4454
4461
  };
4455
4462
  }
4456
4463
  if (element && element.getBoundingClientRect) {
4464
+ console.log(element, element.getBoundingClientRect());
4457
4465
  return element.getBoundingClientRect();
4458
4466
  }
4459
4467
  return {
@@ -4465,7 +4473,7 @@ Check the top-level render call using <` + t + ">.");
4465
4473
  height: 0
4466
4474
  };
4467
4475
  };
4468
- function useWatch(dep, callback) {
4476
+ function useWatch$1(dep, callback) {
4469
4477
  var config2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
4470
4478
  immediate: false
4471
4479
  };
@@ -4495,14 +4503,14 @@ Check the top-level render call using <` + t + ">.");
4495
4503
  stop2.current = true;
4496
4504
  };
4497
4505
  }
4498
- var defaultProps$1r = _object_spread_props(_object_spread({}, ComponentDefaults), {
4506
+ var defaultProps$1q = _object_spread_props(_object_spread({}, ComponentDefaults), {
4499
4507
  position: "top",
4500
4508
  threshold: 0,
4501
4509
  zIndex: 900
4502
4510
  });
4503
- var classPrefix$p = "nut-sticky";
4511
+ var classPrefix$o = "nut-sticky";
4504
4512
  var Sticky = function(props) {
4505
- var _ref = _object_spread({}, defaultProps$1r, props), position2 = _ref.position, zIndex = _ref.zIndex, children = _ref.children, container = _ref.container, style = _ref.style, className = _ref.className, threshold = _ref.threshold, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
4513
+ var _ref = _object_spread({}, defaultProps$1q, props), position2 = _ref.position, zIndex = _ref.zIndex, children = _ref.children, container = _ref.container, style = _ref.style, className = _ref.className, threshold = _ref.threshold, onChange = _ref.onChange, rest = _object_without_properties(_ref, [
4506
4514
  "position",
4507
4515
  "zIndex",
4508
4516
  "children",
@@ -4613,7 +4621,7 @@ Check the top-level render call using <` + t + ">.");
4613
4621
  threshold,
4614
4622
  container
4615
4623
  ]);
4616
- useWatch(isFixed, function() {
4624
+ useWatch$1(isFixed, function() {
4617
4625
  onChange && onChange(isFixed);
4618
4626
  });
4619
4627
  React.useEffect(function() {
@@ -4629,7 +4637,7 @@ Check the top-level render call using <` + t + ">.");
4629
4637
  return /* @__PURE__ */ React.createElement("div", _object_spread({
4630
4638
  ref: rootRef,
4631
4639
  style: _object_spread({}, style, rootStyle),
4632
- className: classNames(classPrefix$p, className)
4640
+ className: classNames(classPrefix$o, className)
4633
4641
  }, rest), /* @__PURE__ */ React.createElement("div", {
4634
4642
  className: "nut-sticky-box",
4635
4643
  ref: stickyRef,
@@ -4637,13 +4645,6 @@ Check the top-level render call using <` + t + ">.");
4637
4645
  }, children));
4638
4646
  };
4639
4647
  Sticky.displayName = "NutSticky";
4640
- var classPrefix$o = "nut-safe-area";
4641
- var SafeArea = function(props) {
4642
- return /* @__PURE__ */ React.createElement("div", {
4643
- className: classNames(classPrefix$o, "".concat(classPrefix$o, "-position-").concat(props.position))
4644
- });
4645
- };
4646
- SafeArea.displayName = "NutSafeArea";
4647
4648
  function _instanceof(left, right) {
4648
4649
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
4649
4650
  return !!right[Symbol.hasInstance](left);
@@ -4655,15 +4656,15 @@ Check the top-level render call using <` + t + ">.");
4655
4656
  className: "nut-icon"
4656
4657
  }) : icon;
4657
4658
  };
4658
- var defaultProps$1q = _object_spread_props(_object_spread({}, ComponentDefaults), {
4659
+ var defaultProps$1p = _object_spread_props(_object_spread({}, ComponentDefaults), {
4659
4660
  icon: null,
4660
4661
  onClick: function(event) {
4661
4662
  }
4662
4663
  });
4663
4664
  var classPrefix$n = "nut-hoverbutton-item";
4664
4665
  var HoverButtonItem = function(props) {
4665
- var _$_object_spread = _object_spread({}, defaultProps$1q, props), className = _$_object_spread.className, children = _$_object_spread.children, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick;
4666
- var handleClick2 = function(event) {
4666
+ var _$_object_spread = _object_spread({}, defaultProps$1p, props), className = _$_object_spread.className, children = _$_object_spread.children, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick;
4667
+ var handleClick = function(event) {
4667
4668
  if (onClick) {
4668
4669
  onClick(event);
4669
4670
  }
@@ -4686,15 +4687,15 @@ Check the top-level render call using <` + t + ">.");
4686
4687
  className
4687
4688
  ], _define_property({}, "".concat(classPrefix$n, "-container-icontext"), icon && children)),
4688
4689
  style,
4689
- onClick: handleClick2
4690
+ onClick: handleClick
4690
4691
  }, renderBody());
4691
4692
  };
4692
4693
  HoverButtonItem.displayName = "NutHoverButtonItem";
4693
4694
  var UI_BOTTOM_DISTANCE = 60;
4694
- var defaultProps$1p = _object_spread({}, ComponentDefaults);
4695
+ var defaultProps$1o = _object_spread({}, ComponentDefaults);
4695
4696
  var classPrefix$m = "nut-hoverbutton";
4696
4697
  var HoverButton = function(props) {
4697
- var _$_object_spread = _object_spread({}, defaultProps$1p, props), children = _$_object_spread.children, zIndex = _$_object_spread.zIndex, tabbarHeight = _$_object_spread.tabbarHeight, className = _$_object_spread.className, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick;
4698
+ var _$_object_spread = _object_spread({}, defaultProps$1o, props), children = _$_object_spread.children, zIndex = _$_object_spread.zIndex, tabbarHeight = _$_object_spread.tabbarHeight, className = _$_object_spread.className, style = _$_object_spread.style, icon = _$_object_spread.icon, onClick = _$_object_spread.onClick;
4698
4699
  var rtl = useRtl();
4699
4700
  var baseStyle = _object_spread({}, style);
4700
4701
  if (tabbarHeight) {
@@ -4721,14 +4722,14 @@ Check the top-level render call using <` + t + ">.");
4721
4722
  };
4722
4723
  HoverButton.displayName = "NutHoverButton";
4723
4724
  HoverButton.Item = HoverButtonItem;
4724
- var defaultProps$1o = _object_spread_props(_object_spread({}, ComponentDefaults), {
4725
+ var defaultProps$1n = _object_spread_props(_object_spread({}, ComponentDefaults), {
4725
4726
  target: "",
4726
4727
  threshold: 200,
4727
4728
  zIndex: 900,
4728
4729
  duration: 1e3
4729
4730
  });
4730
4731
  var BackTop = function(props) {
4731
- var _$_object_spread = _object_spread({}, defaultProps$1o, props), children = _$_object_spread.children, target = _$_object_spread.target, threshold = _$_object_spread.threshold, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, duration = _$_object_spread.duration, icon = _$_object_spread.icon, style = _$_object_spread.style, onClick = _$_object_spread.onClick;
4732
+ var _$_object_spread = _object_spread({}, defaultProps$1n, props), children = _$_object_spread.children, target = _$_object_spread.target, threshold = _$_object_spread.threshold, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, duration = _$_object_spread.duration, icon = _$_object_spread.icon, style = _$_object_spread.style, onClick = _$_object_spread.onClick;
4732
4733
  var classPrefix2 = "nut-backtop";
4733
4734
  var _useState = _sliced_to_array(React.useState(false), 2), backTop = _useState[0], setBackTop = _useState[1];
4734
4735
  var _useState1 = _sliced_to_array(React.useState(0), 2), scrollTop = _useState1[0], setScrollTop = _useState1[1];
@@ -6833,7 +6834,7 @@ Please add \`${key2}Action\` when creating your handler.`);
6833
6834
  }
6834
6835
  }
6835
6836
  }
6836
- const toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
6837
+ const toArray$1 = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
6837
6838
  function flush(queue, iterator) {
6838
6839
  if (queue.size) {
6839
6840
  const items = Array.from(queue);
@@ -7841,7 +7842,7 @@ Please add \`${key2}Action\` when creating your handler.`);
7841
7842
  function callProp(value2, ...args) {
7842
7843
  return is.fun(value2) ? value2(...args) : value2;
7843
7844
  }
7844
- const matchProp = (value2, key2) => value2 === true || !!(key2 && value2 && (is.fun(value2) ? value2(key2) : toArray(value2).includes(key2)));
7845
+ const matchProp = (value2, key2) => value2 === true || !!(key2 && value2 && (is.fun(value2) ? value2(key2) : toArray$1(value2).includes(key2)));
7845
7846
  const resolveProp = (prop, key2) => is.obj(prop) ? key2 && prop[key2] : prop;
7846
7847
  const getDefaultProp = (props, key2) => props.default === true ? props[key2] : props.default ? props.default[key2] : void 0;
7847
7848
  const noopTransform = (value2) => value2;
@@ -8383,7 +8384,7 @@ Please add \`${key2}Action\` when creating your handler.`);
8383
8384
  } = anim;
8384
8385
  const payload = getPayload(anim.to);
8385
8386
  if (!payload && hasFluidValue(anim.to)) {
8386
- toValues = toArray(getFluidValue(anim.to));
8387
+ toValues = toArray$1(getFluidValue(anim.to));
8387
8388
  }
8388
8389
  anim.values.forEach((node2, i2) => {
8389
8390
  if (node2.done) return;
@@ -8736,7 +8737,7 @@ Please add \`${key2}Action\` when creating your handler.`);
8736
8737
  if (!hasAsyncTo) {
8737
8738
  if (started || hasFluidValue(prevTo)) {
8738
8739
  anim.values = node.getPayload();
8739
- anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
8740
+ anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray$1(goal);
8740
8741
  }
8741
8742
  if (anim.immediate != immediate) {
8742
8743
  anim.immediate = immediate;
@@ -9009,7 +9010,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9009
9010
  queue
9010
9011
  } = this;
9011
9012
  if (props) {
9012
- queue = toArray(props).map(createUpdate);
9013
+ queue = toArray$1(props).map(createUpdate);
9013
9014
  } else {
9014
9015
  this.queue = [];
9015
9016
  }
@@ -9025,7 +9026,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9025
9026
  }
9026
9027
  if (keys) {
9027
9028
  const springs = this.springs;
9028
- each(toArray(keys), (key2) => springs[key2].stop(!!arg));
9029
+ each(toArray$1(keys), (key2) => springs[key2].stop(!!arg));
9029
9030
  } else {
9030
9031
  stopAsync(this._state, this._lastAsyncId);
9031
9032
  this.each((spring) => spring.stop(!!arg));
@@ -9039,7 +9040,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9039
9040
  });
9040
9041
  } else {
9041
9042
  const springs = this.springs;
9042
- each(toArray(keys), (key2) => springs[key2].pause());
9043
+ each(toArray$1(keys), (key2) => springs[key2].pause());
9043
9044
  }
9044
9045
  return this;
9045
9046
  }
@@ -9050,7 +9051,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9050
9051
  });
9051
9052
  } else {
9052
9053
  const springs = this.springs;
9053
- each(toArray(keys), (key2) => springs[key2].resume());
9054
+ each(toArray$1(keys), (key2) => springs[key2].resume());
9054
9055
  }
9055
9056
  return this;
9056
9057
  }
@@ -9201,7 +9202,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9201
9202
  function getSprings(ctrl, props) {
9202
9203
  const springs = _extends$1({}, ctrl.springs);
9203
9204
  if (props) {
9204
- each(toArray(props), (props2) => {
9205
+ each(toArray$1(props), (props2) => {
9205
9206
  if (is.und(props2.keys)) {
9206
9207
  props2 = createUpdate(props2);
9207
9208
  }
@@ -9473,7 +9474,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9473
9474
  }
9474
9475
  }
9475
9476
  _get() {
9476
- const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
9477
+ const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray$1(getFluidValue(this.source));
9477
9478
  return this.calc(...inputs);
9478
9479
  }
9479
9480
  _start() {
@@ -9492,7 +9493,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9492
9493
  }
9493
9494
  _attach() {
9494
9495
  let priority2 = 1;
9495
- each(toArray(this.source), (source) => {
9496
+ each(toArray$1(this.source), (source) => {
9496
9497
  if (hasFluidValue(source)) {
9497
9498
  addFluidObserver(source, this);
9498
9499
  }
@@ -9507,7 +9508,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9507
9508
  this._start();
9508
9509
  }
9509
9510
  _detach() {
9510
- each(toArray(this.source), (source) => {
9511
+ each(toArray$1(this.source), (source) => {
9511
9512
  if (hasFluidValue(source)) {
9512
9513
  removeFluidObserver(source, this);
9513
9514
  }
@@ -9526,7 +9527,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9526
9527
  } else if (event.type == "idle") {
9527
9528
  this._active.delete(event.parent);
9528
9529
  } else if (event.type == "priority") {
9529
- this.priority = toArray(this.source).reduce((highest, parent2) => Math.max(highest, (isFrameValue(parent2) ? parent2.priority : 0) + 1), 0);
9530
+ this.priority = toArray$1(this.source).reduce((highest, parent2) => Math.max(highest, (isFrameValue(parent2) ? parent2.priority : 0) + 1), 0);
9530
9531
  }
9531
9532
  }
9532
9533
  }
@@ -9688,7 +9689,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9688
9689
  delete style[key2];
9689
9690
  if (is.und(value2)) return;
9690
9691
  const unit = pxTransforms.test(key2) ? "px" : degTransforms.test(key2) ? "deg" : "";
9691
- inputs.push(toArray(value2));
9692
+ inputs.push(toArray$1(value2));
9692
9693
  transforms.push(key2 === "rotate3d" ? ([x2, y2, z2, deg]) => [`rotate3d(${x2},${y2},${z2},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`${key2}(${input.map((v) => addUnit(v, unit)).join(",")})`, isValueIdentity(input, key2.startsWith("scale") ? 1 : 0)]);
9693
9694
  }
9694
9695
  });
@@ -9749,7 +9750,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9749
9750
  });
9750
9751
  const animated = host.animated;
9751
9752
  var elevatorContext = /* @__PURE__ */ React.createContext({});
9752
- var defaultProps$1n = _object_spread_props(_object_spread({}, ComponentDefaults), {
9753
+ var defaultProps$1m = _object_spread_props(_object_spread({}, ComponentDefaults), {
9753
9754
  height: "200px",
9754
9755
  floorKey: "title",
9755
9756
  list: [],
@@ -9759,7 +9760,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9759
9760
  showKeys: true
9760
9761
  });
9761
9762
  var Elevator = function(props) {
9762
- var _ref = _object_spread({}, defaultProps$1n, props), height2 = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight;
9763
+ var _ref = _object_spread({}, defaultProps$1m, props), height2 = _ref.height, floorKey = _ref.floorKey, list = _ref.list, sticky = _ref.sticky, spaceHeight = _ref.spaceHeight;
9763
9764
  _ref.titleHeight;
9764
9765
  var showKeys = _ref.showKeys, className = _ref.className, style = _ref.style, onItemClick = _ref.onItemClick, onIndexClick = _ref.onIndexClick, children = _ref.children, rest = _object_without_properties(_ref, [
9765
9766
  "height",
@@ -9955,7 +9956,62 @@ Please add \`${key2}Action\` when creating your handler.`);
9955
9956
  };
9956
9957
  Elevator.displayName = "NutElevator";
9957
9958
  Elevator.Context = elevatorContext;
9958
- var defaultProps$1m = _object_spread_props(_object_spread({}, defaultOverlayProps), {
9959
+ function _type_of(obj) {
9960
+ "@swc/helpers - typeof";
9961
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
9962
+ }
9963
+ var defaultProps$1l = _object_spread_props(_object_spread({}, ComponentDefaults), {
9964
+ value: "",
9965
+ dot: false,
9966
+ max: 99,
9967
+ top: 0,
9968
+ right: 0,
9969
+ fill: "solid",
9970
+ size: "large"
9971
+ });
9972
+ var Badge = function(props) {
9973
+ var isIcon = function isIcon2() {
9974
+ if ((typeof value2 === "undefined" ? "undefined" : _type_of(value2)) === "object" && value2) return value2;
9975
+ };
9976
+ var isNumber = function isNumber2() {
9977
+ if (typeof value2 === "number" && value2) return value2;
9978
+ };
9979
+ var isString = function isString2() {
9980
+ if (typeof value2 === "string" && value2) return value2;
9981
+ };
9982
+ var _this;
9983
+ var rtl = useRtl();
9984
+ var _$_object_spread = _object_spread({}, defaultProps$1l, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
9985
+ var classPrefix2 = "nut-badge";
9986
+ var classes = classNames(classPrefix2, className);
9987
+ var getContent = function() {
9988
+ if (dot || value2 === 0) return null;
9989
+ if (typeof value2 === "number") {
9990
+ return max < value2 ? "".concat(max, "+") : "".concat(value2);
9991
+ }
9992
+ return value2;
9993
+ };
9994
+ var _obj;
9995
+ var contentClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-sup"), isNumber() || isString() || dot), _define_property(_obj, "".concat(classPrefix2, "-number"), isNumber()), _define_property(_obj, "".concat(classPrefix2, "-one"), typeof getContent() === "string" && ((_this = "".concat(getContent())) === null || _this === void 0 ? void 0 : _this.length) === 1), _define_property(_obj, "".concat(classPrefix2, "-dot"), dot), _define_property(_obj, "".concat(classPrefix2, "-dot-").concat(size), dot), _define_property(_obj, "".concat(classPrefix2, "-").concat(fill), fill === "outline"), _define_property(_obj, "".concat(classPrefix2, "-content"), children), _obj));
9996
+ var getPositionStyle = function() {
9997
+ return _define_property({
9998
+ top: "".concat(Number(top) || 0, "px")
9999
+ }, rtl ? "left" : "right", "".concat(Number(right) || 0, "px"));
10000
+ };
10001
+ var _obj1;
10002
+ return /* @__PURE__ */ React.createElement("div", {
10003
+ className: classes,
10004
+ style
10005
+ }, isIcon() && /* @__PURE__ */ React.createElement("div", {
10006
+ className: classNames("".concat(classPrefix2, "-content"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix2, "-icon"), true), _define_property(_obj1, "".concat(classPrefix2, "-icon-rtl"), rtl), _obj1)),
10007
+ style: getPositionStyle()
10008
+ }, value2), children, !isIcon() && (getContent() || dot) && /* @__PURE__ */ React.createElement("div", {
10009
+ className: contentClasses,
10010
+ style: getPositionStyle()
10011
+ }, getContent()));
10012
+ };
10013
+ Badge.displayName = "NutBadge";
10014
+ var defaultProps$1k = _object_spread_props(_object_spread({}, defaultOverlayProps), {
9959
10015
  activeText: "",
9960
10016
  inactiveText: "",
9961
10017
  type: "right",
@@ -9973,7 +10029,7 @@ Please add \`${key2}Action\` when creating your handler.`);
9973
10029
  });
9974
10030
  var FixedNav = function(props) {
9975
10031
  var locale = useConfig().locale;
9976
- var _ref = _object_spread({}, defaultProps$1m, props), overlay = _ref.overlay, visible = _ref.visible, list = _ref.list, activeText = _ref.activeText, inactiveText = _ref.inactiveText, position2 = _ref.position, type2 = _ref.type, children = _ref.children, style = _ref.style, className = _ref.className, content2 = _ref.content, zIndex = _ref.zIndex, onChange = _ref.onChange, onSelect = _ref.onSelect, rest = _object_without_properties(_ref, [
10032
+ var _ref = _object_spread({}, defaultProps$1k, props), overlay = _ref.overlay, visible = _ref.visible, list = _ref.list, activeText = _ref.activeText, inactiveText = _ref.inactiveText, position2 = _ref.position, type2 = _ref.type, children = _ref.children, style = _ref.style, className = _ref.className, content2 = _ref.content, zIndex = _ref.zIndex, onChange = _ref.onChange, onSelect = _ref.onSelect, rest = _object_without_properties(_ref, [
9977
10033
  "overlay",
9978
10034
  "visible",
9979
10035
  "list",
@@ -9993,6 +10049,20 @@ Please add \`${key2}Action\` when creating your handler.`);
9993
10049
  var classes = classNames(classPrefix2, {
9994
10050
  active: visible
9995
10051
  }, type2, className);
10052
+ var renderListItem = function(item, index2) {
10053
+ return /* @__PURE__ */ React.createElement("div", {
10054
+ className: "".concat(classPrefix2, "-list-item"),
10055
+ onClick: function(event) {
10056
+ return onSelect(item, event);
10057
+ },
10058
+ key: item.id || index2
10059
+ }, /* @__PURE__ */ React.isValidElement(item.icon) ? item.icon : /* @__PURE__ */ React.createElement("img", {
10060
+ src: item.icon,
10061
+ alt: ""
10062
+ }), /* @__PURE__ */ React.createElement("div", {
10063
+ className: "".concat(classPrefix2, "-list-text")
10064
+ }, item.text));
10065
+ };
9996
10066
  return /* @__PURE__ */ React.createElement("div", _object_spread({
9997
10067
  className: classes,
9998
10068
  style: _object_spread({}, position2, style)
@@ -10007,20 +10077,11 @@ Please add \`${key2}Action\` when creating your handler.`);
10007
10077
  }, children || /* @__PURE__ */ React.createElement("div", {
10008
10078
  className: "".concat(classPrefix2, "-list")
10009
10079
  }, list.map(function(item, index2) {
10010
- return /* @__PURE__ */ React.createElement("div", {
10011
- className: "".concat(classPrefix2, "-list-item"),
10012
- onClick: function(event) {
10013
- return onSelect(item, event);
10014
- },
10015
- key: item.id || index2
10016
- }, /* @__PURE__ */ React.isValidElement(item.icon) ? item.icon : /* @__PURE__ */ React.createElement("img", {
10017
- src: item.icon,
10018
- alt: ""
10019
- }), /* @__PURE__ */ React.createElement("div", {
10020
- className: "".concat(classPrefix2, "-list-text")
10021
- }, item.text), item.num && /* @__PURE__ */ React.createElement("div", {
10022
- className: "b"
10023
- }, item.num));
10080
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, item.num ? /* @__PURE__ */ React.createElement(Badge, {
10081
+ value: item.num,
10082
+ top: 8,
10083
+ right: 6
10084
+ }, renderListItem(item, index2)) : /* @__PURE__ */ React.createElement(React.Fragment, null, renderListItem(item, index2)));
10024
10085
  }))), /* @__PURE__ */ React.createElement("div", {
10025
10086
  className: "".concat(classPrefix2, "-btn"),
10026
10087
  onClick: function() {
@@ -10033,7 +10094,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10033
10094
  }, visible ? activeText || locale.fixednav.activeText : inactiveText || locale.fixednav.inactiveText))));
10034
10095
  };
10035
10096
  FixedNav.displayName = "NutFixedNav";
10036
- var defaultProps$1l = _object_spread_props(_object_spread({}, ComponentDefaults), {
10097
+ var defaultProps$1j = _object_spread_props(_object_spread({}, ComponentDefaults), {
10037
10098
  left: "",
10038
10099
  right: "",
10039
10100
  back: "",
@@ -10043,7 +10104,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10043
10104
  zIndex: 10
10044
10105
  });
10045
10106
  var NavBar = function(props) {
10046
- var _$_object_spread = _object_spread({}, defaultProps$1l, props), right = _$_object_spread.right, left = _$_object_spread.left, title = _$_object_spread.title, className = _$_object_spread.className, style = _$_object_spread.style, back = _$_object_spread.back, fixed = _$_object_spread.fixed, safeAreaInsetTop = _$_object_spread.safeAreaInsetTop, placeholder = _$_object_spread.placeholder, zIndex = _$_object_spread.zIndex, onBackClick = _$_object_spread.onBackClick;
10107
+ var _$_object_spread = _object_spread({}, defaultProps$1j, props), right = _$_object_spread.right, left = _$_object_spread.left, title = _$_object_spread.title, className = _$_object_spread.className, style = _$_object_spread.style, back = _$_object_spread.back, fixed = _$_object_spread.fixed, safeAreaInsetTop = _$_object_spread.safeAreaInsetTop, placeholder = _$_object_spread.placeholder, zIndex = _$_object_spread.zIndex, onBackClick = _$_object_spread.onBackClick;
10047
10108
  var classPrefix2 = "nut-navbar";
10048
10109
  var rtl = useRtl();
10049
10110
  var children = Array.isArray(props.children) ? props.children : [
@@ -10093,217 +10154,6 @@ Please add \`${key2}Action\` when creating your handler.`);
10093
10154
  }, renderWrapper()) : renderWrapper());
10094
10155
  };
10095
10156
  NavBar.displayName = "NutNavBar";
10096
- var defaultProps$1k = _object_spread_props(_object_spread({}, defaultOverlayProps), {
10097
- position: "center",
10098
- transition: "",
10099
- overlayStyle: {},
10100
- overlayClassName: "",
10101
- closeable: false,
10102
- closeIconPosition: "top-right",
10103
- closeIcon: "close",
10104
- destroyOnClose: false,
10105
- portal: null,
10106
- overlay: true,
10107
- round: false,
10108
- onOpen: function() {
10109
- },
10110
- onClose: function() {
10111
- },
10112
- onOverlayClick: function() {
10113
- return true;
10114
- },
10115
- onCloseIconClick: function() {
10116
- return true;
10117
- }
10118
- });
10119
- var _zIndex = 1100;
10120
- var Popup = function(props) {
10121
- var _$_object_spread = _object_spread({}, defaultProps$1k, 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, position2 = _$_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;
10122
- var nodeRef = React.useRef(null);
10123
- var innerIndex = zIndex || _zIndex;
10124
- var _useState = _sliced_to_array(React.useState(innerIndex), 2), index2 = _useState[0], setIndex = _useState[1];
10125
- var _useState1 = _sliced_to_array(React.useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
10126
- var _useState2 = _sliced_to_array(React.useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
10127
- var _useState3 = _sliced_to_array(React.useState(""), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
10128
- useLockScroll(nodeRef, innerVisible && lockScroll);
10129
- var classPrefix2 = "nut-popup";
10130
- var overlayStyles = _object_spread({}, overlayStyle);
10131
- var popStyles = _object_spread_props(_object_spread({}, style), {
10132
- zIndex: index2
10133
- });
10134
- var _obj;
10135
- var popClassName = classNames(classPrefix2, (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-round"), round || position2 === "bottom"), _define_property(_obj, "".concat(classPrefix2, "-").concat(position2), true), _obj), className);
10136
- var open = function() {
10137
- if (!innerVisible) {
10138
- setInnerVisible(true);
10139
- setIndex(++innerIndex);
10140
- }
10141
- if (destroyOnClose) {
10142
- setShowChildren(true);
10143
- }
10144
- onOpen && onOpen();
10145
- };
10146
- var close = function() {
10147
- if (innerVisible) {
10148
- setInnerVisible(false);
10149
- if (destroyOnClose) {
10150
- setTimeout(function() {
10151
- setShowChildren(false);
10152
- }, Number(duration));
10153
- }
10154
- onClose && onClose();
10155
- }
10156
- };
10157
- var handleOverlayClick = function(e2) {
10158
- e2.stopPropagation();
10159
- if (closeOnOverlayClick && onOverlayClick(e2)) {
10160
- close();
10161
- }
10162
- };
10163
- var handleCloseIconClick = function(e2) {
10164
- onCloseIconClick(e2) && close();
10165
- };
10166
- var renderCloseIcon = function() {
10167
- var closeClasses = classNames("".concat(classPrefix2, "-title-right"), "".concat(classPrefix2, "-title-right-").concat(closeIconPosition));
10168
- return /* @__PURE__ */ React.createElement(React.Fragment, null, closeable && /* @__PURE__ */ React.createElement("div", {
10169
- className: closeClasses,
10170
- onClick: handleCloseIconClick
10171
- }, /* @__PURE__ */ React.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React.createElement(n$6, null)));
10172
- };
10173
- var renderTitle = function() {
10174
- if (left || title || description) {
10175
- return /* @__PURE__ */ React.createElement("div", {
10176
- className: "".concat(classPrefix2, "-title")
10177
- }, position2 === "bottom" && /* @__PURE__ */ React.createElement(React.Fragment, null, left && /* @__PURE__ */ React.createElement("div", {
10178
- className: "".concat(classPrefix2, "-title-left")
10179
- }, left), (title || description) && /* @__PURE__ */ React.createElement("div", {
10180
- className: "".concat(classPrefix2, "-title-wrapper")
10181
- }, title && /* @__PURE__ */ React.createElement("div", {
10182
- className: "".concat(classPrefix2, "-title-title")
10183
- }, title), description && /* @__PURE__ */ React.createElement("div", {
10184
- className: "".concat(classPrefix2, "-title-description ").concat(title ? "".concat(classPrefix2, "-title-description-gap") : "")
10185
- }, description))), renderCloseIcon());
10186
- }
10187
- if (closeable) {
10188
- return renderCloseIcon();
10189
- }
10190
- };
10191
- var renderPop = function() {
10192
- return /* @__PURE__ */ React.createElement(CSSTransition, {
10193
- nodeRef,
10194
- classNames: transitionName,
10195
- mountOnEnter: true,
10196
- unmountOnExit: destroyOnClose,
10197
- timeout: duration,
10198
- in: innerVisible,
10199
- onEntered: afterShow,
10200
- onExited: afterClose
10201
- }, /* @__PURE__ */ React.createElement("div", {
10202
- ref: nodeRef,
10203
- style: popStyles,
10204
- className: popClassName,
10205
- onClick
10206
- }, renderTitle(), showChildren && children));
10207
- };
10208
- var renderNode = function() {
10209
- return /* @__PURE__ */ React.createElement(React.Fragment, null, overlay && /* @__PURE__ */ React.createElement(Overlay, {
10210
- zIndex: index2,
10211
- style: overlayStyles,
10212
- className: overlayClassName,
10213
- visible: innerVisible,
10214
- closeOnOverlayClick,
10215
- lockScroll,
10216
- duration,
10217
- onClick: handleOverlayClick
10218
- }), renderPop());
10219
- };
10220
- React.useEffect(function() {
10221
- visible ? open() : close();
10222
- }, [
10223
- visible
10224
- ]);
10225
- React.useEffect(function() {
10226
- setTransitionName(transition || "".concat(classPrefix2, "-slide-").concat(position2));
10227
- }, [
10228
- position2,
10229
- transition
10230
- ]);
10231
- var resolveContainer = function(getContainer) {
10232
- return (typeof getContainer === "function" ? getContainer() : getContainer) || document.body;
10233
- };
10234
- var renderToContainer = function(getContainer, node) {
10235
- if (getContainer) {
10236
- var container = resolveContainer(getContainer);
10237
- return /* @__PURE__ */ ReactDOM.createPortal(node, container);
10238
- }
10239
- return node;
10240
- };
10241
- return /* @__PURE__ */ React.createElement(React.Fragment, null, renderToContainer(portal, renderNode()));
10242
- };
10243
- Popup.displayName = "NutPopup";
10244
- var handleClick = function(e2) {
10245
- e2.stopPropagation();
10246
- var isIcon = e2.target.className.includes("arrow-icon");
10247
- var isTitle = e2.target.className.includes("-title") || isIcon;
10248
- var currentClass = e2.currentTarget.className;
10249
- var isShow = currentClass.includes("sidenavbar-show");
10250
- var arrowIcon = e2.currentTarget.querySelector(".arrow-icon");
10251
- var iconClass = arrowIcon.className;
10252
- if (isTitle) {
10253
- e2.currentTarget.className = isShow ? currentClass.replace("sidenavbar-show", "sidenavbar-hide") : currentClass.replace("sidenavbar-hide", "sidenavbar-show");
10254
- arrowIcon.className = isShow ? iconClass.replace("arrow-down", "arrow-up") : iconClass.replace("arrow-up", "arrow-down");
10255
- }
10256
- };
10257
- var OffsetContext = React.createContext(20);
10258
- var defaultProps$1j = _object_spread_props(_object_spread({}, ComponentDefaults), {
10259
- position: "left",
10260
- width: "80%"
10261
- });
10262
- var SideNavBar = function(props) {
10263
- React.useEffect(function() {
10264
- console.warn("Warning: SideNavBar is deprecated and will be removed in future versions. Please use NewComponent SideBar instead.");
10265
- }, []);
10266
- var classPrefix2 = "nut-sidenavbar";
10267
- var _ref = _object_spread({}, defaultProps$1j, props), title = _ref.title, visible = _ref.visible, width2 = _ref.width, position2 = _ref.position, children = _ref.children, className = _ref.className, onClose = _ref.onClose, indent = _ref.indent, rest = _object_without_properties(_ref, [
10268
- "title",
10269
- "visible",
10270
- "width",
10271
- "position",
10272
- "children",
10273
- "className",
10274
- "onClose",
10275
- "indent"
10276
- ]);
10277
- var innerIndent = indent ? Number(indent) : 20;
10278
- return /* @__PURE__ */ React.createElement(Popup, {
10279
- visible,
10280
- style: {
10281
- width: width2,
10282
- height: "100%"
10283
- },
10284
- position: position2,
10285
- onClose
10286
- }, /* @__PURE__ */ React.createElement("div", _object_spread({
10287
- className: classNames(classPrefix2, className)
10288
- }, rest), /* @__PURE__ */ React.createElement("div", {
10289
- className: "".concat(classPrefix2, "-content")
10290
- }, /* @__PURE__ */ React.createElement("div", {
10291
- className: "".concat(classPrefix2, "-list sidenavbar-show"),
10292
- onClick: handleClick
10293
- }, /* @__PURE__ */ React.createElement("div", {
10294
- className: "".concat(classPrefix2, "-title ").concat(classPrefix2, "-border-bt"),
10295
- style: {
10296
- paddingLeft: "".concat(innerIndent, "px")
10297
- }
10298
- }, title, " ", /* @__PURE__ */ React.createElement("i", {
10299
- className: "arrow-icon arrow-down"
10300
- })), /* @__PURE__ */ React.createElement(OffsetContext.Provider, {
10301
- value: innerIndent
10302
- }, /* @__PURE__ */ React.createElement("div", {
10303
- className: "".concat(classPrefix2, "-content")
10304
- }, children))))));
10305
- };
10306
- SideNavBar.displayName = "NutSideNavBar";
10307
10157
  function mergeProps() {
10308
10158
  for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
10309
10159
  items[_key] = arguments[_key];
@@ -10512,157 +10362,8 @@ Please add \`${key2}Action\` when creating your handler.`);
10512
10362
  };
10513
10363
  SideBar.displayName = "NutSideBar";
10514
10364
  SideBar.Item = SideBarItem;
10515
- var SideNavBarItem = function(props) {
10516
- var classPrefix2 = "nut-subsidenavbar";
10517
- var title = props.title, value2 = props.value;
10518
- props.children;
10519
- var onClick = props.onClick, rest = _object_without_properties(props, [
10520
- "title",
10521
- "value",
10522
- "children",
10523
- "onClick"
10524
- ]);
10525
- var clickFn = function(e2) {
10526
- e2.stopPropagation();
10527
- onClick && onClick({
10528
- title,
10529
- value: value2
10530
- });
10531
- };
10532
- return /* @__PURE__ */ React.createElement("div", _object_spread({
10533
- className: "".concat(classPrefix2, "-item ").concat(classPrefix2, "-border-bt"),
10534
- onClick: clickFn
10535
- }, rest), title);
10536
- };
10537
- var defaultProps$1g = {
10538
- open: true
10539
- };
10540
- var SubSideNavBar = function(props) {
10541
- var classPrefix2 = "nut-subsidenavbar";
10542
- var _ref = _object_spread({}, defaultProps$1g, props), title = _ref.title, value2 = _ref.value, children = _ref.children, onClick = _ref.onClick, open = _ref.open, rest = _object_without_properties(_ref, [
10543
- "title",
10544
- "value",
10545
- "children",
10546
- "onClick",
10547
- "open"
10548
- ]);
10549
- var offset = React.useContext(OffsetContext);
10550
- var listRef = React.useRef(null);
10551
- var setListLevel = React.useCallback(function(nodeList) {
10552
- var level = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
10553
- var titleClass = nodeList[0].className;
10554
- if (titleClass.includes("".concat(classPrefix2, "-title"))) {
10555
- var left = offset * (level + 1);
10556
- nodeList[0].style.paddingLeft = "".concat(left, "px");
10557
- }
10558
- var childNodes = nodeList[1] && nodeList[1].children && Array.from(nodeList[1].children).filter(function(item) {
10559
- return item.nodeType !== 3 && item.nodeType !== 8;
10560
- });
10561
- childNodes.forEach(function(item) {
10562
- var itemClass = item.className;
10563
- if (itemClass.includes("".concat(classPrefix2, "-item"))) {
10564
- var left2 = offset * (level + 2);
10565
- item.style.paddingLeft = "".concat(left2, "px");
10566
- }
10567
- if (itemClass.includes("".concat(classPrefix2, "-list"))) {
10568
- var level1 = item.getAttribute("level") ? Number(item.getAttribute("level")) : 1;
10569
- level1 += 1;
10570
- item.setAttribute("level", level1.toString());
10571
- item.children && setListLevel(item.children, level1);
10572
- }
10573
- });
10574
- }, [
10575
- offset
10576
- ]);
10577
- var clickFn = function(e2) {
10578
- handleClick(e2);
10579
- var currentClass = e2.currentTarget.className;
10580
- var isShow = currentClass.includes("sidenavbar-show");
10581
- onClick && onClick({
10582
- title,
10583
- value: value2,
10584
- isShow
10585
- });
10586
- };
10587
- React.useEffect(function() {
10588
- var _listRef_current, _listRef_current1;
10589
- var childNodes = (_listRef_current = listRef.current) === null || _listRef_current === void 0 ? void 0 : _listRef_current.children;
10590
- (_listRef_current1 = listRef.current) === null || _listRef_current1 === void 0 ? void 0 : _listRef_current1.setAttribute("level", "1");
10591
- childNodes && setListLevel(childNodes);
10592
- }, [
10593
- setListLevel
10594
- ]);
10595
- var divClass = open ? "".concat(classPrefix2, "-list sidenavbar-show") : "".concat(classPrefix2, "-list sidenavbar-hide");
10596
- var iconClass = open ? "arrow-icon arrow-down" : "arrow-icon arrow-up";
10597
- return /* @__PURE__ */ React.createElement("div", _object_spread({
10598
- className: divClass,
10599
- ref: listRef,
10600
- onClick: clickFn
10601
- }, rest), /* @__PURE__ */ React.createElement("div", {
10602
- className: "".concat(classPrefix2, "-title ").concat(classPrefix2, "-border-bt")
10603
- }, title, " ", /* @__PURE__ */ React.createElement("i", {
10604
- className: iconClass
10605
- })), /* @__PURE__ */ React.createElement("div", {
10606
- className: "".concat(classPrefix2, "-content")
10607
- }, children));
10608
- };
10609
- function _type_of(obj) {
10610
- "@swc/helpers - typeof";
10611
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
10612
- }
10613
- var defaultProps$1f = _object_spread_props(_object_spread({}, ComponentDefaults), {
10614
- value: "",
10615
- dot: false,
10616
- max: 99,
10617
- top: 0,
10618
- right: 0,
10619
- fill: "solid",
10620
- size: "large"
10621
- });
10622
- var Badge = function(props) {
10623
- var isIcon = function isIcon2() {
10624
- if ((typeof value2 === "undefined" ? "undefined" : _type_of(value2)) === "object" && value2) return value2;
10625
- };
10626
- var isNumber = function isNumber2() {
10627
- if (typeof value2 === "number" && value2) return value2;
10628
- };
10629
- var isString = function isString2() {
10630
- if (typeof value2 === "string" && value2) return value2;
10631
- };
10632
- var _this;
10633
- var rtl = useRtl();
10634
- var _$_object_spread = _object_spread({}, defaultProps$1f, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
10635
- var classPrefix2 = "nut-badge";
10636
- var classes = classNames(classPrefix2, className);
10637
- var getContent = function() {
10638
- if (dot || value2 === 0) return null;
10639
- if (typeof value2 === "number") {
10640
- return max < value2 ? "".concat(max, "+") : "".concat(value2);
10641
- }
10642
- return value2;
10643
- };
10644
- var _obj;
10645
- var contentClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-sup"), isNumber() || isString() || dot), _define_property(_obj, "".concat(classPrefix2, "-number"), isNumber()), _define_property(_obj, "".concat(classPrefix2, "-one"), typeof getContent() === "string" && ((_this = "".concat(getContent())) === null || _this === void 0 ? void 0 : _this.length) === 1), _define_property(_obj, "".concat(classPrefix2, "-dot"), dot), _define_property(_obj, "".concat(classPrefix2, "-dot-").concat(size), dot), _define_property(_obj, "".concat(classPrefix2, "-").concat(fill), fill === "outline"), _define_property(_obj, "".concat(classPrefix2, "-content"), children), _obj));
10646
- var getPositionStyle = function() {
10647
- return _define_property({
10648
- top: "".concat(Number(top) || 0, "px")
10649
- }, rtl ? "left" : "right", "".concat(Number(right) || 0, "px"));
10650
- };
10651
- var _obj1;
10652
- return /* @__PURE__ */ React.createElement("div", {
10653
- className: classes,
10654
- style
10655
- }, isIcon() && /* @__PURE__ */ React.createElement("div", {
10656
- className: classNames("".concat(classPrefix2, "-content"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix2, "-icon"), true), _define_property(_obj1, "".concat(classPrefix2, "-icon-rtl"), rtl), _obj1)),
10657
- style: getPositionStyle()
10658
- }, value2), children, !isIcon() && (getContent() || dot) && /* @__PURE__ */ React.createElement("div", {
10659
- className: contentClasses,
10660
- style: getPositionStyle()
10661
- }, getContent()));
10662
- };
10663
- Badge.displayName = "NutBadge";
10664
10365
  const TabbarContext = React.createContext(null);
10665
- var defaultProps$1e = _object_spread_props(_object_spread({}, ComponentDefaults), {
10366
+ var defaultProps$1g = _object_spread_props(_object_spread({}, ComponentDefaults), {
10666
10367
  title: "",
10667
10368
  icon: null,
10668
10369
  value: "",
@@ -10673,7 +10374,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10673
10374
  });
10674
10375
  var TabbarItem = function(props) {
10675
10376
  var ctx2 = React.useContext(TabbarContext);
10676
- var _ref = _object_spread({}, defaultProps$1e, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value2 = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right = _ref.right, index2 = _ref.index, rest = _object_without_properties(_ref, [
10377
+ var _ref = _object_spread({}, defaultProps$1g, props), className = _ref.className, style = _ref.style, title = _ref.title, icon = _ref.icon, value2 = _ref.value, dot = _ref.dot, max = _ref.max, top = _ref.top, right = _ref.right, index2 = _ref.index, rest = _object_without_properties(_ref, [
10677
10378
  "className",
10678
10379
  "style",
10679
10380
  "title",
@@ -10715,7 +10416,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10715
10416
  className: boxPrefix
10716
10417
  }, icon)), renderTitleText()) : /* @__PURE__ */ React.createElement(Badge, badgeProps, renderTitleText()));
10717
10418
  };
10718
- var defaultProps$1d = _object_spread_props(_object_spread({}, ComponentDefaults), {
10419
+ var defaultProps$1f = _object_spread_props(_object_spread({}, ComponentDefaults), {
10719
10420
  defaultValue: 0,
10720
10421
  fixed: false,
10721
10422
  inactiveColor: "",
@@ -10725,7 +10426,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10725
10426
  }
10726
10427
  });
10727
10428
  var Tabbar = function(props) {
10728
- var _$_object_spread = _object_spread({}, defaultProps$1d, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value2 = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
10429
+ var _$_object_spread = _object_spread({}, defaultProps$1f, props), children = _$_object_spread.children, defaultValue = _$_object_spread.defaultValue, value2 = _$_object_spread.value, fixed = _$_object_spread.fixed, activeColor = _$_object_spread.activeColor, inactiveColor = _$_object_spread.inactiveColor, safeArea = _$_object_spread.safeArea, className = _$_object_spread.className, style = _$_object_spread.style, onSwitch = _$_object_spread.onSwitch;
10729
10430
  var classPrefix2 = "nut-tabbar";
10730
10431
  var _usePropsValue = _sliced_to_array(usePropsValue({
10731
10432
  value: value2,
@@ -10756,13 +10457,13 @@ Please add \`${key2}Action\` when creating your handler.`);
10756
10457
  };
10757
10458
  Tabbar.displayName = "NutTabbar";
10758
10459
  Tabbar.Item = TabbarItem;
10759
- var defaultProps$1c = {
10460
+ var defaultProps$1e = {
10760
10461
  title: "",
10761
10462
  value: "",
10762
10463
  disabled: false
10763
10464
  };
10764
10465
  var TabPane = function(props) {
10765
- var _$_object_spread = _object_spread({}, defaultProps$1c, props), children = _$_object_spread.children, autoHeightClassName = _$_object_spread.autoHeightClassName, className = _$_object_spread.className, disabled = _$_object_spread.disabled;
10466
+ var _$_object_spread = _object_spread({}, defaultProps$1e, props), children = _$_object_spread.children, autoHeightClassName = _$_object_spread.autoHeightClassName, className = _$_object_spread.className, disabled = _$_object_spread.disabled;
10766
10467
  var classPrefix2 = "nut-tabpane";
10767
10468
  var classes = classNames(classPrefix2, {
10768
10469
  active: !disabled && props.active
@@ -10771,7 +10472,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10771
10472
  className: classes
10772
10473
  }, !disabled && children);
10773
10474
  };
10774
- var defaultProps$1b = _object_spread_props(_object_spread({}, ComponentDefaults), {
10475
+ var defaultProps$1d = _object_spread_props(_object_spread({}, ComponentDefaults), {
10775
10476
  tabStyle: {},
10776
10477
  activeColor: "",
10777
10478
  direction: "horizontal",
@@ -10782,7 +10483,7 @@ Please add \`${key2}Action\` when creating your handler.`);
10782
10483
  var classPrefix$k = "nut-tabs";
10783
10484
  var Tabs = function(props) {
10784
10485
  var rtl = useRtl();
10785
- var _ref = _object_spread({}, defaultProps$1b, props), activeColor = _ref.activeColor, tabStyle = _ref.tabStyle, direction = _ref.direction, activeType = _ref.activeType, duration = _ref.duration, align = _ref.align, title = _ref.title, children = _ref.children, onClick = _ref.onClick, onChange = _ref.onChange, className = _ref.className, autoHeight = _ref.autoHeight, outerValue = _ref.value, outerDefaultValue = _ref.defaultValue, rest = _object_without_properties(_ref, [
10486
+ var _ref = _object_spread({}, defaultProps$1d, props), activeColor = _ref.activeColor, tabStyle = _ref.tabStyle, direction = _ref.direction, activeType = _ref.activeType, duration = _ref.duration, align = _ref.align, title = _ref.title, children = _ref.children, onClick = _ref.onClick, onChange = _ref.onChange, className = _ref.className, autoHeight = _ref.autoHeight, outerValue = _ref.value, outerDefaultValue = _ref.defaultValue, rest = _object_without_properties(_ref, [
10786
10487
  "activeColor",
10787
10488
  "tabStyle",
10788
10489
  "direction",
@@ -10947,6 +10648,154 @@ Please add \`${key2}Action\` when creating your handler.`);
10947
10648
  };
10948
10649
  Tabs.displayName = "NutTabs";
10949
10650
  Tabs.TabPane = TabPane;
10651
+ var defaultProps$1c = _object_spread_props(_object_spread({}, defaultOverlayProps), {
10652
+ position: "center",
10653
+ transition: "",
10654
+ overlayStyle: {},
10655
+ overlayClassName: "",
10656
+ closeable: false,
10657
+ closeIconPosition: "top-right",
10658
+ closeIcon: "close",
10659
+ destroyOnClose: false,
10660
+ portal: null,
10661
+ overlay: true,
10662
+ round: false,
10663
+ onOpen: function() {
10664
+ },
10665
+ onClose: function() {
10666
+ },
10667
+ onOverlayClick: function() {
10668
+ return true;
10669
+ },
10670
+ onCloseIconClick: function() {
10671
+ return true;
10672
+ }
10673
+ });
10674
+ var _zIndex = 1100;
10675
+ var Popup = function(props) {
10676
+ var _$_object_spread = _object_spread({}, defaultProps$1c, 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, position2 = _$_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;
10677
+ var nodeRef = React.useRef(null);
10678
+ var innerIndex = zIndex || _zIndex;
10679
+ var _useState = _sliced_to_array(React.useState(innerIndex), 2), index2 = _useState[0], setIndex = _useState[1];
10680
+ var _useState1 = _sliced_to_array(React.useState(visible), 2), innerVisible = _useState1[0], setInnerVisible = _useState1[1];
10681
+ var _useState2 = _sliced_to_array(React.useState(true), 2), showChildren = _useState2[0], setShowChildren = _useState2[1];
10682
+ var _useState3 = _sliced_to_array(React.useState(""), 2), transitionName = _useState3[0], setTransitionName = _useState3[1];
10683
+ useLockScroll(nodeRef, innerVisible && lockScroll);
10684
+ var classPrefix2 = "nut-popup";
10685
+ var overlayStyles = _object_spread({}, overlayStyle);
10686
+ var popStyles = _object_spread_props(_object_spread({}, style), {
10687
+ zIndex: index2
10688
+ });
10689
+ var _obj;
10690
+ var popClassName = classNames(classPrefix2, (_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-round"), round || position2 === "bottom"), _define_property(_obj, "".concat(classPrefix2, "-").concat(position2), true), _obj), className);
10691
+ var open = function() {
10692
+ if (!innerVisible) {
10693
+ setInnerVisible(true);
10694
+ setIndex(++innerIndex);
10695
+ }
10696
+ if (destroyOnClose) {
10697
+ setShowChildren(true);
10698
+ }
10699
+ onOpen && onOpen();
10700
+ };
10701
+ var close = function() {
10702
+ if (innerVisible) {
10703
+ setInnerVisible(false);
10704
+ if (destroyOnClose) {
10705
+ setTimeout(function() {
10706
+ setShowChildren(false);
10707
+ }, Number(duration));
10708
+ }
10709
+ onClose && onClose();
10710
+ }
10711
+ };
10712
+ var handleOverlayClick = function(e2) {
10713
+ e2.stopPropagation();
10714
+ if (closeOnOverlayClick && onOverlayClick(e2)) {
10715
+ close();
10716
+ }
10717
+ };
10718
+ var handleCloseIconClick = function(e2) {
10719
+ onCloseIconClick(e2) && close();
10720
+ };
10721
+ var renderCloseIcon = function() {
10722
+ var closeClasses = classNames("".concat(classPrefix2, "-title-right"), "".concat(classPrefix2, "-title-right-").concat(closeIconPosition));
10723
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, closeable && /* @__PURE__ */ React.createElement("div", {
10724
+ className: closeClasses,
10725
+ onClick: handleCloseIconClick
10726
+ }, /* @__PURE__ */ React.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React.createElement(n$6, null)));
10727
+ };
10728
+ var renderTitle = function() {
10729
+ if (left || title || description) {
10730
+ return /* @__PURE__ */ React.createElement("div", {
10731
+ className: "".concat(classPrefix2, "-title")
10732
+ }, position2 === "bottom" && /* @__PURE__ */ React.createElement(React.Fragment, null, left && /* @__PURE__ */ React.createElement("div", {
10733
+ className: "".concat(classPrefix2, "-title-left")
10734
+ }, left), (title || description) && /* @__PURE__ */ React.createElement("div", {
10735
+ className: "".concat(classPrefix2, "-title-wrapper")
10736
+ }, title && /* @__PURE__ */ React.createElement("div", {
10737
+ className: "".concat(classPrefix2, "-title-title")
10738
+ }, title), description && /* @__PURE__ */ React.createElement("div", {
10739
+ className: "".concat(classPrefix2, "-title-description ").concat(title ? "".concat(classPrefix2, "-title-description-gap") : "")
10740
+ }, description))), renderCloseIcon());
10741
+ }
10742
+ if (closeable) {
10743
+ return renderCloseIcon();
10744
+ }
10745
+ };
10746
+ var renderPop = function() {
10747
+ return /* @__PURE__ */ React.createElement(CSSTransition, {
10748
+ nodeRef,
10749
+ classNames: transitionName,
10750
+ mountOnEnter: true,
10751
+ unmountOnExit: destroyOnClose,
10752
+ timeout: duration,
10753
+ in: innerVisible,
10754
+ onEntered: afterShow,
10755
+ onExited: afterClose
10756
+ }, /* @__PURE__ */ React.createElement("div", {
10757
+ ref: nodeRef,
10758
+ style: popStyles,
10759
+ className: popClassName,
10760
+ onClick
10761
+ }, renderTitle(), showChildren && children));
10762
+ };
10763
+ var renderNode = function() {
10764
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, overlay && /* @__PURE__ */ React.createElement(Overlay, {
10765
+ zIndex: index2,
10766
+ style: overlayStyles,
10767
+ className: overlayClassName,
10768
+ visible: innerVisible,
10769
+ closeOnOverlayClick,
10770
+ lockScroll,
10771
+ duration,
10772
+ onClick: handleOverlayClick
10773
+ }), renderPop());
10774
+ };
10775
+ React.useEffect(function() {
10776
+ visible ? open() : close();
10777
+ }, [
10778
+ visible
10779
+ ]);
10780
+ React.useEffect(function() {
10781
+ setTransitionName(transition || "".concat(classPrefix2, "-slide-").concat(position2));
10782
+ }, [
10783
+ position2,
10784
+ transition
10785
+ ]);
10786
+ var resolveContainer = function(getContainer) {
10787
+ return (typeof getContainer === "function" ? getContainer() : getContainer) || document.body;
10788
+ };
10789
+ var renderToContainer = function(getContainer, node) {
10790
+ if (getContainer) {
10791
+ var container = resolveContainer(getContainer);
10792
+ return /* @__PURE__ */ ReactDOM.createPortal(node, container);
10793
+ }
10794
+ return node;
10795
+ };
10796
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, renderToContainer(portal, renderNode()));
10797
+ };
10798
+ Popup.displayName = "NutPopup";
10950
10799
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key2, arg) {
10951
10800
  try {
10952
10801
  var info = gen[key2](arg);
@@ -11042,17 +10891,6 @@ Please add \`${key2}Action\` when creating your handler.`);
11042
10891
  return { value: op[0] ? op[1] : void 0, done: true };
11043
10892
  }
11044
10893
  }
11045
- function __values(o) {
11046
- var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o[s2], i2 = 0;
11047
- if (m2) return m2.call(o);
11048
- if (o && typeof o.length === "number") return {
11049
- next: function() {
11050
- if (o && i2 >= o.length) o = void 0;
11051
- return { value: o && o[i2++], done: !o };
11052
- }
11053
- };
11054
- throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
11055
- }
11056
10894
  typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
11057
10895
  var e2 = new Error(message);
11058
10896
  return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2;
@@ -11231,7 +11069,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11231
11069
  ]);
11232
11070
  return Tree2;
11233
11071
  }();
11234
- var defaultProps$1a = _object_spread_props(_object_spread({}, ComponentDefaults), {
11072
+ var defaultProps$1b = _object_spread_props(_object_spread({}, ComponentDefaults), {
11235
11073
  activeColor: "",
11236
11074
  activeIcon: "checklist",
11237
11075
  popup: true,
@@ -11257,7 +11095,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11257
11095
  });
11258
11096
  var InternalCascader = function(props, ref) {
11259
11097
  var locale = useConfig().locale;
11260
- var _$_object_spread = _object_spread({}, defaultProps$1a, props), className = _$_object_spread.className, style = _$_object_spread.style, activeColor = _$_object_spread.activeColor, activeIcon = _$_object_spread.activeIcon, popup = _$_object_spread.popup, _object_spread_popupProps = _$_object_spread.popupProps, popupProps = _object_spread_popupProps === void 0 ? {} : _object_spread_popupProps, visible = _$_object_spread.visible, options2 = _$_object_spread.options, value2 = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, optionKey = _$_object_spread.optionKey, format2 = _$_object_spread.format, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, lazy = _$_object_spread.lazy, title = _$_object_spread.title, left = _$_object_spread.left, onLoad = _$_object_spread.onLoad, onClose = _$_object_spread.onClose, onChange = _$_object_spread.onChange, onPathChange = _$_object_spread.onPathChange;
11098
+ var _$_object_spread = _object_spread({}, defaultProps$1b, props), className = _$_object_spread.className, style = _$_object_spread.style, activeColor = _$_object_spread.activeColor, activeIcon = _$_object_spread.activeIcon, popup = _$_object_spread.popup, _object_spread_popupProps = _$_object_spread.popupProps, popupProps = _object_spread_popupProps === void 0 ? {} : _object_spread_popupProps, visible = _$_object_spread.visible, options2 = _$_object_spread.options, value2 = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, optionKey = _$_object_spread.optionKey, format2 = _$_object_spread.format, closeable = _$_object_spread.closeable, closeIconPosition = _$_object_spread.closeIconPosition, closeIcon = _$_object_spread.closeIcon, lazy = _$_object_spread.lazy, title = _$_object_spread.title, left = _$_object_spread.left, onLoad = _$_object_spread.onLoad, onClose = _$_object_spread.onClose, onChange = _$_object_spread.onChange, onPathChange = _$_object_spread.onPathChange;
11261
11099
  var _useState = _sliced_to_array(React.useState("c1"), 2), tabvalue = _useState[0], setTabvalue = _useState[1];
11262
11100
  var _useState1 = _sliced_to_array(React.useState([]), 2), optionsData = _useState1[0], setOptionsData = _useState1[1];
11263
11101
  var isLazy = function() {
@@ -11712,7 +11550,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11712
11550
  };
11713
11551
  var Cascader = /* @__PURE__ */ React.forwardRef(InternalCascader);
11714
11552
  Cascader.displayName = "NutCascader";
11715
- var defaultProps$19 = _object_spread_props(_object_spread({}, ComponentDefaults), {
11553
+ var defaultProps$1a = _object_spread_props(_object_spread({}, ComponentDefaults), {
11716
11554
  visible: false,
11717
11555
  type: "custom",
11718
11556
  options: [],
@@ -11725,7 +11563,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11725
11563
  height: "200px"
11726
11564
  });
11727
11565
  var CustomRender = function(props) {
11728
- var _ref = _object_spread({}, defaultProps$19, props);
11566
+ var _ref = _object_spread({}, defaultProps$1a, props);
11729
11567
  _ref.children;
11730
11568
  var visible = _ref.visible, type2 = _ref.type;
11731
11569
  _ref.height;
@@ -11763,7 +11601,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11763
11601
  onPathChange
11764
11602
  }, rest)));
11765
11603
  };
11766
- var defaultProps$18 = {
11604
+ var defaultProps$19 = {
11767
11605
  type: "custom",
11768
11606
  existList: [],
11769
11607
  defaultIcon: null,
@@ -11772,7 +11610,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11772
11610
  };
11773
11611
  var ExistRender = function(props) {
11774
11612
  var locale = useConfig().locale;
11775
- var _ref = _object_spread({}, defaultProps$18, props);
11613
+ var _ref = _object_spread({}, defaultProps$19, props);
11776
11614
  _ref.children;
11777
11615
  var type2 = _ref.type, existList = _ref.existList, selectIcon = _ref.selectIcon, defaultIcon = _ref.defaultIcon, custom = _ref.custom, onSelect = _ref.onSelect, onSwitch = _ref.onSwitch;
11778
11616
  _object_without_properties(_ref, [
@@ -11821,7 +11659,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11821
11659
  className: "".concat(classPrefix2, "-footer-btn")
11822
11660
  }, custom)));
11823
11661
  };
11824
- var defaultProps$17 = _object_spread_props(_object_spread({}, ComponentDefaults), {
11662
+ var defaultProps$18 = _object_spread_props(_object_spread({}, ComponentDefaults), {
11825
11663
  defaultValue: [],
11826
11664
  type: "custom",
11827
11665
  options: [],
@@ -11841,7 +11679,7 @@ Please add \`${key2}Action\` when creating your handler.`);
11841
11679
  });
11842
11680
  var InternalAddress = function(props, ref) {
11843
11681
  var locale = useConfig().locale;
11844
- var _ref = _object_spread({}, defaultProps$17, props), style = _ref.style, className = _ref.className, visible = _ref.visible, defaultVisible = _ref.defaultVisible, defaultValue = _ref.defaultValue;
11682
+ var _ref = _object_spread({}, defaultProps$18, props), style = _ref.style, className = _ref.className, visible = _ref.visible, defaultVisible = _ref.defaultVisible, defaultValue = _ref.defaultValue;
11845
11683
  _ref.children;
11846
11684
  var type2 = _ref.type, options2 = _ref.options, optionKey = _ref.optionKey, format2 = _ref.format, height2 = _ref.height, title = _ref.title, existList = _ref.existList, custom = _ref.custom, selectIcon = _ref.selectIcon, defaultIcon = _ref.defaultIcon, closeIcon = _ref.closeIcon, backIcon = _ref.backIcon, onChange = _ref.onChange, onExistSelect = _ref.onExistSelect, onClose = _ref.onClose, onSwitch = _ref.onSwitch;
11847
11685
  _object_without_properties(_ref, [
@@ -12225,7 +12063,7 @@ Please add \`${key2}Action\` when creating your handler.`);
12225
12063
  var isStartAndEnd = function(days) {
12226
12064
  return days.length >= 2 && Utils.isEqual(days[0], days[1]);
12227
12065
  };
12228
- var defaultProps$16 = _object_spread_props(_object_spread({}, ComponentDefaults), {
12066
+ var defaultProps$17 = _object_spread_props(_object_spread({}, ComponentDefaults), {
12229
12067
  type: "single",
12230
12068
  autoBackfill: false,
12231
12069
  popup: true,
@@ -12258,7 +12096,7 @@ Please add \`${key2}Action\` when creating your handler.`);
12258
12096
  });
12259
12097
  var CalendarItem = /* @__PURE__ */ React.forwardRef(function(props, ref) {
12260
12098
  var locale = useConfig().locale;
12261
- var _$_object_spread = _object_spread({}, defaultProps$16, props), style = _$_object_spread.style, className = _$_object_spread.className, children = _$_object_spread.children, popup = _$_object_spread.popup, type2 = _$_object_spread.type, autoBackfill = _$_object_spread.autoBackfill, title = _$_object_spread.title, defaultValue = _$_object_spread.defaultValue, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, showToday = _$_object_spread.showToday, startText = _$_object_spread.startText, endText = _$_object_spread.endText, confirmText = _$_object_spread.confirmText, showTitle = _$_object_spread.showTitle, showSubTitle = _$_object_spread.showSubTitle, scrollAnimation = _$_object_spread.scrollAnimation, firstDayOfWeek = _$_object_spread.firstDayOfWeek, disableDate = _$_object_spread.disableDate, renderHeaderButtons = _$_object_spread.renderHeaderButtons, renderBottomButton = _$_object_spread.renderBottomButton, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, value2 = _$_object_spread.value, onConfirm = _$_object_spread.onConfirm, onUpdate = _$_object_spread.onUpdate, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange;
12099
+ var _$_object_spread = _object_spread({}, defaultProps$17, props), style = _$_object_spread.style, className = _$_object_spread.className, children = _$_object_spread.children, popup = _$_object_spread.popup, type2 = _$_object_spread.type, autoBackfill = _$_object_spread.autoBackfill, title = _$_object_spread.title, defaultValue = _$_object_spread.defaultValue, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, showToday = _$_object_spread.showToday, startText = _$_object_spread.startText, endText = _$_object_spread.endText, confirmText = _$_object_spread.confirmText, showTitle = _$_object_spread.showTitle, showSubTitle = _$_object_spread.showSubTitle, scrollAnimation = _$_object_spread.scrollAnimation, firstDayOfWeek = _$_object_spread.firstDayOfWeek, disableDate = _$_object_spread.disableDate, renderHeaderButtons = _$_object_spread.renderHeaderButtons, renderBottomButton = _$_object_spread.renderBottomButton, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, value2 = _$_object_spread.value, onConfirm = _$_object_spread.onConfirm, onUpdate = _$_object_spread.onUpdate, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange;
12262
12100
  var weekdays = locale.calendaritem.weekdays;
12263
12101
  var weeks = _to_consumable_array(weekdays.slice(firstDayOfWeek, 7)).concat(_to_consumable_array(weekdays.slice(0, firstDayOfWeek)));
12264
12102
  var monthTitle = locale.calendaritem.monthTitle;
@@ -12818,7 +12656,7 @@ Please add \`${key2}Action\` when creating your handler.`);
12818
12656
  }, renderHeader(), renderContent(), popup && !autoBackfill ? renderFooter() : "");
12819
12657
  });
12820
12658
  CalendarItem.displayName = "NutCalendarItem";
12821
- var defaultProps$15 = _object_spread_props(_object_spread({}, ComponentDefaults), {
12659
+ var defaultProps$16 = _object_spread_props(_object_spread({}, ComponentDefaults), {
12822
12660
  type: "single",
12823
12661
  autoBackfill: false,
12824
12662
  popup: true,
@@ -12853,7 +12691,7 @@ Please add \`${key2}Action\` when creating your handler.`);
12853
12691
  });
12854
12692
  var Calendar = /* @__PURE__ */ React.forwardRef(function(props, ref) {
12855
12693
  var locale = useConfig().locale;
12856
- var _$_object_spread = _object_spread({}, defaultProps$15, props), style = _$_object_spread.style, className = _$_object_spread.className, children = _$_object_spread.children, popup = _$_object_spread.popup, visible = _$_object_spread.visible, type2 = _$_object_spread.type, autoBackfill = _$_object_spread.autoBackfill, title = _$_object_spread.title, defaultValue = _$_object_spread.defaultValue, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, showToday = _$_object_spread.showToday, startText = _$_object_spread.startText, endText = _$_object_spread.endText, confirmText = _$_object_spread.confirmText, showTitle = _$_object_spread.showTitle, showSubTitle = _$_object_spread.showSubTitle, scrollAnimation = _$_object_spread.scrollAnimation, firstDayOfWeek = _$_object_spread.firstDayOfWeek, closeIcon = _$_object_spread.closeIcon, disableDate = _$_object_spread.disableDate, renderHeaderButtons = _$_object_spread.renderHeaderButtons, renderBottomButton = _$_object_spread.renderBottomButton, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onClose = _$_object_spread.onClose, onConfirm = _$_object_spread.onConfirm, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange;
12694
+ var _$_object_spread = _object_spread({}, defaultProps$16, props), style = _$_object_spread.style, className = _$_object_spread.className, children = _$_object_spread.children, popup = _$_object_spread.popup, visible = _$_object_spread.visible, type2 = _$_object_spread.type, autoBackfill = _$_object_spread.autoBackfill, title = _$_object_spread.title, defaultValue = _$_object_spread.defaultValue, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, showToday = _$_object_spread.showToday, startText = _$_object_spread.startText, endText = _$_object_spread.endText, confirmText = _$_object_spread.confirmText, showTitle = _$_object_spread.showTitle, showSubTitle = _$_object_spread.showSubTitle, scrollAnimation = _$_object_spread.scrollAnimation, firstDayOfWeek = _$_object_spread.firstDayOfWeek, closeIcon = _$_object_spread.closeIcon, disableDate = _$_object_spread.disableDate, renderHeaderButtons = _$_object_spread.renderHeaderButtons, renderBottomButton = _$_object_spread.renderBottomButton, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onClose = _$_object_spread.onClose, onConfirm = _$_object_spread.onConfirm, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange;
12857
12695
  var calendarRef = React.useRef(null);
12858
12696
  var close = function() {
12859
12697
  onClose && onClose();
@@ -13020,14 +12858,14 @@ Please add \`${key2}Action\` when creating your handler.`);
13020
12858
  convertDateToDay(new Date(current.getTime() + 24 * 60 * 60 * 1e3 * (6 - count)))
13021
12859
  ];
13022
12860
  };
13023
- var defaultProps$14 = _object_spread_props(_object_spread({}, ComponentDefaults), {
12861
+ var defaultProps$15 = _object_spread_props(_object_spread({}, ComponentDefaults), {
13024
12862
  type: "single",
13025
12863
  firstDayOfWeek: 0
13026
12864
  });
13027
12865
  var prefixCls = "nut-calendarcard";
13028
12866
  var CalendarCard = /* @__PURE__ */ React.forwardRef(function(props, ref) {
13029
12867
  var locale = useConfig().locale;
13030
- var _$_object_spread = _object_spread({}, defaultProps$14, props), style = _$_object_spread.style, className = _$_object_spread.className, type2 = _$_object_spread.type, value2 = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
12868
+ var _$_object_spread = _object_spread({}, defaultProps$15, props), style = _$_object_spread.style, className = _$_object_spread.className, type2 = _$_object_spread.type, value2 = _$_object_spread.value, defaultValue = _$_object_spread.defaultValue, firstDayOfWeek = _$_object_spread.firstDayOfWeek, startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, disableDay = _$_object_spread.disableDay, renderDay = _$_object_spread.renderDay, renderDayTop = _$_object_spread.renderDayTop, renderDayBottom = _$_object_spread.renderDayBottom, onDayClick = _$_object_spread.onDayClick, onPageChange = _$_object_spread.onPageChange, onChange = _$_object_spread.onChange;
13031
12869
  var _useState = _sliced_to_array(React.useState(function() {
13032
12870
  var date2 = new Date(Date.now());
13033
12871
  var val2 = value2 || defaultValue;
@@ -13405,7 +13243,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13405
13243
  });
13406
13244
  CalendarCard.displayName = "NutCalendarCard";
13407
13245
  var CheckboxGroupContext = React.createContext(null);
13408
- var defaultProps$13 = _object_spread_props(_object_spread({}, ComponentDefaults), {
13246
+ var defaultProps$14 = _object_spread_props(_object_spread({}, ComponentDefaults), {
13409
13247
  disabled: false,
13410
13248
  shape: "round",
13411
13249
  labelPosition: "right",
@@ -13417,7 +13255,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13417
13255
  });
13418
13256
  var classPrefix$j = "nut-checkbox";
13419
13257
  var Checkbox = function(props) {
13420
- var children = _object_spread({}, defaultProps$13, props).children;
13258
+ var children = _object_spread({}, defaultProps$14, props).children;
13421
13259
  var icon = props.icon, label = props.label, className = props.className, activeIcon = props.activeIcon, checked = props.checked, value2 = props.value, defaultChecked = props.defaultChecked, shape = props.shape, disabled = props.disabled, onChange = props.onChange, indeterminate = props.indeterminate, indeterminateIcon = props.indeterminateIcon, others = _object_without_properties(props, [
13422
13260
  "icon",
13423
13261
  "label",
@@ -13522,7 +13360,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13522
13360
  className: classNames("".concat(classPrefix$j, "-label "), _define_property({}, "".concat(classPrefix$j, "-label-disabled"), innerDisabled))
13523
13361
  }, children || label);
13524
13362
  };
13525
- var handleClick2 = function() {
13363
+ var handleClick = function() {
13526
13364
  if (disabled) return;
13527
13365
  var latestChecked = !innerChecked;
13528
13366
  setChecked(latestChecked);
@@ -13551,11 +13389,11 @@ Please add \`${key2}Action\` when creating your handler.`);
13551
13389
  return /* @__PURE__ */ React.createElement("div", _object_spread_props(_object_spread({
13552
13390
  className: classNames(classPrefix$j, (_obj = {}, _define_property(_obj, "".concat(classPrefix$j, "-reverse"), labelPosition === "left"), _define_property(_obj, "nut-checkbox-list-item", ctx2 === null || ctx2 === void 0 ? void 0 : ctx2.list), _obj), className)
13553
13391
  }, rest), {
13554
- onClick: handleClick2
13392
+ onClick: handleClick
13555
13393
  }), renderCheckboxItem());
13556
13394
  };
13557
13395
  Checkbox.displayName = "NutCheckBox";
13558
- var defaultProps$12 = {
13396
+ var defaultProps$13 = {
13559
13397
  max: void 0,
13560
13398
  min: void 0,
13561
13399
  list: false,
@@ -13569,7 +13407,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13569
13407
  };
13570
13408
  var classPrefix$i = "nut-checkboxgroup";
13571
13409
  var CheckboxGroup = /* @__PURE__ */ React.forwardRef(function(props, ref) {
13572
- var _ref = _object_spread({}, defaultProps$12, props), children = _ref.children, className = _ref.className, disabled = _ref.disabled, list = _ref.list, value2 = _ref.value, defaultValue = _ref.defaultValue, max = _ref.max, min = _ref.min, labelPosition = _ref.labelPosition, direction = _ref.direction, options2 = _ref.options, onChange = _ref.onChange, onLimit = _ref.onLimit, rest = _object_without_properties(_ref, [
13410
+ var _ref = _object_spread({}, defaultProps$13, props), children = _ref.children, className = _ref.className, disabled = _ref.disabled, list = _ref.list, value2 = _ref.value, defaultValue = _ref.defaultValue, max = _ref.max, min = _ref.min, labelPosition = _ref.labelPosition, direction = _ref.direction, options2 = _ref.options, onChange = _ref.onChange, onLimit = _ref.onLimit, rest = _object_without_properties(_ref, [
13573
13411
  "children",
13574
13412
  "className",
13575
13413
  "disabled",
@@ -13888,7 +13726,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13888
13726
  })));
13889
13727
  };
13890
13728
  var PickerRoller = /* @__PURE__ */ React.forwardRef(InternalPickerRoller);
13891
- var defaultProps$11 = _object_spread_props(_object_spread({}, ComponentDefaults), {
13729
+ var defaultProps$12 = _object_spread_props(_object_spread({}, ComponentDefaults), {
13892
13730
  options: [],
13893
13731
  defaultValue: [],
13894
13732
  value: void 0,
@@ -13897,7 +13735,7 @@ Please add \`${key2}Action\` when creating your handler.`);
13897
13735
  }
13898
13736
  });
13899
13737
  var InternalPickerView = function(props, ref) {
13900
- var _$_object_spread = _object_spread({}, defaultProps$11, props), options2 = _$_object_spread.options, _object_spread_defaultValue = _$_object_spread.defaultValue, defaultValue = _object_spread_defaultValue === void 0 ? [] : _object_spread_defaultValue, value2 = _$_object_spread.value, duration = _$_object_spread.duration, threeDimensional = _$_object_spread.threeDimensional, renderLabel = _$_object_spread.renderLabel, className = _$_object_spread.className, style = _$_object_spread.style, onChange = _$_object_spread.onChange;
13738
+ var _$_object_spread = _object_spread({}, defaultProps$12, props), options2 = _$_object_spread.options, _object_spread_defaultValue = _$_object_spread.defaultValue, defaultValue = _object_spread_defaultValue === void 0 ? [] : _object_spread_defaultValue, value2 = _$_object_spread.value, duration = _$_object_spread.duration, threeDimensional = _$_object_spread.threeDimensional, renderLabel = _$_object_spread.renderLabel, className = _$_object_spread.className, style = _$_object_spread.style, onChange = _$_object_spread.onChange;
13901
13739
  var classPrefix2 = "nut-pickerview";
13902
13740
  var cls = classNames(classPrefix2, className);
13903
13741
  var _usePropsValue = _sliced_to_array(usePropsValue({
@@ -14072,7 +13910,7 @@ Please add \`${key2}Action\` when creating your handler.`);
14072
13910
  reset
14073
13911
  ];
14074
13912
  }
14075
- var defaultProps$10 = _object_spread_props(_object_spread({}, ComponentDefaults), {
13913
+ var defaultProps$11 = _object_spread_props(_object_spread({}, ComponentDefaults), {
14076
13914
  title: "",
14077
13915
  options: [],
14078
13916
  value: void 0,
@@ -14081,7 +13919,7 @@ Please add \`${key2}Action\` when creating your handler.`);
14081
13919
  });
14082
13920
  var InternalPicker$1 = function(props, ref) {
14083
13921
  var locale = useConfig().locale;
14084
- var _ref = _object_spread({}, defaultProps$10, props), children = _ref.children;
13922
+ var _ref = _object_spread({}, defaultProps$11, props), children = _ref.children;
14085
13923
  _ref.visible;
14086
13924
  var title = _ref.title, _ref_options = _ref.options, options2 = _ref_options === void 0 ? [] : _ref_options, closeOnOverlayClick = _ref.closeOnOverlayClick, _ref_popupProps = _ref.popupProps, popupProps = _ref_popupProps === void 0 ? {} : _ref_popupProps, _ref_defaultValue = _ref.defaultValue, defaultValue = _ref_defaultValue === void 0 ? [] : _ref_defaultValue, className = _ref.className, style = _ref.style, threeDimensional = _ref.threeDimensional, duration = _ref.duration;
14087
13925
  _ref.onConfirm;
@@ -14439,19 +14277,19 @@ Please add \`${key2}Action\` when creating your handler.`);
14439
14277
  handleDateComparison(date1, selectedOptions, index2);
14440
14278
  }
14441
14279
  };
14442
- var currentYear = (/* @__PURE__ */ new Date()).getFullYear();
14443
- var defaultProps$$ = _object_spread_props(_object_spread({}, ComponentDefaults), {
14280
+ var currentYear$1 = (/* @__PURE__ */ new Date()).getFullYear();
14281
+ var defaultProps$10 = _object_spread_props(_object_spread({}, ComponentDefaults), {
14444
14282
  visible: false,
14445
14283
  title: "",
14446
14284
  type: "date",
14447
14285
  showChinese: false,
14448
14286
  threeDimensional: true,
14449
14287
  minuteStep: 1,
14450
- startDate: new Date(currentYear - 10, 0, 1),
14451
- endDate: new Date(currentYear + 10, 11, 31)
14288
+ startDate: new Date(currentYear$1 - 10, 0, 1),
14289
+ endDate: new Date(currentYear$1 + 10, 11, 31)
14452
14290
  });
14453
14291
  var InternalPicker = function(props, ref) {
14454
- var _ref = _object_spread({}, defaultProps$$, props), startDate = _ref.startDate, endDate = _ref.endDate, type2 = _ref.type, showChinese = _ref.showChinese, minuteStep = _ref.minuteStep;
14292
+ var _ref = _object_spread({}, defaultProps$10, props), startDate = _ref.startDate, endDate = _ref.endDate, type2 = _ref.type, showChinese = _ref.showChinese, minuteStep = _ref.minuteStep;
14455
14293
  _ref.visible;
14456
14294
  var title = _ref.title, defaultValue = _ref.defaultValue, _ref_pickerProps = _ref.pickerProps, pickerProps = _ref_pickerProps === void 0 ? {} : _ref_pickerProps, formatter = _ref.formatter, onClose = _ref.onClose, onCancel = _ref.onCancel, onConfirm = _ref.onConfirm, filter = _ref.filter, onChange = _ref.onChange, threeDimensional = _ref.threeDimensional, className = _ref.className, style = _ref.style, children = _ref.children, rest = _object_without_properties(_ref, [
14457
14295
  "startDate",
@@ -14484,6 +14322,8 @@ Please add \`${key2}Action\` when creating your handler.`);
14484
14322
  minute: lang.min,
14485
14323
  seconds: lang.seconds
14486
14324
  };
14325
+ var classPrefix2 = "nut-datepicker";
14326
+ var cls = classNames(classPrefix2, className);
14487
14327
  var _useState = _sliced_to_array(React.useState([]), 2), pickerValue = _useState[0], setPickerValue = _useState[1];
14488
14328
  var _useState1 = _sliced_to_array(React.useState([]), 2), pickerOptions = _useState1[0], setPickerOptions = _useState1[1];
14489
14329
  var _usePropsValue = _sliced_to_array(usePropsValue({
@@ -14509,10 +14349,9 @@ Please add \`${key2}Action\` when creating your handler.`);
14509
14349
  return actions;
14510
14350
  });
14511
14351
  var handleDateComparison = function(newDate, selectedOptions, index2) {
14512
- var _this;
14513
- var isEqual2 = ((_this = new Date(innerDate)) === null || _this === void 0 ? void 0 : _this.getTime()) === (newDate === null || newDate === void 0 ? void 0 : newDate.getTime());
14514
14352
  if (newDate && isDate(newDate)) {
14515
- if (!isEqual2) {
14353
+ var _this;
14354
+ if (!isEqual$1((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), newDate === null || newDate === void 0 ? void 0 : newDate.getTime())) {
14516
14355
  setInnerDate(formatValue(newDate, startDate, endDate));
14517
14356
  }
14518
14357
  onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions, [
@@ -14525,8 +14364,7 @@ Please add \`${key2}Action\` when creating your handler.`);
14525
14364
  var handleConfirmDateComparison = function(newDate) {
14526
14365
  if (newDate && isDate(newDate)) {
14527
14366
  var _this;
14528
- var isEqual2 = ((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime()) === (newDate === null || newDate === void 0 ? void 0 : newDate.getTime());
14529
- if (!isEqual2) {
14367
+ if (!isEqual$1((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), newDate === null || newDate === void 0 ? void 0 : newDate.getTime())) {
14530
14368
  setSelectedDate(formatValue(newDate, startDate, endDate));
14531
14369
  }
14532
14370
  }
@@ -14576,7 +14414,7 @@ Please add \`${key2}Action\` when creating your handler.`);
14576
14414
  endDate
14577
14415
  ]);
14578
14416
  return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedDate), /* @__PURE__ */ React.createElement("div", _object_spread({
14579
- className: "nut-datepicker ".concat(className),
14417
+ className: cls,
14580
14418
  style
14581
14419
  }, rest), pickerOptions.length && /* @__PURE__ */ React.createElement(Picker, _object_spread_props(_object_spread({}, pickerProps), {
14582
14420
  title,
@@ -14594,6 +14432,98 @@ Please add \`${key2}Action\` when creating your handler.`);
14594
14432
  }))));
14595
14433
  };
14596
14434
  var DatePicker = /* @__PURE__ */ React.forwardRef(InternalPicker);
14435
+ var currentYear = (/* @__PURE__ */ new Date()).getFullYear();
14436
+ var defaultProps$$ = _object_spread_props(_object_spread({}, ComponentDefaults), {
14437
+ type: "date",
14438
+ showChinese: false,
14439
+ threeDimensional: true,
14440
+ minuteStep: 1,
14441
+ startDate: new Date(currentYear - 10, 0, 1),
14442
+ endDate: new Date(currentYear + 10, 11, 31)
14443
+ });
14444
+ var DatePickerView = function(props) {
14445
+ var _$_object_spread = _object_spread({}, defaultProps$$, props), startDate = _$_object_spread.startDate, endDate = _$_object_spread.endDate, type2 = _$_object_spread.type, showChinese = _$_object_spread.showChinese, minuteStep = _$_object_spread.minuteStep, defaultValue = _$_object_spread.defaultValue, formatter = _$_object_spread.formatter, filter = _$_object_spread.filter, onChange = _$_object_spread.onChange, threeDimensional = _$_object_spread.threeDimensional, className = _$_object_spread.className, style = _$_object_spread.style;
14446
+ var classPrefix2 = "nut-datepickerview";
14447
+ var cls = classNames(classPrefix2, className);
14448
+ var locale = useConfig().locale;
14449
+ var lang = locale.datepicker;
14450
+ var zhCNType = {
14451
+ day: lang.day,
14452
+ year: lang.year,
14453
+ month: lang.month,
14454
+ hour: lang.hour,
14455
+ minute: lang.min,
14456
+ seconds: lang.seconds
14457
+ };
14458
+ var _useState = _sliced_to_array(React.useState([]), 2), pickerValue = _useState[0], setPickerValue = _useState[1];
14459
+ var _useState1 = _sliced_to_array(React.useState([]), 2), pickerOptions = _useState1[0], setPickerOptions = _useState1[1];
14460
+ var _usePropsValue = _sliced_to_array(usePropsValue({
14461
+ value: props.value && formatValue(props.value, startDate, endDate),
14462
+ defaultValue: defaultValue && formatValue(defaultValue, startDate, endDate),
14463
+ finalValue: 0
14464
+ }), 2), selectedDate = _usePropsValue[0], setSelectedDate = _usePropsValue[1];
14465
+ var handleDateComparison = function(newDate, selectedOptions, index2) {
14466
+ if (newDate && isDate(newDate)) {
14467
+ var _this;
14468
+ if (!isEqual$1((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), newDate === null || newDate === void 0 ? void 0 : newDate.getTime())) {
14469
+ setSelectedDate(formatValue(newDate, startDate, endDate));
14470
+ onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions, [
14471
+ String(newDate.getFullYear()),
14472
+ padZero(newDate.getMonth() + 1),
14473
+ padZero(newDate.getDate())
14474
+ ], index2);
14475
+ }
14476
+ }
14477
+ };
14478
+ var handleChange = function(selectedOptions, selectedValue, index2) {
14479
+ handlePickerValueChange(selectedOptions, selectedValue, index2, type2, defaultValue || startDate || endDate, handleDateComparison);
14480
+ };
14481
+ var generatePickerColumns = function() {
14482
+ var dateRanges = generateDatePickerRanges(type2, selectedDate, startDate, endDate);
14483
+ var columns = dateRanges.map(function(rangeConfig, columnIndex) {
14484
+ var columnType = rangeConfig.type, range2 = rangeConfig.range;
14485
+ var selectedValue = getDatePartValue(columnType, selectedDate);
14486
+ var pickerColumn = generatePickerColumnWithCallback(range2[0], range2[1], selectedValue, columnType, minuteStep, function(selectedIndex, options2) {
14487
+ var _options_selectedIndex;
14488
+ pickerValue[columnIndex] = (_options_selectedIndex = options2[selectedIndex]) === null || _options_selectedIndex === void 0 ? void 0 : _options_selectedIndex.value;
14489
+ setPickerValue(_to_consumable_array(pickerValue));
14490
+ }, showChinese, zhCNType, formatter);
14491
+ if (filter === null || filter === void 0 ? void 0 : filter(columnType, pickerColumn)) {
14492
+ return filter(columnType, pickerColumn);
14493
+ }
14494
+ return pickerColumn;
14495
+ });
14496
+ return columns || [];
14497
+ };
14498
+ React.useEffect(function() {
14499
+ var _this, _this1;
14500
+ if (!isEqual$1((_this = new Date(selectedDate)) === null || _this === void 0 ? void 0 : _this.getTime(), (_this1 = new Date(selectedDate)) === null || _this1 === void 0 ? void 0 : _this1.getTime())) {
14501
+ setSelectedDate(selectedDate);
14502
+ }
14503
+ }, [
14504
+ selectedDate
14505
+ ]);
14506
+ React.useEffect(function() {
14507
+ setPickerOptions(generatePickerColumns());
14508
+ }, [
14509
+ selectedDate,
14510
+ startDate,
14511
+ endDate
14512
+ ]);
14513
+ return /* @__PURE__ */ React.createElement("div", {
14514
+ className: cls,
14515
+ style
14516
+ }, pickerOptions.length && /* @__PURE__ */ React.createElement(PickerView, {
14517
+ value: pickerValue,
14518
+ options: pickerOptions,
14519
+ onChange: function(param) {
14520
+ var selectedOptions = param.selectedOptions, value2 = param.value, index2 = param.index;
14521
+ handleChange(selectedOptions, value2, index2);
14522
+ },
14523
+ threeDimensional
14524
+ }));
14525
+ };
14526
+ DatePickerView.displayName = "NutDatePickerView";
14597
14527
  var Context = React.createContext({});
14598
14528
  function _extends() {
14599
14529
  _extends = Object.assign ? Object.assign.bind() : function(target) {
@@ -15377,7 +15307,7 @@ Please add \`${key2}Action\` when creating your handler.`);
15377
15307
  pattern: {
15378
15308
  mismatch: "%s value %s does not match pattern %s"
15379
15309
  },
15380
- clone: function clone() {
15310
+ clone: function clone2() {
15381
15311
  var cloned = JSON.parse(JSON.stringify(this));
15382
15312
  cloned.clone = this.clone;
15383
15313
  return cloned;
@@ -15641,299 +15571,391 @@ Please add \`${key2}Action\` when creating your handler.`);
15641
15571
  Schema.warning = warning;
15642
15572
  Schema.messages = messages;
15643
15573
  Schema.validators = validators;
15574
+ function merge() {
15575
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
15576
+ items[_key] = arguments[_key];
15577
+ }
15578
+ return _merge(items[0] === true, false, items);
15579
+ }
15580
+ function recursive() {
15581
+ for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
15582
+ items[_key] = arguments[_key];
15583
+ }
15584
+ return _merge(items[0] === true, true, items);
15585
+ }
15586
+ function clone(input) {
15587
+ if (Array.isArray(input)) {
15588
+ var output = [];
15589
+ for (var index2 = 0; index2 < input.length; ++index2) output.push(clone(input[index2]));
15590
+ return output;
15591
+ }
15592
+ if (isPlainObject(input)) {
15593
+ var output1 = {};
15594
+ for (var index1 in input) output1[index1] = clone(input[index1]);
15595
+ return output1;
15596
+ }
15597
+ return input;
15598
+ }
15599
+ function isPlainObject(input) {
15600
+ if (input === null || (typeof input === "undefined" ? "undefined" : _type_of(input)) !== "object") return false;
15601
+ if (Object.getPrototypeOf(input) === null) return true;
15602
+ var ref = input;
15603
+ while (Object.getPrototypeOf(ref) !== null) ref = Object.getPrototypeOf(ref);
15604
+ return Object.getPrototypeOf(input) === ref;
15605
+ }
15606
+ function _recursiveMerge(base, extend) {
15607
+ if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
15608
+ for (var key2 in extend) {
15609
+ if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
15610
+ base[key2] = isPlainObject(base[key2]) && isPlainObject(extend[key2]) ? _recursiveMerge(base[key2], extend[key2]) : extend[key2];
15611
+ }
15612
+ return base;
15613
+ }
15614
+ function _merge(isClone, isRecursive, items) {
15615
+ var result;
15616
+ if (isClone || !isPlainObject(result = items.shift())) result = {};
15617
+ for (var index2 = 0; index2 < items.length; ++index2) {
15618
+ var item = items[index2];
15619
+ if (!isPlainObject(item)) continue;
15620
+ for (var key2 in item) {
15621
+ if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
15622
+ var value2 = isClone ? clone(item[key2]) : item[key2];
15623
+ result[key2] = isRecursive ? _recursiveMerge(result[key2], value2) : value2;
15624
+ }
15625
+ }
15626
+ return result;
15627
+ }
15644
15628
  var SECRET = "NUT_FORM_INTERNAL";
15645
- var FormStore = function FormStore2() {
15646
- var _this = this;
15647
- var _this1 = this;
15648
- _class_call_check(this, FormStore2);
15649
- var _this2 = this;
15650
- _define_property(this, "initialValues", {});
15651
- _define_property(this, "updateList", []);
15652
- _define_property(this, "store", {});
15653
- _define_property(this, "fieldEntities", []);
15654
- _define_property(this, "callbacks", {});
15655
- _define_property(this, "errors", {});
15656
- _define_property(this, "registerField", function(field) {
15657
- _this.fieldEntities.push(field);
15658
- return function() {
15659
- _this.fieldEntities = _this.fieldEntities.filter(function(item) {
15660
- return item !== field;
15629
+ var FormStore = /* @__PURE__ */ function() {
15630
+ function FormStore2() {
15631
+ var _this = this;
15632
+ var _this1 = this;
15633
+ _class_call_check(this, FormStore2);
15634
+ var _this2 = this;
15635
+ _define_property(this, "initialValues", {});
15636
+ _define_property(this, "updateList", []);
15637
+ _define_property(this, "store", {});
15638
+ _define_property(this, "fieldEntities", []);
15639
+ _define_property(this, "callbacks", {});
15640
+ _define_property(this, "errors", {});
15641
+ _define_property(this, "registerField", function(field) {
15642
+ _this.fieldEntities.push(field);
15643
+ return function() {
15644
+ _this.fieldEntities = _this.fieldEntities.filter(function(item) {
15645
+ return item !== field;
15646
+ });
15647
+ };
15648
+ });
15649
+ _define_property(this, "getFieldValue", function(name2) {
15650
+ var _this_store;
15651
+ return (_this_store = _this.store) === null || _this_store === void 0 ? void 0 : _this_store[name2];
15652
+ });
15653
+ _define_property(this, "getFieldsValue", function(nameList) {
15654
+ if (typeof nameList === "boolean") {
15655
+ return JSON.parse(JSON.stringify(_this.store));
15656
+ }
15657
+ var fieldsValue = {};
15658
+ nameList.forEach(function(field) {
15659
+ fieldsValue[field] = _this.getFieldValue(field);
15661
15660
  });
15662
- if (_this.store) {
15663
- delete _this.store[field.props.name];
15661
+ return fieldsValue;
15662
+ });
15663
+ _define_property(this, "setInitialValues", function(initialValues, init) {
15664
+ _this.initialValues = initialValues || {};
15665
+ if (init) {
15666
+ var nextStore = merge(initialValues, _this.store);
15667
+ _this.updateStore(nextStore);
15668
+ _this.notifyWatch();
15664
15669
  }
15665
- };
15666
- });
15667
- _define_property(this, "getFieldValue", function(name2) {
15668
- var _this_store;
15669
- return (_this_store = _this.store) === null || _this_store === void 0 ? void 0 : _this_store[name2];
15670
- });
15671
- _define_property(this, "getFieldsValue", function(nameList) {
15672
- if (typeof nameList === "boolean") {
15673
- return JSON.parse(JSON.stringify(_this.store));
15674
- }
15675
- var fieldsValue = {};
15676
- nameList.forEach(function(field) {
15677
- fieldsValue[field] = _this.getFieldValue(field);
15678
15670
  });
15679
- return fieldsValue;
15680
- });
15681
- _define_property(this, "setInitialValues", function(values, init) {
15682
- if (init) {
15683
- _this.initialValues = values;
15684
- _this.store = values;
15685
- }
15686
- });
15687
- _define_property(this, "setFieldsValue", function(newStore) {
15688
- var needValidate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
15689
- _this1.store = _object_spread({}, _this1.store, newStore);
15690
- _this1.fieldEntities.forEach(function(entity) {
15691
- var name2 = entity.props.name;
15692
- Object.keys(newStore).forEach(function(key2) {
15693
- if (key2 === name2) {
15694
- entity.onStoreChange("update");
15671
+ _define_property(this, "setFieldsValue", function(newStore) {
15672
+ var nextStore = recursive(true, _this.store, newStore);
15673
+ _this.updateStore(nextStore);
15674
+ _this.fieldEntities.forEach(function(entity) {
15675
+ var name2 = entity.props.name;
15676
+ Object.keys(newStore).forEach(function(key2) {
15677
+ if (key2 === name2) {
15678
+ entity.onStoreChange("update");
15679
+ }
15680
+ });
15681
+ });
15682
+ _this.updateList.forEach(function(item) {
15683
+ var shouldUpdate = item.condition;
15684
+ if (typeof item.condition === "function") {
15685
+ shouldUpdate = item.condition();
15686
+ }
15687
+ if (shouldUpdate) {
15688
+ item.entity.onStoreChange("update");
15695
15689
  }
15696
15690
  });
15691
+ _this.notifyWatch();
15697
15692
  });
15698
- _this1.updateList.forEach(function(item) {
15699
- var shouldUpdate = item.condition;
15700
- if (typeof item.condition === "function") {
15701
- shouldUpdate = item.condition();
15702
- }
15703
- if (shouldUpdate) {
15704
- item.entity.onStoreChange("update");
15705
- }
15693
+ _define_property(this, "setFieldValue", function(name2, value2) {
15694
+ var store = _define_property({}, name2, value2);
15695
+ _this.setFieldsValue(store);
15696
+ _this.notifyWatch([
15697
+ name2
15698
+ ]);
15706
15699
  });
15707
- needValidate && _this1.validateFields();
15708
- });
15709
- _define_property(this, "setCallback", function(callback) {
15710
- _this.callbacks = _object_spread({}, _this.callbacks, callback);
15711
- });
15712
- _define_property(this, "validateFields", /* @__PURE__ */ function() {
15713
- var _ref = _async_to_generator(function(nameList) {
15714
- var filterEntitys, errs, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step, err;
15700
+ _define_property(this, "setCallback", function(callback) {
15701
+ _this.callbacks = _object_spread({}, _this.callbacks, callback);
15702
+ });
15703
+ _define_property(this, "validateEntities", /* @__PURE__ */ function() {
15704
+ var _ref = _async_to_generator(function(entity, errs) {
15705
+ var _entity_props, name2, _entity_props_rules, rules2, descriptor, validator, _this_store, param, errors, _errs;
15706
+ return __generator(this, function(_state) {
15707
+ switch (_state.label) {
15708
+ case 0:
15709
+ _entity_props = entity.props, name2 = _entity_props.name, _entity_props_rules = _entity_props.rules, rules2 = _entity_props_rules === void 0 ? [] : _entity_props_rules;
15710
+ if (!name2) {
15711
+ console.warn("Form field missing name property");
15712
+ return [
15713
+ 2
15714
+ ];
15715
+ }
15716
+ descriptor = {};
15717
+ if (rules2.length) {
15718
+ if (rules2.length > 1) {
15719
+ descriptor[name2] = [];
15720
+ rules2.forEach(function(v) {
15721
+ descriptor[name2].push(v);
15722
+ });
15723
+ } else {
15724
+ descriptor[name2] = rules2[0];
15725
+ }
15726
+ }
15727
+ validator = new Schema(descriptor);
15728
+ _state.label = 1;
15729
+ case 1:
15730
+ _state.trys.push([
15731
+ 1,
15732
+ 3,
15733
+ 4,
15734
+ 5
15735
+ ]);
15736
+ return [
15737
+ 4,
15738
+ validator.validate(_define_property({}, name2, (_this_store = _this2.store) === null || _this_store === void 0 ? void 0 : _this_store[name2]))
15739
+ ];
15740
+ case 2:
15741
+ _state.sent();
15742
+ return [
15743
+ 3,
15744
+ 5
15745
+ ];
15746
+ case 3:
15747
+ param = _state.sent();
15748
+ errors = param.errors;
15749
+ if (errors) {
15750
+ (_errs = errs).push.apply(_errs, _to_consumable_array(errors));
15751
+ _this2.errors[name2] = errors;
15752
+ }
15753
+ return [
15754
+ 3,
15755
+ 5
15756
+ ];
15757
+ case 4:
15758
+ if (!errs || errs.length === 0) {
15759
+ _this2.errors[name2] = [];
15760
+ }
15761
+ return [
15762
+ 7
15763
+ ];
15764
+ case 5:
15765
+ entity.onStoreChange("validate");
15766
+ return [
15767
+ 2
15768
+ ];
15769
+ }
15770
+ });
15771
+ });
15772
+ return function(entity, errs) {
15773
+ return _ref.apply(this, arguments);
15774
+ };
15775
+ }());
15776
+ _define_property(this, "validateFields", /* @__PURE__ */ function() {
15777
+ var _ref = _async_to_generator(function(nameList) {
15778
+ var filterEntities, errs;
15779
+ return __generator(this, function(_state) {
15780
+ switch (_state.label) {
15781
+ case 0:
15782
+ filterEntities = [];
15783
+ if (!nameList || nameList.length === 0) {
15784
+ filterEntities = _this2.fieldEntities;
15785
+ } else {
15786
+ filterEntities = _this2.fieldEntities.filter(function(param) {
15787
+ var name2 = param.props.name;
15788
+ return nameList.includes(name2);
15789
+ });
15790
+ }
15791
+ errs = [];
15792
+ return [
15793
+ 4,
15794
+ Promise.all(filterEntities.map(/* @__PURE__ */ function() {
15795
+ var _ref2 = _async_to_generator(function(entity) {
15796
+ return __generator(this, function(_state2) {
15797
+ switch (_state2.label) {
15798
+ case 0:
15799
+ return [
15800
+ 4,
15801
+ _this2.validateEntities(entity, errs)
15802
+ ];
15803
+ case 1:
15804
+ _state2.sent();
15805
+ return [
15806
+ 2
15807
+ ];
15808
+ }
15809
+ });
15810
+ });
15811
+ return function(entity) {
15812
+ return _ref2.apply(this, arguments);
15813
+ };
15814
+ }()))
15815
+ ];
15816
+ case 1:
15817
+ _state.sent();
15818
+ return [
15819
+ 2,
15820
+ errs
15821
+ ];
15822
+ }
15823
+ });
15824
+ });
15825
+ return function(nameList) {
15826
+ return _ref.apply(this, arguments);
15827
+ };
15828
+ }());
15829
+ _define_property(this, "submit", /* @__PURE__ */ _async_to_generator(function() {
15830
+ var errors, _this_callbacks_onFinish, _this_callbacks, _this_callbacks_onFinishFailed, _this_callbacks1;
15715
15831
  return __generator(this, function(_state) {
15716
15832
  switch (_state.label) {
15717
15833
  case 0:
15718
- filterEntitys = [];
15719
- errs = [];
15720
- _this2.errors.length = 0;
15721
- if (!nameList || nameList.length === 0) {
15722
- filterEntitys = _this2.fieldEntities;
15723
- } else {
15724
- filterEntitys = _this2.fieldEntities.filter(function(param) {
15725
- var name2 = param.props.name;
15726
- return nameList.includes(name2);
15727
- });
15728
- }
15729
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
15730
- _state.label = 1;
15731
- case 1:
15732
- _state.trys.push([
15733
- 1,
15734
- 6,
15735
- 7,
15736
- 8
15737
- ]);
15738
- _loop = function() {
15739
- var entity, _entity_props, name2, _entity_props_rules, rules2, descriptor, validator, _this_store, param, errors, _errs;
15740
- return __generator(this, function(_state2) {
15741
- switch (_state2.label) {
15742
- case 0:
15743
- entity = _step.value;
15744
- _entity_props = entity.props, name2 = _entity_props.name, _entity_props_rules = _entity_props.rules, rules2 = _entity_props_rules === void 0 ? [] : _entity_props_rules;
15745
- descriptor = {};
15746
- if (rules2.length) {
15747
- if (rules2.length > 1) {
15748
- descriptor[name2] = [];
15749
- rules2.forEach(function(v) {
15750
- descriptor[name2].push(v);
15751
- });
15752
- } else {
15753
- descriptor[name2] = rules2[0];
15754
- }
15755
- }
15756
- validator = new Schema(descriptor);
15757
- _state2.label = 1;
15758
- case 1:
15759
- _state2.trys.push([
15760
- 1,
15761
- 3,
15762
- 4,
15763
- 5
15764
- ]);
15765
- return [
15766
- 4,
15767
- validator.validate(_define_property({}, name2, (_this_store = _this2.store) === null || _this_store === void 0 ? void 0 : _this_store[name2]))
15768
- ];
15769
- case 2:
15770
- _state2.sent();
15771
- return [
15772
- 3,
15773
- 5
15774
- ];
15775
- case 3:
15776
- param = _state2.sent();
15777
- errors = param.errors;
15778
- if (errors) {
15779
- (_errs = errs).push.apply(_errs, _to_consumable_array(errors));
15780
- _this2.errors[name2] = errors;
15781
- }
15782
- return [
15783
- 3,
15784
- 5
15785
- ];
15786
- case 4:
15787
- if (!errs || errs.length === 0) {
15788
- _this2.errors[name2] = [];
15789
- }
15790
- return [
15791
- 7
15792
- ];
15793
- case 5:
15794
- entity.onStoreChange("validate");
15795
- return [
15796
- 2
15797
- ];
15798
- }
15799
- });
15800
- };
15801
- _iterator = filterEntitys[Symbol.iterator]();
15802
- _state.label = 2;
15803
- case 2:
15804
- if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
15805
- 3,
15806
- 5
15807
- ];
15808
- return [
15809
- 5,
15810
- __values(_loop())
15811
- ];
15812
- case 3:
15813
- _state.sent();
15814
- _state.label = 4;
15815
- case 4:
15816
- _iteratorNormalCompletion = true;
15817
- return [
15818
- 3,
15819
- 2
15820
- ];
15821
- case 5:
15822
15834
  return [
15823
- 3,
15824
- 8
15825
- ];
15826
- case 6:
15827
- err = _state.sent();
15828
- _didIteratorError = true;
15829
- _iteratorError = err;
15830
- return [
15831
- 3,
15832
- 8
15835
+ 4,
15836
+ _this2.validateFields()
15833
15837
  ];
15834
- case 7:
15835
- try {
15836
- if (!_iteratorNormalCompletion && _iterator.return != null) {
15837
- _iterator.return();
15838
- }
15839
- } finally {
15840
- if (_didIteratorError) {
15841
- throw _iteratorError;
15842
- }
15838
+ case 1:
15839
+ errors = _state.sent();
15840
+ if (errors.length === 0) {
15841
+ (_this_callbacks_onFinish = (_this_callbacks = _this2.callbacks).onFinish) === null || _this_callbacks_onFinish === void 0 ? void 0 : _this_callbacks_onFinish.call(_this_callbacks, _this2.store);
15842
+ } else if (errors.length > 0) {
15843
+ (_this_callbacks_onFinishFailed = (_this_callbacks1 = _this2.callbacks).onFinishFailed) === null || _this_callbacks_onFinishFailed === void 0 ? void 0 : _this_callbacks_onFinishFailed.call(_this_callbacks1, _this2.store, errors);
15843
15844
  }
15844
15845
  return [
15845
- 7
15846
- ];
15847
- case 8:
15848
- return [
15849
- 2,
15850
- errs
15846
+ 2
15851
15847
  ];
15852
15848
  }
15853
15849
  });
15854
- });
15855
- return function(nameList) {
15856
- return _ref.apply(this, arguments);
15857
- };
15858
- }());
15859
- _define_property(this, "submit", /* @__PURE__ */ _async_to_generator(function() {
15860
- var errors, _this_callbacks_onFinish, _this_callbacks, _this_callbacks_onFinishFailed, _this_callbacks1;
15861
- return __generator(this, function(_state) {
15862
- switch (_state.label) {
15863
- case 0:
15864
- return [
15865
- 4,
15866
- _this2.validateFields()
15867
- ];
15868
- case 1:
15869
- errors = _state.sent();
15870
- if (errors.length === 0) {
15871
- (_this_callbacks_onFinish = (_this_callbacks = _this2.callbacks).onFinish) === null || _this_callbacks_onFinish === void 0 ? void 0 : _this_callbacks_onFinish.call(_this_callbacks, _this2.store);
15872
- } else if (errors.length > 0) {
15873
- (_this_callbacks_onFinishFailed = (_this_callbacks1 = _this2.callbacks).onFinishFailed) === null || _this_callbacks_onFinishFailed === void 0 ? void 0 : _this_callbacks_onFinishFailed.call(_this_callbacks1, _this2.store, errors);
15874
- }
15875
- return [
15876
- 2
15877
- ];
15850
+ }));
15851
+ _define_property(this, "resetFields", function(namePaths) {
15852
+ if (namePaths && namePaths.length) {
15853
+ namePaths.forEach(function(path) {
15854
+ _this.errors[path] = null;
15855
+ _this.fieldEntities.forEach(function(entity) {
15856
+ var name2 = entity.props.name;
15857
+ if (name2 === path) {
15858
+ if (path in _this.initialValues) {
15859
+ _this.updateStore(_define_property({}, path, _this.initialValues[path]));
15860
+ } else {
15861
+ delete _this.store[path];
15862
+ }
15863
+ entity.onStoreChange("reset");
15864
+ }
15865
+ });
15866
+ });
15867
+ } else {
15868
+ var nextStore = merge({}, _this.initialValues);
15869
+ _this.updateStore(nextStore);
15870
+ _this.fieldEntities.forEach(function(entity) {
15871
+ entity.onStoreChange("reset");
15872
+ });
15878
15873
  }
15879
15874
  });
15880
- }));
15881
- _define_property(this, "resetFields", function() {
15882
- _this.errors.length = 0;
15883
- _this.store = _this.initialValues;
15884
- _this.fieldEntities.forEach(function(entity) {
15885
- entity.onStoreChange("reset");
15875
+ _define_property(this, "registerUpdate", function(field, shouldUpdate) {
15876
+ _this.updateList.push({
15877
+ entity: field,
15878
+ condition: shouldUpdate
15879
+ });
15880
+ return function() {
15881
+ _this.updateList = _this.updateList.filter(function(i2) {
15882
+ return i2.entity !== field;
15883
+ });
15884
+ };
15886
15885
  });
15887
- });
15888
- _define_property(this, "registerUpdate", function(field, shouldUpdate) {
15889
- _this.updateList.push({
15890
- entity: field,
15891
- condition: shouldUpdate
15886
+ _define_property(this, "dispatch", function(param) {
15887
+ var name2 = param.name;
15888
+ _this.validateFields([
15889
+ name2
15890
+ ]);
15892
15891
  });
15893
- return function() {
15894
- _this.updateList = _this.updateList.filter(function(i2) {
15895
- return i2.entity !== field;
15896
- });
15897
- };
15898
- });
15899
- _define_property(this, "dispatch", function(param) {
15900
- var name2 = param.name;
15901
- _this.validateFields([
15902
- name2
15903
- ]);
15904
- });
15905
- _define_property(this, "getInternal", function(key2) {
15906
- if (key2 === SECRET) {
15892
+ _define_property(this, "getInternal", function(key2) {
15893
+ if (key2 === SECRET) {
15894
+ return {
15895
+ registerField: _this.registerField,
15896
+ setCallback: _this.setCallback,
15897
+ setInitialValues: _this.setInitialValues,
15898
+ dispatch: _this.dispatch,
15899
+ store: _this.store,
15900
+ fieldEntities: _this.fieldEntities,
15901
+ registerUpdate: _this.registerUpdate,
15902
+ registerWatch: _this.registerWatch
15903
+ };
15904
+ }
15905
+ });
15906
+ _define_property(this, "getForm", function() {
15907
15907
  return {
15908
- registerField: _this.registerField,
15909
- setCallback: _this.setCallback,
15910
- setInitialValues: _this.setInitialValues,
15911
- dispatch: _this.dispatch,
15912
- store: _this.store,
15913
- fieldEntities: _this.fieldEntities,
15914
- registerUpdate: _this.registerUpdate
15908
+ getFieldValue: _this.getFieldValue,
15909
+ getFieldsValue: _this.getFieldsValue,
15910
+ setFieldsValue: _this.setFieldsValue,
15911
+ setFieldValue: _this.setFieldValue,
15912
+ resetFields: _this.resetFields,
15913
+ validateFields: _this.validateFields,
15914
+ submit: _this.submit,
15915
+ errors: _this.errors,
15916
+ getInternal: _this.getInternal
15915
15917
  };
15916
- }
15917
- });
15918
- _define_property(this, "getForm", function() {
15919
- return {
15920
- getFieldValue: _this.getFieldValue,
15921
- getFieldsValue: _this.getFieldsValue,
15922
- setFieldsValue: _this.setFieldsValue,
15923
- resetFields: _this.resetFields,
15924
- validateFields: _this.validateFields,
15925
- submit: _this.submit,
15926
- errors: _this.errors,
15927
- getInternal: _this.getInternal
15918
+ });
15919
+ _define_property(this, "watchList", []);
15920
+ _define_property(this, "registerWatch", function(callback) {
15921
+ _this.watchList.push(callback);
15922
+ return function() {
15923
+ _this.watchList = _this.watchList.filter(function(fn) {
15924
+ return fn !== callback;
15925
+ });
15926
+ };
15927
+ });
15928
+ _define_property(this, "notifyWatch", function() {
15929
+ var namePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
15930
+ if (_this1.watchList.length) {
15931
+ var allValues;
15932
+ if (!namePath || namePath.length === 0) {
15933
+ allValues = _this1.getFieldsValue(true);
15934
+ } else {
15935
+ allValues = _this1.getFieldsValue(namePath);
15936
+ }
15937
+ _this1.watchList.forEach(function(callback) {
15938
+ callback(allValues, namePath);
15939
+ });
15940
+ }
15941
+ });
15942
+ this.callbacks = {
15943
+ onFinish: function() {
15944
+ },
15945
+ onFinishFailed: function() {
15946
+ }
15928
15947
  };
15929
- });
15930
- this.callbacks = {
15931
- onFinish: function() {
15932
- },
15933
- onFinishFailed: function() {
15948
+ }
15949
+ _create_class(FormStore2, [
15950
+ {
15951
+ key: "updateStore",
15952
+ value: function updateStore(nextStore) {
15953
+ this.store = nextStore;
15954
+ }
15934
15955
  }
15935
- };
15936
- };
15956
+ ]);
15957
+ return FormStore2;
15958
+ }();
15937
15959
  var useForm = function(form) {
15938
15960
  var formRef = React.useRef();
15939
15961
  if (!formRef.current) {
@@ -15948,10 +15970,32 @@ Please add \`${key2}Action\` when creating your handler.`);
15948
15970
  formRef.current
15949
15971
  ];
15950
15972
  };
15973
+ var useWatch = function(path, form) {
15974
+ var formInstance = form.getInternal(SECRET);
15975
+ var _useState = _sliced_to_array(React.useState(), 2), value2 = _useState[0], setValue = _useState[1];
15976
+ React.useEffect(function() {
15977
+ var unsubscribe = formInstance.registerWatch(function(data2, namePath) {
15978
+ var value3 = data2[path];
15979
+ setValue(value3);
15980
+ });
15981
+ var initialValue = form.getFieldsValue(true);
15982
+ if (value2 !== initialValue[path]) {
15983
+ setValue(initialValue[path]);
15984
+ }
15985
+ return function() {
15986
+ return unsubscribe();
15987
+ };
15988
+ }, [
15989
+ form
15990
+ ]);
15991
+ return value2;
15992
+ };
15951
15993
  var defaultProps$_ = _object_spread_props(_object_spread({}, ComponentDefaults), {
15952
15994
  labelPosition: "right",
15953
15995
  starPosition: "left",
15996
+ disabled: false,
15954
15997
  divider: false,
15998
+ validateTrigger: "onChange",
15955
15999
  onFinish: function(values) {
15956
16000
  },
15957
16001
  onFinishFailed: function(values, errorFields) {
@@ -15964,7 +16008,7 @@ Please add \`${key2}Action\` when creating your handler.`);
15964
16008
  };
15965
16009
  var Form = /* @__PURE__ */ React.forwardRef(function(props, ref) {
15966
16010
  var classPrefix2 = "nut-form";
15967
- var _$_object_spread = _object_spread({}, defaultProps$_, props), className = _$_object_spread.className, style = _$_object_spread.style, footer = _$_object_spread.footer, children = _$_object_spread.children, initialValues = _$_object_spread.initialValues, divider = _$_object_spread.divider, onFinish = _$_object_spread.onFinish, onFinishFailed = _$_object_spread.onFinishFailed, labelPosition = _$_object_spread.labelPosition, starPosition = _$_object_spread.starPosition, form = _$_object_spread.form;
16011
+ var _$_object_spread = _object_spread({}, defaultProps$_, props), className = _$_object_spread.className, style = _$_object_spread.style, footer = _$_object_spread.footer, children = _$_object_spread.children, initialValues = _$_object_spread.initialValues, divider = _$_object_spread.divider, disabled = _$_object_spread.disabled, onFinish = _$_object_spread.onFinish, onFinishFailed = _$_object_spread.onFinishFailed, validateTrigger = _$_object_spread.validateTrigger, labelPosition = _$_object_spread.labelPosition, starPosition = _$_object_spread.starPosition, form = _$_object_spread.form;
15968
16012
  var formInstance;
15969
16013
  if (form !== void 0) {
15970
16014
  formInstance = form;
@@ -16003,7 +16047,12 @@ Please add \`${key2}Action\` when creating your handler.`);
16003
16047
  }, /* @__PURE__ */ React.createElement(Cell.Group, {
16004
16048
  divider
16005
16049
  }, /* @__PURE__ */ React.createElement(Context.Provider, {
16006
- value: formInstance
16050
+ value: {
16051
+ formInstance,
16052
+ labelPosition,
16053
+ disabled,
16054
+ validateTrigger
16055
+ }
16007
16056
  }, children), footer ? /* @__PURE__ */ React.createElement(Cell, {
16008
16057
  className: "".concat(classPrefix2, "-footer")
16009
16058
  }, footer) : null));
@@ -16063,6 +16112,14 @@ Please add \`${key2}Action\` when creating your handler.`);
16063
16112
  }
16064
16113
  ).$$typeof === component.type.$$typeof;
16065
16114
  }
16115
+ function toArray(value2) {
16116
+ if (value2 === void 0 || value2 === null) {
16117
+ return [];
16118
+ }
16119
+ return Array.isArray(value2) ? value2 : [
16120
+ value2
16121
+ ];
16122
+ }
16066
16123
  var defaultProps$Z = _object_spread_props(_object_spread({}, ComponentDefaults), {
16067
16124
  required: false,
16068
16125
  name: "",
@@ -16074,7 +16131,6 @@ Please add \`${key2}Action\` when creating your handler.`);
16074
16131
  }
16075
16132
  ],
16076
16133
  errorMessageAlign: "left",
16077
- validateTrigger: "onChange",
16078
16134
  shouldUpdate: false,
16079
16135
  noStyle: false
16080
16136
  });
@@ -16088,15 +16144,19 @@ Please add \`${key2}Action\` when creating your handler.`);
16088
16144
  ]), _define_property(_this, "cancelRegister", void 0), _define_property(_this, "componentRef", void 0), _define_property(_this, "eventOff", void 0), // children添加value属性和onChange事件
16089
16145
  _define_property(_this, "getControlled", function(children) {
16090
16146
  var _children_props;
16091
- var _this_context = _this.context, setFieldsValue = _this_context.setFieldsValue, getFieldValue = _this_context.getFieldValue;
16092
- var dispatch = _this.context.getInternal(SECRET).dispatch;
16147
+ var _this_context_formInstance = _this.context.formInstance, setFieldsValue = _this_context_formInstance.setFieldsValue, getFieldValue = _this_context_formInstance.getFieldValue;
16148
+ var dispatch = _this.context.formInstance.getInternal(SECRET).dispatch;
16093
16149
  var _this_props = _this.props, _this_props_name = _this_props.name, name2 = _this_props_name === void 0 ? "" : _this_props_name;
16094
16150
  if (children === null || children === void 0 ? void 0 : (_children_props = children.props) === null || _children_props === void 0 ? void 0 : _children_props.defaultValue) {
16095
- console.warn("通过 initialValue 设置初始值");
16151
+ if (process.env.NODE_ENV !== "production") {
16152
+ console.warn("[NutUI] FormItem:", "请通过 initialValue 设置初始值,而不是 defaultValue");
16153
+ }
16096
16154
  }
16097
16155
  var fieldValue = getFieldValue(name2);
16098
16156
  var _obj;
16099
- var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {}, _define_property(_obj, _this.props.valuePropName || "value", fieldValue !== void 0 ? fieldValue : _this.props.initialValue), _define_property(_obj, _this.props.trigger || "onChange", function() {
16157
+ var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {
16158
+ className: children.props.className
16159
+ }, _define_property(_obj, _this.props.valuePropName || "value", fieldValue !== void 0 ? fieldValue : _this.props.initialValue), _define_property(_obj, _this.props.trigger || "onChange", function() {
16100
16160
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16101
16161
  args[_key] = arguments[_key];
16102
16162
  }
@@ -16109,33 +16169,27 @@ Please add \`${key2}Action\` when creating your handler.`);
16109
16169
  var _this_props2;
16110
16170
  next = (_this_props2 = _this.props).getValueFromEvent.apply(_this_props2, _to_consumable_array(args));
16111
16171
  }
16112
- setFieldsValue(_define_property({}, name2, next), false);
16172
+ setFieldsValue(_define_property({}, name2, next));
16113
16173
  }), _obj));
16114
16174
  var validateTrigger = _this.props.validateTrigger;
16115
- var validateTriggers = [
16116
- _this.props.trigger || "onChange"
16117
- ];
16118
- if (validateTrigger) {
16119
- validateTriggers = typeof validateTrigger === "string" ? [
16120
- validateTrigger
16121
- ] : _to_consumable_array(validateTrigger);
16122
- validateTriggers.forEach(function(trigger) {
16123
- var originTrigger = controlled[trigger];
16124
- controlled[trigger] = function() {
16125
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16126
- args[_key] = arguments[_key];
16127
- }
16128
- if (originTrigger) {
16129
- originTrigger.apply(void 0, _to_consumable_array(args));
16130
- }
16131
- if (_this.props.rules && _this.props.rules.length) {
16132
- dispatch({
16133
- name: _this.props.name
16134
- });
16135
- }
16136
- };
16137
- });
16138
- }
16175
+ var mergedValidateTrigger = validateTrigger || _this.context.validateTrigger;
16176
+ var validateTriggers = toArray(mergedValidateTrigger);
16177
+ validateTriggers.forEach(function(trigger) {
16178
+ var originTrigger = controlled[trigger];
16179
+ controlled[trigger] = function() {
16180
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16181
+ args[_key] = arguments[_key];
16182
+ }
16183
+ if (originTrigger) {
16184
+ originTrigger.apply(void 0, _to_consumable_array(args));
16185
+ }
16186
+ if (_this.props.rules && _this.props.rules.length) {
16187
+ dispatch({
16188
+ name: _this.props.name
16189
+ });
16190
+ }
16191
+ };
16192
+ });
16139
16193
  if (isForwardRefComponent(children)) {
16140
16194
  controlled.ref = function(componentInstance) {
16141
16195
  var originRef = children.ref;
@@ -16160,7 +16214,7 @@ Please add \`${key2}Action\` when creating your handler.`);
16160
16214
  });
16161
16215
  }), _define_property(_this, "onStoreChange", function(type2) {
16162
16216
  if (type2 === "reset") {
16163
- _this.context.errors[_this.props.name] = [];
16217
+ _this.context.formInstance.errors[_this.props.name] = [];
16164
16218
  _this.refresh();
16165
16219
  } else {
16166
16220
  _this.forceUpdate();
@@ -16170,23 +16224,25 @@ Please add \`${key2}Action\` when creating your handler.`);
16170
16224
  var requiredInRules = rules2 === null || rules2 === void 0 ? void 0 : rules2.some(function(rule) {
16171
16225
  return rule.required;
16172
16226
  });
16173
- var item = name2 ? _this.context.errors[name2] : [];
16174
- var starPosition = _this.context.starPosition;
16175
- var renderStar = (required2 || requiredInRules) && /* @__PURE__ */ React.createElement("i", {
16176
- className: "required"
16177
- });
16178
- var renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
16227
+ var item = name2 ? _this.context.formInstance.errors[name2] : [];
16228
+ var starPosition = _this.context.formInstance.starPosition;
16229
+ var renderStar = (required2 || requiredInRules) && /* @__PURE__ */ React.createElement("div", {
16230
+ className: "nut-form-item-label-required required"
16231
+ }, "*");
16232
+ var renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
16233
+ className: "nut-form-item-labeltxt"
16234
+ }, starPosition === "left" ? renderStar : null, label), starPosition === "right" ? renderStar : null);
16179
16235
  return /* @__PURE__ */ React.createElement(Cell, {
16180
- className: "nut-form-item ".concat(className),
16236
+ className: "".concat(_this.getClassNameWithDirection("nut-form-item"), " ").concat(className),
16181
16237
  style,
16182
16238
  align,
16183
16239
  onClick: function(e2) {
16184
16240
  return _this.props.onClick && _this.props.onClick(e2, _this.componentRef);
16185
16241
  }
16186
16242
  }, label ? /* @__PURE__ */ React.createElement("div", {
16187
- className: "nut-cell-title nut-form-item-label"
16243
+ className: "nut-cell-title ".concat(_this.getClassNameWithDirection("nut-form-item-label"))
16188
16244
  }, renderLabel) : null, /* @__PURE__ */ React.createElement("div", {
16189
- className: "nut-cell-value nut-form-item-body"
16245
+ className: "nut-cell-value ".concat(_this.getClassNameWithDirection("nut-form-item-body"))
16190
16246
  }, /* @__PURE__ */ React.createElement("div", {
16191
16247
  className: "nut-form-item-body-slots"
16192
16248
  }, childNode), item && item.length > 0 && /* @__PURE__ */ React.createElement("div", {
@@ -16206,11 +16262,11 @@ Please add \`${key2}Action\` when creating your handler.`);
16206
16262
  {
16207
16263
  key: "componentDidMount",
16208
16264
  value: function componentDidMount() {
16209
- var _this_context_getInternal = this.context.getInternal(SECRET), _this_context_getInternal_store = _this_context_getInternal.store, store = _this_context_getInternal_store === void 0 ? {} : _this_context_getInternal_store, setInitialValues = _this_context_getInternal.setInitialValues;
16265
+ var _this_context_formInstance_getInternal = this.context.formInstance.getInternal(SECRET), _this_context_formInstance_getInternal_store = _this_context_formInstance_getInternal.store, store = _this_context_formInstance_getInternal_store === void 0 ? {} : _this_context_formInstance_getInternal_store, setInitialValues = _this_context_formInstance_getInternal.setInitialValues;
16210
16266
  if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
16211
16267
  setInitialValues(_object_spread_props(_object_spread({}, store), _define_property({}, this.props.name, this.props.initialValue)), true);
16212
16268
  }
16213
- var _this_context_getInternal1 = this.context.getInternal(SECRET), registerField = _this_context_getInternal1.registerField, registerUpdate = _this_context_getInternal1.registerUpdate;
16269
+ var _this_context_formInstance_getInternal1 = this.context.formInstance.getInternal(SECRET), registerField = _this_context_formInstance_getInternal1.registerField, registerUpdate = _this_context_formInstance_getInternal1.registerUpdate;
16214
16270
  this.cancelRegister = registerField(this);
16215
16271
  this.eventOff = registerUpdate(this, this.props.shouldUpdate);
16216
16272
  }
@@ -16226,6 +16282,15 @@ Please add \`${key2}Action\` when creating your handler.`);
16226
16282
  }
16227
16283
  }
16228
16284
  },
16285
+ {
16286
+ key: "getClassNameWithDirection",
16287
+ value: function getClassNameWithDirection(className) {
16288
+ if (className && this.context.labelPosition) {
16289
+ return "".concat(className, " ").concat(className, "-").concat(this.context.labelPosition);
16290
+ }
16291
+ return className;
16292
+ }
16293
+ },
16229
16294
  {
16230
16295
  key: "render",
16231
16296
  value: function render2() {
@@ -16235,11 +16300,13 @@ Please add \`${key2}Action\` when creating your handler.`);
16235
16300
  if (!this.props.shouldUpdate) {
16236
16301
  returnChildNode = /* @__PURE__ */ React.cloneElement(child, this.getControlled(child));
16237
16302
  } else {
16238
- returnChildNode = child(this.context);
16303
+ returnChildNode = child(this.context.formInstance);
16239
16304
  }
16240
16305
  return /* @__PURE__ */ React.createElement(React.Fragment, {
16241
16306
  key: this.state.resetCount
16242
- }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode));
16307
+ }, /* @__PURE__ */ React.createElement("div", {
16308
+ className: this.context.disabled ? "nut-form-item-disabled" : ""
16309
+ }, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
16243
16310
  }
16244
16311
  }
16245
16312
  ]);
@@ -16250,6 +16317,7 @@ Please add \`${key2}Action\` when creating your handler.`);
16250
16317
  var InnerForm = Form;
16251
16318
  InnerForm.Item = FormItem;
16252
16319
  InnerForm.useForm = useForm;
16320
+ InnerForm.useWatch = useWatch;
16253
16321
  function trimExtraChar(value2, char, regExp) {
16254
16322
  var index2 = value2.indexOf(char);
16255
16323
  if (index2 === -1) {
@@ -16750,7 +16818,7 @@ Please add \`${key2}Action\` when creating your handler.`);
16750
16818
  parent2.updateTitle(text2, index2);
16751
16819
  }
16752
16820
  };
16753
- var handleClick2 = function(item) {
16821
+ var handleClick = function(item) {
16754
16822
  parent2.toggleMenuItem(index2);
16755
16823
  setTitle(item.text);
16756
16824
  setValue(item.value);
@@ -16845,7 +16913,7 @@ Please add \`${key2}Action\` when creating your handler.`);
16845
16913
  flexBasis: "".concat(100 / columns, "%")
16846
16914
  },
16847
16915
  onClick: function() {
16848
- handleClick2(item);
16916
+ handleClick(item);
16849
16917
  }
16850
16918
  }, item.value === innerValue ? /* @__PURE__ */ React.createElement("i", {
16851
16919
  className: "nut-menu-container-item-icon"
@@ -17308,7 +17376,7 @@ Please add \`${key2}Action\` when creating your handler.`);
17308
17376
  var renderRadioItem = function() {
17309
17377
  return renderByShape(context2 && context2.shape ? context2.shape : shape);
17310
17378
  };
17311
- var handleClick2 = function(e2) {
17379
+ var handleClick = function(e2) {
17312
17380
  if (disabled || checkedStatement) return;
17313
17381
  setCheckedStatement(!checkedStatement);
17314
17382
  };
@@ -17316,7 +17384,7 @@ Please add \`${key2}Action\` when creating your handler.`);
17316
17384
  return /* @__PURE__ */ React.createElement("div", _object_spread({
17317
17385
  className: cls,
17318
17386
  style,
17319
- onClick: handleClick2
17387
+ onClick: handleClick
17320
17388
  }, rest), renderRadioItem());
17321
17389
  };
17322
17390
  Radio.displayName = "NutRadio";
@@ -18195,7 +18263,7 @@ Please add \`${key2}Action\` when creating your handler.`);
18195
18263
  var locale = useConfig().locale;
18196
18264
  var _ref = _object_spread({}, defaultProps$O, props), title = _ref.title, description = _ref.description, tips = _ref.tips, outerVisible = _ref.visible, value2 = _ref.value, error = _ref.error, hideFooter = _ref.hideFooter, length2 = _ref.length, plain = _ref.plain, style = _ref.style, className = _ref.className;
18197
18265
  _ref.closeable;
18198
- var autoFocus = _ref.autoFocus, onFocus = _ref.onFocus, onChange = _ref.onChange, onConfirm = _ref.onConfirm, onTips = _ref.onTips, onCancel = _ref.onCancel, onClose = _ref.onClose, onComplete = _ref.onComplete;
18266
+ var autoFocus = _ref.autoFocus, round = _ref.round, onFocus = _ref.onFocus, onChange = _ref.onChange, onConfirm = _ref.onConfirm, onTips = _ref.onTips, onCancel = _ref.onCancel, onClose = _ref.onClose, onComplete = _ref.onComplete;
18199
18267
  _ref.onOverlayClick;
18200
18268
  _ref.onCloseIconClick;
18201
18269
  var rest = _object_without_properties(_ref, [
@@ -18212,6 +18280,7 @@ Please add \`${key2}Action\` when creating your handler.`);
18212
18280
  "className",
18213
18281
  "closeable",
18214
18282
  "autoFocus",
18283
+ "round",
18215
18284
  "onFocus",
18216
18285
  "onChange",
18217
18286
  "onConfirm",
@@ -18275,15 +18344,12 @@ Please add \`${key2}Action\` when creating your handler.`);
18275
18344
  onConfirm && onConfirm(inputValue);
18276
18345
  };
18277
18346
  return /* @__PURE__ */ React.createElement(Popup, _object_spread({
18278
- style: {
18279
- padding: "32px 24px 28px 24px",
18280
- borderRadius: "12px",
18281
- textAlign: "center"
18282
- },
18347
+ className: "".concat(classPrefix2, "-popup"),
18283
18348
  visible,
18284
18349
  closeable: true,
18285
18350
  onOverlayClick: handleClose,
18286
- onCloseIconClick: handleClose
18351
+ onCloseIconClick: handleClose,
18352
+ round
18287
18353
  }, rest), /* @__PURE__ */ React.createElement("div", {
18288
18354
  className: classNames(classPrefix2, className),
18289
18355
  style
@@ -19475,13 +19541,13 @@ Please add \`${key2}Action\` when creating your handler.`);
19475
19541
  className: classNames("".concat(classPrefix2, "-footer"), _define_property({}, footerDirection, footerDirection))
19476
19542
  }, footer);
19477
19543
  };
19478
- var handleClick2 = function(e2) {
19544
+ var handleClick = function(e2) {
19479
19545
  onClick && onClick(e2);
19480
19546
  };
19481
19547
  return /* @__PURE__ */ React.createElement("div", {
19482
19548
  className: classNames("".concat(classPrefix2, "-outer"), className),
19483
19549
  style,
19484
- onClick: handleClick2
19550
+ onClick: handleClick
19485
19551
  }, close, header, /* @__PURE__ */ React.createElement("div", {
19486
19552
  className: classPrefix2,
19487
19553
  style: {
@@ -19539,6 +19605,9 @@ Please add \`${key2}Action\` when creating your handler.`);
19539
19605
  unmountOnExit: true,
19540
19606
  appear: true
19541
19607
  }, /* @__PURE__ */ React.createElement(Content, _object_spread_props(_object_spread({}, restProps), {
19608
+ style: {
19609
+ zIndex
19610
+ },
19542
19611
  visible
19543
19612
  }))));
19544
19613
  };
@@ -19911,59 +19980,6 @@ Please add \`${key2}Action\` when creating your handler.`);
19911
19980
  };
19912
19981
  Empty.displayName = "NutEmpty";
19913
19982
  var defaultProps$E = _object_spread_props(_object_spread({}, ComponentDefaults), {
19914
- title: null,
19915
- description: null,
19916
- icon: "",
19917
- status: "info",
19918
- actions: []
19919
- });
19920
- var ResultPage = function(props) {
19921
- var _$_object_spread = _object_spread({}, defaultProps$E, props), className = _$_object_spread.className, style = _$_object_spread.style, title = _$_object_spread.title, description = _$_object_spread.description, icon = _$_object_spread.icon, status = _$_object_spread.status, actions = _$_object_spread.actions, children = _$_object_spread.children;
19922
- var classPrefix2 = "nut-resultpage";
19923
- var cls = classNames(classPrefix2, className);
19924
- var defaultStatus2 = {
19925
- success: /* @__PURE__ */ React.createElement(m$1, {
19926
- color: "#00D900"
19927
- }),
19928
- error: /* @__PURE__ */ React.createElement(n$4, {
19929
- color: "#FF0F23"
19930
- }),
19931
- warning: /* @__PURE__ */ React.createElement(c, {
19932
- color: "#FFBF00"
19933
- }),
19934
- info: /* @__PURE__ */ React.createElement(p$2, {
19935
- color: "#0073FF"
19936
- }),
19937
- waiting: /* @__PURE__ */ React.createElement(n$a, {
19938
- color: "#0073FF"
19939
- })
19940
- };
19941
- return /* @__PURE__ */ React.createElement("div", {
19942
- className: cls,
19943
- style
19944
- }, /* @__PURE__ */ React.createElement("div", {
19945
- className: "".concat(classPrefix2, "-icon")
19946
- }, icon || defaultStatus2[status]), typeof title === "string" && title ? /* @__PURE__ */ React.createElement("div", {
19947
- className: "".concat(classPrefix2, "-title")
19948
- }, title) : title, typeof description === "string" && description ? /* @__PURE__ */ React.createElement("div", {
19949
- className: "".concat(classPrefix2, "-description")
19950
- }, description) : description, actions.length ? /* @__PURE__ */ React.createElement("div", {
19951
- className: "".concat(classPrefix2, "-actions")
19952
- }, actions.map(function(action, index2) {
19953
- action.text;
19954
- var rest = _object_without_properties(action, [
19955
- "text"
19956
- ]);
19957
- return /* @__PURE__ */ React.createElement("div", {
19958
- className: "".concat(classPrefix2, "-action"),
19959
- key: index2
19960
- }, /* @__PURE__ */ React.createElement(Button, _object_spread_props(_object_spread({}, rest), {
19961
- size: "large"
19962
- }), action === null || action === void 0 ? void 0 : action.text));
19963
- })) : null, children);
19964
- };
19965
- ResultPage.displayName = "NutResultPage";
19966
- var defaultProps$D = _object_spread_props(_object_spread({}, ComponentDefaults), {
19967
19983
  type: "default",
19968
19984
  hasMore: true,
19969
19985
  threshold: 200,
@@ -19983,7 +19999,7 @@ Please add \`${key2}Action\` when creating your handler.`);
19983
19999
  return null;
19984
20000
  };
19985
20001
  var locale = useConfig().locale;
19986
- var _ref = _object_spread({}, defaultProps$D, props), children = _ref.children, type2 = _ref.type, hasMore = _ref.hasMore, threshold = _ref.threshold, target = _ref.target, capture = _ref.capture, pullRefresh = _ref.pullRefresh, pullingText = _ref.pullingText, loadingText = _ref.loadingText, loadMoreText = _ref.loadMoreText, className = _ref.className, onRefresh = _ref.onRefresh, onLoadMore = _ref.onLoadMore, onScroll = _ref.onScroll, restProps = _object_without_properties(_ref, [
20002
+ var _ref = _object_spread({}, defaultProps$E, props), children = _ref.children, type2 = _ref.type, hasMore = _ref.hasMore, threshold = _ref.threshold, target = _ref.target, capture = _ref.capture, pullRefresh = _ref.pullRefresh, pullingText = _ref.pullingText, loadingText = _ref.loadingText, loadMoreText = _ref.loadMoreText, className = _ref.className, onRefresh = _ref.onRefresh, onLoadMore = _ref.onLoadMore, onScroll = _ref.onScroll, restProps = _object_without_properties(_ref, [
19987
20003
  "children",
19988
20004
  "type",
19989
20005
  "hasMore",
@@ -23473,7 +23489,7 @@ Please add \`${key2}Action\` when creating your handler.`);
23473
23489
  shapePath._length = 0;
23474
23490
  shapePath.c = false;
23475
23491
  }
23476
- function clone(shape) {
23492
+ function clone2(shape) {
23477
23493
  var cloned = factory.newElement();
23478
23494
  var i2;
23479
23495
  var len = shape._length === void 0 ? shape.v.length : shape._length;
@@ -23485,7 +23501,7 @@ Please add \`${key2}Action\` when creating your handler.`);
23485
23501
  return cloned;
23486
23502
  }
23487
23503
  var factory = poolFactory(4, create, release);
23488
- factory.clone = clone;
23504
+ factory.clone = clone2;
23489
23505
  return factory;
23490
23506
  }();
23491
23507
  function ShapeCollection() {
@@ -24203,7 +24219,7 @@ Please add \`${key2}Action\` when creating your handler.`);
24203
24219
  }
24204
24220
  return true;
24205
24221
  }
24206
- function clone(matr) {
24222
+ function clone2(matr) {
24207
24223
  var i2;
24208
24224
  for (i2 = 0; i2 < 16; i2 += 1) {
24209
24225
  matr.props[i2] = this.props[i2];
@@ -24355,7 +24371,7 @@ Please add \`${key2}Action\` when creating your handler.`);
24355
24371
  this.applyToPointStringified = applyToPointStringified;
24356
24372
  this.toCSS = toCSS;
24357
24373
  this.to2dCSS = to2dCSS;
24358
- this.clone = clone;
24374
+ this.clone = clone2;
24359
24375
  this.cloneFromProps = cloneFromProps;
24360
24376
  this.equals = equals;
24361
24377
  this.inversePoints = inversePoints;
@@ -36989,7 +37005,7 @@ Please add \`${key2}Action\` when creating your handler.`);
36989
37005
  circular: d$3,
36990
37006
  spinner: s
36991
37007
  };
36992
- var defaultProps$C = _object_spread_props(_object_spread({}, ComponentDefaults), {
37008
+ var defaultProps$D = _object_spread_props(_object_spread({}, ComponentDefaults), {
36993
37009
  // 对比一下,个人感觉还是Loading1比较好看一些,所以用它作为了默认的loading图标
36994
37010
  type: "circular",
36995
37011
  direction: "horizontal",
@@ -37000,7 +37016,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37000
37016
  autoplay: true
37001
37017
  };
37002
37018
  var Loading = /* @__PURE__ */ React.forwardRef(function(props, ref) {
37003
- var _ref = _object_spread({}, defaultProps$C, props), className = _ref.className, style = _ref.style, children = _ref.children, direction = _ref.direction, icon = _ref.icon, lottieProps = _ref.lottieProps, rest = _object_without_properties(_ref, [
37019
+ var _ref = _object_spread({}, defaultProps$D, props), className = _ref.className, style = _ref.style, children = _ref.children, direction = _ref.direction, icon = _ref.icon, lottieProps = _ref.lottieProps, rest = _object_without_properties(_ref, [
37004
37020
  "className",
37005
37021
  "style",
37006
37022
  "children",
@@ -37043,7 +37059,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37043
37059
  }, children) : null);
37044
37060
  });
37045
37061
  Loading.displayName = "NutLoading";
37046
- var defaultProps$B = _object_spread_props(_object_spread({}, ComponentDefaults), {
37062
+ var defaultProps$C = _object_spread_props(_object_spread({}, ComponentDefaults), {
37047
37063
  align: "left",
37048
37064
  direction: "horizontal",
37049
37065
  list: [],
@@ -37064,7 +37080,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37064
37080
  });
37065
37081
  var NoticeBar = function(props) {
37066
37082
  var rtl = useRtl();
37067
- var _$_object_spread = _object_spread({}, defaultProps$B, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style, align = _$_object_spread.align, direction = _$_object_spread.direction, list = _$_object_spread.list, duration = _$_object_spread.duration, height2 = _$_object_spread.height, content2 = _$_object_spread.content, closeable = _$_object_spread.closeable, wrap = _$_object_spread.wrap, leftIcon = _$_object_spread.leftIcon, rightIcon = _$_object_spread.rightIcon, right = _$_object_spread.right, delay = _$_object_spread.delay, scrollable = _$_object_spread.scrollable, speed = _$_object_spread.speed, close = _$_object_spread.close, click = _$_object_spread.click, onClose = _$_object_spread.onClose, onClick = _$_object_spread.onClick, onItemClick = _$_object_spread.onItemClick;
37083
+ var _$_object_spread = _object_spread({}, defaultProps$C, props), children = _$_object_spread.children, className = _$_object_spread.className, style = _$_object_spread.style, align = _$_object_spread.align, direction = _$_object_spread.direction, list = _$_object_spread.list, duration = _$_object_spread.duration, height2 = _$_object_spread.height, content2 = _$_object_spread.content, closeable = _$_object_spread.closeable, wrap = _$_object_spread.wrap, leftIcon = _$_object_spread.leftIcon, rightIcon = _$_object_spread.rightIcon, right = _$_object_spread.right, delay = _$_object_spread.delay, scrollable = _$_object_spread.scrollable, speed = _$_object_spread.speed, close = _$_object_spread.close, click = _$_object_spread.click, onClose = _$_object_spread.onClose, onClick = _$_object_spread.onClick, onItemClick = _$_object_spread.onItemClick;
37068
37084
  var classPrefix2 = "nut-noticebar";
37069
37085
  var wrapRef = React.useRef(null);
37070
37086
  var contentRef = React.useRef(null);
@@ -37165,7 +37181,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37165
37181
  }
37166
37182
  }, 0);
37167
37183
  };
37168
- var handleClick2 = function(event) {
37184
+ var handleClick = function(event) {
37169
37185
  click && click(event);
37170
37186
  onClick && onClick(event);
37171
37187
  };
@@ -37374,7 +37390,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37374
37390
  }, showNoticeBar && direction === "horizontal" ? /* @__PURE__ */ React.createElement("div", {
37375
37391
  className: noticebarClass,
37376
37392
  style: barStyle,
37377
- onClick: handleClick2
37393
+ onClick: handleClick
37378
37394
  }, leftIcon ? /* @__PURE__ */ React.createElement("div", {
37379
37395
  className: "nut-noticebar-box-left-icon"
37380
37396
  }, leftIcon) : null, /* @__PURE__ */ React.createElement("div", {
@@ -37397,7 +37413,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37397
37413
  className: "nut-noticebar-vertical",
37398
37414
  style: barStyle,
37399
37415
  ref: container,
37400
- onClick: handleClick2
37416
+ onClick: handleClick
37401
37417
  }, leftIcon ? /* @__PURE__ */ React.createElement("div", {
37402
37418
  className: "nut-noticebar-box-left-icon"
37403
37419
  }, leftIcon) : null, children ? /* @__PURE__ */ React.createElement("div", {
@@ -37641,7 +37657,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37641
37657
  }
37642
37658
  }
37643
37659
  };
37644
- var defaultProps$A = _object_spread_props(_object_spread({}, ComponentDefaults), {
37660
+ var defaultProps$B = _object_spread_props(_object_spread({}, ComponentDefaults), {
37645
37661
  list: [],
37646
37662
  theme: "light",
37647
37663
  location: "bottom",
@@ -37666,7 +37682,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37666
37682
  var classPrefix$b = "nut-popover";
37667
37683
  var Popover = function(props) {
37668
37684
  var rtl = useRtl();
37669
- var _ref = _object_spread({}, defaultProps$A, props), children = _ref.children, list = _ref.list, theme = _ref.theme, location = _ref.location, visible = _ref.visible, offset = _ref.offset, arrowOffset = _ref.arrowOffset, targetId = _ref.targetId, overlay = _ref.overlay, closeOnOutsideClick = _ref.closeOnOutsideClick, closeOnActionClick = _ref.closeOnActionClick, className = _ref.className, showArrow = _ref.showArrow, style = _ref.style, onClick = _ref.onClick, onOpen = _ref.onOpen, onClose = _ref.onClose, onSelect = _ref.onSelect, rest = _object_without_properties(_ref, [
37685
+ var _ref = _object_spread({}, defaultProps$B, props), children = _ref.children, list = _ref.list, theme = _ref.theme, location = _ref.location, visible = _ref.visible, offset = _ref.offset, arrowOffset = _ref.arrowOffset, targetId = _ref.targetId, overlay = _ref.overlay, closeOnOutsideClick = _ref.closeOnOutsideClick, closeOnActionClick = _ref.closeOnActionClick, className = _ref.className, showArrow = _ref.showArrow, style = _ref.style, onClick = _ref.onClick, onOpen = _ref.onOpen, onClose = _ref.onClose, onSelect = _ref.onSelect, rest = _object_without_properties(_ref, [
37670
37686
  "children",
37671
37687
  "list",
37672
37688
  "theme",
@@ -37939,7 +37955,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37939
37955
  return setTimeout(resolve, time2);
37940
37956
  });
37941
37957
  };
37942
- var defaultProps$z = _object_spread_props(_object_spread({}, ComponentDefaults), {
37958
+ var defaultProps$A = _object_spread_props(_object_spread({}, ComponentDefaults), {
37943
37959
  type: "default",
37944
37960
  pullingText: "",
37945
37961
  canReleaseText: "",
@@ -37958,7 +37974,7 @@ Please add \`${key2}Action\` when creating your handler.`);
37958
37974
  };
37959
37975
  var classPrefix2 = "nut-pulltorefresh";
37960
37976
  var locale = useConfig().locale;
37961
- var props = _object_spread({}, defaultProps$z, p2, {
37977
+ var props = _object_spread({}, defaultProps$A, p2, {
37962
37978
  pullingText: p2.pullingText || locale.pullToRefresh.pullingText,
37963
37979
  canReleaseText: p2.canReleaseText || locale.pullToRefresh.canReleaseText,
37964
37980
  refreshingText: p2.refreshingText || locale.pullToRefresh.refreshingText,
@@ -38193,6 +38209,59 @@ Please add \`${key2}Action\` when creating your handler.`);
38193
38209
  }, props.children));
38194
38210
  };
38195
38211
  PullToRefresh.displayName = "NutPullToRefresh";
38212
+ var defaultProps$z = _object_spread_props(_object_spread({}, ComponentDefaults), {
38213
+ title: null,
38214
+ description: null,
38215
+ icon: "",
38216
+ status: "info",
38217
+ actions: []
38218
+ });
38219
+ var ResultPage = function(props) {
38220
+ var _$_object_spread = _object_spread({}, defaultProps$z, props), className = _$_object_spread.className, style = _$_object_spread.style, title = _$_object_spread.title, description = _$_object_spread.description, icon = _$_object_spread.icon, status = _$_object_spread.status, actions = _$_object_spread.actions, children = _$_object_spread.children;
38221
+ var classPrefix2 = "nut-resultpage";
38222
+ var cls = classNames(classPrefix2, className);
38223
+ var defaultStatus2 = {
38224
+ success: /* @__PURE__ */ React.createElement(m$1, {
38225
+ color: "#00D900"
38226
+ }),
38227
+ error: /* @__PURE__ */ React.createElement(n$4, {
38228
+ color: "#FF0F23"
38229
+ }),
38230
+ warning: /* @__PURE__ */ React.createElement(c, {
38231
+ color: "#FFBF00"
38232
+ }),
38233
+ info: /* @__PURE__ */ React.createElement(p$2, {
38234
+ color: "#0073FF"
38235
+ }),
38236
+ waiting: /* @__PURE__ */ React.createElement(n$a, {
38237
+ color: "#0073FF"
38238
+ })
38239
+ };
38240
+ return /* @__PURE__ */ React.createElement("div", {
38241
+ className: cls,
38242
+ style
38243
+ }, /* @__PURE__ */ React.createElement("div", {
38244
+ className: "".concat(classPrefix2, "-icon")
38245
+ }, icon || defaultStatus2[status]), typeof title === "string" && title ? /* @__PURE__ */ React.createElement("div", {
38246
+ className: "".concat(classPrefix2, "-title")
38247
+ }, title) : title, typeof description === "string" && description ? /* @__PURE__ */ React.createElement("div", {
38248
+ className: "".concat(classPrefix2, "-description")
38249
+ }, description) : description, actions.length ? /* @__PURE__ */ React.createElement("div", {
38250
+ className: "".concat(classPrefix2, "-actions")
38251
+ }, actions.map(function(action, index2) {
38252
+ action.text;
38253
+ var rest = _object_without_properties(action, [
38254
+ "text"
38255
+ ]);
38256
+ return /* @__PURE__ */ React.createElement("div", {
38257
+ className: "".concat(classPrefix2, "-action"),
38258
+ key: index2
38259
+ }, /* @__PURE__ */ React.createElement(Button, _object_spread_props(_object_spread({}, rest), {
38260
+ size: "large"
38261
+ }), action === null || action === void 0 ? void 0 : action.text));
38262
+ })) : null, children);
38263
+ };
38264
+ ResultPage.displayName = "NutResultPage";
38196
38265
  var AvatarContext = React.createContext({});
38197
38266
  var defaultProps$y = _object_spread_props(_object_spread({}, ComponentDefaults), {
38198
38267
  maxContent: "",
@@ -38862,7 +38931,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38862
38931
  var classes = classNames((_obj = {
38863
38932
  "nut-ani-container": true
38864
38933
  }, _define_property(_obj, "".concat(classPrefix$7, "-").concat(type2), action === "initial" || clicked), _define_property(_obj, "loop", loop2), _obj), className);
38865
- var handleClick2 = function(event) {
38934
+ var handleClick = function(event) {
38866
38935
  setClicked(true);
38867
38936
  if (!loop2) {
38868
38937
  setTimeout(function() {
@@ -38875,7 +38944,7 @@ Please add \`${key2}Action\` when creating your handler.`);
38875
38944
  className: "nut-animate"
38876
38945
  }, /* @__PURE__ */ React.createElement("div", _object_spread({
38877
38946
  className: classes,
38878
- onClick: handleClick2
38947
+ onClick: handleClick
38879
38948
  }, rest), children));
38880
38949
  };
38881
38950
  Animate.displayName = "NutAnimate";
@@ -39391,7 +39460,7 @@ Please add \`${key2}Action\` when creating your handler.`);
39391
39460
  expanded,
39392
39461
  rotate
39393
39462
  ]);
39394
- var handleClick2 = function() {
39463
+ var handleClick = function() {
39395
39464
  if (!disabled) {
39396
39465
  context2.updateValue(name2);
39397
39466
  }
@@ -39442,7 +39511,7 @@ Please add \`${key2}Action\` when creating your handler.`);
39442
39511
  className: classNames("".concat(classPrefix2, "-header"), {
39443
39512
  disabled
39444
39513
  }),
39445
- onClick: handleClick2
39514
+ onClick: handleClick
39446
39515
  }, /* @__PURE__ */ React.createElement("div", {
39447
39516
  className: "".concat(classPrefix2, "-title")
39448
39517
  }, title), /* @__PURE__ */ React.createElement("div", {
@@ -39921,12 +39990,12 @@ Please add \`${key2}Action\` when creating your handler.`);
39921
39990
  onChange && onChange("collapse");
39922
39991
  }
39923
39992
  };
39924
- var handleClick2 = function() {
39993
+ var handleClick = function() {
39925
39994
  onClick && onClick();
39926
39995
  };
39927
39996
  return /* @__PURE__ */ React.createElement("div", _object_spread({
39928
39997
  className: classes,
39929
- onClick: handleClick2,
39998
+ onClick: handleClick,
39930
39999
  ref: root2
39931
40000
  }, rest), !exceeded ? content2 : null, exceeded && !expanded ? /* @__PURE__ */ React.createElement("span", null, (_ellipsis_current = ellipsis.current) === null || _ellipsis_current === void 0 ? void 0 : _ellipsis_current.leading, expandText ? /* @__PURE__ */ React.createElement("span", {
39932
40001
  className: "nut-ellipsis-text",
@@ -40811,63 +40880,7 @@ Please add \`${key2}Action\` when creating your handler.`);
40811
40880
  }, pageCount)));
40812
40881
  };
40813
40882
  Pagination.displayName = "NutPagination";
40814
- var defaultProps$e = {
40815
- options: [],
40816
- onChange: function(value2) {
40817
- }
40818
- };
40819
- var Segmented = function(props) {
40820
- var classPrefix2 = "nut-segmented";
40821
- var itemClassPrefix = "nut-segmented-item";
40822
- var mergedProps = mergeProps(defaultProps$e, props);
40823
- var options2 = mergedProps.options;
40824
- mergedProps.onChange;
40825
- var _usePropsValue = _sliced_to_array(usePropsValue({
40826
- value: mergedProps.value,
40827
- defaultValue: mergedProps.defaultValue,
40828
- finalValue: 0,
40829
- onChange: mergedProps.onChange
40830
- }), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
40831
- var renderItems = React.useCallback(function(options3, value3) {
40832
- return options3.map(function(option, index2) {
40833
- var optionType = typeof option === "undefined" ? "undefined" : _type_of(option);
40834
- switch (optionType) {
40835
- case "object":
40836
- var opt = option;
40837
- var _obj;
40838
- return /* @__PURE__ */ React.createElement("div", {
40839
- className: classNames(itemClassPrefix, (_obj = {}, _define_property(_obj, "".concat(itemClassPrefix, "-active"), opt.value === value3), _define_property(_obj, "".concat(opt.className), !!opt.className), _obj)),
40840
- key: opt.value,
40841
- onClick: function() {
40842
- if (opt.disabled) return;
40843
- setValue(opt.value);
40844
- }
40845
- }, opt.icon ? /* @__PURE__ */ React.createElement("span", {
40846
- className: "nut-segmented-icon"
40847
- }, opt.icon) : null, opt.label);
40848
- default: {
40849
- if (typeof option !== "string" && typeof option !== "number") {
40850
- console.warn("Unsupported option type:", optionType);
40851
- }
40852
- return /* @__PURE__ */ React.createElement("div", {
40853
- className: classNames(itemClassPrefix, _define_property({}, "".concat(itemClassPrefix, "-active"), index2 === value3)),
40854
- key: option.toString(),
40855
- onClick: function() {
40856
- setValue(index2);
40857
- }
40858
- }, option);
40859
- }
40860
- }
40861
- });
40862
- }, [
40863
- value2
40864
- ]);
40865
- return /* @__PURE__ */ React.createElement("div", {
40866
- className: classNames(classPrefix2),
40867
- style: mergedProps.style
40868
- }, renderItems(options2, value2));
40869
- };
40870
- var defaultProps$d = _object_spread_props(_object_spread({}, ComponentDefaults), {
40883
+ var defaultProps$e = _object_spread_props(_object_spread({}, ComponentDefaults), {
40871
40884
  color: "primary",
40872
40885
  price: 0,
40873
40886
  symbol: "&yen;",
@@ -40878,7 +40891,7 @@ Please add \`${key2}Action\` when creating your handler.`);
40878
40891
  line: false
40879
40892
  });
40880
40893
  var Price = function(props) {
40881
- var _ref = _object_spread({}, defaultProps$d, props), color = _ref.color, price = _ref.price, symbol = _ref.symbol, digits = _ref.digits, thousands = _ref.thousands, position2 = _ref.position, size = _ref.size, line = _ref.line, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
40894
+ var _ref = _object_spread({}, defaultProps$e, props), color = _ref.color, price = _ref.price, symbol = _ref.symbol, digits = _ref.digits, thousands = _ref.thousands, position2 = _ref.position, size = _ref.size, line = _ref.line, className = _ref.className, style = _ref.style, rest = _object_without_properties(_ref, [
40882
40895
  "color",
40883
40896
  "price",
40884
40897
  "symbol",
@@ -40947,6 +40960,62 @@ Please add \`${key2}Action\` when creating your handler.`);
40947
40960
  }, formatDecimal(price))) : null, symbol && position2 === "after" ? renderSymbol() : null);
40948
40961
  };
40949
40962
  Price.displayName = "NutPrice";
40963
+ var defaultProps$d = {
40964
+ options: [],
40965
+ onChange: function(value2) {
40966
+ }
40967
+ };
40968
+ var Segmented = function(props) {
40969
+ var classPrefix2 = "nut-segmented";
40970
+ var itemClassPrefix = "nut-segmented-item";
40971
+ var mergedProps = mergeProps(defaultProps$d, props);
40972
+ var options2 = mergedProps.options;
40973
+ mergedProps.onChange;
40974
+ var _usePropsValue = _sliced_to_array(usePropsValue({
40975
+ value: mergedProps.value,
40976
+ defaultValue: mergedProps.defaultValue,
40977
+ finalValue: 0,
40978
+ onChange: mergedProps.onChange
40979
+ }), 2), value2 = _usePropsValue[0], setValue = _usePropsValue[1];
40980
+ var renderItems = React.useCallback(function(options3, value3) {
40981
+ return options3.map(function(option, index2) {
40982
+ var optionType = typeof option === "undefined" ? "undefined" : _type_of(option);
40983
+ switch (optionType) {
40984
+ case "object":
40985
+ var opt = option;
40986
+ var _obj;
40987
+ return /* @__PURE__ */ React.createElement("div", {
40988
+ className: classNames(itemClassPrefix, (_obj = {}, _define_property(_obj, "".concat(itemClassPrefix, "-active"), opt.value === value3), _define_property(_obj, "".concat(opt.className), !!opt.className), _obj)),
40989
+ key: opt.value,
40990
+ onClick: function() {
40991
+ if (opt.disabled) return;
40992
+ setValue(opt.value);
40993
+ }
40994
+ }, opt.icon ? /* @__PURE__ */ React.createElement("span", {
40995
+ className: "nut-segmented-icon"
40996
+ }, opt.icon) : null, opt.label);
40997
+ default: {
40998
+ if (typeof option !== "string" && typeof option !== "number") {
40999
+ console.warn("Unsupported option type:", optionType);
41000
+ }
41001
+ return /* @__PURE__ */ React.createElement("div", {
41002
+ className: classNames(itemClassPrefix, _define_property({}, "".concat(itemClassPrefix, "-active"), index2 === value3)),
41003
+ key: option.toString(),
41004
+ onClick: function() {
41005
+ setValue(index2);
41006
+ }
41007
+ }, option);
41008
+ }
41009
+ }
41010
+ });
41011
+ }, [
41012
+ value2
41013
+ ]);
41014
+ return /* @__PURE__ */ React.createElement("div", {
41015
+ className: classNames(classPrefix2),
41016
+ style: mergedProps.style
41017
+ }, renderItems(options2, value2));
41018
+ };
40950
41019
  var DataContext = React.createContext({});
40951
41020
  var defaultProps$c = _object_spread_props(_object_spread({}, ComponentDefaults), {
40952
41021
  title: "",
@@ -41278,7 +41347,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41278
41347
  var classPrefix2 = "nut-tag";
41279
41348
  var _obj;
41280
41349
  var classes = classNames((_obj = {}, _define_property(_obj, classPrefix2, true), _define_property(_obj, "".concat(classPrefix2, "-").concat(type2), type2), _define_property(_obj, "".concat(classPrefix2, "-plain"), plain), _define_property(_obj, "".concat(classPrefix2, "-round"), round), _define_property(_obj, "".concat(classPrefix2, "-mark"), mark), _define_property(_obj, "".concat(classPrefix2, "-close"), closeable), _define_property(_obj, "".concat(className), className), _obj));
41281
- var handleClick2 = function(e2) {
41350
+ var handleClick = function(e2) {
41282
41351
  onClick && onClick(e2);
41283
41352
  };
41284
41353
  var getStyle = function() {
@@ -41304,7 +41373,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41304
41373
  className: classes,
41305
41374
  style: _object_spread({}, style, getStyle()),
41306
41375
  onClick: function(e2) {
41307
- return handleClick2(e2);
41376
+ return handleClick(e2);
41308
41377
  }
41309
41378
  }, children && /* @__PURE__ */ React.createElement("span", {
41310
41379
  className: textClasses,
@@ -41326,7 +41395,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41326
41395
  className: classes,
41327
41396
  style: _object_spread({}, style, getStyle()),
41328
41397
  onClick: function(e2) {
41329
- return handleClick2(e2);
41398
+ return handleClick(e2);
41330
41399
  }
41331
41400
  }, children && /* @__PURE__ */ React.createElement("span", {
41332
41401
  className: textClasses,
@@ -41808,6 +41877,446 @@ Please add \`${key2}Action\` when creating your handler.`);
41808
41877
  };
41809
41878
  VirtualList.displayName = "NutVirtualList";
41810
41879
  var defaultProps$6 = _object_spread_props(_object_spread({}, ComponentDefaults), {
41880
+ maxZoom: 3,
41881
+ space: 10,
41882
+ toolbar: [
41883
+ /* @__PURE__ */ React.createElement(Button, {
41884
+ type: "danger",
41885
+ key: "cancel"
41886
+ }, "Cancel"),
41887
+ /* @__PURE__ */ React.createElement(Button, {
41888
+ key: "reset"
41889
+ }, "Reset"),
41890
+ /* @__PURE__ */ React.createElement(Button, {
41891
+ key: "rotate"
41892
+ }, "Rotate"),
41893
+ /* @__PURE__ */ React.createElement(Button, {
41894
+ type: "success",
41895
+ key: "confirm"
41896
+ }, "Confirm")
41897
+ ],
41898
+ toolbarPosition: "bottom",
41899
+ editText: "Edit",
41900
+ shape: "square"
41901
+ });
41902
+ var classPrefix$1 = "nut-avatar-cropper";
41903
+ var AvatarCropper = function(props) {
41904
+ var locale = useConfig().locale;
41905
+ defaultProps$6.toolbar = [
41906
+ /* @__PURE__ */ React.createElement(Button, {
41907
+ type: "danger",
41908
+ key: "cancel"
41909
+ }, locale.cancel),
41910
+ /* @__PURE__ */ React.createElement(Button, {
41911
+ key: "reset"
41912
+ }, locale.reset),
41913
+ /* @__PURE__ */ React.createElement(Button, {
41914
+ key: "rotate"
41915
+ }, locale.avatarCropper.rotate),
41916
+ /* @__PURE__ */ React.createElement(Button, {
41917
+ type: "success",
41918
+ key: "confirm"
41919
+ }, locale.confirm)
41920
+ ];
41921
+ var _ref = _object_spread({}, defaultProps$6, props), children = _ref.children, maxZoom = _ref.maxZoom, space = _ref.space, toolbar = _ref.toolbar, toolbarPosition = _ref.toolbarPosition, editText = _ref.editText, shape = _ref.shape, className = _ref.className, style = _ref.style, onConfirm = _ref.onConfirm, onCancel = _ref.onCancel, rest = _object_without_properties(_ref, [
41922
+ "children",
41923
+ "maxZoom",
41924
+ "space",
41925
+ "toolbar",
41926
+ "toolbarPosition",
41927
+ "editText",
41928
+ "shape",
41929
+ "className",
41930
+ "style",
41931
+ "onConfirm",
41932
+ "onCancel"
41933
+ ]);
41934
+ var cls = classNames(classPrefix$1, className, shape === "round" && "round");
41935
+ var toolbarPositionCls = classNames("".concat(classPrefix$1, "-popup-toolbar"), toolbarPosition);
41936
+ var inputImageRef = React.useRef(null);
41937
+ var cropperPopupRef = React.useRef(null);
41938
+ var canvasRef = React.useRef(null);
41939
+ var _useState = _sliced_to_array(React.useState(false), 2), visible = _useState[0], setVisible = _useState[1];
41940
+ var _useState1 = _sliced_to_array(React.useState(false), 2), moving = _useState1[0], setMoving = _useState1[1];
41941
+ var _useState2 = _sliced_to_array(React.useState(false), 2), zooming = _useState2[0], setZooming = _useState2[1];
41942
+ var _useState3 = _sliced_to_array(React.useState({
41943
+ defScale: 1,
41944
+ scale: 1,
41945
+ angle: 0,
41946
+ moveX: 0,
41947
+ moveY: 0,
41948
+ displayWidth: 0,
41949
+ displayHeight: 0
41950
+ }), 2), state = _useState3[0], setState = _useState3[1];
41951
+ var defDrawImage = {
41952
+ img: new Image(),
41953
+ sx: 0,
41954
+ sy: 0,
41955
+ swidth: 0,
41956
+ sheight: 0,
41957
+ x: 0,
41958
+ y: 0,
41959
+ width: 0,
41960
+ height: 0
41961
+ };
41962
+ var _useState4 = _sliced_to_array(React.useState(_object_spread({}, defDrawImage)), 2), drawImage = _useState4[0], setDrawImg = _useState4[1];
41963
+ var devicePixelRatio = window.devicePixelRatio || 1;
41964
+ var touch = useTouch();
41965
+ var highlightStyle = React.useMemo(function() {
41966
+ var width2 = "".concat(drawImage.swidth / devicePixelRatio, "px");
41967
+ var height2 = width2;
41968
+ return {
41969
+ width: width2,
41970
+ height: height2,
41971
+ borderRadius: shape === "round" ? "50%" : ""
41972
+ };
41973
+ }, [
41974
+ devicePixelRatio,
41975
+ drawImage.swidth
41976
+ ]);
41977
+ var isAngle = React.useMemo(function() {
41978
+ return state.angle === 90 || state.angle === 270;
41979
+ }, [
41980
+ state.angle
41981
+ ]);
41982
+ var maxMoveX = React.useMemo(function() {
41983
+ var swidth = drawImage.swidth, height2 = drawImage.height;
41984
+ if (isAngle) {
41985
+ return Math.max(0, (height2 * state.scale - swidth) / 2);
41986
+ }
41987
+ return Math.max(0, (state.displayWidth * state.scale - swidth) / 2);
41988
+ }, [
41989
+ state.scale,
41990
+ state.displayWidth,
41991
+ drawImage,
41992
+ isAngle
41993
+ ]);
41994
+ var maxMoveY = React.useMemo(function() {
41995
+ var swidth = drawImage.swidth, height2 = drawImage.height;
41996
+ if (isAngle) {
41997
+ return Math.max(0, (state.displayWidth * state.scale - swidth) / 2);
41998
+ }
41999
+ return Math.max(0, (height2 * state.scale - swidth) / 2);
42000
+ }, [
42001
+ state.scale,
42002
+ state.displayWidth,
42003
+ drawImage,
42004
+ isAngle
42005
+ ]);
42006
+ var fileToDataURL = function(file) {
42007
+ return new Promise(function(resolve) {
42008
+ var reader = new FileReader();
42009
+ reader.onloadend = function(e2) {
42010
+ return resolve(e2.target.result);
42011
+ };
42012
+ reader.readAsDataURL(file);
42013
+ });
42014
+ };
42015
+ var dataURLToImage = function(dataURL) {
42016
+ return new Promise(function(resolve) {
42017
+ var img = new Image();
42018
+ img.onload = function() {
42019
+ return resolve(img);
42020
+ };
42021
+ img.src = dataURL;
42022
+ });
42023
+ };
42024
+ var draw = React.useCallback(function() {
42025
+ var img = drawImage.img, width2 = drawImage.width, height2 = drawImage.height, x = drawImage.x, y = drawImage.y, swidth = drawImage.swidth;
42026
+ var moveX = state.moveX, moveY = state.moveY, scale2 = state.scale, angle = state.angle, displayWidth = state.displayWidth, displayHeight = state.displayHeight;
42027
+ var canvas = canvasRef.current;
42028
+ if (!canvas) return;
42029
+ var ctx2 = canvas.getContext("2d");
42030
+ canvas.width = displayWidth;
42031
+ canvas.height = displayHeight;
42032
+ ctx2.clearRect(0, 0, canvas.width, canvas.height);
42033
+ ctx2.fillStyle = "#666";
42034
+ ctx2.fillRect(0, 0, canvas.width, canvas.height);
42035
+ ctx2.fillStyle = "#000";
42036
+ ctx2.fillRect(space * devicePixelRatio, (canvas.height - swidth) / 2, swidth, swidth);
42037
+ ctx2.translate(canvas.width / 2 + moveX, canvas.height / 2 + moveY);
42038
+ ctx2.rotate(Math.PI / 180 * angle);
42039
+ ctx2.scale(scale2, scale2);
42040
+ ctx2.drawImage(img, x, y, width2, height2);
42041
+ }, [
42042
+ drawImage,
42043
+ state,
42044
+ devicePixelRatio,
42045
+ space
42046
+ ]);
42047
+ React.useEffect(function() {
42048
+ if (Math.abs(state.moveX) > maxMoveX) {
42049
+ setState(_object_spread_props(_object_spread({}, state), {
42050
+ moveX: maxMoveX
42051
+ }));
42052
+ }
42053
+ if (Math.abs(state.moveY) > maxMoveY) {
42054
+ setState(_object_spread_props(_object_spread({}, state), {
42055
+ moveY: maxMoveY
42056
+ }));
42057
+ }
42058
+ draw();
42059
+ }, [
42060
+ state,
42061
+ maxMoveX,
42062
+ maxMoveY,
42063
+ draw
42064
+ ]);
42065
+ var setDrawImgs = function(image) {
42066
+ var rect = getRect(cropperPopupRef.current);
42067
+ if (!rect) return;
42068
+ var clientWidth = rect.width, clientHeight = rect.height;
42069
+ var canvasWidth = state.displayWidth = clientWidth * devicePixelRatio;
42070
+ var canvasHeight = state.displayHeight = clientHeight * devicePixelRatio;
42071
+ var copyDrawImg = _object_spread({}, defDrawImage);
42072
+ var imgWidth = image.width, imgHeight = image.height;
42073
+ copyDrawImg.img = image;
42074
+ var isPortrait = imgHeight > imgWidth;
42075
+ var rate = isPortrait ? imgWidth / imgHeight : imgHeight / imgWidth;
42076
+ copyDrawImg.width = canvasWidth;
42077
+ copyDrawImg.height = isPortrait ? canvasWidth / rate : canvasWidth * rate;
42078
+ copyDrawImg.x = -copyDrawImg.width / 2;
42079
+ copyDrawImg.y = -copyDrawImg.height / 2;
42080
+ copyDrawImg.swidth = canvasWidth - space * 2 * devicePixelRatio;
42081
+ copyDrawImg.sheight = isPortrait ? copyDrawImg.swidth / rate : copyDrawImg.swidth * rate;
42082
+ copyDrawImg.sx = space * devicePixelRatio;
42083
+ copyDrawImg.sy = (canvasHeight - copyDrawImg.swidth) / 2;
42084
+ setDrawImg(copyDrawImg);
42085
+ var scale2 = copyDrawImg.swidth / (isPortrait ? copyDrawImg.width : copyDrawImg.height);
42086
+ setState(_object_spread_props(_object_spread({}, state), {
42087
+ defScale: scale2
42088
+ }));
42089
+ resetScale(scale2);
42090
+ };
42091
+ var inputImageChange = /* @__PURE__ */ function() {
42092
+ var _ref2 = _async_to_generator(function(event) {
42093
+ var $el, files, base64, image;
42094
+ return __generator(this, function(_state) {
42095
+ switch (_state.label) {
42096
+ case 0:
42097
+ setVisible(true);
42098
+ $el = event.target;
42099
+ files = $el.files;
42100
+ if (!(files === null || files === void 0 ? void 0 : files.length)) return [
42101
+ 2
42102
+ ];
42103
+ return [
42104
+ 4,
42105
+ fileToDataURL(files[0])
42106
+ ];
42107
+ case 1:
42108
+ base64 = _state.sent();
42109
+ return [
42110
+ 4,
42111
+ dataURLToImage(base64)
42112
+ ];
42113
+ case 2:
42114
+ image = _state.sent();
42115
+ setDrawImgs(image);
42116
+ return [
42117
+ 2
42118
+ ];
42119
+ }
42120
+ });
42121
+ });
42122
+ return function inputImageChange2(event) {
42123
+ return _ref2.apply(this, arguments);
42124
+ };
42125
+ }();
42126
+ var resetScale = function(scale2) {
42127
+ setState(_object_spread_props(_object_spread({}, state), {
42128
+ moveX: 0,
42129
+ moveY: 0,
42130
+ angle: 0,
42131
+ scale: scale2 || state.defScale,
42132
+ defScale: scale2 || state.defScale
42133
+ }));
42134
+ };
42135
+ var setScale = function(scale2) {
42136
+ scale2 = clamp(scale2, 0.3, +maxZoom + 1);
42137
+ if (scale2 !== state.scale) {
42138
+ setState(_object_spread_props(_object_spread({}, state), {
42139
+ scale: scale2
42140
+ }));
42141
+ }
42142
+ };
42143
+ var getDistance = function(touches) {
42144
+ return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
42145
+ };
42146
+ var _useState5 = _sliced_to_array(React.useState({
42147
+ startMoveX: 0,
42148
+ startMoveY: 0,
42149
+ startScale: 0,
42150
+ startDistance: 0
42151
+ }), 2), startMove = _useState5[0], setStartMove = _useState5[1];
42152
+ var startMoveX = startMove.startMoveX, startMoveY = startMove.startMoveY, startScale = startMove.startScale, startDistance = startMove.startDistance;
42153
+ var onTouchStart = function(event) {
42154
+ var touches = event.touches;
42155
+ var offsetX = touch.offsetX;
42156
+ touch.start(event);
42157
+ var fingerNum = touches === null || touches === void 0 ? void 0 : touches.length;
42158
+ setStartMove(_object_spread_props(_object_spread({}, startMove), {
42159
+ startMoveX: state.moveX,
42160
+ startMoveY: state.moveY
42161
+ }));
42162
+ setMoving(fingerNum === 1);
42163
+ setZooming(fingerNum === 2 && !offsetX.current);
42164
+ if (fingerNum === 2 && !offsetX.current) {
42165
+ setStartMove(_object_spread_props(_object_spread({}, startMove), {
42166
+ startScale: state.scale,
42167
+ startDistance: getDistance(event.touches)
42168
+ }));
42169
+ }
42170
+ };
42171
+ var onTouchMove = function(event) {
42172
+ var touches = event.touches;
42173
+ touch.move(event);
42174
+ if (moving || zooming) {
42175
+ preventDefault$1(event, true);
42176
+ }
42177
+ if (moving) {
42178
+ var deltaX = touch.deltaX, deltaY = touch.deltaY;
42179
+ var moveX = deltaX.current * state.scale + startMoveX;
42180
+ var moveY = deltaY.current * state.scale + startMoveY;
42181
+ setState(_object_spread_props(_object_spread({}, state), {
42182
+ moveX: clamp(moveX, -maxMoveX, maxMoveX),
42183
+ moveY: clamp(moveY, -maxMoveY, maxMoveY)
42184
+ }));
42185
+ }
42186
+ if (zooming && touches.length === 2) {
42187
+ var distance = getDistance(touches);
42188
+ var scale2 = startScale * distance / startDistance;
42189
+ setScale(scale2);
42190
+ }
42191
+ };
42192
+ var onTouchEnd = function(event) {
42193
+ var stopPropagation = false;
42194
+ if (moving || zooming) {
42195
+ stopPropagation = !(moving && startMoveX === state.moveX && startMoveY === state.moveY);
42196
+ if (!event.touches.length) {
42197
+ if (zooming) {
42198
+ setState(_object_spread_props(_object_spread({}, state), {
42199
+ moveX: clamp(state.moveX, -maxMoveX, maxMoveX),
42200
+ moveY: clamp(state.moveY, -maxMoveY, maxMoveY)
42201
+ }));
42202
+ setZooming(false);
42203
+ }
42204
+ setMoving(false);
42205
+ setStartMove(_object_spread_props(_object_spread({}, startMove), {
42206
+ startMoveX: 0,
42207
+ startMoveY: 0,
42208
+ startScale: state.defScale
42209
+ }));
42210
+ if (state.scale < state.defScale) {
42211
+ resetScale();
42212
+ }
42213
+ if (state.scale > maxZoom) {
42214
+ setState(_object_spread_props(_object_spread({}, state), {
42215
+ scale: +maxZoom
42216
+ }));
42217
+ }
42218
+ }
42219
+ }
42220
+ preventDefault$1(event, stopPropagation);
42221
+ touch.reset();
42222
+ };
42223
+ var reset = function() {
42224
+ setState(_object_spread_props(_object_spread({}, state), {
42225
+ angle: 0
42226
+ }));
42227
+ };
42228
+ var rotate = function() {
42229
+ if (state.angle === 270) {
42230
+ setState(_object_spread_props(_object_spread({}, state), {
42231
+ angle: 0
42232
+ }));
42233
+ return;
42234
+ }
42235
+ setState(_object_spread_props(_object_spread({}, state), {
42236
+ angle: state.angle + 90
42237
+ }));
42238
+ };
42239
+ var cancel = function() {
42240
+ var isEmit = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
42241
+ setVisible(false);
42242
+ resetScale();
42243
+ inputImageRef.current && (inputImageRef.current.value = "");
42244
+ isEmit && onCancel && onCancel();
42245
+ };
42246
+ var confirm2 = function() {
42247
+ var canvas = canvasRef.current;
42248
+ var sx = drawImage.sx, sy = drawImage.sy, swidth = drawImage.swidth;
42249
+ var width2 = swidth;
42250
+ var height2 = swidth;
42251
+ var croppedCanvas = document.createElement("canvas");
42252
+ var croppedCtx = croppedCanvas.getContext("2d");
42253
+ croppedCanvas.width = width2;
42254
+ croppedCanvas.height = height2;
42255
+ canvas && croppedCtx.drawImage(canvas, sx, sy, width2, height2, 0, 0, width2, height2);
42256
+ var imageDataURL = croppedCanvas.toDataURL("image/png");
42257
+ onConfirm && onConfirm(imageDataURL);
42258
+ cancel(false);
42259
+ };
42260
+ var ToolBar = function() {
42261
+ var actions = [
42262
+ cancel,
42263
+ reset,
42264
+ rotate,
42265
+ confirm2
42266
+ ];
42267
+ return /* @__PURE__ */ React.createElement("div", {
42268
+ className: "".concat(classPrefix$1, "-popup-toolbar-flex")
42269
+ }, actions.map(function(action, index2) {
42270
+ return /* @__PURE__ */ React.createElement("div", {
42271
+ key: index2,
42272
+ className: "".concat(classPrefix$1, "-popup-toolbar-item"),
42273
+ onClick: function(_e) {
42274
+ return action();
42275
+ }
42276
+ }, toolbar[index2]);
42277
+ }));
42278
+ };
42279
+ var CropperPopup = function() {
42280
+ return /* @__PURE__ */ React.createElement("div", {
42281
+ ref: cropperPopupRef,
42282
+ className: "".concat(classPrefix$1, "-popup"),
42283
+ style: {
42284
+ display: visible ? "block" : "none"
42285
+ }
42286
+ }, /* @__PURE__ */ React.createElement("canvas", {
42287
+ ref: canvasRef,
42288
+ className: "".concat(classPrefix$1, "-popup-canvas")
42289
+ }), /* @__PURE__ */ React.createElement("div", {
42290
+ className: "".concat(classPrefix$1, "-popup-highlight"),
42291
+ onTouchStart,
42292
+ onTouchMove,
42293
+ onTouchEnd
42294
+ }, /* @__PURE__ */ React.createElement("div", {
42295
+ className: "highlight",
42296
+ style: highlightStyle
42297
+ })), /* @__PURE__ */ React.createElement("div", {
42298
+ className: toolbarPositionCls
42299
+ }, /* @__PURE__ */ React.createElement(ToolBar, null)));
42300
+ };
42301
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", _object_spread_props(_object_spread({
42302
+ className: cls
42303
+ }, rest), {
42304
+ style
42305
+ }), children, /* @__PURE__ */ React.createElement("input", {
42306
+ ref: inputImageRef,
42307
+ type: "file",
42308
+ accept: "image/*",
42309
+ className: "".concat(classPrefix$1, "-input"),
42310
+ onChange: function(e2) {
42311
+ return inputImageChange(e2);
42312
+ },
42313
+ "aria-label": locale.avatarCropper.selectImage
42314
+ }), /* @__PURE__ */ React.createElement("div", {
42315
+ className: "nut-avatar-cropper-edit-text"
42316
+ }, editText)), CropperPopup());
42317
+ };
42318
+ AvatarCropper.displayName = "NutAvatarCropper";
42319
+ var defaultProps$5 = _object_spread_props(_object_spread({}, ComponentDefaults), {
41811
42320
  list: [],
41812
42321
  interval: 500,
41813
42322
  loop: true,
@@ -41815,9 +42324,9 @@ Please add \`${key2}Action\` when creating your handler.`);
41815
42324
  rows: 3,
41816
42325
  gapY: 10
41817
42326
  });
41818
- var classPrefix$1 = "nut-barrage";
42327
+ var classPrefix = "nut-barrage";
41819
42328
  var InternalBarrage = function(props, ref) {
41820
- var _ref = _object_spread({}, defaultProps$6, props), className = _ref.className, interval = _ref.interval, loop2 = _ref.loop, list = _ref.list, duration = _ref.duration, rows = _ref.rows, gapY = _ref.gapY, restProps = _object_without_properties(_ref, [
42329
+ var _ref = _object_spread({}, defaultProps$5, props), className = _ref.className, interval = _ref.interval, loop2 = _ref.loop, list = _ref.list, duration = _ref.duration, rows = _ref.rows, gapY = _ref.gapY, restProps = _object_without_properties(_ref, [
41821
42330
  "className",
41822
42331
  "interval",
41823
42332
  "loop",
@@ -41833,7 +42342,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41833
42342
  var index2 = React.useRef(0);
41834
42343
  var times = React.useRef([]);
41835
42344
  var historyIndex = React.useRef(-1);
41836
- var classes = classNames(classPrefix$1, className);
42345
+ var classes = classNames(classPrefix, className);
41837
42346
  React.useImperativeHandle(ref, function() {
41838
42347
  return {
41839
42348
  add: function(word) {
@@ -41912,7 +42421,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41912
42421
  };
41913
42422
  var Barrage = /* @__PURE__ */ React.forwardRef(InternalBarrage);
41914
42423
  Barrage.displayName = "NutBarrage";
41915
- var defaultProps$5 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42424
+ var defaultProps$4 = _object_spread_props(_object_spread({}, ComponentDefaults), {
41916
42425
  src: "",
41917
42426
  title: "",
41918
42427
  price: "",
@@ -41926,7 +42435,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41926
42435
  extra: ""
41927
42436
  });
41928
42437
  var Card = function(props) {
41929
- var _ref = _object_spread({}, defaultProps$5, props), className = _ref.className, style = _ref.style, src = _ref.src, title = _ref.title, price = _ref.price, vipPrice = _ref.vipPrice, shopDescription = _ref.shopDescription, delivery = _ref.delivery, shopName = _ref.shopName, tag = _ref.tag, priceTag = _ref.priceTag, description = _ref.description, extra = _ref.extra, rest = _object_without_properties(_ref, [
42438
+ var _ref = _object_spread({}, defaultProps$4, props), className = _ref.className, style = _ref.style, src = _ref.src, title = _ref.title, price = _ref.price, vipPrice = _ref.vipPrice, shopDescription = _ref.shopDescription, delivery = _ref.delivery, shopName = _ref.shopName, tag = _ref.tag, priceTag = _ref.priceTag, description = _ref.description, extra = _ref.extra, rest = _object_without_properties(_ref, [
41930
42439
  "className",
41931
42440
  "style",
41932
42441
  "src",
@@ -41976,7 +42485,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41976
42485
  }, shopName), extra)));
41977
42486
  };
41978
42487
  Card.displayName = "NutCard";
41979
- var defaultProps$4 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42488
+ var defaultProps$3 = _object_spread_props(_object_spread({}, ComponentDefaults), {
41980
42489
  activeDate: "",
41981
42490
  activeTime: [],
41982
42491
  options: [],
@@ -41989,7 +42498,7 @@ Please add \`${key2}Action\` when creating your handler.`);
41989
42498
  }
41990
42499
  });
41991
42500
  var TimeDetail = function(props) {
41992
- var _$_object_spread = _object_spread({}, defaultProps$4, props), options2 = _$_object_spread.options, optionKey = _$_object_spread.optionKey, className = _$_object_spread.className, activeDate = _$_object_spread.activeDate, activeTime = _$_object_spread.activeTime, onSelect = _$_object_spread.onSelect;
42501
+ var _$_object_spread = _object_spread({}, defaultProps$3, props), options2 = _$_object_spread.options, optionKey = _$_object_spread.optionKey, className = _$_object_spread.className, activeDate = _$_object_spread.activeDate, activeTime = _$_object_spread.activeTime, onSelect = _$_object_spread.onSelect;
41993
42502
  var classPrefix2 = "nut-timedetail";
41994
42503
  var timeList = React.useMemo(function() {
41995
42504
  return (options2 === null || options2 === void 0 ? void 0 : options2.find(function(item) {
@@ -42031,7 +42540,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42031
42540
  }));
42032
42541
  };
42033
42542
  TimeDetail.displayName = "NutTimeDetail";
42034
- var defaultProps$3 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42543
+ var defaultProps$2 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42035
42544
  visible: false,
42036
42545
  multiple: false,
42037
42546
  defaultValue: [],
@@ -42044,7 +42553,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42044
42553
  });
42045
42554
  var TimeSelect = function(props) {
42046
42555
  var locale = useConfig().locale;
42047
- var _ref = _object_spread({}, defaultProps$3, props), visible = _ref.visible, className = _ref.className, style = _ref.style, title = _ref.title, defaultValue = _ref.defaultValue, options2 = _ref.options, optionKey = _ref.optionKey, multiple = _ref.multiple, onSelect = _ref.onSelect, onDateChange = _ref.onDateChange, onTimeChange = _ref.onTimeChange, rest = _object_without_properties(_ref, [
42556
+ var _ref = _object_spread({}, defaultProps$2, props), visible = _ref.visible, className = _ref.className, style = _ref.style, title = _ref.title, defaultValue = _ref.defaultValue, options2 = _ref.options, optionKey = _ref.optionKey, multiple = _ref.multiple, onSelect = _ref.onSelect, onDateChange = _ref.onDateChange, onTimeChange = _ref.onTimeChange, rest = _object_without_properties(_ref, [
42048
42557
  "visible",
42049
42558
  "className",
42050
42559
  "style",
@@ -42155,7 +42664,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42155
42664
  }))));
42156
42665
  };
42157
42666
  TimeSelect.displayName = "NutTimeSelect";
42158
- var defaultProps$2 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42667
+ var defaultProps$1 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42159
42668
  value: 0,
42160
42669
  digits: 2,
42161
42670
  symbol: false,
@@ -42169,7 +42678,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42169
42678
  dropIcon: null
42170
42679
  });
42171
42680
  var TrendArrow = function(props) {
42172
- var _ref = _object_spread({}, defaultProps$2, props), value2 = _ref.value, digits = _ref.digits, symbol = _ref.symbol, zero = _ref.zero, left = _ref.left, sync2 = _ref.sync, color = _ref.color, riseColor = _ref.riseColor, dropColor = _ref.dropColor, riseIcon = _ref.riseIcon, dropIcon = _ref.dropIcon, className = _ref.className, style = _ref.style;
42681
+ var _ref = _object_spread({}, defaultProps$1, props), value2 = _ref.value, digits = _ref.digits, symbol = _ref.symbol, zero = _ref.zero, left = _ref.left, sync2 = _ref.sync, color = _ref.color, riseColor = _ref.riseColor, dropColor = _ref.dropColor, riseIcon = _ref.riseIcon, dropIcon = _ref.dropIcon, className = _ref.className, style = _ref.style;
42173
42682
  _ref.children;
42174
42683
  var rest = _object_without_properties(_ref, [
42175
42684
  "value",
@@ -42241,7 +42750,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42241
42750
  }))), left && renderContent(!left));
42242
42751
  };
42243
42752
  TrendArrow.displayName = "NutTrendArrow";
42244
- var defaultProps$1 = _object_spread_props(_object_spread({}, ComponentDefaults), {
42753
+ var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
42245
42754
  content: "",
42246
42755
  fullPage: true,
42247
42756
  zIndex: 2e3,
@@ -42262,7 +42771,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42262
42771
  });
42263
42772
  var WaterMark = function(props) {
42264
42773
  var locale = useConfig().locale;
42265
- var _$_object_spread = _object_spread({}, defaultProps$1, props), content2 = _$_object_spread.content, fullPage = _$_object_spread.fullPage, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, gapX = _$_object_spread.gapX, gapY = _$_object_spread.gapY, startX = _$_object_spread.startX, startY = _$_object_spread.startY, width2 = _$_object_spread.width, height2 = _$_object_spread.height, image = _$_object_spread.image, imageWidth = _$_object_spread.imageWidth, imageHeight = _$_object_spread.imageHeight, rotate = _$_object_spread.rotate, color = _$_object_spread.color, fontStyle = _$_object_spread.fontStyle, fontFamily = _$_object_spread.fontFamily, fontWeight = _$_object_spread.fontWeight, fontSize = _$_object_spread.fontSize, style = _$_object_spread.style;
42774
+ var _$_object_spread = _object_spread({}, defaultProps, props), content2 = _$_object_spread.content, fullPage = _$_object_spread.fullPage, zIndex = _$_object_spread.zIndex, className = _$_object_spread.className, gapX = _$_object_spread.gapX, gapY = _$_object_spread.gapY, startX = _$_object_spread.startX, startY = _$_object_spread.startY, width2 = _$_object_spread.width, height2 = _$_object_spread.height, image = _$_object_spread.image, imageWidth = _$_object_spread.imageWidth, imageHeight = _$_object_spread.imageHeight, rotate = _$_object_spread.rotate, color = _$_object_spread.color, fontStyle = _$_object_spread.fontStyle, fontFamily = _$_object_spread.fontFamily, fontWeight = _$_object_spread.fontWeight, fontSize = _$_object_spread.fontSize, style = _$_object_spread.style;
42266
42775
  var _useState = _sliced_to_array(React.useState(""), 2), base64Url = _useState[0], setBase64Url = _useState[1];
42267
42776
  var classPrefix2 = "nut-watermark";
42268
42777
  var classes = classNames(classPrefix2, _define_property({}, "".concat(classPrefix2, "-full-page"), fullPage));
@@ -42319,446 +42828,6 @@ Please add \`${key2}Action\` when creating your handler.`);
42319
42828
  });
42320
42829
  };
42321
42830
  WaterMark.displayName = "NutWaterMark";
42322
- var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
42323
- maxZoom: 3,
42324
- space: 10,
42325
- toolbar: [
42326
- /* @__PURE__ */ React.createElement(Button, {
42327
- type: "danger",
42328
- key: "cancel"
42329
- }, "Cancel"),
42330
- /* @__PURE__ */ React.createElement(Button, {
42331
- key: "reset"
42332
- }, "Reset"),
42333
- /* @__PURE__ */ React.createElement(Button, {
42334
- key: "rotate"
42335
- }, "Rotate"),
42336
- /* @__PURE__ */ React.createElement(Button, {
42337
- type: "success",
42338
- key: "confirm"
42339
- }, "Confirm")
42340
- ],
42341
- toolbarPosition: "bottom",
42342
- editText: "Edit",
42343
- shape: "square"
42344
- });
42345
- var classPrefix = "nut-avatar-cropper";
42346
- var AvatarCropper = function(props) {
42347
- var locale = useConfig().locale;
42348
- defaultProps.toolbar = [
42349
- /* @__PURE__ */ React.createElement(Button, {
42350
- type: "danger",
42351
- key: "cancel"
42352
- }, locale.cancel),
42353
- /* @__PURE__ */ React.createElement(Button, {
42354
- key: "reset"
42355
- }, locale.reset),
42356
- /* @__PURE__ */ React.createElement(Button, {
42357
- key: "rotate"
42358
- }, locale.avatarCropper.rotate),
42359
- /* @__PURE__ */ React.createElement(Button, {
42360
- type: "success",
42361
- key: "confirm"
42362
- }, locale.confirm)
42363
- ];
42364
- var _ref = _object_spread({}, defaultProps, props), children = _ref.children, maxZoom = _ref.maxZoom, space = _ref.space, toolbar = _ref.toolbar, toolbarPosition = _ref.toolbarPosition, editText = _ref.editText, shape = _ref.shape, className = _ref.className, style = _ref.style, onConfirm = _ref.onConfirm, onCancel = _ref.onCancel, rest = _object_without_properties(_ref, [
42365
- "children",
42366
- "maxZoom",
42367
- "space",
42368
- "toolbar",
42369
- "toolbarPosition",
42370
- "editText",
42371
- "shape",
42372
- "className",
42373
- "style",
42374
- "onConfirm",
42375
- "onCancel"
42376
- ]);
42377
- var cls = classNames(classPrefix, className, shape === "round" && "round");
42378
- var toolbarPositionCls = classNames("".concat(classPrefix, "-popup-toolbar"), toolbarPosition);
42379
- var inputImageRef = React.useRef(null);
42380
- var cropperPopupRef = React.useRef(null);
42381
- var canvasRef = React.useRef(null);
42382
- var _useState = _sliced_to_array(React.useState(false), 2), visible = _useState[0], setVisible = _useState[1];
42383
- var _useState1 = _sliced_to_array(React.useState(false), 2), moving = _useState1[0], setMoving = _useState1[1];
42384
- var _useState2 = _sliced_to_array(React.useState(false), 2), zooming = _useState2[0], setZooming = _useState2[1];
42385
- var _useState3 = _sliced_to_array(React.useState({
42386
- defScale: 1,
42387
- scale: 1,
42388
- angle: 0,
42389
- moveX: 0,
42390
- moveY: 0,
42391
- displayWidth: 0,
42392
- displayHeight: 0
42393
- }), 2), state = _useState3[0], setState = _useState3[1];
42394
- var defDrawImage = {
42395
- img: new Image(),
42396
- sx: 0,
42397
- sy: 0,
42398
- swidth: 0,
42399
- sheight: 0,
42400
- x: 0,
42401
- y: 0,
42402
- width: 0,
42403
- height: 0
42404
- };
42405
- var _useState4 = _sliced_to_array(React.useState(_object_spread({}, defDrawImage)), 2), drawImage = _useState4[0], setDrawImg = _useState4[1];
42406
- var devicePixelRatio = window.devicePixelRatio || 1;
42407
- var touch = useTouch();
42408
- var highlightStyle = React.useMemo(function() {
42409
- var width2 = "".concat(drawImage.swidth / devicePixelRatio, "px");
42410
- var height2 = width2;
42411
- return {
42412
- width: width2,
42413
- height: height2,
42414
- borderRadius: shape === "round" ? "50%" : ""
42415
- };
42416
- }, [
42417
- devicePixelRatio,
42418
- drawImage.swidth
42419
- ]);
42420
- var isAngle = React.useMemo(function() {
42421
- return state.angle === 90 || state.angle === 270;
42422
- }, [
42423
- state.angle
42424
- ]);
42425
- var maxMoveX = React.useMemo(function() {
42426
- var swidth = drawImage.swidth, height2 = drawImage.height;
42427
- if (isAngle) {
42428
- return Math.max(0, (height2 * state.scale - swidth) / 2);
42429
- }
42430
- return Math.max(0, (state.displayWidth * state.scale - swidth) / 2);
42431
- }, [
42432
- state.scale,
42433
- state.displayWidth,
42434
- drawImage,
42435
- isAngle
42436
- ]);
42437
- var maxMoveY = React.useMemo(function() {
42438
- var swidth = drawImage.swidth, height2 = drawImage.height;
42439
- if (isAngle) {
42440
- return Math.max(0, (state.displayWidth * state.scale - swidth) / 2);
42441
- }
42442
- return Math.max(0, (height2 * state.scale - swidth) / 2);
42443
- }, [
42444
- state.scale,
42445
- state.displayWidth,
42446
- drawImage,
42447
- isAngle
42448
- ]);
42449
- var fileToDataURL = function(file) {
42450
- return new Promise(function(resolve) {
42451
- var reader = new FileReader();
42452
- reader.onloadend = function(e2) {
42453
- return resolve(e2.target.result);
42454
- };
42455
- reader.readAsDataURL(file);
42456
- });
42457
- };
42458
- var dataURLToImage = function(dataURL) {
42459
- return new Promise(function(resolve) {
42460
- var img = new Image();
42461
- img.onload = function() {
42462
- return resolve(img);
42463
- };
42464
- img.src = dataURL;
42465
- });
42466
- };
42467
- var draw = React.useCallback(function() {
42468
- var img = drawImage.img, width2 = drawImage.width, height2 = drawImage.height, x = drawImage.x, y = drawImage.y, swidth = drawImage.swidth;
42469
- var moveX = state.moveX, moveY = state.moveY, scale2 = state.scale, angle = state.angle, displayWidth = state.displayWidth, displayHeight = state.displayHeight;
42470
- var canvas = canvasRef.current;
42471
- if (!canvas) return;
42472
- var ctx2 = canvas.getContext("2d");
42473
- canvas.width = displayWidth;
42474
- canvas.height = displayHeight;
42475
- ctx2.clearRect(0, 0, canvas.width, canvas.height);
42476
- ctx2.fillStyle = "#666";
42477
- ctx2.fillRect(0, 0, canvas.width, canvas.height);
42478
- ctx2.fillStyle = "#000";
42479
- ctx2.fillRect(space * devicePixelRatio, (canvas.height - swidth) / 2, swidth, swidth);
42480
- ctx2.translate(canvas.width / 2 + moveX, canvas.height / 2 + moveY);
42481
- ctx2.rotate(Math.PI / 180 * angle);
42482
- ctx2.scale(scale2, scale2);
42483
- ctx2.drawImage(img, x, y, width2, height2);
42484
- }, [
42485
- drawImage,
42486
- state,
42487
- devicePixelRatio,
42488
- space
42489
- ]);
42490
- React.useEffect(function() {
42491
- if (Math.abs(state.moveX) > maxMoveX) {
42492
- setState(_object_spread_props(_object_spread({}, state), {
42493
- moveX: maxMoveX
42494
- }));
42495
- }
42496
- if (Math.abs(state.moveY) > maxMoveY) {
42497
- setState(_object_spread_props(_object_spread({}, state), {
42498
- moveY: maxMoveY
42499
- }));
42500
- }
42501
- draw();
42502
- }, [
42503
- state,
42504
- maxMoveX,
42505
- maxMoveY,
42506
- draw
42507
- ]);
42508
- var setDrawImgs = function(image) {
42509
- var rect = getRect(cropperPopupRef.current);
42510
- if (!rect) return;
42511
- var clientWidth = rect.width, clientHeight = rect.height;
42512
- var canvasWidth = state.displayWidth = clientWidth * devicePixelRatio;
42513
- var canvasHeight = state.displayHeight = clientHeight * devicePixelRatio;
42514
- var copyDrawImg = _object_spread({}, defDrawImage);
42515
- var imgWidth = image.width, imgHeight = image.height;
42516
- copyDrawImg.img = image;
42517
- var isPortrait = imgHeight > imgWidth;
42518
- var rate = isPortrait ? imgWidth / imgHeight : imgHeight / imgWidth;
42519
- copyDrawImg.width = canvasWidth;
42520
- copyDrawImg.height = isPortrait ? canvasWidth / rate : canvasWidth * rate;
42521
- copyDrawImg.x = -copyDrawImg.width / 2;
42522
- copyDrawImg.y = -copyDrawImg.height / 2;
42523
- copyDrawImg.swidth = canvasWidth - space * 2 * devicePixelRatio;
42524
- copyDrawImg.sheight = isPortrait ? copyDrawImg.swidth / rate : copyDrawImg.swidth * rate;
42525
- copyDrawImg.sx = space * devicePixelRatio;
42526
- copyDrawImg.sy = (canvasHeight - copyDrawImg.swidth) / 2;
42527
- setDrawImg(copyDrawImg);
42528
- var scale2 = copyDrawImg.swidth / (isPortrait ? copyDrawImg.width : copyDrawImg.height);
42529
- setState(_object_spread_props(_object_spread({}, state), {
42530
- defScale: scale2
42531
- }));
42532
- resetScale(scale2);
42533
- };
42534
- var inputImageChange = /* @__PURE__ */ function() {
42535
- var _ref2 = _async_to_generator(function(event) {
42536
- var $el, files, base64, image;
42537
- return __generator(this, function(_state) {
42538
- switch (_state.label) {
42539
- case 0:
42540
- setVisible(true);
42541
- $el = event.target;
42542
- files = $el.files;
42543
- if (!(files === null || files === void 0 ? void 0 : files.length)) return [
42544
- 2
42545
- ];
42546
- return [
42547
- 4,
42548
- fileToDataURL(files[0])
42549
- ];
42550
- case 1:
42551
- base64 = _state.sent();
42552
- return [
42553
- 4,
42554
- dataURLToImage(base64)
42555
- ];
42556
- case 2:
42557
- image = _state.sent();
42558
- setDrawImgs(image);
42559
- return [
42560
- 2
42561
- ];
42562
- }
42563
- });
42564
- });
42565
- return function inputImageChange2(event) {
42566
- return _ref2.apply(this, arguments);
42567
- };
42568
- }();
42569
- var resetScale = function(scale2) {
42570
- setState(_object_spread_props(_object_spread({}, state), {
42571
- moveX: 0,
42572
- moveY: 0,
42573
- angle: 0,
42574
- scale: scale2 || state.defScale,
42575
- defScale: scale2 || state.defScale
42576
- }));
42577
- };
42578
- var setScale = function(scale2) {
42579
- scale2 = clamp(scale2, 0.3, +maxZoom + 1);
42580
- if (scale2 !== state.scale) {
42581
- setState(_object_spread_props(_object_spread({}, state), {
42582
- scale: scale2
42583
- }));
42584
- }
42585
- };
42586
- var getDistance = function(touches) {
42587
- return Math.sqrt(Math.pow(touches[0].clientX - touches[1].clientX, 2) + Math.pow(touches[0].clientY - touches[1].clientY, 2));
42588
- };
42589
- var _useState5 = _sliced_to_array(React.useState({
42590
- startMoveX: 0,
42591
- startMoveY: 0,
42592
- startScale: 0,
42593
- startDistance: 0
42594
- }), 2), startMove = _useState5[0], setStartMove = _useState5[1];
42595
- var startMoveX = startMove.startMoveX, startMoveY = startMove.startMoveY, startScale = startMove.startScale, startDistance = startMove.startDistance;
42596
- var onTouchStart = function(event) {
42597
- var touches = event.touches;
42598
- var offsetX = touch.offsetX;
42599
- touch.start(event);
42600
- var fingerNum = touches === null || touches === void 0 ? void 0 : touches.length;
42601
- setStartMove(_object_spread_props(_object_spread({}, startMove), {
42602
- startMoveX: state.moveX,
42603
- startMoveY: state.moveY
42604
- }));
42605
- setMoving(fingerNum === 1);
42606
- setZooming(fingerNum === 2 && !offsetX.current);
42607
- if (fingerNum === 2 && !offsetX.current) {
42608
- setStartMove(_object_spread_props(_object_spread({}, startMove), {
42609
- startScale: state.scale,
42610
- startDistance: getDistance(event.touches)
42611
- }));
42612
- }
42613
- };
42614
- var onTouchMove = function(event) {
42615
- var touches = event.touches;
42616
- touch.move(event);
42617
- if (moving || zooming) {
42618
- preventDefault$1(event, true);
42619
- }
42620
- if (moving) {
42621
- var deltaX = touch.deltaX, deltaY = touch.deltaY;
42622
- var moveX = deltaX.current * state.scale + startMoveX;
42623
- var moveY = deltaY.current * state.scale + startMoveY;
42624
- setState(_object_spread_props(_object_spread({}, state), {
42625
- moveX: clamp(moveX, -maxMoveX, maxMoveX),
42626
- moveY: clamp(moveY, -maxMoveY, maxMoveY)
42627
- }));
42628
- }
42629
- if (zooming && touches.length === 2) {
42630
- var distance = getDistance(touches);
42631
- var scale2 = startScale * distance / startDistance;
42632
- setScale(scale2);
42633
- }
42634
- };
42635
- var onTouchEnd = function(event) {
42636
- var stopPropagation = false;
42637
- if (moving || zooming) {
42638
- stopPropagation = !(moving && startMoveX === state.moveX && startMoveY === state.moveY);
42639
- if (!event.touches.length) {
42640
- if (zooming) {
42641
- setState(_object_spread_props(_object_spread({}, state), {
42642
- moveX: clamp(state.moveX, -maxMoveX, maxMoveX),
42643
- moveY: clamp(state.moveY, -maxMoveY, maxMoveY)
42644
- }));
42645
- setZooming(false);
42646
- }
42647
- setMoving(false);
42648
- setStartMove(_object_spread_props(_object_spread({}, startMove), {
42649
- startMoveX: 0,
42650
- startMoveY: 0,
42651
- startScale: state.defScale
42652
- }));
42653
- if (state.scale < state.defScale) {
42654
- resetScale();
42655
- }
42656
- if (state.scale > maxZoom) {
42657
- setState(_object_spread_props(_object_spread({}, state), {
42658
- scale: +maxZoom
42659
- }));
42660
- }
42661
- }
42662
- }
42663
- preventDefault$1(event, stopPropagation);
42664
- touch.reset();
42665
- };
42666
- var reset = function() {
42667
- setState(_object_spread_props(_object_spread({}, state), {
42668
- angle: 0
42669
- }));
42670
- };
42671
- var rotate = function() {
42672
- if (state.angle === 270) {
42673
- setState(_object_spread_props(_object_spread({}, state), {
42674
- angle: 0
42675
- }));
42676
- return;
42677
- }
42678
- setState(_object_spread_props(_object_spread({}, state), {
42679
- angle: state.angle + 90
42680
- }));
42681
- };
42682
- var cancel = function() {
42683
- var isEmit = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
42684
- setVisible(false);
42685
- resetScale();
42686
- inputImageRef.current && (inputImageRef.current.value = "");
42687
- isEmit && onCancel && onCancel();
42688
- };
42689
- var confirm2 = function() {
42690
- var canvas = canvasRef.current;
42691
- var sx = drawImage.sx, sy = drawImage.sy, swidth = drawImage.swidth;
42692
- var width2 = swidth;
42693
- var height2 = swidth;
42694
- var croppedCanvas = document.createElement("canvas");
42695
- var croppedCtx = croppedCanvas.getContext("2d");
42696
- croppedCanvas.width = width2;
42697
- croppedCanvas.height = height2;
42698
- canvas && croppedCtx.drawImage(canvas, sx, sy, width2, height2, 0, 0, width2, height2);
42699
- var imageDataURL = croppedCanvas.toDataURL("image/png");
42700
- onConfirm && onConfirm(imageDataURL);
42701
- cancel(false);
42702
- };
42703
- var ToolBar = function() {
42704
- var actions = [
42705
- cancel,
42706
- reset,
42707
- rotate,
42708
- confirm2
42709
- ];
42710
- return /* @__PURE__ */ React.createElement("div", {
42711
- className: "".concat(classPrefix, "-popup-toolbar-flex")
42712
- }, actions.map(function(action, index2) {
42713
- return /* @__PURE__ */ React.createElement("div", {
42714
- key: index2,
42715
- className: "".concat(classPrefix, "-popup-toolbar-item"),
42716
- onClick: function(_e) {
42717
- return action();
42718
- }
42719
- }, toolbar[index2]);
42720
- }));
42721
- };
42722
- var CropperPopup = function() {
42723
- return /* @__PURE__ */ React.createElement("div", {
42724
- ref: cropperPopupRef,
42725
- className: "".concat(classPrefix, "-popup"),
42726
- style: {
42727
- display: visible ? "block" : "none"
42728
- }
42729
- }, /* @__PURE__ */ React.createElement("canvas", {
42730
- ref: canvasRef,
42731
- className: "".concat(classPrefix, "-popup-canvas")
42732
- }), /* @__PURE__ */ React.createElement("div", {
42733
- className: "".concat(classPrefix, "-popup-highlight"),
42734
- onTouchStart,
42735
- onTouchMove,
42736
- onTouchEnd
42737
- }, /* @__PURE__ */ React.createElement("div", {
42738
- className: "highlight",
42739
- style: highlightStyle
42740
- })), /* @__PURE__ */ React.createElement("div", {
42741
- className: toolbarPositionCls
42742
- }, /* @__PURE__ */ React.createElement(ToolBar, null)));
42743
- };
42744
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", _object_spread_props(_object_spread({
42745
- className: cls
42746
- }, rest), {
42747
- style
42748
- }), children, /* @__PURE__ */ React.createElement("input", {
42749
- ref: inputImageRef,
42750
- type: "file",
42751
- accept: "image/*",
42752
- className: "".concat(classPrefix, "-input"),
42753
- onChange: function(e2) {
42754
- return inputImageChange(e2);
42755
- },
42756
- "aria-label": locale.avatarCropper.selectImage
42757
- }), /* @__PURE__ */ React.createElement("div", {
42758
- className: "nut-avatar-cropper-edit-text"
42759
- }, editText)), CropperPopup());
42760
- };
42761
- AvatarCropper.displayName = "NutAvatarCropper";
42762
42831
  exports.ActionSheet = ActionSheet;
42763
42832
  exports.Address = Address;
42764
42833
  exports.Animate = Animate;
@@ -42787,6 +42856,7 @@ Please add \`${key2}Action\` when creating your handler.`);
42787
42856
  exports.ConfigProvider = ConfigProvider;
42788
42857
  exports.CountDown = CountDown;
42789
42858
  exports.DatePicker = DatePicker;
42859
+ exports.DatePickerView = DatePickerView;
42790
42860
  exports.Dialog = Dialog;
42791
42861
  exports.Divider = Divider;
42792
42862
  exports.Drag = Drag;
@@ -42835,15 +42905,12 @@ Please add \`${key2}Action\` when creating your handler.`);
42835
42905
  exports.Segmented = Segmented;
42836
42906
  exports.ShortPassword = ShortPassword;
42837
42907
  exports.SideBar = SideBar;
42838
- exports.SideNavBar = SideNavBar;
42839
- exports.SideNavBarItem = SideNavBarItem;
42840
42908
  exports.Signature = Signature;
42841
42909
  exports.Skeleton = Skeleton;
42842
42910
  exports.Space = Space;
42843
42911
  exports.Step = Step;
42844
42912
  exports.Steps = Steps;
42845
42913
  exports.Sticky = Sticky;
42846
- exports.SubSideNavBar = SubSideNavBar;
42847
42914
  exports.Swipe = Swipe;
42848
42915
  exports.Swiper = InnerSwiper;
42849
42916
  exports.SwiperItem = SwiperItem;