Comparing version 7.34.4 to 7.35.0
import { EXPAND_COLUMN, INTERNAL_HOOKS } from './constant'; | ||
import { FooterComponents as Summary } from './Footer'; | ||
import VirtualTable, { genVirtualTable } from './VirtualTable'; | ||
import type { VirtualTableProps } from './VirtualTable'; | ||
import type { Reference } from './interface'; | ||
import Column from './sugar/Column'; | ||
@@ -10,3 +9,5 @@ import ColumnGroup from './sugar/ColumnGroup'; | ||
import { INTERNAL_COL_DEFINE } from './utils/legacyUtil'; | ||
export { genTable, Summary, Column, ColumnGroup, type TableProps, INTERNAL_COL_DEFINE, EXPAND_COLUMN, INTERNAL_HOOKS, VirtualTable, genVirtualTable, type VirtualTableProps, }; | ||
import type { VirtualTableProps } from './VirtualTable'; | ||
import VirtualTable, { genVirtualTable } from './VirtualTable'; | ||
export { genTable, Summary, Column, ColumnGroup, type TableProps, INTERNAL_COL_DEFINE, EXPAND_COLUMN, INTERNAL_HOOKS, VirtualTable, genVirtualTable, type VirtualTableProps, type Reference, }; | ||
export default Table; |
import { EXPAND_COLUMN, INTERNAL_HOOKS } from "./constant"; | ||
import { FooterComponents as Summary } from "./Footer"; | ||
import VirtualTable, { genVirtualTable } from "./VirtualTable"; | ||
import Column from "./sugar/Column"; | ||
@@ -8,3 +7,4 @@ import ColumnGroup from "./sugar/ColumnGroup"; | ||
import { INTERNAL_COL_DEFINE } from "./utils/legacyUtil"; | ||
import VirtualTable, { genVirtualTable } from "./VirtualTable"; | ||
export { genTable, Summary, Column, ColumnGroup, INTERNAL_COL_DEFINE, EXPAND_COLUMN, INTERNAL_HOOKS, VirtualTable, genVirtualTable }; | ||
export default Table; |
@@ -22,2 +22,11 @@ import type * as React from 'react'; | ||
export type TableLayout = 'auto' | 'fixed'; | ||
export type ScrollConfig = { | ||
index?: number; | ||
key?: Key; | ||
top?: number; | ||
}; | ||
export type Reference = { | ||
nativeElement: HTMLDivElement; | ||
scrollTo: (config: ScrollConfig) => void; | ||
}; | ||
export type RowClassName<RecordType> = (record: RecordType, index: number, indent: number) => string; | ||
@@ -92,2 +101,3 @@ export interface CellType<RecordType> { | ||
scrollLeft: number; | ||
scrollTo?: (scrollConfig: ScrollConfig) => void; | ||
}>; | ||
@@ -94,0 +104,0 @@ onScroll: OnCustomizeScroll; |
@@ -30,3 +30,3 @@ /** | ||
import { FooterComponents } from './Footer'; | ||
import type { ColumnsType, ColumnType, DefaultRecordType, Direction, ExpandableConfig, GetComponentProps, GetRowKey, LegacyExpandableProps, PanelRender, RowClassName, TableComponents, TableLayout, TableSticky } from './interface'; | ||
import type { ColumnsType, ColumnType, DefaultRecordType, Direction, ExpandableConfig, GetComponentProps, GetRowKey, LegacyExpandableProps, PanelRender, Reference, RowClassName, TableComponents, TableLayout, TableSticky } from './interface'; | ||
import Column from './sugar/Column'; | ||
@@ -63,2 +63,3 @@ import ColumnGroup from './sugar/ColumnGroup'; | ||
sticky?: boolean | TableSticky; | ||
reference?: React.Ref<Reference>; | ||
/** | ||
@@ -65,0 +66,0 @@ * @private Internal usage, may remove by refactor. Should always use `columns` instead. |
@@ -87,2 +87,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
direction = props.direction, | ||
reference = props.reference, | ||
title = props.title, | ||
@@ -182,3 +183,3 @@ footer = props.footer, | ||
// ====================== Scroll ====================== | ||
// ======================= Refs ======================= | ||
var fullTableRef = React.useRef(); | ||
@@ -188,2 +189,31 @@ var scrollHeaderRef = React.useRef(); | ||
var scrollBodyContainerRef = React.useRef(); | ||
React.useImperativeHandle(reference, function () { | ||
return { | ||
nativeElement: fullTableRef.current, | ||
scrollTo: function scrollTo(config) { | ||
var _scrollBodyRef$curren3; | ||
if (scrollBodyRef.current instanceof HTMLElement) { | ||
// Native scroll | ||
var index = config.index, | ||
top = config.top, | ||
key = config.key; | ||
if (top) { | ||
var _scrollBodyRef$curren; | ||
(_scrollBodyRef$curren = scrollBodyRef.current) === null || _scrollBodyRef$curren === void 0 ? void 0 : _scrollBodyRef$curren.scrollTo({ | ||
top: top | ||
}); | ||
} else { | ||
var _scrollBodyRef$curren2; | ||
var mergedKey = key !== null && key !== void 0 ? key : getRowKey(mergedData[index]); | ||
(_scrollBodyRef$curren2 = scrollBodyRef.current.querySelector("[data-row-key=\"".concat(mergedKey, "\"]"))) === null || _scrollBodyRef$curren2 === void 0 ? void 0 : _scrollBodyRef$curren2.scrollIntoView(); | ||
} | ||
} else if ((_scrollBodyRef$curren3 = scrollBodyRef.current) !== null && _scrollBodyRef$curren3 !== void 0 && _scrollBodyRef$curren3.scrollTo) { | ||
// Pass to proxy | ||
scrollBodyRef.current.scrollTo(config); | ||
} | ||
} | ||
}; | ||
}); | ||
// ====================== Scroll ====================== | ||
var scrollSummaryRef = React.useRef(); | ||
@@ -190,0 +220,0 @@ var _React$useState3 = React.useState(false), |
import * as React from 'react'; | ||
import type { OnCustomizeScroll } from '../interface'; | ||
import type { OnCustomizeScroll, ScrollConfig } from '../interface'; | ||
export interface GridProps<RecordType = any> { | ||
@@ -9,4 +9,5 @@ data: RecordType[]; | ||
scrollLeft: number; | ||
scrollTo?: (scrollConfig: ScrollConfig) => void; | ||
} | ||
declare const ResponseGrid: React.ForwardRefExoticComponent<GridProps<any> & React.RefAttributes<GridRef>>; | ||
export default ResponseGrid; |
@@ -62,11 +62,17 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
React.useImperativeHandle(ref, function () { | ||
var obj = {}; | ||
var obj = { | ||
scrollTo: function scrollTo(config) { | ||
var _listRef$current; | ||
console.log('!!!!', config); | ||
(_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.scrollTo(config); | ||
} | ||
}; | ||
Object.defineProperty(obj, 'scrollLeft', { | ||
get: function get() { | ||
var _listRef$current; | ||
return ((_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.getScrollInfo().x) || 0; | ||
var _listRef$current2; | ||
return ((_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.getScrollInfo().x) || 0; | ||
}, | ||
set: function set(value) { | ||
var _listRef$current2; | ||
(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.scrollTo({ | ||
var _listRef$current3; | ||
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.scrollTo({ | ||
left: value | ||
@@ -73,0 +79,0 @@ }); |
import { EXPAND_COLUMN, INTERNAL_HOOKS } from './constant'; | ||
import { FooterComponents as Summary } from './Footer'; | ||
import VirtualTable, { genVirtualTable } from './VirtualTable'; | ||
import type { VirtualTableProps } from './VirtualTable'; | ||
import type { Reference } from './interface'; | ||
import Column from './sugar/Column'; | ||
@@ -10,3 +9,5 @@ import ColumnGroup from './sugar/ColumnGroup'; | ||
import { INTERNAL_COL_DEFINE } from './utils/legacyUtil'; | ||
export { genTable, Summary, Column, ColumnGroup, type TableProps, INTERNAL_COL_DEFINE, EXPAND_COLUMN, INTERNAL_HOOKS, VirtualTable, genVirtualTable, type VirtualTableProps, }; | ||
import type { VirtualTableProps } from './VirtualTable'; | ||
import VirtualTable, { genVirtualTable } from './VirtualTable'; | ||
export { genTable, Summary, Column, ColumnGroup, type TableProps, INTERNAL_COL_DEFINE, EXPAND_COLUMN, INTERNAL_HOOKS, VirtualTable, genVirtualTable, type VirtualTableProps, type Reference, }; | ||
export default Table; |
@@ -65,3 +65,2 @@ "use strict"; | ||
var _Footer = require("./Footer"); | ||
var _VirtualTable = _interopRequireWildcard(require("./VirtualTable")); | ||
var _Column = _interopRequireDefault(require("./sugar/Column")); | ||
@@ -71,2 +70,3 @@ var _ColumnGroup = _interopRequireDefault(require("./sugar/ColumnGroup")); | ||
var _legacyUtil = require("./utils/legacyUtil"); | ||
var _VirtualTable = _interopRequireWildcard(require("./VirtualTable")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
@@ -73,0 +73,0 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } |
@@ -22,2 +22,11 @@ import type * as React from 'react'; | ||
export type TableLayout = 'auto' | 'fixed'; | ||
export type ScrollConfig = { | ||
index?: number; | ||
key?: Key; | ||
top?: number; | ||
}; | ||
export type Reference = { | ||
nativeElement: HTMLDivElement; | ||
scrollTo: (config: ScrollConfig) => void; | ||
}; | ||
export type RowClassName<RecordType> = (record: RecordType, index: number, indent: number) => string; | ||
@@ -92,2 +101,3 @@ export interface CellType<RecordType> { | ||
scrollLeft: number; | ||
scrollTo?: (scrollConfig: ScrollConfig) => void; | ||
}>; | ||
@@ -94,0 +104,0 @@ onScroll: OnCustomizeScroll; |
@@ -30,3 +30,3 @@ /** | ||
import { FooterComponents } from './Footer'; | ||
import type { ColumnsType, ColumnType, DefaultRecordType, Direction, ExpandableConfig, GetComponentProps, GetRowKey, LegacyExpandableProps, PanelRender, RowClassName, TableComponents, TableLayout, TableSticky } from './interface'; | ||
import type { ColumnsType, ColumnType, DefaultRecordType, Direction, ExpandableConfig, GetComponentProps, GetRowKey, LegacyExpandableProps, PanelRender, Reference, RowClassName, TableComponents, TableLayout, TableSticky } from './interface'; | ||
import Column from './sugar/Column'; | ||
@@ -63,2 +63,3 @@ import ColumnGroup from './sugar/ColumnGroup'; | ||
sticky?: boolean | TableSticky; | ||
reference?: React.Ref<Reference>; | ||
/** | ||
@@ -65,0 +66,0 @@ * @private Internal usage, may remove by refactor. Should always use `columns` instead. |
@@ -99,2 +99,3 @@ "use strict"; | ||
direction = props.direction, | ||
reference = props.reference, | ||
title = props.title, | ||
@@ -194,3 +195,3 @@ footer = props.footer, | ||
// ====================== Scroll ====================== | ||
// ======================= Refs ======================= | ||
var fullTableRef = React.useRef(); | ||
@@ -200,2 +201,31 @@ var scrollHeaderRef = React.useRef(); | ||
var scrollBodyContainerRef = React.useRef(); | ||
React.useImperativeHandle(reference, function () { | ||
return { | ||
nativeElement: fullTableRef.current, | ||
scrollTo: function scrollTo(config) { | ||
var _scrollBodyRef$curren3; | ||
if (scrollBodyRef.current instanceof HTMLElement) { | ||
// Native scroll | ||
var index = config.index, | ||
top = config.top, | ||
key = config.key; | ||
if (top) { | ||
var _scrollBodyRef$curren; | ||
(_scrollBodyRef$curren = scrollBodyRef.current) === null || _scrollBodyRef$curren === void 0 ? void 0 : _scrollBodyRef$curren.scrollTo({ | ||
top: top | ||
}); | ||
} else { | ||
var _scrollBodyRef$curren2; | ||
var mergedKey = key !== null && key !== void 0 ? key : getRowKey(mergedData[index]); | ||
(_scrollBodyRef$curren2 = scrollBodyRef.current.querySelector("[data-row-key=\"".concat(mergedKey, "\"]"))) === null || _scrollBodyRef$curren2 === void 0 ? void 0 : _scrollBodyRef$curren2.scrollIntoView(); | ||
} | ||
} else if ((_scrollBodyRef$curren3 = scrollBodyRef.current) !== null && _scrollBodyRef$curren3 !== void 0 && _scrollBodyRef$curren3.scrollTo) { | ||
// Pass to proxy | ||
scrollBodyRef.current.scrollTo(config); | ||
} | ||
} | ||
}; | ||
}); | ||
// ====================== Scroll ====================== | ||
var scrollSummaryRef = React.useRef(); | ||
@@ -202,0 +232,0 @@ var _React$useState3 = React.useState(false), |
import * as React from 'react'; | ||
import type { OnCustomizeScroll } from '../interface'; | ||
import type { OnCustomizeScroll, ScrollConfig } from '../interface'; | ||
export interface GridProps<RecordType = any> { | ||
@@ -9,4 +9,5 @@ data: RecordType[]; | ||
scrollLeft: number; | ||
scrollTo?: (scrollConfig: ScrollConfig) => void; | ||
} | ||
declare const ResponseGrid: React.ForwardRefExoticComponent<GridProps<any> & React.RefAttributes<GridRef>>; | ||
export default ResponseGrid; |
@@ -72,11 +72,17 @@ "use strict"; | ||
React.useImperativeHandle(ref, function () { | ||
var obj = {}; | ||
var obj = { | ||
scrollTo: function scrollTo(config) { | ||
var _listRef$current; | ||
console.log('!!!!', config); | ||
(_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.scrollTo(config); | ||
} | ||
}; | ||
Object.defineProperty(obj, 'scrollLeft', { | ||
get: function get() { | ||
var _listRef$current; | ||
return ((_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.getScrollInfo().x) || 0; | ||
var _listRef$current2; | ||
return ((_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.getScrollInfo().x) || 0; | ||
}, | ||
set: function set(value) { | ||
var _listRef$current2; | ||
(_listRef$current2 = listRef.current) === null || _listRef$current2 === void 0 ? void 0 : _listRef$current2.scrollTo({ | ||
var _listRef$current3; | ||
(_listRef$current3 = listRef.current) === null || _listRef$current3 === void 0 ? void 0 : _listRef$current3.scrollTo({ | ||
left: value | ||
@@ -83,0 +89,0 @@ }); |
{ | ||
"name": "rc-table", | ||
"version": "7.34.4", | ||
"version": "7.35.0", | ||
"description": "table ui component for react", | ||
@@ -60,3 +60,3 @@ "engines": { | ||
"rc-resize-observer": "^1.1.0", | ||
"rc-util": "^5.36.0", | ||
"rc-util": "^5.37.0", | ||
"rc-virtual-list": "^3.11.1" | ||
@@ -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
399657
8719
1
Updatedrc-util@^5.37.0