Skip to content

Commit

Permalink
fix: regression with SortingState.columnExtensions.sortingEnabled (#3647
Browse files Browse the repository at this point in the history
) (#3653)

* fix regression with SortingState.columnExtensions.sortingEnabled

* silence the linter

* try to disable the tslint rule globally where strictNullChecks is false

* new tslint configs extend the root config
  • Loading branch information
VasilyStrelyaev committed Jun 6, 2023
1 parent b2fdd43 commit 5655906
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/dx-grid-core/src/plugins/sorting-state/helpers.test.ts
Expand Up @@ -38,6 +38,20 @@ describe('SortingState helpers', () => {
const result = getPersistentSortedColumns(sorting, columnExtensions);
expect(result).toEqual(['b']);
});
it('should honor the default sortingEnabled state', () => {
const sorting = [
{ columnName: 'a', ...defaultDirection },
{ columnName: 'b', ...defaultDirection },
{ columnName: 'c', ...defaultDirection },
];
const columnExtensions = [
{ columnName: 'a', sortingEnabled: true },
{ columnName: 'b', sortingEnabled: false },
{ columnName: 'c' },
];
const result = getPersistentSortedColumns(sorting, columnExtensions);
expect(result).toEqual(['b']);
});
});

describe('#calculateKeepOther', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/dx-grid-core/src/plugins/sorting-state/helpers.ts
Expand Up @@ -15,7 +15,7 @@ export const getColumnSortingDirection: GetColumnSortingDirectionFn = (
export const getPersistentSortedColumns: GetPersistentSortedColumnsFn = (
sorting, columnExtensions = [],
) => columnExtensions.reduce((acc, { columnName, sortingEnabled }) => {
if (!sortingEnabled) {
if (sortingEnabled === false) {
if (sorting.findIndex(sortItem => sortItem.columnName === columnName) > -1) {
acc.push(columnName);
}
Expand Down
13 changes: 13 additions & 0 deletions packages/dx-grid-core/tslint.json
@@ -0,0 +1,13 @@
{
"extends": "../../tslint.json",
"linterOptions": {
"exclude": [
"config/**/*.js",
"node_modules/**/*.ts",
"**/*.g.test.tsx"
]
},
"rules": {
"no-boolean-literal-compare": false
}
}
13 changes: 13 additions & 0 deletions packages/dx-scheduler-core/tslint.json
@@ -0,0 +1,13 @@
{
"extends": "../../tslint.json",
"linterOptions": {
"exclude": [
"config/**/*.js",
"node_modules/**/*.ts",
"**/*.g.test.tsx"
]
},
"rules": {
"no-boolean-literal-compare": false
}
}

0 comments on commit 5655906

Please sign in to comment.