@lingxiteam/ebe-utils 0.0.25 → 0.0.29
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/es/constants.js +0 -1
- package/es/index.js +57 -38
- package/es/node/move.d.ts +1 -0
- package/es/node/move.js +7 -4
- package/es/requestQueue.d.ts +9 -0
- package/es/requestQueue.js +59 -0
- package/lib/h5public/src/components/common/PreviewFile/index.tsx +3 -7
- package/lib/h5public/src/components/factory/package.json +1 -1
- package/lib/h5public/src/components/factory/src/BlockSelect/components/CheckBox/index.tsx +14 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/components/Icon/index.tsx +4 -4
- package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +13 -21
- package/lib/h5public/src/components/factory/src/Button/index.tsx +1 -0
- package/lib/h5public/src/components/factory/src/Card/index.less +11 -24
- package/lib/h5public/src/components/factory/src/Card/index.tsx +61 -22
- package/lib/h5public/src/components/factory/src/DGroup/index.less +7 -3
- package/lib/h5public/src/components/factory/src/DformFile/FormFile.tsx +17 -4
- package/lib/h5public/src/components/factory/src/DformFile/assets/closeIcon.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/default.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/fileName.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/img.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/js.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/pdf.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/ppt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/txt.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/word.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/xls.png +0 -0
- package/lib/h5public/src/components/factory/src/DformFile/assets/zip.png +0 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.less +41 -5
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +4 -2
- package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -1
- package/lib/h5public/src/components/factory/src/Image/BasicImage/index.tsx +36 -1
- package/lib/h5public/src/components/factory/src/StackColumn/loader.tsx +1 -1
- package/lib/h5public/src/components/factory/src/StaticTabs/index.tsx +1 -1
- package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +14 -3
- package/lib/h5public/src/components/factory/src/VideoPlayer/loader.ts +1 -1
- package/lib/h5public/src/components/factory/src/utils/CustomModule.tsx +3 -0
- package/lib/h5public/src/components/factory/src/utils/hooks/useFormItem.ts +3 -0
- package/lib/h5public/src/hooks/usePageForm.ts +29 -3
- package/lib/h5public/src/utils/native.ts +94 -0
- package/lib/h5public/yarn.lock +19383 -0
- package/lib/node/move.d.ts +1 -0
- package/lib/node/move.js +6 -3
- package/lib/pcpublic/src/components/common/PreviewFile/index.tsx +8 -0
- package/lib/pcpublic/src/components/common/PreviewFile/utils.ts +45 -0
- package/lib/pcpublic/src/components/pcfactory/package.json +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/CollapsePanel/index.tsx +6 -4
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/YieldMethod.ts +33 -0
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/index.tsx +18 -3
- package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
- package/lib/pcpublic/src/components/pcfactory/src/Img/index.tsx +34 -2
- package/lib/pcpublic/src/components/pcfactory/src/LoopList/index.tsx +9 -4
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +8 -1
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/index.tsx +39 -13
- package/lib/pcpublic/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +22 -14
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +12 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +54 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +516 -485
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +40 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +3 -34
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +30 -3
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +37 -13
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +15 -4
- package/lib/pcpublic/src/components/pcfactory/src/Tabs/index.tsx +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tag/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +13 -2
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/FormGroup.less +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Icon.less +4 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/StdUpload.less +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +15 -0
- package/lib/pcpublic/src/hooks/usePageForm.ts +4 -3
- package/lib/pcpublic/src/utils/exportCustomData/index.tsx +723 -0
- package/lib/pcpublic/src/utils/exportCustomData/tool.ts +399 -0
- package/lib/pcpublic/src/utils/messageApi.ts +25 -20
- package/lib/pcpublic/yarn.lock +11441 -0
- package/lib/public/src/components/ProgressComp/index.tsx +4 -14
- package/lib/public/src/hooks/useBaseDataSource.ts +2 -1
- package/lib/public/src/hooks/useExportCustomDataFile.ts +4 -0
- package/lib/public/src/services/api/engine.ts +19 -0
- package/lib/public/src/services/api/index.ts +12 -0
- package/lib/public/src/utils/Context/context.tsx +1 -0
- package/lib/public/src/utils/cmd.ts +455 -0
- package/lib/public/src/utils/historytool.ts +3 -0
- package/lib/public/src/utils/lcdpBaseApi.ts +2 -2
- package/lib/public/src/utils/platform/utils/fileUtils.ts +12 -11
- package/lib/public/src/utils/polyfills.ts +4 -0
- package/lib/public/src/utils/popoverUtils.ts +56 -0
- package/lib/public/src/utils/service/baseRequest.ts +8 -8
- package/lib/public/src/utils/service/urlHelper.ts +2 -0
- package/lib/public/src/utils/useComponentHoc.ts +6 -3
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
2
2
|
import { Card as AntCard } from 'antd-mobile-5';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import Icon from '../Icon';
|
|
6
6
|
import useStyle from '../View/useStyle';
|
|
7
7
|
import './index.less';
|
|
@@ -10,7 +10,7 @@ const prefixCls = 'lcdp-h5-card';
|
|
|
10
10
|
export interface MyCardProps {
|
|
11
11
|
// full?: CardProps['full'];
|
|
12
12
|
style?: any;
|
|
13
|
-
cardType?:
|
|
13
|
+
cardType?: '1' | '2';
|
|
14
14
|
title?: React.ReactNode;
|
|
15
15
|
showHeader?: boolean;
|
|
16
16
|
headerBackground?: string;
|
|
@@ -71,17 +71,62 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
73
|
const { getAppFileUrlByFileCode } = getEngineApis();
|
|
74
|
-
const finialStyle = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
74
|
+
// const finialStyle = {
|
|
75
|
+
// ...style,
|
|
76
|
+
// padding: style?.padding || '12px',
|
|
77
|
+
// };
|
|
78
78
|
|
|
79
79
|
const [imgSrc, setImgSrc] = useState<string>();
|
|
80
|
+
const viewRef = useRef<HTMLDivElement>();
|
|
81
|
+
const restStyle = useStyle(
|
|
82
|
+
{
|
|
83
|
+
...props,
|
|
84
|
+
src: imgSrc,
|
|
85
|
+
},
|
|
86
|
+
viewRef,
|
|
87
|
+
);
|
|
88
|
+
const { bodyStyle, boxStyle, footerStyle } = useMemo(() => {
|
|
89
|
+
const box = {
|
|
90
|
+
...restStyle,
|
|
91
|
+
};
|
|
92
|
+
delete box.margin;
|
|
93
|
+
const footer = {
|
|
94
|
+
...box,
|
|
95
|
+
};
|
|
96
|
+
const body = {
|
|
97
|
+
...box,
|
|
98
|
+
};
|
|
99
|
+
if (props?.cardType === '2') {
|
|
100
|
+
// 简洁模式,保留box的padding和footer的上padding,其他去掉
|
|
101
|
+
delete body.padding;
|
|
102
|
+
const [top] = box.padding.split(' ');
|
|
103
|
+
footer.padding = `${top} 0 0 0`;
|
|
104
|
+
} else {
|
|
105
|
+
// 默认模式,去掉box的padding,其他保留
|
|
106
|
+
delete box.padding;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
boxStyle: box,
|
|
110
|
+
bodyStyle: body,
|
|
111
|
+
footerStyle: footer,
|
|
112
|
+
};
|
|
113
|
+
}, [restStyle, props?.cardType]);
|
|
80
114
|
const renderChildren = () => {
|
|
81
115
|
return React.Children.toArray(children).map((child: any) => {
|
|
82
116
|
if ($$ISNEW) {
|
|
83
|
-
|
|
84
|
-
|
|
117
|
+
let fStyle = { ...(child?.props?.style || {}) };
|
|
118
|
+
if (child?.props?.schema?.compName === 'CardBody') {
|
|
119
|
+
fStyle = {
|
|
120
|
+
...fStyle,
|
|
121
|
+
...bodyStyle,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (child?.props?.schema?.compName === 'CardFooter') {
|
|
125
|
+
fStyle = {
|
|
126
|
+
...fStyle,
|
|
127
|
+
...footerStyle,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
85
130
|
return React.cloneElement(child, {
|
|
86
131
|
extendProps: {
|
|
87
132
|
onBodyClick,
|
|
@@ -158,14 +203,16 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
158
203
|
}
|
|
159
204
|
};
|
|
160
205
|
const headerStyle = () => {
|
|
161
|
-
const { titleLineHeight
|
|
206
|
+
const { titleLineHeight } = style;
|
|
162
207
|
const defaultStyle = {
|
|
163
208
|
...style,
|
|
164
209
|
background: headerBackground,
|
|
165
|
-
|
|
166
|
-
padding:
|
|
210
|
+
// 卡片头部不受padding控制,风格固定
|
|
211
|
+
// padding: '12px', // 兼容旧数据
|
|
212
|
+
lineHeight: titleLineHeight,
|
|
167
213
|
};
|
|
168
214
|
delete defaultStyle.margin;
|
|
215
|
+
delete defaultStyle.padding;
|
|
169
216
|
if (props?.cardType === '2') {
|
|
170
217
|
return { ...defaultStyle, border: 'none' };
|
|
171
218
|
}
|
|
@@ -180,7 +227,7 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
180
227
|
className={`${prefixCls}-title`}
|
|
181
228
|
style={{
|
|
182
229
|
color: titleColor,
|
|
183
|
-
fontSize: titleFontSize,
|
|
230
|
+
fontSize: +titleFontSize,
|
|
184
231
|
fontWeight: titleFontWeight,
|
|
185
232
|
}}
|
|
186
233
|
>
|
|
@@ -219,15 +266,7 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
219
266
|
})();
|
|
220
267
|
}
|
|
221
268
|
}, [backgroundType, src, fileCode]);
|
|
222
|
-
|
|
223
|
-
const restStyle = useStyle(
|
|
224
|
-
{
|
|
225
|
-
...props,
|
|
226
|
-
src: imgSrc,
|
|
227
|
-
},
|
|
228
|
-
viewRef,
|
|
229
|
-
);
|
|
230
|
-
delete restStyle.margin;
|
|
269
|
+
|
|
231
270
|
return (
|
|
232
271
|
<AntCard
|
|
233
272
|
className={classNames(
|
|
@@ -242,7 +281,7 @@ const Card = LingxiForwardRef<any, MyCardProps>((props, ref) => {
|
|
|
242
281
|
headerStyle={$$ISNEW && showHeader ? headerStyle() : { display: 'none' }}
|
|
243
282
|
style={{ ...style, overflow: 'hidden', padding: 0 }}
|
|
244
283
|
extra={showHeader ? extra() : null}
|
|
245
|
-
bodyStyle={$$ISNEW ? { padding: '0', ...
|
|
284
|
+
bodyStyle={$$ISNEW ? { padding: '0', ...boxStyle } : {}}
|
|
246
285
|
onClick={(e) => {
|
|
247
286
|
if (onClick) {
|
|
248
287
|
onClick(e);
|
|
@@ -63,7 +63,6 @@ export interface FormFileProps extends UseFormItemProps {
|
|
|
63
63
|
downloadBtn?: any;
|
|
64
64
|
deleteBtn?: any;
|
|
65
65
|
listStyle?: string; // 列表样式
|
|
66
|
-
status?: string; // 状态 4为只读
|
|
67
66
|
fileProps?: any; // 零代码里面可能有自定义上传信息
|
|
68
67
|
uploadAccepType?: any;
|
|
69
68
|
columns?: any;
|
|
@@ -141,17 +140,31 @@ const FormFile = LingxiForwardRef<any, FormFileProps>((props, ref) => {
|
|
|
141
140
|
} = columns || {};
|
|
142
141
|
const {
|
|
143
142
|
disabled,
|
|
144
|
-
val,
|
|
143
|
+
val: defaultVal,
|
|
145
144
|
onInputChange,
|
|
146
145
|
getRules,
|
|
147
146
|
required,
|
|
148
147
|
readOnly,
|
|
149
148
|
visible,
|
|
149
|
+
isForm,
|
|
150
|
+
form,
|
|
150
151
|
} = useFormItem(ref, props);
|
|
151
152
|
const galleryRef = useRef<any>();
|
|
152
153
|
const uploadResultRef = React.useRef<any>();
|
|
153
154
|
const [imgSrc, setImgSrc] = useState('');
|
|
154
155
|
const [imageVisible, setImageVisibleVisible] = useState(false);
|
|
156
|
+
const { fieldProps } = restProps;
|
|
157
|
+
const { val } = useMemo(
|
|
158
|
+
() => ({
|
|
159
|
+
get val() {
|
|
160
|
+
if (isForm && fieldProps) {
|
|
161
|
+
return form?.getFieldValue(fieldProps);
|
|
162
|
+
}
|
|
163
|
+
return defaultVal;
|
|
164
|
+
},
|
|
165
|
+
}),
|
|
166
|
+
[defaultVal, isForm, fieldProps, form],
|
|
167
|
+
);
|
|
155
168
|
|
|
156
169
|
useEffect(() => {
|
|
157
170
|
if (!uploadResultRef.current) {
|
|
@@ -531,7 +544,7 @@ const FormFile = LingxiForwardRef<any, FormFileProps>((props, ref) => {
|
|
|
531
544
|
}
|
|
532
545
|
};
|
|
533
546
|
const previewFile = (data: any, index: number) => {
|
|
534
|
-
if (
|
|
547
|
+
if (!disabled) {
|
|
535
548
|
if (onFilespreviewClick) {
|
|
536
549
|
// 有配置预览事件,则执行默认,否则默认
|
|
537
550
|
onFilespreviewClick(data, index);
|
|
@@ -565,7 +578,7 @@ const FormFile = LingxiForwardRef<any, FormFileProps>((props, ref) => {
|
|
|
565
578
|
});
|
|
566
579
|
}
|
|
567
580
|
if (props?.deleteBtn && !disabled) {
|
|
568
|
-
if (
|
|
581
|
+
if (!readOnly) {
|
|
569
582
|
// 删除
|
|
570
583
|
btnList.push({
|
|
571
584
|
...props.deleteBtn,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class YieldMethod {
|
|
2
|
+
private cacheMap: {
|
|
3
|
+
methodName: string;
|
|
4
|
+
func: (...args: any[]) => any;
|
|
5
|
+
params?: any[];
|
|
6
|
+
}[] = [];
|
|
7
|
+
|
|
8
|
+
appendTo(methodName: string, func: (...args: any[]) => any, params?: any[]) {
|
|
9
|
+
this.cacheMap.push({
|
|
10
|
+
methodName,
|
|
11
|
+
func,
|
|
12
|
+
params,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
run(method?: string) {
|
|
17
|
+
let result = null;
|
|
18
|
+
|
|
19
|
+
this.cacheMap = this.cacheMap.filter(
|
|
20
|
+
({ func, params = [], methodName }) => {
|
|
21
|
+
if (!method || methodName === method) {
|
|
22
|
+
result = func?.(...params);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default YieldMethod;
|
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
@import '~@lingxiteam/antd-mobile-v2-theme/es/index.less';
|
|
2
2
|
|
|
3
3
|
.ued-dynamic-data-card {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
.lingxiteam-dform-group {
|
|
5
|
+
.lingxiteam-dform-card-extends-icon {
|
|
6
|
+
svg {
|
|
7
|
+
font-size: 12 * @hd;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
.lingxiteam-dform-card-title-box {
|
|
11
|
+
padding-bottom: 0;
|
|
12
|
+
}
|
|
13
|
+
.lingxiteam-dform-card-extends-body-exit-done {
|
|
14
|
+
padding-top: 12 * @hd;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lcdp-dgroup-icon {
|
|
19
|
+
color: @brand-primary;
|
|
20
|
+
}
|
|
21
|
+
.lingxiteam-dform-content {
|
|
22
|
+
padding-left: 12 * @hd;
|
|
23
|
+
.lingxiteam-dform-item {
|
|
24
|
+
padding-top: 3 * @hd;
|
|
25
|
+
padding-bottom: 3 * @hd;
|
|
26
|
+
min-height: 0;
|
|
27
|
+
}
|
|
28
|
+
.lcdp-dformwrapper-right-content {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
.cust-icon {
|
|
32
|
+
font-size: 12 * @hd;
|
|
33
|
+
width: 12 * @hd;
|
|
34
|
+
height: 12 * @hd;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
.lingxiteam-dform-item {
|
|
39
|
+
padding-right: 12 * @hd;
|
|
40
|
+
}
|
|
41
|
+
.lingxiteam-dform-bottom-line {
|
|
42
|
+
left: 12 * @hd;
|
|
43
|
+
right: 12 * @hd;
|
|
9
44
|
}
|
|
10
45
|
}
|
|
46
|
+
|
|
@@ -77,7 +77,13 @@ const DynamicDataContainer = LingxiForwardRef<any, DynamicDataContainerProps>(
|
|
|
77
77
|
>
|
|
78
78
|
>({});
|
|
79
79
|
|
|
80
|
-
const {
|
|
80
|
+
const {
|
|
81
|
+
dynamicPageRef,
|
|
82
|
+
staticAttrKeys,
|
|
83
|
+
yieldMethod,
|
|
84
|
+
readyComplete,
|
|
85
|
+
engineliftCycle,
|
|
86
|
+
} = useDynamicDataContainer({
|
|
81
87
|
dynamicHelper: dynamicHelperRef.current,
|
|
82
88
|
});
|
|
83
89
|
|
|
@@ -282,7 +288,12 @@ const DynamicDataContainer = LingxiForwardRef<any, DynamicDataContainerProps>(
|
|
|
282
288
|
},
|
|
283
289
|
resetFields,
|
|
284
290
|
setFieldsValue: (assignData: Record<string, unknown>) => {
|
|
285
|
-
|
|
291
|
+
if (readyComplete) {
|
|
292
|
+
return setFieldsValue(assignData, true);
|
|
293
|
+
}
|
|
294
|
+
return yieldMethod.appendTo('setFieldsValue', setFieldsValue, [
|
|
295
|
+
assignData,
|
|
296
|
+
]);
|
|
286
297
|
},
|
|
287
298
|
}));
|
|
288
299
|
|
|
@@ -297,7 +308,11 @@ const DynamicDataContainer = LingxiForwardRef<any, DynamicDataContainerProps>(
|
|
|
297
308
|
renderDynamicPage(
|
|
298
309
|
pageData,
|
|
299
310
|
{ uid: $$componentItem.uid },
|
|
300
|
-
{
|
|
311
|
+
{
|
|
312
|
+
ref: dynamicPageRef,
|
|
313
|
+
staticAttrKeys,
|
|
314
|
+
engineliftCycle,
|
|
315
|
+
},
|
|
301
316
|
)}
|
|
302
317
|
</DynamicDataProvider>
|
|
303
318
|
{loading && <SpinLoading />}
|
package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
1
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import YieldMethod from './YieldMethod';
|
|
2
3
|
|
|
3
4
|
export const useDynamicDataContainer = ({
|
|
4
5
|
dynamicHelper,
|
|
@@ -6,6 +7,8 @@ export const useDynamicDataContainer = ({
|
|
|
6
7
|
dynamicHelper?: any;
|
|
7
8
|
}) => {
|
|
8
9
|
const dynamicPageRef = useRef<any>(null);
|
|
10
|
+
const [readyComplete, setReadyComplete] = useState(false);
|
|
11
|
+
const yieldMethod = useMemo(() => new YieldMethod(), []);
|
|
9
12
|
|
|
10
13
|
useEffect(() => {
|
|
11
14
|
dynamicHelper?.updateSandboxContext(
|
|
@@ -20,8 +23,18 @@ export const useDynamicDataContainer = ({
|
|
|
20
23
|
return [];
|
|
21
24
|
}, [dynamicHelper]);
|
|
22
25
|
|
|
26
|
+
const engineliftCycle = {
|
|
27
|
+
engineDidRender: () => {
|
|
28
|
+
setReadyComplete(true);
|
|
29
|
+
yieldMethod.run();
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
23
33
|
return {
|
|
24
34
|
dynamicPageRef,
|
|
25
35
|
staticAttrKeys,
|
|
36
|
+
yieldMethod,
|
|
37
|
+
readyComplete,
|
|
38
|
+
engineliftCycle,
|
|
26
39
|
};
|
|
27
40
|
};
|
|
@@ -55,6 +55,7 @@ interface DataRefProps {
|
|
|
55
55
|
refreshing: boolean;
|
|
56
56
|
total: number;
|
|
57
57
|
currentPage: number;
|
|
58
|
+
// pageLoad: boolean;
|
|
58
59
|
resolve?: any;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -94,13 +95,14 @@ const DynamicList = LingxiForwardRef<any, MyDynamicListProps>((props, ref) => {
|
|
|
94
95
|
const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
|
|
95
96
|
const [pageReady, setPageReady] = useState(false);
|
|
96
97
|
const [hasMore, setHasMore] = useState(true);
|
|
97
|
-
const [listData, setListData] = useState<any[]>([]);
|
|
98
98
|
const [pageLoad, setPageLoad] = useState(false);
|
|
99
|
+
const [listData, setListData] = useState<any[]>([]);
|
|
99
100
|
const listRef = useRef<any>({});
|
|
100
101
|
const dynamicDataRef = useRef<DataRefProps>({
|
|
101
102
|
total: total || 0,
|
|
102
103
|
refreshing: false,
|
|
103
104
|
currentPage: pageNum,
|
|
105
|
+
// pageLoad: false,
|
|
104
106
|
});
|
|
105
107
|
const [isFullOfView, setIsFullOfView] = useState(false);
|
|
106
108
|
const [showFooter, setShowFooter] = useState(false);
|
|
@@ -334,8 +336,8 @@ const DynamicList = LingxiForwardRef<any, MyDynamicListProps>((props, ref) => {
|
|
|
334
336
|
|
|
335
337
|
useEffect(() => {
|
|
336
338
|
// FIXME: 可能在旧数据存在异常情况,可重点排查这里
|
|
339
|
+
// if (dataSource && !dynamicDataRef.current.pageLoad) {
|
|
337
340
|
if (dataSource && !pageLoad) {
|
|
338
|
-
// if (dataSource) {
|
|
339
341
|
setPageReady(true);
|
|
340
342
|
dynamicDataRef.current.total = Number(total);
|
|
341
343
|
// dynamicDataRef.current.pageLoad = true;
|
|
@@ -420,7 +420,9 @@ const DynamicTable = LingxiForwardRef<any, MyDynamicTableProps>(
|
|
|
420
420
|
|
|
421
421
|
useEffect(() => {
|
|
422
422
|
tableDataRef.current.allData = dataSource;
|
|
423
|
-
|
|
423
|
+
setTimeout(() => {
|
|
424
|
+
resetCurrentPageData();
|
|
425
|
+
}, 0);
|
|
424
426
|
}, [dataSource]);
|
|
425
427
|
|
|
426
428
|
useEffect(() => {
|
|
@@ -29,15 +29,50 @@ const MyImage = AppForwardRef<ImageProps>((props, ref) => {
|
|
|
29
29
|
const [complete, setComplete] = useState(false);
|
|
30
30
|
const finStyle = useHiddenStyle(visible, style);
|
|
31
31
|
|
|
32
|
+
const setImgsrcWithSign = (src: string) => {
|
|
33
|
+
if (
|
|
34
|
+
src &&
|
|
35
|
+
(src.match('downloadFileByFileCode') || src.match('file/download')) &&
|
|
36
|
+
engineApis?.service?.buildXSignUrl
|
|
37
|
+
) {
|
|
38
|
+
// 如果是平台服务,统一添加或更新签名
|
|
39
|
+
if (src.match('X-SIGN=')) {
|
|
40
|
+
// 如果资源地址使用签名模式,需更新地址签名
|
|
41
|
+
setSrc(
|
|
42
|
+
engineApis.service.buildXSignUrl({
|
|
43
|
+
url: src.slice(0, src.indexOf('&X-SIGN')),
|
|
44
|
+
version: (window as any).lxSecurityModeInFile || '1.0',
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
} else {
|
|
48
|
+
// 添加签名
|
|
49
|
+
setSrc(
|
|
50
|
+
engineApis.service.buildXSignUrl({
|
|
51
|
+
url: src,
|
|
52
|
+
version: (window as any).lxSecurityModeInFile || '1.0',
|
|
53
|
+
}),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
setSrc(src);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
32
61
|
useEffect(() => {
|
|
33
62
|
if (props.src) {
|
|
34
63
|
setSrc(props.src);
|
|
64
|
+
if (/^\d+$/.test(props.src)) {
|
|
65
|
+
// 如果src为纯数字,则认为是文件id, 转换成平台文件地址
|
|
66
|
+
setSrc(engineApis.getAppFileUrlById(src));
|
|
67
|
+
} else {
|
|
68
|
+
setImgsrcWithSign(props.src);
|
|
69
|
+
}
|
|
35
70
|
}
|
|
36
71
|
}, [props.src]);
|
|
37
72
|
|
|
38
73
|
useImperativeHandle(ref, () => ({
|
|
39
74
|
setSrc(v: string) {
|
|
40
|
-
|
|
75
|
+
setImgsrcWithSign(v);
|
|
41
76
|
},
|
|
42
77
|
setCompFileId: (fileId: string) => {
|
|
43
78
|
setSrc(engineApis.getAppFileUrlById(fileId));
|
|
@@ -5,7 +5,7 @@ const StackColumnLoader = Loadable({
|
|
|
5
5
|
// eslint-disable-next-line func-call-spacing
|
|
6
6
|
loader: async () =>
|
|
7
7
|
(await import(
|
|
8
|
-
/* webpackChunkName: factory-StackColumn */ './StackColumn'
|
|
8
|
+
/* webpackChunkName: 'factory-StackColumn' */ './StackColumn'
|
|
9
9
|
)) as unknown as React.ComponentType<any>,
|
|
10
10
|
loading: LoadingComponennt,
|
|
11
11
|
});
|
|
@@ -196,7 +196,7 @@ const StaticTabs = LingxiForwardRef<any, StaticTabsProps>((props, ref) => {
|
|
|
196
196
|
if (newChildren?.[index]) {
|
|
197
197
|
temTabchildren.push(newChildren[index]);
|
|
198
198
|
} else if (newChildren.length > 0) {
|
|
199
|
-
temTabchildren.push(newChildren[0]);
|
|
199
|
+
temTabchildren.push(newChildren[0] || <></>);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import DynamicForm from '@lingxiteam/dform';
|
|
2
2
|
import Field from '@lingxiteam/dform/es/components/Field';
|
|
3
3
|
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
import {
|
|
5
6
|
useContext,
|
|
6
7
|
useEffect,
|
|
@@ -57,6 +58,7 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>(
|
|
|
57
58
|
formItemInstance,
|
|
58
59
|
onBlur,
|
|
59
60
|
required,
|
|
61
|
+
className,
|
|
60
62
|
} = props;
|
|
61
63
|
const { onInputChange, val } = formItemInstance;
|
|
62
64
|
const { getValidateCodePicture, getLocale } = getEngineApis?.() || {};
|
|
@@ -298,7 +300,10 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>(
|
|
|
298
300
|
};
|
|
299
301
|
|
|
300
302
|
return (
|
|
301
|
-
<div
|
|
303
|
+
<div
|
|
304
|
+
className={classNames(prefixCls, className)}
|
|
305
|
+
style={visible ? {} : { display: 'none' }}
|
|
306
|
+
>
|
|
302
307
|
{renderView()}
|
|
303
308
|
</div>
|
|
304
309
|
);
|
|
@@ -307,9 +312,15 @@ const VerificationCode = LingxiForwardRef<any, MyVerificationCodeProps>(
|
|
|
307
312
|
|
|
308
313
|
export default LingxiForwardRef<unknown, MyVerificationCodeProps>(
|
|
309
314
|
(props, ref) => {
|
|
310
|
-
const extraRef = useRef({});
|
|
315
|
+
const extraRef = useRef<any>({});
|
|
311
316
|
const { visible } = props;
|
|
312
|
-
const formItemInstance = useFormItem(ref, props,
|
|
317
|
+
const formItemInstance = useFormItem(ref, props, {
|
|
318
|
+
refreshPictureVeriryCode: () =>
|
|
319
|
+
extraRef.current.refreshPictureVeriryCode?.(),
|
|
320
|
+
startCountdown: () => extraRef.current.startCountdown?.(),
|
|
321
|
+
resetCountdown: () => extraRef.current.resetCountdown?.(),
|
|
322
|
+
setImageURL: (src: string) => extraRef.current.setImageURL?.(src),
|
|
323
|
+
});
|
|
313
324
|
|
|
314
325
|
if (!formItemInstance.isForm) {
|
|
315
326
|
return (
|
|
@@ -9,7 +9,7 @@ const ViewPlayerLoader = Loadable<
|
|
|
9
9
|
// eslint-disable-next-line func-call-spacing
|
|
10
10
|
loader: async () =>
|
|
11
11
|
(await import(
|
|
12
|
-
/* webpackChunkName: factory-ViewPlayer */ './ViewPlayer'
|
|
12
|
+
/* webpackChunkName: 'factory-ViewPlayer' */ './ViewPlayer'
|
|
13
13
|
)) as unknown as React.ComponentType<any>,
|
|
14
14
|
loading: LoadingComponennt,
|
|
15
15
|
});
|
|
@@ -114,6 +114,9 @@ export const useFormItem = (
|
|
|
114
114
|
} else if (isForm && fieldProps) {
|
|
115
115
|
const fieldVlaue = form?.getFieldValue(fieldProps);
|
|
116
116
|
if (!isEqual(fieldVlaue, defaultValue)) {
|
|
117
|
+
if (onlySyncValue) {
|
|
118
|
+
onlySyncValue(defaultValue);
|
|
119
|
+
}
|
|
117
120
|
form?.setFieldsValue({ [fieldProps]: defaultValue });
|
|
118
121
|
}
|
|
119
122
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { useContext } from 'react';
|
|
12
12
|
|
|
13
13
|
const usePageForm = (refs: Record<string, any>) => {
|
|
14
|
-
const { refs: renderRefs } = useContext(Context);
|
|
14
|
+
const { refs: renderRefs, forceUpdate } = useContext(Context);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* 重置表单值
|
|
@@ -94,11 +94,12 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
forms.forEach((form) => {
|
|
97
|
-
form?.setFieldsValue(formValues);
|
|
97
|
+
form?.setFieldsValue(formValues, refs);
|
|
98
98
|
});
|
|
99
99
|
} else {
|
|
100
|
-
refs[compId]?.setFieldsValue?.(formValues);
|
|
100
|
+
refs[compId]?.setFieldsValue?.(formValues, refs);
|
|
101
101
|
}
|
|
102
|
+
forceUpdate({});
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
/**
|
|
@@ -117,6 +118,30 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
117
118
|
const getAllFormValues = () =>
|
|
118
119
|
validateFields({ refs, renderRefs }, getFieldsValueByCode);
|
|
119
120
|
|
|
121
|
+
/**
|
|
122
|
+
* 设置表单是否可编辑
|
|
123
|
+
* @param compId 组件id
|
|
124
|
+
* @param editor 是否可编辑
|
|
125
|
+
*/
|
|
126
|
+
const setFormDisabled = async (compId: string, editor: boolean) => {
|
|
127
|
+
if (!refs[compId]) return;
|
|
128
|
+
const compName = refs[compId].compName;
|
|
129
|
+
|
|
130
|
+
if (compName === 'BOFramer') {
|
|
131
|
+
const forms = getFormsByBoframerId({
|
|
132
|
+
refs,
|
|
133
|
+
renderRefs,
|
|
134
|
+
compId,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
forms.forEach((form) => {
|
|
138
|
+
form?.setDisabled(editor);
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
refs[compId]?.setDisabled?.(editor);
|
|
142
|
+
}
|
|
143
|
+
forceUpdate({});
|
|
144
|
+
};
|
|
120
145
|
return {
|
|
121
146
|
getFormValue,
|
|
122
147
|
validateForm,
|
|
@@ -124,6 +149,7 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
124
149
|
getAllFormValues,
|
|
125
150
|
resetForm,
|
|
126
151
|
setFormValues,
|
|
152
|
+
setFormDisabled,
|
|
127
153
|
};
|
|
128
154
|
};
|
|
129
155
|
|