Skip to content

Commit

Permalink
fix: the devMode should be false or an object with other options
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding-SE committed Dec 8, 2023
1 parent b3ec90d commit ac57992
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/common/src/core/slickGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
if (!this.stylesheet) {
const sheets: any = (this._options.shadowRoot || document).styleSheets;

if (typeof this.options.devMode?.ownerNodeIndex === 'number' && this.options.devMode.ownerNodeIndex >= 0) {
if (this.options.devMode && typeof this.options.devMode.ownerNodeIndex === 'number' && this.options.devMode.ownerNodeIndex >= 0) {
sheets[this.options.devMode.ownerNodeIndex].ownerNode = this._style;
}

Expand Down Expand Up @@ -3749,7 +3749,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
}

getViewportWidth() {
this.viewportW = parseFloat(getInnerSize(this._container, 'width') as unknown as string) || this.options.devMode?.containerClientWidth || 0;
this.viewportW = parseFloat(getInnerSize(this._container, 'width') as unknown as string) || (this.options.devMode && this.options.devMode.containerClientWidth) || 0;
return this.viewportW;
}

Expand Down
6 changes: 2 additions & 4 deletions packages/common/src/interfaces/gridOption.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,12 @@ export interface GridOption<C extends Column = Column> {
/** Default cell Formatter that will be used by the grid */
defaultFormatter?: Formatter;

/** Escape hatch geared towards testing Slickgrid in jsdom based environments to circumvent the lack of stylesheet.ownerNode and clientWidth calculations */
devMode?: false & { ownerNodeIndex?: number; containerClientWidth?: number; };
/** Escape hatch geared towards testing Slickgrid in JSDOM based environments to circumvent the lack of stylesheet.ownerNode and clientWidth calculations */
devMode?: false | { ownerNodeIndex?: number; containerClientWidth?: number; };

/** Do we have paging enabled? */
doPaging?: boolean;

/** Escape hatch geared towards testing Slickgrid in JSDOM based environments to circumvent the lack of stylesheet.ownerNode and clientWidth calculations */
devMode?: false | { ownerNodeIndex?: number; containerClientWidth?: number; };

/** Draggable Grouping Plugin options & events */
draggableGrouping?: DraggableGrouping;
Expand Down

0 comments on commit ac57992

Please sign in to comment.