mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-07 15:13:51 +08:00
552 lines
26 KiB
Diff
552 lines
26 KiB
Diff
diff --git a/node_modules/rc-table/es/VirtualTable/BodyGrid.js b/node_modules/rc-table/es/VirtualTable/BodyGrid.js
|
|
index 42dcde8..2fc28a7 100644
|
|
--- a/node_modules/rc-table/es/VirtualTable/BodyGrid.js
|
|
+++ b/node_modules/rc-table/es/VirtualTable/BodyGrid.js
|
|
@@ -23,11 +23,14 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
sticky = _useContext2.sticky,
|
|
scrollY = _useContext2.scrollY,
|
|
listItemHeight = _useContext2.listItemHeight,
|
|
+ listItemHeightFixed = _useContext2.listItemHeightFixed,
|
|
+ listItemColumnVirtual = _useContext2.listItemColumnVirtual,
|
|
getComponent = _useContext2.getComponent,
|
|
onTablePropScroll = _useContext2.onScroll;
|
|
|
|
// =========================== Ref ============================
|
|
var listRef = React.useRef();
|
|
+ var lastForwardedXRef = React.useRef(0);
|
|
|
|
// =========================== Data ===========================
|
|
var flattenData = useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey);
|
|
@@ -110,10 +113,16 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
return 1;
|
|
};
|
|
var extraRender = function extraRender(info) {
|
|
+ // The column-window fast path explicitly requires rows without spans.
|
|
+ // Avoid scanning every column on each vertical window update.
|
|
+ if (listItemColumnVirtual) {
|
|
+ return null;
|
|
+ }
|
|
var start = info.start,
|
|
end = info.end,
|
|
getSize = info.getSize,
|
|
- offsetY = info.offsetY;
|
|
+ offsetY = info.offsetY,
|
|
+ offsetX = info.offsetX;
|
|
|
|
// Do nothing if no data
|
|
if (end < 0) {
|
|
@@ -198,6 +207,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
style: {
|
|
top: -offsetY + sizeInfo.top
|
|
},
|
|
+ offsetX: offsetX,
|
|
extra: true,
|
|
getHeight: getHeight
|
|
});
|
|
@@ -239,6 +249,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
className: tblPrefixCls,
|
|
height: scrollY,
|
|
itemHeight: listItemHeight || 24,
|
|
+ itemHeightFixed: listItemHeightFixed,
|
|
data: flattenData,
|
|
itemKey: function itemKey(item) {
|
|
return getRowKey(item.record);
|
|
@@ -249,6 +260,8 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
onVirtualScroll: function onVirtualScroll(_ref4) {
|
|
var _listRef$current7;
|
|
var x = _ref4.x;
|
|
+ if (lastForwardedXRef.current === x) return;
|
|
+ lastForwardedXRef.current = x;
|
|
onScroll({
|
|
currentTarget: (_listRef$current7 = listRef.current) === null || _listRef$current7 === void 0 ? void 0 : _listRef$current7.nativeElement,
|
|
scrollLeft: x
|
|
@@ -262,6 +275,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
data: item,
|
|
rowKey: rowKey,
|
|
index: index,
|
|
+ offsetX: itemProps.offsetX,
|
|
style: itemProps.style
|
|
});
|
|
}));
|
|
diff --git a/node_modules/rc-table/es/VirtualTable/BodyLine.js b/node_modules/rc-table/es/VirtualTable/BodyLine.js
|
|
index c760819..c7a7c29 100644
|
|
--- a/node_modules/rc-table/es/VirtualTable/BodyLine.js
|
|
+++ b/node_modules/rc-table/es/VirtualTable/BodyLine.js
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
-var _excluded = ["data", "index", "className", "rowKey", "style", "extra", "getHeight"];
|
|
+var _excluded = ["data", "index", "className", "rowKey", "style", "offsetX", "extra", "getHeight"];
|
|
import { useContext } from '@rc-component/context';
|
|
import classNames from 'classnames';
|
|
import * as React from 'react';
|
|
@@ -10,7 +10,7 @@ import Cell from "../Cell";
|
|
import TableContext, { responseImmutable } from "../context/TableContext";
|
|
import useRowInfo from "../hooks/useRowInfo";
|
|
import VirtualCell from "./VirtualCell";
|
|
-import { StaticContext } from "./context";
|
|
+import { GridContext, StaticContext } from "./context";
|
|
import { computedExpandedClassName } from "../utils/expandUtil";
|
|
var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
var data = props.data,
|
|
@@ -18,20 +18,25 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
className = props.className,
|
|
rowKey = props.rowKey,
|
|
style = props.style,
|
|
+ offsetX = props.offsetX,
|
|
extra = props.extra,
|
|
getHeight = props.getHeight,
|
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
var record = data.record,
|
|
indent = data.indent,
|
|
renderIndex = data.index;
|
|
- var _useContext = useContext(TableContext, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX']),
|
|
+ var _useContext = useContext(TableContext, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX', 'direction']),
|
|
scrollX = _useContext.scrollX,
|
|
flattenColumns = _useContext.flattenColumns,
|
|
prefixCls = _useContext.prefixCls,
|
|
fixColumn = _useContext.fixColumn,
|
|
- componentWidth = _useContext.componentWidth;
|
|
- var _useContext2 = useContext(StaticContext, ['getComponent']),
|
|
- getComponent = _useContext2.getComponent;
|
|
+ componentWidth = _useContext.componentWidth,
|
|
+ direction = _useContext.direction;
|
|
+ var _useContext2 = useContext(StaticContext, ['getComponent', 'listItemColumnVirtual']),
|
|
+ getComponent = _useContext2.getComponent,
|
|
+ listItemColumnVirtual = _useContext2.listItemColumnVirtual;
|
|
+ var _useContext3 = useContext(GridContext, ['columnsOffset']),
|
|
+ columnsOffset = _useContext3.columnsOffset;
|
|
var rowInfo = useRowInfo(record, rowKey, index, indent);
|
|
var RowComponent = getComponent(['body', 'row'], 'div');
|
|
var cellComponent = getComponent(['body', 'cell'], 'div');
|
|
@@ -71,12 +76,7 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
rowStyle.position = 'absolute';
|
|
rowStyle.pointerEvents = 'none';
|
|
}
|
|
- var rowNode = /*#__PURE__*/React.createElement(RowComponent, _extends({}, rowProps, restProps, {
|
|
- "data-row-key": rowKey,
|
|
- ref: rowSupportExpand ? null : ref,
|
|
- className: classNames(className, "".concat(prefixCls, "-row"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, _defineProperty({}, "".concat(prefixCls, "-row-extra"), extra)),
|
|
- style: _objectSpread(_objectSpread({}, rowStyle), rowProps === null || rowProps === void 0 ? void 0 : rowProps.style)
|
|
- }), flattenColumns.map(function (column, colIndex) {
|
|
+ var renderVirtualCell = function renderVirtualCell(column, colIndex) {
|
|
return /*#__PURE__*/React.createElement(VirtualCell, {
|
|
key: colIndex,
|
|
component: cellComponent,
|
|
@@ -90,7 +90,60 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
inverse: extra,
|
|
getHeight: getHeight
|
|
});
|
|
- }));
|
|
+ };
|
|
+ var columnNodes;
|
|
+ if (listItemColumnVirtual && direction !== 'rtl' && !extra && columnsOffset && columnsOffset.length === flattenColumns.length) {
|
|
+ var mergedOffsetX = Math.max(0, offsetX || 0);
|
|
+ var viewportWidth = Math.max(0, componentWidth || 0);
|
|
+ var overscanWidth = Math.max(320, viewportWidth);
|
|
+ var visibleStart = Math.max(0, mergedOffsetX - overscanWidth);
|
|
+ var visibleEnd = mergedOffsetX + viewportWidth + overscanWidth;
|
|
+ var nodes = [];
|
|
+ var spacerStart = -1;
|
|
+ var spacerWidth = 0;
|
|
+ var flushSpacer = function flushSpacer() {
|
|
+ if (spacerWidth <= 0) return;
|
|
+ nodes.push(/*#__PURE__*/React.createElement(cellComponent, {
|
|
+ "aria-hidden": true,
|
|
+ className: "".concat(prefixCls, "-cell-virtual-spacer"),
|
|
+ key: "virtual-spacer-".concat(spacerStart),
|
|
+ style: {
|
|
+ border: 0,
|
|
+ flex: "0 0 ".concat(spacerWidth, "px"),
|
|
+ minWidth: 0,
|
|
+ padding: 0,
|
|
+ pointerEvents: 'none',
|
|
+ visibility: 'hidden',
|
|
+ width: "".concat(spacerWidth, "px")
|
|
+ }
|
|
+ }));
|
|
+ spacerStart = -1;
|
|
+ spacerWidth = 0;
|
|
+ };
|
|
+ flattenColumns.forEach(function (column, colIndex) {
|
|
+ var columnStart = colIndex > 0 ? columnsOffset[colIndex - 1] : 0;
|
|
+ var columnEnd = columnsOffset[colIndex] || columnStart;
|
|
+ var fixedColumn = column.fixed === true || column.fixed === 'left' || column.fixed === 'right';
|
|
+ var visibleColumn = fixedColumn || columnEnd >= visibleStart && columnStart <= visibleEnd;
|
|
+ if (visibleColumn) {
|
|
+ flushSpacer();
|
|
+ nodes.push(renderVirtualCell(column, colIndex));
|
|
+ } else {
|
|
+ if (spacerStart < 0) spacerStart = colIndex;
|
|
+ spacerWidth += Math.max(0, columnEnd - columnStart);
|
|
+ }
|
|
+ });
|
|
+ flushSpacer();
|
|
+ columnNodes = nodes;
|
|
+ } else {
|
|
+ columnNodes = flattenColumns.map(renderVirtualCell);
|
|
+ }
|
|
+ var rowNode = /*#__PURE__*/React.createElement(RowComponent, _extends({}, rowProps, restProps, {
|
|
+ "data-row-key": rowKey,
|
|
+ ref: rowSupportExpand ? null : ref,
|
|
+ className: classNames(className, "".concat(prefixCls, "-row"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, _defineProperty({}, "".concat(prefixCls, "-row-extra"), extra)),
|
|
+ style: _objectSpread(_objectSpread({}, rowStyle), rowProps === null || rowProps === void 0 ? void 0 : rowProps.style)
|
|
+ }), columnNodes);
|
|
if (rowSupportExpand) {
|
|
return /*#__PURE__*/React.createElement("div", {
|
|
ref: ref
|
|
@@ -98,7 +151,26 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
}
|
|
return rowNode;
|
|
});
|
|
-var ResponseBodyLine = responseImmutable(BodyLine);
|
|
+var bodyLinePropsAreEqual = function bodyLinePropsAreEqual(prevProps, nextProps) {
|
|
+ var prevKeys = Object.keys(prevProps);
|
|
+ var nextKeys = Object.keys(nextProps);
|
|
+ if (prevKeys.length !== nextKeys.length) return false;
|
|
+ for (var i = 0; i < prevKeys.length; i += 1) {
|
|
+ var key = prevKeys[i];
|
|
+ if (key !== 'style' && prevProps[key] !== nextProps[key]) return false;
|
|
+ }
|
|
+ var prevStyle = prevProps.style || {};
|
|
+ var nextStyle = nextProps.style || {};
|
|
+ var prevStyleKeys = Object.keys(prevStyle);
|
|
+ var nextStyleKeys = Object.keys(nextStyle);
|
|
+ if (prevStyleKeys.length !== nextStyleKeys.length) return false;
|
|
+ for (var _i2 = 0; _i2 < prevStyleKeys.length; _i2 += 1) {
|
|
+ var styleKey = prevStyleKeys[_i2];
|
|
+ if (prevStyle[styleKey] !== nextStyle[styleKey]) return false;
|
|
+ }
|
|
+ return true;
|
|
+};
|
|
+var ResponseBodyLine = responseImmutable(BodyLine, bodyLinePropsAreEqual);
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
ResponseBodyLine.displayName = 'BodyLine';
|
|
}
|
|
diff --git a/node_modules/rc-table/es/VirtualTable/context.d.ts b/node_modules/rc-table/es/VirtualTable/context.d.ts
|
|
index e558165..ccd74fc 100644
|
|
--- a/node_modules/rc-table/es/VirtualTable/context.d.ts
|
|
+++ b/node_modules/rc-table/es/VirtualTable/context.d.ts
|
|
@@ -3,6 +3,8 @@ import type { GetComponent, TableSticky } from '../interface';
|
|
export interface StaticContextProps {
|
|
scrollY: number;
|
|
listItemHeight: number;
|
|
+ listItemHeightFixed?: boolean;
|
|
+ listItemColumnVirtual?: boolean;
|
|
sticky: boolean | TableSticky;
|
|
getComponent: GetComponent;
|
|
onScroll?: React.UIEventHandler<HTMLDivElement>;
|
|
diff --git a/node_modules/rc-table/es/VirtualTable/index.d.ts b/node_modules/rc-table/es/VirtualTable/index.d.ts
|
|
index 31fe8e0..c5097b2 100644
|
|
--- a/node_modules/rc-table/es/VirtualTable/index.d.ts
|
|
+++ b/node_modules/rc-table/es/VirtualTable/index.d.ts
|
|
@@ -8,6 +8,9 @@ export interface VirtualTableProps<RecordType> extends Omit<TableProps<RecordTyp
|
|
y: number;
|
|
};
|
|
listItemHeight?: number;
|
|
+ listItemHeightFixed?: boolean;
|
|
+ /** LTR-only fast path; requires body cells without colSpan/rowSpan. */
|
|
+ listItemColumnVirtual?: boolean;
|
|
}
|
|
export type ForwardGenericVirtualTable = (<RecordType>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & {
|
|
displayName?: string;
|
|
diff --git a/node_modules/rc-table/es/VirtualTable/index.js b/node_modules/rc-table/es/VirtualTable/index.js
|
|
index fb00e9b..a778aa6 100644
|
|
--- a/node_modules/rc-table/es/VirtualTable/index.js
|
|
+++ b/node_modules/rc-table/es/VirtualTable/index.js
|
|
@@ -27,6 +27,8 @@ function VirtualTable(props, ref) {
|
|
prefixCls = _props$prefixCls === void 0 ? DEFAULT_PREFIX : _props$prefixCls,
|
|
className = props.className,
|
|
listItemHeight = props.listItemHeight,
|
|
+ listItemHeightFixed = props.listItemHeightFixed,
|
|
+ listItemColumnVirtual = props.listItemColumnVirtual,
|
|
components = props.components,
|
|
onScroll = props.onScroll;
|
|
var _ref = scroll || {},
|
|
@@ -61,10 +63,12 @@ function VirtualTable(props, ref) {
|
|
sticky: sticky,
|
|
scrollY: scrollY,
|
|
listItemHeight: listItemHeight,
|
|
+ listItemHeightFixed: listItemHeightFixed,
|
|
+ listItemColumnVirtual: listItemColumnVirtual,
|
|
getComponent: getComponent,
|
|
onScroll: onInternalScroll
|
|
};
|
|
- }, [sticky, scrollY, listItemHeight, getComponent, onInternalScroll]);
|
|
+ }, [sticky, scrollY, listItemHeight, listItemHeightFixed, listItemColumnVirtual, getComponent, onInternalScroll]);
|
|
|
|
// ========================== Render ==========================
|
|
return /*#__PURE__*/React.createElement(StaticContext.Provider, {
|
|
diff --git a/node_modules/rc-table/lib/VirtualTable/BodyGrid.js b/node_modules/rc-table/lib/VirtualTable/BodyGrid.js
|
|
index dee2539..85f90af 100644
|
|
--- a/node_modules/rc-table/lib/VirtualTable/BodyGrid.js
|
|
+++ b/node_modules/rc-table/lib/VirtualTable/BodyGrid.js
|
|
@@ -33,11 +33,14 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
sticky = _useContext2.sticky,
|
|
scrollY = _useContext2.scrollY,
|
|
listItemHeight = _useContext2.listItemHeight,
|
|
+ listItemHeightFixed = _useContext2.listItemHeightFixed,
|
|
+ listItemColumnVirtual = _useContext2.listItemColumnVirtual,
|
|
getComponent = _useContext2.getComponent,
|
|
onTablePropScroll = _useContext2.onScroll;
|
|
|
|
// =========================== Ref ============================
|
|
var listRef = React.useRef();
|
|
+ var lastForwardedXRef = React.useRef(0);
|
|
|
|
// =========================== Data ===========================
|
|
var flattenData = (0, _useFlattenRecords.default)(data, childrenColumnName, expandedKeys, getRowKey);
|
|
@@ -120,10 +123,16 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
return 1;
|
|
};
|
|
var extraRender = function extraRender(info) {
|
|
+ // The column-window fast path explicitly requires rows without spans.
|
|
+ // Avoid scanning every column on each vertical window update.
|
|
+ if (listItemColumnVirtual) {
|
|
+ return null;
|
|
+ }
|
|
var start = info.start,
|
|
end = info.end,
|
|
getSize = info.getSize,
|
|
- offsetY = info.offsetY;
|
|
+ offsetY = info.offsetY,
|
|
+ offsetX = info.offsetX;
|
|
|
|
// Do nothing if no data
|
|
if (end < 0) {
|
|
@@ -208,6 +217,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
style: {
|
|
top: -offsetY + sizeInfo.top
|
|
},
|
|
+ offsetX: offsetX,
|
|
extra: true,
|
|
getHeight: getHeight
|
|
});
|
|
@@ -249,6 +259,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
className: tblPrefixCls,
|
|
height: scrollY,
|
|
itemHeight: listItemHeight || 24,
|
|
+ itemHeightFixed: listItemHeightFixed,
|
|
data: flattenData,
|
|
itemKey: function itemKey(item) {
|
|
return getRowKey(item.record);
|
|
@@ -259,6 +270,8 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
onVirtualScroll: function onVirtualScroll(_ref4) {
|
|
var _listRef$current7;
|
|
var x = _ref4.x;
|
|
+ if (lastForwardedXRef.current === x) return;
|
|
+ lastForwardedXRef.current = x;
|
|
onScroll({
|
|
currentTarget: (_listRef$current7 = listRef.current) === null || _listRef$current7 === void 0 ? void 0 : _listRef$current7.nativeElement,
|
|
scrollLeft: x
|
|
@@ -272,6 +285,7 @@ var Grid = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
data: item,
|
|
rowKey: rowKey,
|
|
index: index,
|
|
+ offsetX: itemProps.offsetX,
|
|
style: itemProps.style
|
|
});
|
|
}));
|
|
diff --git a/node_modules/rc-table/lib/VirtualTable/BodyLine.js b/node_modules/rc-table/lib/VirtualTable/BodyLine.js
|
|
index e1275fb..374781d 100644
|
|
--- a/node_modules/rc-table/lib/VirtualTable/BodyLine.js
|
|
+++ b/node_modules/rc-table/lib/VirtualTable/BodyLine.js
|
|
@@ -19,7 +19,7 @@ var _useRowInfo = _interopRequireDefault(require("../hooks/useRowInfo"));
|
|
var _VirtualCell = _interopRequireDefault(require("./VirtualCell"));
|
|
var _context2 = require("./context");
|
|
var _expandUtil = require("../utils/expandUtil");
|
|
-var _excluded = ["data", "index", "className", "rowKey", "style", "extra", "getHeight"];
|
|
+var _excluded = ["data", "index", "className", "rowKey", "style", "offsetX", "extra", "getHeight"];
|
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -28,20 +28,25 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
className = props.className,
|
|
rowKey = props.rowKey,
|
|
style = props.style,
|
|
+ offsetX = props.offsetX,
|
|
extra = props.extra,
|
|
getHeight = props.getHeight,
|
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
var record = data.record,
|
|
indent = data.indent,
|
|
renderIndex = data.index;
|
|
- var _useContext = (0, _context.useContext)(_TableContext.default, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX']),
|
|
+ var _useContext = (0, _context.useContext)(_TableContext.default, ['prefixCls', 'flattenColumns', 'fixColumn', 'componentWidth', 'scrollX', 'direction']),
|
|
scrollX = _useContext.scrollX,
|
|
flattenColumns = _useContext.flattenColumns,
|
|
prefixCls = _useContext.prefixCls,
|
|
fixColumn = _useContext.fixColumn,
|
|
- componentWidth = _useContext.componentWidth;
|
|
- var _useContext2 = (0, _context.useContext)(_context2.StaticContext, ['getComponent']),
|
|
- getComponent = _useContext2.getComponent;
|
|
+ componentWidth = _useContext.componentWidth,
|
|
+ direction = _useContext.direction;
|
|
+ var _useContext2 = (0, _context.useContext)(_context2.StaticContext, ['getComponent', 'listItemColumnVirtual']),
|
|
+ getComponent = _useContext2.getComponent,
|
|
+ listItemColumnVirtual = _useContext2.listItemColumnVirtual;
|
|
+ var _useContext3 = (0, _context.useContext)(_context2.GridContext, ['columnsOffset']),
|
|
+ columnsOffset = _useContext3.columnsOffset;
|
|
var rowInfo = (0, _useRowInfo.default)(record, rowKey, index, indent);
|
|
var RowComponent = getComponent(['body', 'row'], 'div');
|
|
var cellComponent = getComponent(['body', 'cell'], 'div');
|
|
@@ -81,12 +86,7 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
rowStyle.position = 'absolute';
|
|
rowStyle.pointerEvents = 'none';
|
|
}
|
|
- var rowNode = /*#__PURE__*/React.createElement(RowComponent, (0, _extends2.default)({}, rowProps, restProps, {
|
|
- "data-row-key": rowKey,
|
|
- ref: rowSupportExpand ? null : ref,
|
|
- className: (0, _classnames.default)(className, "".concat(prefixCls, "-row"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-row-extra"), extra)),
|
|
- style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rowStyle), rowProps === null || rowProps === void 0 ? void 0 : rowProps.style)
|
|
- }), flattenColumns.map(function (column, colIndex) {
|
|
+ var renderVirtualCell = function renderVirtualCell(column, colIndex) {
|
|
return /*#__PURE__*/React.createElement(_VirtualCell.default, {
|
|
key: colIndex,
|
|
component: cellComponent,
|
|
@@ -100,7 +100,60 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
inverse: extra,
|
|
getHeight: getHeight
|
|
});
|
|
- }));
|
|
+ };
|
|
+ var columnNodes;
|
|
+ if (listItemColumnVirtual && direction !== 'rtl' && !extra && columnsOffset && columnsOffset.length === flattenColumns.length) {
|
|
+ var mergedOffsetX = Math.max(0, offsetX || 0);
|
|
+ var viewportWidth = Math.max(0, componentWidth || 0);
|
|
+ var overscanWidth = Math.max(320, viewportWidth);
|
|
+ var visibleStart = Math.max(0, mergedOffsetX - overscanWidth);
|
|
+ var visibleEnd = mergedOffsetX + viewportWidth + overscanWidth;
|
|
+ var nodes = [];
|
|
+ var spacerStart = -1;
|
|
+ var spacerWidth = 0;
|
|
+ var flushSpacer = function flushSpacer() {
|
|
+ if (spacerWidth <= 0) return;
|
|
+ nodes.push(/*#__PURE__*/React.createElement(cellComponent, {
|
|
+ "aria-hidden": true,
|
|
+ className: "".concat(prefixCls, "-cell-virtual-spacer"),
|
|
+ key: "virtual-spacer-".concat(spacerStart),
|
|
+ style: {
|
|
+ border: 0,
|
|
+ flex: "0 0 ".concat(spacerWidth, "px"),
|
|
+ minWidth: 0,
|
|
+ padding: 0,
|
|
+ pointerEvents: 'none',
|
|
+ visibility: 'hidden',
|
|
+ width: "".concat(spacerWidth, "px")
|
|
+ }
|
|
+ }));
|
|
+ spacerStart = -1;
|
|
+ spacerWidth = 0;
|
|
+ };
|
|
+ flattenColumns.forEach(function (column, colIndex) {
|
|
+ var columnStart = colIndex > 0 ? columnsOffset[colIndex - 1] : 0;
|
|
+ var columnEnd = columnsOffset[colIndex] || columnStart;
|
|
+ var fixedColumn = column.fixed === true || column.fixed === 'left' || column.fixed === 'right';
|
|
+ var visibleColumn = fixedColumn || columnEnd >= visibleStart && columnStart <= visibleEnd;
|
|
+ if (visibleColumn) {
|
|
+ flushSpacer();
|
|
+ nodes.push(renderVirtualCell(column, colIndex));
|
|
+ } else {
|
|
+ if (spacerStart < 0) spacerStart = colIndex;
|
|
+ spacerWidth += Math.max(0, columnEnd - columnStart);
|
|
+ }
|
|
+ });
|
|
+ flushSpacer();
|
|
+ columnNodes = nodes;
|
|
+ } else {
|
|
+ columnNodes = flattenColumns.map(renderVirtualCell);
|
|
+ }
|
|
+ var rowNode = /*#__PURE__*/React.createElement(RowComponent, (0, _extends2.default)({}, rowProps, restProps, {
|
|
+ "data-row-key": rowKey,
|
|
+ ref: rowSupportExpand ? null : ref,
|
|
+ className: (0, _classnames.default)(className, "".concat(prefixCls, "-row"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, (0, _defineProperty2.default)({}, "".concat(prefixCls, "-row-extra"), extra)),
|
|
+ style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, rowStyle), rowProps === null || rowProps === void 0 ? void 0 : rowProps.style)
|
|
+ }), columnNodes);
|
|
if (rowSupportExpand) {
|
|
return /*#__PURE__*/React.createElement("div", {
|
|
ref: ref
|
|
@@ -108,7 +161,26 @@ var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
}
|
|
return rowNode;
|
|
});
|
|
-var ResponseBodyLine = (0, _TableContext.responseImmutable)(BodyLine);
|
|
+var bodyLinePropsAreEqual = function bodyLinePropsAreEqual(prevProps, nextProps) {
|
|
+ var prevKeys = Object.keys(prevProps);
|
|
+ var nextKeys = Object.keys(nextProps);
|
|
+ if (prevKeys.length !== nextKeys.length) return false;
|
|
+ for (var i = 0; i < prevKeys.length; i += 1) {
|
|
+ var key = prevKeys[i];
|
|
+ if (key !== 'style' && prevProps[key] !== nextProps[key]) return false;
|
|
+ }
|
|
+ var prevStyle = prevProps.style || {};
|
|
+ var nextStyle = nextProps.style || {};
|
|
+ var prevStyleKeys = Object.keys(prevStyle);
|
|
+ var nextStyleKeys = Object.keys(nextStyle);
|
|
+ if (prevStyleKeys.length !== nextStyleKeys.length) return false;
|
|
+ for (var _i2 = 0; _i2 < prevStyleKeys.length; _i2 += 1) {
|
|
+ var styleKey = prevStyleKeys[_i2];
|
|
+ if (prevStyle[styleKey] !== nextStyle[styleKey]) return false;
|
|
+ }
|
|
+ return true;
|
|
+};
|
|
+var ResponseBodyLine = (0, _TableContext.responseImmutable)(BodyLine, bodyLinePropsAreEqual);
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
ResponseBodyLine.displayName = 'BodyLine';
|
|
}
|
|
diff --git a/node_modules/rc-table/lib/VirtualTable/context.d.ts b/node_modules/rc-table/lib/VirtualTable/context.d.ts
|
|
index e558165..ccd74fc 100644
|
|
--- a/node_modules/rc-table/lib/VirtualTable/context.d.ts
|
|
+++ b/node_modules/rc-table/lib/VirtualTable/context.d.ts
|
|
@@ -3,6 +3,8 @@ import type { GetComponent, TableSticky } from '../interface';
|
|
export interface StaticContextProps {
|
|
scrollY: number;
|
|
listItemHeight: number;
|
|
+ listItemHeightFixed?: boolean;
|
|
+ listItemColumnVirtual?: boolean;
|
|
sticky: boolean | TableSticky;
|
|
getComponent: GetComponent;
|
|
onScroll?: React.UIEventHandler<HTMLDivElement>;
|
|
diff --git a/node_modules/rc-table/lib/VirtualTable/index.d.ts b/node_modules/rc-table/lib/VirtualTable/index.d.ts
|
|
index 31fe8e0..c5097b2 100644
|
|
--- a/node_modules/rc-table/lib/VirtualTable/index.d.ts
|
|
+++ b/node_modules/rc-table/lib/VirtualTable/index.d.ts
|
|
@@ -8,6 +8,9 @@ export interface VirtualTableProps<RecordType> extends Omit<TableProps<RecordTyp
|
|
y: number;
|
|
};
|
|
listItemHeight?: number;
|
|
+ listItemHeightFixed?: boolean;
|
|
+ /** LTR-only fast path; requires body cells without colSpan/rowSpan. */
|
|
+ listItemColumnVirtual?: boolean;
|
|
}
|
|
export type ForwardGenericVirtualTable = (<RecordType>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & {
|
|
displayName?: string;
|
|
diff --git a/node_modules/rc-table/lib/VirtualTable/index.js b/node_modules/rc-table/lib/VirtualTable/index.js
|
|
index 8e31a9b..24ab161 100644
|
|
--- a/node_modules/rc-table/lib/VirtualTable/index.js
|
|
+++ b/node_modules/rc-table/lib/VirtualTable/index.js
|
|
@@ -38,6 +38,8 @@ function VirtualTable(props, ref) {
|
|
prefixCls = _props$prefixCls === void 0 ? _Table.DEFAULT_PREFIX : _props$prefixCls,
|
|
className = props.className,
|
|
listItemHeight = props.listItemHeight,
|
|
+ listItemHeightFixed = props.listItemHeightFixed,
|
|
+ listItemColumnVirtual = props.listItemColumnVirtual,
|
|
components = props.components,
|
|
onScroll = props.onScroll;
|
|
var _ref = scroll || {},
|
|
@@ -72,10 +74,12 @@ function VirtualTable(props, ref) {
|
|
sticky: sticky,
|
|
scrollY: scrollY,
|
|
listItemHeight: listItemHeight,
|
|
+ listItemHeightFixed: listItemHeightFixed,
|
|
+ listItemColumnVirtual: listItemColumnVirtual,
|
|
getComponent: getComponent,
|
|
onScroll: onInternalScroll
|
|
};
|
|
- }, [sticky, scrollY, listItemHeight, getComponent, onInternalScroll]);
|
|
+ }, [sticky, scrollY, listItemHeight, listItemHeightFixed, listItemColumnVirtual, getComponent, onInternalScroll]);
|
|
|
|
// ========================== Render ==========================
|
|
return /*#__PURE__*/React.createElement(_context.StaticContext.Provider, {
|