@are-visual/virtual-table 0.6.0 → 0.7.0
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/index.d.ts +3 -2
- package/index.esm.js +23 -23
- package/index.esm.js.map +1 -1
- package/middleware/column-resize/index.d.ts +2 -1
- package/middleware/empty/index.d.ts +2 -1
- package/middleware/expandable/index.d.ts +3 -2
- package/middleware/horizontal-scroll-bar/index.d.ts +2 -1
- package/middleware/loading/index.js +1 -1
- package/middleware/selection/index.d.ts +3 -2
- package/middleware/summary/index.d.ts +18 -5
- package/middleware/summary/index.js +30 -6
- package/middleware/summary/index.js.map +1 -1
- package/middleware/summary/styles.css +2 -2
- package/middleware/summary/styles.scss +4 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Key, ReactNode, HTMLAttributes, TdHTMLAttributes, DetailedHTMLProps, RefObject, ReactElement, CSSProperties, Ref, RefAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
type ScrollElement = HTMLElement | Window;
|
|
5
5
|
declare function getScrollParent(el: Element, root?: ScrollElement | null | undefined): ScrollElement;
|
|
@@ -342,4 +342,5 @@ type PossibleRef<T> = Ref<T> | undefined;
|
|
|
342
342
|
declare function mergeRefs<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
|
|
343
343
|
declare function useMergedRef<T>(...refs: PossibleRef<T>[]): (node: T | null) => void;
|
|
344
344
|
|
|
345
|
-
export {
|
|
345
|
+
export { _default$2 as Colgroup, TablePipeline, _default as VirtualTable, _default$3 as VirtualTableCell, _default$1 as VirtualTableRow, createMiddleware, findLastIndex, getKey, getRelativeOffsetTop, getRowKey, getScrollElement, getScrollParent, getScrollTop, isDocument, isRoot, isValidFixed, isValidFixedLeft, isValidFixedRight, isWindow, mergeRefs, onResize, useColumnSizes, useContainerSize, useHorizontalScrollContext, useMergedRef, useShallowMemo, useStableFn, useTablePipeline, useTableRowManager, useTableSticky };
|
|
346
|
+
export type { AlignType, AnyObject, ColumnDescriptor, ColumnExtra, ColumnType, ContainerSizeState, FixedType, HorizontalScrollContextState, MergedMiddlewareRender, Middleware, MiddlewareContext, MiddlewareRender, MiddlewareRenderBody, MiddlewareRenderBodyContent, MiddlewareRenderBodyRoot, MiddlewareRenderBodyWrapper, MiddlewareRenderCell, MiddlewareRenderContent, MiddlewareRenderHeader, MiddlewareRenderHeaderCell, MiddlewareRenderHeaderRoot, MiddlewareRenderHeaderRow, MiddlewareRenderHeaderWrapper, MiddlewareRenderRoot, MiddlewareRenderRow, MiddlewareRenders, MiddlewareResult, OnRowType, PipelineRender, PipelineRenderOptions, ScrollElement, StickyContextState, TableColumnsContextType, TableRowManagerContextType, UseTablePipelineOptions, CellProps as VirtualTableCellProps, VirtualTableCoreProps as VirtualTableProps, RowProps as VirtualTableRowProps };
|
package/index.esm.js
CHANGED
|
@@ -15,7 +15,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
15
15
|
if (null == r) return {};
|
|
16
16
|
var t = {};
|
|
17
17
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
18
|
-
if (e.
|
|
18
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
19
19
|
t[n] = r[n];
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
@@ -251,7 +251,7 @@ function getTableCellContent(index, data, column) {
|
|
|
251
251
|
}
|
|
252
252
|
return render(rowData[dataIndex], data, index);
|
|
253
253
|
}
|
|
254
|
-
return (_render = render == null ?
|
|
254
|
+
return (_render = render == null ? void 0 : render(data, data, index)) != null ? _render : null;
|
|
255
255
|
}
|
|
256
256
|
function Cell(props) {
|
|
257
257
|
var _onCell;
|
|
@@ -268,7 +268,7 @@ function Cell(props) {
|
|
|
268
268
|
var key = getKey(column);
|
|
269
269
|
var _useTableSticky = useTableSticky(),
|
|
270
270
|
stickySizes = _useTableSticky.size;
|
|
271
|
-
var _ref = (_onCell = onCell == null ?
|
|
271
|
+
var _ref = (_onCell = onCell == null ? void 0 : onCell(rowData, rowIndex)) != null ? _onCell : {},
|
|
272
272
|
extraClassName = _ref.className,
|
|
273
273
|
extraStyle = _ref.style,
|
|
274
274
|
colSpan = _ref.colSpan,
|
|
@@ -343,7 +343,7 @@ function isElement(node) {
|
|
|
343
343
|
}
|
|
344
344
|
function getScrollParent(el, root) {
|
|
345
345
|
var _el$ownerDocument$def;
|
|
346
|
-
if (root ===
|
|
346
|
+
if (root === void 0) {
|
|
347
347
|
root = window;
|
|
348
348
|
}
|
|
349
349
|
var node = el;
|
|
@@ -569,7 +569,7 @@ function useStableFn(callback) {
|
|
|
569
569
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
570
570
|
args[_key] = arguments[_key];
|
|
571
571
|
}
|
|
572
|
-
return fn.current == null ?
|
|
572
|
+
return fn.current == null ? void 0 : fn.current.apply(fn, args);
|
|
573
573
|
}, []);
|
|
574
574
|
return stableFn;
|
|
575
575
|
}
|
|
@@ -587,7 +587,7 @@ function createMiddleware(hook) {
|
|
|
587
587
|
options[_key] = arguments[_key];
|
|
588
588
|
}
|
|
589
589
|
var useMiddleware = function useMiddleware(ctx) {
|
|
590
|
-
return hook.apply(
|
|
590
|
+
return hook.apply(void 0, [ctx].concat(options));
|
|
591
591
|
};
|
|
592
592
|
if (isShallowEqual(options, cache.options)) {
|
|
593
593
|
var _cache$current;
|
|
@@ -712,7 +712,7 @@ var TablePipeline = /*#__PURE__*/function () {
|
|
|
712
712
|
});
|
|
713
713
|
if (rowClassNameFunctions.length > 0) {
|
|
714
714
|
context.current.rowClassName = function (record, index) {
|
|
715
|
-
return clsx.apply(
|
|
715
|
+
return clsx.apply(void 0, rowClassNameFunctions.map(function (fn) {
|
|
716
716
|
return fn(record, index);
|
|
717
717
|
}));
|
|
718
718
|
};
|
|
@@ -745,7 +745,7 @@ function useTablePipeline(options) {
|
|
|
745
745
|
}, []);
|
|
746
746
|
if (use != null) {
|
|
747
747
|
var _extraPipeline$hooks;
|
|
748
|
-
var nextHooks = shakeUnsafeHooks([].concat(use, (_extraPipeline$hooks = extraPipeline == null ?
|
|
748
|
+
var nextHooks = shakeUnsafeHooks([].concat(use, (_extraPipeline$hooks = extraPipeline == null ? void 0 : extraPipeline.hooks) != null ? _extraPipeline$hooks : []));
|
|
749
749
|
if (!shallowEqualArrays(cached.current.hooks, nextHooks)) {
|
|
750
750
|
var pipeline = new TablePipeline();
|
|
751
751
|
pipeline.setHooks(nextHooks);
|
|
@@ -794,7 +794,7 @@ function Row(props) {
|
|
|
794
794
|
}
|
|
795
795
|
return isValidFixedRight(x.column.fixed);
|
|
796
796
|
});
|
|
797
|
-
var _ref = (_onRow = onRow == null ?
|
|
797
|
+
var _ref = (_onRow = onRow == null ? void 0 : onRow(rowData, rowIndex)) != null ? _onRow : {},
|
|
798
798
|
extraClassName = _ref.className,
|
|
799
799
|
extraProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
800
800
|
return pipelineRender(jsx("tr", _extends({}, rest, extraProps, {
|
|
@@ -850,7 +850,7 @@ function useMergedRef() {
|
|
|
850
850
|
refs[_key2] = arguments[_key2];
|
|
851
851
|
}
|
|
852
852
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
853
|
-
return useCallback(mergeRefs.apply(
|
|
853
|
+
return useCallback(mergeRefs.apply(void 0, refs), refs);
|
|
854
854
|
}
|
|
855
855
|
|
|
856
856
|
function onResize(target, callback) {
|
|
@@ -931,7 +931,7 @@ function useRowVirtualize(options) {
|
|
|
931
931
|
// 布局信息(也就是锚点元素需要的信息,top,bottom,height,index)
|
|
932
932
|
var rowRects = useRef([]);
|
|
933
933
|
var updateRowRectList = function updateRowRectList(shouldSkip) {
|
|
934
|
-
if (shouldSkip ===
|
|
934
|
+
if (shouldSkip === void 0) {
|
|
935
935
|
shouldSkip = false;
|
|
936
936
|
}
|
|
937
937
|
if (shouldSkip && rowRects.current.length > 0) {
|
|
@@ -1140,7 +1140,7 @@ function TableBody(props) {
|
|
|
1140
1140
|
var bodyContent = pipelineRender(dataSource.map(function (e, rowIndex) {
|
|
1141
1141
|
var key = getRowKey(e, rowKey);
|
|
1142
1142
|
return jsx(Row$1, {
|
|
1143
|
-
className: clsx(rowClassName == null ?
|
|
1143
|
+
className: clsx(rowClassName == null ? void 0 : rowClassName(e, rowIndex)),
|
|
1144
1144
|
rowIndex: rowIndex + startIndex,
|
|
1145
1145
|
rowData: e,
|
|
1146
1146
|
columns: columnDescriptor,
|
|
@@ -1289,7 +1289,7 @@ var TableHeader = function TableHeader(props) {
|
|
|
1289
1289
|
return null;
|
|
1290
1290
|
}
|
|
1291
1291
|
var isLast = getKey(lastColumn) === key;
|
|
1292
|
-
var _ref = (_column$onHeaderCell = column.onHeaderCell == null ?
|
|
1292
|
+
var _ref = (_column$onHeaderCell = column.onHeaderCell == null ? void 0 : column.onHeaderCell(column, index)) != null ? _column$onHeaderCell : {},
|
|
1293
1293
|
thClassName = _ref.className,
|
|
1294
1294
|
thStyle = _ref.style,
|
|
1295
1295
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -1391,7 +1391,7 @@ function useColumnVirtualize(options) {
|
|
|
1391
1391
|
bodyWrapper = options.bodyWrapper,
|
|
1392
1392
|
columnWidths = options.columnWidths,
|
|
1393
1393
|
_options$disabled = options.disabled,
|
|
1394
|
-
disabled = _options$disabled ===
|
|
1394
|
+
disabled = _options$disabled === void 0 ? false : _options$disabled;
|
|
1395
1395
|
var lastFixedLeftIndex = findLastFixedLeftIndex(rawColumns);
|
|
1396
1396
|
var firstFixedRightIndex = findFirstFixedRightIndex(rawColumns);
|
|
1397
1397
|
var leftKey = lastFixedLeftIndex > -1 ? getKey(rawColumns[lastFixedLeftIndex]) : null;
|
|
@@ -1641,24 +1641,24 @@ function VirtualTableCore(props, ref) {
|
|
|
1641
1641
|
rawColumns = props.columns,
|
|
1642
1642
|
rawData = props.dataSource,
|
|
1643
1643
|
_props$rowKey = props.rowKey,
|
|
1644
|
-
rawRowKey = _props$rowKey ===
|
|
1644
|
+
rawRowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey,
|
|
1645
1645
|
_props$estimatedRowHe = props.estimatedRowHeight,
|
|
1646
|
-
estimatedRowHeight = _props$estimatedRowHe ===
|
|
1646
|
+
estimatedRowHeight = _props$estimatedRowHe === void 0 ? 46 : _props$estimatedRowHe,
|
|
1647
1647
|
estimatedColumnWidth = props.estimatedColumnWidth,
|
|
1648
1648
|
_props$overscanRows = props.overscanRows,
|
|
1649
|
-
overscanRows = _props$overscanRows ===
|
|
1649
|
+
overscanRows = _props$overscanRows === void 0 ? 5 : _props$overscanRows,
|
|
1650
1650
|
_props$overscanColumn = props.overscanColumns,
|
|
1651
|
-
overscanColumns = _props$overscanColumn ===
|
|
1651
|
+
overscanColumns = _props$overscanColumn === void 0 ? 3 : _props$overscanColumn,
|
|
1652
1652
|
stickyHeader = props.stickyHeader,
|
|
1653
1653
|
_props$defaultColumnW = props.defaultColumnWidth,
|
|
1654
|
-
defaultColumnWidth = _props$defaultColumnW ===
|
|
1654
|
+
defaultColumnWidth = _props$defaultColumnW === void 0 ? 100 : _props$defaultColumnW,
|
|
1655
1655
|
_props$pipeline = props.pipeline,
|
|
1656
|
-
pipeline = _props$pipeline ===
|
|
1656
|
+
pipeline = _props$pipeline === void 0 ? TablePipeline.defaultPipeline : _props$pipeline,
|
|
1657
1657
|
rawRowClassName = props.rowClassName,
|
|
1658
1658
|
onRow = props.onRow,
|
|
1659
1659
|
getOffsetTopImpl = props.getOffsetTop,
|
|
1660
1660
|
_props$virtualHeader = props.virtualHeader,
|
|
1661
|
-
virtualHeader = _props$virtualHeader ===
|
|
1661
|
+
virtualHeader = _props$virtualHeader === void 0 ? true : _props$virtualHeader;
|
|
1662
1662
|
var rootNode = useRef(null);
|
|
1663
1663
|
var headerWrapperRef = useRef(null);
|
|
1664
1664
|
var bodyWrapperRef = useRef(null);
|
|
@@ -1748,10 +1748,10 @@ function VirtualTableCore(props, ref) {
|
|
|
1748
1748
|
}),
|
|
1749
1749
|
columns = _useColumnVirtualize.columns;
|
|
1750
1750
|
var onRowClassName = useCallback(function (record, index) {
|
|
1751
|
-
return clsx(rawRowClassName == null ?
|
|
1751
|
+
return clsx(rawRowClassName == null ? void 0 : rawRowClassName(record, index), rowClassName == null ? void 0 : rowClassName(record, index));
|
|
1752
1752
|
}, [rawRowClassName, rowClassName]);
|
|
1753
1753
|
var onRowProps = useCallback(function (record, index) {
|
|
1754
|
-
return _extends({}, onRow == null ?
|
|
1754
|
+
return _extends({}, onRow == null ? void 0 : onRow(record, index), onPipelineRow == null ? void 0 : onPipelineRow(record, index));
|
|
1755
1755
|
}, [onPipelineRow, onRow]);
|
|
1756
1756
|
var hasFixedLeftColumn = pipelineColumns.some(function (x) {
|
|
1757
1757
|
return isValidFixedLeft(x.fixed);
|