@lingxiteam/ebe-utils 0.2.22 → 0.2.24
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/yarn.lock +7 -8
- package/lib/pcpublic/src/components/pcfactory/src/Button/index.tsx +11 -10
- package/lib/pcpublic/src/components/pcfactory/src/Card/CardTitle/index.tsx +31 -24
- package/lib/pcpublic/src/components/pcfactory/src/Card/index.tsx +32 -14
- package/lib/pcpublic/src/components/pcfactory/src/Card/useExtendBtn.tsx +85 -48
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/ChartLine.tsx +24 -6
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/PropsType.ts +31 -5
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/index.tsx +3 -2
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +153 -129
- package/lib/pcpublic/src/components/pcfactory/src/Form/index.tsx +2 -5
- package/lib/pcpublic/src/components/pcfactory/src/Form/useFormStatus.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +15 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/PropsType.ts +4 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +18 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/PropsType.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Layout/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
- package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
- package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
- package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
- package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
- package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
- package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
- package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
- package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
- package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
- package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
- package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +6 -4
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
- package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
- package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
- package/lib/public/public/iconfont.js +1 -0
- package/package.json +2 -2
|
@@ -1,82 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-underscore-dangle */
|
|
6
|
-
import { Form, Table } from 'antd';
|
|
7
|
-
import classnames from 'classnames';
|
|
8
|
-
import React, { useMemo, useRef } from 'react';
|
|
9
|
-
import { PrintContainer, usePrintMode } from '../utils';
|
|
10
|
-
import { useCreation } from '../utils/ahooks';
|
|
11
|
-
import EmptyComp from '../utils/Empty';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
3
|
+
import { Form } from 'antd';
|
|
4
|
+
import { usePrintMode } from '../utils';
|
|
12
5
|
import { useFuncExpExecute } from '../utils/hooks/useFuncExpExecute';
|
|
13
6
|
import { useLocale } from '../utils/hooks/useLocale';
|
|
14
|
-
import BodyCell from './BodyCell';
|
|
15
|
-
import HeaderCell from './HeaderCell';
|
|
16
7
|
import {
|
|
17
8
|
useCMDAction,
|
|
18
|
-
useColumns,
|
|
19
9
|
useCommon,
|
|
20
10
|
useDataSource,
|
|
21
11
|
useExpandable,
|
|
22
12
|
useFilter,
|
|
23
13
|
usePagination,
|
|
24
14
|
useRowEdit,
|
|
25
|
-
useRowMerge,
|
|
26
|
-
useScroll,
|
|
27
15
|
useSelection,
|
|
28
16
|
useSort,
|
|
29
17
|
} from './hooks';
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import type { MyTableProps } from './types/prop';
|
|
33
|
-
|
|
34
|
-
// const prefixCls = 'table';
|
|
35
|
-
|
|
36
|
-
const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
37
|
-
const { dataSource: boundDataSource, visible = true, style: styles, className, onChange, $$componentItem, getEngineApis, ...restProps } = props;
|
|
18
|
+
import TableLoader from './loader';
|
|
19
|
+
import IdleContainer from '../utils/IdleContainer';
|
|
38
20
|
|
|
21
|
+
const Table = LingxiForwardRef<unknown, any>((props, ref) => {
|
|
22
|
+
const { dataSource: boundDataSource, $$componentItem, getEngineApis } = props;
|
|
39
23
|
const { uid: compId } = $$componentItem;
|
|
40
|
-
const { size, sortDirections, sticky, summary, tableLayout, title, rowClassName, showHeader = true } = restProps || {};
|
|
41
|
-
const tableProps = {
|
|
42
|
-
size,
|
|
43
|
-
sortDirections,
|
|
44
|
-
sticky,
|
|
45
|
-
summary,
|
|
46
|
-
tableLayout,
|
|
47
|
-
title,
|
|
48
|
-
rowClassName,
|
|
49
|
-
} as any;
|
|
50
|
-
const [form] = Form.useForm();
|
|
51
24
|
|
|
25
|
+
const [form] = Form.useForm();
|
|
52
26
|
const engineApis = getEngineApis?.();
|
|
53
|
-
const { sandBoxSafeRun, renderBusiComponent, dataState } = engineApis || {};
|
|
54
|
-
|
|
55
27
|
const { getLocale } = useLocale(engineApis || {});
|
|
28
|
+
const { sandBoxSafeRun, renderBusiComponent } = engineApis || {};
|
|
56
29
|
|
|
57
30
|
const funcExpExecute = useFuncExpExecute(sandBoxSafeRun as any, getLocale);
|
|
58
|
-
|
|
59
|
-
const appId = props?.appId || $$componentItem?.appId;
|
|
60
|
-
const pageId = props?.pageId || $$componentItem?.pageId;
|
|
61
|
-
|
|
31
|
+
const commonProps = useCommon({ ...props, boundDataSource });
|
|
62
32
|
const {
|
|
63
|
-
// state, // TODO: 不知道啥时候用的,eval?
|
|
64
33
|
currentRowKey,
|
|
65
|
-
isBordered,
|
|
66
|
-
innerClassName,
|
|
67
34
|
setReplaceBoundDataSource,
|
|
68
35
|
outerDataSource,
|
|
69
36
|
outerDataSourceRef,
|
|
70
|
-
} =
|
|
37
|
+
} = commonProps;
|
|
71
38
|
|
|
72
|
-
const
|
|
39
|
+
const pageProps = usePagination({
|
|
73
40
|
...props,
|
|
74
41
|
outerDataSourceRef,
|
|
75
42
|
boundDataSource,
|
|
76
43
|
engineApis,
|
|
77
44
|
});
|
|
45
|
+
const {
|
|
46
|
+
page,
|
|
47
|
+
pagination,
|
|
48
|
+
hasPageChangeEvent,
|
|
49
|
+
setCurrent,
|
|
50
|
+
setTotal,
|
|
51
|
+
setCurrentPage,
|
|
52
|
+
} = pageProps;
|
|
78
53
|
|
|
79
|
-
const
|
|
54
|
+
const dataSourceProps = useDataSource({
|
|
80
55
|
...props,
|
|
81
56
|
compId,
|
|
82
57
|
currentRowKey,
|
|
@@ -90,25 +65,31 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
90
65
|
outerDataSourceRef,
|
|
91
66
|
setCurrentPage,
|
|
92
67
|
});
|
|
68
|
+
const {
|
|
69
|
+
innerDataSource,
|
|
70
|
+
setInnerDataSource,
|
|
71
|
+
setOuterDataSource,
|
|
72
|
+
currentPageDataSource,
|
|
73
|
+
setTableRowKey,
|
|
74
|
+
} = dataSourceProps;
|
|
93
75
|
|
|
94
|
-
const
|
|
76
|
+
const filterProps = useFilter({
|
|
95
77
|
compId,
|
|
96
78
|
innerDataSource,
|
|
97
79
|
currentRowKey,
|
|
98
80
|
getLocale,
|
|
99
81
|
outerDataSourceRef,
|
|
82
|
+
pagination,
|
|
100
83
|
});
|
|
84
|
+
const { checkIfHiddenRow, filterDataSource } = filterProps;
|
|
101
85
|
|
|
102
|
-
const
|
|
86
|
+
const sortProps = useSort({
|
|
103
87
|
...props,
|
|
104
88
|
innerDataSource: filterDataSource,
|
|
105
89
|
});
|
|
90
|
+
const { sortDataSource } = sortProps;
|
|
106
91
|
|
|
107
|
-
const {
|
|
108
|
-
expandable: realExpandable,
|
|
109
|
-
expandTableData,
|
|
110
|
-
hasExpandContent,
|
|
111
|
-
} = useExpandable({
|
|
92
|
+
const expandProps = useExpandable({
|
|
112
93
|
...props,
|
|
113
94
|
dataSource: sortDataSource,
|
|
114
95
|
currentRowKey,
|
|
@@ -117,9 +98,20 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
117
98
|
funcExpExecute,
|
|
118
99
|
engineApis,
|
|
119
100
|
});
|
|
101
|
+
const { expandable: realExpandable, expandTableData } = expandProps;
|
|
120
102
|
|
|
103
|
+
const selectionProps = useSelection({
|
|
104
|
+
...props,
|
|
105
|
+
innerDataSource,
|
|
106
|
+
currentRowKey,
|
|
107
|
+
currentPageDataSource,
|
|
108
|
+
checkIfHiddenRow,
|
|
109
|
+
page,
|
|
110
|
+
hasPageChangeEvent,
|
|
111
|
+
funcExpExecute,
|
|
112
|
+
expandable: realExpandable,
|
|
113
|
+
});
|
|
121
114
|
const {
|
|
122
|
-
rowSelection,
|
|
123
115
|
selectedRows,
|
|
124
116
|
selectedRowKeys,
|
|
125
117
|
currentPageSelectedRows,
|
|
@@ -130,35 +122,9 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
130
122
|
setCurrentPageSelectedRowKeys,
|
|
131
123
|
setSelectedRowsRule,
|
|
132
124
|
onRowSelected,
|
|
133
|
-
|
|
134
|
-
} = useSelection({
|
|
135
|
-
...props,
|
|
136
|
-
innerDataSource,
|
|
137
|
-
currentRowKey,
|
|
138
|
-
currentPageDataSource,
|
|
139
|
-
checkIfHiddenRow,
|
|
140
|
-
page,
|
|
141
|
-
hasPageChangeEvent,
|
|
142
|
-
funcExpExecute,
|
|
143
|
-
expandable: realExpandable,
|
|
144
|
-
});
|
|
125
|
+
} = selectionProps;
|
|
145
126
|
|
|
146
|
-
const {
|
|
147
|
-
nowInlineEditKey,
|
|
148
|
-
nowEditingData,
|
|
149
|
-
editInlineRow,
|
|
150
|
-
setNowEditingData,
|
|
151
|
-
setNowInlineEditKey,
|
|
152
|
-
onRowAttrValsChange,
|
|
153
|
-
onRowSaveClick,
|
|
154
|
-
onRowCancelClick,
|
|
155
|
-
onRowDeleteClick,
|
|
156
|
-
onRowEditClick,
|
|
157
|
-
onRowDetailClick,
|
|
158
|
-
onRowClick,
|
|
159
|
-
onRowDoubleClick,
|
|
160
|
-
handleIsRowEditableCanUse,
|
|
161
|
-
} = useRowEdit({
|
|
127
|
+
const editProps = useRowEdit({
|
|
162
128
|
...props,
|
|
163
129
|
funcExpExecute,
|
|
164
130
|
innerDataSource,
|
|
@@ -171,17 +137,16 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
171
137
|
compId,
|
|
172
138
|
form,
|
|
173
139
|
});
|
|
140
|
+
const {
|
|
141
|
+
editInlineRow,
|
|
142
|
+
setNowEditingData,
|
|
143
|
+
setNowInlineEditKey,
|
|
144
|
+
onRowSaveClick,
|
|
145
|
+
} = editProps;
|
|
174
146
|
|
|
175
|
-
const {
|
|
176
|
-
...props,
|
|
177
|
-
currentPageDataSource,
|
|
178
|
-
nowInlineEditKey,
|
|
179
|
-
currentRowKey,
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
const { showPrintContainer, loadPrint, selectorKey, printData } = usePrintMode(props.$$componentItem.uid);
|
|
147
|
+
const { loadPrint } = usePrintMode(props.$$componentItem.uid);
|
|
183
148
|
|
|
184
|
-
const
|
|
149
|
+
const cmdProps = useCMDAction({
|
|
185
150
|
...props,
|
|
186
151
|
ref,
|
|
187
152
|
form,
|
|
@@ -215,309 +180,23 @@ const MyTable = React.forwardRef<any, MyTableProps>((props, ref) => {
|
|
|
215
180
|
setTableRowKey,
|
|
216
181
|
});
|
|
217
182
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
indexMap.set(id, index);
|
|
229
|
-
}
|
|
230
|
-
return index;
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
}, [innerDataSource, currentRowKey]);
|
|
234
|
-
|
|
235
|
-
const {
|
|
236
|
-
tableRef,
|
|
237
|
-
finalcolumns,
|
|
238
|
-
customizableCols,
|
|
239
|
-
customSelectedCols,
|
|
240
|
-
setCustomSelectedCols,
|
|
241
|
-
setColCustomOrder,
|
|
242
|
-
columnWidth,
|
|
243
|
-
setColumnWidth,
|
|
244
|
-
initLoadColWidth,
|
|
245
|
-
printColumns,
|
|
246
|
-
fixedAction,
|
|
247
|
-
} = useColumns({
|
|
248
|
-
...props,
|
|
249
|
-
sandBoxSafeRun,
|
|
250
|
-
funcExpExecute,
|
|
251
|
-
engineApis,
|
|
183
|
+
const innerProps = {
|
|
184
|
+
...commonProps,
|
|
185
|
+
...pageProps,
|
|
186
|
+
...dataSourceProps,
|
|
187
|
+
...filterProps,
|
|
188
|
+
...sortProps,
|
|
189
|
+
...expandProps,
|
|
190
|
+
...selectionProps,
|
|
191
|
+
...editProps,
|
|
192
|
+
...cmdProps,
|
|
252
193
|
form,
|
|
253
|
-
appId,
|
|
254
|
-
pageId,
|
|
255
|
-
compId,
|
|
256
|
-
innerDataSource,
|
|
257
|
-
currentRowKey,
|
|
258
|
-
nowInlineEditKey,
|
|
259
|
-
nowEditingData,
|
|
260
|
-
colServiceData,
|
|
261
|
-
colServiceDataForEdit,
|
|
262
|
-
hasSortEvent,
|
|
263
|
-
page,
|
|
264
|
-
pagination,
|
|
265
|
-
rowSpanMap,
|
|
266
|
-
rowClassMap,
|
|
267
|
-
rowSpanColMap,
|
|
268
|
-
onRowDetailClick,
|
|
269
|
-
onRowDeleteClick,
|
|
270
|
-
onRowEditClick,
|
|
271
|
-
onRowSaveClick,
|
|
272
|
-
onRowCancelClick,
|
|
273
|
-
onRowAttrValsChange,
|
|
274
|
-
loading,
|
|
275
|
-
handleIsRowEditableCanUse,
|
|
276
|
-
filters,
|
|
277
|
-
filterDropdownOpen,
|
|
278
|
-
onFilterDropdownVisibleChange,
|
|
279
|
-
renderFilterDropDown,
|
|
280
|
-
rowSelection,
|
|
281
|
-
getLocale,
|
|
282
|
-
getRealIndexById,
|
|
283
|
-
childrenColumnName: realExpandable.childrenColumnName,
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
const {
|
|
287
|
-
scroll,
|
|
288
|
-
tableWrapRef,
|
|
289
|
-
// initTableWrapWidthRef,
|
|
290
|
-
// getTableWrapWidth,
|
|
291
|
-
} = useScroll({
|
|
292
|
-
...props,
|
|
293
|
-
initLoadColWidth,
|
|
294
|
-
finalcolumns,
|
|
295
|
-
columnWidth,
|
|
296
|
-
setColumnWidth,
|
|
297
|
-
sortDataSource,
|
|
298
|
-
pageId,
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
const superSelectTranslationMapRef: any = useRef(); // 防止state更新不及时,导致翻译无法获取翻译数据
|
|
302
|
-
if (!superSelectTranslationMapRef.current) {
|
|
303
|
-
superSelectTranslationMapRef.current = {};
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
const innerTableStyle: any = {};
|
|
307
|
-
if (styles?.overflowY) {
|
|
308
|
-
// 通过自定义样式给表格设置y轴滚动时, 认为希望只有表格滚动,但分页栏固定在底部
|
|
309
|
-
innerTableStyle.overflowY = styles.overflowY;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const handleTableChange = (newPagination: any, newFilters: any, newSorter: any, newExtra: any) => {
|
|
313
|
-
if (typeof onChange === 'function') {
|
|
314
|
-
onChange(newPagination, newFilters, newSorter, newExtra);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (newExtra.action === 'paginate') {
|
|
318
|
-
if (hasPageChangeEvent) {
|
|
319
|
-
onPageChange(
|
|
320
|
-
newPagination?.current,
|
|
321
|
-
newPagination?.pageSize,
|
|
322
|
-
newSorter?.order === 'ascend' ? newSorter?.field : undefined,
|
|
323
|
-
newSorter?.order === 'descend' ? newSorter?.field : undefined
|
|
324
|
-
);
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
setCurrentPage(newPagination?.current);
|
|
329
|
-
setCurrentPageSize(newPagination?.pageSize);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (newExtra.action === 'sort' && hasSortEvent) {
|
|
333
|
-
// order 取值 ['ascend', 'descend']
|
|
334
|
-
const { field: colName, order } = newSorter;
|
|
335
|
-
if (order === 'ascend') {
|
|
336
|
-
onSortChange(colName, undefined, newPagination?.pageSize);
|
|
337
|
-
} else if (order === 'descend') {
|
|
338
|
-
onSortChange(undefined, colName, newPagination?.pageSize);
|
|
339
|
-
} else {
|
|
340
|
-
onSortChange(undefined, undefined, newPagination?.pageSize);
|
|
341
|
-
}
|
|
342
|
-
} else if (Object.keys(rowSpanColMap).length > 0) {
|
|
343
|
-
if (newSorter?.field) {
|
|
344
|
-
setSortOrder(newSorter);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
194
|
};
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
// const tableWidth = getTableWrapWidth();
|
|
354
|
-
// if (tableWrapRef.current && tableWidth) {
|
|
355
|
-
// const realTableWidth = tableWidth >= initTableWrapWidthRef.current - 10 ? initTableWrapWidthRef.current - 9 : tableWidth;
|
|
356
|
-
// tmpStyle.width = `${realTableWidth}px`;
|
|
357
|
-
// }
|
|
358
|
-
// return tmpStyle;
|
|
359
|
-
// }, [columnWidth]);
|
|
360
|
-
|
|
361
|
-
const eleProps = {
|
|
362
|
-
appId,
|
|
363
|
-
pageId,
|
|
364
|
-
'data-compid': (props as any)?.['data-compid'],
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
const isEmptyLoading = useMemo(() => loading && sortDataSource?.length === 0, [loading, sortDataSource]);
|
|
368
|
-
|
|
369
|
-
return visible ? (
|
|
370
|
-
<>
|
|
371
|
-
<div {...eleProps} style={styles} className={classnames('ued-table-wrap', className)} ref={tableWrapRef}>
|
|
372
|
-
<TableHead
|
|
373
|
-
{...restProps}
|
|
374
|
-
source="engine"
|
|
375
|
-
columns={customizableCols}
|
|
376
|
-
selectedCols={customSelectedCols}
|
|
377
|
-
setSelectedCols={setCustomSelectedCols}
|
|
378
|
-
setColOrder={setColCustomOrder}
|
|
379
|
-
sandBoxSafeRun={sandBoxSafeRun}
|
|
380
|
-
/>
|
|
381
|
-
<Form form={form}>
|
|
382
|
-
<Table
|
|
383
|
-
// {...restProps} // TODO: 不要这么透传,需要什么传什么,先注释,之后缺什么再补
|
|
384
|
-
{...tableProps}
|
|
385
|
-
showHeader={showHeader}
|
|
386
|
-
locale={{
|
|
387
|
-
emptyText: <EmptyComp dataState={dataState} getLocale={getLocale} />,
|
|
388
|
-
}}
|
|
389
|
-
ref={tableRef}
|
|
390
|
-
// loading={loading}
|
|
391
|
-
bordered={isBordered}
|
|
392
|
-
className={innerClassName}
|
|
393
|
-
style={innerTableStyle}
|
|
394
|
-
components={{
|
|
395
|
-
body: {
|
|
396
|
-
cell: BodyCell,
|
|
397
|
-
},
|
|
398
|
-
header: {
|
|
399
|
-
cell: (info: any) => (
|
|
400
|
-
<HeaderCell
|
|
401
|
-
{...info}
|
|
402
|
-
tableData={sortDataSource}
|
|
403
|
-
hasExpandContent={hasExpandContent}
|
|
404
|
-
childrenColumnName={realExpandable.childrenColumnName}
|
|
405
|
-
/>
|
|
406
|
-
),
|
|
407
|
-
},
|
|
408
|
-
}}
|
|
409
|
-
columns={finalcolumns.map((item, index) => {
|
|
410
|
-
// 固定列最后一项宽度根据本身计算返回
|
|
411
|
-
if (fixedAction && finalcolumns.length - 1 === index) {
|
|
412
|
-
return item;
|
|
413
|
-
}
|
|
414
|
-
item.width = columnWidth[index] || item.width;
|
|
415
|
-
return item;
|
|
416
|
-
})}
|
|
417
|
-
rowKey={currentRowKey}
|
|
418
|
-
scroll={scroll}
|
|
419
|
-
onChange={handleTableChange}
|
|
420
|
-
onRow={record => {
|
|
421
|
-
return {
|
|
422
|
-
onClick: event => {
|
|
423
|
-
const hasOnRowClick = onRowClick(event, record, getRealIndexById(record[currentRowKey]));
|
|
424
|
-
!hasOnRowClick && onRowSelectClick(record, getRealIndexById(record[currentRowKey]));
|
|
425
|
-
}, // 点击行
|
|
426
|
-
onDoubleClick: event => {
|
|
427
|
-
onRowDoubleClick(event, record, getRealIndexById(record[currentRowKey]));
|
|
428
|
-
},
|
|
429
|
-
onContextMenu: event => {},
|
|
430
|
-
onMouseEnter: event => {}, // 鼠标移入行
|
|
431
|
-
onMouseLeave: event => {},
|
|
432
|
-
};
|
|
433
|
-
}}
|
|
434
|
-
rowSelection={rowSelection}
|
|
435
|
-
// loading没有数据的时候模拟3个数据,当数据为空时依然展示骨架屏
|
|
436
|
-
dataSource={isEmptyLoading ? [{}, {}, {}] : sortDataSource}
|
|
437
|
-
expandable={realExpandable}
|
|
438
|
-
pagination={isEmptyLoading ? false : page && pagination}
|
|
439
|
-
summary={(pageData: any[]) => (
|
|
440
|
-
<Table.Summary fixed={!!props?.scroll}>
|
|
441
|
-
<TableSummaryRow
|
|
442
|
-
columns={finalcolumns}
|
|
443
|
-
dataSource={pageData as any[]}
|
|
444
|
-
summary={props.summary}
|
|
445
|
-
summaryConfig={props?.summaryTotal}
|
|
446
|
-
selectionType={rowSelection?.type}
|
|
447
|
-
/>
|
|
448
|
-
</Table.Summary>
|
|
449
|
-
)}
|
|
450
|
-
/>
|
|
451
|
-
</Form>
|
|
452
|
-
</div>
|
|
453
|
-
{showPrintContainer && (
|
|
454
|
-
<PrintContainer
|
|
455
|
-
containerProps={{
|
|
456
|
-
style: styles,
|
|
457
|
-
className: classnames('ued-table-wrap', className),
|
|
458
|
-
...selectorKey,
|
|
459
|
-
}}
|
|
460
|
-
>
|
|
461
|
-
<TableHead
|
|
462
|
-
source="engine"
|
|
463
|
-
// @ts-ignore
|
|
464
|
-
columns={customizableCols}
|
|
465
|
-
selectedCols={customSelectedCols}
|
|
466
|
-
setSelectedCols={setCustomSelectedCols}
|
|
467
|
-
setColOrder={setColCustomOrder}
|
|
468
|
-
sandBoxSafeRun={sandBoxSafeRun}
|
|
469
|
-
{...restProps}
|
|
470
|
-
headExtends={[]}
|
|
471
|
-
engineApis={engineApis}
|
|
472
|
-
/>
|
|
473
|
-
<Form form={form}>
|
|
474
|
-
{/** @ts-ignore */}
|
|
475
|
-
<Table
|
|
476
|
-
{...restProps}
|
|
477
|
-
showHeader={showHeader}
|
|
478
|
-
bordered={isBordered}
|
|
479
|
-
className={innerClassName}
|
|
480
|
-
style={innerTableStyle}
|
|
481
|
-
components={{
|
|
482
|
-
body: {
|
|
483
|
-
cell: BodyCell,
|
|
484
|
-
},
|
|
485
|
-
header: {
|
|
486
|
-
cell: (info: any) => (
|
|
487
|
-
<HeaderCell
|
|
488
|
-
{...info}
|
|
489
|
-
tableData={printData?.dataSource?.length > 0 ? printData.dataSource : sortDataSource}
|
|
490
|
-
childrenColumnName={realExpandable.childrenColumnName}
|
|
491
|
-
hasExpandContent={hasExpandContent}
|
|
492
|
-
/>
|
|
493
|
-
),
|
|
494
|
-
},
|
|
495
|
-
}}
|
|
496
|
-
columns={printColumns.map((item, index) => {
|
|
497
|
-
item.width = columnWidth[index] || item.width;
|
|
498
|
-
return item;
|
|
499
|
-
})}
|
|
500
|
-
rowKey={currentRowKey}
|
|
501
|
-
dataSource={printData?.dataSource?.length > 0 ? printData.dataSource : sortDataSource}
|
|
502
|
-
expandable={realExpandable}
|
|
503
|
-
pagination={false}
|
|
504
|
-
summary={(pageData: readonly any[]) => (
|
|
505
|
-
<Table.Summary fixed={!!props?.scroll}>
|
|
506
|
-
<TableSummaryRow
|
|
507
|
-
columns={finalcolumns}
|
|
508
|
-
dataSource={pageData as any[]}
|
|
509
|
-
summary={props.summary}
|
|
510
|
-
summaryConfig={props?.summaryTotal}
|
|
511
|
-
selectionType={rowSelection?.type}
|
|
512
|
-
/>
|
|
513
|
-
</Table.Summary>
|
|
514
|
-
)}
|
|
515
|
-
/>
|
|
516
|
-
</Form>
|
|
517
|
-
</PrintContainer>
|
|
518
|
-
)}
|
|
519
|
-
</>
|
|
520
|
-
) : null;
|
|
195
|
+
return (
|
|
196
|
+
<IdleContainer>
|
|
197
|
+
<TableLoader {...props} {...innerProps} />
|
|
198
|
+
</IdleContainer>
|
|
199
|
+
);
|
|
521
200
|
});
|
|
522
201
|
|
|
523
|
-
export default
|
|
202
|
+
export default Table;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Loadable from 'react-loadable';
|
|
3
|
+
import { LoadingComponennt } from '../utils/LoaderHelper';
|
|
4
|
+
|
|
5
|
+
const TableLoader = Loadable<any, React.ComponentType<any>>({
|
|
6
|
+
loader: () => import(/* webpackChunkName: "pcfactory-Table" */ './Table'),
|
|
7
|
+
loading: LoadingComponennt,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default TableLoader;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// import Table from './Table';
|
|
14
|
+
|
|
15
|
+
// export default Table;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LocaleFunction } from '@lingxiteam/types';
|
|
1
|
+
import { LocaleFunction, EngineBaseProps } from '@lingxiteam/types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
export interface OperationCellProps {
|
|
@@ -20,7 +20,7 @@ export interface OperationCellProps {
|
|
|
20
20
|
fixedAction?: boolean;
|
|
21
21
|
isSmallPopover: boolean;
|
|
22
22
|
tableRef: any;
|
|
23
|
-
$$componentItem:
|
|
23
|
+
$$componentItem: EngineBaseProps['$$componentItem'];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface SingleBtnProps {
|
|
@@ -49,7 +49,7 @@ export interface TableRowExpandEventTypes {
|
|
|
49
49
|
* @param expandedRowKeys
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
|
-
onExpandedRowsChange?:
|
|
52
|
+
onExpandedRowsChange?:(expandedRowKeys: any[]) => void;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export interface TableEditEventTypes {
|
|
@@ -107,12 +107,12 @@ export interface TableEditEventTypes {
|
|
|
107
107
|
onBeforeInlineEdit?: (e: any) => void;
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
* 保存行内编辑时触发
|
|
111
|
+
* @param data
|
|
112
|
+
* @param id
|
|
113
|
+
* @param index
|
|
114
|
+
* @returns
|
|
115
|
+
*/
|
|
116
116
|
onBeforeInlineSave?: (data: any, id: any, index: number | null) => void;
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -127,4 +127,8 @@ export interface TablePaginationEventTypes {
|
|
|
127
127
|
onPageChange?: (page: React.SetStateAction<number>, size: number) => void;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
export type MyTableEventTypes =
|
|
130
|
+
export type MyTableEventTypes =
|
|
131
|
+
TableBaseEventTypes &
|
|
132
|
+
TableRowExpandEventTypes &
|
|
133
|
+
TableEditEventTypes &
|
|
134
|
+
TablePaginationEventTypes
|
|
@@ -10,11 +10,12 @@ export type HeaderCellProps = React.HTMLAttributes<any> & {
|
|
|
10
10
|
tableData?: any[];
|
|
11
11
|
hasExpandContent?: boolean;
|
|
12
12
|
childrenColumnName: string;
|
|
13
|
+
cellKey?: string;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export interface Code {
|
|
16
17
|
code: any;
|
|
17
|
-
originCode: string
|
|
18
|
+
originCode: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export interface Tip {
|