@lingxiteam/ebe-utils 0.5.2 → 0.5.4
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/lib/h5public/src/components/factory/src/PictureVerifyCode/index.tsx +15 -19
- package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +35 -26
- package/lib/pcpublic/src/components/pcfactory/src/PictureVerifyCode/index.tsx +23 -19
- package/lib/pcpublic/src/components/pcfactory/src/VerificationCode/index.tsx +46 -28
- package/lib/pcpublic/src/components/pcfactory/src/View/index.tsx +56 -29
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import React, { useImperativeHandle, useState, useEffect, useMemo } from 'react';
|
|
1
2
|
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
2
|
-
import React, { useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
3
3
|
import IconPlaceholder from './assets/placeholder.png';
|
|
4
4
|
|
|
5
5
|
export interface PictureVerifyCodeProps {
|
|
@@ -10,15 +10,14 @@ export interface PictureVerifyCodeProps {
|
|
|
10
10
|
}
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
const PictureVerifyCode: React.FC<PictureVerifyCodeProps> = LingxiForwardRef<any, PictureVerifyCodeProps>((props, ref) => {
|
|
13
|
-
const {
|
|
13
|
+
const { onClick, style, visible, getEngineApis, ...restProps } = props;
|
|
14
14
|
const { getValidateCodePicture } = getEngineApis();
|
|
15
15
|
const [imgSrc, setImgSrc] = useState(IconPlaceholder);
|
|
16
16
|
const getPicVerifyCode = () => {
|
|
17
17
|
const newTimestamp = new Date().getTime();
|
|
18
|
-
if (
|
|
18
|
+
if (newTimestamp) {
|
|
19
19
|
try {
|
|
20
20
|
const params = {
|
|
21
|
-
validateCodeCount: `${digit}`,
|
|
22
21
|
t: `${newTimestamp}`,
|
|
23
22
|
};
|
|
24
23
|
setImgSrc(getValidateCodePicture(params));
|
|
@@ -42,21 +41,18 @@ const PictureVerifyCode: React.FC<PictureVerifyCodeProps> = LingxiForwardRef<any
|
|
|
42
41
|
return null;
|
|
43
42
|
}
|
|
44
43
|
// eslint-disable-next-line jsx-a11y/alt-text
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onClick
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
44
|
+
return <img
|
|
45
|
+
{...restProps}
|
|
46
|
+
style={targetStyle}
|
|
47
|
+
src={imgSrc}
|
|
48
|
+
onClick={(e) => {
|
|
49
|
+
if (onClick) {
|
|
50
|
+
onClick(e);
|
|
51
|
+
} else { // 点击事件如果有自定义则执行自定义事件,反之默认刷新验证码
|
|
52
|
+
getPicVerifyCode();
|
|
53
|
+
}
|
|
54
|
+
}}
|
|
55
|
+
/>;
|
|
60
56
|
});
|
|
61
57
|
|
|
62
58
|
export default PictureVerifyCode;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
-
import DynamicForm from '@lingxiteam/dform';
|
|
3
1
|
import Field from '@lingxiteam/dform/es/components/Field';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import useAsyncState from '../utils/hooks/useAsyncState';
|
|
2
|
+
import DynamicForm from '@lingxiteam/dform';
|
|
3
|
+
import React, { useContext, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
4
|
import { useFormItem } from '../utils/hooks/useFormItem';
|
|
8
5
|
import IconPlaceholder from './assets/placeholder.png';
|
|
9
6
|
import './index.less';
|
|
7
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
8
|
+
import useAsyncState from '../utils/hooks/useAsyncState';
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
|
|
10
11
|
|
|
11
12
|
const { Context } = DynamicForm;
|
|
12
13
|
export interface MyVerificationCodeProps {
|
|
@@ -45,7 +46,6 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
45
46
|
style,
|
|
46
47
|
fieldProps,
|
|
47
48
|
onClick,
|
|
48
|
-
digit,
|
|
49
49
|
visible = true,
|
|
50
50
|
getEngineApis,
|
|
51
51
|
formItemInstance,
|
|
@@ -61,9 +61,7 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
61
61
|
const readingRef = useRef(false);
|
|
62
62
|
const time = useRef<any>();
|
|
63
63
|
const timer = useRef<any>();
|
|
64
|
-
const [{ imageURL }, setState] = useAsyncState({
|
|
65
|
-
imageURL: props.imageURL,
|
|
66
|
-
});
|
|
64
|
+
const [{ imageURL }, setState] = useAsyncState({ imageURL: props.imageURL });
|
|
67
65
|
const [imgSrc, setImgSrc] = useState(IconPlaceholder);
|
|
68
66
|
const countdownReading = () => {
|
|
69
67
|
timer.current = setInterval(() => {
|
|
@@ -126,20 +124,17 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
126
124
|
|
|
127
125
|
const getPicVerifyCode = () => {
|
|
128
126
|
const newTimestamp = new Date().getTime();
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
};
|
|
134
|
-
setImgSrc(getValidateCodePicture(params));
|
|
135
|
-
}
|
|
127
|
+
const params = {
|
|
128
|
+
t: `${newTimestamp}`,
|
|
129
|
+
};
|
|
130
|
+
setImgSrc(getValidateCodePicture(params));
|
|
136
131
|
};
|
|
137
132
|
useEffect(() => {
|
|
138
133
|
if (displayStyle === 'random') {
|
|
139
134
|
// 随机数的情况下自动刷新
|
|
140
135
|
getPicVerifyCode();
|
|
141
136
|
}
|
|
142
|
-
}, [displayStyle
|
|
137
|
+
}, [displayStyle]);
|
|
143
138
|
|
|
144
139
|
/**
|
|
145
140
|
* 获取验证码
|
|
@@ -152,7 +147,7 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
152
147
|
src={imgSrc}
|
|
153
148
|
alt=""
|
|
154
149
|
className="imageActive"
|
|
155
|
-
onClick={e => {
|
|
150
|
+
onClick={(e) => {
|
|
156
151
|
if (onClick) {
|
|
157
152
|
onClick(e);
|
|
158
153
|
} else {
|
|
@@ -171,15 +166,21 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
171
166
|
<div className={`${prefixCls}-titleTop`} style={otherStyle}>
|
|
172
167
|
<span className="topText">
|
|
173
168
|
{title}
|
|
174
|
-
{required &&
|
|
169
|
+
{required && (
|
|
170
|
+
<div className="redStar">*</div>
|
|
171
|
+
)}
|
|
175
172
|
</span>
|
|
176
173
|
<div className={`${prefixCls}-inputContent`}>
|
|
177
174
|
<div className="normalArea">
|
|
178
175
|
<input placeholder={placeholderText} onBlur={onBlur} value={val} onChange={onMyChange} />
|
|
179
|
-
{displayStyle === 'imageStyle' &&
|
|
176
|
+
{displayStyle === 'imageStyle' && (
|
|
177
|
+
<img className="imageActive" src={imageURL} alt="" onClick={onClick} />
|
|
178
|
+
)}
|
|
180
179
|
{displayStyle === 'countdownStyle' && (
|
|
181
180
|
<div
|
|
182
|
-
className={
|
|
181
|
+
className={
|
|
182
|
+
readingRef.current === false ? 'sendButtonActive' : 'sendButtonDisable'
|
|
183
|
+
}
|
|
183
184
|
style={readingRef.current === false ? { color } : {}}
|
|
184
185
|
onClick={onClick}
|
|
185
186
|
>
|
|
@@ -198,13 +199,19 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
198
199
|
<div className="normalArea">
|
|
199
200
|
<span className="titleText">
|
|
200
201
|
{title}
|
|
201
|
-
{required &&
|
|
202
|
+
{required && (
|
|
203
|
+
<div className="redStar">*</div>
|
|
204
|
+
)}
|
|
202
205
|
</span>
|
|
203
206
|
<input placeholder={placeholderText} onBlur={onBlur} value={val} onChange={onMyChange} />
|
|
204
|
-
{displayStyle === 'imageStyle' &&
|
|
207
|
+
{displayStyle === 'imageStyle' && (
|
|
208
|
+
<img className="imageActive" src={imageURL} alt="" onClick={onClick} />
|
|
209
|
+
)}
|
|
205
210
|
{displayStyle === 'countdownStyle' && (
|
|
206
211
|
<div
|
|
207
|
-
className={
|
|
212
|
+
className={
|
|
213
|
+
readingRef.current === false ? 'sendButtonActive' : 'sendButtonDisable'
|
|
214
|
+
}
|
|
208
215
|
style={readingRef.current === false ? { color } : {}}
|
|
209
216
|
onClick={onClick}
|
|
210
217
|
>
|
|
@@ -221,7 +228,9 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>((props,
|
|
|
221
228
|
<div className={`${prefixCls}-inputContent`} style={otherStyle}>
|
|
222
229
|
<div className="normalArea">
|
|
223
230
|
<input placeholder={placeholderText} value={val} onBlur={onBlur} onChange={onMyChange} />
|
|
224
|
-
{displayStyle === 'imageStyle' &&
|
|
231
|
+
{displayStyle === 'imageStyle' && (
|
|
232
|
+
<img className="imageActive" src={imageURL} alt="" onClick={onClick} />
|
|
233
|
+
)}
|
|
225
234
|
{displayStyle === 'countdownStyle' && (
|
|
226
235
|
<div
|
|
227
236
|
className={readingRef.current === false ? 'sendButtonActive' : 'sendButtonDisable'}
|
|
@@ -261,7 +270,7 @@ export default LingxiForwardRef<unknown, MyVerificationCodeProps>((props, ref) =
|
|
|
261
270
|
|
|
262
271
|
return (
|
|
263
272
|
<Field initialValue={props.defaultValue} name={props?.fieldProps} rules={visible ? formItemInstance.getRules() : []} validateTrigger="onBlur">
|
|
264
|
-
<VerificationCode {...props} onBlur={() => {}} ref={extraRef} formItemInstance={formItemInstance} />
|
|
273
|
+
<VerificationCode {...props} onBlur={() => { }} ref={extraRef} formItemInstance={formItemInstance} />
|
|
265
274
|
</Field>
|
|
266
275
|
);
|
|
267
276
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef,
|
|
1
|
+
import React, { useImperativeHandle, forwardRef, useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import IconPlaceholder from './assets/placeholder.png';
|
|
3
3
|
|
|
4
4
|
export interface PictureVerifyCodeProps {
|
|
@@ -9,7 +9,14 @@ export interface PictureVerifyCodeProps {
|
|
|
9
9
|
getEngineApis?: any;
|
|
10
10
|
}
|
|
11
11
|
const PictureVerifyCode: React.FC<PictureVerifyCodeProps> = forwardRef((props, ref) => {
|
|
12
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
digit,
|
|
14
|
+
onClick,
|
|
15
|
+
style,
|
|
16
|
+
visible,
|
|
17
|
+
getEngineApis,
|
|
18
|
+
...restProps
|
|
19
|
+
} = props;
|
|
13
20
|
|
|
14
21
|
const engineApis = getEngineApis?.() || {};
|
|
15
22
|
|
|
@@ -21,7 +28,7 @@ const PictureVerifyCode: React.FC<PictureVerifyCodeProps> = forwardRef((props, r
|
|
|
21
28
|
(async () => {
|
|
22
29
|
try {
|
|
23
30
|
const params = {
|
|
24
|
-
validateCodeCount: `${digit}`,
|
|
31
|
+
// validateCodeCount: `${digit}`,
|
|
25
32
|
t: `${newTimestamp}`,
|
|
26
33
|
};
|
|
27
34
|
const url = await engineApis.getValidateCodePicture(params);
|
|
@@ -46,22 +53,19 @@ const PictureVerifyCode: React.FC<PictureVerifyCodeProps> = forwardRef((props, r
|
|
|
46
53
|
if (!visible) {
|
|
47
54
|
return null;
|
|
48
55
|
}
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
onClick
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
64
|
-
);
|
|
56
|
+
return <img
|
|
57
|
+
alt=""
|
|
58
|
+
{...restProps}
|
|
59
|
+
style={targetStyle}
|
|
60
|
+
src={imgSrc}
|
|
61
|
+
onClick={(e) => {
|
|
62
|
+
if (onClick) {
|
|
63
|
+
onClick(e);
|
|
64
|
+
} else { // 点击事件如果有自定义则执行自定义事件,反之默认刷新验证码
|
|
65
|
+
getPicVerifyCode();
|
|
66
|
+
}
|
|
67
|
+
}}
|
|
68
|
+
/>;
|
|
65
69
|
});
|
|
66
70
|
|
|
67
71
|
export default PictureVerifyCode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState, forwardRef } from 'react';
|
|
1
2
|
import { Input } from 'antd';
|
|
2
|
-
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { FormFields, getFieldsProps, useCommonImperativeHandle, useForm } from '../utils';
|
|
4
|
-
import { useLocale } from '../utils/hooks/useLocale';
|
|
5
4
|
import IconPlaceholder from './assets/placeholder.png';
|
|
5
|
+
import { useLocale } from '../utils/hooks/useLocale';
|
|
6
6
|
|
|
7
7
|
export interface MyVerificationCodeProps {
|
|
8
8
|
defaultValue?: any;
|
|
@@ -58,18 +58,38 @@ const countDownTextFn = (getLocale?: any) => ({
|
|
|
58
58
|
|
|
59
59
|
const InnerView = (p: any) => {
|
|
60
60
|
const { renderView, ...restProps } = p;
|
|
61
|
-
return
|
|
61
|
+
return (
|
|
62
|
+
<div className={prefixCls}>
|
|
63
|
+
{p.renderView(restProps)}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
62
66
|
};
|
|
63
67
|
|
|
64
68
|
const VerificationCode: React.FC<MyVerificationCodeProps> = forwardRef((props, ref) => {
|
|
65
|
-
const {
|
|
69
|
+
const {
|
|
70
|
+
placeholderText,
|
|
71
|
+
displayStyle,
|
|
72
|
+
countdownTime,
|
|
73
|
+
style,
|
|
74
|
+
regexp,
|
|
75
|
+
getEngineApis,
|
|
76
|
+
onChange,
|
|
77
|
+
onClick,
|
|
78
|
+
imageURL: myImageURL,
|
|
79
|
+
} = props;
|
|
66
80
|
|
|
67
81
|
const engineApis = getEngineApis?.() || {};
|
|
68
82
|
|
|
69
83
|
const { getLocale } = useLocale(engineApis);
|
|
70
84
|
|
|
71
85
|
const countDownTextMap: any = countDownTextFn(getLocale);
|
|
72
|
-
const {
|
|
86
|
+
const {
|
|
87
|
+
color,
|
|
88
|
+
margin: customMargin,
|
|
89
|
+
display: customDisplay,
|
|
90
|
+
visibility: customVisibility,
|
|
91
|
+
...otherStyle
|
|
92
|
+
} = style;
|
|
73
93
|
|
|
74
94
|
const { inForm } = useForm();
|
|
75
95
|
|
|
@@ -90,11 +110,10 @@ const VerificationCode: React.FC<MyVerificationCodeProps> = forwardRef((props, r
|
|
|
90
110
|
|
|
91
111
|
const getPicVerifyCode = () => {
|
|
92
112
|
const newTimestamp = new Date().getTime();
|
|
93
|
-
if (
|
|
113
|
+
if (newTimestamp) {
|
|
94
114
|
(async () => {
|
|
95
115
|
try {
|
|
96
116
|
const params = {
|
|
97
|
-
validateCodeCount: `${digit}`,
|
|
98
117
|
t: `${newTimestamp}`,
|
|
99
118
|
};
|
|
100
119
|
const url = await engineApis?.getValidateCodePicture(params);
|
|
@@ -158,25 +177,23 @@ const VerificationCode: React.FC<MyVerificationCodeProps> = forwardRef((props, r
|
|
|
158
177
|
};
|
|
159
178
|
|
|
160
179
|
/**
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
180
|
+
* 获取验证码
|
|
181
|
+
* @returns
|
|
182
|
+
*/
|
|
164
183
|
const renderPicVerifyCode = () => {
|
|
165
184
|
if (displayStyle === 'random') {
|
|
166
|
-
return
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
onClick
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
/>
|
|
179
|
-
);
|
|
185
|
+
return <img
|
|
186
|
+
src={imgSrc}
|
|
187
|
+
alt=""
|
|
188
|
+
className="imageActive"
|
|
189
|
+
onClick={(e) => {
|
|
190
|
+
if (onClick) {
|
|
191
|
+
onClick(e);
|
|
192
|
+
} else {
|
|
193
|
+
getPicVerifyCode();
|
|
194
|
+
}
|
|
195
|
+
}}
|
|
196
|
+
/>;
|
|
180
197
|
}
|
|
181
198
|
return null;
|
|
182
199
|
};
|
|
@@ -186,7 +203,9 @@ const VerificationCode: React.FC<MyVerificationCodeProps> = forwardRef((props, r
|
|
|
186
203
|
<div className={`${prefixCls}-inputContent`} style={otherStyle}>
|
|
187
204
|
<div className="normalArea">
|
|
188
205
|
<Input placeholder={placeholderText} value={p.value} onBlur={p.onBlur} onChange={p.onChange} />
|
|
189
|
-
{displayStyle === 'imageStyle' &&
|
|
206
|
+
{displayStyle === 'imageStyle' && (
|
|
207
|
+
<img className="imageActive" src={imageURL} alt="" onClick={onClick} />
|
|
208
|
+
)}
|
|
190
209
|
{displayStyle === 'countdownStyle' && (
|
|
191
210
|
<div
|
|
192
211
|
className={countdownText === 'send' ? 'sendButtonActive' : 'sendButtonDisable'}
|
|
@@ -223,11 +242,10 @@ const VerificationCode: React.FC<MyVerificationCodeProps> = forwardRef((props, r
|
|
|
223
242
|
}, [resetCountdown]);
|
|
224
243
|
|
|
225
244
|
useEffect(() => {
|
|
226
|
-
if (displayStyle === 'random') {
|
|
227
|
-
// 随机数的情况下自动刷新
|
|
245
|
+
if (displayStyle === 'random') { // 随机数的情况下自动刷新
|
|
228
246
|
getPicVerifyCode();
|
|
229
247
|
}
|
|
230
|
-
}, [displayStyle
|
|
248
|
+
}, [displayStyle]);
|
|
231
249
|
|
|
232
250
|
return (
|
|
233
251
|
<FormFields
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import React, {
|
|
2
|
+
CSSProperties,
|
|
3
|
+
useEffect,
|
|
4
|
+
useImperativeHandle,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import useBackgroundStyle from './useBackgroundStyle';
|
|
3
10
|
import { useHiddenStyle, useListenProps } from '../utils';
|
|
11
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
4
12
|
import { useLocale } from '../utils/hooks/useLocale';
|
|
5
13
|
import SpinComp from '../utils/Spin';
|
|
6
|
-
import useBackgroundStyle from './useBackgroundStyle';
|
|
7
14
|
|
|
8
15
|
export interface MyViewProps {
|
|
9
16
|
style: React.CSSProperties;
|
|
@@ -17,7 +24,16 @@ export interface MyViewProps {
|
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
const View = LingxiForwardRef<any, MyViewProps>((props: any, ref) => {
|
|
20
|
-
const {
|
|
27
|
+
const {
|
|
28
|
+
children,
|
|
29
|
+
style,
|
|
30
|
+
className,
|
|
31
|
+
visible = true,
|
|
32
|
+
backgroundType,
|
|
33
|
+
getEngineApis,
|
|
34
|
+
visibility = false,
|
|
35
|
+
...restProps
|
|
36
|
+
} = props;
|
|
21
37
|
|
|
22
38
|
const [loading, setLoading] = useListenProps(props.loading);
|
|
23
39
|
|
|
@@ -46,18 +62,10 @@ const View = LingxiForwardRef<any, MyViewProps>((props: any, ref) => {
|
|
|
46
62
|
const getLoadingStyle = (isShow: boolean): CSSProperties => {
|
|
47
63
|
const res: CSSProperties = {};
|
|
48
64
|
if (containerRef.current && loadingRef.current) {
|
|
49
|
-
const containerRefProps = window.getComputedStyle(containerRef.current);
|
|
50
65
|
const { offsetWidth, offsetHeight } = containerRef.current;
|
|
51
|
-
const
|
|
52
|
-
// 获取loading基于父级的偏移量
|
|
53
|
-
const loadingOffset = loadingRef.current.getBoundingClientRect();
|
|
54
|
-
|
|
55
|
-
const offset = {
|
|
56
|
-
x: loadingOffset.left - containerOffset.left,
|
|
57
|
-
y: loadingOffset.top - containerOffset.top,
|
|
58
|
-
};
|
|
66
|
+
const containerRefProps = window.getComputedStyle(containerRef.current);
|
|
59
67
|
|
|
60
|
-
res.position = 'absolute';
|
|
68
|
+
// res.position = 'absolute';
|
|
61
69
|
res.width = `${offsetWidth}px`;
|
|
62
70
|
res.height = `${offsetHeight}px`;
|
|
63
71
|
res.zIndex = containerRefProps.zIndex;
|
|
@@ -65,11 +73,8 @@ const View = LingxiForwardRef<any, MyViewProps>((props: any, ref) => {
|
|
|
65
73
|
res.display = 'flex';
|
|
66
74
|
res.justifyContent = 'center';
|
|
67
75
|
res.alignItems = 'center';
|
|
68
|
-
res.left = 0;
|
|
69
|
-
res.top = 0;
|
|
70
|
-
if (offset.x > 0 || offset.y > 0) {
|
|
71
|
-
res.transform = `translate(${-offset.x}px, ${-offset.y}px)`;
|
|
72
|
-
}
|
|
76
|
+
// res.left = 0;
|
|
77
|
+
// res.top = 0;
|
|
73
78
|
}
|
|
74
79
|
if (!isShow) {
|
|
75
80
|
res.display = 'none';
|
|
@@ -86,7 +91,14 @@ const View = LingxiForwardRef<any, MyViewProps>((props: any, ref) => {
|
|
|
86
91
|
);
|
|
87
92
|
}
|
|
88
93
|
return null;
|
|
89
|
-
}, [
|
|
94
|
+
}, [
|
|
95
|
+
loading,
|
|
96
|
+
loadingRef.current,
|
|
97
|
+
reload,
|
|
98
|
+
lang,
|
|
99
|
+
dataState?.loading,
|
|
100
|
+
loadingText,
|
|
101
|
+
]);
|
|
90
102
|
|
|
91
103
|
useEffect(() => {
|
|
92
104
|
if (loading) {
|
|
@@ -107,12 +119,23 @@ const View = LingxiForwardRef<any, MyViewProps>((props: any, ref) => {
|
|
|
107
119
|
// return null;
|
|
108
120
|
// }
|
|
109
121
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
const combineStyle = useMemo(() => {
|
|
123
|
+
if (loading) {
|
|
124
|
+
return {
|
|
113
125
|
...backgroundStyle,
|
|
114
126
|
...finalStyle,
|
|
115
|
-
|
|
127
|
+
overflow: 'hidden',
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
...backgroundStyle,
|
|
132
|
+
...finalStyle,
|
|
133
|
+
};
|
|
134
|
+
}, [backgroundStyle, finalStyle, loading]);
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<div
|
|
138
|
+
style={combineStyle}
|
|
116
139
|
className={className}
|
|
117
140
|
data-compid={props?.['data-compid']}
|
|
118
141
|
{...restProps}
|
|
@@ -123,11 +146,15 @@ const View = LingxiForwardRef<any, MyViewProps>((props: any, ref) => {
|
|
|
123
146
|
{loading && (
|
|
124
147
|
<div
|
|
125
148
|
style={{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
position: 'absolute',
|
|
150
|
+
width: '100%',
|
|
151
|
+
height: '100%',
|
|
152
|
+
top: 0,
|
|
153
|
+
left: 0,
|
|
154
|
+
display: 'flex',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
justifyContent: 'center',
|
|
157
|
+
zIndex: 99,
|
|
131
158
|
}}
|
|
132
159
|
ref={loadingRef}
|
|
133
160
|
>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingxiteam/ebe-utils",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@babel/types": "^7.12.12",
|
|
20
20
|
"cac": "^6.7.14",
|
|
21
21
|
"fs-extra": "9.x",
|
|
22
|
-
"@lingxiteam/ebe": "0.5.
|
|
22
|
+
"@lingxiteam/ebe": "0.5.4"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|