@devexpress/dx-grid-core
Advanced tools
Comparing version 1.0.0-alpha.4 to 1.0.0-alpha.5
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-06-23 | ||
* Version: 1.0.0-alpha.3 | ||
* Generated: 2017-07-07 | ||
* Version: 1.0.0-alpha.4 | ||
* License: https://js.devexpress.com/Licensing | ||
*/ | ||
import { easeOutCubic } from '@devexpress/dx-core'; | ||
var _extends = Object.assign || function (target) { | ||
@@ -52,6 +54,39 @@ for (var i = 1; i < arguments.length; i++) { | ||
var slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"]) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return function (arr, i) { | ||
if (Array.isArray(arr)) { | ||
return arr; | ||
} else if (Symbol.iterator in Object(arr)) { | ||
return sliceIterator(arr, i); | ||
} else { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
}; | ||
}(); | ||
@@ -67,2 +102,5 @@ | ||
var toConsumableArray = function (arr) { | ||
@@ -175,4 +213,4 @@ if (Array.isArray(arr)) { | ||
var result = array.slice(0); | ||
var auxiliary = array.slice(0); | ||
var result = array.slice(); | ||
var auxiliary = array.slice(); | ||
sortAuxiliaryToArray(result, auxiliary, 0, result.length - 1, compare); | ||
@@ -198,3 +236,3 @@ return result; | ||
var compare = sorting.slice().reverse().reduce(function (prevCompare, columnSorting) { | ||
var compare = Array.from(sorting).reverse().reduce(function (prevCompare, columnSorting) { | ||
return createSortingCompare(columnSorting, prevCompare); | ||
@@ -205,3 +243,3 @@ }, function () { | ||
return mergeSort(rows, compare); | ||
return mergeSort(Array.from(rows), compare); | ||
}; | ||
@@ -216,3 +254,3 @@ | ||
}); | ||
var nextState = filters.slice(); | ||
var nextState = Array.from(filters); | ||
@@ -273,3 +311,3 @@ if (config) { | ||
var grouping = prevGrouping.slice(); | ||
var grouping = Array.from(prevGrouping); | ||
var index = grouping.findIndex(function (g) { | ||
@@ -364,2 +402,15 @@ return g.columnName === columnName; | ||
var nextExpandedGroups = function nextExpandedGroups(prevExpandedGroups, groupKey) { | ||
var expandedGroups = Array.from(prevExpandedGroups); | ||
var groupKeyIndex = expandedGroups.indexOf(groupKey); | ||
if (groupKeyIndex > -1) { | ||
expandedGroups.splice(groupKeyIndex, 1); | ||
} else { | ||
expandedGroups.push(groupKey); | ||
} | ||
return expandedGroups; | ||
}; | ||
var setCurrentPage = function setCurrentPage(prevPage, _ref) { | ||
@@ -441,4 +492,5 @@ var page = _ref.page; | ||
var selectedRows = selection.slice(); | ||
var selectedRows = Array.from(selection); | ||
var selectedIndex = selectedRows.indexOf(rowId); | ||
var isRowSelected = isSelected; | ||
@@ -504,3 +556,3 @@ | ||
var expandedRows = prevExpanded.slice(); | ||
var expandedRows = Array.from(prevExpanded); | ||
var expandedIndex = expandedRows.indexOf(rowId); | ||
@@ -669,4 +721,4 @@ var isRowExpanded = isExpanded !== undefined ? isExpanded : expandedIndex === -1; | ||
var targetColumnIndex = order.indexOf(targetColumnName); | ||
var newOrder = Array.from(order); | ||
var newOrder = order.slice(); | ||
newOrder.splice(sourceColumnIndex, 1); | ||
@@ -678,3 +730,3 @@ newOrder.splice(targetColumnIndex, 0, sourceColumnName); | ||
var orderedColumns = function orderedColumns(columns, order) { | ||
var result = columns.slice(); | ||
var result = Array.from(columns); | ||
@@ -906,3 +958,76 @@ result.sort(function (a, b) { | ||
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 }; | ||
var ANIMATION_DURATION = 200; | ||
var getAnimationProgress = function getAnimationProgress(animation) { | ||
return (new Date().getTime() - animation.startTime) / ANIMATION_DURATION; | ||
}; | ||
var getAnimations = function getAnimations(prevColumns, nextColumns, tableWidth, draggingColumnKey, prevAnimations) { | ||
var prevColumnGeometries = new Map(getTableColumnGeometries(prevColumns, tableWidth).map(function (geometry, index) { | ||
return [tableColumnKeyGetter(prevColumns[index], index), geometry]; | ||
}).map(function (_ref4) { | ||
var _ref5 = slicedToArray(_ref4, 2), | ||
key = _ref5[0], | ||
geometry = _ref5[1]; | ||
var animation = prevAnimations.get(key); | ||
if (!animation) return [key, geometry]; | ||
var progress = easeOutCubic(getAnimationProgress(animation)); | ||
var left = (animation.left.to - animation.left.from) * progress + animation.left.from; | ||
return [key, { | ||
left: left, | ||
right: geometry.right - (geometry.left - left) | ||
}]; | ||
})); | ||
var nextColumnGeometries = new Map(getTableColumnGeometries(nextColumns, tableWidth).map(function (geometry, index) { | ||
return [tableColumnKeyGetter(nextColumns[index], index), geometry]; | ||
})); | ||
return new Map([].concat(toConsumableArray(nextColumnGeometries.keys())).map(function (key) { | ||
var prev = prevColumnGeometries.get(key); | ||
var next = nextColumnGeometries.get(key); | ||
var result = { startTime: new Date().getTime(), style: {} }; | ||
if (Math.abs(prev.left - next.left) > 1) { | ||
result.left = { from: prev.left, to: next.left }; | ||
} | ||
if (draggingColumnKey === key) { | ||
result.style = { | ||
zIndex: 100, | ||
position: 'relative' | ||
}; | ||
} | ||
return [key, result]; | ||
}).filter(function (animation) { | ||
return animation[1].left; | ||
})); | ||
}; | ||
var filterActiveAnimations = function filterActiveAnimations(animations) { | ||
return new Map([].concat(toConsumableArray(animations.entries())).filter(function (_ref6) { | ||
var _ref7 = slicedToArray(_ref6, 2), | ||
animation = _ref7[1]; | ||
return getAnimationProgress(animation) < 1; | ||
})); | ||
}; | ||
var evalAnimations = function evalAnimations(animations) { | ||
return new Map([].concat(toConsumableArray(animations.entries())).map(function (_ref8) { | ||
var _ref9 = slicedToArray(_ref8, 2), | ||
key = _ref9[0], | ||
animation = _ref9[1]; | ||
var progress = easeOutCubic(getAnimationProgress(animation)); | ||
var result = _extends({}, animation.style); | ||
if (animation.left) { | ||
var offset = (animation.left.to - animation.left.from) * (progress - 1); | ||
result.transform = 'translateX(' + offset + 'px)'; | ||
} | ||
return [key, result]; | ||
})); | ||
}; | ||
export { tableRowKeyGetter, tableColumnKeyGetter, getTableCellInfo, findTableCellTarget, getTableColumnGeometries, getTableTargetColumnIndex, getAnimations, filterActiveAnimations, evalAnimations, setColumnSorting, getColumnSortingDirection, sortedRows, setColumnFilter, getColumnFilterConfig, filteredRows, groupByColumn, groupedRows, expandedGroupRows, groupedColumns, nextExpandedGroups, 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-23 | ||
* Version: 1.0.0-alpha.3 | ||
* Generated: 2017-07-07 | ||
* Version: 1.0.0-alpha.4 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -9,6 +9,6 @@ */ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.DevExpress = global.DevExpress || {}, global.DevExpress.DXGridCore = global.DevExpress.DXGridCore || {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@devexpress/dx-core')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@devexpress/dx-core'], factory) : | ||
(factory((global.DevExpress = global.DevExpress || {}, global.DevExpress.DXGridCore = global.DevExpress.DXGridCore || {}),global.DevExpress.DXCore)); | ||
}(this, (function (exports,_devexpress_dxCore) { 'use strict'; | ||
@@ -59,6 +59,39 @@ var _extends = Object.assign || function (target) { | ||
var slicedToArray = function () { | ||
function sliceIterator(arr, i) { | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
try { | ||
if (!_n && _i["return"]) _i["return"](); | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return function (arr, i) { | ||
if (Array.isArray(arr)) { | ||
return arr; | ||
} else if (Symbol.iterator in Object(arr)) { | ||
return sliceIterator(arr, i); | ||
} else { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
} | ||
}; | ||
}(); | ||
@@ -74,2 +107,5 @@ | ||
var toConsumableArray = function (arr) { | ||
@@ -182,4 +218,4 @@ if (Array.isArray(arr)) { | ||
var result = array.slice(0); | ||
var auxiliary = array.slice(0); | ||
var result = array.slice(); | ||
var auxiliary = array.slice(); | ||
sortAuxiliaryToArray(result, auxiliary, 0, result.length - 1, compare); | ||
@@ -205,3 +241,3 @@ return result; | ||
var compare = sorting.slice().reverse().reduce(function (prevCompare, columnSorting) { | ||
var compare = Array.from(sorting).reverse().reduce(function (prevCompare, columnSorting) { | ||
return createSortingCompare(columnSorting, prevCompare); | ||
@@ -212,3 +248,3 @@ }, function () { | ||
return mergeSort(rows, compare); | ||
return mergeSort(Array.from(rows), compare); | ||
}; | ||
@@ -223,3 +259,3 @@ | ||
}); | ||
var nextState = filters.slice(); | ||
var nextState = Array.from(filters); | ||
@@ -280,3 +316,3 @@ if (config) { | ||
var grouping = prevGrouping.slice(); | ||
var grouping = Array.from(prevGrouping); | ||
var index = grouping.findIndex(function (g) { | ||
@@ -371,2 +407,15 @@ return g.columnName === columnName; | ||
var nextExpandedGroups = function nextExpandedGroups(prevExpandedGroups, groupKey) { | ||
var expandedGroups = Array.from(prevExpandedGroups); | ||
var groupKeyIndex = expandedGroups.indexOf(groupKey); | ||
if (groupKeyIndex > -1) { | ||
expandedGroups.splice(groupKeyIndex, 1); | ||
} else { | ||
expandedGroups.push(groupKey); | ||
} | ||
return expandedGroups; | ||
}; | ||
var setCurrentPage = function setCurrentPage(prevPage, _ref) { | ||
@@ -448,4 +497,5 @@ var page = _ref.page; | ||
var selectedRows = selection.slice(); | ||
var selectedRows = Array.from(selection); | ||
var selectedIndex = selectedRows.indexOf(rowId); | ||
var isRowSelected = isSelected; | ||
@@ -511,3 +561,3 @@ | ||
var expandedRows = prevExpanded.slice(); | ||
var expandedRows = Array.from(prevExpanded); | ||
var expandedIndex = expandedRows.indexOf(rowId); | ||
@@ -676,4 +726,4 @@ var isRowExpanded = isExpanded !== undefined ? isExpanded : expandedIndex === -1; | ||
var targetColumnIndex = order.indexOf(targetColumnName); | ||
var newOrder = Array.from(order); | ||
var newOrder = order.slice(); | ||
newOrder.splice(sourceColumnIndex, 1); | ||
@@ -685,3 +735,3 @@ newOrder.splice(targetColumnIndex, 0, sourceColumnName); | ||
var orderedColumns = function orderedColumns(columns, order) { | ||
var result = columns.slice(); | ||
var result = Array.from(columns); | ||
@@ -913,2 +963,75 @@ result.sort(function (a, b) { | ||
var ANIMATION_DURATION = 200; | ||
var getAnimationProgress = function getAnimationProgress(animation) { | ||
return (new Date().getTime() - animation.startTime) / ANIMATION_DURATION; | ||
}; | ||
var getAnimations = function getAnimations(prevColumns, nextColumns, tableWidth, draggingColumnKey, prevAnimations) { | ||
var prevColumnGeometries = new Map(getTableColumnGeometries(prevColumns, tableWidth).map(function (geometry, index) { | ||
return [tableColumnKeyGetter(prevColumns[index], index), geometry]; | ||
}).map(function (_ref4) { | ||
var _ref5 = slicedToArray(_ref4, 2), | ||
key = _ref5[0], | ||
geometry = _ref5[1]; | ||
var animation = prevAnimations.get(key); | ||
if (!animation) return [key, geometry]; | ||
var progress = _devexpress_dxCore.easeOutCubic(getAnimationProgress(animation)); | ||
var left = (animation.left.to - animation.left.from) * progress + animation.left.from; | ||
return [key, { | ||
left: left, | ||
right: geometry.right - (geometry.left - left) | ||
}]; | ||
})); | ||
var nextColumnGeometries = new Map(getTableColumnGeometries(nextColumns, tableWidth).map(function (geometry, index) { | ||
return [tableColumnKeyGetter(nextColumns[index], index), geometry]; | ||
})); | ||
return new Map([].concat(toConsumableArray(nextColumnGeometries.keys())).map(function (key) { | ||
var prev = prevColumnGeometries.get(key); | ||
var next = nextColumnGeometries.get(key); | ||
var result = { startTime: new Date().getTime(), style: {} }; | ||
if (Math.abs(prev.left - next.left) > 1) { | ||
result.left = { from: prev.left, to: next.left }; | ||
} | ||
if (draggingColumnKey === key) { | ||
result.style = { | ||
zIndex: 100, | ||
position: 'relative' | ||
}; | ||
} | ||
return [key, result]; | ||
}).filter(function (animation) { | ||
return animation[1].left; | ||
})); | ||
}; | ||
var filterActiveAnimations = function filterActiveAnimations(animations) { | ||
return new Map([].concat(toConsumableArray(animations.entries())).filter(function (_ref6) { | ||
var _ref7 = slicedToArray(_ref6, 2), | ||
animation = _ref7[1]; | ||
return getAnimationProgress(animation) < 1; | ||
})); | ||
}; | ||
var evalAnimations = function evalAnimations(animations) { | ||
return new Map([].concat(toConsumableArray(animations.entries())).map(function (_ref8) { | ||
var _ref9 = slicedToArray(_ref8, 2), | ||
key = _ref9[0], | ||
animation = _ref9[1]; | ||
var progress = _devexpress_dxCore.easeOutCubic(getAnimationProgress(animation)); | ||
var result = _extends({}, animation.style); | ||
if (animation.left) { | ||
var offset = (animation.left.to - animation.left.from) * (progress - 1); | ||
result.transform = 'translateX(' + offset + 'px)'; | ||
} | ||
return [key, result]; | ||
})); | ||
}; | ||
exports.tableRowKeyGetter = tableRowKeyGetter; | ||
@@ -920,2 +1043,5 @@ exports.tableColumnKeyGetter = tableColumnKeyGetter; | ||
exports.getTableTargetColumnIndex = getTableTargetColumnIndex; | ||
exports.getAnimations = getAnimations; | ||
exports.filterActiveAnimations = filterActiveAnimations; | ||
exports.evalAnimations = evalAnimations; | ||
exports.setColumnSorting = setColumnSorting; | ||
@@ -931,2 +1057,3 @@ exports.getColumnSortingDirection = getColumnSortingDirection; | ||
exports.groupedColumns = groupedColumns; | ||
exports.nextExpandedGroups = nextExpandedGroups; | ||
exports.setCurrentPage = setCurrentPage; | ||
@@ -933,0 +1060,0 @@ exports.setPageSize = setPageSize; |
{ | ||
"name": "@devexpress/dx-grid-core", | ||
"version": "1.0.0-alpha.4", | ||
"version": "1.0.0-alpha.5", | ||
"description": "Core library for the DevExtreme Reactive Grid component", | ||
@@ -53,2 +53,3 @@ "author": { | ||
"devDependencies": { | ||
"@devexpress/dx-core": "1.0.0-alpha.5", | ||
"babel-cli": "^6.24.1", | ||
@@ -71,4 +72,8 @@ "babel-core": "^6.25.0", | ||
"rollup-plugin-license": "^0.4.0", | ||
"rollup-watch": "^4.0.0" | ||
"rollup-watch": "^4.0.0", | ||
"seamless-immutable": "^7.1.2" | ||
}, | ||
"peerDependencies": { | ||
"@devexpress/dx-core": "1.0.0-alpha.5" | ||
} | ||
} |
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
167101
1708
1
20