Comparing version 7.45.7 to 7.46.0
@@ -30,3 +30,3 @@ import { useContext } from '@rc-component/context'; | ||
style: { | ||
width: componentWidth - (fixHeader ? scrollbarSize : 0), | ||
width: componentWidth - (fixHeader && !isEmpty ? scrollbarSize : 0), | ||
position: 'sticky', | ||
@@ -33,0 +33,0 @@ left: 0, |
@@ -61,2 +61,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { getColumnsKey, validateValue } from "./utils/valueUtil"; | ||
import { getDOM } from "rc-util/es/Dom/findDOMNode"; | ||
export var DEFAULT_PREFIX = 'rc-table'; | ||
@@ -272,3 +273,3 @@ | ||
scrollYStyle = { | ||
overflowY: 'scroll', | ||
overflowY: hasData ? 'scroll' : 'auto', | ||
maxHeight: scroll.y | ||
@@ -344,4 +345,4 @@ }; | ||
if (measureTarget) { | ||
var scrollWidth = measureTarget.scrollWidth, | ||
clientWidth = measureTarget.clientWidth; | ||
var scrollWidth = typeof mergedScrollX === 'number' ? mergedScrollX : measureTarget.scrollWidth; | ||
var clientWidth = measureTarget.clientWidth; | ||
// There is no space to scroll | ||
@@ -369,3 +370,3 @@ if (scrollWidth === clientWidth) { | ||
onInternalScroll({ | ||
currentTarget: scrollBodyRef.current | ||
currentTarget: getDOM(scrollBodyRef.current) | ||
}); | ||
@@ -372,0 +373,0 @@ } else { |
@@ -9,5 +9,6 @@ import * as React from 'react'; | ||
scrollLeft: number; | ||
scrollTo?: (scrollConfig: ScrollConfig) => void; | ||
nativeElement: HTMLDivElement; | ||
scrollTo: (scrollConfig: ScrollConfig) => void; | ||
} | ||
declare const ResponseGrid: React.ForwardRefExoticComponent<GridProps<any> & React.RefAttributes<GridRef>>; | ||
export default ResponseGrid; |
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import { useContext } from '@rc-component/context'; | ||
import classNames from 'classnames'; | ||
import VirtualList from 'rc-virtual-list'; | ||
import * as React from 'react'; | ||
import Cell from "../Cell"; | ||
import TableContext, { responseImmutable } from "../context/TableContext"; | ||
@@ -15,3 +13,3 @@ import useFlattenRecords from "../hooks/useFlattenRecords"; | ||
onScroll = props.onScroll; | ||
var _useContext = useContext(TableContext, ['flattenColumns', 'onColumnResize', 'getRowKey', 'prefixCls', 'expandedKeys', 'childrenColumnName', 'emptyNode', 'scrollX']), | ||
var _useContext = useContext(TableContext, ['flattenColumns', 'onColumnResize', 'getRowKey', 'prefixCls', 'expandedKeys', 'childrenColumnName', 'scrollX']), | ||
flattenColumns = _useContext.flattenColumns, | ||
@@ -23,3 +21,2 @@ onColumnResize = _useContext.onColumnResize, | ||
childrenColumnName = _useContext.childrenColumnName, | ||
emptyNode = _useContext.emptyNode, | ||
scrollX = _useContext.scrollX; | ||
@@ -65,2 +62,3 @@ var _useContext2 = useContext(StaticContext), | ||
React.useImperativeHandle(ref, function () { | ||
var _listRef$current2; | ||
var obj = { | ||
@@ -70,12 +68,13 @@ scrollTo: function scrollTo(config) { | ||
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.scrollTo(config); | ||
} | ||
}, | ||
nativeElement: (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.nativeElement | ||
}; | ||
Object.defineProperty(obj, 'scrollLeft', { | ||
get: function get() { | ||
var _listRef$current2; | ||
return ((_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.getScrollInfo().x) || 0; | ||
var _listRef$current3; | ||
return ((_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.getScrollInfo().x) || 0; | ||
}, | ||
set: function set(value) { | ||
var _listRef$current3; | ||
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 || _listRef$current3.scrollTo({ | ||
var _listRef$current4; | ||
(_listRef$current4 = listRef.current) === null || _listRef$current4 === void 0 || _listRef$current4.scrollTo({ | ||
left: value | ||
@@ -208,59 +207,49 @@ }); | ||
var wrapperComponent = getComponent(['body', 'wrapper']); | ||
var RowComponent = getComponent(['body', 'row'], 'div'); | ||
var cellComponent = getComponent(['body', 'cell'], 'div'); | ||
var bodyContent; | ||
if (flattenData.length) { | ||
// ========================== Sticky Scroll Bar ========================== | ||
var horizontalScrollBarStyle = {}; | ||
if (sticky) { | ||
horizontalScrollBarStyle.position = 'sticky'; | ||
horizontalScrollBarStyle.bottom = 0; | ||
if (_typeof(sticky) === 'object' && sticky.offsetScroll) { | ||
horizontalScrollBarStyle.bottom = sticky.offsetScroll; | ||
} | ||
// ========================== Sticky Scroll Bar ========================== | ||
var horizontalScrollBarStyle = {}; | ||
if (sticky) { | ||
horizontalScrollBarStyle.position = 'sticky'; | ||
horizontalScrollBarStyle.bottom = 0; | ||
if (_typeof(sticky) === 'object' && sticky.offsetScroll) { | ||
horizontalScrollBarStyle.bottom = sticky.offsetScroll; | ||
} | ||
bodyContent = /*#__PURE__*/React.createElement(VirtualList, { | ||
fullHeight: false, | ||
ref: listRef, | ||
prefixCls: "".concat(tblPrefixCls, "-virtual"), | ||
styles: { | ||
horizontalScrollBar: horizontalScrollBarStyle | ||
}, | ||
className: tblPrefixCls, | ||
height: scrollY, | ||
itemHeight: listItemHeight || 24, | ||
data: flattenData, | ||
itemKey: function itemKey(item) { | ||
return getRowKey(item.record); | ||
}, | ||
component: wrapperComponent, | ||
scrollWidth: scrollX, | ||
onVirtualScroll: function onVirtualScroll(_ref4) { | ||
var x = _ref4.x; | ||
onScroll({ | ||
scrollLeft: x | ||
}); | ||
}, | ||
onScroll: onTablePropScroll, | ||
extraRender: extraRender | ||
}, function (item, index, itemProps) { | ||
var rowKey = getRowKey(item.record, index); | ||
return /*#__PURE__*/React.createElement(BodyLine, { | ||
data: item, | ||
rowKey: rowKey, | ||
index: index, | ||
style: itemProps.style | ||
}); | ||
}); | ||
} else { | ||
bodyContent = /*#__PURE__*/React.createElement(RowComponent, { | ||
className: classNames("".concat(prefixCls, "-placeholder")) | ||
}, /*#__PURE__*/React.createElement(Cell, { | ||
component: cellComponent, | ||
prefixCls: prefixCls | ||
}, emptyNode)); | ||
} | ||
return /*#__PURE__*/React.createElement(GridContext.Provider, { | ||
value: gridContext | ||
}, bodyContent); | ||
}, /*#__PURE__*/React.createElement(VirtualList, { | ||
fullHeight: false, | ||
ref: listRef, | ||
prefixCls: "".concat(tblPrefixCls, "-virtual"), | ||
styles: { | ||
horizontalScrollBar: horizontalScrollBarStyle | ||
}, | ||
className: tblPrefixCls, | ||
height: scrollY, | ||
itemHeight: listItemHeight || 24, | ||
data: flattenData, | ||
itemKey: function itemKey(item) { | ||
return getRowKey(item.record); | ||
}, | ||
component: wrapperComponent, | ||
scrollWidth: scrollX, | ||
onVirtualScroll: function onVirtualScroll(_ref4) { | ||
var _listRef$current5; | ||
var x = _ref4.x; | ||
onScroll({ | ||
currentTarget: (_listRef$current5 = listRef.current) === null || _listRef$current5 === void 0 ? void 0 : _listRef$current5.nativeElement, | ||
scrollLeft: x | ||
}); | ||
}, | ||
onScroll: onTablePropScroll, | ||
extraRender: extraRender | ||
}, function (item, index, itemProps) { | ||
var rowKey = getRowKey(item.record, index); | ||
return /*#__PURE__*/React.createElement(BodyLine, { | ||
data: item, | ||
rowKey: rowKey, | ||
index: index, | ||
style: itemProps.style | ||
}); | ||
})); | ||
}); | ||
@@ -267,0 +256,0 @@ var ResponseGrid = responseImmutable(Grid); |
@@ -22,3 +22,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
function VirtualTable(props, ref) { | ||
var columns = props.columns, | ||
var data = props.data, | ||
columns = props.columns, | ||
scroll = props.scroll, | ||
@@ -78,3 +79,4 @@ sticky = props.sticky, | ||
components: _objectSpread(_objectSpread({}, components), {}, { | ||
body: renderBody | ||
// fix https://github.com/ant-design/ant-design/issues/48991 | ||
body: data !== null && data !== void 0 && data.length ? renderBody : undefined | ||
}), | ||
@@ -81,0 +83,0 @@ columns: columns, |
@@ -40,3 +40,3 @@ "use strict"; | ||
style: { | ||
width: componentWidth - (fixHeader ? scrollbarSize : 0), | ||
width: componentWidth - (fixHeader && !isEmpty ? scrollbarSize : 0), | ||
position: 'sticky', | ||
@@ -43,0 +43,0 @@ left: 0, |
@@ -44,2 +44,3 @@ "use strict"; | ||
var _valueUtil = require("./utils/valueUtil"); | ||
var _findDOMNode = require("rc-util/lib/Dom/findDOMNode"); | ||
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); } | ||
@@ -283,3 +284,3 @@ 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; } | ||
scrollYStyle = { | ||
overflowY: 'scroll', | ||
overflowY: hasData ? 'scroll' : 'auto', | ||
maxHeight: scroll.y | ||
@@ -355,4 +356,4 @@ }; | ||
if (measureTarget) { | ||
var scrollWidth = measureTarget.scrollWidth, | ||
clientWidth = measureTarget.clientWidth; | ||
var scrollWidth = typeof mergedScrollX === 'number' ? mergedScrollX : measureTarget.scrollWidth; | ||
var clientWidth = measureTarget.clientWidth; | ||
// There is no space to scroll | ||
@@ -380,3 +381,3 @@ if (scrollWidth === clientWidth) { | ||
onInternalScroll({ | ||
currentTarget: scrollBodyRef.current | ||
currentTarget: (0, _findDOMNode.getDOM)(scrollBodyRef.current) | ||
}); | ||
@@ -383,0 +384,0 @@ } else { |
@@ -9,5 +9,6 @@ import * as React from 'react'; | ||
scrollLeft: number; | ||
scrollTo?: (scrollConfig: ScrollConfig) => void; | ||
nativeElement: HTMLDivElement; | ||
scrollTo: (scrollConfig: ScrollConfig) => void; | ||
} | ||
declare const ResponseGrid: React.ForwardRefExoticComponent<GridProps<any> & React.RefAttributes<GridRef>>; | ||
export default ResponseGrid; |
@@ -12,6 +12,4 @@ "use strict"; | ||
var _context = require("@rc-component/context"); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _rcVirtualList = _interopRequireDefault(require("rc-virtual-list")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _Cell = _interopRequireDefault(require("../Cell")); | ||
var _TableContext = _interopRequireWildcard(require("../context/TableContext")); | ||
@@ -26,3 +24,3 @@ var _useFlattenRecords = _interopRequireDefault(require("../hooks/useFlattenRecords")); | ||
onScroll = props.onScroll; | ||
var _useContext = (0, _context.useContext)(_TableContext.default, ['flattenColumns', 'onColumnResize', 'getRowKey', 'prefixCls', 'expandedKeys', 'childrenColumnName', 'emptyNode', 'scrollX']), | ||
var _useContext = (0, _context.useContext)(_TableContext.default, ['flattenColumns', 'onColumnResize', 'getRowKey', 'prefixCls', 'expandedKeys', 'childrenColumnName', 'scrollX']), | ||
flattenColumns = _useContext.flattenColumns, | ||
@@ -34,3 +32,2 @@ onColumnResize = _useContext.onColumnResize, | ||
childrenColumnName = _useContext.childrenColumnName, | ||
emptyNode = _useContext.emptyNode, | ||
scrollX = _useContext.scrollX; | ||
@@ -76,2 +73,3 @@ var _useContext2 = (0, _context.useContext)(_context2.StaticContext), | ||
React.useImperativeHandle(ref, function () { | ||
var _listRef$current2; | ||
var obj = { | ||
@@ -81,12 +79,13 @@ scrollTo: function scrollTo(config) { | ||
(_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.scrollTo(config); | ||
} | ||
}, | ||
nativeElement: (_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.nativeElement | ||
}; | ||
Object.defineProperty(obj, 'scrollLeft', { | ||
get: function get() { | ||
var _listRef$current2; | ||
return ((_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.getScrollInfo().x) || 0; | ||
var _listRef$current3; | ||
return ((_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.getScrollInfo().x) || 0; | ||
}, | ||
set: function set(value) { | ||
var _listRef$current3; | ||
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 || _listRef$current3.scrollTo({ | ||
var _listRef$current4; | ||
(_listRef$current4 = listRef.current) === null || _listRef$current4 === void 0 || _listRef$current4.scrollTo({ | ||
left: value | ||
@@ -219,59 +218,49 @@ }); | ||
var wrapperComponent = getComponent(['body', 'wrapper']); | ||
var RowComponent = getComponent(['body', 'row'], 'div'); | ||
var cellComponent = getComponent(['body', 'cell'], 'div'); | ||
var bodyContent; | ||
if (flattenData.length) { | ||
// ========================== Sticky Scroll Bar ========================== | ||
var horizontalScrollBarStyle = {}; | ||
if (sticky) { | ||
horizontalScrollBarStyle.position = 'sticky'; | ||
horizontalScrollBarStyle.bottom = 0; | ||
if ((0, _typeof2.default)(sticky) === 'object' && sticky.offsetScroll) { | ||
horizontalScrollBarStyle.bottom = sticky.offsetScroll; | ||
} | ||
// ========================== Sticky Scroll Bar ========================== | ||
var horizontalScrollBarStyle = {}; | ||
if (sticky) { | ||
horizontalScrollBarStyle.position = 'sticky'; | ||
horizontalScrollBarStyle.bottom = 0; | ||
if ((0, _typeof2.default)(sticky) === 'object' && sticky.offsetScroll) { | ||
horizontalScrollBarStyle.bottom = sticky.offsetScroll; | ||
} | ||
bodyContent = /*#__PURE__*/React.createElement(_rcVirtualList.default, { | ||
fullHeight: false, | ||
ref: listRef, | ||
prefixCls: "".concat(tblPrefixCls, "-virtual"), | ||
styles: { | ||
horizontalScrollBar: horizontalScrollBarStyle | ||
}, | ||
className: tblPrefixCls, | ||
height: scrollY, | ||
itemHeight: listItemHeight || 24, | ||
data: flattenData, | ||
itemKey: function itemKey(item) { | ||
return getRowKey(item.record); | ||
}, | ||
component: wrapperComponent, | ||
scrollWidth: scrollX, | ||
onVirtualScroll: function onVirtualScroll(_ref4) { | ||
var x = _ref4.x; | ||
onScroll({ | ||
scrollLeft: x | ||
}); | ||
}, | ||
onScroll: onTablePropScroll, | ||
extraRender: extraRender | ||
}, function (item, index, itemProps) { | ||
var rowKey = getRowKey(item.record, index); | ||
return /*#__PURE__*/React.createElement(_BodyLine.default, { | ||
data: item, | ||
rowKey: rowKey, | ||
index: index, | ||
style: itemProps.style | ||
}); | ||
}); | ||
} else { | ||
bodyContent = /*#__PURE__*/React.createElement(RowComponent, { | ||
className: (0, _classnames.default)("".concat(prefixCls, "-placeholder")) | ||
}, /*#__PURE__*/React.createElement(_Cell.default, { | ||
component: cellComponent, | ||
prefixCls: prefixCls | ||
}, emptyNode)); | ||
} | ||
return /*#__PURE__*/React.createElement(_context2.GridContext.Provider, { | ||
value: gridContext | ||
}, bodyContent); | ||
}, /*#__PURE__*/React.createElement(_rcVirtualList.default, { | ||
fullHeight: false, | ||
ref: listRef, | ||
prefixCls: "".concat(tblPrefixCls, "-virtual"), | ||
styles: { | ||
horizontalScrollBar: horizontalScrollBarStyle | ||
}, | ||
className: tblPrefixCls, | ||
height: scrollY, | ||
itemHeight: listItemHeight || 24, | ||
data: flattenData, | ||
itemKey: function itemKey(item) { | ||
return getRowKey(item.record); | ||
}, | ||
component: wrapperComponent, | ||
scrollWidth: scrollX, | ||
onVirtualScroll: function onVirtualScroll(_ref4) { | ||
var _listRef$current5; | ||
var x = _ref4.x; | ||
onScroll({ | ||
currentTarget: (_listRef$current5 = listRef.current) === null || _listRef$current5 === void 0 ? void 0 : _listRef$current5.nativeElement, | ||
scrollLeft: x | ||
}); | ||
}, | ||
onScroll: onTablePropScroll, | ||
extraRender: extraRender | ||
}, function (item, index, itemProps) { | ||
var rowKey = getRowKey(item.record, index); | ||
return /*#__PURE__*/React.createElement(_BodyLine.default, { | ||
data: item, | ||
rowKey: rowKey, | ||
index: index, | ||
style: itemProps.style | ||
}); | ||
})); | ||
}); | ||
@@ -278,0 +267,0 @@ var ResponseGrid = (0, _TableContext.responseImmutable)(Grid); |
@@ -33,3 +33,4 @@ "use strict"; | ||
function VirtualTable(props, ref) { | ||
var columns = props.columns, | ||
var data = props.data, | ||
columns = props.columns, | ||
scroll = props.scroll, | ||
@@ -89,3 +90,4 @@ sticky = props.sticky, | ||
components: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, components), {}, { | ||
body: renderBody | ||
// fix https://github.com/ant-design/ant-design/issues/48991 | ||
body: data !== null && data !== void 0 && data.length ? renderBody : undefined | ||
}), | ||
@@ -92,0 +94,0 @@ columns: columns, |
{ | ||
"name": "rc-table", | ||
"version": "7.45.7", | ||
"version": "7.46.0", | ||
"description": "table ui component for react", | ||
@@ -60,3 +60,3 @@ "engines": { | ||
"rc-resize-observer": "^1.1.0", | ||
"rc-util": "^5.37.0", | ||
"rc-util": "^5.41.0", | ||
"rc-virtual-list": "^3.14.2" | ||
@@ -63,0 +63,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
399176
8823
Updatedrc-util@^5.41.0