Comparing version 11.0.3 to 11.1.0
@@ -25,3 +25,3 @@ "use strict"; | ||
var DataRow = function (props) { | ||
var dispatch = props.dispatch, groupColumnsCount = props.groupColumnsCount, isSelectedRow = props.isSelectedRow, rowKeyValue = props.rowKeyValue, rowReordering = props.rowReordering, trRef = props.trRef, childComponents = props.childComponents; | ||
var dispatch = props.dispatch, groupColumnsCount = props.groupColumnsCount, isSelectedRow = props.isSelectedRow, rowKeyValue = props.rowKeyValue, rowReordering = props.rowReordering, trRef = props.trRef, childComponents = props.childComponents, isOdd = props.isOdd; | ||
var dataRow = childComponents.dataRow; | ||
@@ -40,3 +40,3 @@ if (rowReordering) { | ||
var _a = (0, ComponentUtils_1.getElementCustomization)({ | ||
className: "".concat(defaultOptions_1.default.css.row, " ").concat(isSelectedRow ? defaultOptions_1.default.css.rowSelected : '') | ||
className: "".concat(defaultOptions_1.default.css.row, " ").concat(isSelectedRow ? defaultOptions_1.default.css.rowSelected : '').concat(isOdd === undefined ? '' : isOdd ? ' ka-odd' : ' ka-even') | ||
}, props, dataRow), elementAttributes = _a.elementAttributes, content = _a.content; | ||
@@ -43,0 +43,0 @@ return (react_1.default.createElement("tr", __assign({ ref: trRef }, elementAttributes), content |
@@ -6,4 +6,5 @@ import React, { RefObject } from 'react'; | ||
treeGroupsExpanded?: any[]; | ||
isFirstRowOdd?: boolean; | ||
} | ||
declare const Rows: React.FunctionComponent<IRowsProps>; | ||
export default Rows; |
@@ -41,2 +41,3 @@ "use strict"; | ||
var react_1 = __importStar(require("react")); | ||
var DataUtils_1 = require("../../Utils/DataUtils"); | ||
var GroupUtils_1 = require("../../Utils/GroupUtils"); | ||
@@ -48,5 +49,4 @@ var TreeUtils_1 = require("../../Utils/TreeUtils"); | ||
var FilterUtils_1 = require("../../Utils/FilterUtils"); | ||
var DataUtils_1 = require("../../Utils/DataUtils"); | ||
var Rows = function (props) { | ||
var childComponents = props.childComponents, columns = props.columns, data = props.data, _a = props.detailsRows, detailsRows = _a === void 0 ? [] : _a, dispatch = props.dispatch, editableCells = props.editableCells, format = props.format, groupedColumns = props.groupedColumns, _b = props.groups, groups = _b === void 0 ? [] : _b, _c = props.groupsExpanded, groupsExpanded = _c === void 0 ? [] : _c, onFirstRowRendered = props.onFirstRowRendered, treeGroupsExpanded = props.treeGroupsExpanded, rowKeyField = props.rowKeyField, rowReordering = props.rowReordering, selectedRows = props.selectedRows, validation = props.validation, treeExpandButtonColumnKey = props.treeExpandButtonColumnKey; | ||
var childComponents = props.childComponents, columns = props.columns, data = props.data, _a = props.detailsRows, detailsRows = _a === void 0 ? [] : _a, dispatch = props.dispatch, editableCells = props.editableCells, format = props.format, groupedColumns = props.groupedColumns, _b = props.groups, groups = _b === void 0 ? [] : _b, _c = props.groupsExpanded, groupsExpanded = _c === void 0 ? [] : _c, isFirstRowOdd = props.isFirstRowOdd, onFirstRowRendered = props.onFirstRowRendered, treeGroupsExpanded = props.treeGroupsExpanded, rowKeyField = props.rowKeyField, rowReordering = props.rowReordering, selectedRows = props.selectedRows, validation = props.validation, treeExpandButtonColumnKey = props.treeExpandButtonColumnKey, oddEvenRows = props.oddEvenRows; | ||
var groupMark = (0, GroupUtils_1.getGroupMark)(); | ||
@@ -78,3 +78,6 @@ var firstRowRef = (0, react_1.useRef)(null); | ||
var rowEditableCells = (0, FilterUtils_1.getRowEditableCells)(rowKeyValue_1, editableCells); | ||
var dataRow = (react_1.default.createElement(DataAndDetailsRows_1.default, { childComponents: props.childComponents, columns: props.columns, dispatch: dispatch, editableCells: props.editableCells, editingMode: props.editingMode, isTreeGroup: isTreeGroup, isTreeExpanded: isTreeExpanded, treeDeep: isTreeRow === true ? d.treeDeep : undefined, treeExpandButtonColumnKey: treeExpandButtonColumnKey, format: format, groupColumnsCount: props.groupColumnsCount, isDetailsRowShown: isDetailsRowShown, isSelectedRow: isSelectedRow, key: rowKeyValue_1, rowData: rowData, rowEditableCells: rowEditableCells, rowKeyField: props.rowKeyField, rowKeyValue: rowKeyValue_1, rowReordering: rowReordering, selectedRows: props.selectedRows, trRef: rowRefLink, validation: validation })); | ||
var isOdd = oddEvenRows | ||
? isFirstRowOdd ? (0, DataUtils_1.checkRowOdd)(data, rowData) : !(0, DataUtils_1.checkRowOdd)(data, rowData) | ||
: undefined; | ||
var dataRow = (react_1.default.createElement(DataAndDetailsRows_1.default, { isOdd: isOdd, childComponents: props.childComponents, columns: props.columns, dispatch: dispatch, editableCells: props.editableCells, editingMode: props.editingMode, isTreeGroup: isTreeGroup, isTreeExpanded: isTreeExpanded, treeDeep: isTreeRow === true ? d.treeDeep : undefined, treeExpandButtonColumnKey: treeExpandButtonColumnKey, format: format, groupColumnsCount: props.groupColumnsCount, isDetailsRowShown: isDetailsRowShown, isSelectedRow: isSelectedRow, key: rowKeyValue_1, rowData: rowData, rowEditableCells: rowEditableCells, rowKeyField: props.rowKeyField, rowKeyValue: rowKeyValue_1, rowReordering: rowReordering, selectedRows: props.selectedRows, trRef: rowRefLink, validation: validation })); | ||
rowRefLink = undefined; | ||
@@ -81,0 +84,0 @@ return dataRow; |
@@ -26,3 +26,3 @@ import * as React from 'react'; | ||
columns: Column<TData>[]; | ||
groupedColumns?: GroupedColumn[]; | ||
controlledPropsKeys?: ControlledPropsKeys; | ||
data?: TData[]; | ||
@@ -38,12 +38,12 @@ detailsRows?: any[]; | ||
format?: FormatFunc<TData>; | ||
groupedColumns?: GroupedColumn[]; | ||
groupPanel?: GroupPanelSettings; | ||
groups?: Group[]; | ||
groupsExpanded?: any[][]; | ||
groupPanel?: GroupPanelSettings; | ||
height?: number | string; | ||
loading?: ILoadingProps; | ||
noData?: NoData; | ||
oddEvenRows?: boolean; | ||
paging?: PagingOptions; | ||
rowKeyField: string; | ||
treeGroupKeyField?: string; | ||
treeGroupsExpanded?: any[]; | ||
treeExpandButtonColumnKey?: string; | ||
rowReordering?: boolean; | ||
@@ -55,8 +55,9 @@ search?: SearchFunc<TData>; | ||
sort?: SortFunc; | ||
noData?: NoData; | ||
sortingMode?: SortingMode; | ||
treeExpandButtonColumnKey?: string; | ||
treeGroupKeyField?: string; | ||
treeGroupsExpanded?: any[]; | ||
validation?: ValidationFunc<TData>; | ||
virtualScrolling?: VirtualScrolling; | ||
width?: number | string; | ||
controlledPropsKeys?: ControlledPropsKeys; | ||
} | ||
@@ -63,0 +64,0 @@ export interface ITableEvents { |
@@ -25,3 +25,3 @@ "use strict"; | ||
var _a; | ||
var data = props.data, dispatch = props.dispatch, virtualScrolling = props.virtualScrolling, editableCells = props.editableCells; | ||
var data = props.data, dispatch = props.dispatch, virtualScrolling = props.virtualScrolling, editableCells = props.editableCells, oddEvenRows = props.oddEvenRows; | ||
var onFirstRowRendered = function (firstRowRef) { | ||
@@ -43,6 +43,8 @@ if (firstRowRef | ||
var virtualized; | ||
var isFirstVisibleRowOdd; | ||
if (virtualScrolling) { | ||
var isNewRowShown = !!((_a = (0, CellUtils_1.getNewRowEditableCells)(editableCells)) === null || _a === void 0 ? void 0 : _a.length); | ||
virtualized = (0, Virtualize_1.getVirtualized)(virtualScrolling, virtualizedData, isNewRowShown); | ||
virtualized = (0, Virtualize_1.getVirtualized)(virtualScrolling, virtualizedData, isNewRowShown, oddEvenRows); | ||
virtualizedData = virtualized.virtualizedData; | ||
isFirstVisibleRowOdd = virtualized.isFirstVisibleRowOdd; | ||
} | ||
@@ -52,3 +54,3 @@ return (react_1.default.createElement(react_1.default.Fragment, null, | ||
react_1.default.createElement("td", { style: { height: virtualized.beginHeight } })), | ||
react_1.default.createElement(Rows_1.default, __assign({}, props, { data: virtualizedData, onFirstRowRendered: onFirstRowRendered })), | ||
react_1.default.createElement(Rows_1.default, __assign({}, props, { data: virtualizedData, onFirstRowRendered: onFirstRowRendered, isFirstRowOdd: isFirstVisibleRowOdd })), | ||
virtualized && virtualized.endHeight !== 0 && (react_1.default.createElement("tr", { style: { height: virtualized.endHeight } }, | ||
@@ -55,0 +57,0 @@ react_1.default.createElement("td", { style: { height: virtualized.endHeight } }))))); |
{ | ||
"name": "ka-table", | ||
"version": "11.0.3", | ||
"version": "11.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "github:komarovalexander/ka-table", |
@@ -182,2 +182,3 @@ import { ChildComponents, Column, EditableCell, Group, VirtualScrolling } from './models'; | ||
groupsExpanded?: any[][]; | ||
oddEvenRows?: boolean; | ||
rowKeyField: string; | ||
@@ -211,2 +212,3 @@ rowReordering: boolean; | ||
export interface IRowProps extends IRowCommonProps { | ||
isOdd?: boolean; | ||
format?: FormatFunc; | ||
@@ -213,0 +215,0 @@ groupColumnsCount: number; |
@@ -11,1 +11,2 @@ import { Column } from '../Models/Column'; | ||
export declare const reorderData: (data: any[], getKey: (d: any) => any, keyValue: any, targetKeyValue: any) => any[]; | ||
export declare const checkRowOdd: (data: any[], rowData: any) => boolean; |
@@ -23,3 +23,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.reorderData = exports.insertBefore = exports.reorderDataByIndex = exports.replaceValue = exports.getValueByField = exports.getValueByColumn = exports.createObjByFields = exports.getParentValue = void 0; | ||
exports.checkRowOdd = exports.reorderData = exports.insertBefore = exports.reorderDataByIndex = exports.replaceValue = exports.getValueByField = exports.getValueByColumn = exports.createObjByFields = exports.getParentValue = void 0; | ||
var ColumnUtils_1 = require("./ColumnUtils"); | ||
@@ -111,1 +111,5 @@ var getParentValue = function (rowData, fieldParents) { | ||
exports.reorderData = reorderData; | ||
var checkRowOdd = function (data, rowData) { | ||
return (data === null || data === void 0 ? void 0 : data.indexOf(rowData)) % 2 !== 0; | ||
}; | ||
exports.checkRowOdd = checkRowOdd; |
@@ -21,3 +21,3 @@ import { ITableProps } from '../'; | ||
columns: Column<any>[]; | ||
groupedColumns?: import("../Models/GroupedColumn").GroupedColumn[]; | ||
controlledPropsKeys?: import("../types").ControlledPropsKeys; | ||
data?: any[]; | ||
@@ -32,12 +32,12 @@ detailsRows?: any[]; | ||
format?: import("../types").FormatFunc<any>; | ||
groupedColumns?: import("../Models/GroupedColumn").GroupedColumn[]; | ||
groupPanel?: import("../Models/GroupPanelSettings").GroupPanelSettings; | ||
groups?: import("../models").Group[]; | ||
groupsExpanded?: any[][]; | ||
groupPanel?: import("../Models/GroupPanelSettings").GroupPanelSettings; | ||
height?: string | number; | ||
loading?: import("../props").ILoadingProps; | ||
noData?: import("../types").NoData; | ||
oddEvenRows?: boolean; | ||
paging?: import("../models").PagingOptions; | ||
rowKeyField: string; | ||
treeGroupKeyField?: string; | ||
treeGroupsExpanded?: any[]; | ||
treeExpandButtonColumnKey?: string; | ||
rowReordering?: boolean; | ||
@@ -49,8 +49,9 @@ search?: import("../types").SearchFunc<any>; | ||
sort?: import("../types").SortFunc; | ||
noData?: import("../types").NoData; | ||
sortingMode?: import("../enums").SortingMode; | ||
treeExpandButtonColumnKey?: string; | ||
treeGroupKeyField?: string; | ||
treeGroupsExpanded?: any[]; | ||
validation?: ValidationFunc<any>; | ||
virtualScrolling?: import("../models").VirtualScrolling; | ||
width?: string | number; | ||
controlledPropsKeys?: import("../types").ControlledPropsKeys; | ||
}; |
import { VirtualScrolling } from '../Models/VirtualScrolling'; | ||
export declare const isVirtualScrollingEnabled: (virtualScrolling?: VirtualScrolling) => boolean; | ||
export declare const getVirtualized: (virtualScrolling: VirtualScrolling, data: any[], isNewRowShown?: boolean) => { | ||
export declare const getVirtualized: (virtualScrolling: VirtualScrolling, data: any[], isNewRowShown?: boolean, oddEvenRows?: boolean) => { | ||
beginHeight: number; | ||
endHeight: number; | ||
virtualizedData: any[]; | ||
isFirstVisibleRowOdd: boolean; | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVirtualized = exports.isVirtualScrollingEnabled = void 0; | ||
var DataUtils_1 = require("./DataUtils"); | ||
var isVirtualScrollingEnabled = function (virtualScrolling) { | ||
@@ -8,3 +9,3 @@ return virtualScrolling && virtualScrolling.enabled !== false; | ||
exports.isVirtualScrollingEnabled = isVirtualScrollingEnabled; | ||
var getVirtualized = function (virtualScrolling, data, isNewRowShown) { | ||
var getVirtualized = function (virtualScrolling, data, isNewRowShown, oddEvenRows) { | ||
var virtualizedData = []; | ||
@@ -43,4 +44,7 @@ var _a = virtualScrolling.scrollTop, scrollTop = _a === void 0 ? 0 : _a, _b = virtualScrolling.bottomInvisibleCount, bottomInvisibleCount = _b === void 0 ? 5 : _b, _c = virtualScrolling.topInvisibleCount, topInvisibleCount = _c === void 0 ? 0 : _c; | ||
virtualizedData: virtualizedData, | ||
isFirstVisibleRowOdd: oddEvenRows | ||
? (0, DataUtils_1.checkRowOdd)(data, virtualizedData[0]) | ||
: undefined | ||
}; | ||
}; | ||
exports.getVirtualized = getVirtualized; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
396785
8126