@devexpress/dx-grid-core
Advanced tools
Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.4
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-06-09 | ||
* Version: 1.0.0-alpha.2 | ||
* Generated: 2017-06-23 | ||
* Version: 1.0.0-alpha.3 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -367,6 +367,10 @@ */ | ||
var paginate = function paginate(rows, pageSize, page) { | ||
return rows.slice(pageSize * page, pageSize * (page + 1)); | ||
return pageSize ? rows.slice(pageSize * page, pageSize * (page + 1)) : rows; | ||
}; | ||
var ensurePageHeaders = function ensurePageHeaders(rows, pageSize) { | ||
if (!pageSize) { | ||
return rows; | ||
} | ||
var result = rows.slice(); | ||
@@ -405,3 +409,3 @@ | ||
var totalPageCount = function totalPageCount(rows, pageSize) { | ||
return Math.ceil(rows.length / pageSize); | ||
return pageSize ? Math.ceil(rows.length / pageSize) : 1; | ||
}; | ||
@@ -414,8 +418,13 @@ | ||
var firstRowOnPage = function firstRowOnPage(currentPage, pageSize) { | ||
return currentPage * pageSize + 1; | ||
return pageSize ? currentPage * pageSize + 1 : 1; | ||
}; | ||
var lastRowOnPage = function lastRowOnPage(currentPage, pageSize, totalRowCount) { | ||
var index = (currentPage + 1) * pageSize; | ||
return index > totalRowCount ? totalRowCount : index; | ||
var result = totalRowCount; | ||
if (pageSize) { | ||
var index = (currentPage + 1) * pageSize; | ||
result = index > totalRowCount ? totalRowCount : index; | ||
} | ||
return result; | ||
}; | ||
@@ -676,5 +685,5 @@ | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping, groupColumnWidth) { | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping, groupIndentColumnWidth) { | ||
return [].concat(toConsumableArray(grouping.map(function (group) { | ||
return { type: 'groupColumn', group: group, width: groupColumnWidth }; | ||
return { type: 'groupColumn', group: group, width: groupIndentColumnWidth }; | ||
})), toConsumableArray(columns)); | ||
@@ -827,3 +836,65 @@ }; | ||
export { tableRowKeyGetter, tableColumnKeyGetter, getTableCellInfo, findTableCellTarget, setColumnSorting, getColumnSortingDirection, sortedRows, setColumnFilter, getColumnFilterConfig, filteredRows, groupByColumn, groupedRows, expandedGroupRows, groupedColumns, setCurrentPage, setPageSize, paginate, ensurePageHeaders, totalPageCount, totalCount, firstRowOnPage, lastRowOnPage, setRowSelection, setRowsSelection, getAvailableToSelect, getAvailableSelection, setDetailRowExpanded, expandedDetailRows, tableColumnsWithDetail, isDetailRowExpanded, startEditRows, stopEditRows, addRow, changeAddedRow, cancelAddedRows, changeRow, cancelChanges, deleteRows, cancelDeletedRows, changedRowsByIds, addedRowsByIds, getRowChange, rowsWithEditing, setColumnOrder, orderedColumns, tableHeaderRowsWithFilter, tableColumnsWithGroups, tableColumnsWithoutGroups, tableRowsWithHeading, tableColumnsWithSelection, tableBodyRowsWithSelection, tableExtraProps }; | ||
var getTableColumnGeometries = function getTableColumnGeometries(columns, tableWidth) { | ||
var columnWidths = columns.map(function (column) { | ||
return column.width; | ||
}); | ||
var freeSpace = tableWidth; | ||
var restrictedSpace = columnWidths.reduce(function (accum, width) { | ||
return accum + (width || 0); | ||
}, 0); | ||
var freeSpacePortions = columnWidths.reduce(function (accum, width) { | ||
return accum + (width === undefined ? 1 : 0); | ||
}, 0); | ||
var freeSpacePortion = (freeSpace - restrictedSpace) / freeSpacePortions; | ||
var lastRightPosition = 0; | ||
return columnWidths.map(function (width) { | ||
return width === undefined ? freeSpacePortion : width; | ||
}).map(function (width) { | ||
lastRightPosition += width; | ||
return { | ||
left: lastRightPosition - width, | ||
right: lastRightPosition | ||
}; | ||
}); | ||
}; | ||
var getTableTargetColumnIndex = function getTableTargetColumnIndex(columnGeometries, sourceIndex, offset) { | ||
var sourceWidth = columnGeometries[sourceIndex].right - columnGeometries[sourceIndex].left; | ||
var getWidthDifference = function getWidthDifference(index) { | ||
return columnGeometries[index].right - columnGeometries[index].left - sourceWidth; | ||
}; | ||
return columnGeometries.map(function (_ref2, targetIndex) { | ||
var left = _ref2.left, | ||
right = _ref2.right; | ||
var leftBorder = left; | ||
if (targetIndex > 0 && targetIndex <= sourceIndex) { | ||
leftBorder = Math.min(leftBorder, leftBorder - getWidthDifference(targetIndex - 1)); | ||
} | ||
if (targetIndex > sourceIndex) { | ||
leftBorder = Math.max(leftBorder, leftBorder + getWidthDifference(targetIndex)); | ||
} | ||
var rightBorder = right; | ||
if (targetIndex < columnGeometries.length - 1 && targetIndex >= sourceIndex) { | ||
rightBorder = Math.max(rightBorder, rightBorder + getWidthDifference(targetIndex + 1)); | ||
} | ||
if (targetIndex < sourceIndex) { | ||
rightBorder = Math.min(rightBorder, rightBorder - getWidthDifference(targetIndex)); | ||
} | ||
return { | ||
left: leftBorder, | ||
right: rightBorder | ||
}; | ||
}).findIndex(function (_ref3) { | ||
var left = _ref3.left, | ||
right = _ref3.right; | ||
return offset > left && offset < right; | ||
}); | ||
}; | ||
export { tableRowKeyGetter, tableColumnKeyGetter, getTableCellInfo, findTableCellTarget, getTableColumnGeometries, getTableTargetColumnIndex, setColumnSorting, getColumnSortingDirection, sortedRows, setColumnFilter, getColumnFilterConfig, filteredRows, groupByColumn, groupedRows, expandedGroupRows, groupedColumns, setCurrentPage, setPageSize, paginate, ensurePageHeaders, totalPageCount, totalCount, firstRowOnPage, lastRowOnPage, setRowSelection, setRowsSelection, getAvailableToSelect, getAvailableSelection, setDetailRowExpanded, expandedDetailRows, tableColumnsWithDetail, isDetailRowExpanded, startEditRows, stopEditRows, addRow, changeAddedRow, cancelAddedRows, changeRow, cancelChanges, deleteRows, cancelDeletedRows, changedRowsByIds, addedRowsByIds, getRowChange, rowsWithEditing, setColumnOrder, orderedColumns, tableHeaderRowsWithFilter, tableColumnsWithGroups, tableColumnsWithoutGroups, tableRowsWithHeading, tableColumnsWithSelection, tableBodyRowsWithSelection, tableExtraProps }; | ||
//# sourceMappingURL=dx-grid-core.es.js.map |
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-06-09 | ||
* Version: 1.0.0-alpha.2 | ||
* Generated: 2017-06-23 | ||
* Version: 1.0.0-alpha.3 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -373,6 +373,10 @@ */ | ||
var paginate = function paginate(rows, pageSize, page) { | ||
return rows.slice(pageSize * page, pageSize * (page + 1)); | ||
return pageSize ? rows.slice(pageSize * page, pageSize * (page + 1)) : rows; | ||
}; | ||
var ensurePageHeaders = function ensurePageHeaders(rows, pageSize) { | ||
if (!pageSize) { | ||
return rows; | ||
} | ||
var result = rows.slice(); | ||
@@ -411,3 +415,3 @@ | ||
var totalPageCount = function totalPageCount(rows, pageSize) { | ||
return Math.ceil(rows.length / pageSize); | ||
return pageSize ? Math.ceil(rows.length / pageSize) : 1; | ||
}; | ||
@@ -420,8 +424,13 @@ | ||
var firstRowOnPage = function firstRowOnPage(currentPage, pageSize) { | ||
return currentPage * pageSize + 1; | ||
return pageSize ? currentPage * pageSize + 1 : 1; | ||
}; | ||
var lastRowOnPage = function lastRowOnPage(currentPage, pageSize, totalRowCount) { | ||
var index = (currentPage + 1) * pageSize; | ||
return index > totalRowCount ? totalRowCount : index; | ||
var result = totalRowCount; | ||
if (pageSize) { | ||
var index = (currentPage + 1) * pageSize; | ||
result = index > totalRowCount ? totalRowCount : index; | ||
} | ||
return result; | ||
}; | ||
@@ -682,5 +691,5 @@ | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping, groupColumnWidth) { | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping, groupIndentColumnWidth) { | ||
return [].concat(toConsumableArray(grouping.map(function (group) { | ||
return { type: 'groupColumn', group: group, width: groupColumnWidth }; | ||
return { type: 'groupColumn', group: group, width: groupIndentColumnWidth }; | ||
})), toConsumableArray(columns)); | ||
@@ -833,2 +842,64 @@ }; | ||
var getTableColumnGeometries = function getTableColumnGeometries(columns, tableWidth) { | ||
var columnWidths = columns.map(function (column) { | ||
return column.width; | ||
}); | ||
var freeSpace = tableWidth; | ||
var restrictedSpace = columnWidths.reduce(function (accum, width) { | ||
return accum + (width || 0); | ||
}, 0); | ||
var freeSpacePortions = columnWidths.reduce(function (accum, width) { | ||
return accum + (width === undefined ? 1 : 0); | ||
}, 0); | ||
var freeSpacePortion = (freeSpace - restrictedSpace) / freeSpacePortions; | ||
var lastRightPosition = 0; | ||
return columnWidths.map(function (width) { | ||
return width === undefined ? freeSpacePortion : width; | ||
}).map(function (width) { | ||
lastRightPosition += width; | ||
return { | ||
left: lastRightPosition - width, | ||
right: lastRightPosition | ||
}; | ||
}); | ||
}; | ||
var getTableTargetColumnIndex = function getTableTargetColumnIndex(columnGeometries, sourceIndex, offset) { | ||
var sourceWidth = columnGeometries[sourceIndex].right - columnGeometries[sourceIndex].left; | ||
var getWidthDifference = function getWidthDifference(index) { | ||
return columnGeometries[index].right - columnGeometries[index].left - sourceWidth; | ||
}; | ||
return columnGeometries.map(function (_ref2, targetIndex) { | ||
var left = _ref2.left, | ||
right = _ref2.right; | ||
var leftBorder = left; | ||
if (targetIndex > 0 && targetIndex <= sourceIndex) { | ||
leftBorder = Math.min(leftBorder, leftBorder - getWidthDifference(targetIndex - 1)); | ||
} | ||
if (targetIndex > sourceIndex) { | ||
leftBorder = Math.max(leftBorder, leftBorder + getWidthDifference(targetIndex)); | ||
} | ||
var rightBorder = right; | ||
if (targetIndex < columnGeometries.length - 1 && targetIndex >= sourceIndex) { | ||
rightBorder = Math.max(rightBorder, rightBorder + getWidthDifference(targetIndex + 1)); | ||
} | ||
if (targetIndex < sourceIndex) { | ||
rightBorder = Math.min(rightBorder, rightBorder - getWidthDifference(targetIndex)); | ||
} | ||
return { | ||
left: leftBorder, | ||
right: rightBorder | ||
}; | ||
}).findIndex(function (_ref3) { | ||
var left = _ref3.left, | ||
right = _ref3.right; | ||
return offset > left && offset < right; | ||
}); | ||
}; | ||
exports.tableRowKeyGetter = tableRowKeyGetter; | ||
@@ -838,2 +909,4 @@ exports.tableColumnKeyGetter = tableColumnKeyGetter; | ||
exports.findTableCellTarget = findTableCellTarget; | ||
exports.getTableColumnGeometries = getTableColumnGeometries; | ||
exports.getTableTargetColumnIndex = getTableTargetColumnIndex; | ||
exports.setColumnSorting = setColumnSorting; | ||
@@ -840,0 +913,0 @@ exports.getColumnSortingDirection = getColumnSortingDirection; |
{ | ||
"name": "@devexpress/dx-grid-core", | ||
"version": "1.0.0-alpha.3", | ||
"version": "1.0.0-alpha.4", | ||
"description": "Core library for the DevExtreme Reactive Grid component", | ||
@@ -54,4 +54,4 @@ "author": { | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.24.1", | ||
"babel-jest": "^19.0.0", | ||
"babel-core": "^6.25.0", | ||
"babel-jest": "^20.0.3", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
@@ -63,12 +63,12 @@ "babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-airbnb-base": "^11.1.3", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jest": "^19.0.1", | ||
"jest": "^19.0.2", | ||
"eslint-config-airbnb-base": "^11.2.0", | ||
"eslint-plugin-import": "^2.3.0", | ||
"eslint-plugin-jest": "^20.0.3", | ||
"jest": "^20.0.4", | ||
"jest-junit": "^1.5.1", | ||
"rollup": "^0.41.6", | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-babel": "^2.7.1", | ||
"rollup-plugin-license": "^0.3.0", | ||
"rollup-watch": "^3.2.2" | ||
"rollup-plugin-license": "^0.4.0", | ||
"rollup-watch": "^4.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
147370
1493