@devexpress/dx-grid-core
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-rc.1
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-12-28 | ||
* Version: 1.0.0-beta.3 | ||
* Generated: 2018-01-18 | ||
* Version: 1.0.0-rc.1 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -47,3 +47,3 @@ */ | ||
var setColumnSorting = function setColumnSorting(state, _ref) { | ||
var changeColumnSorting = function changeColumnSorting(state, _ref) { | ||
var columnName = _ref.columnName, | ||
@@ -517,3 +517,3 @@ direction = _ref.direction, | ||
var setColumnFilter = function setColumnFilter(filters, _ref) { | ||
var changeColumnFilter = function changeColumnFilter(filters, _ref) { | ||
var columnName = _ref.columnName, | ||
@@ -631,12 +631,9 @@ config = _ref.config; | ||
var GROUP_KEY_SEPARATOR = '|'; | ||
var GROUP_ADD_MODE = 'add'; | ||
var GROUP_REMOVE_MODE = 'remove'; | ||
var GROUP_REORDER_MODE = 'reorder'; | ||
var groupByColumn = function groupByColumn(state, _ref) { | ||
var applyColumnGrouping = function applyColumnGrouping(grouping, _ref) { | ||
var columnName = _ref.columnName, | ||
groupIndex = _ref.groupIndex; | ||
var grouping = state.grouping.slice(); | ||
var groupingIndex = grouping.findIndex(function (g) { | ||
var nextGrouping = grouping.slice(); | ||
var groupingIndex = nextGrouping.findIndex(function (g) { | ||
return g.columnName === columnName; | ||
@@ -647,9 +644,9 @@ }); | ||
if (groupingIndex > -1) { | ||
grouping.splice(groupingIndex, 1); | ||
nextGrouping.splice(groupingIndex, 1); | ||
} else if (groupIndex === undefined) { | ||
targetIndex = grouping.length; | ||
targetIndex = nextGrouping.length; | ||
} | ||
if (targetIndex > -1) { | ||
grouping.splice(targetIndex, 0, { | ||
nextGrouping.splice(targetIndex, 0, { | ||
columnName: columnName | ||
@@ -659,17 +656,28 @@ }); | ||
var ungroupedColumnIndex = state.grouping.findIndex(function (group, index) { | ||
return !grouping[index] || group.columnName !== grouping[index].columnName; | ||
return nextGrouping; | ||
}; | ||
var changeColumnGrouping = function changeColumnGrouping(_ref2, _ref3) { | ||
var grouping = _ref2.grouping, | ||
expandedGroups = _ref2.expandedGroups; | ||
var columnName = _ref3.columnName, | ||
groupIndex = _ref3.groupIndex; | ||
var nextGrouping = applyColumnGrouping(grouping, { columnName: columnName, groupIndex: groupIndex }); | ||
var ungroupedColumnIndex = grouping.findIndex(function (group, index) { | ||
return !nextGrouping[index] || group.columnName !== nextGrouping[index].columnName; | ||
}); | ||
if (ungroupedColumnIndex === -1) { | ||
return { | ||
grouping: grouping | ||
grouping: nextGrouping | ||
}; | ||
} | ||
var filteredExpandedGroups = state.expandedGroups.filter(function (group) { | ||
var filteredExpandedGroups = expandedGroups.filter(function (group) { | ||
return group.split(GROUP_KEY_SEPARATOR).length <= ungroupedColumnIndex; | ||
}); | ||
if (filteredExpandedGroups.length === state.expandedGroups.length) { | ||
if (filteredExpandedGroups.length === expandedGroups.length) { | ||
return { | ||
grouping: grouping | ||
grouping: nextGrouping | ||
}; | ||
@@ -679,3 +687,3 @@ } | ||
return { | ||
grouping: grouping, | ||
grouping: nextGrouping, | ||
expandedGroups: filteredExpandedGroups | ||
@@ -685,4 +693,4 @@ }; | ||
var toggleExpandedGroups = function toggleExpandedGroups(state, _ref2) { | ||
var groupKey = _ref2.groupKey; | ||
var toggleExpandedGroups = function toggleExpandedGroups(state, _ref4) { | ||
var groupKey = _ref4.groupKey; | ||
@@ -703,37 +711,18 @@ var expandedGroups = state.expandedGroups.slice(); | ||
var draftGroupingChange = function draftGroupingChange(state, _ref3) { | ||
var columnName = _ref3.columnName, | ||
groupIndex = _ref3.groupIndex; | ||
return { groupingChange: { columnName: columnName, groupIndex: groupIndex } }; | ||
var draftColumnGrouping = function draftColumnGrouping(_ref5, _ref6) { | ||
var grouping = _ref5.grouping, | ||
draftGrouping = _ref5.draftGrouping; | ||
var columnName = _ref6.columnName, | ||
groupIndex = _ref6.groupIndex; | ||
return { | ||
draftGrouping: applyColumnGrouping(draftGrouping || grouping, { columnName: columnName, groupIndex: groupIndex }) | ||
}; | ||
}; | ||
var cancelGroupingChange = function cancelGroupingChange() { | ||
return { groupingChange: null }; | ||
var cancelColumnGroupingDraft = function cancelColumnGroupingDraft() { | ||
return { | ||
draftGrouping: null | ||
}; | ||
}; | ||
var draftGrouping = function draftGrouping(grouping, groupingChange) { | ||
if (!groupingChange) return grouping; | ||
var columnName = groupingChange.columnName, | ||
groupIndex = groupingChange.groupIndex; | ||
var result = grouping.slice(); | ||
if (groupIndex !== -1) { | ||
result = result.filter(function (g) { | ||
return g.columnName !== columnName; | ||
}); | ||
result.splice(groupIndex, 0, { | ||
columnName: columnName, | ||
draft: grouping.length > result.length ? GROUP_REORDER_MODE : GROUP_ADD_MODE | ||
}); | ||
} else { | ||
result = result.map(function (g) { | ||
return g.columnName === columnName ? { columnName: columnName, draft: GROUP_REMOVE_MODE } : g; | ||
}); | ||
} | ||
return result; | ||
}; | ||
var GRID_GROUP_TYPE = 'group'; | ||
@@ -805,2 +794,3 @@ var GRID_GROUP_CHECK = Symbol(GRID_GROUP_TYPE + '_check'); | ||
}); | ||
var expandedGroupsSet = new Set(expandedGroups); | ||
var currentGroupExpanded = true; | ||
@@ -824,3 +814,3 @@ var currentGroupLevel = 0; | ||
currentGroupExpanded = expandedGroups.has(row.compoundKey); | ||
currentGroupExpanded = expandedGroupsSet.has(row.compoundKey); | ||
currentGroupLevel = groupLevel; | ||
@@ -882,15 +872,30 @@ | ||
var groupingPanelItems = function groupingPanelItems(columns, grouping) { | ||
return grouping.map(function (_ref) { | ||
var columnName = _ref.columnName, | ||
draft = _ref.draft; | ||
var column = columns.find(function (c) { | ||
return c.name === columnName; | ||
}); | ||
var groupingPanelItems = function groupingPanelItems(columns, grouping, draftGrouping) { | ||
var items = draftGrouping.map(function (_ref) { | ||
var columnName = _ref.columnName; | ||
return { | ||
column: column, | ||
draft: draft | ||
column: columns.find(function (c) { | ||
return c.name === columnName; | ||
}), | ||
draft: !grouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
}) | ||
}; | ||
}); | ||
grouping.forEach(function (_ref2, index) { | ||
var columnName = _ref2.columnName; | ||
if (draftGrouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
})) return; | ||
items.splice(index, 0, { | ||
column: columns.find(function (c) { | ||
return c.name === columnName; | ||
}), | ||
draft: true | ||
}); | ||
}); | ||
return items; | ||
}; | ||
@@ -974,43 +979,17 @@ | ||
var setRowSelection = function setRowSelection(selection, _ref) { | ||
var rowId = _ref.rowId, | ||
selected = _ref.selected; | ||
var toggleSelection = function toggleSelection(selection, _ref) { | ||
var rowIds = _ref.rowIds, | ||
state = _ref.state; | ||
var selectedRows = selection.slice(); | ||
var selectedIndex = selectedRows.indexOf(rowId); | ||
var isRowSelected = selected; | ||
if (isRowSelected === undefined) { | ||
isRowSelected = selectedIndex === -1; | ||
} | ||
if (selectedIndex > -1 && !isRowSelected) { | ||
selectedRows.splice(selectedIndex, 1); | ||
} else if (selectedIndex === -1 && isRowSelected) { | ||
selectedRows.push(rowId); | ||
} | ||
return selectedRows; | ||
}; | ||
var setRowsSelection = function setRowsSelection(selection, _ref2) { | ||
var rowIds = _ref2.rowIds, | ||
selected = _ref2.selected; | ||
if (rowIds.length === 1) { | ||
return setRowSelection(selection, { rowId: rowIds[0], selected: selected }); | ||
} | ||
var rowIdsSet = new Set(rowIds); | ||
var isRowsSelected = selected; | ||
if (isRowsSelected === undefined) { | ||
var rowsState = state; | ||
if (rowsState === undefined) { | ||
var availableSelection = selection.filter(function (rowId) { | ||
return rowIdsSet.has(rowId); | ||
}); | ||
isRowsSelected = availableSelection.length !== rowIdsSet.size; | ||
rowsState = availableSelection.length !== rowIdsSet.size; | ||
} | ||
if (isRowsSelected) { | ||
if (rowsState) { | ||
var selectionSet = new Set(selection); | ||
@@ -1042,6 +1021,9 @@ return [].concat(toConsumableArray(selection), toConsumableArray(rowIds.filter(function (rowId) { | ||
availableToSelect = _ref.availableToSelect; | ||
return availableToSelect.length !== 0 && selection.size !== 0 && availableToSelect.some(function (elem) { | ||
return selection.has(elem); | ||
var selectionSet = new Set(selection); | ||
return availableToSelect.length !== 0 && selectionSet.size !== 0 && availableToSelect.some(function (elem) { | ||
return selectionSet.has(elem); | ||
}) && availableToSelect.some(function (elem) { | ||
return !selection.has(elem); | ||
return !selectionSet.has(elem); | ||
}); | ||
@@ -1053,17 +1035,20 @@ }; | ||
availableToSelect = _ref2.availableToSelect; | ||
return selection.size !== 0 && availableToSelect.length !== 0 && !availableToSelect.some(function (elem) { | ||
return !selection.has(elem); | ||
var selectionSet = new Set(selection); | ||
return selectionSet.size !== 0 && availableToSelect.length !== 0 && !availableToSelect.some(function (elem) { | ||
return !selectionSet.has(elem); | ||
}); | ||
}; | ||
var startEditRows = function startEditRows(prevEditingRows, _ref) { | ||
var startEditRows = function startEditRows(prevEditingRowIds, _ref) { | ||
var rowIds = _ref.rowIds; | ||
return [].concat(toConsumableArray(prevEditingRows), toConsumableArray(rowIds)); | ||
return [].concat(toConsumableArray(prevEditingRowIds), toConsumableArray(rowIds)); | ||
}; | ||
var stopEditRows = function stopEditRows(prevEditingRows, _ref2) { | ||
var stopEditRows = function stopEditRows(prevEditingRowIds, _ref2) { | ||
var rowIds = _ref2.rowIds; | ||
var rowIdSet = new Set(rowIds); | ||
return prevEditingRows.filter(function (id) { | ||
return prevEditingRowIds.filter(function (id) { | ||
return !rowIdSet.has(id); | ||
@@ -1102,14 +1087,14 @@ }); | ||
var changeRow = function changeRow(prevChangedRows, _ref6) { | ||
var changeRow = function changeRow(prevRowChanges, _ref6) { | ||
var rowId = _ref6.rowId, | ||
change = _ref6.change; | ||
var prevChange = prevChangedRows[rowId] || {}; | ||
return _extends({}, prevChangedRows, defineProperty({}, rowId, _extends({}, prevChange, change))); | ||
var prevChange = prevRowChanges[rowId] || {}; | ||
return _extends({}, prevRowChanges, defineProperty({}, rowId, _extends({}, prevChange, change))); | ||
}; | ||
var cancelChanges = function cancelChanges(prevChangedRows, _ref7) { | ||
var cancelChanges = function cancelChanges(prevRowChanges, _ref7) { | ||
var rowIds = _ref7.rowIds; | ||
var result = _extends({}, prevChangedRows); | ||
var result = _extends({}, prevRowChanges); | ||
rowIds.forEach(function (rowId) { | ||
@@ -1121,12 +1106,12 @@ delete result[rowId]; | ||
var deleteRows = function deleteRows(deletedRows, _ref8) { | ||
var deleteRows = function deleteRows(deletedRowIds, _ref8) { | ||
var rowIds = _ref8.rowIds; | ||
return [].concat(toConsumableArray(deletedRows), toConsumableArray(rowIds)); | ||
return [].concat(toConsumableArray(deletedRowIds), toConsumableArray(rowIds)); | ||
}; | ||
var cancelDeletedRows = function cancelDeletedRows(deletedRows, _ref9) { | ||
var cancelDeletedRows = function cancelDeletedRows(deletedRowIds, _ref9) { | ||
var rowIds = _ref9.rowIds; | ||
var rowIdSet = new Set(rowIds); | ||
return deletedRows.filter(function (rowId) { | ||
return deletedRowIds.filter(function (rowId) { | ||
return !rowIdSet.has(rowId); | ||
@@ -1177,4 +1162,4 @@ }); | ||
var getRowChange = function getRowChange(changedRows, rowId) { | ||
return changedRows[rowId] || {}; | ||
var getRowChange = function getRowChange(rowChanges, rowId) { | ||
return rowChanges[rowId] || {}; | ||
}; | ||
@@ -1241,3 +1226,7 @@ | ||
var columnName = tableColumn.column.name; | ||
var width = draftColumnWidths[columnName] || columnWidths[columnName]; | ||
var isCurrentColumn = function isCurrentColumn(elem) { | ||
return elem.columnName === columnName; | ||
}; | ||
var column = draftColumnWidths.find(isCurrentColumn) || columnWidths.find(isCurrentColumn); | ||
var width = column && column.width; | ||
if (width === undefined) { | ||
@@ -1256,34 +1245,41 @@ throw new Error(UNSET_COLUMN_WIDTH_ERROR.replace('$1', columnName)); | ||
var changeTableColumnWidths = function changeTableColumnWidths(state, _ref) { | ||
var shifts = _ref.shifts; | ||
var changeTableColumnWidth = function changeTableColumnWidth(state, _ref) { | ||
var columnName = _ref.columnName, | ||
shift = _ref.shift; | ||
var columnWidths = state.columnWidths; | ||
var updatedColumnWidths = Object.keys(shifts).reduce(function (acc, columnName) { | ||
var size = Math.max(MIN_SIZE, columnWidths[columnName] + shifts[columnName]); | ||
return Object.assign(acc, defineProperty({}, columnName, size)); | ||
}, {}); | ||
return _extends({}, state, { | ||
columnWidths: _extends({}, columnWidths, updatedColumnWidths), | ||
draftColumnWidths: {} | ||
var nextColumnWidth = columnWidths.slice(); | ||
var index = nextColumnWidth.findIndex(function (elem) { | ||
return elem.columnName === columnName; | ||
}); | ||
var updatedColumn = nextColumnWidth[index]; | ||
var size = Math.max(MIN_SIZE, updatedColumn.width + shift); | ||
nextColumnWidth.splice(index, 1, { columnName: columnName, width: size }); | ||
return { | ||
columnWidths: nextColumnWidth | ||
}; | ||
}; | ||
var changeDraftTableColumnWidths = function changeDraftTableColumnWidths(state, _ref2) { | ||
var shifts = _ref2.shifts; | ||
var columnWidths = state.columnWidths, | ||
draftColumnWidths = state.draftColumnWidths; | ||
var draftTableColumnWidth = function draftTableColumnWidth(state, _ref2) { | ||
var columnName = _ref2.columnName, | ||
shift = _ref2.shift; | ||
var columnWidths = state.columnWidths; | ||
var updatedDraftColumnWidths = Object.keys(shifts).reduce(function (acc, columnName) { | ||
if (shifts[columnName] === null) { | ||
delete acc[columnName]; | ||
return acc; | ||
} | ||
var size = Math.max(MIN_SIZE, columnWidths[columnName] + shifts[columnName]); | ||
return Object.assign(acc, defineProperty({}, columnName, size)); | ||
}, Object.assign({}, draftColumnWidths)); | ||
return _extends({}, state, { | ||
draftColumnWidths: updatedDraftColumnWidths | ||
var updatedColumn = columnWidths.find(function (elem) { | ||
return elem.columnName === columnName; | ||
}); | ||
var size = Math.max(MIN_SIZE, updatedColumn.width + shift); | ||
return { | ||
draftColumnWidths: [{ columnName: updatedColumn.columnName, width: size }] | ||
}; | ||
}; | ||
var cancelTableColumnWidthDraft = function cancelTableColumnWidthDraft() { | ||
return { | ||
draftColumnWidths: [] | ||
}; | ||
}; | ||
var TABLE_EDIT_COMMAND_TYPE = 'editCommand'; | ||
@@ -1317,4 +1313,4 @@ | ||
var tableRowsWithEditing = function tableRowsWithEditing(tableRows, editingRows, addedRows, rowHeight) { | ||
var rowIds = new Set(editingRows); | ||
var tableRowsWithEditing = function tableRowsWithEditing(tableRows, editingRowIds, addedRows, rowHeight) { | ||
var rowIds = new Set(editingRowIds); | ||
var editedTableRows = tableRows.map(function (tableRow) { | ||
@@ -1365,20 +1361,23 @@ return tableRow.type === TABLE_DATA_TYPE && rowIds.has(tableRow.rowId) ? _extends({}, tableRow, { | ||
var isGroupingChange = function isGroupingChange(columnDraftGrouping) { | ||
return columnDraftGrouping.draft === GROUP_REMOVE_MODE || columnDraftGrouping.draft === GROUP_ADD_MODE; | ||
}; | ||
var tableColumnsWithDraftGrouping = function tableColumnsWithDraftGrouping(tableColumns, grouping, draftGrouping, showColumnWhenGrouped) { | ||
return tableColumns.reduce(function (acc, tableColumn) { | ||
if (tableColumn.type !== TABLE_DATA_TYPE) { | ||
acc.push(tableColumn); | ||
return acc; | ||
} | ||
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 grouping.columnName === tableColumnName; | ||
var columnName = tableColumn.column.name; | ||
var columnGroupingExists = grouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
}); | ||
var columnDraftGroupingExists = draftGrouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
}); | ||
if (!columnDraftGrouping || showColumnWhenGrouped(tableColumnName)) { | ||
return [].concat(toConsumableArray(acc), [tableColumn]); | ||
} else if (isGroupingChange(columnDraftGrouping)) { | ||
return [].concat(toConsumableArray(acc), [_extends({}, tableColumn, { | ||
if (!columnGroupingExists && !columnDraftGroupingExists || showColumnWhenGrouped(columnName)) { | ||
acc.push(tableColumn); | ||
} else if (!columnGroupingExists && columnDraftGroupingExists || columnGroupingExists && !columnDraftGroupingExists) { | ||
acc.push(_extends({}, tableColumn, { | ||
draft: true | ||
})]); | ||
})); | ||
} | ||
@@ -1400,3 +1399,3 @@ return acc; | ||
}; | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, draftGrouping, showColumnWhenGrouped))); | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, grouping, draftGrouping, showColumnWhenGrouped))); | ||
}; | ||
@@ -1431,4 +1430,4 @@ | ||
var isDetailRowExpanded = function isDetailRowExpanded(expandedRows, rowId) { | ||
return expandedRows.indexOf(rowId) > -1; | ||
var isDetailRowExpanded = function isDetailRowExpanded(expandedRowIds, rowId) { | ||
return expandedRowIds.indexOf(rowId) > -1; | ||
}; | ||
@@ -1442,22 +1441,22 @@ var isDetailToggleTableCell = function isDetailToggleTableCell(tableRow, tableColumn) { | ||
var setDetailRowExpanded = function setDetailRowExpanded(prevExpanded, _ref) { | ||
var toggleDetailRowExpanded = function toggleDetailRowExpanded(prevExpanded, _ref) { | ||
var rowId = _ref.rowId, | ||
isExpanded = _ref.isExpanded; | ||
state = _ref.state; | ||
var expandedRows = prevExpanded.slice(); | ||
var expandedIndex = expandedRows.indexOf(rowId); | ||
var isRowExpanded = isExpanded !== undefined ? isExpanded : expandedIndex === -1; | ||
var expandedRowIds = prevExpanded.slice(); | ||
var expandedIndex = expandedRowIds.indexOf(rowId); | ||
var rowState = state !== undefined ? state : expandedIndex === -1; | ||
if (expandedIndex > -1 && !isRowExpanded) { | ||
expandedRows.splice(expandedIndex, 1); | ||
} else if (expandedIndex === -1 && isRowExpanded) { | ||
expandedRows.push(rowId); | ||
if (expandedIndex > -1 && !rowState) { | ||
expandedRowIds.splice(expandedIndex, 1); | ||
} else if (expandedIndex === -1 && rowState) { | ||
expandedRowIds.push(rowId); | ||
} | ||
return expandedRows; | ||
return expandedRowIds; | ||
}; | ||
var tableRowsWithExpandedDetail = function tableRowsWithExpandedDetail(tableRows, expandedRows, rowHeight) { | ||
var tableRowsWithExpandedDetail = function tableRowsWithExpandedDetail(tableRows, expandedRowIds, rowHeight) { | ||
var result = tableRows; | ||
expandedRows.forEach(function (expandedRowId) { | ||
expandedRowIds.forEach(function (expandedRowId) { | ||
var rowIndex = result.findIndex(function (tableRow) { | ||
@@ -1554,16 +1553,22 @@ return tableRow.type === TABLE_DATA_TYPE && tableRow.rowId === expandedRowId; | ||
var visibleTableColumns = function visibleTableColumns(tableColumns, hiddenColumns) { | ||
var visibleTableColumns = function visibleTableColumns(tableColumns, hiddenColumnNames) { | ||
return tableColumns.filter(function (tableColumn) { | ||
return tableColumn.type !== TABLE_DATA_TYPE || hiddenColumns.indexOf(tableColumn.column.name) === -1; | ||
return tableColumn.type !== TABLE_DATA_TYPE || hiddenColumnNames.indexOf(tableColumn.column.name) === -1; | ||
}); | ||
}; | ||
var columnChooserItems = function columnChooserItems(columns, hiddenColumns) { | ||
var tableDataColumnsExist = function tableDataColumnsExist(tableColumns) { | ||
return tableColumns.some(function (column) { | ||
return column.type === TABLE_DATA_TYPE; | ||
}); | ||
}; | ||
var columnChooserItems = function columnChooserItems(columns, hiddenColumnNames) { | ||
return columns.map(function (column) { | ||
return { column: column, hidden: hiddenColumns.indexOf(column.name) !== -1 }; | ||
return { column: column, hidden: hiddenColumnNames.indexOf(column.name) !== -1 }; | ||
}); | ||
}; | ||
var toggleColumn = function toggleColumn(hiddenColumns, columnName) { | ||
return hiddenColumns.indexOf(columnName) === -1 ? [].concat(toConsumableArray(hiddenColumns), [columnName]) : hiddenColumns.filter(function (hiddenColumn) { | ||
var toggleColumn = function toggleColumn(hiddenColumnNames, columnName) { | ||
return hiddenColumnNames.indexOf(columnName) === -1 ? [].concat(toConsumableArray(hiddenColumnNames), [columnName]) : hiddenColumnNames.filter(function (hiddenColumn) { | ||
return hiddenColumn !== columnName; | ||
@@ -1789,3 +1794,3 @@ }); | ||
export { getColumnExtension, getTableRowColumnsWithColSpan, getTableColumnGeometries, getTableTargetColumnIndex, getAnimations, filterActiveAnimations, evalAnimations, getGroupCellTargetIndex, getMessagesFormatter, rowIdGetter, cellValueGetter, setColumnSorting, getColumnSortingDirection, sortedRows, setColumnFilter, getColumnFilterConfig, filteredRows, GROUP_KEY_SEPARATOR, GROUP_ADD_MODE, GROUP_REMOVE_MODE, GROUP_REORDER_MODE, groupByColumn, toggleExpandedGroups, draftGroupingChange, cancelGroupingChange, draftGrouping, groupRowChecker, groupRowLevelKeyGetter, groupedRows, expandedGroupRows, customGroupedRows, customGroupingRowIdGetter, groupingPanelItems, setCurrentPage, setPageSize, paginatedRows, rowsWithPageHeaders, pageCount, rowCount, firstRowOnPage, lastRowOnPage, setRowsSelection, getAvailableToSelect, someSelected, allSelected, startEditRows, stopEditRows, addRow, changeAddedRow, cancelAddedRows, changeRow, cancelChanges, deleteRows, cancelDeletedRows, changedRowsByIds, addedRowsByIds, createRowChangeGetter, getRowChange, TABLE_REORDERING_TYPE, changeColumnOrder, orderedColumns, tableHeaderRowsWithReordering, draftOrder, tableColumnsWithWidths, changeTableColumnWidths, changeDraftTableColumnWidths, TABLE_EDIT_COMMAND_TYPE, isHeadingEditCommandsTableCell, isEditCommandsTableCell, tableColumnsWithEditing, TABLE_ADDED_TYPE, TABLE_EDIT_TYPE, isEditTableCell, isAddedTableRow, isEditTableRow, tableRowsWithEditing, TABLE_FILTER_TYPE, isFilterTableCell, isFilterTableRow, tableHeaderRowsWithFilter, TABLE_GROUP_TYPE, isGroupTableCell, isGroupIndentTableCell, isGroupTableRow, tableColumnsWithGrouping, tableRowsWithGrouping, TABLE_HEADING_TYPE, isHeadingTableCell, isHeadingTableRow, tableRowsWithHeading, TABLE_DETAIL_TYPE, isDetailRowExpanded, isDetailToggleTableCell, isDetailTableRow, setDetailRowExpanded, tableRowsWithExpandedDetail, tableColumnsWithDetail, TABLE_SELECT_TYPE, isSelectTableCell, isSelectAllTableCell, tableColumnsWithSelection, TABLE_DATA_TYPE, TABLE_NODATA_TYPE, isNoDataTableRow, isDataTableCell, isHeaderStubTableCell, isDataTableRow, tableColumnsWithDataRows, tableRowsWithDataRows, visibleTableColumns, columnChooserItems, toggleColumn }; | ||
export { getColumnExtension, getTableRowColumnsWithColSpan, getTableColumnGeometries, getTableTargetColumnIndex, getAnimations, filterActiveAnimations, evalAnimations, getGroupCellTargetIndex, getMessagesFormatter, rowIdGetter, cellValueGetter, changeColumnSorting, getColumnSortingDirection, sortedRows, changeColumnFilter, getColumnFilterConfig, filteredRows, GROUP_KEY_SEPARATOR, changeColumnGrouping, toggleExpandedGroups, draftColumnGrouping, cancelColumnGroupingDraft, groupRowChecker, groupRowLevelKeyGetter, groupedRows, expandedGroupRows, customGroupedRows, customGroupingRowIdGetter, groupingPanelItems, setCurrentPage, setPageSize, paginatedRows, rowsWithPageHeaders, pageCount, rowCount, firstRowOnPage, lastRowOnPage, toggleSelection, getAvailableToSelect, someSelected, allSelected, startEditRows, stopEditRows, addRow, changeAddedRow, cancelAddedRows, changeRow, cancelChanges, deleteRows, cancelDeletedRows, changedRowsByIds, addedRowsByIds, createRowChangeGetter, getRowChange, TABLE_REORDERING_TYPE, changeColumnOrder, orderedColumns, tableHeaderRowsWithReordering, draftOrder, tableColumnsWithWidths, changeTableColumnWidth, draftTableColumnWidth, cancelTableColumnWidthDraft, TABLE_EDIT_COMMAND_TYPE, isHeadingEditCommandsTableCell, isEditCommandsTableCell, tableColumnsWithEditing, TABLE_ADDED_TYPE, TABLE_EDIT_TYPE, isEditTableCell, isAddedTableRow, isEditTableRow, tableRowsWithEditing, TABLE_FILTER_TYPE, isFilterTableCell, isFilterTableRow, tableHeaderRowsWithFilter, TABLE_GROUP_TYPE, isGroupTableCell, isGroupIndentTableCell, isGroupTableRow, tableColumnsWithGrouping, tableRowsWithGrouping, TABLE_HEADING_TYPE, isHeadingTableCell, isHeadingTableRow, tableRowsWithHeading, TABLE_DETAIL_TYPE, isDetailRowExpanded, isDetailToggleTableCell, isDetailTableRow, toggleDetailRowExpanded, tableRowsWithExpandedDetail, tableColumnsWithDetail, TABLE_SELECT_TYPE, isSelectTableCell, isSelectAllTableCell, tableColumnsWithSelection, TABLE_DATA_TYPE, TABLE_NODATA_TYPE, isNoDataTableRow, isDataTableCell, isHeaderStubTableCell, isDataTableRow, tableColumnsWithDataRows, tableRowsWithDataRows, visibleTableColumns, tableDataColumnsExist, columnChooserItems, toggleColumn }; | ||
//# sourceMappingURL=dx-grid-core.es.js.map |
/** | ||
* Bundle of @devexpress/dx-grid-core | ||
* Generated: 2017-12-28 | ||
* Version: 1.0.0-beta.3 | ||
* Generated: 2018-01-18 | ||
* Version: 1.0.0-rc.1 | ||
* License: https://js.devexpress.com/Licensing | ||
@@ -51,3 +51,3 @@ */ | ||
var setColumnSorting = function setColumnSorting(state, _ref) { | ||
var changeColumnSorting = function changeColumnSorting(state, _ref) { | ||
var columnName = _ref.columnName, | ||
@@ -521,3 +521,3 @@ direction = _ref.direction, | ||
var setColumnFilter = function setColumnFilter(filters, _ref) { | ||
var changeColumnFilter = function changeColumnFilter(filters, _ref) { | ||
var columnName = _ref.columnName, | ||
@@ -635,12 +635,9 @@ config = _ref.config; | ||
var GROUP_KEY_SEPARATOR = '|'; | ||
var GROUP_ADD_MODE = 'add'; | ||
var GROUP_REMOVE_MODE = 'remove'; | ||
var GROUP_REORDER_MODE = 'reorder'; | ||
var groupByColumn = function groupByColumn(state, _ref) { | ||
var applyColumnGrouping = function applyColumnGrouping(grouping, _ref) { | ||
var columnName = _ref.columnName, | ||
groupIndex = _ref.groupIndex; | ||
var grouping = state.grouping.slice(); | ||
var groupingIndex = grouping.findIndex(function (g) { | ||
var nextGrouping = grouping.slice(); | ||
var groupingIndex = nextGrouping.findIndex(function (g) { | ||
return g.columnName === columnName; | ||
@@ -651,9 +648,9 @@ }); | ||
if (groupingIndex > -1) { | ||
grouping.splice(groupingIndex, 1); | ||
nextGrouping.splice(groupingIndex, 1); | ||
} else if (groupIndex === undefined) { | ||
targetIndex = grouping.length; | ||
targetIndex = nextGrouping.length; | ||
} | ||
if (targetIndex > -1) { | ||
grouping.splice(targetIndex, 0, { | ||
nextGrouping.splice(targetIndex, 0, { | ||
columnName: columnName | ||
@@ -663,17 +660,28 @@ }); | ||
var ungroupedColumnIndex = state.grouping.findIndex(function (group, index) { | ||
return !grouping[index] || group.columnName !== grouping[index].columnName; | ||
return nextGrouping; | ||
}; | ||
var changeColumnGrouping = function changeColumnGrouping(_ref2, _ref3) { | ||
var grouping = _ref2.grouping, | ||
expandedGroups = _ref2.expandedGroups; | ||
var columnName = _ref3.columnName, | ||
groupIndex = _ref3.groupIndex; | ||
var nextGrouping = applyColumnGrouping(grouping, { columnName: columnName, groupIndex: groupIndex }); | ||
var ungroupedColumnIndex = grouping.findIndex(function (group, index) { | ||
return !nextGrouping[index] || group.columnName !== nextGrouping[index].columnName; | ||
}); | ||
if (ungroupedColumnIndex === -1) { | ||
return { | ||
grouping: grouping | ||
grouping: nextGrouping | ||
}; | ||
} | ||
var filteredExpandedGroups = state.expandedGroups.filter(function (group) { | ||
var filteredExpandedGroups = expandedGroups.filter(function (group) { | ||
return group.split(GROUP_KEY_SEPARATOR).length <= ungroupedColumnIndex; | ||
}); | ||
if (filteredExpandedGroups.length === state.expandedGroups.length) { | ||
if (filteredExpandedGroups.length === expandedGroups.length) { | ||
return { | ||
grouping: grouping | ||
grouping: nextGrouping | ||
}; | ||
@@ -683,3 +691,3 @@ } | ||
return { | ||
grouping: grouping, | ||
grouping: nextGrouping, | ||
expandedGroups: filteredExpandedGroups | ||
@@ -689,4 +697,4 @@ }; | ||
var toggleExpandedGroups = function toggleExpandedGroups(state, _ref2) { | ||
var groupKey = _ref2.groupKey; | ||
var toggleExpandedGroups = function toggleExpandedGroups(state, _ref4) { | ||
var groupKey = _ref4.groupKey; | ||
@@ -707,37 +715,18 @@ var expandedGroups = state.expandedGroups.slice(); | ||
var draftGroupingChange = function draftGroupingChange(state, _ref3) { | ||
var columnName = _ref3.columnName, | ||
groupIndex = _ref3.groupIndex; | ||
return { groupingChange: { columnName: columnName, groupIndex: groupIndex } }; | ||
var draftColumnGrouping = function draftColumnGrouping(_ref5, _ref6) { | ||
var grouping = _ref5.grouping, | ||
draftGrouping = _ref5.draftGrouping; | ||
var columnName = _ref6.columnName, | ||
groupIndex = _ref6.groupIndex; | ||
return { | ||
draftGrouping: applyColumnGrouping(draftGrouping || grouping, { columnName: columnName, groupIndex: groupIndex }) | ||
}; | ||
}; | ||
var cancelGroupingChange = function cancelGroupingChange() { | ||
return { groupingChange: null }; | ||
var cancelColumnGroupingDraft = function cancelColumnGroupingDraft() { | ||
return { | ||
draftGrouping: null | ||
}; | ||
}; | ||
var draftGrouping = function draftGrouping(grouping, groupingChange) { | ||
if (!groupingChange) return grouping; | ||
var columnName = groupingChange.columnName, | ||
groupIndex = groupingChange.groupIndex; | ||
var result = grouping.slice(); | ||
if (groupIndex !== -1) { | ||
result = result.filter(function (g) { | ||
return g.columnName !== columnName; | ||
}); | ||
result.splice(groupIndex, 0, { | ||
columnName: columnName, | ||
draft: grouping.length > result.length ? GROUP_REORDER_MODE : GROUP_ADD_MODE | ||
}); | ||
} else { | ||
result = result.map(function (g) { | ||
return g.columnName === columnName ? { columnName: columnName, draft: GROUP_REMOVE_MODE } : g; | ||
}); | ||
} | ||
return result; | ||
}; | ||
var GRID_GROUP_TYPE = 'group'; | ||
@@ -809,2 +798,3 @@ var GRID_GROUP_CHECK = Symbol(GRID_GROUP_TYPE + '_check'); | ||
}); | ||
var expandedGroupsSet = new Set(expandedGroups); | ||
var currentGroupExpanded = true; | ||
@@ -828,3 +818,3 @@ var currentGroupLevel = 0; | ||
currentGroupExpanded = expandedGroups.has(row.compoundKey); | ||
currentGroupExpanded = expandedGroupsSet.has(row.compoundKey); | ||
currentGroupLevel = groupLevel; | ||
@@ -886,15 +876,30 @@ | ||
var groupingPanelItems = function groupingPanelItems(columns, grouping) { | ||
return grouping.map(function (_ref) { | ||
var columnName = _ref.columnName, | ||
draft = _ref.draft; | ||
var column = columns.find(function (c) { | ||
return c.name === columnName; | ||
}); | ||
var groupingPanelItems = function groupingPanelItems(columns, grouping, draftGrouping) { | ||
var items = draftGrouping.map(function (_ref) { | ||
var columnName = _ref.columnName; | ||
return { | ||
column: column, | ||
draft: draft | ||
column: columns.find(function (c) { | ||
return c.name === columnName; | ||
}), | ||
draft: !grouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
}) | ||
}; | ||
}); | ||
grouping.forEach(function (_ref2, index) { | ||
var columnName = _ref2.columnName; | ||
if (draftGrouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
})) return; | ||
items.splice(index, 0, { | ||
column: columns.find(function (c) { | ||
return c.name === columnName; | ||
}), | ||
draft: true | ||
}); | ||
}); | ||
return items; | ||
}; | ||
@@ -978,43 +983,17 @@ | ||
var setRowSelection = function setRowSelection(selection, _ref) { | ||
var rowId = _ref.rowId, | ||
selected = _ref.selected; | ||
var toggleSelection = function toggleSelection(selection, _ref) { | ||
var rowIds = _ref.rowIds, | ||
state = _ref.state; | ||
var selectedRows = selection.slice(); | ||
var selectedIndex = selectedRows.indexOf(rowId); | ||
var isRowSelected = selected; | ||
if (isRowSelected === undefined) { | ||
isRowSelected = selectedIndex === -1; | ||
} | ||
if (selectedIndex > -1 && !isRowSelected) { | ||
selectedRows.splice(selectedIndex, 1); | ||
} else if (selectedIndex === -1 && isRowSelected) { | ||
selectedRows.push(rowId); | ||
} | ||
return selectedRows; | ||
}; | ||
var setRowsSelection = function setRowsSelection(selection, _ref2) { | ||
var rowIds = _ref2.rowIds, | ||
selected = _ref2.selected; | ||
if (rowIds.length === 1) { | ||
return setRowSelection(selection, { rowId: rowIds[0], selected: selected }); | ||
} | ||
var rowIdsSet = new Set(rowIds); | ||
var isRowsSelected = selected; | ||
if (isRowsSelected === undefined) { | ||
var rowsState = state; | ||
if (rowsState === undefined) { | ||
var availableSelection = selection.filter(function (rowId) { | ||
return rowIdsSet.has(rowId); | ||
}); | ||
isRowsSelected = availableSelection.length !== rowIdsSet.size; | ||
rowsState = availableSelection.length !== rowIdsSet.size; | ||
} | ||
if (isRowsSelected) { | ||
if (rowsState) { | ||
var selectionSet = new Set(selection); | ||
@@ -1046,6 +1025,9 @@ return [].concat(toConsumableArray(selection), toConsumableArray(rowIds.filter(function (rowId) { | ||
availableToSelect = _ref.availableToSelect; | ||
return availableToSelect.length !== 0 && selection.size !== 0 && availableToSelect.some(function (elem) { | ||
return selection.has(elem); | ||
var selectionSet = new Set(selection); | ||
return availableToSelect.length !== 0 && selectionSet.size !== 0 && availableToSelect.some(function (elem) { | ||
return selectionSet.has(elem); | ||
}) && availableToSelect.some(function (elem) { | ||
return !selection.has(elem); | ||
return !selectionSet.has(elem); | ||
}); | ||
@@ -1057,17 +1039,20 @@ }; | ||
availableToSelect = _ref2.availableToSelect; | ||
return selection.size !== 0 && availableToSelect.length !== 0 && !availableToSelect.some(function (elem) { | ||
return !selection.has(elem); | ||
var selectionSet = new Set(selection); | ||
return selectionSet.size !== 0 && availableToSelect.length !== 0 && !availableToSelect.some(function (elem) { | ||
return !selectionSet.has(elem); | ||
}); | ||
}; | ||
var startEditRows = function startEditRows(prevEditingRows, _ref) { | ||
var startEditRows = function startEditRows(prevEditingRowIds, _ref) { | ||
var rowIds = _ref.rowIds; | ||
return [].concat(toConsumableArray(prevEditingRows), toConsumableArray(rowIds)); | ||
return [].concat(toConsumableArray(prevEditingRowIds), toConsumableArray(rowIds)); | ||
}; | ||
var stopEditRows = function stopEditRows(prevEditingRows, _ref2) { | ||
var stopEditRows = function stopEditRows(prevEditingRowIds, _ref2) { | ||
var rowIds = _ref2.rowIds; | ||
var rowIdSet = new Set(rowIds); | ||
return prevEditingRows.filter(function (id) { | ||
return prevEditingRowIds.filter(function (id) { | ||
return !rowIdSet.has(id); | ||
@@ -1106,14 +1091,14 @@ }); | ||
var changeRow = function changeRow(prevChangedRows, _ref6) { | ||
var changeRow = function changeRow(prevRowChanges, _ref6) { | ||
var rowId = _ref6.rowId, | ||
change = _ref6.change; | ||
var prevChange = prevChangedRows[rowId] || {}; | ||
return _extends({}, prevChangedRows, defineProperty({}, rowId, _extends({}, prevChange, change))); | ||
var prevChange = prevRowChanges[rowId] || {}; | ||
return _extends({}, prevRowChanges, defineProperty({}, rowId, _extends({}, prevChange, change))); | ||
}; | ||
var cancelChanges = function cancelChanges(prevChangedRows, _ref7) { | ||
var cancelChanges = function cancelChanges(prevRowChanges, _ref7) { | ||
var rowIds = _ref7.rowIds; | ||
var result = _extends({}, prevChangedRows); | ||
var result = _extends({}, prevRowChanges); | ||
rowIds.forEach(function (rowId) { | ||
@@ -1125,12 +1110,12 @@ delete result[rowId]; | ||
var deleteRows = function deleteRows(deletedRows, _ref8) { | ||
var deleteRows = function deleteRows(deletedRowIds, _ref8) { | ||
var rowIds = _ref8.rowIds; | ||
return [].concat(toConsumableArray(deletedRows), toConsumableArray(rowIds)); | ||
return [].concat(toConsumableArray(deletedRowIds), toConsumableArray(rowIds)); | ||
}; | ||
var cancelDeletedRows = function cancelDeletedRows(deletedRows, _ref9) { | ||
var cancelDeletedRows = function cancelDeletedRows(deletedRowIds, _ref9) { | ||
var rowIds = _ref9.rowIds; | ||
var rowIdSet = new Set(rowIds); | ||
return deletedRows.filter(function (rowId) { | ||
return deletedRowIds.filter(function (rowId) { | ||
return !rowIdSet.has(rowId); | ||
@@ -1181,4 +1166,4 @@ }); | ||
var getRowChange = function getRowChange(changedRows, rowId) { | ||
return changedRows[rowId] || {}; | ||
var getRowChange = function getRowChange(rowChanges, rowId) { | ||
return rowChanges[rowId] || {}; | ||
}; | ||
@@ -1245,3 +1230,7 @@ | ||
var columnName = tableColumn.column.name; | ||
var width = draftColumnWidths[columnName] || columnWidths[columnName]; | ||
var isCurrentColumn = function isCurrentColumn(elem) { | ||
return elem.columnName === columnName; | ||
}; | ||
var column = draftColumnWidths.find(isCurrentColumn) || columnWidths.find(isCurrentColumn); | ||
var width = column && column.width; | ||
if (width === undefined) { | ||
@@ -1260,34 +1249,41 @@ throw new Error(UNSET_COLUMN_WIDTH_ERROR.replace('$1', columnName)); | ||
var changeTableColumnWidths = function changeTableColumnWidths(state, _ref) { | ||
var shifts = _ref.shifts; | ||
var changeTableColumnWidth = function changeTableColumnWidth(state, _ref) { | ||
var columnName = _ref.columnName, | ||
shift = _ref.shift; | ||
var columnWidths = state.columnWidths; | ||
var updatedColumnWidths = Object.keys(shifts).reduce(function (acc, columnName) { | ||
var size = Math.max(MIN_SIZE, columnWidths[columnName] + shifts[columnName]); | ||
return Object.assign(acc, defineProperty({}, columnName, size)); | ||
}, {}); | ||
return _extends({}, state, { | ||
columnWidths: _extends({}, columnWidths, updatedColumnWidths), | ||
draftColumnWidths: {} | ||
var nextColumnWidth = columnWidths.slice(); | ||
var index = nextColumnWidth.findIndex(function (elem) { | ||
return elem.columnName === columnName; | ||
}); | ||
var updatedColumn = nextColumnWidth[index]; | ||
var size = Math.max(MIN_SIZE, updatedColumn.width + shift); | ||
nextColumnWidth.splice(index, 1, { columnName: columnName, width: size }); | ||
return { | ||
columnWidths: nextColumnWidth | ||
}; | ||
}; | ||
var changeDraftTableColumnWidths = function changeDraftTableColumnWidths(state, _ref2) { | ||
var shifts = _ref2.shifts; | ||
var columnWidths = state.columnWidths, | ||
draftColumnWidths = state.draftColumnWidths; | ||
var draftTableColumnWidth = function draftTableColumnWidth(state, _ref2) { | ||
var columnName = _ref2.columnName, | ||
shift = _ref2.shift; | ||
var columnWidths = state.columnWidths; | ||
var updatedDraftColumnWidths = Object.keys(shifts).reduce(function (acc, columnName) { | ||
if (shifts[columnName] === null) { | ||
delete acc[columnName]; | ||
return acc; | ||
} | ||
var size = Math.max(MIN_SIZE, columnWidths[columnName] + shifts[columnName]); | ||
return Object.assign(acc, defineProperty({}, columnName, size)); | ||
}, Object.assign({}, draftColumnWidths)); | ||
return _extends({}, state, { | ||
draftColumnWidths: updatedDraftColumnWidths | ||
var updatedColumn = columnWidths.find(function (elem) { | ||
return elem.columnName === columnName; | ||
}); | ||
var size = Math.max(MIN_SIZE, updatedColumn.width + shift); | ||
return { | ||
draftColumnWidths: [{ columnName: updatedColumn.columnName, width: size }] | ||
}; | ||
}; | ||
var cancelTableColumnWidthDraft = function cancelTableColumnWidthDraft() { | ||
return { | ||
draftColumnWidths: [] | ||
}; | ||
}; | ||
var TABLE_EDIT_COMMAND_TYPE = 'editCommand'; | ||
@@ -1321,4 +1317,4 @@ | ||
var tableRowsWithEditing = function tableRowsWithEditing(tableRows, editingRows, addedRows, rowHeight) { | ||
var rowIds = new Set(editingRows); | ||
var tableRowsWithEditing = function tableRowsWithEditing(tableRows, editingRowIds, addedRows, rowHeight) { | ||
var rowIds = new Set(editingRowIds); | ||
var editedTableRows = tableRows.map(function (tableRow) { | ||
@@ -1369,20 +1365,23 @@ return tableRow.type === TABLE_DATA_TYPE && rowIds.has(tableRow.rowId) ? _extends({}, tableRow, { | ||
var isGroupingChange = function isGroupingChange(columnDraftGrouping) { | ||
return columnDraftGrouping.draft === GROUP_REMOVE_MODE || columnDraftGrouping.draft === GROUP_ADD_MODE; | ||
}; | ||
var tableColumnsWithDraftGrouping = function tableColumnsWithDraftGrouping(tableColumns, grouping, draftGrouping, showColumnWhenGrouped) { | ||
return tableColumns.reduce(function (acc, tableColumn) { | ||
if (tableColumn.type !== TABLE_DATA_TYPE) { | ||
acc.push(tableColumn); | ||
return acc; | ||
} | ||
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 grouping.columnName === tableColumnName; | ||
var columnName = tableColumn.column.name; | ||
var columnGroupingExists = grouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
}); | ||
var columnDraftGroupingExists = draftGrouping.some(function (columnGrouping) { | ||
return columnGrouping.columnName === columnName; | ||
}); | ||
if (!columnDraftGrouping || showColumnWhenGrouped(tableColumnName)) { | ||
return [].concat(toConsumableArray(acc), [tableColumn]); | ||
} else if (isGroupingChange(columnDraftGrouping)) { | ||
return [].concat(toConsumableArray(acc), [_extends({}, tableColumn, { | ||
if (!columnGroupingExists && !columnDraftGroupingExists || showColumnWhenGrouped(columnName)) { | ||
acc.push(tableColumn); | ||
} else if (!columnGroupingExists && columnDraftGroupingExists || columnGroupingExists && !columnDraftGroupingExists) { | ||
acc.push(_extends({}, tableColumn, { | ||
draft: true | ||
})]); | ||
})); | ||
} | ||
@@ -1404,3 +1403,3 @@ return acc; | ||
}; | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, draftGrouping, showColumnWhenGrouped))); | ||
})), toConsumableArray(tableColumnsWithDraftGrouping(tableColumns, grouping, draftGrouping, showColumnWhenGrouped))); | ||
}; | ||
@@ -1435,4 +1434,4 @@ | ||
var isDetailRowExpanded = function isDetailRowExpanded(expandedRows, rowId) { | ||
return expandedRows.indexOf(rowId) > -1; | ||
var isDetailRowExpanded = function isDetailRowExpanded(expandedRowIds, rowId) { | ||
return expandedRowIds.indexOf(rowId) > -1; | ||
}; | ||
@@ -1446,22 +1445,22 @@ var isDetailToggleTableCell = function isDetailToggleTableCell(tableRow, tableColumn) { | ||
var setDetailRowExpanded = function setDetailRowExpanded(prevExpanded, _ref) { | ||
var toggleDetailRowExpanded = function toggleDetailRowExpanded(prevExpanded, _ref) { | ||
var rowId = _ref.rowId, | ||
isExpanded = _ref.isExpanded; | ||
state = _ref.state; | ||
var expandedRows = prevExpanded.slice(); | ||
var expandedIndex = expandedRows.indexOf(rowId); | ||
var isRowExpanded = isExpanded !== undefined ? isExpanded : expandedIndex === -1; | ||
var expandedRowIds = prevExpanded.slice(); | ||
var expandedIndex = expandedRowIds.indexOf(rowId); | ||
var rowState = state !== undefined ? state : expandedIndex === -1; | ||
if (expandedIndex > -1 && !isRowExpanded) { | ||
expandedRows.splice(expandedIndex, 1); | ||
} else if (expandedIndex === -1 && isRowExpanded) { | ||
expandedRows.push(rowId); | ||
if (expandedIndex > -1 && !rowState) { | ||
expandedRowIds.splice(expandedIndex, 1); | ||
} else if (expandedIndex === -1 && rowState) { | ||
expandedRowIds.push(rowId); | ||
} | ||
return expandedRows; | ||
return expandedRowIds; | ||
}; | ||
var tableRowsWithExpandedDetail = function tableRowsWithExpandedDetail(tableRows, expandedRows, rowHeight) { | ||
var tableRowsWithExpandedDetail = function tableRowsWithExpandedDetail(tableRows, expandedRowIds, rowHeight) { | ||
var result = tableRows; | ||
expandedRows.forEach(function (expandedRowId) { | ||
expandedRowIds.forEach(function (expandedRowId) { | ||
var rowIndex = result.findIndex(function (tableRow) { | ||
@@ -1558,16 +1557,22 @@ return tableRow.type === TABLE_DATA_TYPE && tableRow.rowId === expandedRowId; | ||
var visibleTableColumns = function visibleTableColumns(tableColumns, hiddenColumns) { | ||
var visibleTableColumns = function visibleTableColumns(tableColumns, hiddenColumnNames) { | ||
return tableColumns.filter(function (tableColumn) { | ||
return tableColumn.type !== TABLE_DATA_TYPE || hiddenColumns.indexOf(tableColumn.column.name) === -1; | ||
return tableColumn.type !== TABLE_DATA_TYPE || hiddenColumnNames.indexOf(tableColumn.column.name) === -1; | ||
}); | ||
}; | ||
var columnChooserItems = function columnChooserItems(columns, hiddenColumns) { | ||
var tableDataColumnsExist = function tableDataColumnsExist(tableColumns) { | ||
return tableColumns.some(function (column) { | ||
return column.type === TABLE_DATA_TYPE; | ||
}); | ||
}; | ||
var columnChooserItems = function columnChooserItems(columns, hiddenColumnNames) { | ||
return columns.map(function (column) { | ||
return { column: column, hidden: hiddenColumns.indexOf(column.name) !== -1 }; | ||
return { column: column, hidden: hiddenColumnNames.indexOf(column.name) !== -1 }; | ||
}); | ||
}; | ||
var toggleColumn = function toggleColumn(hiddenColumns, columnName) { | ||
return hiddenColumns.indexOf(columnName) === -1 ? [].concat(toConsumableArray(hiddenColumns), [columnName]) : hiddenColumns.filter(function (hiddenColumn) { | ||
var toggleColumn = function toggleColumn(hiddenColumnNames, columnName) { | ||
return hiddenColumnNames.indexOf(columnName) === -1 ? [].concat(toConsumableArray(hiddenColumnNames), [columnName]) : hiddenColumnNames.filter(function (hiddenColumn) { | ||
return hiddenColumn !== columnName; | ||
@@ -1804,17 +1809,13 @@ }); | ||
exports.cellValueGetter = cellValueGetter; | ||
exports.setColumnSorting = setColumnSorting; | ||
exports.changeColumnSorting = changeColumnSorting; | ||
exports.getColumnSortingDirection = getColumnSortingDirection; | ||
exports.sortedRows = sortedRows; | ||
exports.setColumnFilter = setColumnFilter; | ||
exports.changeColumnFilter = changeColumnFilter; | ||
exports.getColumnFilterConfig = getColumnFilterConfig; | ||
exports.filteredRows = filteredRows; | ||
exports.GROUP_KEY_SEPARATOR = GROUP_KEY_SEPARATOR; | ||
exports.GROUP_ADD_MODE = GROUP_ADD_MODE; | ||
exports.GROUP_REMOVE_MODE = GROUP_REMOVE_MODE; | ||
exports.GROUP_REORDER_MODE = GROUP_REORDER_MODE; | ||
exports.groupByColumn = groupByColumn; | ||
exports.changeColumnGrouping = changeColumnGrouping; | ||
exports.toggleExpandedGroups = toggleExpandedGroups; | ||
exports.draftGroupingChange = draftGroupingChange; | ||
exports.cancelGroupingChange = cancelGroupingChange; | ||
exports.draftGrouping = draftGrouping; | ||
exports.draftColumnGrouping = draftColumnGrouping; | ||
exports.cancelColumnGroupingDraft = cancelColumnGroupingDraft; | ||
exports.groupRowChecker = groupRowChecker; | ||
@@ -1835,3 +1836,3 @@ exports.groupRowLevelKeyGetter = groupRowLevelKeyGetter; | ||
exports.lastRowOnPage = lastRowOnPage; | ||
exports.setRowsSelection = setRowsSelection; | ||
exports.toggleSelection = toggleSelection; | ||
exports.getAvailableToSelect = getAvailableToSelect; | ||
@@ -1859,4 +1860,5 @@ exports.someSelected = someSelected; | ||
exports.tableColumnsWithWidths = tableColumnsWithWidths; | ||
exports.changeTableColumnWidths = changeTableColumnWidths; | ||
exports.changeDraftTableColumnWidths = changeDraftTableColumnWidths; | ||
exports.changeTableColumnWidth = changeTableColumnWidth; | ||
exports.draftTableColumnWidth = draftTableColumnWidth; | ||
exports.cancelTableColumnWidthDraft = cancelTableColumnWidthDraft; | ||
exports.TABLE_EDIT_COMMAND_TYPE = TABLE_EDIT_COMMAND_TYPE; | ||
@@ -1890,3 +1892,3 @@ exports.isHeadingEditCommandsTableCell = isHeadingEditCommandsTableCell; | ||
exports.isDetailTableRow = isDetailTableRow; | ||
exports.setDetailRowExpanded = setDetailRowExpanded; | ||
exports.toggleDetailRowExpanded = toggleDetailRowExpanded; | ||
exports.tableRowsWithExpandedDetail = tableRowsWithExpandedDetail; | ||
@@ -1907,2 +1909,3 @@ exports.tableColumnsWithDetail = tableColumnsWithDetail; | ||
exports.visibleTableColumns = visibleTableColumns; | ||
exports.tableDataColumnsExist = tableDataColumnsExist; | ||
exports.columnChooserItems = columnChooserItems; | ||
@@ -1909,0 +1912,0 @@ exports.toggleColumn = toggleColumn; |
{ | ||
"name": "@devexpress/dx-grid-core", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-rc.1", | ||
"description": "Core library for the DevExtreme Reactive Grid component", | ||
@@ -42,5 +42,5 @@ "author": { | ||
"devDependencies": { | ||
"@devexpress/dx-core": "1.0.0-beta.3", | ||
"@devexpress/dx-core": "1.0.0-rc.1", | ||
"babel-core": "^6.26.0", | ||
"babel-jest": "^22.0.4", | ||
"babel-jest": "^22.1.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.3", | ||
"eslint": "^4.14.0", | ||
"eslint": "^4.15.0", | ||
"eslint-config-airbnb-base": "^12.1.0", | ||
"eslint-plugin-filenames": "^1.2.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-jest": "^21.5.0", | ||
"jest": "^22.0.4", | ||
"eslint-plugin-jest": "^21.6.2", | ||
"jest": "^22.1.1", | ||
"rollup": "0.50.0", | ||
@@ -63,4 +63,4 @@ "rollup-plugin-babel": "^3.0.3", | ||
"peerDependencies": { | ||
"@devexpress/dx-core": "1.0.0-beta.3" | ||
"@devexpress/dx-core": "1.0.0-rc.1" | ||
} | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2999
298967