Skip to content

Commit

Permalink
Merge pull request #1679 from zewa666/cell-range-decorator-darkmode
Browse files Browse the repository at this point in the history
feat: matching border color for range selector in darkmode
  • Loading branch information
ghiscoding authored Sep 14, 2024
2 parents 075d191 + 53d0aa2 commit a15269e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/common/src/core/__tests__/slickGrid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,15 @@ describe('SlickGrid core file', () => {

expect(rowSelectSpy).toHaveBeenCalled();
});

it('should change border color for darkMode', () => {
const cellSelectionModel = new SlickCellSelectionModel();

grid = new SlickGrid<any, Column>(container, [], columns, { ...defaultOptions, darkMode: true });
cellSelectionModel.init(grid);

expect(cellSelectionModel.cellRangeSelector.addonOptions.selectionCss.border).toBe('2px solid white');
});
});

describe('Node Getters', () => {
Expand Down Expand Up @@ -5813,4 +5822,4 @@ describe('SlickGrid core file', () => {
});
});
});
});
});
4 changes: 4 additions & 0 deletions packages/common/src/extensions/slickCellSelectionModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export class SlickCellSelectionModel implements SelectionModel {

init(grid: SlickGrid): void {
this._grid = grid;
if (this._addonOptions === undefined || this._addonOptions.cellRangeSelector === undefined) {
this._selector = new SlickCellRangeSelector({ selectionCss: { border: `2px solid ${this._grid.getOptions().darkMode ? "white" : "black"}` } as CSSStyleDeclaration })
}

if (grid.hasDataView()) {
this._dataView = grid.getData<CustomDataView | SlickDataView>();
}
Expand Down

0 comments on commit a15269e

Please sign in to comment.