@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,11 +1,13 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import {
|
|
2
|
+
import { clone } from 'lodash';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { useCreation } from '../../utils/ahooks';
|
|
3
5
|
|
|
4
6
|
const TABLE_ZEBRA_STRIPE_TYPE_CODE = 'zebra';
|
|
5
7
|
const TABLE_BORDER_TYPE_CODE = 'border';
|
|
6
8
|
|
|
7
9
|
const useCommon = (props: any) => {
|
|
8
|
-
const { rowKeyType, rowKey, bordered } = props;
|
|
10
|
+
const { rowKeyType, rowKey, bordered, boundDataSource } = props;
|
|
9
11
|
|
|
10
12
|
const state = props.pageState;
|
|
11
13
|
const isBordered =
|
|
@@ -27,12 +29,48 @@ const useCommon = (props: any) => {
|
|
|
27
29
|
setCurrentRowKey(rowKeyType === 'auto' ? '__RowId__' : rowKey);
|
|
28
30
|
}, [rowKeyType, rowKey]);
|
|
29
31
|
|
|
32
|
+
const [replaceBoundDataSource, setReplaceBoundDataSource] = useState(null);
|
|
33
|
+
// 优先取 replaceBoundDataSource
|
|
34
|
+
// 表格外部数据源
|
|
35
|
+
const outerDataSource = replaceBoundDataSource || boundDataSource;
|
|
36
|
+
|
|
37
|
+
const preCloneData = useRef<any>();
|
|
38
|
+
|
|
39
|
+
const outerDataSourceRef = useCreation(() => {
|
|
40
|
+
preCloneData.current = clone(outerDataSource);
|
|
41
|
+
return {
|
|
42
|
+
current: outerDataSource,
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const preOuterDataSourceRef = outerDataSourceRef.current;
|
|
47
|
+
|
|
48
|
+
// 若表格源数据源引用发生变更,则进一步判断
|
|
49
|
+
if (preOuterDataSourceRef !== outerDataSource) {
|
|
50
|
+
/**
|
|
51
|
+
* 简单的通过 JSON.stringify 判断值是否变更
|
|
52
|
+
* 注:正常情况下,表格绑定页面数据数据源,不会走到里面来,理论上不会有多余的 JSON.stringify 性能损耗
|
|
53
|
+
* 目前只针对表格数据源绑定的表达式是“json字符串数组固定数据”的情况,在每次运行态解析DSL时会是一个新的数组
|
|
54
|
+
* 导致表格数据重复更新渲染 -> 外部渲染 -> 死循环
|
|
55
|
+
* 若今后有其他场景被影响到,或者是 表格数据源绑定的表达式是“json字符串数组固定数据” 但数据量巨大的场景,影响到性能,请修正
|
|
56
|
+
*/
|
|
57
|
+
if (
|
|
58
|
+
JSON.stringify(preCloneData.current) !== JSON.stringify(outerDataSource)
|
|
59
|
+
) {
|
|
60
|
+
preCloneData.current = clone(outerDataSource);
|
|
61
|
+
outerDataSourceRef.current = outerDataSource;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
30
65
|
return {
|
|
31
66
|
currentRowKey,
|
|
32
67
|
isBordered,
|
|
33
68
|
isZebraStripe,
|
|
34
69
|
state,
|
|
35
70
|
innerClassName,
|
|
71
|
+
setReplaceBoundDataSource,
|
|
72
|
+
outerDataSourceRef,
|
|
73
|
+
outerDataSource,
|
|
36
74
|
};
|
|
37
75
|
};
|
|
38
76
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { message } from 'antd';
|
|
2
|
-
import { clone } from 'lodash';
|
|
3
2
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { useCreation } from '../../utils/ahooks';
|
|
5
3
|
import {
|
|
6
4
|
createAutoKey,
|
|
7
5
|
createTempRowKey,
|
|
@@ -20,25 +18,13 @@ const useDataSource = (props: any) => {
|
|
|
20
18
|
pagination,
|
|
21
19
|
hasPageChangeEvent,
|
|
22
20
|
getLocale,
|
|
21
|
+
setReplaceBoundDataSource,
|
|
22
|
+
outerDataSource,
|
|
23
|
+
outerDataSourceRef,
|
|
23
24
|
} = props;
|
|
24
25
|
|
|
25
26
|
const [dataSource, setDataSource] = useState<any[]>([]);
|
|
26
27
|
|
|
27
|
-
const [replaceBoundDataSource, setReplaceBoundDataSource] = useState(null);
|
|
28
|
-
// 优先取 replaceBoundDataSource
|
|
29
|
-
const outerDataSource = replaceBoundDataSource || boundDataSource;
|
|
30
|
-
|
|
31
|
-
const preCloneData = useRef<any>();
|
|
32
|
-
|
|
33
|
-
const outerDataSourceRef = useCreation(() => {
|
|
34
|
-
preCloneData.current = clone(outerDataSource);
|
|
35
|
-
return {
|
|
36
|
-
current: outerDataSource,
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
const preOuterDataSourceRef = outerDataSourceRef.current;
|
|
41
|
-
|
|
42
28
|
// 创建id 实例
|
|
43
29
|
const seqId = useMemo(
|
|
44
30
|
() =>
|
|
@@ -48,23 +34,6 @@ const useDataSource = (props: any) => {
|
|
|
48
34
|
[],
|
|
49
35
|
);
|
|
50
36
|
|
|
51
|
-
// 若表格源数据源引用发生变更,则进一步判断
|
|
52
|
-
if (preOuterDataSourceRef !== outerDataSource) {
|
|
53
|
-
/**
|
|
54
|
-
* 简单的通过 JSON.stringify 判断值是否变更
|
|
55
|
-
* 注:正常情况下,表格绑定页面数据数据源,不会走到里面来,理论上不会有多余的 JSON.stringify 性能损耗
|
|
56
|
-
* 目前只针对表格数据源绑定的表达式是“json字符串数组固定数据”的情况,在每次运行态解析DSL时会是一个新的数组
|
|
57
|
-
* 导致表格数据重复更新渲染 -> 外部渲染 -> 死循环
|
|
58
|
-
* 若今后有其他场景被影响到,或者是 表格数据源绑定的表达式是“json字符串数组固定数据” 但数据量巨大的场景,影响到性能,请修正
|
|
59
|
-
*/
|
|
60
|
-
if (
|
|
61
|
-
JSON.stringify(preCloneData.current) !== JSON.stringify(outerDataSource)
|
|
62
|
-
) {
|
|
63
|
-
preCloneData.current = clone(outerDataSource);
|
|
64
|
-
outerDataSourceRef.current = outerDataSource;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
37
|
// 表格当前页数据
|
|
69
38
|
const currentPageDataSource = useMemo(() => {
|
|
70
39
|
// 当 未配置页面回调事件(前端分页) 且 开启分页,需计算当前页的数据有哪些
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useListenProps } from '../../utils';
|
|
4
4
|
import { useLocale } from '../../utils/hooks/useLocale';
|
|
5
5
|
|
|
@@ -15,7 +15,12 @@ const usePagination = (props: any) => {
|
|
|
15
15
|
pageSize: originPageSize,
|
|
16
16
|
showTotal,
|
|
17
17
|
onPageChange,
|
|
18
|
+
outerDataSourceRef,
|
|
19
|
+
boundDataSource,
|
|
20
|
+
engineApis,
|
|
18
21
|
} = props;
|
|
22
|
+
// 是否只更新内部数据源,从3.8.1开始只更新内部数据,不上报到数据源
|
|
23
|
+
const { tableUpdateInnerDataSource } = engineApis?.compatConfig?.cmd || {};
|
|
19
24
|
|
|
20
25
|
// TODO: 有咩有判断是否是前端分页更好的方式?
|
|
21
26
|
const hasPageChangeEvent = typeof onPageChange === 'function'; // 是否配置页码改变回调事件(是:后端分页,否:前端分页)
|
|
@@ -28,6 +33,28 @@ const usePagination = (props: any) => {
|
|
|
28
33
|
const [current, setCurrent] = useListenProps(originCurrent);
|
|
29
34
|
const [pageSize] = useListenProps(originPageSize);
|
|
30
35
|
|
|
36
|
+
const originPagination = useRef<any>({
|
|
37
|
+
total: originTotal,
|
|
38
|
+
current: originCurrent,
|
|
39
|
+
pageSize: originPageSize,
|
|
40
|
+
});
|
|
41
|
+
originPagination.current.total = originTotal;
|
|
42
|
+
originPagination.current.current = originCurrent;
|
|
43
|
+
originPagination.current.pageSize = originPageSize;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (tableUpdateInnerDataSource) {
|
|
46
|
+
const { total: totalRef, current: currentRef } =
|
|
47
|
+
originPagination.current || {};
|
|
48
|
+
// 数据源更新时,将总数和当前页重置成表达式或属性配置的值
|
|
49
|
+
if (totalRef) {
|
|
50
|
+
setTotal(totalRef);
|
|
51
|
+
}
|
|
52
|
+
if (currentRef) {
|
|
53
|
+
setCurrent(currentRef);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [outerDataSourceRef.current, boundDataSource]);
|
|
57
|
+
|
|
31
58
|
// 解析分页选择器配置
|
|
32
59
|
const parsedPageSizeOptions = useMemo(() => {
|
|
33
60
|
if (pageSizeOptions) {
|
|
@@ -52,8 +79,8 @@ const usePagination = (props: any) => {
|
|
|
52
79
|
? (total: number) => getLocale('Pagination.showTotal', { tol: total })
|
|
53
80
|
: undefined,
|
|
54
81
|
// TODO: 这里目前存在一个问题,若配置了空的分页事件,自动认为是后端分页,实际上
|
|
55
|
-
current: hasPageChangeEvent ? paginationCurrent : currentPage,
|
|
56
|
-
pageSize: hasPageChangeEvent ? paginationPageSize : currentPageSize,
|
|
82
|
+
current: (hasPageChangeEvent ? paginationCurrent : currentPage) || 1,
|
|
83
|
+
pageSize: (hasPageChangeEvent ? paginationPageSize : currentPageSize) || 10,
|
|
57
84
|
total: Number(total) || undefined,
|
|
58
85
|
showQuickJumper,
|
|
59
86
|
showSizeChanger,
|
|
@@ -27,11 +27,15 @@ const useRowEdit = (props: any) => {
|
|
|
27
27
|
onRowDoubleClick,
|
|
28
28
|
onBeforeInlineEdit,
|
|
29
29
|
onBeforeInlineSave,
|
|
30
|
+
engineApis,
|
|
30
31
|
} = props;
|
|
31
32
|
|
|
32
33
|
const [nowInlineEditKey, setNowInlineEditKey] = useState<string | null>();
|
|
33
34
|
const [nowEditingData, setNowEditingData] = useState<any | null>();
|
|
34
35
|
|
|
36
|
+
// 是否只更新内部数据源,从3.8.1开始只更新内部数据源
|
|
37
|
+
const { tableUpdateInnerDataSource } = engineApis?.compatConfig?.cmd || {};
|
|
38
|
+
|
|
35
39
|
const onRowSaveClick = (row: any, index: number | null, isForce: any) => {
|
|
36
40
|
// 保存行内编辑行方法
|
|
37
41
|
// 这个同时处理用于自带的行内编辑保存按钮,和指令的强制保存的情况
|
|
@@ -57,12 +61,14 @@ const useRowEdit = (props: any) => {
|
|
|
57
61
|
Object.assign(trow, nowEditingData);
|
|
58
62
|
deleteTempRowProperties(trow);
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if (!tableUpdateInnerDataSource) {
|
|
65
|
+
// 单行保存编辑时,需要将修改后的值同步到绑定的数据源
|
|
66
|
+
const syncPropsDataSourceRow = props.dataSource?.find(
|
|
67
|
+
(r: any) => r[currentRowKey] === nowInlineEditKey,
|
|
68
|
+
);
|
|
69
|
+
Object.assign(syncPropsDataSourceRow, nowEditingData);
|
|
70
|
+
deleteTempRowProperties(syncPropsDataSourceRow);
|
|
71
|
+
}
|
|
66
72
|
|
|
67
73
|
setInnerDataSource([...innerDataSource]);
|
|
68
74
|
|
|
@@ -121,7 +127,11 @@ const useRowEdit = (props: any) => {
|
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
// 倘若绑定了数据源,需要通过引用的方式,移除对应的临时数据
|
|
124
|
-
if (
|
|
130
|
+
if (
|
|
131
|
+
isLatestCreationTempRow &&
|
|
132
|
+
dataSourceFromDataSourceConfig &&
|
|
133
|
+
!tableUpdateInnerDataSource
|
|
134
|
+
) {
|
|
125
135
|
const targetIndex = innerDataSource.findIndex(
|
|
126
136
|
(i: any) =>
|
|
127
137
|
row?.[EMPTY_ROW_TEMP_KEY_ATTR] === i?.[EMPTY_ROW_TEMP_KEY_ATTR],
|
|
@@ -167,10 +177,13 @@ const useRowEdit = (props: any) => {
|
|
|
167
177
|
const editRow = innerDataSource.find(
|
|
168
178
|
(r: any) => r[currentRowKey] === row[currentRowKey],
|
|
169
179
|
);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
let syncPropsDataSourceRow: Record<string, any> = {};
|
|
181
|
+
if (!tableUpdateInnerDataSource) {
|
|
182
|
+
// 整表编辑时,需要将修改后的值同步到绑定的数据源
|
|
183
|
+
syncPropsDataSourceRow = outerDataSource?.find(
|
|
184
|
+
(r: any) => r[currentRowKey] === row[currentRowKey],
|
|
185
|
+
);
|
|
186
|
+
}
|
|
174
187
|
|
|
175
188
|
editRow[attr] = newAttrVal;
|
|
176
189
|
syncPropsDataSourceRow[attr] = newAttrVal;
|
|
@@ -196,13 +209,18 @@ const useRowEdit = (props: any) => {
|
|
|
196
209
|
|
|
197
210
|
// 当处于编辑状态时,需要过滤来自编辑控件内部触发的 click
|
|
198
211
|
while (target?.className !== curentTarget?.className) {
|
|
212
|
+
if (!target) break;
|
|
213
|
+
// 非当前行内元素,不再遍历
|
|
214
|
+
if (!curentTarget.contains(target)) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
199
217
|
if (
|
|
200
218
|
typeof target?.className === 'string' &&
|
|
201
219
|
target.className.includes(EDIT_COMPONENT_STOP_PROPAGATION_CLS)
|
|
202
220
|
) {
|
|
203
221
|
return true;
|
|
204
222
|
}
|
|
205
|
-
target = target
|
|
223
|
+
target = target?.parentNode as HTMLBaseElement;
|
|
206
224
|
}
|
|
207
225
|
|
|
208
226
|
if (onRowClick) {
|
|
@@ -221,6 +239,12 @@ const useRowEdit = (props: any) => {
|
|
|
221
239
|
// 当处于编辑状态时,需要过滤来自编辑控件内部触发的 doubleclick
|
|
222
240
|
let stopDoubleClick = false;
|
|
223
241
|
while (target?.className !== curentTarget?.className) {
|
|
242
|
+
if (!target) break;
|
|
243
|
+
// 非当前行内元素,不再遍历,不触发点击事件
|
|
244
|
+
if (!curentTarget.contains(target)) {
|
|
245
|
+
stopDoubleClick = true;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
224
248
|
if (
|
|
225
249
|
typeof target?.className === 'string' &&
|
|
226
250
|
target.className.includes(EDIT_COMPONENT_STOP_PROPAGATION_CLS)
|
|
@@ -228,7 +252,7 @@ const useRowEdit = (props: any) => {
|
|
|
228
252
|
stopDoubleClick = true;
|
|
229
253
|
break;
|
|
230
254
|
}
|
|
231
|
-
target = target
|
|
255
|
+
target = target?.parentNode as HTMLBaseElement;
|
|
232
256
|
}
|
|
233
257
|
|
|
234
258
|
if (!stopDoubleClick) {
|
|
@@ -90,7 +90,10 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
90
90
|
currentRowKey,
|
|
91
91
|
isBordered,
|
|
92
92
|
innerClassName,
|
|
93
|
-
|
|
93
|
+
setReplaceBoundDataSource,
|
|
94
|
+
outerDataSource,
|
|
95
|
+
outerDataSourceRef,
|
|
96
|
+
} = useCommon({ ...props, boundDataSource });
|
|
94
97
|
|
|
95
98
|
const {
|
|
96
99
|
page,
|
|
@@ -101,13 +104,16 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
101
104
|
setCurrentPage,
|
|
102
105
|
setCurrentPageSize,
|
|
103
106
|
onPageChange,
|
|
104
|
-
} = usePagination(
|
|
107
|
+
} = usePagination({
|
|
108
|
+
...props,
|
|
109
|
+
outerDataSourceRef,
|
|
110
|
+
boundDataSource,
|
|
111
|
+
engineApis,
|
|
112
|
+
});
|
|
105
113
|
|
|
106
114
|
const {
|
|
107
115
|
innerDataSource,
|
|
108
116
|
setInnerDataSource,
|
|
109
|
-
outerDataSource,
|
|
110
|
-
outerDataSourceRef,
|
|
111
117
|
setOuterDataSource,
|
|
112
118
|
currentPageDataSource,
|
|
113
119
|
} = useDataSource({
|
|
@@ -119,6 +125,9 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
119
125
|
pagination,
|
|
120
126
|
hasPageChangeEvent,
|
|
121
127
|
getLocale,
|
|
128
|
+
setReplaceBoundDataSource,
|
|
129
|
+
outerDataSource,
|
|
130
|
+
outerDataSourceRef,
|
|
122
131
|
});
|
|
123
132
|
|
|
124
133
|
const {
|
|
@@ -200,6 +209,7 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
200
209
|
currentRowKey,
|
|
201
210
|
selectedRows,
|
|
202
211
|
onRowSelected,
|
|
212
|
+
engineApis,
|
|
203
213
|
});
|
|
204
214
|
|
|
205
215
|
const { rowSpanColMap, rowSpanMap, rowClassMap } = useRowMerge({
|
|
@@ -241,6 +251,7 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
241
251
|
onRowSelected,
|
|
242
252
|
onRowSaveClick,
|
|
243
253
|
loadPrint,
|
|
254
|
+
engineApis,
|
|
244
255
|
});
|
|
245
256
|
|
|
246
257
|
// 根据id获取真实的下标,避免过滤和排序后影响下标
|
|
@@ -142,10 +142,12 @@ const MyTabs = LingxiForwardRef<any, MyTabsProps>((props, ref) => {
|
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
return (
|
|
145
|
+
// tab={c?.props.schema?.props?.tab || c?.props?.tab} 兼容转源码
|
|
145
146
|
<TabPane
|
|
146
147
|
forceRender
|
|
147
148
|
{...(c?.props.schema?.props || {})}
|
|
148
149
|
key={key}
|
|
150
|
+
tab={c?.props.schema?.props?.tab || c?.props?.tab}
|
|
149
151
|
{...extendProps}
|
|
150
152
|
>
|
|
151
153
|
<ChannelContainer.Item
|
|
@@ -15,11 +15,11 @@ export interface MyTagProps extends TagProps {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const MyTag = LingxiForwardRef<any, MyTagProps>((props, ref) => {
|
|
18
|
-
const { name, visible = true, title, ...restProps } = props;
|
|
18
|
+
const { name, visible = true, title, $$componentItem, ...restProps } = props;
|
|
19
19
|
|
|
20
20
|
return visible ? (
|
|
21
21
|
<WrapperTag>
|
|
22
|
-
<div>
|
|
22
|
+
<div key={$$componentItem.uid}>
|
|
23
23
|
<Tag
|
|
24
24
|
{...restProps}
|
|
25
25
|
color={restProps?.tagType?.color || restProps.color}
|
|
@@ -58,12 +58,18 @@ const TreeTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
58
58
|
const appId = props?.appId || $$componentItem?.appId;
|
|
59
59
|
const pageId = props?.pageId || $$componentItem?.pageId;
|
|
60
60
|
|
|
61
|
-
const {
|
|
61
|
+
const {
|
|
62
|
+
currentRowKey,
|
|
63
|
+
isBordered,
|
|
64
|
+
innerClassName,
|
|
65
|
+
setReplaceBoundDataSource,
|
|
66
|
+
outerDataSource,
|
|
67
|
+
outerDataSourceRef,
|
|
68
|
+
} = useCommon({ ...props, boundDataSource });
|
|
62
69
|
|
|
63
70
|
const {
|
|
64
71
|
innerDataSource,
|
|
65
72
|
setInnerDataSource,
|
|
66
|
-
outerDataSource,
|
|
67
73
|
setOuterDataSource,
|
|
68
74
|
currentPageDataSource,
|
|
69
75
|
} = useDataSource({
|
|
@@ -71,6 +77,9 @@ const TreeTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
71
77
|
compId,
|
|
72
78
|
currentRowKey,
|
|
73
79
|
boundDataSource,
|
|
80
|
+
setReplaceBoundDataSource,
|
|
81
|
+
outerDataSource,
|
|
82
|
+
outerDataSourceRef,
|
|
74
83
|
});
|
|
75
84
|
|
|
76
85
|
// 根据id获取真实的下标,避免过滤和排序后影响下标
|
|
@@ -124,6 +133,7 @@ const TreeTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
124
133
|
currentRowKey,
|
|
125
134
|
selectedRows,
|
|
126
135
|
onRowSelected,
|
|
136
|
+
engineApis,
|
|
127
137
|
});
|
|
128
138
|
|
|
129
139
|
const {
|
|
@@ -157,6 +167,7 @@ const TreeTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
157
167
|
setChildrenColumnName,
|
|
158
168
|
onRowSelected,
|
|
159
169
|
setMode,
|
|
170
|
+
engineApis,
|
|
160
171
|
});
|
|
161
172
|
|
|
162
173
|
const {
|
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
& > .@{ant-prefix}-collapse-header {
|
|
16
16
|
border-radius: 0;
|
|
17
|
-
padding:
|
|
17
|
+
padding: 0;
|
|
18
18
|
background-color: transparent;
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-direction: row-reverse;
|
|
21
21
|
align-items: center;
|
|
22
|
-
padding-right: @padding-sm;
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
.@{ant-prefix}-collapse-expand-icon {
|
|
@@ -45,8 +44,9 @@
|
|
|
45
44
|
position: relative;
|
|
46
45
|
display: flex;
|
|
47
46
|
align-items: center;
|
|
48
|
-
padding: 0 @padding-xs;
|
|
47
|
+
padding: 0 @padding-xs 0 0;
|
|
49
48
|
&-icon-line {
|
|
49
|
+
// padding: @padding-xs @padding-xs @padding-xs 0;
|
|
50
50
|
&::before {
|
|
51
51
|
content: '';
|
|
52
52
|
background-color: @primary-color;
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
> i,
|
|
79
|
-
span
|
|
79
|
+
span,
|
|
80
|
+
img {
|
|
80
81
|
margin-right: @padding-xxs;
|
|
81
82
|
color: @primary-color;
|
|
82
83
|
}
|
|
@@ -101,6 +102,9 @@
|
|
|
101
102
|
& > .@{ant-prefix}-collapse-content {
|
|
102
103
|
border-top: 1px solid @border-color-base;
|
|
103
104
|
}
|
|
105
|
+
.ued-form-group-title {
|
|
106
|
+
padding: 4px 8px 4px 0;
|
|
107
|
+
}
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
&-extend-btn {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
border-radius: @border-radius-base;
|
|
18
18
|
}
|
|
19
19
|
&.@{stdupload-prefix-cls}-disabled {
|
|
20
|
-
display: block
|
|
20
|
+
display: block;
|
|
21
21
|
.@{ant-prefix}-btn {
|
|
22
22
|
cursor: not-allowed;
|
|
23
23
|
background-color: #f5f8fa;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
border: 1px dashed @border-color-base;
|
|
34
34
|
border-radius: @border-radius-base;
|
|
35
35
|
&.@{stdupload-prefix-cls}-disabled {
|
|
36
|
-
display: inline-block
|
|
36
|
+
display: inline-block;
|
|
37
37
|
cursor: not-allowed;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
border-radius: @border-radius-base;
|
|
46
46
|
|
|
47
47
|
&.@{stdupload-prefix-cls}-disabled {
|
|
48
|
-
display: block
|
|
48
|
+
display: block;
|
|
49
49
|
cursor: not-allowed;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -361,6 +361,20 @@ const IconCheckSvg = getSvgImageBase64(
|
|
|
361
361
|
'<?xml version="1.0" encoding="UTF-8"?><svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><title>全局样式:20/原子级控件/复选/状态:#选中</title><g id="控件" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g id="system-complete"><path d="M11,0 C17.075904,0 22,4.92409598 22,11 C22,17.075904 17.0734732,22 11,22 C4.92652679,22 0,17.0734732 0,11 C0,4.92652679 4.92409598,0 11,0 Z" id="Shape" fill="#1890FF"></path><path d="M9.42871875,12.9681652 L7.2069029,10.7463493 C6.90006126,10.4395077 6.40257267,10.4395077 6.09573103,10.7463493 C5.78889035,11.05319 5.78889035,11.550677 6.09573103,11.8575177 C6.09573161,11.8575183 6.0957322,11.8575189 6.09573278,11.8575195 L8.72212536,14.4838955 C9.11265701,14.8744045 9.74581424,14.874407 10.136349,14.483901 L10.5404063,14.0798527 L10.5404063,14.0798527 L16.2813591,8.33795955 C16.588183,8.03108543 16.5881626,7.53359119 16.2813136,7.22674219 C15.974472,6.91990055 15.4769834,6.91990055 15.1701417,7.22674219 L9.42871875,12.9681652 L9.42871875,12.9681652 Z" id="Path" fill="#FFFFFF"></path></g></g></svg>',
|
|
362
362
|
);
|
|
363
363
|
|
|
364
|
+
const getDynamicProperty = (str: string) => {
|
|
365
|
+
const patterns = ['data.', 'globalData.', 'state.'];
|
|
366
|
+
|
|
367
|
+
// eslint-disable-next-line no-plusplus
|
|
368
|
+
for (let index = 0; index < patterns.length; index++) {
|
|
369
|
+
const pattern = patterns[index];
|
|
370
|
+
if (str.includes(pattern)) {
|
|
371
|
+
return pattern.slice(0, -1);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
// 如果都不包含,返回 null
|
|
375
|
+
return undefined;
|
|
376
|
+
};
|
|
377
|
+
|
|
364
378
|
export {
|
|
365
379
|
flatTree,
|
|
366
380
|
deepCopy,
|
|
@@ -380,4 +394,5 @@ export {
|
|
|
380
394
|
IconCheckSvg,
|
|
381
395
|
IconNormalCheckSvg,
|
|
382
396
|
IconWebViewErrorSvg,
|
|
397
|
+
getDynamicProperty,
|
|
383
398
|
};
|
|
@@ -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
|
* 获取当前表单值
|
|
@@ -121,11 +121,12 @@ const usePageForm = (refs: Record<string, any>) => {
|
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
forms.forEach((form) => {
|
|
124
|
-
form?.setFieldsValue(formValues);
|
|
124
|
+
form?.setFieldsValue(formValues, refs);
|
|
125
125
|
});
|
|
126
126
|
} else {
|
|
127
|
-
refs[compId]?.setFieldsValue?.(formValues);
|
|
127
|
+
refs[compId]?.setFieldsValue?.(formValues, refs);
|
|
128
128
|
}
|
|
129
|
+
forceUpdate({});
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
/**
|