@arco-design/mobile-react 2.28.1 → 2.29.0

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 (97) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/_helpers/hooks.d.ts +7 -1
  5. package/cjs/_helpers/hooks.js +9 -5
  6. package/cjs/form/form-item.js +109 -108
  7. package/cjs/grid/style/css/index.css +4 -0
  8. package/cjs/grid/style/index.less +6 -0
  9. package/cjs/index.d.ts +1 -0
  10. package/cjs/index.js +5 -1
  11. package/cjs/nav-bar/index.d.ts +3 -3
  12. package/cjs/picker-view/components/picker-cell.js +20 -6
  13. package/cjs/skeleton/demo/style/css/mobile.css +7 -0
  14. package/cjs/skeleton/demo/style/mobile.less +13 -0
  15. package/cjs/skeleton/elements.d.ts +7 -0
  16. package/cjs/skeleton/elements.js +302 -0
  17. package/cjs/skeleton/index.d.ts +18 -0
  18. package/cjs/skeleton/index.js +100 -0
  19. package/cjs/skeleton/skeleton-context.d.ts +3 -0
  20. package/cjs/skeleton/skeleton-context.js +15 -0
  21. package/cjs/skeleton/style/css/index.css +180 -0
  22. package/cjs/skeleton/style/css/index.d.ts +3 -0
  23. package/cjs/skeleton/style/css/index.js +7 -0
  24. package/cjs/skeleton/style/index.d.ts +3 -0
  25. package/cjs/skeleton/style/index.js +7 -0
  26. package/cjs/skeleton/style/index.less +147 -0
  27. package/cjs/skeleton/type.d.ts +104 -0
  28. package/cjs/skeleton/type.js +3 -0
  29. package/cjs/style.d.ts +1 -0
  30. package/cjs/style.js +2 -0
  31. package/cjs/tabs/index.js +8 -2
  32. package/dist/index.js +532 -147
  33. package/dist/index.min.js +5 -5
  34. package/dist/style.css +123 -0
  35. package/dist/style.min.css +1 -1
  36. package/esm/_helpers/hooks.d.ts +7 -1
  37. package/esm/_helpers/hooks.js +8 -2
  38. package/esm/form/form-item.js +109 -108
  39. package/esm/grid/style/css/index.css +4 -0
  40. package/esm/grid/style/index.less +6 -0
  41. package/esm/index.d.ts +1 -0
  42. package/esm/index.js +1 -0
  43. package/esm/nav-bar/index.d.ts +3 -3
  44. package/esm/picker-view/components/picker-cell.js +20 -6
  45. package/esm/skeleton/demo/style/css/mobile.css +7 -0
  46. package/esm/skeleton/demo/style/mobile.less +13 -0
  47. package/esm/skeleton/elements.d.ts +7 -0
  48. package/esm/skeleton/elements.js +281 -0
  49. package/esm/skeleton/index.d.ts +18 -0
  50. package/esm/skeleton/index.js +82 -0
  51. package/esm/skeleton/skeleton-context.d.ts +3 -0
  52. package/esm/skeleton/skeleton-context.js +5 -0
  53. package/esm/skeleton/style/css/index.css +180 -0
  54. package/esm/skeleton/style/css/index.d.ts +3 -0
  55. package/esm/skeleton/style/css/index.js +3 -0
  56. package/esm/skeleton/style/index.d.ts +3 -0
  57. package/esm/skeleton/style/index.js +3 -0
  58. package/esm/skeleton/style/index.less +147 -0
  59. package/esm/skeleton/type.d.ts +104 -0
  60. package/esm/skeleton/type.js +1 -0
  61. package/esm/style.d.ts +1 -0
  62. package/esm/style.js +1 -0
  63. package/esm/tabs/index.js +9 -3
  64. package/package.json +3 -3
  65. package/tokens/app/arcodesign/default/css-variables.less +16 -0
  66. package/tokens/app/arcodesign/default/index.d.ts +16 -0
  67. package/tokens/app/arcodesign/default/index.js +17 -1
  68. package/tokens/app/arcodesign/default/index.json +190 -0
  69. package/tokens/app/arcodesign/default/index.less +16 -0
  70. package/umd/_helpers/hooks.d.ts +7 -1
  71. package/umd/_helpers/hooks.js +9 -5
  72. package/umd/form/form-item.js +109 -108
  73. package/umd/grid/style/css/index.css +4 -0
  74. package/umd/grid/style/index.less +6 -0
  75. package/umd/index.d.ts +1 -0
  76. package/umd/index.js +7 -5
  77. package/umd/nav-bar/index.d.ts +3 -3
  78. package/umd/picker-view/components/picker-cell.js +20 -6
  79. package/umd/skeleton/demo/style/css/mobile.css +7 -0
  80. package/umd/skeleton/demo/style/mobile.less +13 -0
  81. package/umd/skeleton/elements.d.ts +7 -0
  82. package/umd/skeleton/elements.js +306 -0
  83. package/umd/skeleton/index.d.ts +18 -0
  84. package/umd/skeleton/index.js +104 -0
  85. package/umd/skeleton/skeleton-context.d.ts +3 -0
  86. package/umd/skeleton/skeleton-context.js +28 -0
  87. package/umd/skeleton/style/css/index.css +180 -0
  88. package/umd/skeleton/style/css/index.d.ts +3 -0
  89. package/umd/skeleton/style/css/index.js +15 -0
  90. package/umd/skeleton/style/index.d.ts +3 -0
  91. package/umd/skeleton/style/index.js +15 -0
  92. package/umd/skeleton/style/index.less +147 -0
  93. package/umd/skeleton/type.d.ts +104 -0
  94. package/umd/skeleton/type.js +17 -0
  95. package/umd/style.d.ts +1 -0
  96. package/umd/style.js +4 -4
  97. package/umd/tabs/index.js +8 -2
package/dist/index.js CHANGED
@@ -132,7 +132,7 @@
132
132
  function isEmptyArray(obj) {
133
133
  return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
134
134
  }
135
- var isDeepEqual = function isDeepEqual(obj, sub) {
135
+ function isDeepEqual(obj, sub) {
136
136
  if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
137
137
  return obj === sub;
138
138
  }
@@ -150,7 +150,7 @@
150
150
  }
151
151
 
152
152
  return true;
153
- };
153
+ }
154
154
 
155
155
  function cls () {
156
156
  var args = [];
@@ -367,7 +367,7 @@
367
367
  * @param childrenEl 子节点
368
368
  */
369
369
 
370
- var isContains = function isContains(parentEl, childrenEl) {
370
+ function isContains(parentEl, childrenEl) {
371
371
  if (!parentEl || !childrenEl) return false;
372
372
 
373
373
  if (parentEl.contains) {
@@ -385,7 +385,7 @@
385
385
  }
386
386
 
387
387
  return false;
388
- };
388
+ }
389
389
  function execRAF(fn) {
390
390
  try {
391
391
  return requestAnimationFrame(fn);
@@ -3142,6 +3142,12 @@
3142
3142
  * @desc {en} Tips: Use in scenarios where asynchronous processing is not completed after unmount. It is not recommended to replace useState without brains
3143
3143
  * @param initialState 初始状态
3144
3144
  * @param initialState {en} Initial State
3145
+ * @example
3146
+ * ```
3147
+ * import { useMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
3148
+ *
3149
+ * const [scrollValue, setScrollValue] = useMountedState(value);
3150
+ * ```
3145
3151
  */
3146
3152
 
3147
3153
  function useMountedState(initialState) {
@@ -3535,7 +3541,7 @@
3535
3541
  };
3536
3542
  }, [visible]);
3537
3543
  }
3538
- var useProgress = function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
3544
+ function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
3539
3545
  var _a = React.useState(0),
3540
3546
  currentPercentage = _a[0],
3541
3547
  setCurrentPercentage = _a[1];
@@ -3569,7 +3575,7 @@
3569
3575
  percentage === 100 ? setCurrentPercentage(100) : setCurrentPercentage(count * step);
3570
3576
  }, [count, percentage, step]);
3571
3577
  return [currentPercentage, transitionControl];
3572
- };
3578
+ }
3573
3579
  function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
3574
3580
  if (delay === void 0) {
3575
3581
  delay = 200;
@@ -5468,9 +5474,15 @@
5468
5474
  }
5469
5475
 
5470
5476
  function updateLayout() {
5477
+ var _a, _b;
5478
+
5479
+ var _c = getOffset(domRef.current),
5480
+ width = _c.width,
5481
+ height = _c.height;
5482
+
5471
5483
  cellRef.current && cellRef.current.resetUnderlineStyle();
5472
- setWrapWidth(domRef.current ? domRef.current.offsetWidth : 0);
5473
- setWrapHeight(domRef.current ? domRef.current.offsetHeight : 0);
5484
+ setWrapWidth(width || ((_a = domRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0);
5485
+ setWrapHeight(height || ((_b = domRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0);
5474
5486
  paneRef.current && paneRef.current.setCurrentHeight();
5475
5487
  }
5476
5488
 
@@ -6134,7 +6146,7 @@
6134
6146
  * @name_en Cell
6135
6147
  */
6136
6148
 
6137
- var index$o = componentWrapper(Cell, {
6149
+ var index$p = componentWrapper(Cell, {
6138
6150
  Group: Group$4
6139
6151
  });
6140
6152
 
@@ -7429,7 +7441,7 @@
7429
7441
  * @name_en ActionSheet
7430
7442
  */
7431
7443
 
7432
- var index$n = componentWrapper(ActionSheet, methodsGenerator$5(ActionSheetWithGlobalContext));
7444
+ var index$o = componentWrapper(ActionSheet, methodsGenerator$5(ActionSheetWithGlobalContext));
7433
7445
 
7434
7446
  /**
7435
7447
  * 加载中组件,分为四种类型,`circle`为环形,`arc`为弧线,`spin`为旋转,`dot`为圆点。所有类型均可定制颜色,环形和弧线类型可定制线圈半径及粗细,旋转和圆点类型可定制内部元素透明度。
@@ -8214,7 +8226,7 @@
8214
8226
  * @name_en Avatar
8215
8227
  */
8216
8228
 
8217
- var index$m = componentWrapper(Avatar, {
8229
+ var index$n = componentWrapper(Avatar, {
8218
8230
  Group: Group$3
8219
8231
  });
8220
8232
 
@@ -10467,7 +10479,7 @@
10467
10479
  * @name_en Collapse
10468
10480
  */
10469
10481
 
10470
- var index$l = componentWrapper(Collapse, {
10482
+ var index$m = componentWrapper(Collapse, {
10471
10483
  Group: Group$1
10472
10484
  });
10473
10485
 
@@ -10964,6 +10976,7 @@
10964
10976
  var rowCount = Math.max(rows % 2 === 0 ? rows + 1 : rows, 3);
10965
10977
  var isTouchMoveRef = React.useRef(false);
10966
10978
  var isTouchStopped = React.useRef(false);
10979
+ var unmountCallbackRef = React.useRef();
10967
10980
  var timeRef = React.useRef(null);
10968
10981
  var colStyle = React.useMemo(function () {
10969
10982
  return getStyleWithVendor(__assign$2(__assign$2({
@@ -11005,20 +11018,24 @@
11005
11018
  }
11006
11019
 
11007
11020
  setTransitionDuration(transDuration ? transDuration + "ms" : '');
11008
- setTransformY(transY); // 处理连续滑动的情况:
11009
- // @en handle the case of continuous sliding:
11010
- // 如果上一次callback还未执行,先cancel掉上一次回调,只执行最近的一次回调
11011
- // @en If the last callback has not been executed, cancel the last callback first, and only execute the latest callback
11021
+ setTransformY(transY); // 处理连续滑动的情况:如果上一次callback还未执行,先cancel掉上一次回调
11022
+ // @en handle the case of continuous sliding: If the last callback has not been executed, cancel the last callback first
11012
11023
 
11013
11024
  if (latestCallbackTimer.current) {
11014
11025
  clearTimeout(latestCallbackTimer.current);
11015
11026
  }
11016
11027
 
11017
- latestCallbackTimer.current = window.setTimeout(function () {
11028
+ var setNormalStatus = function setNormalStatus() {
11029
+ // 如果timer顺利执行,则在unmount时不再重复执行
11030
+ // @en If the timer is successfully executed, it will not be repeated when unmounting
11031
+ unmountCallbackRef.current = undefined;
11018
11032
  movingStatusRef.current = 'normal';
11019
11033
  setTransitionDuration('');
11020
11034
  callback();
11021
- }, transDuration);
11035
+ };
11036
+
11037
+ unmountCallbackRef.current = setNormalStatus;
11038
+ latestCallbackTimer.current = window.setTimeout(setNormalStatus, transDuration);
11022
11039
  }
11023
11040
 
11024
11041
  function _scrollToIndex(itemIndex, transDuration, callback) {
@@ -11216,6 +11233,17 @@
11216
11233
  _scrollToIndexWithChange(itemIndex, 200);
11217
11234
  }
11218
11235
 
11236
+ React.useEffect(function () {
11237
+ return function () {
11238
+ var _a; // 卸载组件时,如果timer中还有未执行的onchange操作,则立刻执行该操作并移除timer
11239
+ // @en When unloading the component, if there is an unexecuted onchange operation in the timer, execute it immediately and remove the timer
11240
+
11241
+
11242
+ var timerId = latestCallbackTimer.current;
11243
+ (_a = unmountCallbackRef.current) === null || _a === void 0 ? void 0 : _a.call(unmountCallbackRef);
11244
+ timerId && clearTimeout(timerId);
11245
+ };
11246
+ }, []);
11219
11247
  React.useEffect(function () {
11220
11248
  if (wrapRef.current) {
11221
11249
  wrapRef.current.addEventListener('touchstart', _handleColumnTouchStart);
@@ -12136,7 +12164,7 @@
12136
12164
  * @displayName DatePicker
12137
12165
  */
12138
12166
 
12139
- var index$k = componentWrapper(DatePicker, 'DatePicker');
12167
+ var index$l = componentWrapper(DatePicker, 'DatePicker');
12140
12168
 
12141
12169
  function normalizeAlert(config) {
12142
12170
  var _a = config || {},
@@ -12334,7 +12362,7 @@
12334
12362
  * @name_en Dialog
12335
12363
  */
12336
12364
 
12337
- var index$j = componentWrapper(Dialog, methodsGenerator$4(DialogWithGlobalContext));
12365
+ var index$k = componentWrapper(Dialog, methodsGenerator$4(DialogWithGlobalContext));
12338
12366
 
12339
12367
  /**
12340
12368
  * 划分内容的装饰线
@@ -14146,7 +14174,7 @@
14146
14174
  };
14147
14175
  });
14148
14176
 
14149
- var index$i = (function () {
14177
+ var index$j = (function () {
14150
14178
  // Export existing implementation if available.
14151
14179
  if (typeof global$1.ResizeObserver !== 'undefined') {
14152
14180
  return global$1.ResizeObserver;
@@ -14377,7 +14405,7 @@
14377
14405
  React.useEffect(function () {
14378
14406
  if (domRef.current && reflowOnResize) {
14379
14407
  if (!observerRef.current && ellipsis) {
14380
- observerRef.current = new index$i(reflow);
14408
+ observerRef.current = new index$j(reflow);
14381
14409
  observerRef.current.observe(domRef.current);
14382
14410
  }
14383
14411
  }
@@ -14891,6 +14919,87 @@
14891
14919
  _this._errors = [];
14892
14920
  _this._touched = false;
14893
14921
 
14922
+ _this.onValueChange = function (preStore, curStore) {
14923
+ _this._touched = true;
14924
+ var shouldUpdate = _this.props.shouldUpdate;
14925
+
14926
+ if (typeof shouldUpdate === 'function') {
14927
+ shouldUpdate({
14928
+ preStore: preStore,
14929
+ curStore: curStore
14930
+ }) && _this.forceUpdate();
14931
+ return;
14932
+ }
14933
+
14934
+ _this.forceUpdate();
14935
+ };
14936
+
14937
+ _this.getFieldError = function () {
14938
+ return _this._errors;
14939
+ };
14940
+
14941
+ _this.isFieldTouched = function () {
14942
+ return _this._touched;
14943
+ };
14944
+
14945
+ _this.validateField = function () {
14946
+ var _a;
14947
+
14948
+ var validateMessages = _this.context.validateMessages;
14949
+ var getFieldValue = _this.context.form.getFieldValue;
14950
+ var _b = _this.props,
14951
+ field = _b.field,
14952
+ rules = _b.rules,
14953
+ onValidateStatusChange = _b.onValidateStatusChange;
14954
+ var value = getFieldValue(field);
14955
+
14956
+ if ((rules === null || rules === void 0 ? void 0 : rules.length) && field) {
14957
+ var fieldDom_1 = _this.props.getFormItemRef();
14958
+
14959
+ var fieldValidator_1 = new Validator((_a = {}, _a[field] = rules, _a), {
14960
+ validateMessages: validateMessages
14961
+ });
14962
+ return new Promise(function (resolve) {
14963
+ var _a;
14964
+
14965
+ fieldValidator_1.validate((_a = {}, _a[field] = value, _a), function (errorsMap) {
14966
+ var _a = getErrorAndWarnings((errorsMap === null || errorsMap === void 0 ? void 0 : errorsMap[field]) || []),
14967
+ errors = _a.errors,
14968
+ warnings = _a.warnings;
14969
+
14970
+ _this._errors = errors;
14971
+ onValidateStatusChange({
14972
+ errors: _this._errors,
14973
+ warnings: warnings
14974
+ });
14975
+ return resolve({
14976
+ errors: _this._errors,
14977
+ warnings: warnings,
14978
+ value: value,
14979
+ field: field,
14980
+ dom: fieldDom_1
14981
+ });
14982
+ });
14983
+ });
14984
+ }
14985
+
14986
+ return Promise.resolve({
14987
+ errors: [],
14988
+ warnings: [],
14989
+ value: value,
14990
+ field: field,
14991
+ dom: null
14992
+ });
14993
+ };
14994
+
14995
+ _this.setFieldData = function (value) {
14996
+ var field = _this.props.field;
14997
+ var setFieldValue = _this.context.form.setFieldValue;
14998
+ setFieldValue(field, value);
14999
+
15000
+ _this.validateField();
15001
+ };
15002
+
14894
15003
  _this.innerTriggerFunction = function (_, value) {
14895
15004
  var _a, _b;
14896
15005
 
@@ -14933,6 +15042,24 @@
14933
15042
  }
14934
15043
  };
14935
15044
 
15045
+ _this.innerClearFunction = function () {
15046
+ var _a, _b;
15047
+
15048
+ var args = [];
15049
+
15050
+ for (var _i = 0; _i < arguments.length; _i++) {
15051
+ args[_i] = arguments[_i];
15052
+ }
15053
+
15054
+ var children = _this.props.children;
15055
+
15056
+ _this.setFieldData('');
15057
+
15058
+ if ((_a = children.props) === null || _a === void 0 ? void 0 : _a.onClear) {
15059
+ (_b = children.props) === null || _b === void 0 ? void 0 : _b.onClear.apply(_b, args);
15060
+ }
15061
+ };
15062
+
14936
15063
  _this.destroyField = function () {};
14937
15064
 
14938
15065
  if ((props === null || props === void 0 ? void 0 : props.initialValue) && props.field) {
@@ -14952,104 +15079,6 @@
14952
15079
  this.destroyField();
14953
15080
  };
14954
15081
 
14955
- FormItemInner.prototype.onValueChange = function (preStore, curStore) {
14956
- this._touched = true;
14957
- var shouldUpdate = this.props.shouldUpdate;
14958
-
14959
- if (typeof shouldUpdate === 'function') {
14960
- shouldUpdate({
14961
- preStore: preStore,
14962
- curStore: curStore
14963
- }) && this.forceUpdate();
14964
- return;
14965
- }
14966
-
14967
- this.forceUpdate();
14968
- };
14969
-
14970
- FormItemInner.prototype.getFieldError = function () {
14971
- return this._errors;
14972
- };
14973
-
14974
- FormItemInner.prototype.isFieldTouched = function () {
14975
- return this._touched;
14976
- };
14977
-
14978
- FormItemInner.prototype.validateField = function () {
14979
- var _a;
14980
-
14981
- var _this = this;
14982
-
14983
- var validateMessages = this.context.validateMessages;
14984
- var getFieldValue = this.context.form.getFieldValue;
14985
- var _b = this.props,
14986
- field = _b.field,
14987
- rules = _b.rules,
14988
- onValidateStatusChange = _b.onValidateStatusChange;
14989
- var value = getFieldValue(field);
14990
-
14991
- if ((rules === null || rules === void 0 ? void 0 : rules.length) && field) {
14992
- var fieldDom_1 = this.props.getFormItemRef();
14993
- var fieldValidator_1 = new Validator((_a = {}, _a[field] = rules, _a), {
14994
- validateMessages: validateMessages
14995
- });
14996
- return new Promise(function (resolve) {
14997
- var _a;
14998
-
14999
- fieldValidator_1.validate((_a = {}, _a[field] = value, _a), function (errorsMap) {
15000
- var _a = getErrorAndWarnings((errorsMap === null || errorsMap === void 0 ? void 0 : errorsMap[field]) || []),
15001
- errors = _a.errors,
15002
- warnings = _a.warnings;
15003
-
15004
- _this._errors = errors;
15005
- onValidateStatusChange({
15006
- errors: _this._errors,
15007
- warnings: warnings
15008
- });
15009
- return resolve({
15010
- errors: _this._errors,
15011
- warnings: warnings,
15012
- value: value,
15013
- field: field,
15014
- dom: fieldDom_1
15015
- });
15016
- });
15017
- });
15018
- }
15019
-
15020
- return Promise.resolve({
15021
- errors: [],
15022
- warnings: [],
15023
- value: value,
15024
- field: field,
15025
- dom: null
15026
- });
15027
- };
15028
-
15029
- FormItemInner.prototype.setFieldData = function (value) {
15030
- var field = this.props.field;
15031
- var setFieldValue = this.context.form.setFieldValue;
15032
- setFieldValue(field, value);
15033
- this.validateField();
15034
- };
15035
-
15036
- FormItemInner.prototype.innerClearFunction = function () {
15037
- var _a, _b;
15038
-
15039
- var args = [];
15040
-
15041
- for (var _i = 0; _i < arguments.length; _i++) {
15042
- args[_i] = arguments[_i];
15043
- }
15044
-
15045
- var children = this.props.children;
15046
- this.setFieldData('');
15047
-
15048
- if ((_a = children.props) === null || _a === void 0 ? void 0 : _a.onClear) {
15049
- (_b = children.props) === null || _b === void 0 ? void 0 : _b.onClear.apply(_b, args);
15050
- }
15051
- };
15052
-
15053
15082
  FormItemInner.prototype.renderChildren = function () {
15054
15083
  var _a;
15055
15084
 
@@ -15306,7 +15335,7 @@
15306
15335
  * @name_en Form
15307
15336
  */
15308
15337
 
15309
- var index$h = componentWrapper(Form, {
15338
+ var index$i = componentWrapper(Form, {
15310
15339
  Item: Item$1
15311
15340
  });
15312
15341
 
@@ -17284,10 +17313,10 @@
17284
17313
  * @displayName ImagePicker
17285
17314
  */
17286
17315
 
17287
- var index$g = componentWrapper(ImagePicker, 'ImagePicker');
17316
+ var index$h = componentWrapper(ImagePicker, 'ImagePicker');
17288
17317
 
17289
17318
  /*!
17290
- * @arco-design/transformable v1.0.1
17319
+ * @arco-design/transformable v1.0.2
17291
17320
  * (c) 2022 ludan.kibbon
17292
17321
  */
17293
17322
  function _defineProperty(obj, key, value) {
@@ -20482,7 +20511,7 @@
20482
20511
  * @name_en ImagePreview
20483
20512
  */
20484
20513
 
20485
- var index$f = componentWrapper(ImagePreview, methodsGenerator$3(ImagePreviewWithGlobalContext));
20514
+ var index$g = componentWrapper(ImagePreview, methodsGenerator$3(ImagePreviewWithGlobalContext));
20486
20515
 
20487
20516
  var IndexBarContext = /*#__PURE__*/React.createContext({
20488
20517
  sticky: true,
@@ -20951,7 +20980,7 @@
20951
20980
  * @name_en SearchBar
20952
20981
  */
20953
20982
 
20954
- var index$e = componentWrapper(IndexBar, {
20983
+ var index$f = componentWrapper(IndexBar, {
20955
20984
  Group: IndexBarGroup
20956
20985
  });
20957
20986
 
@@ -21300,7 +21329,7 @@
21300
21329
  * @displayName Input
21301
21330
  */
21302
21331
 
21303
- var index$d = componentWrapper(Input, 'Input');
21332
+ var index$e = componentWrapper(Input, 'Input');
21304
21333
 
21305
21334
  // @en let keyboard random
21306
21335
 
@@ -22103,7 +22132,7 @@
22103
22132
  * @name_en Notify
22104
22133
  */
22105
22134
 
22106
- var index$c = componentWrapper(Notify, methodsGenerator$2(NotifyWithGlobalContext));
22135
+ var index$d = componentWrapper(Notify, methodsGenerator$2(NotifyWithGlobalContext));
22107
22136
 
22108
22137
  function Arrow() {
22109
22138
  return /*#__PURE__*/React__default["default"].createElement("svg", {
@@ -23515,7 +23544,7 @@
23515
23544
  * @type_en Data Display
23516
23545
  */
23517
23546
 
23518
- var index$b = componentWrapper(Popover$1, {
23547
+ var index$c = componentWrapper(Popover$1, {
23519
23548
  Menu: Menu
23520
23549
  });
23521
23550
 
@@ -23781,7 +23810,7 @@
23781
23810
  * @name_en PopupSwiper
23782
23811
  */
23783
23812
 
23784
- var index$a = componentWrapper(PopupSwiper, methodsGenerator$1(PopupSwiperWithGlobalContext));
23813
+ var index$b = componentWrapper(PopupSwiper, methodsGenerator$1(PopupSwiperWithGlobalContext));
23785
23814
 
23786
23815
  /**
23787
23816
  * 进度条组件,可根据外界传递进来的百分比进行进度展示
@@ -24632,7 +24661,7 @@
24632
24661
  * @displayName Radio
24633
24662
  */
24634
24663
 
24635
- var index$9 = componentWrapper(Radio, 'Radio', {
24664
+ var index$a = componentWrapper(Radio, 'Radio', {
24636
24665
  Group: Group
24637
24666
  });
24638
24667
 
@@ -24814,7 +24843,7 @@
24814
24843
  * @displayName Rate
24815
24844
  */
24816
24845
 
24817
- var index$8 = componentWrapper(Rate, 'Rate');
24846
+ var index$9 = componentWrapper(Rate, 'Rate');
24818
24847
 
24819
24848
  function createHighlightNode(config, index) {
24820
24849
  var keyword = config.keyword,
@@ -25189,6 +25218,361 @@
25189
25218
  return /*#__PURE__*/React__default["default"].createElement(ContextLayout, null, renderSearchBar);
25190
25219
  });
25191
25220
 
25221
+ var SkeletonContext = /*#__PURE__*/React__default["default"].createContext({
25222
+ showAnimation: true,
25223
+ animation: 'gradient'
25224
+ });
25225
+
25226
+ var calcOffset = function calcOffset(dom, useRtl) {
25227
+ if (!dom) {
25228
+ return 0;
25229
+ }
25230
+
25231
+ if (useRtl) {
25232
+ return dom.offsetLeft - dom.offsetTop;
25233
+ }
25234
+
25235
+ return dom.offsetLeft + dom.offsetTop;
25236
+ };
25237
+
25238
+ function useOffset(dom, useRtl) {
25239
+ var _a = React.useState(),
25240
+ offset = _a[0],
25241
+ setOffset = _a[1];
25242
+
25243
+ var calcLayout = function calcLayout() {
25244
+ var _a;
25245
+
25246
+ var isList = Array.isArray(dom);
25247
+
25248
+ if (!(isList ? dom.length > 0 : (_a = dom) === null || _a === void 0 ? void 0 : _a.current)) {
25249
+ return;
25250
+ }
25251
+
25252
+ setOffset(isList ? dom.map(function (item) {
25253
+ return calcOffset(item, useRtl);
25254
+ }) : calcOffset(dom.current, useRtl));
25255
+ };
25256
+
25257
+ React.useEffect(function () {
25258
+ nextTick(function () {
25259
+ calcLayout();
25260
+ });
25261
+ }, [dom, useRtl]);
25262
+ useListenResize(calcLayout);
25263
+ return offset;
25264
+ }
25265
+
25266
+ var SkeletonNode = /*#__PURE__*/React.forwardRef(function (props, ref) {
25267
+ var _a = props.className,
25268
+ className = _a === void 0 ? '' : _a,
25269
+ style = props.style,
25270
+ children = props.children;
25271
+
25272
+ var _b = React.useContext(GlobalContext),
25273
+ useRtl = _b.useRtl,
25274
+ prefixCls = _b.prefixCls;
25275
+
25276
+ var _c = React.useContext(SkeletonContext),
25277
+ backgroundColor = _c.backgroundColor,
25278
+ showAnimation = _c.showAnimation,
25279
+ animation = _c.animation;
25280
+
25281
+ var domRef = React.useRef(null);
25282
+ var isGradientAnimation = showAnimation && animation === 'gradient';
25283
+ var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
25284
+ React.useImperativeHandle(ref, function () {
25285
+ return {
25286
+ dom: domRef.current
25287
+ };
25288
+ });
25289
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25290
+ className: cls(prefixCls + "-skeleton-item", prefixCls + "-skeleton-node", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
25291
+ style: __assign$2({
25292
+ backgroundColor: backgroundColor
25293
+ }, style),
25294
+ ref: domRef
25295
+ }, children, isGradientAnimation && offset !== undefined && /*#__PURE__*/React__default["default"].createElement("div", {
25296
+ className: prefixCls + "-skeleton-animation-item",
25297
+ style: {
25298
+ left: 0 - offset
25299
+ }
25300
+ }));
25301
+ });
25302
+ var SkeletonTitle = /*#__PURE__*/React.forwardRef(function (props, ref) {
25303
+ var _a = props.className,
25304
+ className = _a === void 0 ? '' : _a,
25305
+ style = props.style,
25306
+ _b = props.width,
25307
+ width = _b === void 0 ? '40%' : _b;
25308
+
25309
+ var _c = React.useContext(GlobalContext),
25310
+ useRtl = _c.useRtl,
25311
+ prefixCls = _c.prefixCls;
25312
+
25313
+ var _d = React.useContext(SkeletonContext),
25314
+ backgroundColor = _d.backgroundColor,
25315
+ showAnimation = _d.showAnimation,
25316
+ animation = _d.animation;
25317
+
25318
+ var domRef = React.useRef(null);
25319
+ var isGradientAnimation = showAnimation && animation === 'gradient';
25320
+ var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
25321
+ React.useImperativeHandle(ref, function () {
25322
+ return {
25323
+ dom: domRef.current
25324
+ };
25325
+ });
25326
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25327
+ className: cls(prefixCls + "-skeleton-item", prefixCls + "-skeleton-title", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
25328
+ style: __assign$2({
25329
+ width: width,
25330
+ backgroundColor: backgroundColor
25331
+ }, style),
25332
+ ref: domRef
25333
+ }, isGradientAnimation && offset !== undefined && /*#__PURE__*/React__default["default"].createElement("div", {
25334
+ className: prefixCls + "-skeleton-animation-item",
25335
+ style: {
25336
+ left: 0 - offset
25337
+ }
25338
+ }));
25339
+ });
25340
+ var SkeletonParagraph = /*#__PURE__*/React.forwardRef(function (props, ref) {
25341
+ var _a = props.className,
25342
+ className = _a === void 0 ? '' : _a,
25343
+ style = props.style,
25344
+ _b = props.rows,
25345
+ rows = _b === void 0 ? 3 : _b,
25346
+ _c = props.width,
25347
+ width = _c === void 0 ? '60%' : _c;
25348
+
25349
+ var _d = React.useContext(GlobalContext),
25350
+ useRtl = _d.useRtl,
25351
+ prefixCls = _d.prefixCls;
25352
+
25353
+ var _e = React.useContext(SkeletonContext),
25354
+ backgroundColor = _e.backgroundColor,
25355
+ showAnimation = _e.showAnimation,
25356
+ animation = _e.animation;
25357
+
25358
+ var domRef = React.useRef(null);
25359
+ var lineDomRefs = React.useRef([]);
25360
+ var isGradientAnimation = showAnimation && animation === 'gradient';
25361
+ var offsets = useOffset(isGradientAnimation ? lineDomRefs.current : undefined, useRtl);
25362
+ React.useImperativeHandle(ref, function () {
25363
+ return {
25364
+ dom: domRef.current
25365
+ };
25366
+ });
25367
+
25368
+ var getWidth = function getWidth(idx) {
25369
+ if (isArray(width)) {
25370
+ return width[idx];
25371
+ }
25372
+
25373
+ if (rows - 1 === idx) {
25374
+ return width;
25375
+ }
25376
+
25377
+ return undefined;
25378
+ };
25379
+
25380
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25381
+ className: cls(prefixCls + "-skeleton-paragraph", className),
25382
+ style: style,
25383
+ ref: domRef
25384
+ }, Array.from(new Array(rows)).map(function (_, idx) {
25385
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25386
+ key: idx,
25387
+ className: cls(prefixCls + "-skeleton-item", prefixCls + "-skeleton-paragraph-line", showAnimation && prefixCls + "-skeleton-animation-" + animation),
25388
+ style: {
25389
+ width: getWidth(idx),
25390
+ backgroundColor: backgroundColor
25391
+ },
25392
+ ref: function ref(el) {
25393
+ return el && (lineDomRefs.current[idx] = el);
25394
+ }
25395
+ }, isGradientAnimation && offsets !== undefined && /*#__PURE__*/React__default["default"].createElement("div", {
25396
+ className: prefixCls + "-skeleton-animation-item",
25397
+ style: {
25398
+ left: 0 - (offsets[idx] || 0)
25399
+ }
25400
+ }));
25401
+ }));
25402
+ });
25403
+ var SkeletonAvatar = /*#__PURE__*/React.forwardRef(function (props, ref) {
25404
+ var _a = props.className,
25405
+ className = _a === void 0 ? '' : _a,
25406
+ style = props.style;
25407
+
25408
+ var _b = React.useContext(GlobalContext),
25409
+ useRtl = _b.useRtl,
25410
+ prefixCls = _b.prefixCls;
25411
+
25412
+ var _c = React.useContext(SkeletonContext),
25413
+ backgroundColor = _c.backgroundColor,
25414
+ showAnimation = _c.showAnimation,
25415
+ animation = _c.animation;
25416
+
25417
+ var domRef = React.useRef(null);
25418
+ var isGradientAnimation = showAnimation && animation === 'gradient';
25419
+ var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
25420
+ React.useImperativeHandle(ref, function () {
25421
+ return {
25422
+ dom: domRef.current
25423
+ };
25424
+ });
25425
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25426
+ className: cls(prefixCls + "-skeleton-item", prefixCls + "-skeleton-avatar", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
25427
+ style: __assign$2({
25428
+ backgroundColor: backgroundColor
25429
+ }, style),
25430
+ ref: domRef
25431
+ }, isGradientAnimation && offset !== undefined && /*#__PURE__*/React__default["default"].createElement("div", {
25432
+ className: prefixCls + "-skeleton-animation-item",
25433
+ style: {
25434
+ left: 0 - offset
25435
+ }
25436
+ }));
25437
+ });
25438
+ var SkeletonGrid = /*#__PURE__*/React.forwardRef(function (props, ref) {
25439
+ var _a = props.className,
25440
+ className = _a === void 0 ? '' : _a,
25441
+ style = props.style,
25442
+ _b = props.columns,
25443
+ columns = _b === void 0 ? 4 : _b;
25444
+
25445
+ var _c = React.useContext(GlobalContext),
25446
+ useRtl = _c.useRtl,
25447
+ prefixCls = _c.prefixCls;
25448
+
25449
+ var _d = React.useContext(SkeletonContext),
25450
+ backgroundColor = _d.backgroundColor,
25451
+ showAnimation = _d.showAnimation,
25452
+ animation = _d.animation;
25453
+
25454
+ var domRef = React.useRef(null);
25455
+ var iconDomRefs = React.useRef([]);
25456
+ var textDomRefs = React.useRef([]);
25457
+ var isGradientAnimation = showAnimation && animation === 'gradient';
25458
+ var iconOffsets = useOffset(isGradientAnimation ? iconDomRefs.current : undefined, useRtl);
25459
+ var textOffsets = useOffset(isGradientAnimation ? textDomRefs.current : undefined, useRtl);
25460
+ React.useImperativeHandle(ref, function () {
25461
+ return {
25462
+ dom: domRef.current
25463
+ };
25464
+ });
25465
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25466
+ className: cls(prefixCls + "-skeleton-grid", className),
25467
+ style: style,
25468
+ ref: domRef
25469
+ }, Array.from(new Array(columns)).map(function (_, idx) {
25470
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25471
+ key: idx,
25472
+ className: cls(prefixCls + "-skeleton-grid-item")
25473
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
25474
+ className: cls(prefixCls + "-skeleton-item", prefixCls + "-skeleton-grid-icon", showAnimation && prefixCls + "-skeleton-animation-" + animation),
25475
+ style: {
25476
+ backgroundColor: backgroundColor
25477
+ },
25478
+ ref: function ref(el) {
25479
+ return el && (iconDomRefs.current[idx] = el);
25480
+ }
25481
+ }, isGradientAnimation && iconOffsets !== undefined && /*#__PURE__*/React__default["default"].createElement("div", {
25482
+ className: prefixCls + "-skeleton-animation-item",
25483
+ style: {
25484
+ left: 0 - ((iconOffsets === null || iconOffsets === void 0 ? void 0 : iconOffsets[idx]) || 0)
25485
+ }
25486
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
25487
+ className: cls(prefixCls + "-skeleton-item", prefixCls + "-skeleton-grid-text", showAnimation && prefixCls + "-skeleton-animation-" + animation),
25488
+ style: {
25489
+ backgroundColor: backgroundColor
25490
+ },
25491
+ ref: function ref(el) {
25492
+ return el && (textDomRefs.current[idx] = el);
25493
+ }
25494
+ }, isGradientAnimation && textOffsets !== undefined && /*#__PURE__*/React__default["default"].createElement("div", {
25495
+ className: prefixCls + "-skeleton-animation-item",
25496
+ style: {
25497
+ left: 0 - ((textOffsets === null || textOffsets === void 0 ? void 0 : textOffsets[idx]) || 0)
25498
+ }
25499
+ })));
25500
+ }));
25501
+ });
25502
+
25503
+ function getComponentProps(prop) {
25504
+ if (prop && typeof prop === 'object') {
25505
+ return prop;
25506
+ }
25507
+
25508
+ return {};
25509
+ }
25510
+
25511
+ var Skeleton = /*#__PURE__*/React.forwardRef(function (props, ref) {
25512
+ var _a;
25513
+
25514
+ var _b = props.className,
25515
+ className = _b === void 0 ? '' : _b,
25516
+ style = props.style,
25517
+ children = props.children,
25518
+ _c = props.title,
25519
+ title = _c === void 0 ? true : _c,
25520
+ _d = props.paragraph,
25521
+ paragraph = _d === void 0 ? true : _d,
25522
+ _e = props.avatar,
25523
+ avatar = _e === void 0 ? false : _e,
25524
+ grid = props.grid,
25525
+ _f = props.showAnimation,
25526
+ showAnimation = _f === void 0 ? true : _f,
25527
+ _g = props.animation,
25528
+ animation = _g === void 0 ? 'gradient' : _g,
25529
+ animationGradientColor = props.animationGradientColor,
25530
+ backgroundColor = props.backgroundColor;
25531
+ var domRef = React.useRef(null);
25532
+ var prefixCls = React.useContext(GlobalContext).prefixCls;
25533
+ React.useImperativeHandle(ref, function () {
25534
+ return {
25535
+ dom: domRef.current
25536
+ };
25537
+ });
25538
+ var isGrid = !!grid;
25539
+ var hasTitle = !!title;
25540
+ var hasParagraph = !!paragraph;
25541
+ var hasAvatar = !!avatar;
25542
+ var content = isGrid ? /*#__PURE__*/React__default["default"].createElement(SkeletonGrid, __assign$2({}, getComponentProps(grid))) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, hasAvatar && /*#__PURE__*/React__default["default"].createElement(SkeletonAvatar, __assign$2({}, getComponentProps(avatar))), (hasTitle || hasParagraph) && /*#__PURE__*/React__default["default"].createElement("div", {
25543
+ className: prefixCls + "-skeleton-content"
25544
+ }, hasTitle && /*#__PURE__*/React__default["default"].createElement(SkeletonTitle, __assign$2({}, getComponentProps(title))), hasParagraph && /*#__PURE__*/React__default["default"].createElement(SkeletonParagraph, __assign$2({}, getComponentProps(paragraph)))));
25545
+ return /*#__PURE__*/React__default["default"].createElement("div", {
25546
+ className: cls(prefixCls + "-skeleton", (_a = {}, _a[prefixCls + "-skeleton-with-avatar"] = hasAvatar, _a), className),
25547
+ style: __assign$2({
25548
+ color: animationGradientColor
25549
+ }, style),
25550
+ ref: domRef
25551
+ }, /*#__PURE__*/React__default["default"].createElement(SkeletonContext.Provider, {
25552
+ value: {
25553
+ showAnimation: showAnimation,
25554
+ animation: animation,
25555
+ backgroundColor: backgroundColor
25556
+ }
25557
+ }, content, children));
25558
+ });
25559
+ /**
25560
+ * 在内容加载过程中展示一组占位图形。
25561
+ * @en Display a set of placeholder graphics during content loading
25562
+ * @type 信息展示
25563
+ * @type_en Data Display
25564
+ * @name 骨架屏
25565
+ * @name_en Skeleton
25566
+ */
25567
+
25568
+ var index$8 = componentWrapper(Skeleton, {
25569
+ Node: SkeletonNode,
25570
+ Title: SkeletonTitle,
25571
+ Paragraph: SkeletonParagraph,
25572
+ Avatar: SkeletonAvatar,
25573
+ Grid: SkeletonGrid
25574
+ });
25575
+
25192
25576
  var LISTEN_FLAG = 'data-show-listened';
25193
25577
  /**
25194
25578
  * 父 dom 节点集合
@@ -28474,50 +28858,51 @@
28474
28858
 
28475
28859
  var index = componentWrapper(Toast, methodsGenerator(ToastWithGlobalContext));
28476
28860
 
28477
- exports.ActionSheet = index$n;
28478
- exports.Avatar = index$m;
28861
+ exports.ActionSheet = index$o;
28862
+ exports.Avatar = index$n;
28479
28863
  exports.Badge = Badge;
28480
28864
  exports.Button = Button;
28481
28865
  exports.Carousel = Carousel;
28482
- exports.Cell = index$o;
28866
+ exports.Cell = index$p;
28483
28867
  exports.Checkbox = Checkbox;
28484
28868
  exports.CircleProgress = CircleProgress;
28485
- exports.Collapse = index$l;
28869
+ exports.Collapse = index$m;
28486
28870
  exports.ContextProvider = ContextProvider;
28487
28871
  exports.CountDown = CountDown;
28488
- exports.DatePicker = index$k;
28489
- exports.Dialog = index$j;
28872
+ exports.DatePicker = index$l;
28873
+ exports.Dialog = index$k;
28490
28874
  exports.Divider = Divider;
28491
28875
  exports.Dropdown = Dropdown$1;
28492
28876
  exports.DropdownMenu = DropdownMenu;
28493
28877
  exports.Ellipsis = Ellipsis;
28494
- exports.Form = index$h;
28878
+ exports.Form = index$i;
28495
28879
  exports.Grid = Grid;
28496
28880
  exports.Image = BaseImage;
28497
- exports.ImagePicker = index$g;
28498
- exports.ImagePreview = index$f;
28499
- exports.IndexBar = index$e;
28500
- exports.Input = index$d;
28881
+ exports.ImagePicker = index$h;
28882
+ exports.ImagePreview = index$g;
28883
+ exports.IndexBar = index$f;
28884
+ exports.Input = index$e;
28501
28885
  exports.Keyboard = Keyboard;
28502
28886
  exports.LoadMore = LoadMore;
28503
28887
  exports.Loading = Loading;
28504
28888
  exports.Masking = Masking$1;
28505
28889
  exports.NavBar = NavBar;
28506
28890
  exports.NoticeBar = NoticeBar;
28507
- exports.Notify = index$c;
28891
+ exports.Notify = index$d;
28508
28892
  exports.Pagination = Pagination;
28509
28893
  exports.Picker = Picker$1;
28510
28894
  exports.PickerView = PickerView$1;
28511
- exports.Popover = index$b;
28895
+ exports.Popover = index$c;
28512
28896
  exports.Popup = Popup$1;
28513
- exports.PopupSwiper = index$a;
28897
+ exports.PopupSwiper = index$b;
28514
28898
  exports.Portal = Portal;
28515
28899
  exports.Progress = Progress;
28516
28900
  exports.PullRefresh = PullRefresh;
28517
- exports.Radio = index$9;
28518
- exports.Rate = index$8;
28901
+ exports.Radio = index$a;
28902
+ exports.Rate = index$9;
28519
28903
  exports.SearchBar = SearchBar;
28520
28904
  exports.ShowMonitor = ShowMonitor;
28905
+ exports.Skeleton = index$8;
28521
28906
  exports.Slider = index$7;
28522
28907
  exports.Stepper = index$6;
28523
28908
  exports.Steps = index$5;