Comparing version 7.37.0 to 7.38.0
@@ -141,3 +141,5 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
} | ||
BodyRow.displayName = 'BodyRow'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
BodyRow.displayName = 'BodyRow'; | ||
} | ||
export default responseImmutable(BodyRow); |
@@ -80,3 +80,5 @@ import { useContext } from '@rc-component/context'; | ||
} | ||
Body.displayName = 'Body'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
Body.displayName = 'Body'; | ||
} | ||
export default responseImmutable(Body); |
@@ -123,3 +123,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
// >>>>> ClassName | ||
var mergedClassName = classNames(cellPrefixCls, className, (_classNames = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-left"), isFixLeft && supportSticky), "".concat(cellPrefixCls, "-fix-left-first"), firstFixLeft && supportSticky), "".concat(cellPrefixCls, "-fix-left-last"), lastFixLeft && supportSticky), "".concat(cellPrefixCls, "-fix-left-all"), lastFixLeft && allColumnsFixedLeft && supportSticky), "".concat(cellPrefixCls, "-fix-right"), isFixRight && supportSticky), "".concat(cellPrefixCls, "-fix-right-first"), firstFixRight && supportSticky), "".concat(cellPrefixCls, "-fix-right-last"), lastFixRight && supportSticky), "".concat(cellPrefixCls, "-ellipsis"), ellipsis), "".concat(cellPrefixCls, "-with-append"), appendNode), "".concat(cellPrefixCls, "-fix-sticky"), (isFixLeft || isFixRight) && isSticky && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-row-hover"), !legacyCellProps && hovering)), additionalProps.className, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.className); | ||
var mergedClassName = classNames(cellPrefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-left"), isFixLeft && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-left-first"), firstFixLeft && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-left-last"), lastFixLeft && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-left-all"), lastFixLeft && allColumnsFixedLeft && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-right"), isFixRight && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-right-first"), firstFixRight && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-right-last"), lastFixRight && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-ellipsis"), ellipsis), _defineProperty(_classNames, "".concat(cellPrefixCls, "-with-append"), appendNode), _defineProperty(_classNames, "".concat(cellPrefixCls, "-fix-sticky"), (isFixLeft || isFixRight) && isSticky && supportSticky), _defineProperty(_classNames, "".concat(cellPrefixCls, "-row-hover"), !legacyCellProps && hovering), _classNames), additionalProps.className, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.className); | ||
@@ -126,0 +126,0 @@ // >>>>> Style |
@@ -145,3 +145,5 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
}); | ||
FixedHolder.displayName = 'FixedHolder'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
FixedHolder.displayName = 'FixedHolder'; | ||
} | ||
@@ -148,0 +150,0 @@ /** Return a table in div as fixed element which contains sticky info */ |
@@ -49,3 +49,5 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
} | ||
HeaderRow.displayName = 'HeaderRow'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
HeaderRow.displayName = 'HeaderRow'; | ||
} | ||
export default HeaderRow; |
@@ -138,2 +138,3 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
if (expandable) { | ||
var _expandColumn; | ||
var cloneColumns = baseColumns.slice(); | ||
@@ -177,6 +178,6 @@ | ||
// >>> Create expandable column | ||
var expandColumn = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, INTERNAL_COL_DEFINE, { | ||
var expandColumn = (_expandColumn = {}, _defineProperty(_expandColumn, INTERNAL_COL_DEFINE, { | ||
className: "".concat(prefixCls, "-expand-icon-col"), | ||
columnType: 'EXPAND_COLUMN' | ||
}), "title", columnTitle), "fixed", fixedColumn), "className", "".concat(prefixCls, "-row-expand-icon-cell")), "width", columnWidth), "render", function render(_, record, index) { | ||
}), _defineProperty(_expandColumn, "title", columnTitle), _defineProperty(_expandColumn, "fixed", fixedColumn), _defineProperty(_expandColumn, "className", "".concat(prefixCls, "-row-expand-icon-cell")), _defineProperty(_expandColumn, "width", columnWidth), _defineProperty(_expandColumn, "render", function render(_, record, index) { | ||
var rowKey = getRowKey(record, index); | ||
@@ -200,3 +201,3 @@ var expanded = expandedKeys.has(rowKey); | ||
return icon; | ||
}); | ||
}), _expandColumn); | ||
return cloneColumns.map(function (col) { | ||
@@ -203,0 +204,0 @@ return col === EXPAND_COLUMN ? expandColumn : col; |
@@ -36,2 +36,4 @@ /* istanbul ignore file */ | ||
}); | ||
RenderBlock.displayName = 'RenderBlock'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
RenderBlock.displayName = 'RenderBlock'; | ||
} |
@@ -5,4 +5,3 @@ /* istanbul ignore next */ | ||
* So HOC will not work on this. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function Column(_) { | ||
@@ -9,0 +8,0 @@ return null; |
@@ -5,4 +5,3 @@ /* istanbul ignore next */ | ||
* So HOC will not work on this. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function ColumnGroup(_) { | ||
@@ -9,0 +8,0 @@ return null; |
@@ -96,5 +96,3 @@ /** | ||
declare function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<RecordType>, ref: React.Ref<Reference>): React.JSX.Element; | ||
export type ForwardGenericTable = (<RecordType extends DefaultRecordType = any>(props: TableProps<RecordType> & { | ||
ref?: React.Ref<Reference>; | ||
}) => React.ReactElement) & { | ||
export type ForwardGenericTable = (<RecordType extends DefaultRecordType = any>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & { | ||
displayName?: string; | ||
@@ -101,0 +99,0 @@ }; |
@@ -72,2 +72,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
function Table(tableProps, ref) { | ||
var _classNames; | ||
var props = _objectSpread({ | ||
@@ -574,3 +575,3 @@ rowKey: 'key', | ||
var fullTable = /*#__PURE__*/React.createElement("div", _extends({ | ||
className: classNames(prefixCls, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-ping-left"), pingedLeft), "".concat(prefixCls, "-ping-right"), pingedRight), "".concat(prefixCls, "-layout-fixed"), tableLayout === 'fixed'), "".concat(prefixCls, "-fixed-header"), fixHeader), "".concat(prefixCls, "-fixed-column"), fixColumn), "".concat(prefixCls, "-scroll-horizontal"), horizonScroll), "".concat(prefixCls, "-has-fix-left"), flattenColumns[0] && flattenColumns[0].fixed), "".concat(prefixCls, "-has-fix-right"), flattenColumns[flattenColumns.length - 1] && flattenColumns[flattenColumns.length - 1].fixed === 'right')), | ||
className: classNames(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _defineProperty(_classNames, "".concat(prefixCls, "-ping-left"), pingedLeft), _defineProperty(_classNames, "".concat(prefixCls, "-ping-right"), pingedRight), _defineProperty(_classNames, "".concat(prefixCls, "-layout-fixed"), tableLayout === 'fixed'), _defineProperty(_classNames, "".concat(prefixCls, "-fixed-header"), fixHeader), _defineProperty(_classNames, "".concat(prefixCls, "-fixed-column"), fixColumn), _defineProperty(_classNames, "".concat(prefixCls, "-scroll-horizontal"), horizonScroll), _defineProperty(_classNames, "".concat(prefixCls, "-has-fix-left"), flattenColumns[0] && flattenColumns[0].fixed), _defineProperty(_classNames, "".concat(prefixCls, "-has-fix-right"), flattenColumns[flattenColumns.length - 1] && flattenColumns[flattenColumns.length - 1].fixed === 'right'), _classNames)), | ||
style: style, | ||
@@ -577,0 +578,0 @@ id: id, |
@@ -5,2 +5,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
export function renderExpandIcon(_ref) { | ||
var _classNames; | ||
var prefixCls = _ref.prefixCls, | ||
@@ -22,3 +23,3 @@ record = _ref.record, | ||
return /*#__PURE__*/React.createElement("span", { | ||
className: classNames(expandClassName, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-row-expanded"), expanded), "".concat(prefixCls, "-row-collapsed"), !expanded)), | ||
className: classNames(expandClassName, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-row-expanded"), expanded), _defineProperty(_classNames, "".concat(prefixCls, "-row-collapsed"), !expanded), _classNames)), | ||
onClick: onClick | ||
@@ -25,0 +26,0 @@ }); |
@@ -28,3 +28,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
scrollY = _useContext2.scrollY, | ||
listItemHeight = _useContext2.listItemHeight; | ||
listItemHeight = _useContext2.listItemHeight, | ||
getComponent = _useContext2.getComponent; | ||
@@ -201,2 +202,7 @@ // =========================== Ref ============================ | ||
var tblPrefixCls = "".concat(prefixCls, "-tbody"); | ||
// default 'div' in rc-virtual-list | ||
var wrapperComponent = getComponent(['body', 'wrapper']); | ||
var RowComponent = getComponent(['body', 'row'], 'div'); | ||
var cellComponent = getComponent(['body', 'cell'], 'div'); | ||
var bodyContent; | ||
@@ -226,2 +232,3 @@ if (flattenData.length) { | ||
}, | ||
component: wrapperComponent, | ||
scrollWidth: scrollX, | ||
@@ -244,6 +251,6 @@ onVirtualScroll: function onVirtualScroll(_ref4) { | ||
} else { | ||
bodyContent = /*#__PURE__*/React.createElement("div", { | ||
bodyContent = /*#__PURE__*/React.createElement(RowComponent, { | ||
className: classNames("".concat(prefixCls, "-placeholder")) | ||
}, /*#__PURE__*/React.createElement(Cell, { | ||
component: "div", | ||
component: cellComponent, | ||
prefixCls: prefixCls | ||
@@ -250,0 +257,0 @@ }, emptyNode)); |
@@ -13,2 +13,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import VirtualCell from "./VirtualCell"; | ||
import { StaticContext } from "./context"; | ||
var BodyLine = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
@@ -32,3 +33,7 @@ var data = props.data, | ||
componentWidth = _useContext.componentWidth; | ||
var _useContext2 = useContext(StaticContext, ['getComponent']), | ||
getComponent = _useContext2.getComponent; | ||
var rowInfo = useRowInfo(record, rowKey, index, indent); | ||
var RowComponent = getComponent(['body', 'row'], 'div'); | ||
var cellComponent = getComponent(['body', 'cell'], 'div'); | ||
@@ -52,6 +57,6 @@ // ========================== Expand ========================== | ||
var rowCellCls = "".concat(prefixCls, "-expanded-row-cell"); | ||
expandRowNode = /*#__PURE__*/React.createElement("div", { | ||
expandRowNode = /*#__PURE__*/React.createElement(RowComponent, { | ||
className: classNames("".concat(prefixCls, "-expanded-row"), "".concat(prefixCls, "-expanded-row-level-").concat(indent + 1), computedExpandedRowClassName) | ||
}, /*#__PURE__*/React.createElement(Cell, { | ||
component: "div", | ||
component: cellComponent, | ||
prefixCls: prefixCls, | ||
@@ -64,3 +69,2 @@ className: classNames(rowCellCls, _defineProperty({}, "".concat(rowCellCls, "-fixed"), fixColumn)), | ||
// ========================== Render ========================== | ||
var rowStyle = _objectSpread(_objectSpread({}, style), {}, { | ||
@@ -73,3 +77,3 @@ width: scrollX | ||
} | ||
var rowNode = /*#__PURE__*/React.createElement("div", _extends({}, rowProps, restProps, { | ||
var rowNode = /*#__PURE__*/React.createElement(RowComponent, _extends({}, rowProps, restProps, { | ||
ref: rowSupportExpand ? null : ref, | ||
@@ -81,2 +85,3 @@ className: classNames(className, "".concat(prefixCls, "-row"), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className, _defineProperty({}, "".concat(prefixCls, "-row-extra"), extra)), | ||
key: colIndex, | ||
component: cellComponent, | ||
rowInfo: rowInfo, | ||
@@ -83,0 +88,0 @@ column: column, |
@@ -1,2 +0,2 @@ | ||
import type { TableSticky } from '../interface'; | ||
import type { GetComponent, TableSticky } from '../interface'; | ||
export interface StaticContextProps { | ||
@@ -6,2 +6,3 @@ scrollY: number; | ||
sticky: boolean | TableSticky; | ||
getComponent: GetComponent; | ||
} | ||
@@ -8,0 +9,0 @@ export declare const StaticContext: import("@rc-component/context").SelectorContext<StaticContextProps>; |
@@ -12,5 +12,3 @@ import type { CompareProps } from '@rc-component/context/lib/Immutable'; | ||
} | ||
export type ForwardGenericVirtualTable = (<RecordType>(props: TableProps<RecordType> & { | ||
ref?: React.Ref<Reference>; | ||
}) => React.ReactElement) & { | ||
export type ForwardGenericVirtualTable = (<RecordType>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & { | ||
displayName?: string; | ||
@@ -17,0 +15,0 @@ }; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import classNames from 'classnames'; | ||
import { warning } from 'rc-util'; | ||
import { useEvent, warning } from 'rc-util'; | ||
import * as React from 'react'; | ||
@@ -11,2 +11,3 @@ import { INTERNAL_HOOKS } from "../constant"; | ||
import { StaticContext } from "./context"; | ||
import getValue from "rc-util/es/utils/get"; | ||
var renderBody = function renderBody(rawData, props) { | ||
@@ -49,2 +50,5 @@ var ref = props.ref, | ||
} | ||
var getComponent = useEvent(function (path, defaultComponent) { | ||
return getValue(components, path) || defaultComponent; | ||
}); | ||
@@ -56,5 +60,6 @@ // ========================= Context ========================== | ||
scrollY: scrollY, | ||
listItemHeight: listItemHeight | ||
listItemHeight: listItemHeight, | ||
getComponent: getComponent | ||
}; | ||
}, [sticky, scrollY, listItemHeight]); | ||
}, [sticky, scrollY, listItemHeight, getComponent]); | ||
@@ -61,0 +66,0 @@ // ========================== Render ========================== |
import * as React from 'react'; | ||
import type useRowInfo from '../hooks/useRowInfo'; | ||
import type { ColumnType } from '../interface'; | ||
import type { ColumnType, CustomizeComponent } from '../interface'; | ||
export interface VirtualCellProps<RecordType> { | ||
@@ -10,2 +10,3 @@ rowInfo: ReturnType<typeof useRowInfo>; | ||
index: number; | ||
component?: CustomizeComponent; | ||
/** Used for `column.render` */ | ||
@@ -12,0 +13,0 @@ renderIndex: number; |
@@ -23,2 +23,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
index = props.index, | ||
component = props.component, | ||
renderIndex = props.renderIndex, | ||
@@ -95,3 +96,3 @@ record = props.record, | ||
scope: column.rowScope, | ||
component: "div", | ||
component: component, | ||
prefixCls: rowInfo.prefixCls, | ||
@@ -98,0 +99,0 @@ key: key, |
@@ -152,3 +152,5 @@ "use strict"; | ||
} | ||
BodyRow.displayName = 'BodyRow'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
BodyRow.displayName = 'BodyRow'; | ||
} | ||
var _default = exports.default = (0, _TableContext.responseImmutable)(BodyRow); |
@@ -90,3 +90,5 @@ "use strict"; | ||
} | ||
Body.displayName = 'Body'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
Body.displayName = 'Body'; | ||
} | ||
var _default = exports.default = (0, _TableContext.responseImmutable)(Body); |
@@ -133,3 +133,3 @@ "use strict"; | ||
// >>>>> ClassName | ||
var mergedClassName = (0, _classnames.default)(cellPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-left"), isFixLeft && supportSticky), "".concat(cellPrefixCls, "-fix-left-first"), firstFixLeft && supportSticky), "".concat(cellPrefixCls, "-fix-left-last"), lastFixLeft && supportSticky), "".concat(cellPrefixCls, "-fix-left-all"), lastFixLeft && allColumnsFixedLeft && supportSticky), "".concat(cellPrefixCls, "-fix-right"), isFixRight && supportSticky), "".concat(cellPrefixCls, "-fix-right-first"), firstFixRight && supportSticky), "".concat(cellPrefixCls, "-fix-right-last"), lastFixRight && supportSticky), "".concat(cellPrefixCls, "-ellipsis"), ellipsis), "".concat(cellPrefixCls, "-with-append"), appendNode), "".concat(cellPrefixCls, "-fix-sticky"), (isFixLeft || isFixRight) && isSticky && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-row-hover"), !legacyCellProps && hovering)), additionalProps.className, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.className); | ||
var mergedClassName = (0, _classnames.default)(cellPrefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-left"), isFixLeft && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-left-first"), firstFixLeft && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-left-last"), lastFixLeft && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-left-all"), lastFixLeft && allColumnsFixedLeft && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-right"), isFixRight && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-right-first"), firstFixRight && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-right-last"), lastFixRight && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-ellipsis"), ellipsis), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-with-append"), appendNode), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-fix-sticky"), (isFixLeft || isFixRight) && isSticky && supportSticky), (0, _defineProperty2.default)(_classNames, "".concat(cellPrefixCls, "-row-hover"), !legacyCellProps && hovering), _classNames), additionalProps.className, legacyCellProps === null || legacyCellProps === void 0 ? void 0 : legacyCellProps.className); | ||
@@ -136,0 +136,0 @@ // >>>>> Style |
@@ -155,3 +155,5 @@ "use strict"; | ||
}); | ||
FixedHolder.displayName = 'FixedHolder'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
FixedHolder.displayName = 'FixedHolder'; | ||
} | ||
@@ -158,0 +160,0 @@ /** Return a table in div as fixed element which contains sticky info */ |
@@ -59,3 +59,5 @@ "use strict"; | ||
} | ||
HeaderRow.displayName = 'HeaderRow'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
HeaderRow.displayName = 'HeaderRow'; | ||
} | ||
var _default = exports.default = HeaderRow; |
@@ -149,2 +149,3 @@ "use strict"; | ||
if (expandable) { | ||
var _expandColumn; | ||
var cloneColumns = baseColumns.slice(); | ||
@@ -188,6 +189,6 @@ | ||
// >>> Create expandable column | ||
var expandColumn = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _legacyUtil.INTERNAL_COL_DEFINE, { | ||
var expandColumn = (_expandColumn = {}, (0, _defineProperty2.default)(_expandColumn, _legacyUtil.INTERNAL_COL_DEFINE, { | ||
className: "".concat(prefixCls, "-expand-icon-col"), | ||
columnType: 'EXPAND_COLUMN' | ||
}), "title", columnTitle), "fixed", fixedColumn), "className", "".concat(prefixCls, "-row-expand-icon-cell")), "width", columnWidth), "render", function render(_, record, index) { | ||
}), (0, _defineProperty2.default)(_expandColumn, "title", columnTitle), (0, _defineProperty2.default)(_expandColumn, "fixed", fixedColumn), (0, _defineProperty2.default)(_expandColumn, "className", "".concat(prefixCls, "-row-expand-icon-cell")), (0, _defineProperty2.default)(_expandColumn, "width", columnWidth), (0, _defineProperty2.default)(_expandColumn, "render", function render(_, record, index) { | ||
var rowKey = getRowKey(record, index); | ||
@@ -211,3 +212,3 @@ var expanded = expandedKeys.has(rowKey); | ||
return icon; | ||
}); | ||
}), _expandColumn); | ||
return cloneColumns.map(function (col) { | ||
@@ -214,0 +215,0 @@ return col === _constant.EXPAND_COLUMN ? expandColumn : col; |
@@ -46,2 +46,4 @@ "use strict"; | ||
}); | ||
RenderBlock.displayName = 'RenderBlock'; | ||
if (process.env.NODE_ENV !== 'production') { | ||
RenderBlock.displayName = 'RenderBlock'; | ||
} |
@@ -11,4 +11,3 @@ "use strict"; | ||
* So HOC will not work on this. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function Column(_) { | ||
@@ -15,0 +14,0 @@ return null; |
@@ -11,4 +11,3 @@ "use strict"; | ||
* So HOC will not work on this. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
*/ // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function ColumnGroup(_) { | ||
@@ -15,0 +14,0 @@ return null; |
@@ -96,5 +96,3 @@ /** | ||
declare function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<RecordType>, ref: React.Ref<Reference>): React.JSX.Element; | ||
export type ForwardGenericTable = (<RecordType extends DefaultRecordType = any>(props: TableProps<RecordType> & { | ||
ref?: React.Ref<Reference>; | ||
}) => React.ReactElement) & { | ||
export type ForwardGenericTable = (<RecordType extends DefaultRecordType = any>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & { | ||
displayName?: string; | ||
@@ -101,0 +99,0 @@ }; |
@@ -83,2 +83,3 @@ "use strict"; | ||
function Table(tableProps, ref) { | ||
var _classNames; | ||
var props = (0, _objectSpread2.default)({ | ||
@@ -585,3 +586,3 @@ rowKey: 'key', | ||
var fullTable = /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ | ||
className: (0, _classnames.default)(prefixCls, className, (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-rtl"), direction === 'rtl'), "".concat(prefixCls, "-ping-left"), pingedLeft), "".concat(prefixCls, "-ping-right"), pingedRight), "".concat(prefixCls, "-layout-fixed"), tableLayout === 'fixed'), "".concat(prefixCls, "-fixed-header"), fixHeader), "".concat(prefixCls, "-fixed-column"), fixColumn), "".concat(prefixCls, "-scroll-horizontal"), horizonScroll), "".concat(prefixCls, "-has-fix-left"), flattenColumns[0] && flattenColumns[0].fixed), "".concat(prefixCls, "-has-fix-right"), flattenColumns[flattenColumns.length - 1] && flattenColumns[flattenColumns.length - 1].fixed === 'right')), | ||
className: (0, _classnames.default)(prefixCls, className, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-ping-left"), pingedLeft), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-ping-right"), pingedRight), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-layout-fixed"), tableLayout === 'fixed'), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-fixed-header"), fixHeader), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-fixed-column"), fixColumn), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-scroll-horizontal"), horizonScroll), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-has-fix-left"), flattenColumns[0] && flattenColumns[0].fixed), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-has-fix-right"), flattenColumns[flattenColumns.length - 1] && flattenColumns[flattenColumns.length - 1].fixed === 'right'), _classNames)), | ||
style: style, | ||
@@ -588,0 +589,0 @@ id: id, |
@@ -16,2 +16,3 @@ "use strict"; | ||
function renderExpandIcon(_ref) { | ||
var _classNames; | ||
var prefixCls = _ref.prefixCls, | ||
@@ -33,3 +34,3 @@ record = _ref.record, | ||
return /*#__PURE__*/React.createElement("span", { | ||
className: (0, _classnames.default)(expandClassName, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(prefixCls, "-row-expanded"), expanded), "".concat(prefixCls, "-row-collapsed"), !expanded)), | ||
className: (0, _classnames.default)(expandClassName, (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-row-expanded"), expanded), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-row-collapsed"), !expanded), _classNames)), | ||
onClick: onClick | ||
@@ -36,0 +37,0 @@ }); |
@@ -38,3 +38,4 @@ "use strict"; | ||
scrollY = _useContext2.scrollY, | ||
listItemHeight = _useContext2.listItemHeight; | ||
listItemHeight = _useContext2.listItemHeight, | ||
getComponent = _useContext2.getComponent; | ||
@@ -211,2 +212,7 @@ // =========================== Ref ============================ | ||
var tblPrefixCls = "".concat(prefixCls, "-tbody"); | ||
// default 'div' in rc-virtual-list | ||
var wrapperComponent = getComponent(['body', 'wrapper']); | ||
var RowComponent = getComponent(['body', 'row'], 'div'); | ||
var cellComponent = getComponent(['body', 'cell'], 'div'); | ||
var bodyContent; | ||
@@ -236,2 +242,3 @@ if (flattenData.length) { | ||
}, | ||
component: wrapperComponent, | ||
scrollWidth: scrollX, | ||
@@ -254,6 +261,6 @@ onVirtualScroll: function onVirtualScroll(_ref4) { | ||
} else { | ||
bodyContent = /*#__PURE__*/React.createElement("div", { | ||
bodyContent = /*#__PURE__*/React.createElement(RowComponent, { | ||
className: (0, _classnames.default)("".concat(prefixCls, "-placeholder")) | ||
}, /*#__PURE__*/React.createElement(_Cell.default, { | ||
component: "div", | ||
component: cellComponent, | ||
prefixCls: prefixCls | ||
@@ -260,0 +267,0 @@ }, emptyNode)); |
@@ -20,2 +20,3 @@ "use strict"; | ||
var _VirtualCell = _interopRequireDefault(require("./VirtualCell")); | ||
var _context2 = require("./context"); | ||
var _excluded = ["data", "index", "className", "rowKey", "style", "extra", "getHeight"]; | ||
@@ -42,3 +43,7 @@ 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); } | ||
componentWidth = _useContext.componentWidth; | ||
var _useContext2 = (0, _context.useContext)(_context2.StaticContext, ['getComponent']), | ||
getComponent = _useContext2.getComponent; | ||
var rowInfo = (0, _useRowInfo.default)(record, rowKey, index, indent); | ||
var RowComponent = getComponent(['body', 'row'], 'div'); | ||
var cellComponent = getComponent(['body', 'cell'], 'div'); | ||
@@ -62,6 +67,6 @@ // ========================== Expand ========================== | ||
var rowCellCls = "".concat(prefixCls, "-expanded-row-cell"); | ||
expandRowNode = /*#__PURE__*/React.createElement("div", { | ||
expandRowNode = /*#__PURE__*/React.createElement(RowComponent, { | ||
className: (0, _classnames.default)("".concat(prefixCls, "-expanded-row"), "".concat(prefixCls, "-expanded-row-level-").concat(indent + 1), computedExpandedRowClassName) | ||
}, /*#__PURE__*/React.createElement(_Cell.default, { | ||
component: "div", | ||
component: cellComponent, | ||
prefixCls: prefixCls, | ||
@@ -74,3 +79,2 @@ className: (0, _classnames.default)(rowCellCls, (0, _defineProperty2.default)({}, "".concat(rowCellCls, "-fixed"), fixColumn)), | ||
// ========================== Render ========================== | ||
var rowStyle = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, style), {}, { | ||
@@ -83,3 +87,3 @@ width: scrollX | ||
} | ||
var rowNode = /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, rowProps, restProps, { | ||
var rowNode = /*#__PURE__*/React.createElement(RowComponent, (0, _extends2.default)({}, rowProps, restProps, { | ||
ref: rowSupportExpand ? null : ref, | ||
@@ -91,2 +95,3 @@ 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)), | ||
key: colIndex, | ||
component: cellComponent, | ||
rowInfo: rowInfo, | ||
@@ -93,0 +98,0 @@ column: column, |
@@ -1,2 +0,2 @@ | ||
import type { TableSticky } from '../interface'; | ||
import type { GetComponent, TableSticky } from '../interface'; | ||
export interface StaticContextProps { | ||
@@ -6,2 +6,3 @@ scrollY: number; | ||
sticky: boolean | TableSticky; | ||
getComponent: GetComponent; | ||
} | ||
@@ -8,0 +9,0 @@ export declare const StaticContext: import("@rc-component/context").SelectorContext<StaticContextProps>; |
@@ -12,5 +12,3 @@ import type { CompareProps } from '@rc-component/context/lib/Immutable'; | ||
} | ||
export type ForwardGenericVirtualTable = (<RecordType>(props: TableProps<RecordType> & { | ||
ref?: React.Ref<Reference>; | ||
}) => React.ReactElement) & { | ||
export type ForwardGenericVirtualTable = (<RecordType>(props: TableProps<RecordType> & React.RefAttributes<Reference>) => React.ReactElement) & { | ||
displayName?: string; | ||
@@ -17,0 +15,0 @@ }; |
@@ -20,2 +20,3 @@ "use strict"; | ||
var _context = require("./context"); | ||
var _get = _interopRequireDefault(require("rc-util/lib/utils/get")); | ||
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); } | ||
@@ -60,2 +61,5 @@ 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 getComponent = (0, _rcUtil.useEvent)(function (path, defaultComponent) { | ||
return (0, _get.default)(components, path) || defaultComponent; | ||
}); | ||
@@ -67,5 +71,6 @@ // ========================= Context ========================== | ||
scrollY: scrollY, | ||
listItemHeight: listItemHeight | ||
listItemHeight: listItemHeight, | ||
getComponent: getComponent | ||
}; | ||
}, [sticky, scrollY, listItemHeight]); | ||
}, [sticky, scrollY, listItemHeight, getComponent]); | ||
@@ -72,0 +77,0 @@ // ========================== Render ========================== |
import * as React from 'react'; | ||
import type useRowInfo from '../hooks/useRowInfo'; | ||
import type { ColumnType } from '../interface'; | ||
import type { ColumnType, CustomizeComponent } from '../interface'; | ||
export interface VirtualCellProps<RecordType> { | ||
@@ -10,2 +10,3 @@ rowInfo: ReturnType<typeof useRowInfo>; | ||
index: number; | ||
component?: CustomizeComponent; | ||
/** Used for `column.render` */ | ||
@@ -12,0 +13,0 @@ renderIndex: number; |
@@ -34,2 +34,3 @@ "use strict"; | ||
index = props.index, | ||
component = props.component, | ||
renderIndex = props.renderIndex, | ||
@@ -106,3 +107,3 @@ record = props.record, | ||
scope: column.rowScope, | ||
component: "div", | ||
component: component, | ||
prefixCls: rowInfo.prefixCls, | ||
@@ -109,0 +110,0 @@ key: key, |
{ | ||
"name": "rc-table", | ||
"version": "7.37.0", | ||
"version": "7.38.0", | ||
"description": "table ui component for react", | ||
@@ -83,3 +83,3 @@ "engines": { | ||
"eslint-plugin-jest": "^27.6.0", | ||
"eslint-plugin-unicorn": "^49.0.0", | ||
"eslint-plugin-unicorn": "^50.0.1", | ||
"father": "^4.0.0", | ||
@@ -86,0 +86,0 @@ "gh-pages": "^6.1.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
394043
8731
60