Comparing version 3.2.2 to 3.3.1
@@ -72,2 +72,6 @@ import { ActionType } from './enums'; | ||
type: ActionType.HideLoading, | ||
}); }; | ||
export var updatePageIndex = function (pageIndex) { return ({ | ||
pageIndex: pageIndex, | ||
type: ActionType.UpdatePageIndex, | ||
}); }; |
@@ -88,2 +88,6 @@ import { ActionType } from './enums'; | ||
type: ActionType.HideLoading, | ||
}); | ||
export const updatePageIndex = (pageIndex: number) => ({ | ||
pageIndex, | ||
type: ActionType.UpdatePageIndex, | ||
}); |
@@ -21,5 +21,6 @@ var __assign = (this && this.__assign) || function () { | ||
import Loading from '../Loading/Loading'; | ||
import Paging from '../Paging/Paging'; | ||
import TableBody from '../TableBody/TableBody'; | ||
export var Table = function (props) { | ||
var _a = props.childAttributes, childAttributes = _a === void 0 ? {} : _a, _b = props.data, data = _b === void 0 ? [] : _b, _c = props.editableCells, editableCells = _c === void 0 ? [] : _c, _d = props.editingMode, editingMode = _d === void 0 ? EditingMode.None : _d, filteringMode = props.filteringMode, groups = props.groups, loading = props.loading, _e = props.selectedRows, selectedRows = _e === void 0 ? [] : _e, _f = props.sortingMode, sortingMode = _f === void 0 ? SortingMode.None : _f; | ||
var _a = props.childAttributes, childAttributes = _a === void 0 ? {} : _a, _b = props.data, data = _b === void 0 ? [] : _b, _c = props.editableCells, editableCells = _c === void 0 ? [] : _c, _d = props.editingMode, editingMode = _d === void 0 ? EditingMode.None : _d, filteringMode = props.filteringMode, groups = props.groups, loading = props.loading, paging = props.paging, _e = props.selectedRows, selectedRows = _e === void 0 ? [] : _e, _f = props.sortingMode, sortingMode = _f === void 0 ? SortingMode.None : _f; | ||
var groupsExpanded = props.groupsExpanded; | ||
@@ -46,3 +47,4 @@ var preparedOptions = prepareTableOptions(props); | ||
React.createElement(TableBody, __assign({}, props, { childAttributes: childAttributes, columns: preparedOptions.columns, data: preparedOptions.groupedData, dispatch: dispatch, editableCells: editableCells, editingMode: editingMode, groupColumnsCount: preparedOptions.groupColumnsCount, groupedColumns: preparedOptions.groupedColumns, groupsExpanded: groupsExpanded, selectedRows: selectedRows }))), | ||
React.createElement(Paging, __assign({}, paging, { dispatch: dispatch, pagesCount: preparedOptions.pagesCount })), | ||
React.createElement(Loading, __assign({}, loading)))); | ||
}; |
@@ -28,2 +28,3 @@ export var DataType; | ||
ActionType["ShowLoading"] = "ShowLoading"; | ||
ActionType["UpdatePageIndex"] = "UpdatePageIndex"; | ||
ActionType["UpdateCellValue"] = "UpdateCellValue"; | ||
@@ -30,0 +31,0 @@ ActionType["UpdateData"] = "UpdateData"; |
@@ -27,2 +27,3 @@ export enum DataType { | ||
ShowLoading = 'ShowLoading', | ||
UpdatePageIndex = 'UpdatePageIndex', | ||
UpdateCellValue = 'UpdateCellValue', | ||
@@ -29,0 +30,0 @@ UpdateData = 'UpdateData', |
{ | ||
"name": "ka-table", | ||
"version": "3.2.2", | ||
"version": "3.3.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "github:komarovalexander/ka-table", |
@@ -27,4 +27,7 @@ var __assign = (this && this.__assign) || function () { | ||
var kaReducer = function (state, action) { | ||
var columns = state.columns, _a = state.data, data = _a === void 0 ? [] : _a, _b = state.editableCells, editableCells = _b === void 0 ? [] : _b, groupsExpanded = state.groupsExpanded, loading = state.loading, rowKeyField = state.rowKeyField, _c = state.selectedRows, selectedRows = _c === void 0 ? [] : _c, virtualScrolling = state.virtualScrolling; | ||
var columns = state.columns, _a = state.data, data = _a === void 0 ? [] : _a, _b = state.editableCells, editableCells = _b === void 0 ? [] : _b, groupsExpanded = state.groupsExpanded, loading = state.loading, paging = state.paging, rowKeyField = state.rowKeyField, _c = state.selectedRows, selectedRows = _c === void 0 ? [] : _c, virtualScrolling = state.virtualScrolling; | ||
switch (action.type) { | ||
case ActionType.UpdatePageIndex: { | ||
return __assign(__assign({}, state), { paging: __assign(__assign({}, paging), { pageIndex: action.pageIndex }) }); | ||
} | ||
case ActionType.HideLoading: { | ||
@@ -31,0 +34,0 @@ return __assign(__assign({}, state), { loading: __assign(__assign({}, loading), { enabled: false }) }); |
@@ -19,2 +19,3 @@ | ||
loading, | ||
paging, | ||
rowKeyField, | ||
@@ -26,2 +27,5 @@ selectedRows = [], | ||
switch (action.type) { | ||
case ActionType.UpdatePageIndex: { | ||
return { ...state, paging: {...paging, pageIndex: action.pageIndex } }; | ||
} | ||
case ActionType.HideLoading: { | ||
@@ -28,0 +32,0 @@ return { ...state, loading: {...loading, enabled: false } }; |
@@ -15,2 +15,3 @@ var __assign = (this && this.__assign) || function () { | ||
import { getGroupedData } from './GroupUtils'; | ||
import { getPageData, getPagesCount } from './PagingUtils'; | ||
import { sortData } from './SortUtils'; | ||
@@ -54,3 +55,3 @@ import { convertToColumnTypes } from './TypeUtils'; | ||
export var prepareTableOptions = function (props) { | ||
var extendedFilter = props.extendedFilter, groups = props.groups, groupsExpanded = props.groupsExpanded, search = props.search; | ||
var extendedFilter = props.extendedFilter, groups = props.groups, groupsExpanded = props.groupsExpanded, paging = props.paging, search = props.search; | ||
var columns = props.columns, _a = props.data, data = _a === void 0 ? [] : _a; | ||
@@ -69,3 +70,5 @@ data = extendedFilter ? extendedFilter(data) : data; | ||
} | ||
var groupedData = groups ? getGroupedData(data, groups, groupedColumns, groupsExpanded) : data; | ||
var groupedAllData = groups ? getGroupedData(data, groups, groupedColumns, groupsExpanded) : data; | ||
var pagesCount = getPagesCount(groupedAllData, paging); | ||
var groupedData = getPageData(groupedAllData, paging); | ||
return { | ||
@@ -77,3 +80,4 @@ columns: columns, | ||
groupedData: groupedData, | ||
pagesCount: pagesCount | ||
}; | ||
}; |
@@ -9,2 +9,3 @@ import { HTMLAttributes } from 'react'; | ||
import { getGroupedData } from './GroupUtils'; | ||
import { getPageData, getPagesCount } from './PagingUtils'; | ||
import { sortData } from './SortUtils'; | ||
@@ -65,2 +66,3 @@ import { convertToColumnTypes } from './TypeUtils'; | ||
groupsExpanded, | ||
paging, | ||
search, | ||
@@ -88,3 +90,5 @@ } = props; | ||
const groupedData = groups ? getGroupedData(data, groups, groupedColumns, groupsExpanded) : data; | ||
const groupedAllData = groups ? getGroupedData(data, groups, groupedColumns, groupsExpanded) : data; | ||
const pagesCount = getPagesCount(groupedAllData, paging); | ||
const groupedData = getPageData(groupedAllData, paging); | ||
@@ -97,3 +101,4 @@ return { | ||
groupedData, | ||
pagesCount | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
213285
152
4158