@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.
Files changed (96) hide show
  1. package/es/constants.js +0 -1
  2. package/es/index.js +57 -38
  3. package/es/node/move.d.ts +1 -0
  4. package/es/node/move.js +7 -4
  5. package/es/requestQueue.d.ts +9 -0
  6. package/es/requestQueue.js +59 -0
  7. package/lib/h5public/src/components/common/PreviewFile/index.tsx +3 -7
  8. package/lib/h5public/src/components/factory/package.json +1 -1
  9. package/lib/h5public/src/components/factory/src/BlockSelect/components/CheckBox/index.tsx +14 -4
  10. package/lib/h5public/src/components/factory/src/BlockSelect/components/Icon/index.tsx +4 -4
  11. package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +13 -21
  12. package/lib/h5public/src/components/factory/src/Button/index.tsx +1 -0
  13. package/lib/h5public/src/components/factory/src/Card/index.less +11 -24
  14. package/lib/h5public/src/components/factory/src/Card/index.tsx +61 -22
  15. package/lib/h5public/src/components/factory/src/DGroup/index.less +7 -3
  16. package/lib/h5public/src/components/factory/src/DformFile/FormFile.tsx +17 -4
  17. package/lib/h5public/src/components/factory/src/DformFile/assets/closeIcon.png +0 -0
  18. package/lib/h5public/src/components/factory/src/DformFile/assets/default.png +0 -0
  19. package/lib/h5public/src/components/factory/src/DformFile/assets/fileName.png +0 -0
  20. package/lib/h5public/src/components/factory/src/DformFile/assets/img.png +0 -0
  21. package/lib/h5public/src/components/factory/src/DformFile/assets/js.png +0 -0
  22. package/lib/h5public/src/components/factory/src/DformFile/assets/pdf.png +0 -0
  23. package/lib/h5public/src/components/factory/src/DformFile/assets/ppt.png +0 -0
  24. package/lib/h5public/src/components/factory/src/DformFile/assets/txt.png +0 -0
  25. package/lib/h5public/src/components/factory/src/DformFile/assets/word.png +0 -0
  26. package/lib/h5public/src/components/factory/src/DformFile/assets/xls.png +0 -0
  27. package/lib/h5public/src/components/factory/src/DformFile/assets/zip.png +0 -0
  28. package/lib/h5public/src/components/factory/src/DynamicDataContainer/YieldMethod.ts +33 -0
  29. package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.less +41 -5
  30. package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.tsx +18 -3
  31. package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
  32. package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +4 -2
  33. package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -1
  34. package/lib/h5public/src/components/factory/src/Image/BasicImage/index.tsx +36 -1
  35. package/lib/h5public/src/components/factory/src/StackColumn/loader.tsx +1 -1
  36. package/lib/h5public/src/components/factory/src/StaticTabs/index.tsx +1 -1
  37. package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +14 -3
  38. package/lib/h5public/src/components/factory/src/VideoPlayer/loader.ts +1 -1
  39. package/lib/h5public/src/components/factory/src/utils/CustomModule.tsx +3 -0
  40. package/lib/h5public/src/components/factory/src/utils/hooks/useFormItem.ts +3 -0
  41. package/lib/h5public/src/hooks/usePageForm.ts +29 -3
  42. package/lib/h5public/src/utils/native.ts +94 -0
  43. package/lib/h5public/yarn.lock +19383 -0
  44. package/lib/node/move.d.ts +1 -0
  45. package/lib/node/move.js +6 -3
  46. package/lib/pcpublic/src/components/common/PreviewFile/index.tsx +8 -0
  47. package/lib/pcpublic/src/components/common/PreviewFile/utils.ts +45 -0
  48. package/lib/pcpublic/src/components/pcfactory/package.json +1 -1
  49. package/lib/pcpublic/src/components/pcfactory/src/CollapsePanel/index.tsx +6 -4
  50. package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/YieldMethod.ts +33 -0
  51. package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/index.tsx +18 -3
  52. package/lib/pcpublic/src/components/pcfactory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
  53. package/lib/pcpublic/src/components/pcfactory/src/Img/index.tsx +34 -2
  54. package/lib/pcpublic/src/components/pcfactory/src/LoopList/index.tsx +9 -4
  55. package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +8 -1
  56. package/lib/pcpublic/src/components/pcfactory/src/StdUpload/index.tsx +39 -13
  57. package/lib/pcpublic/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +22 -14
  58. package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +12 -1
  59. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +54 -12
  60. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +516 -485
  61. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +40 -2
  62. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +3 -34
  63. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +1 -1
  64. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +30 -3
  65. package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +37 -13
  66. package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +15 -4
  67. package/lib/pcpublic/src/components/pcfactory/src/Tabs/index.tsx +2 -0
  68. package/lib/pcpublic/src/components/pcfactory/src/Tag/index.tsx +2 -2
  69. package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +13 -2
  70. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +1 -1
  71. package/lib/pcpublic/src/components/pcfactory/src/styles/components/FormGroup.less +8 -4
  72. package/lib/pcpublic/src/components/pcfactory/src/styles/components/Icon.less +4 -0
  73. package/lib/pcpublic/src/components/pcfactory/src/styles/components/StdUpload.less +3 -3
  74. package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +3 -0
  75. package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +15 -0
  76. package/lib/pcpublic/src/hooks/usePageForm.ts +4 -3
  77. package/lib/pcpublic/src/utils/exportCustomData/index.tsx +723 -0
  78. package/lib/pcpublic/src/utils/exportCustomData/tool.ts +399 -0
  79. package/lib/pcpublic/src/utils/messageApi.ts +25 -20
  80. package/lib/pcpublic/yarn.lock +11441 -0
  81. package/lib/public/src/components/ProgressComp/index.tsx +4 -14
  82. package/lib/public/src/hooks/useBaseDataSource.ts +2 -1
  83. package/lib/public/src/hooks/useExportCustomDataFile.ts +4 -0
  84. package/lib/public/src/services/api/engine.ts +19 -0
  85. package/lib/public/src/services/api/index.ts +12 -0
  86. package/lib/public/src/utils/Context/context.tsx +1 -0
  87. package/lib/public/src/utils/cmd.ts +455 -0
  88. package/lib/public/src/utils/historytool.ts +3 -0
  89. package/lib/public/src/utils/lcdpBaseApi.ts +2 -2
  90. package/lib/public/src/utils/platform/utils/fileUtils.ts +12 -11
  91. package/lib/public/src/utils/polyfills.ts +4 -0
  92. package/lib/public/src/utils/popoverUtils.ts +56 -0
  93. package/lib/public/src/utils/service/baseRequest.ts +8 -8
  94. package/lib/public/src/utils/service/urlHelper.ts +2 -0
  95. package/lib/public/src/utils/useComponentHoc.ts +6 -3
  96. package/package.json +2 -2
@@ -2,5 +2,6 @@ export interface MoveConfig {
2
2
  target: string;
3
3
  outDir: string;
4
4
  cwd?: string;
5
+ plugin?: any;
5
6
  }
6
7
  export declare function move(moveConfig: MoveConfig): Promise<any>;
package/lib/node/move.js CHANGED
@@ -25,7 +25,7 @@ module.exports = __toCommonJS(move_exports);
25
25
  var import_fs_extra = require("fs-extra");
26
26
  var import_path = require("path");
27
27
  var import_getAllImportFiles = require("./babel/getAllImportFiles");
28
- var copyFileSyncAlias = (cwd, from, to) => {
28
+ var copyFileSyncAlias = (cwd, from, to, plugin) => {
29
29
  var _a;
30
30
  let context = (0, import_fs_extra.readFileSync)(from, "utf-8");
31
31
  const importList = ((_a = context.match(/from '@\/([^']+)'/g)) == null ? void 0 : _a.map((match) => match.slice(8, -1))) || [];
@@ -34,10 +34,13 @@ var copyFileSyncAlias = (cwd, from, to) => {
34
34
  const filePath = (0, import_path.relative)((0, import_path.dirname)(from), absolute);
35
35
  context = context.replace(`@/${source}`, filePath);
36
36
  });
37
+ if (plugin) {
38
+ context = plugin(to, context);
39
+ }
37
40
  (0, import_fs_extra.writeFileSync)(to, context, "utf-8");
38
41
  };
39
42
  async function move(moveConfig) {
40
- const { target, outDir, cwd = process.cwd() } = moveConfig;
43
+ const { target, outDir, cwd = process.cwd(), plugin } = moveConfig;
41
44
  const resolvedTarget = (0, import_path.isAbsolute)(target) ? target : (0, import_path.join)(cwd, target);
42
45
  if (!(0, import_fs_extra.existsSync)(resolvedTarget)) {
43
46
  throw new Error(`指定的入口文件不存在: ${resolvedTarget}`);
@@ -55,7 +58,7 @@ async function move(moveConfig) {
55
58
  const filePath = (0, import_path.relative)(cwd, file);
56
59
  const absTarget = (0, import_path.isAbsolute)(outDir) ? (0, import_path.join)(outDir, filePath) : (0, import_path.join)(cwd, outDir, filePath);
57
60
  (0, import_fs_extra.mkdirpSync)((0, import_path.dirname)(absTarget));
58
- copyFileSyncAlias(cwd, file, absTarget);
61
+ copyFileSyncAlias(cwd, file, absTarget, plugin);
59
62
  });
60
63
  console.log(`[COPY] 共拷贝文件数 ${count}`);
61
64
  const pkg = (0, import_path.join)(cwd, "package.json");
@@ -27,6 +27,7 @@ import security from '@/utils/Security';
27
27
  import { LocaleFunction } from '@lingxiteam/types';
28
28
  import {
29
29
  CAN_SCALE,
30
+ getPreviewModeWithDate,
30
31
  isUrlFormat,
31
32
  LOCAL_PREVIEW,
32
33
  parseFileInfo,
@@ -324,6 +325,13 @@ const PreviewFile: React.FC<PreviewFileProps> = (props) => {
324
325
  }
325
326
  return true;
326
327
  }
328
+ // 目前仅支持判断图片类型,当没有文件名的时候通过dataUrl进行判断
329
+ // @ts-ignore
330
+ const imgeType = getPreviewModeWithDate(fileBlob?.dataUrl);
331
+ if (imgeType) {
332
+ fileInfo.previewMode = imgeType;
333
+ return true;
334
+ }
327
335
  return false;
328
336
  });
329
337
  if (target?.previewMode === PREVIEW_MODE.TXT && fileBlob instanceof Blob) {
@@ -84,7 +84,52 @@ export const parseFileInfo = (
84
84
  }
85
85
  return newFileInfo;
86
86
  };
87
+ export const getPreviewModeWithDate = (dataUrl: string) => {
88
+ if (typeof dataUrl === 'string' && dataUrl.length > 0) {
89
+ const base64String = dataUrl.split(',')[1];
90
+ const binaryString = atob(base64String);
91
+ if (binaryString.length < 4) {
92
+ return null;
93
+ }
94
+ const bytes = new Uint8Array(4);
95
+
96
+ // eslint-disable-next-line no-plusplus
97
+ for (let i = 0; i < 4; i++) {
98
+ bytes[i] = binaryString.charCodeAt(i);
99
+ }
87
100
 
101
+ const arr = bytes.subarray(0, 4);
102
+ let header = '';
103
+ // eslint-disable-next-line no-plusplus
104
+ for (let i = 0; i < arr.length; i++) {
105
+ header += arr[i].toString(16);
106
+ }
107
+ // 文件类型匹配
108
+ let type = null;
109
+ switch (header) {
110
+ case '89504e47':
111
+ type = 'image/png';
112
+ break;
113
+ case '47494638':
114
+ type = 'image/gif';
115
+ break;
116
+ case 'ffd8ffe0':
117
+ case 'ffd8ffe1':
118
+ case 'ffd8ffe2':
119
+ case 'ffd8ffe3':
120
+ case 'ffd8ffe8':
121
+ type = 'image/jpeg';
122
+ break;
123
+ default:
124
+ break;
125
+ }
126
+ if (type?.startsWith('image/')) {
127
+ return PREVIEW_MODE.IMG;
128
+ }
129
+ return null;
130
+ }
131
+ return null;
132
+ };
88
133
  // 判断是否是网络地址,是的话不调用后端接口预览
89
134
  export const isUrlFormat = (id: string) =>
90
135
  /^https?:\/\/[^\s/$.?#].[^\s]*$/i.test(id);
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@lingxiteam/pcfactory",
3
- "version": "3.7.1"
3
+ "version": "3.8.1-alpha.12"
4
4
  }
@@ -1,7 +1,7 @@
1
1
  import { LingxiForwardRef } from '@lingxiteam/types';
2
2
  import { Collapse } from 'antd';
3
3
  import type { CollapsePanelProps } from 'antd/lib/collapse';
4
- import { useEffect, useRef } from 'react';
4
+ import { useCallback, useEffect, useRef } from 'react';
5
5
  import CommIcon from '../Icon';
6
6
  import type { PrefixIconIconProps } from '../Icon/PropsType';
7
7
  import { useChildRenderContext } from '../utils';
@@ -61,7 +61,7 @@ const CollapsePanel = LingxiForwardRef<any, MyCollapsePanelProps>(
61
61
  appId,
62
62
  mode: 'engine',
63
63
  });
64
- const renderHeader = () => {
64
+ const renderHeader = useCallback(() => {
65
65
  const headStyle: { backgroundColor?: string } = {};
66
66
  if (headerColor) {
67
67
  headStyle.backgroundColor = headerColor;
@@ -146,12 +146,13 @@ const CollapsePanel = LingxiForwardRef<any, MyCollapsePanelProps>(
146
146
  </div>
147
147
  );
148
148
  }
149
- };
149
+ }, [titleColor, header]);
150
150
 
151
151
  renderRef.current = visible ? (
152
152
  <Panel
153
153
  {...restProps}
154
154
  header={renderHeader()}
155
+ id={props.$$componentItem.uid}
155
156
  key={currentProps?.key ?? currentIndex}
156
157
  >
157
158
  <div
@@ -172,8 +173,9 @@ const CollapsePanel = LingxiForwardRef<any, MyCollapsePanelProps>(
172
173
  props.$$componentItem.uid,
173
174
  renderRef,
174
175
  );
175
- }, [children]);
176
+ }, []);
176
177
 
178
+ // TODO 暂时通过监听children解决循环列表内子控件未及时更新问题
177
179
  useUpdateEffect(() => {
178
180
  // 监听需要更新的属性
179
181
  childRenderContext.update?.();
@@ -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;
@@ -76,7 +76,13 @@ const DynamicDataContainer = LingxiForwardRef<any, DynamicDataContainerProps>(
76
76
  const [pageData, setPageData] = useState<any>();
77
77
  const dynamicHelperRef = useRef<ReturnType<typeof dynamicData2DSL>>();
78
78
 
79
- const { dynamicPageRef, staticAttrKeys } = useDynamicDataContainer({
79
+ const {
80
+ dynamicPageRef,
81
+ staticAttrKeys,
82
+ yieldMethod,
83
+ readyComplete,
84
+ engineliftCycle,
85
+ } = useDynamicDataContainer({
80
86
  dynamicHelper: dynamicHelperRef.current,
81
87
  });
82
88
 
@@ -216,7 +222,12 @@ const DynamicDataContainer = LingxiForwardRef<any, DynamicDataContainerProps>(
216
222
  return undefined;
217
223
  },
218
224
  setFieldsValue: (assignData: Record<string, unknown>) => {
219
- return setFieldsValue(assignData, true);
225
+ if (readyComplete) {
226
+ return setFieldsValue(assignData, true);
227
+ }
228
+ return yieldMethod.appendTo('setFieldsValue', setFieldsValue, [
229
+ assignData,
230
+ ]);
220
231
  },
221
232
  }));
222
233
 
@@ -289,7 +300,11 @@ const DynamicDataContainer = LingxiForwardRef<any, DynamicDataContainerProps>(
289
300
  renderDynamicPage(
290
301
  pageData,
291
302
  { uid: $$componentItem.uid },
292
- { ref: dynamicPageRef, staticAttrKeys },
303
+ {
304
+ ref: dynamicPageRef,
305
+ staticAttrKeys,
306
+ engineliftCycle,
307
+ },
293
308
  )}
294
309
  </DynamicDataProvider>
295
310
  </Spin>
@@ -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
  };
@@ -39,6 +39,35 @@ const MyImg = React.forwardRef<any, MyImgProps>((props, ref) => {
39
39
  const [imgSrc, setImgSrc] = useState<string>();
40
40
  const [errorSrc, setErrorSrc] = useState<string>();
41
41
 
42
+ const setImgsrcWithSign = (src: string) => {
43
+ if (
44
+ src &&
45
+ (src.match('downloadFileByFileCode') || src.match('file/download')) &&
46
+ engineApis?.service?.buildXSignUrl
47
+ ) {
48
+ // 如果是平台服务,统一添加或更新签名
49
+ if (src.match('X-SIGN=')) {
50
+ // 如果资源地址使用签名模式,需更新地址签名
51
+ setImgSrc(
52
+ engineApis.service.buildXSignUrl({
53
+ url: src.slice(0, src.indexOf('&X-SIGN')),
54
+ version: (window as any).lxSecurityModeInFile || '1.0',
55
+ }),
56
+ );
57
+ } else {
58
+ // 添加签名
59
+ setImgSrc(
60
+ engineApis.service.buildXSignUrl({
61
+ url: src,
62
+ version: (window as any).lxSecurityModeInFile || '1.0',
63
+ }),
64
+ );
65
+ }
66
+ } else {
67
+ setImgSrc(src);
68
+ }
69
+ };
70
+
42
71
  useEffect(() => {
43
72
  // srcType设置兼容存量数据,当存量数据无srcType时根据旧的资源优先级进行赋值
44
73
  let mySrcType = srcType;
@@ -52,8 +81,11 @@ const MyImg = React.forwardRef<any, MyImgProps>((props, ref) => {
52
81
  }
53
82
  if (mySrcType === 'fileCode' && fileCode) {
54
83
  setImgSrc(engineApis?.service?.getAppFileUrlByFileCode(fileCode));
84
+ } else if (/^\d+$/.test(src)) {
85
+ // 如果src为纯数字,则认为是文件id, 转换成平台文件地址
86
+ setImgSrc(engineApis?.service?.getAppFileUrlById(src));
55
87
  } else {
56
- setImgSrc(src);
88
+ setImgsrcWithSign(src);
57
89
  }
58
90
  }, [src, fileName, fileId, srcType, fileCode]);
59
91
 
@@ -68,7 +100,7 @@ const MyImg = React.forwardRef<any, MyImgProps>((props, ref) => {
68
100
 
69
101
  useImperativeHandle(ref, () => ({
70
102
  setSrc: (href: string) => {
71
- setImgSrc(href);
103
+ setImgsrcWithSign(href);
72
104
  },
73
105
  setCompFileId: (fileId: string) => {
74
106
  setImgSrc(engineApis?.service?.getAppFileUrlById(fileId));
@@ -166,6 +166,7 @@ const CheckBox = (item: {
166
166
  {renderIcon({ checked, selectImg, normalImg, getAppFileUrlByFileCode })}
167
167
  </div>
168
168
  <div
169
+ onClick={() => onChange(item)}
169
170
  className={classNames({
170
171
  [`${loopListCls}-content`]: true,
171
172
  [`${loopListCls}-content-lass`]: isFormCompat,
@@ -323,6 +324,7 @@ const MyGrid = (props: MyLoopList) => {
323
324
  gridMode = true, // 存量数据为true
324
325
  getEngineApis,
325
326
  $$componentItem,
327
+ className,
326
328
  ...restProps
327
329
  } = props;
328
330
 
@@ -424,7 +426,11 @@ const MyGrid = (props: MyLoopList) => {
424
426
  const { MemoLoopItem, renderer, getLoopItemExtraProps } = MemoRenderer;
425
427
 
426
428
  return (
427
- <Row gutter={[vspace, hspace]} style={{ ...backgroundStyle, ...style }}>
429
+ <Row
430
+ gutter={[vspace, hspace]}
431
+ style={{ ...backgroundStyle, ...style }}
432
+ className={className}
433
+ >
428
434
  {Array.isArray(gridData) &&
429
435
  gridData.map((item, index) => {
430
436
  const restItem = item || {};
@@ -450,9 +456,8 @@ const MyGrid = (props: MyLoopList) => {
450
456
  },
451
457
  ...getLoopItemExtraProps?.(item, index),
452
458
  };
453
-
454
459
  return (
455
- <>
460
+ <React.Fragment key={gridViewIndex}>
456
461
  {!props.disabled ? (
457
462
  <WrapperEditorComp>
458
463
  <EditorComp
@@ -494,7 +499,7 @@ const MyGrid = (props: MyLoopList) => {
494
499
  </DisabledComps>
495
500
  </WrapperDisableComps>
496
501
  )}
497
- </>
502
+ </React.Fragment>
498
503
  );
499
504
  })}
500
505
  </Row>
@@ -64,7 +64,14 @@ const BaseModalSelect = (props: any) => {
64
64
  );
65
65
  }}
66
66
  onClick={(e) => {
67
- !disabled && handleClickVisible();
67
+ if (!disabled) {
68
+ // 图标点击事件优先级最高,其次才是打开默认属性弹窗
69
+ if (onIconClick) {
70
+ onIconClick();
71
+ } else {
72
+ handleClickVisible();
73
+ }
74
+ }
68
75
  e.stopPropagation();
69
76
  }}
70
77
  style={{
@@ -260,29 +260,43 @@ const FormUpload = LingxiForwardRef<any, MyFormUploadProps>((props, ref) => {
260
260
  defaultList.map((file: any) => {
261
261
  const { fileUrl, url, filePathInServer, fileId } = file;
262
262
  let effectDownUrl = fileUrl || url;
263
+ // 兼容外部数据使用filePathInServer字段
263
264
  if (
264
265
  !effectDownUrl &&
265
266
  filePathInServer?.match(/^(http:|https:|\/\/)/)
266
267
  ) {
267
268
  effectDownUrl = filePathInServer;
268
269
  }
269
- if (
270
- effectDownUrl &&
271
- effectDownUrl.match('X-SIGN=') &&
272
- engineApis?.service?.buildXSignUrl
273
- ) {
274
- // 如果资源地址使用签名模式,需更新地址签名
275
- effectDownUrl = engineApis.service.buildXSignUrl(
276
- effectDownUrl.slice(0, url.indexOf('&X-SIGN')),
277
- );
270
+
271
+ // 资源地址签名处理
272
+ if (effectDownUrl && engineApis.service?.buildXSignUrl) {
273
+ if (effectDownUrl.match('X-SIGN=')) {
274
+ // 如果资源地址使用签名模式,需更新地址签名
275
+ effectDownUrl = engineApis.service.buildXSignUrl({
276
+ url: effectDownUrl.slice(0, effectDownUrl.indexOf('&X-SIGN')),
277
+ version: (window as any).lxSecurityModeInFile || '1.0',
278
+ });
279
+ } else {
280
+ // 添加签名
281
+ effectDownUrl = engineApis.service.buildXSignUrl({
282
+ url: effectDownUrl,
283
+ version: (window as any).lxSecurityModeInFile || '1.0',
284
+ });
285
+ }
278
286
  }
287
+
288
+ const finallyUrl =
289
+ effectDownUrl || engineApis?.service?.getAppFileUrlById(fileId);
290
+ const finallyUrlWithoutSign = finallyUrl.match('X-SIGN=')
291
+ ? finallyUrl.slice(0, finallyUrl.indexOf('&X-SIGN'))
292
+ : finallyUrl;
279
293
  return {
280
294
  ...file,
281
- url:
282
- effectDownUrl || engineApis?.service?.getAppFileUrlById(fileId),
295
+ url: finallyUrl,
283
296
  name: file.fileName,
284
297
  uid: `-${file.fileId || file.id || effectDownUrl || file.uid}`, // 添加uid
285
298
  status: file?.status || 'done', // 后台已存在文件状态为已完成
299
+ fileUrl: file.fileUrl || finallyUrlWithoutSign, // 补充一个没有签名的url地址, 业务数据里使用的应是不带签名的
286
300
  };
287
301
  }),
288
302
  );
@@ -348,19 +362,26 @@ const FormUpload = LingxiForwardRef<any, MyFormUploadProps>((props, ref) => {
348
362
  } = resultObject;
349
363
  const { status } = f;
350
364
  let effectDownUrl = fileUrl || url;
365
+ // 兼容外部数据使用filePathInServer字段
351
366
  if (
352
367
  !effectDownUrl &&
353
368
  filePathInServer?.match(/^(http:|https:|\/\/)/)
354
369
  ) {
355
370
  effectDownUrl = filePathInServer;
356
371
  }
372
+
373
+ const finallyUrl =
374
+ effectDownUrl || engineApis?.service?.getAppFileUrlById(fileId);
375
+ const finallyUrlWithoutSign = finallyUrl.match('X-SIGN=')
376
+ ? finallyUrl.slice(0, finallyUrl.indexOf('&X-SIGN'))
377
+ : finallyUrl;
357
378
  return {
358
379
  ...f,
359
380
  ...resultObject,
360
381
  name: handleFileName(f.name),
361
382
  status: +resultCode !== 0 ? 'error' : status,
362
- url:
363
- effectDownUrl || engineApis?.service?.getAppFileUrlById(fileId),
383
+ url: finallyUrl,
384
+ fileUrl: file.fileUrl || finallyUrlWithoutSign,
364
385
  };
365
386
  }
366
387
  }
@@ -472,6 +493,11 @@ const FormUpload = LingxiForwardRef<any, MyFormUploadProps>((props, ref) => {
472
493
  addWaterMark,
473
494
  fileId: file.fileId,
474
495
  });
496
+ } else if (engineApis?.service?.buildXSignUrl) {
497
+ downUrl = engineApis.service.buildXSignUrl({
498
+ url: downUrl,
499
+ version: (window as any).lxSecurityModeInFile || '1.0',
500
+ });
475
501
  }
476
502
  } catch (error) {
477
503
  console.error(error);
@@ -100,9 +100,9 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
100
100
 
101
101
  const [reload, setReload] = useState(0);
102
102
  const [compValue, setCompValue] = useState<any>();
103
- const [dataSource, setDataSource] = useState([]);
104
- const [oldDataSource, setOldDataSource] = useState([]);
105
- const [selectedRows, setSelectedRows] = useState<any>([]);
103
+ const [dataSource, setDataSource] = useState<any[]>([]);
104
+ const [oldDataSource, setOldDataSource] = useState<any[]>([]);
105
+ const [selectedRows, setSelectedRows] = useState<any[]>([]);
106
106
  const [params, setParams] = useState(defaultParams);
107
107
  const [total, setTotal] = useState(0);
108
108
  const [, setShow] = useState(false);
@@ -240,24 +240,28 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
240
240
  },
241
241
  })
242
242
  .then((res = []) => {
243
- res.forEach((item) => {
243
+ const newList = res.map((l: any) => ({
244
+ ...l,
245
+ [valueKey?.key]: String(l[valueKey?.key]),
246
+ }));
247
+ newList.forEach((item) => {
244
248
  set(item[valueKey?.key], item);
245
249
  });
246
250
  // 针对选择的数据在对应表中已删除时,手动补齐数据做展示
247
251
  const others: any[] = [];
248
252
  ids.forEach((i: any) => {
249
253
  // eslint-disable-next-line eqeqeq
250
- if (!res.find((r) => r[valueKey?.key] == i)) {
254
+ if (!newList.find((r) => r[valueKey?.key] == i)) {
251
255
  others.push({
252
256
  [valueKey?.key]: i,
253
257
  [labelKey?.key || valueKey?.key]: i,
254
258
  });
255
259
  }
256
260
  });
257
- setSelectedRows([...res, ...others]);
261
+ setSelectedRows([...newList, ...others]);
258
262
  // 如果初次未传入正确的value数据类型
259
- if (res?.length && res[0][valueKey?.key]) {
260
- const realType = typeof res[0][valueKey?.key];
263
+ if (newList?.length && newList[0][valueKey?.key]) {
264
+ const realType = typeof newList[0][valueKey?.key];
261
265
  const valueType = typeof ids[0];
262
266
  if (
263
267
  (realType !== valueType || ignoreValueType) &&
@@ -269,7 +273,7 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
269
273
  : ids.map((item) => transFormType[realType](item));
270
274
  onSelectChange(
271
275
  transformValue,
272
- res
276
+ newList
273
277
  .map((item) => item[labelKey?.key || valueKey?.key])
274
278
  .join(','),
275
279
  );
@@ -308,12 +312,16 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
308
312
  })
309
313
  .then((res: any) => {
310
314
  const { list = [], total: newTotal } = res || {};
315
+ const newList: any[] = list.map((l: any) => ({
316
+ ...l,
317
+ [valueKey?.key]: String(l[valueKey?.key]),
318
+ }));
311
319
  if (!isSearch) {
312
- setOldDataSource(list);
320
+ setOldDataSource([...newList]);
313
321
  setTotal(newTotal || 0);
314
322
  }
315
- setDataSource(list);
316
- (list || []).forEach((item: any) => {
323
+ setDataSource([...newList]);
324
+ (newList || []).forEach((item: any) => {
317
325
  if (!get(item[valueKey?.key])) {
318
326
  set(item[valueKey?.key], item);
319
327
  }
@@ -432,7 +440,7 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
432
440
  // onSearch={fetchList}
433
441
  onSearch={(v) => superSelectGetAllPage(v, true)}
434
442
  onChange={(e) => {
435
- let changeValue: string | never[] = [];
443
+ let changeValue: any[] = [];
436
444
  if (labelInValue) {
437
445
  changeValue =
438
446
  mode === 'multiple'
@@ -441,7 +449,7 @@ const ComSelect = forwardRef<any, ComSelectProps>((props) => {
441
449
  } else {
442
450
  changeValue = mode === 'multiple' ? e : [e];
443
451
  }
444
- const newData = dataSource.filter((f) =>
452
+ const newData = dataSource.filter((f: any) =>
445
453
  changeValue.includes(f[valueKey.key]),
446
454
  );
447
455
  setSelectedRows(newData);
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { CSSProperties } from 'react';
2
2
 
3
3
  import type { FuncExpExeCuteType } from '../../utils/hooks/useFuncExpExecute';
4
4
  import {
@@ -42,6 +42,7 @@ export interface CellContentProps {
42
42
  children: any;
43
43
  contentStyle: ContentStyle;
44
44
  funcExpExecute?: FuncExpExeCuteType;
45
+ controllLineStyle?: CSSProperties | null;
45
46
  }
46
47
 
47
48
  const CellContent = (props: CellContentProps) => {
@@ -54,6 +55,7 @@ const CellContent = (props: CellContentProps) => {
54
55
  rowIndex,
55
56
  contentStyle,
56
57
  funcExpExecute,
58
+ controllLineStyle,
57
59
  } = props;
58
60
  const {
59
61
  contentType,
@@ -96,6 +98,14 @@ const CellContent = (props: CellContentProps) => {
96
98
 
97
99
  children = content ? handleCellContent(row, rowIndex) : children;
98
100
 
101
+ if (content && controllLineStyle) {
102
+ children = (
103
+ <span className="ued-control-line-number" style={controllLineStyle}>
104
+ {children}
105
+ </span>
106
+ );
107
+ }
108
+
99
109
  const handleOnCellClick = (e: any) => {
100
110
  e.stopPropagation();
101
111
  if (typeof onCellClick === 'function') {
@@ -214,6 +224,7 @@ const FormatCell: React.FC<MyFormatCell> = (props) => {
214
224
  row={row}
215
225
  rowId={rowId}
216
226
  rowIndex={rowIndex}
227
+ controllLineStyle={props.tdProps?.controllLineStyle}
217
228
  >
218
229
  {children}
219
230
  </CellContent>