@lingxiteam/ebe-utils 0.2.2 → 0.2.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/DynamicTable/components/TypeCells.tsx +5 -2
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +15 -1
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/closeIcon.png +0 -0
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/fileName.png +0 -0
- package/lib/pcpublic/src/components/pcfactory/src/StdUpload/assets/img.png +0 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +5 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +30 -26
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +1 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +11 -4
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +4 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Tree.less +6 -0
- package/lib/public/src/utils/cmd.ts +8 -0
- package/lib/public/src/utils/useTool.ts +172 -2
- package/package.json +3 -3
- package/lib/h5public/src/components/factory/src/Icon/IconED/index.less +0 -43
- package/lib/h5public/src/components/factory/src/Icon/IconED/index.tsx +0 -290
- package/lib/public/yarn.lock +0 -11441
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import { createFromIconfontCN } from '@ant-design/icons';
|
|
2
|
-
import { Icon as LegacyIcon } from '@lingxiteam/icons';
|
|
3
|
-
import { LingXiEdFC } from '@lingxiteam/types';
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
6
|
-
import './index.less';
|
|
7
|
-
|
|
8
|
-
export interface IconFileEDProps {
|
|
9
|
-
fileId: string;
|
|
10
|
-
fileCode: string;
|
|
11
|
-
fileSubType: 'ICON_IMAGE' | 'ICONFONT';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface MyIconEDProps {
|
|
15
|
-
type?: string;
|
|
16
|
-
isIconFont?: boolean;
|
|
17
|
-
fontAddress?: string;
|
|
18
|
-
svgContent?: string;
|
|
19
|
-
theme?: string;
|
|
20
|
-
iconFileInfo?: any;
|
|
21
|
-
iconFile?: IconFileEDProps;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface IconEDProps {
|
|
25
|
-
icon?: MyIconEDProps;
|
|
26
|
-
type?: string;
|
|
27
|
-
isIconFont?: boolean;
|
|
28
|
-
fontAddress?: string;
|
|
29
|
-
svgContent?: string;
|
|
30
|
-
theme?: string;
|
|
31
|
-
style?: any;
|
|
32
|
-
className?: any;
|
|
33
|
-
rotate?: any;
|
|
34
|
-
iconFileInfo?: any;
|
|
35
|
-
iconFile?: IconFileEDProps;
|
|
36
|
-
size?: any;
|
|
37
|
-
color?: any;
|
|
38
|
-
mode?: string;
|
|
39
|
-
iconItems?: any;
|
|
40
|
-
isUsePrimary?: boolean;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const IconED: LingXiEdFC<IconEDProps> = (props) => {
|
|
44
|
-
const {
|
|
45
|
-
icon = {},
|
|
46
|
-
type,
|
|
47
|
-
rotate,
|
|
48
|
-
size,
|
|
49
|
-
style,
|
|
50
|
-
mode,
|
|
51
|
-
iconItems,
|
|
52
|
-
isUsePrimary: curIsUsePrimary,
|
|
53
|
-
theme: curTheme,
|
|
54
|
-
isIconFont: curIsIconFont,
|
|
55
|
-
fontAddress: curFontAddress,
|
|
56
|
-
svgContent: curSvgContent,
|
|
57
|
-
iconFileInfo: curIconFileInfo,
|
|
58
|
-
iconFile: curIconFile,
|
|
59
|
-
getEdEngineApi,
|
|
60
|
-
$$componentItem,
|
|
61
|
-
...restProps
|
|
62
|
-
} = props;
|
|
63
|
-
const [scriptUrl, setScripUrl] = useState<any>();
|
|
64
|
-
|
|
65
|
-
const {
|
|
66
|
-
curType,
|
|
67
|
-
iconFile,
|
|
68
|
-
iconFileInfo,
|
|
69
|
-
fontAddress,
|
|
70
|
-
isIconFont,
|
|
71
|
-
theme,
|
|
72
|
-
svgContent,
|
|
73
|
-
isUsePrimary,
|
|
74
|
-
color,
|
|
75
|
-
} = useMemo(() => {
|
|
76
|
-
const iconInfo = Array.isArray(iconItems) && iconItems[0];
|
|
77
|
-
if (mode === 'custom' && iconInfo) {
|
|
78
|
-
return {
|
|
79
|
-
curType: iconInfo?.icon?.type,
|
|
80
|
-
theme: iconInfo?.icon?.theme,
|
|
81
|
-
isIconFont: iconInfo?.icon?.isIconFont,
|
|
82
|
-
fontAddress: iconInfo?.icon?.fontAddress,
|
|
83
|
-
svgContent: iconInfo?.icon?.svgContent,
|
|
84
|
-
iconFileInfo: iconInfo?.icon?.iconFileInfo,
|
|
85
|
-
iconFile: iconInfo?.icon?.iconFile,
|
|
86
|
-
isUsePrimary: iconInfo?.isUsePrimary,
|
|
87
|
-
color: iconInfo?.color,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
curType: icon?.type || type,
|
|
92
|
-
iconFile: icon?.iconFile || curIconFile,
|
|
93
|
-
iconFileInfo: icon?.iconFileInfo || curIconFileInfo,
|
|
94
|
-
fontAddress: icon?.fontAddress || curFontAddress,
|
|
95
|
-
isIconFont: icon?.isIconFont || curIsIconFont,
|
|
96
|
-
theme: icon?.theme || curTheme,
|
|
97
|
-
svgContent: icon?.svgContent || curSvgContent,
|
|
98
|
-
};
|
|
99
|
-
}, [
|
|
100
|
-
JSON.stringify(icon),
|
|
101
|
-
type,
|
|
102
|
-
curIconFile,
|
|
103
|
-
curIconFileInfo,
|
|
104
|
-
curFontAddress,
|
|
105
|
-
curIsIconFont,
|
|
106
|
-
curTheme,
|
|
107
|
-
curSvgContent,
|
|
108
|
-
mode,
|
|
109
|
-
iconItems,
|
|
110
|
-
]);
|
|
111
|
-
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (iconFile) {
|
|
114
|
-
const { fileId, fileCode, fileHttp } = iconFile;
|
|
115
|
-
(async () => {
|
|
116
|
-
const { getAppFileUrlById, getAppFileUrlByFileCode } =
|
|
117
|
-
getEdEngineApi?.() || {};
|
|
118
|
-
if (fileId && getAppFileUrlById) {
|
|
119
|
-
setScripUrl(getAppFileUrlById(fileId));
|
|
120
|
-
} else if (fileCode && getAppFileUrlByFileCode) {
|
|
121
|
-
setScripUrl(
|
|
122
|
-
getAppFileUrlByFileCode({
|
|
123
|
-
appId: $$componentItem?.appId || window.appId,
|
|
124
|
-
fileCode,
|
|
125
|
-
}),
|
|
126
|
-
);
|
|
127
|
-
} else if (fileHttp) {
|
|
128
|
-
setScripUrl(fileHttp);
|
|
129
|
-
}
|
|
130
|
-
})();
|
|
131
|
-
} else if (fontAddress) {
|
|
132
|
-
setScripUrl(fontAddress);
|
|
133
|
-
} else if (iconFileInfo && !iconFileInfo.svgContent) {
|
|
134
|
-
const { getMaterialFile } = getEdEngineApi?.() || {};
|
|
135
|
-
(async () => {
|
|
136
|
-
if (iconFileInfo.materialId && iconFileInfo.fileName) {
|
|
137
|
-
setScripUrl(
|
|
138
|
-
getMaterialFile({
|
|
139
|
-
materialId: iconFileInfo.materialId,
|
|
140
|
-
fileName: iconFileInfo.fileName,
|
|
141
|
-
}),
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
})();
|
|
145
|
-
} else {
|
|
146
|
-
setScripUrl('');
|
|
147
|
-
}
|
|
148
|
-
}, [iconFile, fontAddress, iconFileInfo]);
|
|
149
|
-
|
|
150
|
-
const curClassName = classnames({
|
|
151
|
-
[restProps?.className]: restProps?.className,
|
|
152
|
-
'cust-icon-ed': true,
|
|
153
|
-
'cust-icon-theme': isUsePrimary,
|
|
154
|
-
[`cust-icon-ed-${size}`]: size,
|
|
155
|
-
});
|
|
156
|
-
const curStyle = useMemo(
|
|
157
|
-
() => ({
|
|
158
|
-
width: style?.fontSize || style?.width,
|
|
159
|
-
height: style?.fontSize || style?.height,
|
|
160
|
-
fontSize: style?.fontSize || style?.width, // 兼容存量数据
|
|
161
|
-
...(style || {}),
|
|
162
|
-
color: isUsePrimary
|
|
163
|
-
? undefined
|
|
164
|
-
: color || style?.color || restProps?.color,
|
|
165
|
-
fill: isUsePrimary
|
|
166
|
-
? undefined
|
|
167
|
-
: color || style?.color || restProps?.color,
|
|
168
|
-
}),
|
|
169
|
-
[isUsePrimary, style, color],
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
if (svgContent) {
|
|
173
|
-
return (
|
|
174
|
-
<div
|
|
175
|
-
className={curClassName}
|
|
176
|
-
style={{
|
|
177
|
-
...curStyle,
|
|
178
|
-
transform: `rotate(${rotate}deg)`,
|
|
179
|
-
}}
|
|
180
|
-
// eslint-disable-next-line react/no-danger
|
|
181
|
-
dangerouslySetInnerHTML={{
|
|
182
|
-
__html: svgContent,
|
|
183
|
-
}}
|
|
184
|
-
/>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (curType) {
|
|
189
|
-
if (fontAddress || iconFile?.fileSubType === 'ICONFONT' || isIconFont) {
|
|
190
|
-
if (scriptUrl) {
|
|
191
|
-
const IconFont = createFromIconfontCN({
|
|
192
|
-
scriptUrl,
|
|
193
|
-
});
|
|
194
|
-
return (
|
|
195
|
-
<IconFont
|
|
196
|
-
type={curType}
|
|
197
|
-
rotate={rotate}
|
|
198
|
-
{...restProps}
|
|
199
|
-
style={curStyle}
|
|
200
|
-
className={curClassName}
|
|
201
|
-
/>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
if (!fontAddress) {
|
|
205
|
-
// 采用项目本地的iconfont文件
|
|
206
|
-
return (
|
|
207
|
-
<svg
|
|
208
|
-
style={{
|
|
209
|
-
...curStyle,
|
|
210
|
-
transform: `rotate(${rotate}deg)`,
|
|
211
|
-
}}
|
|
212
|
-
aria-hidden="true"
|
|
213
|
-
className={curClassName}
|
|
214
|
-
>
|
|
215
|
-
<use xlinkHref={`#${curType}`} />
|
|
216
|
-
</svg>
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
} else if (
|
|
220
|
-
theme &&
|
|
221
|
-
!['cross-circle', 'cross-circle-o'].includes(curType) &&
|
|
222
|
-
Object.keys(iconFileInfo || {})?.length < 1
|
|
223
|
-
) {
|
|
224
|
-
// 兼容原来的antd-mobile的图标
|
|
225
|
-
return (
|
|
226
|
-
<LegacyIcon
|
|
227
|
-
type={curType}
|
|
228
|
-
rotate={rotate}
|
|
229
|
-
theme={theme}
|
|
230
|
-
{...restProps}
|
|
231
|
-
style={curStyle}
|
|
232
|
-
className={curClassName}
|
|
233
|
-
/>
|
|
234
|
-
);
|
|
235
|
-
} else if (iconFileInfo && Object.keys(iconFileInfo)?.length > 0) {
|
|
236
|
-
if (iconFileInfo.svgContent) {
|
|
237
|
-
return (
|
|
238
|
-
<div
|
|
239
|
-
className={curClassName}
|
|
240
|
-
style={{
|
|
241
|
-
...curStyle,
|
|
242
|
-
transform: `rotate(${rotate}deg)`,
|
|
243
|
-
}}
|
|
244
|
-
// eslint-disable-next-line react/no-danger
|
|
245
|
-
dangerouslySetInnerHTML={{ __html: iconFileInfo.svgContent }}
|
|
246
|
-
/>
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
return (
|
|
250
|
-
<img
|
|
251
|
-
className={curClassName}
|
|
252
|
-
style={{
|
|
253
|
-
...curStyle,
|
|
254
|
-
transform: `rotate(${rotate}deg)`,
|
|
255
|
-
}}
|
|
256
|
-
src={scriptUrl}
|
|
257
|
-
alt=""
|
|
258
|
-
/>
|
|
259
|
-
);
|
|
260
|
-
} else if (curType) {
|
|
261
|
-
return (
|
|
262
|
-
<LegacyIcon
|
|
263
|
-
type={curType}
|
|
264
|
-
rotate={rotate}
|
|
265
|
-
theme={theme}
|
|
266
|
-
{...restProps}
|
|
267
|
-
style={curStyle}
|
|
268
|
-
className={curClassName}
|
|
269
|
-
/>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (iconFile?.fileSubType === 'ICON_IMAGE' && scriptUrl) {
|
|
274
|
-
return (
|
|
275
|
-
<img
|
|
276
|
-
alt="图片格式错误"
|
|
277
|
-
src={scriptUrl}
|
|
278
|
-
{...restProps}
|
|
279
|
-
style={{
|
|
280
|
-
...curStyle,
|
|
281
|
-
transform: `rotate(${rotate}deg)`,
|
|
282
|
-
}}
|
|
283
|
-
className={curClassName}
|
|
284
|
-
/>
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
return null;
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
export default IconED;
|