Skip to content

Commit

Permalink
fix: interface for controls/plugins w/Formatter might return HTMLElem…
Browse files Browse the repository at this point in the history
…ent (#911)
  • Loading branch information
ghiscoding authored Nov 14, 2023
1 parent 5c4fb0a commit 9190843
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 98 deletions.
2 changes: 1 addition & 1 deletion src/controls/slick.columnmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class SlickColumnMenu {

const labelElm = document.createElement('label');
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`;
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel);
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel);
liElm.appendChild(labelElm);
this._listElm.appendChild(liElm);
}
Expand Down
2 changes: 1 addition & 1 deletion src/controls/slick.columnpicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class SlickColumnPicker {

const labelElm = document.createElement('label');
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`;
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel);
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel);
liElm.appendChild(labelElm);
this._listElm.appendChild(liElm);
}
Expand Down
2 changes: 1 addition & 1 deletion src/controls/slick.gridmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export class SlickGridMenu {

const labelElm = document.createElement('label');
labelElm.htmlFor = `${this._gridUid}-gridmenu-colpicker-${columnId}`;
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel || '');
labelElm.innerHTML = this.grid.sanitizeHtmlString((columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel) || '');
liElm.appendChild(labelElm);
this._listElm.appendChild(liElm);
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/columnPicker.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface ColumnPickerOption {
syncResizeTitle?: string;

/** Callback method to override the column name output used by the ColumnPicker/GridMenu. */
headerColumnValueExtractor?: (column: Column, gridOptions?: GridOption) => string;
headerColumnValueExtractor?: (column: Column, gridOptions?: GridOption) => string | HTMLElement;
}

export interface OnColumnsChangedArgs {
Expand Down
2 changes: 1 addition & 1 deletion src/models/gridMenuOption.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export interface GridMenuOption {
// action/override callbacks

/** Callback method to override the column name output used by the ColumnPicker/GridMenu. */
headerColumnValueExtractor?: (column: Column, gridOptions?: GridOption) => string;
headerColumnValueExtractor?: (column: Column, gridOptions?: GridOption) => string | HTMLElement;

/** Callback method that user can override the default behavior of enabling/disabling an item from the list. */
menuUsabilityOverride?: (args: MenuCallbackArgs<any>) => boolean;
Expand Down
Loading

0 comments on commit 9190843

Please sign in to comment.