@devexpress/dx-grid-core
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-05-26 | ||
* Version: 1.0.0-alpha.1 | ||
* Generated: 2017-06-09 | ||
* Version: 1.0.0-alpha.2 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -407,2 +407,15 @@ */ | ||
var totalCount = function totalCount(rows) { | ||
return rows.length; | ||
}; | ||
var firstRowOnPage = function firstRowOnPage(currentPage, pageSize) { | ||
return currentPage * pageSize + 1; | ||
}; | ||
var lastRowOnPage = function lastRowOnPage(currentPage, pageSize, totalRowCount) { | ||
var index = (currentPage + 1) * pageSize; | ||
return index > totalRowCount ? totalRowCount : index; | ||
}; | ||
var setRowSelection = function setRowSelection(selection, _ref) { | ||
@@ -505,4 +518,4 @@ var rowId = _ref.rowId, | ||
var tableColumnsWithDetail = function tableColumnsWithDetail(columns) { | ||
return [{ type: 'detail', width: 25 }].concat(toConsumableArray(columns)); | ||
var tableColumnsWithDetail = function tableColumnsWithDetail(columns, detailToggleCellWidth) { | ||
return [{ type: 'detail', width: detailToggleCellWidth }].concat(toConsumableArray(columns)); | ||
}; | ||
@@ -633,2 +646,27 @@ | ||
var setColumnOrder = function setColumnOrder(order, _ref) { | ||
var sourceColumnName = _ref.sourceColumnName, | ||
targetColumnName = _ref.targetColumnName; | ||
var sourceColumnIndex = order.indexOf(sourceColumnName); | ||
var targetColumnIndex = order.indexOf(targetColumnName); | ||
var newOrder = order.slice(); | ||
newOrder.splice(sourceColumnIndex, 1); | ||
newOrder.splice(targetColumnIndex, 0, sourceColumnName); | ||
return newOrder; | ||
}; | ||
var orderedColumns = function orderedColumns(columns, order) { | ||
var result = columns.slice(); | ||
result.sort(function (a, b) { | ||
var aPos = order.indexOf(a.name); | ||
var bPos = order.indexOf(b.name); | ||
return aPos - bPos; | ||
}); | ||
return result; | ||
}; | ||
var tableHeaderRowsWithFilter = function tableHeaderRowsWithFilter(headerRows, rowHeight) { | ||
@@ -638,5 +676,5 @@ return [].concat(toConsumableArray(headerRows), [{ type: 'filter', height: rowHeight }]); | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping) { | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping, groupColumnWidth) { | ||
return [].concat(toConsumableArray(grouping.map(function (group) { | ||
return { type: 'groupColumn', group: group, width: 20 }; | ||
return { type: 'groupColumn', group: group, width: groupColumnWidth }; | ||
})), toConsumableArray(columns)); | ||
@@ -679,4 +717,4 @@ }; | ||
var tableColumnsWithSelection = function tableColumnsWithSelection(columns) { | ||
return [{ type: 'select', name: 'select', width: 30 }].concat(toConsumableArray(columns)); | ||
var tableColumnsWithSelection = function tableColumnsWithSelection(columns, selectionColumnWidth) { | ||
return [{ type: 'select', name: 'select', width: selectionColumnWidth }].concat(toConsumableArray(columns)); | ||
}; | ||
@@ -702,3 +740,91 @@ | ||
export { setColumnSorting, getColumnSortingDirection, sortedRows, setColumnFilter, getColumnFilterConfig, filteredRows, groupByColumn, groupedRows, expandedGroupRows, groupedColumns, setCurrentPage, setPageSize, paginate, ensurePageHeaders, totalPageCount, setRowSelection, setRowsSelection, getAvailableToSelect, getAvailableSelection, setDetailRowExpanded, expandedDetailRows, tableColumnsWithDetail, isDetailRowExpanded, startEditRows, stopEditRows, addRow, changeAddedRow, cancelAddedRows, changeRow, cancelChanges, deleteRows, cancelDeletedRows, changedRowsByIds, addedRowsByIds, getRowChange, rowsWithEditing, tableHeaderRowsWithFilter, tableColumnsWithGroups, tableColumnsWithoutGroups, tableRowsWithHeading, tableColumnsWithSelection, tableBodyRowsWithSelection, tableExtraProps }; | ||
/* globals document */ | ||
var querySelectorAll = function () { | ||
var scopeSupported = true; | ||
try { | ||
document.createElement('a').querySelector(':scope *'); | ||
} catch (e) { | ||
scopeSupported = false; | ||
} | ||
if (scopeSupported) { | ||
return function (element, selectors) { | ||
return element.querySelectorAll(selectors); | ||
}; | ||
} | ||
var scope = /:scope\b/gi; | ||
return function (element, selectors) { | ||
var el = element; | ||
var hasScope = selectors && scope.test(selectors); | ||
if (hasScope) { | ||
var id = el.getAttribute('id'); | ||
if (!id) { | ||
el.id = 'q' + Math.floor(Math.random() * 9000000) + 1000000; | ||
} | ||
var elementOrNodeList = el.querySelectorAll(selectors.replace(scope, '#' + el.id)); | ||
if (id === null) { | ||
el.removeAttribute('id'); | ||
} else if (!id) { | ||
el.id = id; | ||
} | ||
return elementOrNodeList; | ||
} | ||
return el.querySelectorAll(selectors); | ||
}; | ||
}(); | ||
var getTableKeyGetter = function getTableKeyGetter(getIntrinsicKey, object, index) { | ||
var type = object.type || 'data'; | ||
var intrinsicKey = type === 'data' ? getIntrinsicKey(object) : object.id; | ||
var key = intrinsicKey === undefined ? '$' + index : intrinsicKey; | ||
return type + '_' + key; | ||
}; | ||
var tableRowKeyGetter = getTableKeyGetter; | ||
var getColumnId = function getColumnId(column) { | ||
return column.name; | ||
}; | ||
var tableColumnKeyGetter = function tableColumnKeyGetter(column, columnIndex) { | ||
return getTableKeyGetter(getColumnId, column, columnIndex); | ||
}; | ||
var getTableCellInfo = function getTableCellInfo(_ref) { | ||
var row = _ref.row, | ||
columnIndex = _ref.columnIndex, | ||
columns = _ref.columns; | ||
if (row.colspan !== undefined && columnIndex > row.colspan) return { skip: true }; | ||
if (row.colspan === columnIndex) return { colspan: columns.length - row.colspan }; | ||
return {}; | ||
}; | ||
var findTableCellTarget = function findTableCellTarget(e) { | ||
var target = e.target, | ||
currentTarget = e.currentTarget; | ||
var rowsEls = querySelectorAll(currentTarget, ':scope > tr, :scope > tr'); | ||
var rowIndex = [].concat(toConsumableArray(rowsEls)).findIndex(function (rowEl) { | ||
return rowEl.contains(target); | ||
}); | ||
if (rowIndex === -1) return { rowIndex: -1, columnIndex: -1 }; | ||
var cellEls = querySelectorAll(rowsEls[rowIndex], ':scope > th, :scope > td'); | ||
var columnIndex = [].concat(toConsumableArray(cellEls)).findIndex(function (cellEl) { | ||
return cellEl.contains(target); | ||
}); | ||
if (columnIndex === -1) return { rowIndex: -1, columnIndex: -1 }; | ||
return { rowIndex: rowIndex, columnIndex: columnIndex }; | ||
}; | ||
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 }; | ||
//# sourceMappingURL=dx-grid-core.es.js.map |
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-05-26 | ||
* Version: 1.0.0-alpha.1 | ||
* Generated: 2017-06-09 | ||
* Version: 1.0.0-alpha.2 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -413,2 +413,15 @@ */ | ||
var totalCount = function totalCount(rows) { | ||
return rows.length; | ||
}; | ||
var firstRowOnPage = function firstRowOnPage(currentPage, pageSize) { | ||
return currentPage * pageSize + 1; | ||
}; | ||
var lastRowOnPage = function lastRowOnPage(currentPage, pageSize, totalRowCount) { | ||
var index = (currentPage + 1) * pageSize; | ||
return index > totalRowCount ? totalRowCount : index; | ||
}; | ||
var setRowSelection = function setRowSelection(selection, _ref) { | ||
@@ -511,4 +524,4 @@ var rowId = _ref.rowId, | ||
var tableColumnsWithDetail = function tableColumnsWithDetail(columns) { | ||
return [{ type: 'detail', width: 25 }].concat(toConsumableArray(columns)); | ||
var tableColumnsWithDetail = function tableColumnsWithDetail(columns, detailToggleCellWidth) { | ||
return [{ type: 'detail', width: detailToggleCellWidth }].concat(toConsumableArray(columns)); | ||
}; | ||
@@ -639,2 +652,27 @@ | ||
var setColumnOrder = function setColumnOrder(order, _ref) { | ||
var sourceColumnName = _ref.sourceColumnName, | ||
targetColumnName = _ref.targetColumnName; | ||
var sourceColumnIndex = order.indexOf(sourceColumnName); | ||
var targetColumnIndex = order.indexOf(targetColumnName); | ||
var newOrder = order.slice(); | ||
newOrder.splice(sourceColumnIndex, 1); | ||
newOrder.splice(targetColumnIndex, 0, sourceColumnName); | ||
return newOrder; | ||
}; | ||
var orderedColumns = function orderedColumns(columns, order) { | ||
var result = columns.slice(); | ||
result.sort(function (a, b) { | ||
var aPos = order.indexOf(a.name); | ||
var bPos = order.indexOf(b.name); | ||
return aPos - bPos; | ||
}); | ||
return result; | ||
}; | ||
var tableHeaderRowsWithFilter = function tableHeaderRowsWithFilter(headerRows, rowHeight) { | ||
@@ -644,5 +682,5 @@ return [].concat(toConsumableArray(headerRows), [{ type: 'filter', height: rowHeight }]); | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping) { | ||
var tableColumnsWithGroups = function tableColumnsWithGroups(columns, grouping, groupColumnWidth) { | ||
return [].concat(toConsumableArray(grouping.map(function (group) { | ||
return { type: 'groupColumn', group: group, width: 20 }; | ||
return { type: 'groupColumn', group: group, width: groupColumnWidth }; | ||
})), toConsumableArray(columns)); | ||
@@ -685,4 +723,4 @@ }; | ||
var tableColumnsWithSelection = function tableColumnsWithSelection(columns) { | ||
return [{ type: 'select', name: 'select', width: 30 }].concat(toConsumableArray(columns)); | ||
var tableColumnsWithSelection = function tableColumnsWithSelection(columns, selectionColumnWidth) { | ||
return [{ type: 'select', name: 'select', width: selectionColumnWidth }].concat(toConsumableArray(columns)); | ||
}; | ||
@@ -708,2 +746,94 @@ | ||
/* globals document */ | ||
var querySelectorAll = function () { | ||
var scopeSupported = true; | ||
try { | ||
document.createElement('a').querySelector(':scope *'); | ||
} catch (e) { | ||
scopeSupported = false; | ||
} | ||
if (scopeSupported) { | ||
return function (element, selectors) { | ||
return element.querySelectorAll(selectors); | ||
}; | ||
} | ||
var scope = /:scope\b/gi; | ||
return function (element, selectors) { | ||
var el = element; | ||
var hasScope = selectors && scope.test(selectors); | ||
if (hasScope) { | ||
var id = el.getAttribute('id'); | ||
if (!id) { | ||
el.id = 'q' + Math.floor(Math.random() * 9000000) + 1000000; | ||
} | ||
var elementOrNodeList = el.querySelectorAll(selectors.replace(scope, '#' + el.id)); | ||
if (id === null) { | ||
el.removeAttribute('id'); | ||
} else if (!id) { | ||
el.id = id; | ||
} | ||
return elementOrNodeList; | ||
} | ||
return el.querySelectorAll(selectors); | ||
}; | ||
}(); | ||
var getTableKeyGetter = function getTableKeyGetter(getIntrinsicKey, object, index) { | ||
var type = object.type || 'data'; | ||
var intrinsicKey = type === 'data' ? getIntrinsicKey(object) : object.id; | ||
var key = intrinsicKey === undefined ? '$' + index : intrinsicKey; | ||
return type + '_' + key; | ||
}; | ||
var tableRowKeyGetter = getTableKeyGetter; | ||
var getColumnId = function getColumnId(column) { | ||
return column.name; | ||
}; | ||
var tableColumnKeyGetter = function tableColumnKeyGetter(column, columnIndex) { | ||
return getTableKeyGetter(getColumnId, column, columnIndex); | ||
}; | ||
var getTableCellInfo = function getTableCellInfo(_ref) { | ||
var row = _ref.row, | ||
columnIndex = _ref.columnIndex, | ||
columns = _ref.columns; | ||
if (row.colspan !== undefined && columnIndex > row.colspan) return { skip: true }; | ||
if (row.colspan === columnIndex) return { colspan: columns.length - row.colspan }; | ||
return {}; | ||
}; | ||
var findTableCellTarget = function findTableCellTarget(e) { | ||
var target = e.target, | ||
currentTarget = e.currentTarget; | ||
var rowsEls = querySelectorAll(currentTarget, ':scope > tr, :scope > tr'); | ||
var rowIndex = [].concat(toConsumableArray(rowsEls)).findIndex(function (rowEl) { | ||
return rowEl.contains(target); | ||
}); | ||
if (rowIndex === -1) return { rowIndex: -1, columnIndex: -1 }; | ||
var cellEls = querySelectorAll(rowsEls[rowIndex], ':scope > th, :scope > td'); | ||
var columnIndex = [].concat(toConsumableArray(cellEls)).findIndex(function (cellEl) { | ||
return cellEl.contains(target); | ||
}); | ||
if (columnIndex === -1) return { rowIndex: -1, columnIndex: -1 }; | ||
return { rowIndex: rowIndex, columnIndex: columnIndex }; | ||
}; | ||
exports.tableRowKeyGetter = tableRowKeyGetter; | ||
exports.tableColumnKeyGetter = tableColumnKeyGetter; | ||
exports.getTableCellInfo = getTableCellInfo; | ||
exports.findTableCellTarget = findTableCellTarget; | ||
exports.setColumnSorting = setColumnSorting; | ||
@@ -724,2 +854,5 @@ exports.getColumnSortingDirection = getColumnSortingDirection; | ||
exports.totalPageCount = totalPageCount; | ||
exports.totalCount = totalCount; | ||
exports.firstRowOnPage = firstRowOnPage; | ||
exports.lastRowOnPage = lastRowOnPage; | ||
exports.setRowSelection = setRowSelection; | ||
@@ -746,2 +879,4 @@ exports.setRowsSelection = setRowsSelection; | ||
exports.rowsWithEditing = rowsWithEditing; | ||
exports.setColumnOrder = setColumnOrder; | ||
exports.orderedColumns = orderedColumns; | ||
exports.tableHeaderRowsWithFilter = tableHeaderRowsWithFilter; | ||
@@ -748,0 +883,0 @@ exports.tableColumnsWithGroups = tableColumnsWithGroups; |
{ | ||
"name": "@devexpress/dx-grid-core", | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"description": "Core library for the DevExtreme Reactive Grid component", | ||
@@ -5,0 +5,0 @@ "author": { |
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
133855
1367
1