@arco-design/mobile-react 2.28.2 → 2.29.1
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.
- package/CHANGELOG.md +27 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/grid/style/css/index.css +4 -0
- package/cjs/grid/style/index.less +6 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +5 -1
- package/cjs/input/hooks.js +33 -40
- package/cjs/input/props.d.ts +1 -1
- package/cjs/skeleton/demo/style/css/mobile.css +7 -0
- package/cjs/skeleton/demo/style/mobile.less +13 -0
- package/cjs/skeleton/elements.d.ts +7 -0
- package/cjs/skeleton/elements.js +302 -0
- package/cjs/skeleton/index.d.ts +18 -0
- package/cjs/skeleton/index.js +100 -0
- package/cjs/skeleton/skeleton-context.d.ts +3 -0
- package/cjs/skeleton/skeleton-context.js +15 -0
- package/cjs/skeleton/style/css/index.css +180 -0
- package/cjs/skeleton/style/css/index.d.ts +3 -0
- package/cjs/skeleton/style/css/index.js +7 -0
- package/cjs/skeleton/style/index.d.ts +3 -0
- package/cjs/skeleton/style/index.js +7 -0
- package/cjs/skeleton/style/index.less +147 -0
- package/cjs/skeleton/type.d.ts +104 -0
- package/cjs/skeleton/type.js +3 -0
- package/cjs/style.d.ts +1 -0
- package/cjs/style.js +2 -0
- package/dist/index.js +423 -76
- package/dist/index.min.js +5 -5
- package/dist/style.css +123 -0
- package/dist/style.min.css +1 -1
- package/esm/grid/style/css/index.css +4 -0
- package/esm/grid/style/index.less +6 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/input/hooks.js +32 -40
- package/esm/input/props.d.ts +1 -1
- package/esm/skeleton/demo/style/css/mobile.css +7 -0
- package/esm/skeleton/demo/style/mobile.less +13 -0
- package/esm/skeleton/elements.d.ts +7 -0
- package/esm/skeleton/elements.js +281 -0
- package/esm/skeleton/index.d.ts +18 -0
- package/esm/skeleton/index.js +82 -0
- package/esm/skeleton/skeleton-context.d.ts +3 -0
- package/esm/skeleton/skeleton-context.js +5 -0
- package/esm/skeleton/style/css/index.css +180 -0
- package/esm/skeleton/style/css/index.d.ts +3 -0
- package/esm/skeleton/style/css/index.js +3 -0
- package/esm/skeleton/style/index.d.ts +3 -0
- package/esm/skeleton/style/index.js +3 -0
- package/esm/skeleton/style/index.less +147 -0
- package/esm/skeleton/type.d.ts +104 -0
- package/esm/skeleton/type.js +1 -0
- package/esm/style.d.ts +1 -0
- package/esm/style.js +1 -0
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +16 -0
- package/tokens/app/arcodesign/default/index.d.ts +16 -0
- package/tokens/app/arcodesign/default/index.js +17 -1
- package/tokens/app/arcodesign/default/index.json +190 -0
- package/tokens/app/arcodesign/default/index.less +16 -0
- package/umd/grid/style/css/index.css +4 -0
- package/umd/grid/style/index.less +6 -0
- package/umd/index.d.ts +1 -0
- package/umd/index.js +7 -5
- package/umd/input/hooks.js +36 -44
- package/umd/input/props.d.ts +1 -1
- package/umd/skeleton/demo/style/css/mobile.css +7 -0
- package/umd/skeleton/demo/style/mobile.less +13 -0
- package/umd/skeleton/elements.d.ts +7 -0
- package/umd/skeleton/elements.js +306 -0
- package/umd/skeleton/index.d.ts +18 -0
- package/umd/skeleton/index.js +104 -0
- package/umd/skeleton/skeleton-context.d.ts +3 -0
- package/umd/skeleton/skeleton-context.js +28 -0
- package/umd/skeleton/style/css/index.css +180 -0
- package/umd/skeleton/style/css/index.d.ts +3 -0
- package/umd/skeleton/style/css/index.js +15 -0
- package/umd/skeleton/style/index.d.ts +3 -0
- package/umd/skeleton/style/index.js +15 -0
- package/umd/skeleton/style/index.less +147 -0
- package/umd/skeleton/type.d.ts +104 -0
- package/umd/skeleton/type.js +17 -0
- package/umd/style.d.ts +1 -0
- package/umd/style.js +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,33 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [2.29.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.29.0...@arco-design/mobile-react@2.29.1) (2023-08-21)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* fix wrong logic after click clear icon of `Input`, `Textarea` and `SearchBar` ([#156](https://github.com/arco-design/arco-design-mobile/issues/156)) ([b741263](https://github.com/arco-design/arco-design-mobile/commit/b741263fd1a1b9c3da9c106f7487714e33e042f2))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [2.29.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.28.2...@arco-design/mobile-react@2.29.0) (2023-08-17)
|
18
|
+
|
19
|
+
|
20
|
+
### Bug Fixes
|
21
|
+
|
22
|
+
* compatibility between grid and image picker ([#151](https://github.com/arco-design/arco-design-mobile/issues/151)) ([28ae5b9](https://github.com/arco-design/arco-design-mobile/commit/28ae5b9a8eb6dd91422d50d3f2cfe8b0d7ccdfa4))
|
23
|
+
|
24
|
+
|
25
|
+
### Features
|
26
|
+
|
27
|
+
* add new component `Skeleton` ([#136](https://github.com/arco-design/arco-design-mobile/issues/136)) ([49351f6](https://github.com/arco-design/arco-design-mobile/commit/49351f639b7a3272b55f189447d935946933ddd6))
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
6
33
|
## [2.28.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.28.1...@arco-design/mobile-react@2.28.2) (2023-08-07)
|
7
34
|
|
8
35
|
|
package/README.en-US.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.29.0/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.29.0/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## Full import
|
package/README.md
CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
|
|
59
59
|
React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
|
60
60
|
|
61
61
|
```
|
62
|
-
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.
|
63
|
-
<script src="https://unpkg.com/@arco-design/mobile-react@2.
|
62
|
+
<link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.29.0/dist/style.min.css">
|
63
|
+
<script src="https://unpkg.com/@arco-design/mobile-react@2.29.0/dist/index.min.js"></script>
|
64
64
|
```
|
65
65
|
|
66
66
|
## 引入全部
|
package/cjs/index.d.ts
CHANGED
@@ -43,6 +43,7 @@ export { default as PullRefresh } from './pull-refresh';
|
|
43
43
|
export { default as Radio } from './radio';
|
44
44
|
export { default as Rate } from './rate';
|
45
45
|
export { default as SearchBar } from './search-bar';
|
46
|
+
export { default as Skeleton } from './skeleton';
|
46
47
|
export { default as ShowMonitor } from './show-monitor';
|
47
48
|
export { default as Slider } from './slider';
|
48
49
|
export { default as Stepper } from './stepper';
|
package/cjs/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
4
|
|
5
5
|
exports.__esModule = true;
|
6
|
-
exports.Transition = exports.Toast = exports.Textarea = exports.Tag = exports.Tabs = exports.TabBar = exports.Switch = exports.SwipeLoad = exports.SwipeAction = exports.Sticky = exports.Steps = exports.Stepper = exports.Slider = exports.ShowMonitor = exports.SearchBar = exports.Rate = exports.Radio = exports.PullRefresh = exports.Progress = exports.Portal = exports.PopupSwiper = exports.Popup = exports.Popover = exports.PickerView = exports.Picker = exports.Pagination = exports.Notify = exports.NoticeBar = exports.NavBar = exports.Masking = exports.Loading = exports.LoadMore = exports.Keyboard = exports.Input = exports.IndexBar = exports.ImagePreview = exports.ImagePicker = exports.Image = exports.Grid = exports.Form = exports.Ellipsis = exports.DropdownMenu = exports.Dropdown = exports.Divider = exports.Dialog = exports.DatePicker = exports.CountDown = exports.ContextProvider = exports.Collapse = exports.CircleProgress = exports.Checkbox = exports.Cell = exports.Carousel = exports.Button = exports.Badge = exports.Avatar = exports.ActionSheet = void 0;
|
6
|
+
exports.Transition = exports.Toast = exports.Textarea = exports.Tag = exports.Tabs = exports.TabBar = exports.Switch = exports.SwipeLoad = exports.SwipeAction = exports.Sticky = exports.Steps = exports.Stepper = exports.Slider = exports.Skeleton = exports.ShowMonitor = exports.SearchBar = exports.Rate = exports.Radio = exports.PullRefresh = exports.Progress = exports.Portal = exports.PopupSwiper = exports.Popup = exports.Popover = exports.PickerView = exports.Picker = exports.Pagination = exports.Notify = exports.NoticeBar = exports.NavBar = exports.Masking = exports.Loading = exports.LoadMore = exports.Keyboard = exports.Input = exports.IndexBar = exports.ImagePreview = exports.ImagePicker = exports.Image = exports.Grid = exports.Form = exports.Ellipsis = exports.DropdownMenu = exports.Dropdown = exports.Divider = exports.Dialog = exports.DatePicker = exports.CountDown = exports.ContextProvider = exports.Collapse = exports.CircleProgress = exports.Checkbox = exports.Cell = exports.Carousel = exports.Button = exports.Badge = exports.Avatar = exports.ActionSheet = void 0;
|
7
7
|
|
8
8
|
var _tabs = _interopRequireDefault(require("./tabs"));
|
9
9
|
|
@@ -185,6 +185,10 @@ var _searchBar = _interopRequireDefault(require("./search-bar"));
|
|
185
185
|
|
186
186
|
exports.SearchBar = _searchBar.default;
|
187
187
|
|
188
|
+
var _skeleton = _interopRequireDefault(require("./skeleton"));
|
189
|
+
|
190
|
+
exports.Skeleton = _skeleton.default;
|
191
|
+
|
188
192
|
var _showMonitor = _interopRequireDefault(require("./show-monitor"));
|
189
193
|
|
190
194
|
exports.ShowMonitor = _showMonitor.default;
|
package/cjs/input/hooks.js
CHANGED
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
5
5
|
exports.__esModule = true;
|
6
6
|
exports.useInputLogic = useInputLogic;
|
7
7
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
9
11
|
|
10
12
|
var _mobileUtils = require("@arco-design/mobile-utils");
|
@@ -62,23 +64,6 @@ function useInputLogic(props, inputRef) {
|
|
62
64
|
toggleClear = _useState2[1];
|
63
65
|
|
64
66
|
var compositingRef = (0, _react.useRef)(false);
|
65
|
-
/**
|
66
|
-
* clear相关问题背景
|
67
|
-
* 如果点击clear按钮之前已经是focusing状态了,那么在点完clear按钮之后会手动聚焦一下
|
68
|
-
* 该行为将导致onClear事件触发时,也会触发一次onBlur和onFocus事件,可能影响一些组件外的代码逻辑
|
69
|
-
*
|
70
|
-
* e.g. 假设input按钮右侧有一个按钮仅在聚焦时展示
|
71
|
-
* 实现代码大致是:onBlur设置其visible为false,onFocus设置其visible为true
|
72
|
-
* 那么这个按钮就会因为clear的点击造成一瞬的闪烁
|
73
|
-
*
|
74
|
-
* 解决思路
|
75
|
-
* 先来看一下,在输入框已激活的状态时,点击清除按钮后,组件的一些事件的触发顺序
|
76
|
-
* handleBlur -> handleClear -> handleFocus -> onBlur(外部回调) -> onFocus(外部回调)
|
77
|
-
* 可以看到外部的onBlur和onFocus回调都是在handleClear函数之后被调用
|
78
|
-
* 因此可以在handleClear中设置一个shouldPreventEvent的boolean标志
|
79
|
-
* 如果这个标志为true,则跳过调用外部的onBlur和onFocus,并在最后再将标志置回false
|
80
|
-
*
|
81
|
-
*/
|
82
67
|
|
83
68
|
var _useState3 = (0, _react.useState)(false),
|
84
69
|
isFocusing = _useState3[0],
|
@@ -178,28 +163,24 @@ function useInputLogic(props, inputRef) {
|
|
178
163
|
}
|
179
164
|
|
180
165
|
function handleFocus(e) {
|
181
|
-
(
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
}
|
166
|
+
if (preventEventWhenClearing && shouldPreventEvent.current) {
|
167
|
+
shouldPreventEvent.current = false;
|
168
|
+
return;
|
169
|
+
}
|
186
170
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
});
|
171
|
+
setIsFocusing(true);
|
172
|
+
clearShowType === 'focus' && toggleClear(true);
|
173
|
+
onFocus && onFocus(e);
|
191
174
|
}
|
192
175
|
|
193
176
|
function handleBlur(e) {
|
194
|
-
(
|
195
|
-
|
196
|
-
|
197
|
-
}
|
177
|
+
if (preventEventWhenClearing && shouldPreventEvent.current) {
|
178
|
+
return;
|
179
|
+
}
|
198
180
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
});
|
181
|
+
setIsFocusing(false);
|
182
|
+
clearShowType === 'focus' && toggleClear(false);
|
183
|
+
onBlur && onBlur(e);
|
203
184
|
}
|
204
185
|
|
205
186
|
function handleClick(e) {
|
@@ -230,10 +211,17 @@ function useInputLogic(props, inputRef) {
|
|
230
211
|
|
231
212
|
if (isFocusing) {
|
232
213
|
if (preventEventWhenClearing) {
|
233
|
-
shouldPreventEvent.current = true;
|
214
|
+
shouldPreventEvent.current = true; // 一段时间未执行blur或focus则重置,避免对下次事件循环造成影响
|
215
|
+
// @en If blur or focus is not executed for a period of time, it will be reset to avoid affecting the next event loop
|
216
|
+
|
217
|
+
setTimeout(function () {
|
218
|
+
shouldPreventEvent.current = false;
|
219
|
+
}, 200);
|
234
220
|
}
|
235
221
|
|
236
|
-
|
222
|
+
(0, _mobileUtils.nextTick)(function () {
|
223
|
+
inputRef.current && inputRef.current.focus();
|
224
|
+
});
|
237
225
|
}
|
238
226
|
});
|
239
227
|
}
|
@@ -243,6 +231,12 @@ function useInputLogic(props, inputRef) {
|
|
243
231
|
}
|
244
232
|
|
245
233
|
function renderWrapper(prefixCls, type, children) {
|
234
|
+
var _clearEvent;
|
235
|
+
|
236
|
+
// handleClear必须早于handleBlur执行,pc端仅mousedown事件触发早于blur,移动端touch相关事件均早于blur
|
237
|
+
// @en handleClear must be executed earlier than handleBlur
|
238
|
+
// @en only the mousedown event on the PC side is triggered earlier than blur, and the touch-related events on the mobile side are all earlier than blur
|
239
|
+
var clearEvent = (_clearEvent = {}, _clearEvent[system === 'pc' ? 'onMouseDown' : 'onTouchEnd'] = handleClear, _clearEvent);
|
246
240
|
return /*#__PURE__*/_react.default.createElement("div", {
|
247
241
|
role: "search",
|
248
242
|
className: prefixCls + "-container all-border-box " + (className || ''),
|
@@ -262,10 +256,9 @@ function useInputLogic(props, inputRef) {
|
|
262
256
|
className: (0, _mobileUtils.cls)(prefixCls + "-label", {
|
263
257
|
required: required
|
264
258
|
})
|
265
|
-
}, label) : prefix) : null, children, clearable && showClear ? /*#__PURE__*/_react.default.createElement("div", {
|
266
|
-
className: prefixCls + "-clear"
|
267
|
-
|
268
|
-
}, clearIcon) : null, suffix ? /*#__PURE__*/_react.default.createElement("div", {
|
259
|
+
}, label) : prefix) : null, children, clearable && showClear ? /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
260
|
+
className: prefixCls + "-clear"
|
261
|
+
}, clearEvent), clearIcon) : null, suffix ? /*#__PURE__*/_react.default.createElement("div", {
|
269
262
|
className: prefixCls + "-suffix"
|
270
263
|
}, suffix) : null), renderPendNode(append));
|
271
264
|
}
|
package/cjs/input/props.d.ts
CHANGED
@@ -124,7 +124,7 @@ export interface BasicInputProps<T = HTMLInputElement> {
|
|
124
124
|
* 按下清除按钮回调
|
125
125
|
* @en Callback when clear button is pressed
|
126
126
|
*/
|
127
|
-
onClear?: (e: React.
|
127
|
+
onClear?: (e: React.TouchEvent<HTMLElement>) => void;
|
128
128
|
/**
|
129
129
|
* 输入框前置内容,在输入框内部,也可自定义
|
130
130
|
* @en The prefix of the input box, inside the input box, can also be customized
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { SkeletonAvatarProps, SkeletonGridProps, SkeletonNodeProps, SkeletonParagraphProps, SkeletonRef, SkeletonTitleProps } from './type';
|
3
|
+
export declare const SkeletonNode: React.ForwardRefExoticComponent<SkeletonNodeProps & React.RefAttributes<SkeletonRef>>;
|
4
|
+
export declare const SkeletonTitle: React.ForwardRefExoticComponent<SkeletonTitleProps & React.RefAttributes<SkeletonRef>>;
|
5
|
+
export declare const SkeletonParagraph: React.ForwardRefExoticComponent<SkeletonParagraphProps & React.RefAttributes<SkeletonRef>>;
|
6
|
+
export declare const SkeletonAvatar: React.ForwardRefExoticComponent<SkeletonAvatarProps & React.RefAttributes<SkeletonRef>>;
|
7
|
+
export declare const SkeletonGrid: React.ForwardRefExoticComponent<SkeletonGridProps & React.RefAttributes<SkeletonRef>>;
|
@@ -0,0 +1,302 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
|
5
|
+
exports.__esModule = true;
|
6
|
+
exports.SkeletonTitle = exports.SkeletonParagraph = exports.SkeletonNode = exports.SkeletonGrid = exports.SkeletonAvatar = void 0;
|
7
|
+
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
12
|
+
var _mobileUtils = require("@arco-design/mobile-utils");
|
13
|
+
|
14
|
+
var _helpers = require("../_helpers");
|
15
|
+
|
16
|
+
var _contextProvider = require("../context-provider");
|
17
|
+
|
18
|
+
var _skeletonContext = require("./skeleton-context");
|
19
|
+
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
|
+
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
23
|
+
|
24
|
+
var calcOffset = function calcOffset(dom, useRtl) {
|
25
|
+
if (!dom) {
|
26
|
+
return 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
if (useRtl) {
|
30
|
+
return dom.offsetLeft - dom.offsetTop;
|
31
|
+
}
|
32
|
+
|
33
|
+
return dom.offsetLeft + dom.offsetTop;
|
34
|
+
};
|
35
|
+
|
36
|
+
function useOffset(dom, useRtl) {
|
37
|
+
var _useState = (0, _react.useState)(),
|
38
|
+
offset = _useState[0],
|
39
|
+
setOffset = _useState[1];
|
40
|
+
|
41
|
+
var calcLayout = function calcLayout() {
|
42
|
+
var isList = Array.isArray(dom);
|
43
|
+
|
44
|
+
if (!(isList ? dom.length > 0 : dom == null ? void 0 : dom.current)) {
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
|
48
|
+
setOffset(isList ? dom.map(function (item) {
|
49
|
+
return calcOffset(item, useRtl);
|
50
|
+
}) : calcOffset(dom.current, useRtl));
|
51
|
+
};
|
52
|
+
|
53
|
+
(0, _react.useEffect)(function () {
|
54
|
+
(0, _mobileUtils.nextTick)(function () {
|
55
|
+
calcLayout();
|
56
|
+
});
|
57
|
+
}, [dom, useRtl]);
|
58
|
+
(0, _helpers.useListenResize)(calcLayout);
|
59
|
+
return offset;
|
60
|
+
}
|
61
|
+
|
62
|
+
var SkeletonNode = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
63
|
+
var _props$className = props.className,
|
64
|
+
className = _props$className === void 0 ? '' : _props$className,
|
65
|
+
style = props.style,
|
66
|
+
children = props.children;
|
67
|
+
|
68
|
+
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
69
|
+
useRtl = _useContext.useRtl,
|
70
|
+
prefixCls = _useContext.prefixCls;
|
71
|
+
|
72
|
+
var _useContext2 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
|
73
|
+
backgroundColor = _useContext2.backgroundColor,
|
74
|
+
showAnimation = _useContext2.showAnimation,
|
75
|
+
animation = _useContext2.animation;
|
76
|
+
|
77
|
+
var domRef = (0, _react.useRef)(null);
|
78
|
+
var isGradientAnimation = showAnimation && animation === 'gradient';
|
79
|
+
var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
|
80
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
81
|
+
return {
|
82
|
+
dom: domRef.current
|
83
|
+
};
|
84
|
+
});
|
85
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
86
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-node", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
|
87
|
+
style: (0, _extends2.default)({
|
88
|
+
backgroundColor: backgroundColor
|
89
|
+
}, style),
|
90
|
+
ref: domRef
|
91
|
+
}, children, isGradientAnimation && offset !== undefined && /*#__PURE__*/_react.default.createElement("div", {
|
92
|
+
className: prefixCls + "-skeleton-animation-item",
|
93
|
+
style: {
|
94
|
+
left: 0 - offset
|
95
|
+
}
|
96
|
+
}));
|
97
|
+
});
|
98
|
+
exports.SkeletonNode = SkeletonNode;
|
99
|
+
var SkeletonTitle = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
100
|
+
var _props$className2 = props.className,
|
101
|
+
className = _props$className2 === void 0 ? '' : _props$className2,
|
102
|
+
style = props.style,
|
103
|
+
_props$width = props.width,
|
104
|
+
width = _props$width === void 0 ? '40%' : _props$width;
|
105
|
+
|
106
|
+
var _useContext3 = (0, _react.useContext)(_contextProvider.GlobalContext),
|
107
|
+
useRtl = _useContext3.useRtl,
|
108
|
+
prefixCls = _useContext3.prefixCls;
|
109
|
+
|
110
|
+
var _useContext4 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
|
111
|
+
backgroundColor = _useContext4.backgroundColor,
|
112
|
+
showAnimation = _useContext4.showAnimation,
|
113
|
+
animation = _useContext4.animation;
|
114
|
+
|
115
|
+
var domRef = (0, _react.useRef)(null);
|
116
|
+
var isGradientAnimation = showAnimation && animation === 'gradient';
|
117
|
+
var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
|
118
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
119
|
+
return {
|
120
|
+
dom: domRef.current
|
121
|
+
};
|
122
|
+
});
|
123
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
124
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-title", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
|
125
|
+
style: (0, _extends2.default)({
|
126
|
+
width: width,
|
127
|
+
backgroundColor: backgroundColor
|
128
|
+
}, style),
|
129
|
+
ref: domRef
|
130
|
+
}, isGradientAnimation && offset !== undefined && /*#__PURE__*/_react.default.createElement("div", {
|
131
|
+
className: prefixCls + "-skeleton-animation-item",
|
132
|
+
style: {
|
133
|
+
left: 0 - offset
|
134
|
+
}
|
135
|
+
}));
|
136
|
+
});
|
137
|
+
exports.SkeletonTitle = SkeletonTitle;
|
138
|
+
var SkeletonParagraph = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
139
|
+
var _props$className3 = props.className,
|
140
|
+
className = _props$className3 === void 0 ? '' : _props$className3,
|
141
|
+
style = props.style,
|
142
|
+
_props$rows = props.rows,
|
143
|
+
rows = _props$rows === void 0 ? 3 : _props$rows,
|
144
|
+
_props$width2 = props.width,
|
145
|
+
width = _props$width2 === void 0 ? '60%' : _props$width2;
|
146
|
+
|
147
|
+
var _useContext5 = (0, _react.useContext)(_contextProvider.GlobalContext),
|
148
|
+
useRtl = _useContext5.useRtl,
|
149
|
+
prefixCls = _useContext5.prefixCls;
|
150
|
+
|
151
|
+
var _useContext6 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
|
152
|
+
backgroundColor = _useContext6.backgroundColor,
|
153
|
+
showAnimation = _useContext6.showAnimation,
|
154
|
+
animation = _useContext6.animation;
|
155
|
+
|
156
|
+
var domRef = (0, _react.useRef)(null);
|
157
|
+
var lineDomRefs = (0, _react.useRef)([]);
|
158
|
+
var isGradientAnimation = showAnimation && animation === 'gradient';
|
159
|
+
var offsets = useOffset(isGradientAnimation ? lineDomRefs.current : undefined, useRtl);
|
160
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
161
|
+
return {
|
162
|
+
dom: domRef.current
|
163
|
+
};
|
164
|
+
});
|
165
|
+
|
166
|
+
var getWidth = function getWidth(idx) {
|
167
|
+
if ((0, _mobileUtils.isArray)(width)) {
|
168
|
+
return width[idx];
|
169
|
+
}
|
170
|
+
|
171
|
+
if (rows - 1 === idx) {
|
172
|
+
return width;
|
173
|
+
}
|
174
|
+
|
175
|
+
return undefined;
|
176
|
+
};
|
177
|
+
|
178
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
179
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-paragraph", className),
|
180
|
+
style: style,
|
181
|
+
ref: domRef
|
182
|
+
}, Array.from(new Array(rows)).map(function (_, idx) {
|
183
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
184
|
+
key: idx,
|
185
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-paragraph-line", showAnimation && prefixCls + "-skeleton-animation-" + animation),
|
186
|
+
style: {
|
187
|
+
width: getWidth(idx),
|
188
|
+
backgroundColor: backgroundColor
|
189
|
+
},
|
190
|
+
ref: function ref(el) {
|
191
|
+
return el && (lineDomRefs.current[idx] = el);
|
192
|
+
}
|
193
|
+
}, isGradientAnimation && offsets !== undefined && /*#__PURE__*/_react.default.createElement("div", {
|
194
|
+
className: prefixCls + "-skeleton-animation-item",
|
195
|
+
style: {
|
196
|
+
left: 0 - (offsets[idx] || 0)
|
197
|
+
}
|
198
|
+
}));
|
199
|
+
}));
|
200
|
+
});
|
201
|
+
exports.SkeletonParagraph = SkeletonParagraph;
|
202
|
+
var SkeletonAvatar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
203
|
+
var _props$className4 = props.className,
|
204
|
+
className = _props$className4 === void 0 ? '' : _props$className4,
|
205
|
+
style = props.style;
|
206
|
+
|
207
|
+
var _useContext7 = (0, _react.useContext)(_contextProvider.GlobalContext),
|
208
|
+
useRtl = _useContext7.useRtl,
|
209
|
+
prefixCls = _useContext7.prefixCls;
|
210
|
+
|
211
|
+
var _useContext8 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
|
212
|
+
backgroundColor = _useContext8.backgroundColor,
|
213
|
+
showAnimation = _useContext8.showAnimation,
|
214
|
+
animation = _useContext8.animation;
|
215
|
+
|
216
|
+
var domRef = (0, _react.useRef)(null);
|
217
|
+
var isGradientAnimation = showAnimation && animation === 'gradient';
|
218
|
+
var offset = useOffset(isGradientAnimation ? domRef : undefined, useRtl);
|
219
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
220
|
+
return {
|
221
|
+
dom: domRef.current
|
222
|
+
};
|
223
|
+
});
|
224
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
225
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-avatar", showAnimation && prefixCls + "-skeleton-animation-" + animation, className),
|
226
|
+
style: (0, _extends2.default)({
|
227
|
+
backgroundColor: backgroundColor
|
228
|
+
}, style),
|
229
|
+
ref: domRef
|
230
|
+
}, isGradientAnimation && offset !== undefined && /*#__PURE__*/_react.default.createElement("div", {
|
231
|
+
className: prefixCls + "-skeleton-animation-item",
|
232
|
+
style: {
|
233
|
+
left: 0 - offset
|
234
|
+
}
|
235
|
+
}));
|
236
|
+
});
|
237
|
+
exports.SkeletonAvatar = SkeletonAvatar;
|
238
|
+
var SkeletonGrid = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
239
|
+
var _props$className5 = props.className,
|
240
|
+
className = _props$className5 === void 0 ? '' : _props$className5,
|
241
|
+
style = props.style,
|
242
|
+
_props$columns = props.columns,
|
243
|
+
columns = _props$columns === void 0 ? 4 : _props$columns;
|
244
|
+
|
245
|
+
var _useContext9 = (0, _react.useContext)(_contextProvider.GlobalContext),
|
246
|
+
useRtl = _useContext9.useRtl,
|
247
|
+
prefixCls = _useContext9.prefixCls;
|
248
|
+
|
249
|
+
var _useContext10 = (0, _react.useContext)(_skeletonContext.SkeletonContext),
|
250
|
+
backgroundColor = _useContext10.backgroundColor,
|
251
|
+
showAnimation = _useContext10.showAnimation,
|
252
|
+
animation = _useContext10.animation;
|
253
|
+
|
254
|
+
var domRef = (0, _react.useRef)(null);
|
255
|
+
var iconDomRefs = (0, _react.useRef)([]);
|
256
|
+
var textDomRefs = (0, _react.useRef)([]);
|
257
|
+
var isGradientAnimation = showAnimation && animation === 'gradient';
|
258
|
+
var iconOffsets = useOffset(isGradientAnimation ? iconDomRefs.current : undefined, useRtl);
|
259
|
+
var textOffsets = useOffset(isGradientAnimation ? textDomRefs.current : undefined, useRtl);
|
260
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
261
|
+
return {
|
262
|
+
dom: domRef.current
|
263
|
+
};
|
264
|
+
});
|
265
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
266
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-grid", className),
|
267
|
+
style: style,
|
268
|
+
ref: domRef
|
269
|
+
}, Array.from(new Array(columns)).map(function (_, idx) {
|
270
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
271
|
+
key: idx,
|
272
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-grid-item")
|
273
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
274
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-grid-icon", showAnimation && prefixCls + "-skeleton-animation-" + animation),
|
275
|
+
style: {
|
276
|
+
backgroundColor: backgroundColor
|
277
|
+
},
|
278
|
+
ref: function ref(el) {
|
279
|
+
return el && (iconDomRefs.current[idx] = el);
|
280
|
+
}
|
281
|
+
}, isGradientAnimation && iconOffsets !== undefined && /*#__PURE__*/_react.default.createElement("div", {
|
282
|
+
className: prefixCls + "-skeleton-animation-item",
|
283
|
+
style: {
|
284
|
+
left: 0 - ((iconOffsets == null ? void 0 : iconOffsets[idx]) || 0)
|
285
|
+
}
|
286
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
287
|
+
className: (0, _mobileUtils.cls)(prefixCls + "-skeleton-item", prefixCls + "-skeleton-grid-text", showAnimation && prefixCls + "-skeleton-animation-" + animation),
|
288
|
+
style: {
|
289
|
+
backgroundColor: backgroundColor
|
290
|
+
},
|
291
|
+
ref: function ref(el) {
|
292
|
+
return el && (textDomRefs.current[idx] = el);
|
293
|
+
}
|
294
|
+
}, isGradientAnimation && textOffsets !== undefined && /*#__PURE__*/_react.default.createElement("div", {
|
295
|
+
className: prefixCls + "-skeleton-animation-item",
|
296
|
+
style: {
|
297
|
+
left: 0 - ((textOffsets == null ? void 0 : textOffsets[idx]) || 0)
|
298
|
+
}
|
299
|
+
})));
|
300
|
+
}));
|
301
|
+
});
|
302
|
+
exports.SkeletonGrid = SkeletonGrid;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { SkeletonProps, SkeletonRef } from './type';
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<SkeletonRef>> & {
|
4
|
+
Node: React.ForwardRefExoticComponent<import("./type").SkeletonNodeProps & React.RefAttributes<SkeletonRef>>;
|
5
|
+
Title: React.ForwardRefExoticComponent<import("./type").SkeletonTitleProps & React.RefAttributes<SkeletonRef>>;
|
6
|
+
Paragraph: React.ForwardRefExoticComponent<import("./type").SkeletonParagraphProps & React.RefAttributes<SkeletonRef>>;
|
7
|
+
Avatar: React.ForwardRefExoticComponent<import("./type").SkeletonAvatarProps & React.RefAttributes<SkeletonRef>>;
|
8
|
+
Grid: React.ForwardRefExoticComponent<import("./type").SkeletonGridProps & React.RefAttributes<SkeletonRef>>;
|
9
|
+
};
|
10
|
+
/**
|
11
|
+
* 在内容加载过程中展示一组占位图形。
|
12
|
+
* @en Display a set of placeholder graphics during content loading
|
13
|
+
* @type 信息展示
|
14
|
+
* @type_en Data Display
|
15
|
+
* @name 骨架屏
|
16
|
+
* @name_en Skeleton
|
17
|
+
*/
|
18
|
+
export default _default;
|