@devexpress/dx-grid-core
Advanced tools
Comparing version 1.0.0-alpha.10 to 1.0.0-alpha.11
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-09-18 | ||
* Version: 1.0.0-alpha.10 | ||
* Generated: 2017-10-04 | ||
* Version: 1.0.0-alpha.11 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -364,23 +364,27 @@ */ | ||
var createSortingCompare = function createSortingCompare(sorting, compareEqual, getCellData) { | ||
return function (a, b) { | ||
var inverse = sorting.direction === 'desc'; | ||
var columnName = sorting.columnName; | ||
var defaultCompare = function defaultCompare(a, b) { | ||
if (a < b) return -1; | ||
if (a > b) return 1; | ||
return 0; | ||
}; | ||
var aValue = getCellData(a, columnName); | ||
var bValue = getCellData(b, columnName); | ||
var sortedRows = function sortedRows(rows, sorting, getCellValue, getColumnCompare) { | ||
if (!sorting.length) return rows; | ||
if (aValue === bValue) { | ||
return compareEqual && compareEqual(a, b) || 0; | ||
} | ||
var compare = Array.from(sorting).reverse().reduce(function (prevCompare, columnSorting) { | ||
var columnName = columnSorting.columnName; | ||
return aValue < bValue ^ inverse ? -1 : 1; // eslint-disable-line no-bitwise | ||
}; | ||
}; | ||
var inverse = columnSorting.direction === 'desc'; | ||
var columnCompare = getColumnCompare && getColumnCompare(columnName) || defaultCompare; | ||
var sortedRows = function sortedRows(rows, sorting, getCellData) { | ||
if (!sorting.length) return rows; | ||
return function (aRow, bRow) { | ||
var a = getCellValue(aRow, columnName); | ||
var b = getCellValue(bRow, columnName); | ||
var result = columnCompare(a, b); | ||
var compare = Array.from(sorting).reverse().reduce(function (prevCompare, columnSorting) { | ||
return createSortingCompare(columnSorting, prevCompare, getCellData); | ||
if (result !== 0) { | ||
return inverse ? -result : result; | ||
} | ||
return prevCompare(aRow, bRow); | ||
}; | ||
}, function () { | ||
@@ -432,20 +436,21 @@ return 0; | ||
var toString = function toString(value) { | ||
var toLowerCase = function toLowerCase(value) { | ||
return String(value).toLowerCase(); | ||
}; | ||
var applyFilter = function applyFilter(filter, value) { | ||
return toString(value).indexOf(toString(filter.value)) > -1; | ||
var defaultPredicate = function defaultPredicate(value, filter) { | ||
return toLowerCase(value).indexOf(toLowerCase(filter.value)) > -1; | ||
}; | ||
var filteredRows = function filteredRows(rows, filters, getCellData, userFilterFn) { | ||
var filteredRows = function filteredRows(rows, filters, getCellValue, getColumnPredicate) { | ||
if (!filters.length) return rows; | ||
var filterFn = userFilterFn || function (row, filter) { | ||
return applyFilter(filter, getCellData(row, filter.columnName)); | ||
}; | ||
return rows.filter(function (row) { | ||
return filters.reduce(function (acc, filter) { | ||
var columnName = filter.columnName, | ||
filterConfig = objectWithoutProperties(filter, ["columnName"]); | ||
return rows.filter(function (row) { | ||
return filters.reduce(function (accumulator, filter) { | ||
return accumulator && filterFn(row, filter); | ||
var predicate = getColumnPredicate && getColumnPredicate(columnName) || defaultPredicate; | ||
return acc && predicate(getCellValue(row, columnName), filterConfig, row); | ||
}, true); | ||
@@ -457,13 +462,34 @@ }); | ||
var groupedRows = function groupedRows(rows, grouping, getCellData) { | ||
var defaultColumnIdentity = function defaultColumnIdentity(value) { | ||
return { | ||
key: String(value), | ||
value: value | ||
}; | ||
}; | ||
var groupedRows = function groupedRows(rows, grouping, getCellValue, getColumnIdentity) { | ||
if (!grouping.length) return rows; | ||
var columnGrouping = grouping[0]; | ||
var columnName = columnGrouping.columnName; | ||
var groupIdentity = getColumnIdentity && getColumnIdentity(columnName) || defaultColumnIdentity; | ||
var groups = rows.reduce(function (acc, row) { | ||
var value = getCellData(row, grouping[0].columnName); | ||
var key = String(value); | ||
var cellValue = getCellValue(row, columnName); | ||
var group = groupIdentity(cellValue, row); | ||
var key = group.key; | ||
var value = group.value; | ||
if (!value) { | ||
value = key; | ||
} | ||
var sameKeyItems = acc.get(key); | ||
if (!sameKeyItems) { | ||
acc.set(key, [value, [row]]); | ||
acc.set(key, [value, key, [row]]); | ||
} else { | ||
sameKeyItems[1].push(row); | ||
sameKeyItems[2].push(row); | ||
} | ||
@@ -475,9 +501,11 @@ return acc; | ||
return [].concat(toConsumableArray(groups.values())).map(function (_ref) { | ||
var _ref2 = slicedToArray(_ref, 2), | ||
var _ref2 = slicedToArray(_ref, 3), | ||
value = _ref2[0], | ||
items = _ref2[1]; | ||
key = _ref2[1], | ||
items = _ref2[2]; | ||
return { | ||
value: value, | ||
items: groupedRows(items, nestedGrouping, getCellData) | ||
key: key, | ||
items: groupedRows(items, nestedGrouping, getCellValue, getColumnIdentity) | ||
}; | ||
@@ -495,6 +523,7 @@ }); | ||
var value = _ref3.value, | ||
groupKey = _ref3.key, | ||
items = _ref3.items; | ||
var groupedBy = grouping[0].columnName; | ||
var key = '' + keyPrefix + String(value); | ||
var key = '' + keyPrefix + groupKey; | ||
var expanded = expandedGroups.has(key); | ||
@@ -1036,8 +1065,11 @@ return [].concat(toConsumableArray(acc), [{ | ||
var tableColumnsWithDraftGrouping = function tableColumnsWithDraftGrouping(tableColumns, draftGrouping) { | ||
var tableColumnsWithDraftGrouping = function tableColumnsWithDraftGrouping(tableColumns, draftGrouping, showColumnWhenGrouped) { | ||
return tableColumns.reduce(function (acc, tableColumn) { | ||
var isDataColumn = tableColumn.type === TABLE_DATA_TYPE; | ||
var tableColumnName = isDataColumn ? tableColumn.column.name : ''; | ||
var columnDraftGrouping = draftGrouping.find(function (grouping) { | ||
return tableColumn.type === TABLE_DATA_TYPE && grouping.columnName === tableColumn.column.name; | ||
return grouping.columnName === tableColumnName; | ||
}); | ||
if (!columnDraftGrouping) { | ||
if (!columnDraftGrouping || showColumnWhenGrouped(tableColumnName)) { | ||
return [].concat(toConsumableArray(acc), [tableColumn]); | ||
@@ -1053,3 +1085,3 @@ } else if (columnDraftGrouping.mode === 'remove' || columnDraftGrouping.mode === 'add') { | ||
var tableColumnsWithGrouping = function tableColumnsWithGrouping(tableColumns, grouping, draftGrouping, groupIndentColumnWidth) { | ||
var tableColumnsWithGrouping = function tableColumnsWithGrouping(tableColumns, grouping, draftGrouping, groupIndentColumnWidth, showColumnWhenGrouped) { | ||
return [].concat(toConsumableArray(grouping.map(function (columnGrouping) { | ||
@@ -1065,3 +1097,3 @@ var groupedColumn = tableColumns.find(function (tableColumn) { | ||
}; | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, draftGrouping))); | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, draftGrouping, showColumnWhenGrouped))); | ||
}; | ||
@@ -1068,0 +1100,0 @@ |
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-09-18 | ||
* Version: 1.0.0-alpha.10 | ||
* Generated: 2017-10-04 | ||
* Version: 1.0.0-alpha.11 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -368,23 +368,27 @@ */ | ||
var createSortingCompare = function createSortingCompare(sorting, compareEqual, getCellData) { | ||
return function (a, b) { | ||
var inverse = sorting.direction === 'desc'; | ||
var columnName = sorting.columnName; | ||
var defaultCompare = function defaultCompare(a, b) { | ||
if (a < b) return -1; | ||
if (a > b) return 1; | ||
return 0; | ||
}; | ||
var aValue = getCellData(a, columnName); | ||
var bValue = getCellData(b, columnName); | ||
var sortedRows = function sortedRows(rows, sorting, getCellValue, getColumnCompare) { | ||
if (!sorting.length) return rows; | ||
if (aValue === bValue) { | ||
return compareEqual && compareEqual(a, b) || 0; | ||
} | ||
var compare = Array.from(sorting).reverse().reduce(function (prevCompare, columnSorting) { | ||
var columnName = columnSorting.columnName; | ||
return aValue < bValue ^ inverse ? -1 : 1; // eslint-disable-line no-bitwise | ||
}; | ||
}; | ||
var inverse = columnSorting.direction === 'desc'; | ||
var columnCompare = getColumnCompare && getColumnCompare(columnName) || defaultCompare; | ||
var sortedRows = function sortedRows(rows, sorting, getCellData) { | ||
if (!sorting.length) return rows; | ||
return function (aRow, bRow) { | ||
var a = getCellValue(aRow, columnName); | ||
var b = getCellValue(bRow, columnName); | ||
var result = columnCompare(a, b); | ||
var compare = Array.from(sorting).reverse().reduce(function (prevCompare, columnSorting) { | ||
return createSortingCompare(columnSorting, prevCompare, getCellData); | ||
if (result !== 0) { | ||
return inverse ? -result : result; | ||
} | ||
return prevCompare(aRow, bRow); | ||
}; | ||
}, function () { | ||
@@ -436,20 +440,21 @@ return 0; | ||
var toString = function toString(value) { | ||
var toLowerCase = function toLowerCase(value) { | ||
return String(value).toLowerCase(); | ||
}; | ||
var applyFilter = function applyFilter(filter, value) { | ||
return toString(value).indexOf(toString(filter.value)) > -1; | ||
var defaultPredicate = function defaultPredicate(value, filter) { | ||
return toLowerCase(value).indexOf(toLowerCase(filter.value)) > -1; | ||
}; | ||
var filteredRows = function filteredRows(rows, filters, getCellData, userFilterFn) { | ||
var filteredRows = function filteredRows(rows, filters, getCellValue, getColumnPredicate) { | ||
if (!filters.length) return rows; | ||
var filterFn = userFilterFn || function (row, filter) { | ||
return applyFilter(filter, getCellData(row, filter.columnName)); | ||
}; | ||
return rows.filter(function (row) { | ||
return filters.reduce(function (acc, filter) { | ||
var columnName = filter.columnName, | ||
filterConfig = objectWithoutProperties(filter, ["columnName"]); | ||
return rows.filter(function (row) { | ||
return filters.reduce(function (accumulator, filter) { | ||
return accumulator && filterFn(row, filter); | ||
var predicate = getColumnPredicate && getColumnPredicate(columnName) || defaultPredicate; | ||
return acc && predicate(getCellValue(row, columnName), filterConfig, row); | ||
}, true); | ||
@@ -461,13 +466,34 @@ }); | ||
var groupedRows = function groupedRows(rows, grouping, getCellData) { | ||
var defaultColumnIdentity = function defaultColumnIdentity(value) { | ||
return { | ||
key: String(value), | ||
value: value | ||
}; | ||
}; | ||
var groupedRows = function groupedRows(rows, grouping, getCellValue, getColumnIdentity) { | ||
if (!grouping.length) return rows; | ||
var columnGrouping = grouping[0]; | ||
var columnName = columnGrouping.columnName; | ||
var groupIdentity = getColumnIdentity && getColumnIdentity(columnName) || defaultColumnIdentity; | ||
var groups = rows.reduce(function (acc, row) { | ||
var value = getCellData(row, grouping[0].columnName); | ||
var key = String(value); | ||
var cellValue = getCellValue(row, columnName); | ||
var group = groupIdentity(cellValue, row); | ||
var key = group.key; | ||
var value = group.value; | ||
if (!value) { | ||
value = key; | ||
} | ||
var sameKeyItems = acc.get(key); | ||
if (!sameKeyItems) { | ||
acc.set(key, [value, [row]]); | ||
acc.set(key, [value, key, [row]]); | ||
} else { | ||
sameKeyItems[1].push(row); | ||
sameKeyItems[2].push(row); | ||
} | ||
@@ -479,9 +505,11 @@ return acc; | ||
return [].concat(toConsumableArray(groups.values())).map(function (_ref) { | ||
var _ref2 = slicedToArray(_ref, 2), | ||
var _ref2 = slicedToArray(_ref, 3), | ||
value = _ref2[0], | ||
items = _ref2[1]; | ||
key = _ref2[1], | ||
items = _ref2[2]; | ||
return { | ||
value: value, | ||
items: groupedRows(items, nestedGrouping, getCellData) | ||
key: key, | ||
items: groupedRows(items, nestedGrouping, getCellValue, getColumnIdentity) | ||
}; | ||
@@ -499,6 +527,7 @@ }); | ||
var value = _ref3.value, | ||
groupKey = _ref3.key, | ||
items = _ref3.items; | ||
var groupedBy = grouping[0].columnName; | ||
var key = '' + keyPrefix + String(value); | ||
var key = '' + keyPrefix + groupKey; | ||
var expanded = expandedGroups.has(key); | ||
@@ -1040,8 +1069,11 @@ return [].concat(toConsumableArray(acc), [{ | ||
var tableColumnsWithDraftGrouping = function tableColumnsWithDraftGrouping(tableColumns, draftGrouping) { | ||
var tableColumnsWithDraftGrouping = function tableColumnsWithDraftGrouping(tableColumns, draftGrouping, showColumnWhenGrouped) { | ||
return tableColumns.reduce(function (acc, tableColumn) { | ||
var isDataColumn = tableColumn.type === TABLE_DATA_TYPE; | ||
var tableColumnName = isDataColumn ? tableColumn.column.name : ''; | ||
var columnDraftGrouping = draftGrouping.find(function (grouping) { | ||
return tableColumn.type === TABLE_DATA_TYPE && grouping.columnName === tableColumn.column.name; | ||
return grouping.columnName === tableColumnName; | ||
}); | ||
if (!columnDraftGrouping) { | ||
if (!columnDraftGrouping || showColumnWhenGrouped(tableColumnName)) { | ||
return [].concat(toConsumableArray(acc), [tableColumn]); | ||
@@ -1057,3 +1089,3 @@ } else if (columnDraftGrouping.mode === 'remove' || columnDraftGrouping.mode === 'add') { | ||
var tableColumnsWithGrouping = function tableColumnsWithGrouping(tableColumns, grouping, draftGrouping, groupIndentColumnWidth) { | ||
var tableColumnsWithGrouping = function tableColumnsWithGrouping(tableColumns, grouping, draftGrouping, groupIndentColumnWidth, showColumnWhenGrouped) { | ||
return [].concat(toConsumableArray(grouping.map(function (columnGrouping) { | ||
@@ -1069,3 +1101,3 @@ var groupedColumn = tableColumns.find(function (tableColumn) { | ||
}; | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, draftGrouping))); | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, draftGrouping, showColumnWhenGrouped))); | ||
}; | ||
@@ -1072,0 +1104,0 @@ |
{ | ||
"name": "@devexpress/dx-grid-core", | ||
"version": "1.0.0-alpha.10", | ||
"version": "1.0.0-alpha.11", | ||
"description": "Core library for the DevExtreme Reactive Grid component", | ||
@@ -39,8 +39,8 @@ "author": { | ||
"lint": "eslint src/**/*", | ||
"lint:fix": "npm run -s lint -- --fix" | ||
"lint:fix": "yarn run lint -- --fix" | ||
}, | ||
"devDependencies": { | ||
"@devexpress/dx-core": "1.0.0-alpha.10", | ||
"@devexpress/dx-core": "1.0.0-alpha.11", | ||
"babel-core": "^6.26.0", | ||
"babel-jest": "^21.0.2", | ||
"babel-jest": "^21.2.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
@@ -51,8 +51,8 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"core-js": "^2.5.1", | ||
"eslint": "^4.7.0", | ||
"eslint-config-airbnb-base": "^12.0.0", | ||
"eslint": "^4.8.0", | ||
"eslint-config-airbnb-base": "^12.0.1", | ||
"eslint-plugin-filenames": "^1.2.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jest": "^21.1.0", | ||
"jest": "^21.1.0", | ||
"eslint-plugin-jest": "^21.2.0", | ||
"jest": "^21.2.1", | ||
"rollup": "^0.50.0", | ||
@@ -64,4 +64,4 @@ "rollup-plugin-babel": "^3.0.2", | ||
"peerDependencies": { | ||
"@devexpress/dx-core": "1.0.0-alpha.10" | ||
"@devexpress/dx-core": "1.0.0-alpha.11" | ||
} | ||
} |
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
236750
2380