linkmore-design 1.1.27-alpha.0 → 1.1.27-alpha.1
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/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/dist/LmEditTable/components/index.d.ts +2 -1
- package/dist/LmEditTable/util.d.ts +1 -0
- package/{lib/LmEditTable/virtual/VirtualRowBack.d.ts → dist/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
- package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/dist/index.umd.js +280 -87
- package/dist/index.umd.min.js +21 -21
- package/dist/variables.css +27 -0
- package/es/LmEditTable/EditTable.js +19 -7
- package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/es/LmEditTable/components/customRenderEmpty.js +20 -0
- package/es/LmEditTable/components/index.d.ts +2 -1
- package/es/LmEditTable/components/index.js +2 -1
- package/es/LmEditTable/style/index.css +27 -0
- package/es/LmEditTable/style/variables.css +27 -0
- package/es/LmEditTable/util.d.ts +1 -0
- package/es/LmEditTable/util.js +11 -0
- package/es/LmEditTable/virtual/VirtualRow.js +94 -16
- package/{dist/LmEditTable/virtual/VirtualRowBack.d.ts → es/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
- package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
- package/es/LmEditTable/virtual/VirtualTable.js +17 -9
- package/es/LmEditTable/virtual/context.js +14 -2
- package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/es/LmTable/virTual/VirtualRow.js +80 -44
- package/es/LmTable/virTual/VirtualTable.js +17 -9
- package/es/LmTable/virTual/context.js +14 -2
- package/es/styles/variables.css +27 -0
- package/lib/LmEditTable/EditTable.js +18 -5
- package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
- package/lib/LmEditTable/components/index.d.ts +2 -1
- package/lib/LmEditTable/components/index.js +8 -0
- package/lib/LmEditTable/style/index.css +27 -0
- package/lib/LmEditTable/style/variables.css +27 -0
- package/lib/LmEditTable/util.d.ts +1 -0
- package/lib/LmEditTable/util.js +13 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +93 -16
- package/{es/LmEditTable/virtual/VirtualRowBack.d.ts → lib/LmEditTable/virtual/VirtualRow2.d.ts} +1 -0
- package/lib/LmEditTable/virtual/{VirtualRowBack.js → VirtualRow2.js} +13 -48
- package/lib/LmEditTable/virtual/VirtualTable.js +16 -8
- package/lib/LmEditTable/virtual/context.js +14 -2
- package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/lib/LmTable/virTual/VirtualRow.js +79 -44
- package/lib/LmTable/virTual/VirtualTable.js +16 -8
- package/lib/LmTable/virTual/context.js +14 -2
- package/lib/styles/variables.css +27 -0
- package/package.json +1 -1
- package/es/LmEditTable/virtual/VirtualRowBack.js +0 -100
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import DraggableContainer from './DraggableContainer';
|
|
2
2
|
import BottomOpetateComponent from './bottomOpetateComponent';
|
|
3
3
|
import QuickOpetate from './QuickOpetate';
|
|
4
|
-
|
|
4
|
+
import CustomizeRenderEmpty from './customRenderEmpty';
|
|
5
|
+
export { DraggableContainer, BottomOpetateComponent, QuickOpetate, CustomizeRenderEmpty };
|
|
5
6
|
declare const _default: {
|
|
6
7
|
DraggableContainer: ({ keys, onSortEnd, virtual, rowKey, options, tableWidth, ...props }: {
|
|
7
8
|
[x: string]: any;
|
|
@@ -9,6 +9,7 @@ export declare function checkExpandIconColumnIndex({ rowSelection, sortOpen, ind
|
|
|
9
9
|
sortOpen: any;
|
|
10
10
|
indexCol: any;
|
|
11
11
|
}): number;
|
|
12
|
+
export declare function checkDataSourceIsEmpty(config: any, dataSource: any): any;
|
|
12
13
|
declare const _default: {
|
|
13
14
|
isObjEmpty: typeof isObjEmpty;
|
|
14
15
|
};
|
package/{lib/LmEditTable/virtual/VirtualRowBack.d.ts → dist/LmEditTable/virtual/VirtualRow2.d.ts}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface rowProps {
|
|
3
|
-
children?: any;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface rowProps {
|
|
3
|
+
children?: any;
|
|
4
|
+
pref?: any;
|
|
5
|
+
}
|
|
6
|
+
declare const VirtualRow: React.NamedExoticComponent<rowProps>;
|
|
7
|
+
export default VirtualRow;
|
package/dist/index.umd.js
CHANGED
|
@@ -285842,13 +285842,20 @@
|
|
|
285842
285842
|
rowHeight: 0,
|
|
285843
285843
|
columnsLen: 0,
|
|
285844
285844
|
// 总行数
|
|
285845
|
-
totalLen: 0
|
|
285845
|
+
totalLen: 0,
|
|
285846
|
+
// 分割后的列数组
|
|
285847
|
+
sliceColumns: {
|
|
285848
|
+
leftColumns: [],
|
|
285849
|
+
centerColumns: [],
|
|
285850
|
+
rightColumns: []
|
|
285851
|
+
}
|
|
285846
285852
|
};
|
|
285847
285853
|
|
|
285848
285854
|
var reducer$4 = function reducer(state, action) {
|
|
285849
285855
|
var totalLen = action.totalLen,
|
|
285850
285856
|
columnsLen = action.columnsLen,
|
|
285851
|
-
rowHeight = action.rowHeight
|
|
285857
|
+
rowHeight = action.rowHeight,
|
|
285858
|
+
sliceColumns = action.sliceColumns;
|
|
285852
285859
|
|
|
285853
285860
|
switch (action.type) {
|
|
285854
285861
|
// 数据数量
|
|
@@ -285869,6 +285876,11 @@
|
|
|
285869
285876
|
rowHeight: rowHeight
|
|
285870
285877
|
});
|
|
285871
285878
|
|
|
285879
|
+
case 'changeSliceColumns':
|
|
285880
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
285881
|
+
sliceColumns: sliceColumns
|
|
285882
|
+
});
|
|
285883
|
+
|
|
285872
285884
|
default:
|
|
285873
285885
|
throw new Error();
|
|
285874
285886
|
}
|
|
@@ -285879,14 +285891,14 @@
|
|
|
285879
285891
|
};
|
|
285880
285892
|
|
|
285881
285893
|
var VirtualTable = /*#__PURE__*/React__default['default'].memo(function (tableProps) {
|
|
285882
|
-
var _bodyRef$current,
|
|
285894
|
+
var _bodyRef$current, _tableProps$children$3, _tableProps$children$4, _bodyRef$current2;
|
|
285883
285895
|
|
|
285884
285896
|
var bodyRef = React.useRef(null);
|
|
285885
285897
|
|
|
285886
285898
|
var _useRealive = useRealive(),
|
|
285887
285899
|
_useRealive2 = _slicedToArray$1(_useRealive, 2),
|
|
285888
285900
|
state = _useRealive2[0],
|
|
285889
|
-
dispatch = _useRealive2[1]; // { totalSize, virtualItems }
|
|
285901
|
+
dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
|
|
285890
285902
|
|
|
285891
285903
|
|
|
285892
285904
|
var rowVirtual = useVirtual({
|
|
@@ -285899,18 +285911,26 @@
|
|
|
285899
285911
|
return state.rowHeight;
|
|
285900
285912
|
}, [state.rowHeight]),
|
|
285901
285913
|
overscan: 5
|
|
285902
|
-
});
|
|
285914
|
+
}); // 列动态宽度
|
|
285915
|
+
|
|
285916
|
+
var columnEstimateSize = React.useCallback(function (i) {
|
|
285917
|
+
var _tableProps$children$, _tableProps$children$2;
|
|
285918
|
+
|
|
285919
|
+
var colWidths = tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$children$ = tableProps.children[0]) === null || _tableProps$children$ === void 0 ? void 0 : (_tableProps$children$2 = _tableProps$children$.props) === null || _tableProps$children$2 === void 0 ? void 0 : _tableProps$children$2.colWidths;
|
|
285920
|
+
var leftColumnsLen = state.sliceColumns.leftColumns.length;
|
|
285921
|
+
var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
|
|
285922
|
+
|
|
285923
|
+
var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
|
|
285924
|
+
return virList[i] || 0;
|
|
285925
|
+
}, [(_tableProps$children$3 = tableProps.children[0]) === null || _tableProps$children$3 === void 0 ? void 0 : (_tableProps$children$4 = _tableProps$children$3.props) === null || _tableProps$children$4 === void 0 ? void 0 : _tableProps$children$4.colWidths, state.sliceColumns.leftColumns.length, state.sliceColumns.centerColumns.length]); // 列虚拟化
|
|
285926
|
+
|
|
285903
285927
|
var columnVirtual = useVirtual({
|
|
285904
285928
|
horizontal: true,
|
|
285905
285929
|
size: state.columnsLen,
|
|
285906
285930
|
parentRef: {
|
|
285907
285931
|
current: bodyRef === null || bodyRef === void 0 ? void 0 : (_bodyRef$current2 = bodyRef.current) === null || _bodyRef$current2 === void 0 ? void 0 : _bodyRef$current2.parentNode
|
|
285908
285932
|
},
|
|
285909
|
-
estimateSize:
|
|
285910
|
-
var _tableProps$children$, _tableProps$children$2;
|
|
285911
|
-
|
|
285912
|
-
return tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$children$ = tableProps.children[0]) === null || _tableProps$children$ === void 0 ? void 0 : (_tableProps$children$2 = _tableProps$children$.props) === null || _tableProps$children$2 === void 0 ? void 0 : _tableProps$children$2.colWidths[i];
|
|
285913
|
-
}, [(_tableProps$children$3 = tableProps.children[0]) === null || _tableProps$children$3 === void 0 ? void 0 : (_tableProps$children$4 = _tableProps$children$3.props) === null || _tableProps$children$4 === void 0 ? void 0 : _tableProps$children$4.colWidths]),
|
|
285933
|
+
estimateSize: columnEstimateSize,
|
|
285914
285934
|
overscan: 5
|
|
285915
285935
|
});
|
|
285916
285936
|
var instance = {
|
|
@@ -285975,37 +285995,63 @@
|
|
|
285975
285995
|
});
|
|
285976
285996
|
|
|
285977
285997
|
var _excluded$28 = ["children"];
|
|
285978
|
-
|
|
285998
|
+
|
|
285999
|
+
var useOptions$2 = function useOptions(_ref) {
|
|
285979
286000
|
var children = _ref.children,
|
|
285980
|
-
|
|
286001
|
+
ref = _ref.ref,
|
|
286002
|
+
trRef = _ref.trRef;
|
|
285981
286003
|
|
|
285982
286004
|
var _useStore = useStore(),
|
|
285983
286005
|
state = _useStore.state,
|
|
285984
286006
|
dispatch = _useStore.dispatch,
|
|
285985
286007
|
instance = _useStore.instance;
|
|
285986
286008
|
|
|
286009
|
+
var virtualItems = instance.columnVirtual.virtualItems;
|
|
285987
286010
|
var rowHeight = state.rowHeight,
|
|
285988
286011
|
totalLen = state.totalLen;
|
|
285989
|
-
var
|
|
285990
|
-
|
|
286012
|
+
var sliceColumns = React.useMemo(function () {
|
|
286013
|
+
return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
|
|
286014
|
+
var _cur$props, _cur$props2;
|
|
285991
286015
|
|
|
285992
|
-
|
|
285993
|
-
|
|
286016
|
+
if (typeof ((_cur$props = cur.props) === null || _cur$props === void 0 ? void 0 : _cur$props.fixLeft) === 'number') {
|
|
286017
|
+
pre.leftColumns.push(cur);
|
|
286018
|
+
return pre;
|
|
286019
|
+
}
|
|
285994
286020
|
|
|
285995
|
-
|
|
285996
|
-
|
|
286021
|
+
if (typeof ((_cur$props2 = cur.props) === null || _cur$props2 === void 0 ? void 0 : _cur$props2.fixRight) === 'number') {
|
|
286022
|
+
pre.rightColumns.push(cur);
|
|
286023
|
+
return pre;
|
|
286024
|
+
}
|
|
285997
286025
|
|
|
285998
|
-
|
|
285999
|
-
|
|
286026
|
+
pre.centerColumns.push(cur);
|
|
286027
|
+
return pre;
|
|
286028
|
+
}, {
|
|
286029
|
+
leftColumns: [],
|
|
286030
|
+
rightColumns: [],
|
|
286031
|
+
centerColumns: []
|
|
286032
|
+
});
|
|
286000
286033
|
}, [children]);
|
|
286001
286034
|
React.useEffect(function () {
|
|
286002
|
-
|
|
286035
|
+
dispatch({
|
|
286036
|
+
type: 'changeSliceColumns',
|
|
286037
|
+
sliceColumns: sliceColumns
|
|
286038
|
+
});
|
|
286039
|
+
}, [sliceColumns]); // 非固定列长度
|
|
286040
|
+
|
|
286041
|
+
var centerColumnsLen = React.useMemo(function () {
|
|
286042
|
+
var _sliceColumns$centerC;
|
|
286043
|
+
|
|
286044
|
+
return (_sliceColumns$centerC = sliceColumns.centerColumns.length) !== null && _sliceColumns$centerC !== void 0 ? _sliceColumns$centerC : 0;
|
|
286045
|
+
}, [sliceColumns]);
|
|
286046
|
+
React.useEffect(function () {
|
|
286047
|
+
if (state.columnsLen !== centerColumnsLen) {
|
|
286003
286048
|
dispatch({
|
|
286004
286049
|
type: 'changeColumnsLen',
|
|
286005
|
-
columnsLen:
|
|
286050
|
+
columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
|
|
286006
286051
|
});
|
|
286007
286052
|
}
|
|
286008
|
-
}, [
|
|
286053
|
+
}, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
|
|
286054
|
+
|
|
286009
286055
|
React.useEffect(function () {
|
|
286010
286056
|
var initHeight = function initHeight(tempRef) {
|
|
286011
286057
|
var _tempRef$current;
|
|
@@ -286016,50 +286062,60 @@
|
|
|
286016
286062
|
var tempRowHeight = (_tempRef$current$offs = tempRef === null || tempRef === void 0 ? void 0 : (_tempRef$current2 = tempRef.current) === null || _tempRef$current2 === void 0 ? void 0 : _tempRef$current2.offsetHeight) !== null && _tempRef$current$offs !== void 0 ? _tempRef$current$offs : 0;
|
|
286017
286063
|
dispatch({
|
|
286018
286064
|
type: 'initHeight',
|
|
286019
|
-
rowHeight: tempRowHeight
|
|
286065
|
+
rowHeight: tempRowHeight + 1
|
|
286020
286066
|
});
|
|
286021
286067
|
}
|
|
286022
286068
|
};
|
|
286023
286069
|
|
|
286024
286070
|
initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
|
|
286025
|
-
}, [trRef, dispatch, rowHeight, totalLen, ref]); //
|
|
286071
|
+
}, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
|
|
286026
286072
|
|
|
286027
|
-
var
|
|
286028
|
-
|
|
286029
|
-
var _cur$props, _cur$props2;
|
|
286073
|
+
var leftColSpan = React.useMemo(function () {
|
|
286074
|
+
var _virtualItems$;
|
|
286030
286075
|
|
|
286031
|
-
|
|
286032
|
-
|
|
286033
|
-
|
|
286034
|
-
|
|
286076
|
+
return (_virtualItems$ = virtualItems[0]) === null || _virtualItems$ === void 0 ? void 0 : _virtualItems$.index;
|
|
286077
|
+
}, [virtualItems]); // 右侧隐藏数量
|
|
286078
|
+
|
|
286079
|
+
var rightColSpan = React.useMemo(function () {
|
|
286080
|
+
return sliceColumns.centerColumns.length - virtualItems.length - leftColSpan || 0;
|
|
286081
|
+
}, [sliceColumns.centerColumns.length, virtualItems.length, leftColSpan]);
|
|
286082
|
+
return _objectSpread(_objectSpread({
|
|
286083
|
+
virtualItems: virtualItems
|
|
286084
|
+
}, sliceColumns), {}, {
|
|
286085
|
+
leftColSpan: leftColSpan,
|
|
286086
|
+
rightColSpan: rightColSpan
|
|
286087
|
+
});
|
|
286088
|
+
};
|
|
286035
286089
|
|
|
286036
|
-
|
|
286037
|
-
|
|
286038
|
-
|
|
286039
|
-
}
|
|
286090
|
+
var VirtualRow = /*#__PURE__*/React__default['default'].memo(function (_ref2, ref) {
|
|
286091
|
+
var children = _ref2.children,
|
|
286092
|
+
resetProps = _objectWithoutProperties$1(_ref2, _excluded$28);
|
|
286040
286093
|
|
|
286041
|
-
|
|
286042
|
-
return pre;
|
|
286043
|
-
}, {
|
|
286044
|
-
fixedLeft: [],
|
|
286045
|
-
fixedRight: [],
|
|
286046
|
-
columns: []
|
|
286047
|
-
});
|
|
286048
|
-
}, [children]); // 横线单元格合并
|
|
286094
|
+
var trRef = React.useRef(null);
|
|
286049
286095
|
|
|
286050
|
-
var
|
|
286051
|
-
|
|
286096
|
+
var _useOptions = useOptions$2({
|
|
286097
|
+
children: children,
|
|
286098
|
+
ref: ref,
|
|
286099
|
+
trRef: trRef
|
|
286100
|
+
}),
|
|
286101
|
+
virtualItems = _useOptions.virtualItems,
|
|
286102
|
+
leftColumns = _useOptions.leftColumns,
|
|
286103
|
+
centerColumns = _useOptions.centerColumns,
|
|
286104
|
+
rightColumns = _useOptions.rightColumns,
|
|
286105
|
+
leftColSpan = _useOptions.leftColSpan,
|
|
286106
|
+
rightColSpan = _useOptions.rightColSpan;
|
|
286052
286107
|
|
|
286053
|
-
return (_virtualItems$ = virtualItems[0]) === null || _virtualItems$ === void 0 ? void 0 : _virtualItems$.index;
|
|
286054
|
-
}, [virtualItems]);
|
|
286055
|
-
console.log('virtualItems', virtualItems);
|
|
286056
286108
|
return /*#__PURE__*/React__default['default'].createElement("tr", _objectSpread(_objectSpread({}, resetProps), {}, {
|
|
286057
286109
|
ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
|
|
286058
|
-
}),
|
|
286059
|
-
|
|
286110
|
+
}), leftColumns, !!leftColSpan && /*#__PURE__*/React__default['default'].createElement("td", {
|
|
286111
|
+
key: "leftColSpan",
|
|
286112
|
+
colSpan: leftColSpan
|
|
286060
286113
|
}), virtualItems.map(function (virtualCol) {
|
|
286061
|
-
return
|
|
286062
|
-
}),
|
|
286114
|
+
return centerColumns[virtualCol.index];
|
|
286115
|
+
}), !!rightColSpan && /*#__PURE__*/React__default['default'].createElement("td", {
|
|
286116
|
+
key: "rightColSpan",
|
|
286117
|
+
colSpan: rightColSpan
|
|
286118
|
+
}), rightColumns);
|
|
286063
286119
|
});
|
|
286064
286120
|
|
|
286065
286121
|
// 分组求和计算
|
|
@@ -312779,13 +312835,20 @@
|
|
|
312779
312835
|
rowHeight: 0,
|
|
312780
312836
|
columnsLen: 0,
|
|
312781
312837
|
// 总行数
|
|
312782
|
-
totalLen: 0
|
|
312838
|
+
totalLen: 0,
|
|
312839
|
+
// 分割后的列数组
|
|
312840
|
+
sliceColumns: {
|
|
312841
|
+
leftColumns: [],
|
|
312842
|
+
centerColumns: [],
|
|
312843
|
+
rightColumns: []
|
|
312844
|
+
}
|
|
312783
312845
|
};
|
|
312784
312846
|
|
|
312785
312847
|
var reducer$5 = function reducer(state, action) {
|
|
312786
312848
|
var totalLen = action.totalLen,
|
|
312787
312849
|
columnsLen = action.columnsLen,
|
|
312788
|
-
rowHeight = action.rowHeight
|
|
312850
|
+
rowHeight = action.rowHeight,
|
|
312851
|
+
sliceColumns = action.sliceColumns;
|
|
312789
312852
|
|
|
312790
312853
|
switch (action.type) {
|
|
312791
312854
|
// 数据数量
|
|
@@ -312806,6 +312869,11 @@
|
|
|
312806
312869
|
rowHeight: rowHeight
|
|
312807
312870
|
});
|
|
312808
312871
|
|
|
312872
|
+
case 'changeSliceColumns':
|
|
312873
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
312874
|
+
sliceColumns: sliceColumns
|
|
312875
|
+
});
|
|
312876
|
+
|
|
312809
312877
|
default:
|
|
312810
312878
|
throw new Error();
|
|
312811
312879
|
}
|
|
@@ -312816,14 +312884,14 @@
|
|
|
312816
312884
|
};
|
|
312817
312885
|
|
|
312818
312886
|
var VirtualTable$1 = /*#__PURE__*/React__default['default'].memo(function (tableProps) {
|
|
312819
|
-
var _bodyRef$current,
|
|
312887
|
+
var _bodyRef$current, _tableProps$children$3, _tableProps$children$4, _bodyRef$current2;
|
|
312820
312888
|
|
|
312821
312889
|
var bodyRef = React.useRef(null);
|
|
312822
312890
|
|
|
312823
312891
|
var _useRealive = useRealive$1(),
|
|
312824
312892
|
_useRealive2 = _slicedToArray$1(_useRealive, 2),
|
|
312825
312893
|
state = _useRealive2[0],
|
|
312826
|
-
dispatch = _useRealive2[1]; // { totalSize, virtualItems }
|
|
312894
|
+
dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
|
|
312827
312895
|
|
|
312828
312896
|
|
|
312829
312897
|
var rowVirtual = useVirtual({
|
|
@@ -312836,18 +312904,26 @@
|
|
|
312836
312904
|
return state.rowHeight;
|
|
312837
312905
|
}, [state.rowHeight]),
|
|
312838
312906
|
overscan: 5
|
|
312839
|
-
});
|
|
312907
|
+
}); // 列动态宽度
|
|
312908
|
+
|
|
312909
|
+
var columnEstimateSize = React.useCallback(function (i) {
|
|
312910
|
+
var _tableProps$children$, _tableProps$children$2;
|
|
312911
|
+
|
|
312912
|
+
var colWidths = tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$children$ = tableProps.children[0]) === null || _tableProps$children$ === void 0 ? void 0 : (_tableProps$children$2 = _tableProps$children$.props) === null || _tableProps$children$2 === void 0 ? void 0 : _tableProps$children$2.colWidths;
|
|
312913
|
+
var leftColumnsLen = state.sliceColumns.leftColumns.length;
|
|
312914
|
+
var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
|
|
312915
|
+
|
|
312916
|
+
var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
|
|
312917
|
+
return virList[i] || 0;
|
|
312918
|
+
}, [(_tableProps$children$3 = tableProps.children[0]) === null || _tableProps$children$3 === void 0 ? void 0 : (_tableProps$children$4 = _tableProps$children$3.props) === null || _tableProps$children$4 === void 0 ? void 0 : _tableProps$children$4.colWidths, state.sliceColumns.leftColumns.length, state.sliceColumns.centerColumns.length]); // 列虚拟化
|
|
312919
|
+
|
|
312840
312920
|
var columnVirtual = useVirtual({
|
|
312841
312921
|
horizontal: true,
|
|
312842
312922
|
size: state.columnsLen,
|
|
312843
312923
|
parentRef: {
|
|
312844
312924
|
current: bodyRef === null || bodyRef === void 0 ? void 0 : (_bodyRef$current2 = bodyRef.current) === null || _bodyRef$current2 === void 0 ? void 0 : _bodyRef$current2.parentNode
|
|
312845
312925
|
},
|
|
312846
|
-
estimateSize:
|
|
312847
|
-
var _tableProps$children$, _tableProps$children$2;
|
|
312848
|
-
|
|
312849
|
-
return tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$children$ = tableProps.children[0]) === null || _tableProps$children$ === void 0 ? void 0 : (_tableProps$children$2 = _tableProps$children$.props) === null || _tableProps$children$2 === void 0 ? void 0 : _tableProps$children$2.colWidths[i];
|
|
312850
|
-
}, [(_tableProps$children$3 = tableProps.children[0]) === null || _tableProps$children$3 === void 0 ? void 0 : (_tableProps$children$4 = _tableProps$children$3.props) === null || _tableProps$children$4 === void 0 ? void 0 : _tableProps$children$4.colWidths]),
|
|
312926
|
+
estimateSize: columnEstimateSize,
|
|
312851
312927
|
overscan: 5
|
|
312852
312928
|
});
|
|
312853
312929
|
var instance = {
|
|
@@ -312933,32 +313009,63 @@
|
|
|
312933
313009
|
}
|
|
312934
313010
|
|
|
312935
313011
|
var _excluded$2Q = ["children", "pref"];
|
|
312936
|
-
|
|
313012
|
+
|
|
313013
|
+
var useOptions$3 = function useOptions(_ref) {
|
|
312937
313014
|
var children = _ref.children,
|
|
312938
|
-
|
|
312939
|
-
|
|
313015
|
+
ref = _ref.ref,
|
|
313016
|
+
trRef = _ref.trRef;
|
|
312940
313017
|
|
|
312941
313018
|
var _useStore = useStore$1(),
|
|
312942
313019
|
state = _useStore.state,
|
|
312943
|
-
dispatch = _useStore.dispatch
|
|
313020
|
+
dispatch = _useStore.dispatch,
|
|
313021
|
+
instance = _useStore.instance;
|
|
312944
313022
|
|
|
313023
|
+
var virtualItems = instance.columnVirtual.virtualItems;
|
|
312945
313024
|
var rowHeight = state.rowHeight,
|
|
312946
313025
|
totalLen = state.totalLen;
|
|
312947
|
-
var
|
|
313026
|
+
var sliceColumns = React.useMemo(function () {
|
|
313027
|
+
return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
|
|
313028
|
+
var _cur$props, _cur$props2;
|
|
312948
313029
|
|
|
312949
|
-
|
|
312950
|
-
|
|
313030
|
+
if (typeof ((_cur$props = cur.props) === null || _cur$props === void 0 ? void 0 : _cur$props.fixLeft) === 'number') {
|
|
313031
|
+
pre.leftColumns.push(cur);
|
|
313032
|
+
return pre;
|
|
313033
|
+
}
|
|
312951
313034
|
|
|
312952
|
-
|
|
313035
|
+
if (typeof ((_cur$props2 = cur.props) === null || _cur$props2 === void 0 ? void 0 : _cur$props2.fixRight) === 'number') {
|
|
313036
|
+
pre.rightColumns.push(cur);
|
|
313037
|
+
return pre;
|
|
313038
|
+
}
|
|
313039
|
+
|
|
313040
|
+
pre.centerColumns.push(cur);
|
|
313041
|
+
return pre;
|
|
313042
|
+
}, {
|
|
313043
|
+
leftColumns: [],
|
|
313044
|
+
rightColumns: [],
|
|
313045
|
+
centerColumns: []
|
|
313046
|
+
});
|
|
312953
313047
|
}, [children]);
|
|
312954
313048
|
React.useEffect(function () {
|
|
312955
|
-
|
|
313049
|
+
dispatch({
|
|
313050
|
+
type: 'changeSliceColumns',
|
|
313051
|
+
sliceColumns: sliceColumns
|
|
313052
|
+
});
|
|
313053
|
+
}, [sliceColumns]); // 非固定列长度
|
|
313054
|
+
|
|
313055
|
+
var centerColumnsLen = React.useMemo(function () {
|
|
313056
|
+
var _sliceColumns$centerC;
|
|
313057
|
+
|
|
313058
|
+
return (_sliceColumns$centerC = sliceColumns.centerColumns.length) !== null && _sliceColumns$centerC !== void 0 ? _sliceColumns$centerC : 0;
|
|
313059
|
+
}, [sliceColumns]);
|
|
313060
|
+
React.useEffect(function () {
|
|
313061
|
+
if (state.columnsLen !== centerColumnsLen) {
|
|
312956
313062
|
dispatch({
|
|
312957
313063
|
type: 'changeColumnsLen',
|
|
312958
|
-
columnsLen:
|
|
313064
|
+
columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
|
|
312959
313065
|
});
|
|
312960
313066
|
}
|
|
312961
|
-
}, [
|
|
313067
|
+
}, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
|
|
313068
|
+
|
|
312962
313069
|
React.useEffect(function () {
|
|
312963
313070
|
var initHeight = function initHeight(tempRef) {
|
|
312964
313071
|
var _tempRef$current;
|
|
@@ -312969,16 +313076,63 @@
|
|
|
312969
313076
|
var tempRowHeight = (_tempRef$current$offs = tempRef === null || tempRef === void 0 ? void 0 : (_tempRef$current2 = tempRef.current) === null || _tempRef$current2 === void 0 ? void 0 : _tempRef$current2.offsetHeight) !== null && _tempRef$current$offs !== void 0 ? _tempRef$current$offs : 0;
|
|
312970
313077
|
dispatch({
|
|
312971
313078
|
type: 'initHeight',
|
|
312972
|
-
rowHeight: tempRowHeight
|
|
313079
|
+
rowHeight: tempRowHeight + 1
|
|
312973
313080
|
});
|
|
312974
313081
|
}
|
|
312975
313082
|
};
|
|
312976
313083
|
|
|
312977
|
-
initHeight(trRef);
|
|
312978
|
-
}, [trRef, dispatch, rowHeight, totalLen, ref]);
|
|
313084
|
+
initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
|
|
313085
|
+
}, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
|
|
313086
|
+
|
|
313087
|
+
var leftColSpan = React.useMemo(function () {
|
|
313088
|
+
var _virtualItems$;
|
|
313089
|
+
|
|
313090
|
+
return (_virtualItems$ = virtualItems[0]) === null || _virtualItems$ === void 0 ? void 0 : _virtualItems$.index;
|
|
313091
|
+
}, [virtualItems]); // 右侧隐藏数量
|
|
313092
|
+
|
|
313093
|
+
var rightColSpan = React.useMemo(function () {
|
|
313094
|
+
return sliceColumns.centerColumns.length - virtualItems.length - leftColSpan || 0;
|
|
313095
|
+
}, [sliceColumns.centerColumns.length, virtualItems.length, leftColSpan]);
|
|
313096
|
+
return _objectSpread(_objectSpread({
|
|
313097
|
+
virtualItems: virtualItems
|
|
313098
|
+
}, sliceColumns), {}, {
|
|
313099
|
+
leftColSpan: leftColSpan,
|
|
313100
|
+
rightColSpan: rightColSpan
|
|
313101
|
+
});
|
|
313102
|
+
};
|
|
313103
|
+
|
|
313104
|
+
var VirtualRow$1 = /*#__PURE__*/React__default['default'].memo(function (_ref2, ref) {
|
|
313105
|
+
var children = _ref2.children,
|
|
313106
|
+
pref = _ref2.pref,
|
|
313107
|
+
resetProps = _objectWithoutProperties$1(_ref2, _excluded$2Q);
|
|
313108
|
+
|
|
313109
|
+
var trRef = React.useRef(null);
|
|
313110
|
+
|
|
313111
|
+
var _useOptions = useOptions$3({
|
|
313112
|
+
children: children,
|
|
313113
|
+
ref: ref,
|
|
313114
|
+
trRef: trRef
|
|
313115
|
+
}),
|
|
313116
|
+
virtualItems = _useOptions.virtualItems,
|
|
313117
|
+
leftColumns = _useOptions.leftColumns,
|
|
313118
|
+
centerColumns = _useOptions.centerColumns,
|
|
313119
|
+
rightColumns = _useOptions.rightColumns,
|
|
313120
|
+
leftColSpan = _useOptions.leftColSpan,
|
|
313121
|
+
rightColSpan = _useOptions.rightColSpan;
|
|
313122
|
+
|
|
312979
313123
|
return /*#__PURE__*/React__default['default'].createElement("tr", _objectSpread(_objectSpread({}, resetProps), {}, {
|
|
312980
313124
|
ref: useForkRef(pref, trRef)
|
|
312981
|
-
}),
|
|
313125
|
+
}), leftColumns, !!leftColSpan && /*#__PURE__*/React__default['default'].createElement("td", {
|
|
313126
|
+
key: "leftColSpan",
|
|
313127
|
+
colSpan: leftColSpan
|
|
313128
|
+
}), virtualItems.map(function (virtualCol) {
|
|
313129
|
+
return /*#__PURE__*/React__default['default'].cloneElement(centerColumns[virtualCol.index], {
|
|
313130
|
+
ref: virtualCol.measureRef
|
|
313131
|
+
});
|
|
313132
|
+
}), !!rightColSpan && /*#__PURE__*/React__default['default'].createElement("td", {
|
|
313133
|
+
key: "rightColSpan",
|
|
313134
|
+
colSpan: rightColSpan
|
|
313135
|
+
}), rightColumns);
|
|
312982
313136
|
});
|
|
312983
313137
|
|
|
312984
313138
|
var _excluded$2R = ["data-row-key", "children", "className", "virtual"];
|
|
@@ -313248,6 +313402,17 @@
|
|
|
313248
313402
|
});
|
|
313249
313403
|
return arr.length;
|
|
313250
313404
|
}
|
|
313405
|
+
function checkDataSourceIsEmpty(config, dataSource) {
|
|
313406
|
+
if (dataSource.length) {
|
|
313407
|
+
return config;
|
|
313408
|
+
}
|
|
313409
|
+
|
|
313410
|
+
return _objectSpread(_objectSpread({}, config), {}, {
|
|
313411
|
+
components: _objectSpread(_objectSpread({}, config.components), {}, {
|
|
313412
|
+
body: {}
|
|
313413
|
+
})
|
|
313414
|
+
});
|
|
313415
|
+
}
|
|
313251
313416
|
|
|
313252
313417
|
var DndContainer$3 = function DndContainer(_ref) {
|
|
313253
313418
|
var children = _ref.children,
|
|
@@ -313507,6 +313672,23 @@
|
|
|
313507
313672
|
}) : null);
|
|
313508
313673
|
};
|
|
313509
313674
|
|
|
313675
|
+
var ConfigContext$7 = ConfigProvider$1.ConfigContext;
|
|
313676
|
+
|
|
313677
|
+
var CustomizeRenderEmpty$1 = function CustomizeRenderEmpty() {
|
|
313678
|
+
var _React$useContext = React__default['default'].useContext(ConfigContext$7),
|
|
313679
|
+
locale = _React$useContext.locale;
|
|
313680
|
+
|
|
313681
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
313682
|
+
className: "lm_table_empty"
|
|
313683
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
313684
|
+
className: "empty_img",
|
|
313685
|
+
style: {
|
|
313686
|
+
width: '130px',
|
|
313687
|
+
height: '80px'
|
|
313688
|
+
}
|
|
313689
|
+
}), /*#__PURE__*/React__default['default'].createElement("span", null, (locale === null || locale === void 0 ? void 0 : locale.locale) === 'en' ? 'no Data' : '暂无数据'));
|
|
313690
|
+
};
|
|
313691
|
+
|
|
313510
313692
|
var _excluded$2V = ["index", "virtual"],
|
|
313511
313693
|
_excluded2$I = ["index"],
|
|
313512
313694
|
_excluded3$b = ["value", "onChange", "record", "rowIndex", "colIndex", "validator"],
|
|
@@ -314715,7 +314897,10 @@
|
|
|
314715
314897
|
setLocalRowSelectList({
|
|
314716
314898
|
selectedRows: value
|
|
314717
314899
|
});
|
|
314718
|
-
}
|
|
314900
|
+
},
|
|
314901
|
+
columns: columns.map(function (item) {
|
|
314902
|
+
return lodash.omit(item, ['render', 'sorter', 'onFilter', 'filters', 'componentProps', 'formProps', 'editable']);
|
|
314903
|
+
})
|
|
314719
314904
|
};
|
|
314720
314905
|
});
|
|
314721
314906
|
var isShowAddAction = React.useMemo(function () {
|
|
@@ -314776,6 +314961,10 @@
|
|
|
314776
314961
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
314777
314962
|
className: "lm_editTable_warpper",
|
|
314778
314963
|
ref: tableWarpRef
|
|
314964
|
+
}, /*#__PURE__*/React__default['default'].createElement(ConfigProvider$1, {
|
|
314965
|
+
renderEmpty: loading ? function () {
|
|
314966
|
+
return null;
|
|
314967
|
+
} : CustomizeRenderEmpty$1
|
|
314779
314968
|
}, /*#__PURE__*/React__default['default'].createElement(DndContainer$2, {
|
|
314780
314969
|
rowKey: _rowKey,
|
|
314781
314970
|
options: resultColumns,
|
|
@@ -314784,7 +314973,7 @@
|
|
|
314784
314973
|
items: columns.reduce(function (acc, item) {
|
|
314785
314974
|
return [].concat(_toConsumableArray$1(acc), [item.dataIndex]);
|
|
314786
314975
|
}, [])
|
|
314787
|
-
}, /*#__PURE__*/React__default['default'].createElement(Table$1, _objectSpread(_objectSpread({}, config.current), {}, {
|
|
314976
|
+
}, /*#__PURE__*/React__default['default'].createElement(Table$1, _objectSpread(_objectSpread({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current)), {}, {
|
|
314788
314977
|
loading: loading,
|
|
314789
314978
|
size: size || 'small',
|
|
314790
314979
|
columns: resultColumns,
|
|
@@ -314804,7 +314993,7 @@
|
|
|
314804
314993
|
}
|
|
314805
314994
|
}),
|
|
314806
314995
|
dataSource: dataSource
|
|
314807
|
-
})))), /*#__PURE__*/React__default['default'].createElement(BottomOpetateComponent, {
|
|
314996
|
+
}))))), /*#__PURE__*/React__default['default'].createElement(BottomOpetateComponent, {
|
|
314808
314997
|
disabled: disabled,
|
|
314809
314998
|
isShowAddAction: isShowAddAction,
|
|
314810
314999
|
recordCreatorProps: recordCreatorProps,
|
|
@@ -314816,7 +315005,11 @@
|
|
|
314816
315005
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
314817
315006
|
className: "lm_editTable_warpper",
|
|
314818
315007
|
ref: tableWarpRef
|
|
314819
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
315008
|
+
}, /*#__PURE__*/React__default['default'].createElement(ConfigProvider$1, {
|
|
315009
|
+
renderEmpty: loading ? function () {
|
|
315010
|
+
return null;
|
|
315011
|
+
} : CustomizeRenderEmpty$1
|
|
315012
|
+
}, /*#__PURE__*/React__default['default'].createElement(Table$1, _objectSpread(_objectSpread({}, checkDataSourceIsEmpty(config.current, dataSourceRef.current)), {}, {
|
|
314820
315013
|
size: size || 'small',
|
|
314821
315014
|
columns: resultColumns,
|
|
314822
315015
|
rowClassName: "editable-row",
|
|
@@ -314850,7 +315043,7 @@
|
|
|
314850
315043
|
}
|
|
314851
315044
|
}),
|
|
314852
315045
|
dataSource: dataSource
|
|
314853
|
-
})), /*#__PURE__*/React__default['default'].createElement(BottomOpetateComponent, {
|
|
315046
|
+
}))), /*#__PURE__*/React__default['default'].createElement(BottomOpetateComponent, {
|
|
314854
315047
|
disabled: disabled,
|
|
314855
315048
|
isShowAddAction: isShowAddAction,
|
|
314856
315049
|
recordCreatorProps: recordCreatorProps,
|
|
@@ -320662,7 +320855,7 @@
|
|
|
320662
320855
|
|
|
320663
320856
|
var _excluded$35 = ["defaultExpandAll", "defaultExpandParent", "defaultExpandedKeys"],
|
|
320664
320857
|
_excluded2$J = ["prefixCls", "className"];
|
|
320665
|
-
var ConfigContext$
|
|
320858
|
+
var ConfigContext$8 = ConfigProvider$1.ConfigContext;
|
|
320666
320859
|
|
|
320667
320860
|
function getIcon$1(props) {
|
|
320668
320861
|
var isLeaf = props.isLeaf,
|
|
@@ -320796,7 +320989,7 @@
|
|
|
320796
320989
|
}
|
|
320797
320990
|
};
|
|
320798
320991
|
|
|
320799
|
-
var _React$useContext = React.useContext(ConfigContext$
|
|
320992
|
+
var _React$useContext = React.useContext(ConfigContext$8),
|
|
320800
320993
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
320801
320994
|
direction = _React$useContext.direction;
|
|
320802
320995
|
|
|
@@ -321103,11 +321296,11 @@
|
|
|
321103
321296
|
});
|
|
321104
321297
|
}
|
|
321105
321298
|
|
|
321106
|
-
var ConfigContext$
|
|
321299
|
+
var ConfigContext$9 = ConfigProvider$1.ConfigContext;
|
|
321107
321300
|
var Tree$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
321108
321301
|
var _classNames;
|
|
321109
321302
|
|
|
321110
|
-
var _React$useContext = React.useContext(ConfigContext$
|
|
321303
|
+
var _React$useContext = React.useContext(ConfigContext$9),
|
|
321111
321304
|
getPrefixCls = _React$useContext.getPrefixCls,
|
|
321112
321305
|
direction = _React$useContext.direction,
|
|
321113
321306
|
virtual = _React$useContext.virtual;
|