@bit-sun/business-component 2.4.19 → 2.4.21
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/.editorconfig +16 -16
- package/.fatherrc.ts +5 -5
- package/.gitlab-ci.yml +179 -179
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +74 -74
- package/README.md +27 -27
- package/dist/index.esm.js +10 -6
- package/dist/index.js +10 -6
- package/docs/index.md +21 -21
- package/lib/assets/drag.svg +17 -17
- package/lib/assets/exportFail.svg +37 -37
- package/lib/assets/exportProcessing.svg +28 -28
- package/lib/assets/exportSuccess.svg +34 -34
- package/lib/assets/label_icon_bottom.svg +25 -25
- package/lib/assets/upExport.svg +22 -22
- package/package.json +79 -79
- package/src/assets/32.svg +27 -27
- package/src/assets/addIcon.svg +17 -17
- package/src/assets/allfunc.svg +27 -27
- package/src/assets/arrowRight.svg +24 -24
- package/src/assets/btn-delete.svg +29 -29
- package/src/assets/btn-edit.svg +19 -19
- package/src/assets/btn-more.svg +17 -17
- package/src/assets/btn-submit.svg +19 -19
- package/src/assets/caidan.svg +11 -11
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/exportFail.svg +37 -37
- package/src/assets/exportProcessing.svg +28 -28
- package/src/assets/exportSuccess.svg +34 -34
- package/src/assets/fixed-left-active.svg +11 -11
- package/src/assets/fixed-left.svg +15 -15
- package/src/assets/fixed-right-active.svg +11 -11
- package/src/assets/fixed-right.svg +15 -15
- package/src/assets/guanbi.svg +15 -15
- package/src/assets/icon-quanping.svg +15 -15
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/list-no-img.svg +21 -21
- package/src/assets/morentouxiang-32.svg +23 -23
- package/src/assets/scanning.svg +24 -24
- package/src/assets/upExport.svg +22 -22
- package/src/common/ENUM.ts +41 -41
- package/src/components/Business/AddSelectBusiness/index.md +162 -162
- package/src/components/Business/AddSelectBusiness/index.tsx +1061 -1061
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +111 -111
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +285 -285
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +170 -170
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +72 -72
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -157
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +218 -218
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +155 -155
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +160 -160
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
- package/src/components/Business/BsLayouts/index.less +79 -79
- package/src/components/Business/BsLayouts/index.tsx +1484 -1484
- package/src/components/Business/BsLayouts/service.ts +10 -10
- package/src/components/Business/BsLayouts/utils.tsx +203 -203
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +566 -566
- package/src/components/Business/BsSulaQueryTable/index.less +221 -221
- package/src/components/Business/BsSulaQueryTable/index.tsx +558 -558
- package/src/components/Business/BsSulaQueryTable/setting.tsx +854 -854
- package/src/components/Business/BsSulaQueryTable/utils.less +65 -65
- package/src/components/Business/BsSulaQueryTable/utils.tsx +690 -690
- package/src/components/Business/CommodityEntry/index.md +70 -70
- package/src/components/Business/CommodityEntry/index.tsx +80 -80
- package/src/components/Business/CommonAlert/index.tsx +23 -23
- package/src/components/Business/CommonGuideWrapper/index.less +111 -111
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +83 -83
- package/src/components/Business/DetailPageWrapper/index.less +79 -79
- package/src/components/Business/DetailPageWrapper/index.tsx +315 -315
- package/src/components/Business/DetailPageWrapper/utils.tsx +100 -100
- package/src/components/Business/HomePageWrapper/index.less +33 -33
- package/src/components/Business/HomePageWrapper/index.md +45 -45
- package/src/components/Business/HomePageWrapper/index.tsx +162 -162
- package/src/components/Business/JsonQueryTable/components/FieldsModifyModal.tsx +824 -824
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +205 -205
- package/src/components/Business/JsonQueryTable/components/Formula.tsx +206 -206
- package/src/components/Business/JsonQueryTable/components/MaintainOptions.tsx +127 -127
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
- package/src/components/Business/JsonQueryTable/function.ts +62 -62
- package/src/components/Business/JsonQueryTable/index.less +16 -16
- package/src/components/Business/JsonQueryTable/index.md +328 -328
- package/src/components/Business/JsonQueryTable/index.tsx +537 -537
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
- package/src/components/Business/JsonQueryTable/static.ts +450 -450
- package/src/components/Business/SearchSelect/BusinessUtils.ts +2057 -2057
- package/src/components/Business/SearchSelect/common.ts +134 -134
- package/src/components/Business/SearchSelect/index.md +1444 -1444
- package/src/components/Business/SearchSelect/index.tsx +55 -55
- package/src/components/Business/SearchSelect/utils.ts +101 -101
- package/src/components/Business/StateFlow/index.less +130 -130
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/TreeSearchSelect/index.md +185 -185
- package/src/components/Business/TreeSearchSelect/index.tsx +33 -33
- package/src/components/Business/TreeSearchSelect/utils.ts +104 -104
- package/src/components/Business/columnSettingTable/columnSetting.tsx +766 -766
- package/src/components/Business/columnSettingTable/index.less +247 -247
- package/src/components/Business/columnSettingTable/index.md +357 -357
- package/src/components/Business/columnSettingTable/index.tsx +235 -234
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +243 -242
- package/src/components/Business/columnSettingTable/utils.tsx +71 -71
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
- package/src/components/Business/moreTreeTable/index.less +99 -99
- package/src/components/Business/moreTreeTable/index.md +448 -448
- package/src/components/Business/moreTreeTable/index.tsx +387 -387
- package/src/components/Business/moreTreeTable/utils.ts +126 -126
- package/src/components/Functional/AddSelect/helps.ts +80 -80
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.md +155 -155
- package/src/components/Functional/AddSelect/index.tsx +1171 -1171
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.md +39 -39
- package/src/components/Functional/BillEntry/index.tsx +773 -773
- package/src/components/Functional/BsAntdSula/BsCascader/index.md +62 -62
- package/src/components/Functional/BsAntdSula/BsCascader/index.tsx +178 -178
- package/src/components/Functional/BsAntdSula/index.ts +2 -2
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.md +44 -44
- package/src/components/Functional/DataImport/index.tsx +696 -696
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.md +39 -39
- package/src/components/Functional/DataValidation/index.tsx +688 -688
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
- package/src/components/Functional/EllipsisTooltip/index.js +36 -36
- package/src/components/Functional/EllipsisTooltip/index.md +30 -30
- package/src/components/Functional/ExportFunctions/ExportIcon/index.md +37 -37
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +60 -60
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.md +33 -33
- package/src/components/Functional/QueryMutipleInput/index.tsx +128 -128
- package/src/components/Functional/SearchSelect/index.less +115 -115
- package/src/components/Functional/SearchSelect/index.md +141 -141
- package/src/components/Functional/SearchSelect/index.tsx +896 -896
- package/src/components/Functional/SearchSelect/utils.ts +3 -3
- package/src/components/Functional/TreeSearchSelect/index.md +47 -47
- package/src/components/Functional/TreeSearchSelect/index.tsx +204 -204
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +62 -62
- package/src/components/Solution/RuleComponent/index.d.ts +29 -29
- package/src/components/Solution/RuleComponent/index.js +2073 -2073
- package/src/components/Solution/RuleComponent/index.less +230 -230
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/ruleFiled.js +2281 -2281
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/components/Solution/RuleComponent/util.js +143 -143
- package/src/index.ts +38 -38
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +725 -725
- package/src/plugin/TableColumnSetting/utils.ts +19 -19
- package/src/styles/bsDefault.less +1912 -1912
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/CustomLoginInfo.ts +55 -55
- package/src/utils/LocalstorageUtils.ts +95 -95
- package/src/utils/TableUtils.tsx +18 -18
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/enumConfig.ts +11 -11
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +4 -4
- package/src/utils/requestUtils.ts +166 -166
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +195 -195
- package/tsconfig.json +29 -29
- package/typings.d.ts +4 -4
|
@@ -1,387 +1,387 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import React, { useState, useEffect, useImperativeHandle, forwardRef, useMemo, useRef } from 'react';
|
|
3
|
-
import { getAllColumns, convertToRows, headersToRows } from './utils';
|
|
4
|
-
import './index.less';
|
|
5
|
-
import FixedScrollBar from "./FixedScrollBar";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export default forwardRef((props, ref) => {
|
|
9
|
-
const [show, setShow] = useState(false);
|
|
10
|
-
const [config, setConfig] = useState({
|
|
11
|
-
tableType: 'col-header-table',
|
|
12
|
-
colHeader: [],
|
|
13
|
-
colLastData: [],
|
|
14
|
-
rowHeader: [],
|
|
15
|
-
rowLastData: [],
|
|
16
|
-
colHeaderToTop: 0,
|
|
17
|
-
});
|
|
18
|
-
const [colTableData, setColTableData] = useState([]); //纵向表头数据
|
|
19
|
-
const [multiTableData, setMmultiTableData] = useState({}); //多表头数据
|
|
20
|
-
const [viewCount, setViewCount] = useState(10); //虚拟表格每次渲染数量
|
|
21
|
-
const itemWidth = 100; // 表格每一项宽度
|
|
22
|
-
const [realColHeaderWidth, setLeftWidth] = useState(props?.colHeaderWidth || 400);
|
|
23
|
-
|
|
24
|
-
const viewPort = useRef(null);
|
|
25
|
-
const topScrollBar = useRef(null);
|
|
26
|
-
const leftTableRef = useRef(null);
|
|
27
|
-
|
|
28
|
-
//起始渲染item
|
|
29
|
-
const [startIndex, setStartIndex] = useState(0);
|
|
30
|
-
|
|
31
|
-
//结束渲染item
|
|
32
|
-
const endIndex = useMemo(() => {
|
|
33
|
-
return startIndex + viewCount;
|
|
34
|
-
}, [startIndex, viewCount])
|
|
35
|
-
|
|
36
|
-
//表格偏移量
|
|
37
|
-
const [offsetWidth, setOffset] = useState(0);
|
|
38
|
-
|
|
39
|
-
useEffect(() => { //根据容器宽度计算每次渲染个数
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
let realLeftTableWidth = leftTableRef.current.clientWidth;
|
|
42
|
-
let viewPortWidth = viewPort.current.clientWidth;
|
|
43
|
-
let defaultTableWidth = viewPortWidth - realLeftTableWidth;
|
|
44
|
-
let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
|
|
45
|
-
setViewCount(viewCount)
|
|
46
|
-
setLeftWidth(realLeftTableWidth);
|
|
47
|
-
})
|
|
48
|
-
}, [])
|
|
49
|
-
|
|
50
|
-
const onScroll = (e) => {
|
|
51
|
-
if(topScrollBar.current){
|
|
52
|
-
topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0)
|
|
53
|
-
}
|
|
54
|
-
const scrollWidth = viewPort.current.scrollLeft;
|
|
55
|
-
let startIndex = Math.floor(scrollWidth/itemWidth);
|
|
56
|
-
if ( startIndex + viewCount >= colTableData.length) {
|
|
57
|
-
startIndex = colTableData.length - viewCount <= 0 ? 0 : colTableData.length - viewCount;
|
|
58
|
-
}
|
|
59
|
-
const offsetWidth = startIndex * itemWidth;
|
|
60
|
-
setStartIndex(startIndex);
|
|
61
|
-
setOffset(offsetWidth);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 占位符,表格列总宽度
|
|
65
|
-
const placeholderWidth = useMemo(() => {
|
|
66
|
-
return colTableData.length*100
|
|
67
|
-
}, [colTableData])
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
useImperativeHandle(ref, () => ({
|
|
71
|
-
// 暴露子组件刷新表格方法出去,父组件可以调用该方法刷新表格数据
|
|
72
|
-
getDataSource: getDataSource,
|
|
73
|
-
}));
|
|
74
|
-
|
|
75
|
-
// 设置表头相关信息
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
const { colData, rowData } = props;
|
|
78
|
-
let tableType;
|
|
79
|
-
if (colData && colData.length && rowData && rowData.length) {
|
|
80
|
-
tableType = 'multi-header-table';
|
|
81
|
-
const colHeaderData = convertToRows(colData);
|
|
82
|
-
const rowHeaderData = headersToRows(rowData);
|
|
83
|
-
const { rowHeader } = rowHeaderData;
|
|
84
|
-
setConfig({
|
|
85
|
-
colHeader: [],
|
|
86
|
-
colLastData: [],
|
|
87
|
-
rowHeader: [],
|
|
88
|
-
rowLastData: [],
|
|
89
|
-
...colHeaderData,
|
|
90
|
-
...rowHeaderData,
|
|
91
|
-
colHeaderToTop: (rowHeader?.length || 0)*40,
|
|
92
|
-
tableType: tableType
|
|
93
|
-
})
|
|
94
|
-
} else if (colData && colData.length) {
|
|
95
|
-
tableType = 'col-header-table';
|
|
96
|
-
const colHeaderData = convertToRows(colData);
|
|
97
|
-
setConfig({
|
|
98
|
-
colHeader: [],
|
|
99
|
-
colLastData: [],
|
|
100
|
-
rowHeader: [],
|
|
101
|
-
rowLastData: [],
|
|
102
|
-
...colHeaderData,
|
|
103
|
-
colHeaderToTop: 0,
|
|
104
|
-
tableType: tableType
|
|
105
|
-
})
|
|
106
|
-
}
|
|
107
|
-
}, [props.colData, props.rowData]);
|
|
108
|
-
|
|
109
|
-
// 设置多表头表格数据
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (!config.colLastData.length || !config.rowLastData.length || !props.multiTableData) return;
|
|
112
|
-
let tableData = {};
|
|
113
|
-
let [row, col] = [config.rowLastData, config.colLastData];
|
|
114
|
-
col.forEach(x => {
|
|
115
|
-
row.forEach(y => {
|
|
116
|
-
let key = x.id + "__" + y.id;
|
|
117
|
-
tableData[key] = "";
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
Object.assign(tableData, props.multiTableData);
|
|
121
|
-
setMmultiTableData({
|
|
122
|
-
...tableData
|
|
123
|
-
});
|
|
124
|
-
}, [config.colLastData, config.rowLastData, props.multiTableData])
|
|
125
|
-
|
|
126
|
-
// 设置纵向表格数据
|
|
127
|
-
useEffect(() => {
|
|
128
|
-
if (props?.colTableData && props?.colTableData.length) {
|
|
129
|
-
setColTableData([
|
|
130
|
-
...props.colTableData
|
|
131
|
-
])
|
|
132
|
-
}
|
|
133
|
-
}, [props.colTableData])
|
|
134
|
-
|
|
135
|
-
const getDataSource = () => {
|
|
136
|
-
return colTableData;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const tableInsFn = {
|
|
140
|
-
getDataSource: getDataSource,
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// if (!show) {
|
|
146
|
-
// return <div>loading</div>;
|
|
147
|
-
// }
|
|
148
|
-
|
|
149
|
-
const {width, height, tableProps } = props;
|
|
150
|
-
let tableWidth = width ? `${width}px` : '100%';
|
|
151
|
-
let tableHeight = `${height || 400}px`;
|
|
152
|
-
const rightAreaWidth = 'calc(100% - ' + `${realColHeaderWidth}px` + ')';
|
|
153
|
-
return (
|
|
154
|
-
<div
|
|
155
|
-
style={{width: tableWidth, height: tableHeight}}
|
|
156
|
-
key='moreTreeTable'
|
|
157
|
-
className={'editTableWrapper'}
|
|
158
|
-
onScroll={onScroll}
|
|
159
|
-
ref={viewPort}
|
|
160
|
-
>
|
|
161
|
-
<FixedScrollBar
|
|
162
|
-
stickyProps={tableProps?.sticky}
|
|
163
|
-
viewPort={viewPort}
|
|
164
|
-
ref={topScrollBar}
|
|
165
|
-
/>
|
|
166
|
-
<div style={{
|
|
167
|
-
width: `${realColHeaderWidth + placeholderWidth}px`,
|
|
168
|
-
position: 'absolute',
|
|
169
|
-
top: 0,
|
|
170
|
-
left: 0,
|
|
171
|
-
height: '100%',
|
|
172
|
-
}}
|
|
173
|
-
></div>
|
|
174
|
-
{/* -------------------------------------左上角区域--------------------------------------- */}
|
|
175
|
-
<table
|
|
176
|
-
style={{
|
|
177
|
-
width: `${realColHeaderWidth}px`,
|
|
178
|
-
height: `${config.colHeaderToTop}px`,
|
|
179
|
-
display: config.tableType === 'col-header-table' ? 'none' : '',
|
|
180
|
-
}}
|
|
181
|
-
className={`${'north__west'}`}
|
|
182
|
-
>
|
|
183
|
-
</table>
|
|
184
|
-
|
|
185
|
-
{/* --------------------------------------纵向表头---------------------------------------- */}
|
|
186
|
-
<table
|
|
187
|
-
style={{
|
|
188
|
-
tableLayout:'auto',
|
|
189
|
-
minWidth: '100px',
|
|
190
|
-
width: `${realColHeaderWidth}px`,
|
|
191
|
-
top: `${config.colHeaderToTop}px`,
|
|
192
|
-
left: '0px',
|
|
193
|
-
position: 'sticky',
|
|
194
|
-
}}
|
|
195
|
-
ref={leftTableRef}
|
|
196
|
-
className={`${'south__west'} ${'editTable__block'} ${'table_border_style'}`}
|
|
197
|
-
>
|
|
198
|
-
<tbody>
|
|
199
|
-
{config.colHeader.map((item, index) => {
|
|
200
|
-
return (
|
|
201
|
-
<tr>
|
|
202
|
-
{item.map((innerItem) => {
|
|
203
|
-
if (!innerItem) return null;
|
|
204
|
-
let fixedTop = innerItem.fixed ? `${index*40 + config.colHeaderToTop}px` : 0;
|
|
205
|
-
return (
|
|
206
|
-
<td
|
|
207
|
-
style={{
|
|
208
|
-
// width: '200px',
|
|
209
|
-
height: '40px',
|
|
210
|
-
background: '#f7f8fb',
|
|
211
|
-
lineHeight: '28px',
|
|
212
|
-
color: '#000000',
|
|
213
|
-
fontWeight: 500,
|
|
214
|
-
position: innerItem.fixed ? 'sticky' : '',
|
|
215
|
-
top: fixedTop,
|
|
216
|
-
}}
|
|
217
|
-
rowSpan={innerItem && innerItem.colSpan}
|
|
218
|
-
colSpan={innerItem && innerItem.rowSpan}
|
|
219
|
-
>
|
|
220
|
-
{innerItem && innerItem.title}
|
|
221
|
-
</td>
|
|
222
|
-
);
|
|
223
|
-
})}
|
|
224
|
-
{/* <td></td> */}
|
|
225
|
-
</tr>
|
|
226
|
-
);
|
|
227
|
-
})}
|
|
228
|
-
</tbody>
|
|
229
|
-
</table>
|
|
230
|
-
<table
|
|
231
|
-
className={` ${'editTable__block'} ${'table_border_style'}`}
|
|
232
|
-
style={{
|
|
233
|
-
width: '100%',
|
|
234
|
-
top: 0,
|
|
235
|
-
left: `${realColHeaderWidth}px`,
|
|
236
|
-
position: 'absolute',
|
|
237
|
-
display: config.tableType === 'col-header-table' ? 'none' : ''
|
|
238
|
-
}}
|
|
239
|
-
>
|
|
240
|
-
<colgroup>
|
|
241
|
-
{
|
|
242
|
-
config.rowLastData.map(row => {
|
|
243
|
-
return (<col width={row.width ? `${row.width}px` : '100px'} />)
|
|
244
|
-
})
|
|
245
|
-
}
|
|
246
|
-
</colgroup>
|
|
247
|
-
<tbody>
|
|
248
|
-
{
|
|
249
|
-
config.rowHeader.map((item) => {
|
|
250
|
-
return (
|
|
251
|
-
<tr>
|
|
252
|
-
{
|
|
253
|
-
item.map((innerItem) => {
|
|
254
|
-
if (!innerItem) return null;
|
|
255
|
-
return (
|
|
256
|
-
<td
|
|
257
|
-
style={{
|
|
258
|
-
height: '40px',
|
|
259
|
-
background: '#f7f8fb',
|
|
260
|
-
color: '#000000',
|
|
261
|
-
fontWeight: 500,
|
|
262
|
-
width: innerItem.width ? `${innerItem.width}px` : '100px',
|
|
263
|
-
}}
|
|
264
|
-
rowSpan={innerItem && innerItem.rowSpan}
|
|
265
|
-
colSpan={innerItem && innerItem.colSpan}
|
|
266
|
-
>
|
|
267
|
-
{innerItem && innerItem.title}
|
|
268
|
-
</td>
|
|
269
|
-
)
|
|
270
|
-
})
|
|
271
|
-
}
|
|
272
|
-
</tr>
|
|
273
|
-
)
|
|
274
|
-
})
|
|
275
|
-
}
|
|
276
|
-
</tbody>
|
|
277
|
-
</table>
|
|
278
|
-
<div
|
|
279
|
-
style={{
|
|
280
|
-
position: 'absolute',
|
|
281
|
-
left: `${realColHeaderWidth}px`,
|
|
282
|
-
top: `${config.colHeaderToTop}px`,
|
|
283
|
-
minWidth: rightAreaWidth,
|
|
284
|
-
zIndex: 0,
|
|
285
|
-
}}
|
|
286
|
-
>
|
|
287
|
-
{/* --------------------------------------横向表头---------------------------------------- */}
|
|
288
|
-
{/* <div style={{position: 'relative'}}>
|
|
289
|
-
|
|
290
|
-
</div> */}
|
|
291
|
-
<div
|
|
292
|
-
style={{
|
|
293
|
-
width: '100%',
|
|
294
|
-
position: 'relative'
|
|
295
|
-
}}
|
|
296
|
-
className={`${'value_table'} ${'table_border_style'}`}
|
|
297
|
-
>
|
|
298
|
-
{/* ------------------------------------纵向表头数据-------------------------------------- */}
|
|
299
|
-
<table
|
|
300
|
-
style={{
|
|
301
|
-
tableLayout:'auto',
|
|
302
|
-
width: '800px',
|
|
303
|
-
display: config.tableType === 'col-header-table' ? '' : 'none',
|
|
304
|
-
transform: `translateX(${offsetWidth}px)`
|
|
305
|
-
}}
|
|
306
|
-
className={`${'editTable__block'} ${'table_border_style'}`}
|
|
307
|
-
>
|
|
308
|
-
<tbody>
|
|
309
|
-
{config.colLastData.map((item, index) => {
|
|
310
|
-
let fixedTop = item.fixed ? `${index*40 + config.colHeaderToTop}px` : 0;
|
|
311
|
-
return (
|
|
312
|
-
<tr>
|
|
313
|
-
{colTableData.map((record, index) => {
|
|
314
|
-
let tdHidden = record?.['_rowConfig']?.hidden ? 'none' : 'table-cell'
|
|
315
|
-
let onCellResult = item.onCell?.(record, index) || {}
|
|
316
|
-
let {addStyle={}} = onCellResult
|
|
317
|
-
return (
|
|
318
|
-
<td
|
|
319
|
-
style={{
|
|
320
|
-
...addStyle,
|
|
321
|
-
display: tdHidden,
|
|
322
|
-
background: (index % 2 === 1) || item.fixed ? '#f7f8fb' : '#fff',
|
|
323
|
-
minWidth: '100px',
|
|
324
|
-
width: `${itemWidth}px`,
|
|
325
|
-
height: '40px',
|
|
326
|
-
position: item.fixed ? 'sticky' : '',
|
|
327
|
-
top: fixedTop,
|
|
328
|
-
color: item.fixed ? '#000000' : 'inherit',
|
|
329
|
-
zIndex: item.fixed ? 10 : '',
|
|
330
|
-
}}
|
|
331
|
-
>
|
|
332
|
-
{
|
|
333
|
-
item.render ? item.render({text:record[item.key || item.dataIndex], record, index, table: tableInsFn}) : record[item.key || item.dataIndex]
|
|
334
|
-
}
|
|
335
|
-
{/* {record[item.key || item.dataIndex]?.value} */}
|
|
336
|
-
</td>
|
|
337
|
-
);
|
|
338
|
-
}).slice(startIndex, endIndex+1)}
|
|
339
|
-
{/* <td></td> */}
|
|
340
|
-
</tr>
|
|
341
|
-
);
|
|
342
|
-
})}
|
|
343
|
-
</tbody>
|
|
344
|
-
</table>
|
|
345
|
-
{/* -------------------------------------多表头数据-------------------------------------- */}
|
|
346
|
-
<table
|
|
347
|
-
style={{
|
|
348
|
-
width: '100%',
|
|
349
|
-
display: config.tableType === 'col-header-table' ? 'none' : '',
|
|
350
|
-
}}
|
|
351
|
-
className={`${'editTable__block'} ${'table_border_style'}`}
|
|
352
|
-
>
|
|
353
|
-
<colgroup>
|
|
354
|
-
{
|
|
355
|
-
config.rowLastData.map(row => {
|
|
356
|
-
return (<col width={row.width ? `${row.width}px` : '100px'} />)
|
|
357
|
-
})
|
|
358
|
-
}
|
|
359
|
-
</colgroup>
|
|
360
|
-
<tbody>
|
|
361
|
-
{config.colLastData.map((col) => {
|
|
362
|
-
return (
|
|
363
|
-
<tr>
|
|
364
|
-
{config.rowLastData.map((row, index) => {
|
|
365
|
-
return (
|
|
366
|
-
<td
|
|
367
|
-
style={{
|
|
368
|
-
background: (index % 2 === 0) ? '#fff' : '#f7f8fb',
|
|
369
|
-
width: row.width ? `${row.width}px` : '100px',
|
|
370
|
-
height: '40px',
|
|
371
|
-
}}
|
|
372
|
-
>
|
|
373
|
-
{multiTableData[(row.key || row.dataIndex)+'__'+(col.key || col.dataIndex)]}
|
|
374
|
-
</td>
|
|
375
|
-
);
|
|
376
|
-
})}
|
|
377
|
-
{/* <td></td> */}
|
|
378
|
-
</tr>
|
|
379
|
-
);
|
|
380
|
-
})}
|
|
381
|
-
</tbody>
|
|
382
|
-
</table>
|
|
383
|
-
</div>
|
|
384
|
-
</div>
|
|
385
|
-
</div>
|
|
386
|
-
);
|
|
387
|
-
});
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React, { useState, useEffect, useImperativeHandle, forwardRef, useMemo, useRef } from 'react';
|
|
3
|
+
import { getAllColumns, convertToRows, headersToRows } from './utils';
|
|
4
|
+
import './index.less';
|
|
5
|
+
import FixedScrollBar from "./FixedScrollBar";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default forwardRef((props, ref) => {
|
|
9
|
+
const [show, setShow] = useState(false);
|
|
10
|
+
const [config, setConfig] = useState({
|
|
11
|
+
tableType: 'col-header-table',
|
|
12
|
+
colHeader: [],
|
|
13
|
+
colLastData: [],
|
|
14
|
+
rowHeader: [],
|
|
15
|
+
rowLastData: [],
|
|
16
|
+
colHeaderToTop: 0,
|
|
17
|
+
});
|
|
18
|
+
const [colTableData, setColTableData] = useState([]); //纵向表头数据
|
|
19
|
+
const [multiTableData, setMmultiTableData] = useState({}); //多表头数据
|
|
20
|
+
const [viewCount, setViewCount] = useState(10); //虚拟表格每次渲染数量
|
|
21
|
+
const itemWidth = 100; // 表格每一项宽度
|
|
22
|
+
const [realColHeaderWidth, setLeftWidth] = useState(props?.colHeaderWidth || 400);
|
|
23
|
+
|
|
24
|
+
const viewPort = useRef(null);
|
|
25
|
+
const topScrollBar = useRef(null);
|
|
26
|
+
const leftTableRef = useRef(null);
|
|
27
|
+
|
|
28
|
+
//起始渲染item
|
|
29
|
+
const [startIndex, setStartIndex] = useState(0);
|
|
30
|
+
|
|
31
|
+
//结束渲染item
|
|
32
|
+
const endIndex = useMemo(() => {
|
|
33
|
+
return startIndex + viewCount;
|
|
34
|
+
}, [startIndex, viewCount])
|
|
35
|
+
|
|
36
|
+
//表格偏移量
|
|
37
|
+
const [offsetWidth, setOffset] = useState(0);
|
|
38
|
+
|
|
39
|
+
useEffect(() => { //根据容器宽度计算每次渲染个数
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
let realLeftTableWidth = leftTableRef.current.clientWidth;
|
|
42
|
+
let viewPortWidth = viewPort.current.clientWidth;
|
|
43
|
+
let defaultTableWidth = viewPortWidth - realLeftTableWidth;
|
|
44
|
+
let viewCount = Math.floor(defaultTableWidth/itemWidth) + 2 <= 10 ? 10 : Math.floor(defaultTableWidth/itemWidth) + 2;
|
|
45
|
+
setViewCount(viewCount)
|
|
46
|
+
setLeftWidth(realLeftTableWidth);
|
|
47
|
+
})
|
|
48
|
+
}, [])
|
|
49
|
+
|
|
50
|
+
const onScroll = (e) => {
|
|
51
|
+
if(topScrollBar.current){
|
|
52
|
+
topScrollBar.current.scrollTo(viewPort.current.scrollLeft, 0)
|
|
53
|
+
}
|
|
54
|
+
const scrollWidth = viewPort.current.scrollLeft;
|
|
55
|
+
let startIndex = Math.floor(scrollWidth/itemWidth);
|
|
56
|
+
if ( startIndex + viewCount >= colTableData.length) {
|
|
57
|
+
startIndex = colTableData.length - viewCount <= 0 ? 0 : colTableData.length - viewCount;
|
|
58
|
+
}
|
|
59
|
+
const offsetWidth = startIndex * itemWidth;
|
|
60
|
+
setStartIndex(startIndex);
|
|
61
|
+
setOffset(offsetWidth);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// 占位符,表格列总宽度
|
|
65
|
+
const placeholderWidth = useMemo(() => {
|
|
66
|
+
return colTableData.length*100
|
|
67
|
+
}, [colTableData])
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
useImperativeHandle(ref, () => ({
|
|
71
|
+
// 暴露子组件刷新表格方法出去,父组件可以调用该方法刷新表格数据
|
|
72
|
+
getDataSource: getDataSource,
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
// 设置表头相关信息
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
const { colData, rowData } = props;
|
|
78
|
+
let tableType;
|
|
79
|
+
if (colData && colData.length && rowData && rowData.length) {
|
|
80
|
+
tableType = 'multi-header-table';
|
|
81
|
+
const colHeaderData = convertToRows(colData);
|
|
82
|
+
const rowHeaderData = headersToRows(rowData);
|
|
83
|
+
const { rowHeader } = rowHeaderData;
|
|
84
|
+
setConfig({
|
|
85
|
+
colHeader: [],
|
|
86
|
+
colLastData: [],
|
|
87
|
+
rowHeader: [],
|
|
88
|
+
rowLastData: [],
|
|
89
|
+
...colHeaderData,
|
|
90
|
+
...rowHeaderData,
|
|
91
|
+
colHeaderToTop: (rowHeader?.length || 0)*40,
|
|
92
|
+
tableType: tableType
|
|
93
|
+
})
|
|
94
|
+
} else if (colData && colData.length) {
|
|
95
|
+
tableType = 'col-header-table';
|
|
96
|
+
const colHeaderData = convertToRows(colData);
|
|
97
|
+
setConfig({
|
|
98
|
+
colHeader: [],
|
|
99
|
+
colLastData: [],
|
|
100
|
+
rowHeader: [],
|
|
101
|
+
rowLastData: [],
|
|
102
|
+
...colHeaderData,
|
|
103
|
+
colHeaderToTop: 0,
|
|
104
|
+
tableType: tableType
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
}, [props.colData, props.rowData]);
|
|
108
|
+
|
|
109
|
+
// 设置多表头表格数据
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (!config.colLastData.length || !config.rowLastData.length || !props.multiTableData) return;
|
|
112
|
+
let tableData = {};
|
|
113
|
+
let [row, col] = [config.rowLastData, config.colLastData];
|
|
114
|
+
col.forEach(x => {
|
|
115
|
+
row.forEach(y => {
|
|
116
|
+
let key = x.id + "__" + y.id;
|
|
117
|
+
tableData[key] = "";
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
Object.assign(tableData, props.multiTableData);
|
|
121
|
+
setMmultiTableData({
|
|
122
|
+
...tableData
|
|
123
|
+
});
|
|
124
|
+
}, [config.colLastData, config.rowLastData, props.multiTableData])
|
|
125
|
+
|
|
126
|
+
// 设置纵向表格数据
|
|
127
|
+
useEffect(() => {
|
|
128
|
+
if (props?.colTableData && props?.colTableData.length) {
|
|
129
|
+
setColTableData([
|
|
130
|
+
...props.colTableData
|
|
131
|
+
])
|
|
132
|
+
}
|
|
133
|
+
}, [props.colTableData])
|
|
134
|
+
|
|
135
|
+
const getDataSource = () => {
|
|
136
|
+
return colTableData;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const tableInsFn = {
|
|
140
|
+
getDataSource: getDataSource,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
// if (!show) {
|
|
146
|
+
// return <div>loading</div>;
|
|
147
|
+
// }
|
|
148
|
+
|
|
149
|
+
const {width, height, tableProps } = props;
|
|
150
|
+
let tableWidth = width ? `${width}px` : '100%';
|
|
151
|
+
let tableHeight = `${height || 400}px`;
|
|
152
|
+
const rightAreaWidth = 'calc(100% - ' + `${realColHeaderWidth}px` + ')';
|
|
153
|
+
return (
|
|
154
|
+
<div
|
|
155
|
+
style={{width: tableWidth, height: tableHeight}}
|
|
156
|
+
key='moreTreeTable'
|
|
157
|
+
className={'editTableWrapper'}
|
|
158
|
+
onScroll={onScroll}
|
|
159
|
+
ref={viewPort}
|
|
160
|
+
>
|
|
161
|
+
<FixedScrollBar
|
|
162
|
+
stickyProps={tableProps?.sticky}
|
|
163
|
+
viewPort={viewPort}
|
|
164
|
+
ref={topScrollBar}
|
|
165
|
+
/>
|
|
166
|
+
<div style={{
|
|
167
|
+
width: `${realColHeaderWidth + placeholderWidth}px`,
|
|
168
|
+
position: 'absolute',
|
|
169
|
+
top: 0,
|
|
170
|
+
left: 0,
|
|
171
|
+
height: '100%',
|
|
172
|
+
}}
|
|
173
|
+
></div>
|
|
174
|
+
{/* -------------------------------------左上角区域--------------------------------------- */}
|
|
175
|
+
<table
|
|
176
|
+
style={{
|
|
177
|
+
width: `${realColHeaderWidth}px`,
|
|
178
|
+
height: `${config.colHeaderToTop}px`,
|
|
179
|
+
display: config.tableType === 'col-header-table' ? 'none' : '',
|
|
180
|
+
}}
|
|
181
|
+
className={`${'north__west'}`}
|
|
182
|
+
>
|
|
183
|
+
</table>
|
|
184
|
+
|
|
185
|
+
{/* --------------------------------------纵向表头---------------------------------------- */}
|
|
186
|
+
<table
|
|
187
|
+
style={{
|
|
188
|
+
tableLayout:'auto',
|
|
189
|
+
minWidth: '100px',
|
|
190
|
+
width: `${realColHeaderWidth}px`,
|
|
191
|
+
top: `${config.colHeaderToTop}px`,
|
|
192
|
+
left: '0px',
|
|
193
|
+
position: 'sticky',
|
|
194
|
+
}}
|
|
195
|
+
ref={leftTableRef}
|
|
196
|
+
className={`${'south__west'} ${'editTable__block'} ${'table_border_style'}`}
|
|
197
|
+
>
|
|
198
|
+
<tbody>
|
|
199
|
+
{config.colHeader.map((item, index) => {
|
|
200
|
+
return (
|
|
201
|
+
<tr>
|
|
202
|
+
{item.map((innerItem) => {
|
|
203
|
+
if (!innerItem) return null;
|
|
204
|
+
let fixedTop = innerItem.fixed ? `${index*40 + config.colHeaderToTop}px` : 0;
|
|
205
|
+
return (
|
|
206
|
+
<td
|
|
207
|
+
style={{
|
|
208
|
+
// width: '200px',
|
|
209
|
+
height: '40px',
|
|
210
|
+
background: '#f7f8fb',
|
|
211
|
+
lineHeight: '28px',
|
|
212
|
+
color: '#000000',
|
|
213
|
+
fontWeight: 500,
|
|
214
|
+
position: innerItem.fixed ? 'sticky' : '',
|
|
215
|
+
top: fixedTop,
|
|
216
|
+
}}
|
|
217
|
+
rowSpan={innerItem && innerItem.colSpan}
|
|
218
|
+
colSpan={innerItem && innerItem.rowSpan}
|
|
219
|
+
>
|
|
220
|
+
{innerItem && innerItem.title}
|
|
221
|
+
</td>
|
|
222
|
+
);
|
|
223
|
+
})}
|
|
224
|
+
{/* <td></td> */}
|
|
225
|
+
</tr>
|
|
226
|
+
);
|
|
227
|
+
})}
|
|
228
|
+
</tbody>
|
|
229
|
+
</table>
|
|
230
|
+
<table
|
|
231
|
+
className={` ${'editTable__block'} ${'table_border_style'}`}
|
|
232
|
+
style={{
|
|
233
|
+
width: '100%',
|
|
234
|
+
top: 0,
|
|
235
|
+
left: `${realColHeaderWidth}px`,
|
|
236
|
+
position: 'absolute',
|
|
237
|
+
display: config.tableType === 'col-header-table' ? 'none' : ''
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
<colgroup>
|
|
241
|
+
{
|
|
242
|
+
config.rowLastData.map(row => {
|
|
243
|
+
return (<col width={row.width ? `${row.width}px` : '100px'} />)
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
</colgroup>
|
|
247
|
+
<tbody>
|
|
248
|
+
{
|
|
249
|
+
config.rowHeader.map((item) => {
|
|
250
|
+
return (
|
|
251
|
+
<tr>
|
|
252
|
+
{
|
|
253
|
+
item.map((innerItem) => {
|
|
254
|
+
if (!innerItem) return null;
|
|
255
|
+
return (
|
|
256
|
+
<td
|
|
257
|
+
style={{
|
|
258
|
+
height: '40px',
|
|
259
|
+
background: '#f7f8fb',
|
|
260
|
+
color: '#000000',
|
|
261
|
+
fontWeight: 500,
|
|
262
|
+
width: innerItem.width ? `${innerItem.width}px` : '100px',
|
|
263
|
+
}}
|
|
264
|
+
rowSpan={innerItem && innerItem.rowSpan}
|
|
265
|
+
colSpan={innerItem && innerItem.colSpan}
|
|
266
|
+
>
|
|
267
|
+
{innerItem && innerItem.title}
|
|
268
|
+
</td>
|
|
269
|
+
)
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
</tr>
|
|
273
|
+
)
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
</tbody>
|
|
277
|
+
</table>
|
|
278
|
+
<div
|
|
279
|
+
style={{
|
|
280
|
+
position: 'absolute',
|
|
281
|
+
left: `${realColHeaderWidth}px`,
|
|
282
|
+
top: `${config.colHeaderToTop}px`,
|
|
283
|
+
minWidth: rightAreaWidth,
|
|
284
|
+
zIndex: 0,
|
|
285
|
+
}}
|
|
286
|
+
>
|
|
287
|
+
{/* --------------------------------------横向表头---------------------------------------- */}
|
|
288
|
+
{/* <div style={{position: 'relative'}}>
|
|
289
|
+
|
|
290
|
+
</div> */}
|
|
291
|
+
<div
|
|
292
|
+
style={{
|
|
293
|
+
width: '100%',
|
|
294
|
+
position: 'relative'
|
|
295
|
+
}}
|
|
296
|
+
className={`${'value_table'} ${'table_border_style'}`}
|
|
297
|
+
>
|
|
298
|
+
{/* ------------------------------------纵向表头数据-------------------------------------- */}
|
|
299
|
+
<table
|
|
300
|
+
style={{
|
|
301
|
+
tableLayout:'auto',
|
|
302
|
+
width: '800px',
|
|
303
|
+
display: config.tableType === 'col-header-table' ? '' : 'none',
|
|
304
|
+
transform: `translateX(${offsetWidth}px)`
|
|
305
|
+
}}
|
|
306
|
+
className={`${'editTable__block'} ${'table_border_style'}`}
|
|
307
|
+
>
|
|
308
|
+
<tbody>
|
|
309
|
+
{config.colLastData.map((item, index) => {
|
|
310
|
+
let fixedTop = item.fixed ? `${index*40 + config.colHeaderToTop}px` : 0;
|
|
311
|
+
return (
|
|
312
|
+
<tr>
|
|
313
|
+
{colTableData.map((record, index) => {
|
|
314
|
+
let tdHidden = record?.['_rowConfig']?.hidden ? 'none' : 'table-cell'
|
|
315
|
+
let onCellResult = item.onCell?.(record, index) || {}
|
|
316
|
+
let {addStyle={}} = onCellResult
|
|
317
|
+
return (
|
|
318
|
+
<td
|
|
319
|
+
style={{
|
|
320
|
+
...addStyle,
|
|
321
|
+
display: tdHidden,
|
|
322
|
+
background: (index % 2 === 1) || item.fixed ? '#f7f8fb' : '#fff',
|
|
323
|
+
minWidth: '100px',
|
|
324
|
+
width: `${itemWidth}px`,
|
|
325
|
+
height: '40px',
|
|
326
|
+
position: item.fixed ? 'sticky' : '',
|
|
327
|
+
top: fixedTop,
|
|
328
|
+
color: item.fixed ? '#000000' : 'inherit',
|
|
329
|
+
zIndex: item.fixed ? 10 : '',
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
{
|
|
333
|
+
item.render ? item.render({text:record[item.key || item.dataIndex], record, index, table: tableInsFn}) : record[item.key || item.dataIndex]
|
|
334
|
+
}
|
|
335
|
+
{/* {record[item.key || item.dataIndex]?.value} */}
|
|
336
|
+
</td>
|
|
337
|
+
);
|
|
338
|
+
}).slice(startIndex, endIndex+1)}
|
|
339
|
+
{/* <td></td> */}
|
|
340
|
+
</tr>
|
|
341
|
+
);
|
|
342
|
+
})}
|
|
343
|
+
</tbody>
|
|
344
|
+
</table>
|
|
345
|
+
{/* -------------------------------------多表头数据-------------------------------------- */}
|
|
346
|
+
<table
|
|
347
|
+
style={{
|
|
348
|
+
width: '100%',
|
|
349
|
+
display: config.tableType === 'col-header-table' ? 'none' : '',
|
|
350
|
+
}}
|
|
351
|
+
className={`${'editTable__block'} ${'table_border_style'}`}
|
|
352
|
+
>
|
|
353
|
+
<colgroup>
|
|
354
|
+
{
|
|
355
|
+
config.rowLastData.map(row => {
|
|
356
|
+
return (<col width={row.width ? `${row.width}px` : '100px'} />)
|
|
357
|
+
})
|
|
358
|
+
}
|
|
359
|
+
</colgroup>
|
|
360
|
+
<tbody>
|
|
361
|
+
{config.colLastData.map((col) => {
|
|
362
|
+
return (
|
|
363
|
+
<tr>
|
|
364
|
+
{config.rowLastData.map((row, index) => {
|
|
365
|
+
return (
|
|
366
|
+
<td
|
|
367
|
+
style={{
|
|
368
|
+
background: (index % 2 === 0) ? '#fff' : '#f7f8fb',
|
|
369
|
+
width: row.width ? `${row.width}px` : '100px',
|
|
370
|
+
height: '40px',
|
|
371
|
+
}}
|
|
372
|
+
>
|
|
373
|
+
{multiTableData[(row.key || row.dataIndex)+'__'+(col.key || col.dataIndex)]}
|
|
374
|
+
</td>
|
|
375
|
+
);
|
|
376
|
+
})}
|
|
377
|
+
{/* <td></td> */}
|
|
378
|
+
</tr>
|
|
379
|
+
);
|
|
380
|
+
})}
|
|
381
|
+
</tbody>
|
|
382
|
+
</table>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
);
|
|
387
|
+
});
|