@lingxiteam/ebe-utils 0.0.27 → 0.0.30

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 (89) hide show
  1. package/es/constants.js +0 -1
  2. package/es/index.d.ts +8 -2
  3. package/es/index.js +106 -42
  4. package/es/node/move.d.ts +1 -0
  5. package/es/node/move.js +7 -4
  6. package/es/requestQueue.d.ts +9 -0
  7. package/es/requestQueue.js +59 -0
  8. package/lib/h5public/src/components/common/PreviewFile/index.tsx +3 -7
  9. package/lib/h5public/src/components/factory/package.json +1 -1
  10. package/lib/h5public/src/components/factory/src/BlockSelect/components/CheckBox/index.tsx +14 -4
  11. package/lib/h5public/src/components/factory/src/BlockSelect/components/Icon/index.tsx +4 -4
  12. package/lib/h5public/src/components/factory/src/BlockSelect/index.tsx +13 -21
  13. package/lib/h5public/src/components/factory/src/Button/index.tsx +1 -0
  14. package/lib/h5public/src/components/factory/src/Card/index.less +11 -24
  15. package/lib/h5public/src/components/factory/src/Card/index.tsx +61 -22
  16. package/lib/h5public/src/components/factory/src/DGroup/index.less +7 -3
  17. package/lib/h5public/src/components/factory/src/DformFile/FormFile.tsx +17 -4
  18. package/lib/h5public/src/components/factory/src/DformFile/assets/closeIcon.png +0 -0
  19. package/lib/h5public/src/components/factory/src/DformFile/assets/default.png +0 -0
  20. package/lib/h5public/src/components/factory/src/DformFile/assets/fileName.png +0 -0
  21. package/lib/h5public/src/components/factory/src/DformFile/assets/img.png +0 -0
  22. package/lib/h5public/src/components/factory/src/DformFile/assets/js.png +0 -0
  23. package/lib/h5public/src/components/factory/src/DformFile/assets/pdf.png +0 -0
  24. package/lib/h5public/src/components/factory/src/DformFile/assets/ppt.png +0 -0
  25. package/lib/h5public/src/components/factory/src/DformFile/assets/txt.png +0 -0
  26. package/lib/h5public/src/components/factory/src/DformFile/assets/word.png +0 -0
  27. package/lib/h5public/src/components/factory/src/DformFile/assets/xls.png +0 -0
  28. package/lib/h5public/src/components/factory/src/DformFile/assets/zip.png +0 -0
  29. package/lib/h5public/src/components/factory/src/DynamicDataContainer/YieldMethod.ts +33 -0
  30. package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.less +41 -5
  31. package/lib/h5public/src/components/factory/src/DynamicDataContainer/index.tsx +18 -3
  32. package/lib/h5public/src/components/factory/src/DynamicDataContainer/useDynamicDataContainer.ts +14 -1
  33. package/lib/h5public/src/components/factory/src/DynamicList/index.tsx +4 -2
  34. package/lib/h5public/src/components/factory/src/DynamicTable/Table.tsx +3 -1
  35. package/lib/h5public/src/components/factory/src/Image/BasicImage/index.tsx +36 -1
  36. package/lib/h5public/src/components/factory/src/StackColumn/loader.tsx +1 -1
  37. package/lib/h5public/src/components/factory/src/StaticTabs/index.tsx +1 -1
  38. package/lib/h5public/src/components/factory/src/VerificationCode/index.tsx +14 -3
  39. package/lib/h5public/src/components/factory/src/VideoPlayer/loader.ts +1 -1
  40. package/lib/h5public/src/components/factory/src/utils/CustomModule.tsx +3 -0
  41. package/lib/h5public/src/components/factory/src/utils/hooks/useFormItem.ts +3 -0
  42. package/lib/h5public/src/hooks/usePageForm.ts +2 -3
  43. package/lib/h5public/src/utils/native.ts +94 -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 +34 -12
  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 +2 -3
  77. package/lib/pcpublic/src/utils/exportCustomData/index.tsx +0 -3
  78. package/lib/pcpublic/src/utils/formUtils.ts +20 -1
  79. package/lib/public/src/hooks/useExportCustomDataFile.ts +4 -0
  80. package/lib/public/src/services/api/index.ts +12 -0
  81. package/lib/public/src/utils/Context/context.tsx +1 -0
  82. package/lib/public/src/utils/historytool.ts +3 -0
  83. package/lib/public/src/utils/lcdpBaseApi.ts +2 -2
  84. package/lib/public/src/utils/platform/utils/fileUtils.ts +12 -11
  85. package/lib/public/src/utils/polyfills.ts +4 -0
  86. package/lib/public/src/utils/popoverUtils.ts +56 -0
  87. package/lib/public/src/utils/service/baseRequest.ts +8 -8
  88. package/lib/public/src/utils/service/urlHelper.ts +2 -0
  89. package/package.json +2 -2
@@ -4,6 +4,7 @@ import React from 'react';
4
4
  export const Context = React.createContext<{
5
5
  ModalManagerRef: React.MutableRefObject<any>;
6
6
  refs: any;
7
+ forceUpdate: any;
7
8
  appId: string;
8
9
  attrDataMap: Record<string, any>;
9
10
  }>({} as any);
@@ -144,6 +144,9 @@ const historytool = (
144
144
  menuUrl: createUrl(true, historyParmas),
145
145
  params: historyParmas.search,
146
146
  });
147
+ } else {
148
+ console.error('未找到门户,使用push跳转');
149
+ historyPush(historyParmas);
147
150
  }
148
151
  break;
149
152
  default:
@@ -2,8 +2,8 @@
2
2
  import { ModalManagerHooks } from '@lingxiteam/types';
3
3
  import copy from 'copy-to-clipboard';
4
4
  import React from 'react';
5
+ import PopoverUtils from './popoverUtils';
5
6
  import api from './service/commonFetch';
6
- // import PopoverUtils from '@/utils/popoverUtils';
7
7
  // import { Interceptor } from "../request";
8
8
  // import type { InterceptorType } from "../request";
9
9
  // import browserCompatible from './browserCompatible';
@@ -50,7 +50,7 @@ class LcdpBaseApi {
50
50
  /**
51
51
  * 收集页面popover引用
52
52
  */
53
- // PopoverManager: PopoverUtils.getInstance(),
53
+ PopoverManager: PopoverUtils.getInstance(),
54
54
  };
55
55
 
56
56
  // 调用接口合集
@@ -4,9 +4,11 @@ import {
4
4
  openProgressMsg,
5
5
  showProgressNotification,
6
6
  } from '@/components/ProgressComp';
7
+ import { APPID } from '@/constants';
7
8
  import engineServices from '@/services/api/engine';
8
9
  import fileServices from '@/services/api/file';
9
10
  import { getAppFileUrlByFileCode } from '@/services/api/getAppFileUrlByFileCode';
11
+ import security from '@/utils/Security';
10
12
  import {
11
13
  BatchDownloadFileByIdsParamsType,
12
14
  DownloadByFileCodeType,
@@ -18,8 +20,6 @@ import {
18
20
  import { isErrorStatus } from '../../service/defaultResponseInterceptor';
19
21
  import { HTTPMehodFn } from '../type';
20
22
 
21
- import security from '@/utils/Security';
22
-
23
23
  type ExportPathMapType = Record<'sql' | 'object' | 'multiExport', string>;
24
24
  type ExportApiMapType = Record<'sql' | 'object' | 'multiExport', HTTPMehodFn>;
25
25
 
@@ -126,6 +126,7 @@ const downloadByXMLHttpRequest = (params: {
126
126
  xhr.responseType = 'blob'; // 设置接受类型
127
127
  const headers: any = {
128
128
  'Content-Type': 'application/json',
129
+ appId: APPID,
129
130
  };
130
131
  Object.keys(headers).forEach((header) => {
131
132
  xhr.setRequestHeader(header, headers[header]); // 设置请求头参数
@@ -144,8 +145,8 @@ const downloadByXMLHttpRequest = (params: {
144
145
  // 展示下载进度条
145
146
  if (evt.lengthComputable && messageApi?.loading) {
146
147
  const percentComplete = Math.round((evt.loaded * 100) / evt.total);
147
- if (typeof messageApi?.openProgressMsg === 'function') {
148
- messageApi.openProgressMsg(
148
+ if (typeof openProgressMsg === 'function') {
149
+ openProgressMsg(
149
150
  downloadIndex,
150
151
  newFileName,
151
152
  percentComplete,
@@ -293,8 +294,8 @@ const exportFileShowProgressAsync: OmitAppIdAndPageId<
293
294
  } else {
294
295
  percent = +((+currentCount / +total) * 100).toFixed(2);
295
296
  }
296
- if (messageApi?.showProgressNotification) {
297
- messageApi.showProgressNotification({
297
+ if (showProgressNotification) {
298
+ showProgressNotification({
298
299
  ...messageConfig,
299
300
  message: showLoading
300
301
  ? undefined
@@ -326,8 +327,8 @@ const exportFileShowProgressAsync: OmitAppIdAndPageId<
326
327
  polledRequest();
327
328
  } else if (statusCd === 10) {
328
329
  onSuccess?.();
329
- if (messageApi?.showProgressNotification) {
330
- messageApi.showProgressNotification({
330
+ if (showProgressNotification) {
331
+ showProgressNotification({
331
332
  ...messageConfig,
332
333
  percent: 100,
333
334
  btn: () => null,
@@ -348,7 +349,7 @@ const exportFileShowProgressAsync: OmitAppIdAndPageId<
348
349
  });
349
350
  }
350
351
  } else if (statusCd === -1) {
351
- messageApi.showProgressNotification({
352
+ showProgressNotification({
352
353
  ...messageConfig,
353
354
  type: 'error',
354
355
  percent,
@@ -439,7 +440,7 @@ const exportFileShowProgress: OmitAppIdAndPageId<
439
440
  'Content-Type': 'application/json',
440
441
  // 'X-B-TARGET-ID': pageId,
441
442
  'X-B-AUTH': '1',
442
- // 'APP-ID': appId,
443
+ // 'APP-ID': APPID,
443
444
  };
444
445
  Object.keys(headers).forEach((header) => {
445
446
  xhr.setRequestHeader(header, headers[header]); // 设置请求头参数
@@ -506,7 +507,7 @@ const exportFileShowProgress: OmitAppIdAndPageId<
506
507
  }
507
508
  xhr.abort(); // 取消请求
508
509
  };
509
- xhr.send(JSON.stringify(params));
510
+ xhr.send(JSON.stringify({ ...params, appId: APPID }));
510
511
  }
511
512
  };
512
513
 
@@ -0,0 +1,4 @@
1
+ // 兼容属性调用Object.keys/ Object.values时 参数为非对象报错
2
+ const { keys, values } = Object;
3
+ Object.keys = (o = {}) => keys(o);
4
+ Object.values = (o = {}) => values(o);
@@ -0,0 +1,56 @@
1
+ export type popoverRef = {
2
+ close: () => void;
3
+ };
4
+
5
+ class PopoverUtils {
6
+ static instance: PopoverUtils;
7
+
8
+ // 根据renderId记录popover引用
9
+ private readonly renderPopoverRef = new Map<string, Set<popoverRef>>();
10
+
11
+ setPopover(ref: popoverRef, renderId: string) {
12
+ if (!this.renderPopoverRef.has(renderId)) {
13
+ this.renderPopoverRef.set(renderId, new Set());
14
+ }
15
+ this.renderPopoverRef.get(renderId)?.add(ref);
16
+ }
17
+
18
+ private close(pagePopoverRef?: Set<popoverRef>) {
19
+ if (pagePopoverRef && pagePopoverRef.size > 0) {
20
+ pagePopoverRef.forEach((ref) => {
21
+ if (ref && typeof ref.close === 'function') {
22
+ ref.close();
23
+ }
24
+ });
25
+ }
26
+ }
27
+
28
+ closePopover(renderId?: string) {
29
+ if (renderId) {
30
+ const pagePopoverRef = this.renderPopoverRef.get(renderId);
31
+ this.close(pagePopoverRef);
32
+ } else {
33
+ this.renderPopoverRef.forEach((val) => {
34
+ this.close(val);
35
+ });
36
+ }
37
+ }
38
+
39
+ removePopover(ref: popoverRef, renderId?: string) {
40
+ if (ref && renderId) {
41
+ const pagePopoverRef = this.renderPopoverRef.get(renderId);
42
+ pagePopoverRef?.delete(ref);
43
+ } else {
44
+ this.renderPopoverRef.clear();
45
+ }
46
+ }
47
+
48
+ static getInstance() {
49
+ if (!this.instance) {
50
+ this.instance = new PopoverUtils();
51
+ }
52
+ return this.instance;
53
+ }
54
+ }
55
+
56
+ export default PopoverUtils;
@@ -1,7 +1,7 @@
1
1
  import { request as baseRequest, RequestOptionsInit } from 'alita';
2
2
  import merge from 'lodash/merge';
3
3
  export interface AppCtxType {
4
- appId: string;
4
+ appId?: string;
5
5
  pageId?: string;
6
6
  language?: string;
7
7
  }
@@ -77,7 +77,7 @@ export const request = (
77
77
  const http = {
78
78
  get: (
79
79
  url: string,
80
- appCtx: AppCtxType,
80
+ appCtx?: AppCtxType,
81
81
  data?: DataType,
82
82
  options?: RequestOptions,
83
83
  ) => {
@@ -85,24 +85,24 @@ const http = {
85
85
  },
86
86
  post: (
87
87
  url: string,
88
- appCtx: AppCtxType,
89
- data: DataType,
88
+ appCtx?: AppCtxType,
89
+ data?: DataType,
90
90
  options?: RequestOptions,
91
91
  ) => {
92
92
  return request('post', url, appCtx, data, options);
93
93
  },
94
94
  put: (
95
95
  url: string,
96
- appCtx: AppCtxType,
97
- data: DataType,
96
+ appCtx?: AppCtxType,
97
+ data?: DataType,
98
98
  options?: RequestOptions,
99
99
  ) => {
100
100
  return request('put', url, appCtx, data, options);
101
101
  },
102
102
  delete: (
103
103
  url: string,
104
- appCtx: AppCtxType,
105
- data: DataType,
104
+ appCtx?: AppCtxType,
105
+ data?: DataType,
106
106
  options?: RequestOptions,
107
107
  ) => {
108
108
  return request('delete', url, appCtx, data, options);
@@ -1,3 +1,4 @@
1
+ import { APPID } from '@/constants';
1
2
  import { isPlainObject } from 'lodash';
2
3
  import http, { AppCtxType } from './baseRequest';
3
4
 
@@ -38,6 +39,7 @@ const urlHelper = {
38
39
  return `${url}?${urlHelper.stringify({
39
40
  ...params,
40
41
  ...appCtx,
42
+ appId: APPID,
41
43
  })}`;
42
44
  },
43
45
  get: (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/ebe-utils",
3
- "version": "0.0.27",
3
+ "version": "0.0.30",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -17,7 +17,7 @@
17
17
  "@babel/parser": "^7.12.12",
18
18
  "@babel/traverse": "^7.12.12",
19
19
  "@babel/types": "^7.12.12",
20
- "@lingxiteam/ebe": "0.0.27",
20
+ "@lingxiteam/ebe": "0.0.30",
21
21
  "cac": "^6.7.14",
22
22
  "fs-extra": "9.x"
23
23
  },