From 89ae4f3c36a0ea0890d1b8864a74055604c71bc3 Mon Sep 17 00:00:00 2001 From: mikebender Date: Tue, 19 Dec 2023 18:18:26 -0500 Subject: [PATCH] fix: Interface for IrisGridTableModelTemplate.backgroundColorForCell - The implementation for IrisGridTableModelTemplate.backgroundColorForCell did not accept a theme, even though GridModel.backgroundColorForCell does - This caused issues with classes that extended IrisGridTableModelTemplate or it's subclasses like IrisGridTableModel, as the could not override this method to correctly accept the theme parameter BREAKING CHANGE: - Subclasses of IrisGridTableModelTemplate or it's subclasses that use backgroundColorForCell may need to update their signature to accept the theme if they are calling the superclass --- packages/grid/src/index.ts | 1 + packages/iris-grid/src/IrisGrid.tsx | 4 ++-- packages/iris-grid/src/IrisGridTableModelTemplate.ts | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/grid/src/index.ts b/packages/grid/src/index.ts index d19a66d01b..b0744d032b 100644 --- a/packages/grid/src/index.ts +++ b/packages/grid/src/index.ts @@ -11,6 +11,7 @@ export * from './GridRange'; export * from './GridAxisRange'; export * from './GridRenderer'; export { default as GridTestUtils } from './GridTestUtils'; +export * from './GridTheme'; export { default as GridTheme } from './GridTheme'; export type { GridTheme as GridThemeType } from './GridTheme'; export * from './GridUtils'; diff --git a/packages/iris-grid/src/IrisGrid.tsx b/packages/iris-grid/src/IrisGrid.tsx index 4dc456270b..a1e53cc073 100644 --- a/packages/iris-grid/src/IrisGrid.tsx +++ b/packages/iris-grid/src/IrisGrid.tsx @@ -1363,8 +1363,8 @@ export class IrisGrid extends Component { getCachedTheme = memoize( ( - contextTheme: GridThemeType | null, - theme: GridThemeType | null, + contextTheme: Partial | null, + theme: Partial | null, isEditable: boolean, floatingRowCount: number ): Partial => { diff --git a/packages/iris-grid/src/IrisGridTableModelTemplate.ts b/packages/iris-grid/src/IrisGridTableModelTemplate.ts index 74e8a7b5a2..2b64e196bf 100644 --- a/packages/iris-grid/src/IrisGridTableModelTemplate.ts +++ b/packages/iris-grid/src/IrisGridTableModelTemplate.ts @@ -625,7 +625,11 @@ class IrisGridTableModelTemplate< return theme.textColor; } - backgroundColorForCell(x: ModelIndex, y: ModelIndex): string | null { + backgroundColorForCell( + x: ModelIndex, + y: ModelIndex, + theme: IrisGridThemeType + ): string | null { return this.formatForCell(x, y)?.backgroundColor ?? null; }