@arcblock/ux 1.17.15 → 1.17.18
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.
|
@@ -59,39 +59,37 @@ function AnimationWaiter(_ref) {
|
|
|
59
59
|
|
|
60
60
|
const [tipsId, setTipsId] = (0, _react.useState)(0);
|
|
61
61
|
const [currentSpeed, setCurrentSpeed] = (0, _react.useState)(speed);
|
|
62
|
-
const [
|
|
62
|
+
const [messageId, setMessageId] = (0, _react.useState)(0); // 动画的开始时间
|
|
63
63
|
|
|
64
64
|
const startTime = (0, _react.useRef)(new Date().getTime());
|
|
65
|
+
|
|
66
|
+
if (!Array.isArray(message)) {
|
|
67
|
+
// eslint-disable-next-line no-param-reassign
|
|
68
|
+
message = [message];
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
(0, _react.useEffect)(() => {
|
|
66
72
|
if (!message) {
|
|
67
73
|
return;
|
|
68
74
|
}
|
|
69
75
|
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (Array.isArray(message)) {
|
|
74
|
-
setDesc(message[msgId]);
|
|
75
|
-
timer1 = setInterval(() => {
|
|
76
|
-
msgId++;
|
|
76
|
+
let msgIndex = 0;
|
|
77
|
+
const timer = setInterval(() => {
|
|
78
|
+
msgIndex++;
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
80
|
+
if (msgIndex >= message.length) {
|
|
81
|
+
if (messageLoop) {
|
|
82
|
+
msgIndex = 0;
|
|
83
|
+
} else {
|
|
84
|
+
msgIndex = message.length - 1;
|
|
84
85
|
}
|
|
86
|
+
}
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
} else {
|
|
89
|
-
setDesc(message);
|
|
90
|
-
} // eslint-disable-next-line consistent-return
|
|
91
|
-
|
|
88
|
+
setMessageId(msgIndex);
|
|
89
|
+
}, messageDuration); // eslint-disable-next-line consistent-return
|
|
92
90
|
|
|
93
91
|
return () => {
|
|
94
|
-
clearInterval(
|
|
92
|
+
clearInterval(timer);
|
|
95
93
|
};
|
|
96
94
|
}, [message, messageDuration]); // tips
|
|
97
95
|
|
|
@@ -126,6 +124,19 @@ function AnimationWaiter(_ref) {
|
|
|
126
124
|
}, 1000);
|
|
127
125
|
return () => clearTimeout(timer);
|
|
128
126
|
}, [currentSpeed]);
|
|
127
|
+
|
|
128
|
+
const getMsgClassName = index => {
|
|
129
|
+
let className = 'message-before';
|
|
130
|
+
|
|
131
|
+
if (messageId === index) {
|
|
132
|
+
className = 'show-message';
|
|
133
|
+
} else if (messageId < index) {
|
|
134
|
+
className = 'message-after';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return className;
|
|
138
|
+
};
|
|
139
|
+
|
|
129
140
|
return /*#__PURE__*/_react.default.createElement(Container, rest, /*#__PURE__*/_react.default.createElement(_reactLottiePlayer.default, {
|
|
130
141
|
loop: true,
|
|
131
142
|
animationData: animationData || _defaultAnimation.default,
|
|
@@ -137,8 +148,16 @@ function AnimationWaiter(_ref) {
|
|
|
137
148
|
}
|
|
138
149
|
}), message && /*#__PURE__*/_react.default.createElement("div", {
|
|
139
150
|
className: "waiter-message"
|
|
140
|
-
},
|
|
141
|
-
className
|
|
151
|
+
}, message.map((text, index) => {
|
|
152
|
+
const className = getMsgClassName(index);
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
154
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
155
|
+
key: index
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
157
|
+
className: "message-block ".concat(className)
|
|
158
|
+
}, text), /*#__PURE__*/_react.default.createElement("span", {
|
|
159
|
+
className: "placeholder-message ".concat(className)
|
|
160
|
+
}, text));
|
|
142
161
|
})), tips.length ? /*#__PURE__*/_react.default.createElement("div", {
|
|
143
162
|
className: "waiter-tips-container"
|
|
144
163
|
}, tips.map((e, index) => {
|
|
@@ -178,4 +197,4 @@ AnimationWaiter.defaultProps = {
|
|
|
178
197
|
const Container = _styledComponents.default.div.withConfig({
|
|
179
198
|
displayName: "AnimationWaiter__Container",
|
|
180
199
|
componentId: "sc-1qcr25l-0"
|
|
181
|
-
})(["display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%;.waiter-message{font-weight:700;font-size:18px;line-height:22px;}.waiter-tips-container{position:relative;margin-top:auto;width:100%;.waiter-tips-block{position:absolute;bottom:0;left:0;width:100%;opacity:0;pointer-events:none;z-index:1;transform:translate(-20px,0);transition:all ease 0.4s;&.show-tips{opacity:1;pointer-events:auto;z-index:2;transform:translate(0,0);}}}
|
|
200
|
+
})(["display:flex;justify-content:center;align-items:center;flex-direction:column;width:100%;height:100%;.waiter-message{position:relative;width:100%;font-weight:700;font-size:18px;line-height:22px;text-align:center;overflow:hidden;.message-block{position:absolute;left:0;width:100%;opacity:0;transition:all ease 0.3s;user-select:none;&.message-before{transform:translate(-20px,0);}&.message-after{transform:translate(20px,0);}&.show-message{transform:translate(0,0);opacity:1;user-select:text;z-index:2;}}.placeholder-message{user-select:none;display:none;opacity:0;&.show-message{display:block;}}}.waiter-tips-container{position:relative;margin-top:auto;width:100%;.waiter-tips-block{position:absolute;bottom:0;left:0;width:100%;opacity:0;pointer-events:none;z-index:1;transform:translate(-20px,0);transition:all ease 0.4s;&.show-tips{opacity:1;pointer-events:auto;z-index:2;transform:translate(0,0);}}}"]);
|
package/lib/Blocklet/blocklet.js
CHANGED
|
@@ -36,7 +36,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
36
36
|
const Div = _styledComponents.default.div.withConfig({
|
|
37
37
|
displayName: "blocklet__Div",
|
|
38
38
|
componentId: "sc-atxvkd-0"
|
|
39
|
-
})(["&.arcblock-blocklet{padding:16px 16px 0 16px;}.arcblock-blocklet__content{cursor:pointer;display:flex;", "{align-items:center;}}.arcblock-blocklet__cover{width:64px;height:64px;margin-right:16px;overflow:hidden;border-radius:12px;transform:translateZ(0);", "{width:80px;height:80px;margin-bottom:12px;}}.arcblock-blocklet__button--hover{&:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;transition:opacity 0.3s;}&:hover::before{opacity:0;}&::after{content:'';position:absolute;height:100%;width:100%;background-color:", ";transform:scale(0.1);opacity:0;z-index:-1;transition:transform 0.3s,opacity 0.3s,background-color 0.3s;}&:hover::after{opacity:1;transform-origin:center;transform:scale(1);}}&:not(.Mui-disabled){background-color:transparent !important;color:", ";}&:not(.Mui-disabled){&:hover{color:", ";}}}.arcblock-blocklet__info{flex:1;overflow:hidden;border-bottom:1px solid ", ";padding-bottom:24px;}.arcblock-blocklet__text{height:57px;overflow:hidden;}.arcblock-blocklet__title{margin:0;font-size:16px;font-weight:500;line-height:19px;overflow:hidden;text-overflow:ellipsis;
|
|
39
|
+
})(["&.arcblock-blocklet{padding:16px 16px 0 16px;}.arcblock-blocklet__content{cursor:pointer;display:flex;", "{align-items:center;}}.arcblock-blocklet__cover{width:64px;height:64px;margin-right:16px;overflow:hidden;border-radius:12px;transform:translateZ(0);", "{width:80px;height:80px;margin-bottom:12px;}}.arcblock-blocklet__button--hover{&:not(.Mui-disabled){position:relative;z-index:1;&::before{content:'';position:absolute;height:100%;width:100%;left:0;top:0;transition:opacity 0.3s;}&:hover::before{opacity:0;}&::after{content:'';position:absolute;height:100%;width:100%;background-color:", ";transform:scale(0.1);opacity:0;z-index:-1;transition:transform 0.3s,opacity 0.3s,background-color 0.3s;}&:hover::after{opacity:1;transform-origin:center;transform:scale(1);}}&:not(.Mui-disabled){background-color:transparent !important;color:", ";}&:not(.Mui-disabled){&:hover{color:", ";}}}.arcblock-blocklet__info{flex:1;overflow:hidden;border-bottom:1px solid ", ";padding-bottom:24px;}.arcblock-blocklet__text{height:57px;overflow:hidden;}.arcblock-blocklet__title{margin:0;font-size:16px;font-weight:500;line-height:19px;max-height:19px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.arcblock-blocklet__describe{margin-top:4px;color:", ";font-size:14px;font-weight:500;line-height:17px;max-height:34px;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;word-break:break-all;}.arcblock-blocklet__version{color:", ";font-size:12px;}"], props => props.theme.breakpoints.up('sm'), props => props.theme.breakpoints.up('sm'), props => props.theme.palette.primary.main, props => props.theme.palette.primary.main, props => props.theme.palette.common.white, props => props.theme.palette.divider, props => props.theme.palette.grey[600], props => props.theme.palette.grey[600]);
|
|
40
40
|
|
|
41
41
|
function BlockletStore(_ref) {
|
|
42
42
|
let {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/ux",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.18",
|
|
4
4
|
"description": "Common used react components for arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"react": ">=16.12.0",
|
|
54
54
|
"react-ga": "^2.7.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "d5c90d25f6b2e2313188645b82e997cf53ce274f",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@arcblock/icons": "^1.17.
|
|
59
|
-
"@arcblock/react-hooks": "^1.17.
|
|
58
|
+
"@arcblock/icons": "^1.17.18",
|
|
59
|
+
"@arcblock/react-hooks": "^1.17.18",
|
|
60
60
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
61
61
|
"@fontsource/lato": "^4.5.3",
|
|
62
62
|
"@material-ui/core": "^4.12.3",
|
|
@@ -34,38 +34,37 @@ export default function AnimationWaiter({
|
|
|
34
34
|
}) {
|
|
35
35
|
const [tipsId, setTipsId] = useState(0);
|
|
36
36
|
const [currentSpeed, setCurrentSpeed] = useState(speed);
|
|
37
|
-
const [
|
|
37
|
+
const [messageId, setMessageId] = useState(0);
|
|
38
38
|
// 动画的开始时间
|
|
39
39
|
const startTime = useRef(new Date().getTime());
|
|
40
40
|
|
|
41
|
+
if (!Array.isArray(message)) {
|
|
42
|
+
// eslint-disable-next-line no-param-reassign
|
|
43
|
+
message = [message];
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
useEffect(() => {
|
|
42
47
|
if (!message) {
|
|
43
48
|
return;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
msgId = 0;
|
|
56
|
-
} else {
|
|
57
|
-
msgId = message.length - 1;
|
|
58
|
-
}
|
|
51
|
+
let msgIndex = 0;
|
|
52
|
+
|
|
53
|
+
const timer = setInterval(() => {
|
|
54
|
+
msgIndex++;
|
|
55
|
+
if (msgIndex >= message.length) {
|
|
56
|
+
if (messageLoop) {
|
|
57
|
+
msgIndex = 0;
|
|
58
|
+
} else {
|
|
59
|
+
msgIndex = message.length - 1;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
setDesc(message);
|
|
64
|
-
}
|
|
61
|
+
}
|
|
62
|
+
setMessageId(msgIndex);
|
|
63
|
+
}, messageDuration);
|
|
65
64
|
|
|
66
65
|
// eslint-disable-next-line consistent-return
|
|
67
66
|
return () => {
|
|
68
|
-
clearInterval(
|
|
67
|
+
clearInterval(timer);
|
|
69
68
|
};
|
|
70
69
|
}, [message, messageDuration]);
|
|
71
70
|
|
|
@@ -106,6 +105,16 @@ export default function AnimationWaiter({
|
|
|
106
105
|
return () => clearTimeout(timer);
|
|
107
106
|
}, [currentSpeed]);
|
|
108
107
|
|
|
108
|
+
const getMsgClassName = index => {
|
|
109
|
+
let className = 'message-before';
|
|
110
|
+
if (messageId === index) {
|
|
111
|
+
className = 'show-message';
|
|
112
|
+
} else if (messageId < index) {
|
|
113
|
+
className = 'message-after';
|
|
114
|
+
}
|
|
115
|
+
return className;
|
|
116
|
+
};
|
|
117
|
+
|
|
109
118
|
return (
|
|
110
119
|
<Container {...rest}>
|
|
111
120
|
<Lottie
|
|
@@ -120,8 +129,17 @@ export default function AnimationWaiter({
|
|
|
120
129
|
/>
|
|
121
130
|
{message && (
|
|
122
131
|
<div className="waiter-message">
|
|
123
|
-
{
|
|
124
|
-
|
|
132
|
+
{message.map((text, index) => {
|
|
133
|
+
const className = getMsgClassName(index);
|
|
134
|
+
return (
|
|
135
|
+
<div
|
|
136
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
137
|
+
key={index}>
|
|
138
|
+
<span className={`message-block ${className}`}>{text}</span>
|
|
139
|
+
<span className={`placeholder-message ${className}`}>{text}</span>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
})}
|
|
125
143
|
</div>
|
|
126
144
|
)}
|
|
127
145
|
|
|
@@ -180,9 +198,42 @@ const Container = styled.div`
|
|
|
180
198
|
height: 100%;
|
|
181
199
|
|
|
182
200
|
.waiter-message {
|
|
201
|
+
position: relative;
|
|
202
|
+
width: 100%;
|
|
183
203
|
font-weight: 700;
|
|
184
204
|
font-size: 18px;
|
|
185
205
|
line-height: 22px;
|
|
206
|
+
text-align: center;
|
|
207
|
+
overflow: hidden;
|
|
208
|
+
.message-block {
|
|
209
|
+
position: absolute;
|
|
210
|
+
left: 0;
|
|
211
|
+
width: 100%;
|
|
212
|
+
opacity: 0;
|
|
213
|
+
transition: all ease 0.3s;
|
|
214
|
+
user-select: none;
|
|
215
|
+
&.message-before {
|
|
216
|
+
transform: translate(-20px, 0);
|
|
217
|
+
}
|
|
218
|
+
&.message-after {
|
|
219
|
+
transform: translate(20px, 0);
|
|
220
|
+
}
|
|
221
|
+
&.show-message {
|
|
222
|
+
transform: translate(0, 0);
|
|
223
|
+
opacity: 1;
|
|
224
|
+
user-select: text;
|
|
225
|
+
z-index: 2;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.placeholder-message {
|
|
230
|
+
user-select: none;
|
|
231
|
+
display: none;
|
|
232
|
+
opacity: 0;
|
|
233
|
+
&.show-message {
|
|
234
|
+
display: block;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
186
237
|
}
|
|
187
238
|
|
|
188
239
|
.waiter-tips-container {
|
|
@@ -207,28 +258,4 @@ const Container = styled.div`
|
|
|
207
258
|
}
|
|
208
259
|
}
|
|
209
260
|
}
|
|
210
|
-
|
|
211
|
-
.waiter-loading::after {
|
|
212
|
-
display: inline-block;
|
|
213
|
-
animation: dotty steps(1, end) 2s infinite;
|
|
214
|
-
content: '';
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
@keyframes dotty {
|
|
218
|
-
0% {
|
|
219
|
-
content: '';
|
|
220
|
-
}
|
|
221
|
-
25% {
|
|
222
|
-
content: '.';
|
|
223
|
-
}
|
|
224
|
-
50% {
|
|
225
|
-
content: '..';
|
|
226
|
-
}
|
|
227
|
-
75% {
|
|
228
|
-
content: '...';
|
|
229
|
-
}
|
|
230
|
-
100% {
|
|
231
|
-
content: '';
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
261
|
`;
|
package/src/Blocklet/blocklet.js
CHANGED
|
@@ -95,24 +95,24 @@ const Div = styled.div`
|
|
|
95
95
|
font-size: 16px;
|
|
96
96
|
font-weight: 500;
|
|
97
97
|
line-height: 19px;
|
|
98
|
+
max-height: 19px;
|
|
98
99
|
overflow: hidden;
|
|
99
100
|
text-overflow: ellipsis;
|
|
100
|
-
|
|
101
|
-
-webkit-line-clamp: 2;
|
|
102
|
-
-webkit-box-orient: vertical;
|
|
103
|
-
max-height: 38px;
|
|
104
|
-
word-break: break-all;
|
|
101
|
+
white-space: nowrap;
|
|
105
102
|
}
|
|
106
103
|
.arcblock-blocklet__describe {
|
|
107
|
-
margin-top:
|
|
104
|
+
margin-top: 4px;
|
|
108
105
|
color: ${props => props.theme.palette.grey[600]};
|
|
109
106
|
font-size: 14px;
|
|
110
107
|
font-weight: 500;
|
|
111
108
|
line-height: 17px;
|
|
112
|
-
max-height:
|
|
109
|
+
max-height: 34px;
|
|
113
110
|
overflow: hidden;
|
|
114
111
|
text-overflow: ellipsis;
|
|
115
|
-
|
|
112
|
+
display: -webkit-box;
|
|
113
|
+
-webkit-line-clamp: 2;
|
|
114
|
+
-webkit-box-orient: vertical;
|
|
115
|
+
word-break: break-all;
|
|
116
116
|
}
|
|
117
117
|
.arcblock-blocklet__version {
|
|
118
118
|
color: ${props => props.theme.palette.grey[600]};
|