slickgrid
Advanced tools
Comparing version 5.5.1 to 5.5.2
@@ -67,3 +67,3 @@ "use strict"; | ||
let labelElm = document.createElement("label"); | ||
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`, labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel), liElm.appendChild(labelElm), this._listElm.appendChild(liElm); | ||
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`, this.grid.applyHtmlCode(labelElm, columnLabel), liElm.appendChild(labelElm), this._listElm.appendChild(liElm); | ||
} | ||
@@ -101,4 +101,3 @@ if (this._options.columnPicker && (!this._options.columnPicker.hideForceFitButton || !this._options.columnPicker.hideSyncResizeButton) && this._listElm.appendChild(document.createElement("hr")), !((_c = this._options.columnPicker) != null && _c.hideForceFitButton)) { | ||
updateAllTitles(pickerOptions) { | ||
var _a; | ||
(_a = this._columnTitleElm) != null && _a.innerHTML && (this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(pickerOptions.columnTitle)); | ||
this.grid.applyHtmlCode(this._columnTitleElm, pickerOptions.columnTitle); | ||
} | ||
@@ -105,0 +104,0 @@ updateColumn(e) { |
@@ -68,3 +68,3 @@ "use strict"; | ||
let labelElm = document.createElement("label"); | ||
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`, labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel), liElm.appendChild(labelElm), this._listElm.appendChild(liElm); | ||
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`, this.grid.applyHtmlCode(labelElm, columnLabel), liElm.appendChild(labelElm), this._listElm.appendChild(liElm); | ||
} | ||
@@ -102,4 +102,3 @@ if (this._gridOptions.columnPicker && (!this._gridOptions.columnPicker.hideForceFitButton || !this._gridOptions.columnPicker.hideSyncResizeButton) && this._listElm.appendChild(document.createElement("hr")), !((_c = this._gridOptions.columnPicker) != null && _c.hideForceFitButton)) { | ||
updateAllTitles(pickerOptions) { | ||
var _a; | ||
(_a = this._columnTitleElm) != null && _a.innerHTML && (this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(pickerOptions.columnTitle)); | ||
this.grid.applyHtmlCode(this._columnTitleElm, pickerOptions.columnTitle); | ||
} | ||
@@ -106,0 +105,0 @@ updateColumn(e) { |
@@ -124,3 +124,3 @@ "use strict"; | ||
let level = (args == null ? void 0 : args.level) || 0, isSubMenu = level > 0; | ||
!isSubMenu && ((_a = this._gridMenuOptions) != null && _a.commandTitle || (_b = this._gridMenuOptions) != null && _b.customTitle) && (this._commandTitleElm = document.createElement("div"), this._commandTitleElm.className = "title", this._commandTitleElm.innerHTML = this.grid.sanitizeHtmlString(this._gridMenuOptions.commandTitle || this._gridMenuOptions.customTitle), commandListElm.appendChild(this._commandTitleElm)); | ||
!isSubMenu && ((_a = this._gridMenuOptions) != null && _a.commandTitle || (_b = this._gridMenuOptions) != null && _b.customTitle) && (this._commandTitleElm = document.createElement("div"), this._commandTitleElm.className = "title", this.grid.applyHtmlCode(this._commandTitleElm, this.grid.sanitizeHtmlString(this._gridMenuOptions.commandTitle || this._gridMenuOptions.customTitle)), commandListElm.appendChild(this._commandTitleElm)); | ||
for (let i = 0, ln = commandItems.length; i < ln; i++) { | ||
@@ -141,3 +141,3 @@ let addClickListener = !0, item = commandItems[i], callbackArgs = { | ||
let textElm = document.createElement("span"); | ||
if (textElm.className = "slick-gridmenu-content", textElm.innerHTML = this.grid.sanitizeHtmlString(item.title || ""), liElm.appendChild(textElm), item.textCssClass && textElm.classList.add(...item.textCssClass.split(" ")), commandListElm.appendChild(liElm), addClickListener) { | ||
if (textElm.className = "slick-gridmenu-content", this.grid.applyHtmlCode(textElm, this.grid.sanitizeHtmlString(item.title || "")), liElm.appendChild(textElm), item.textCssClass && textElm.classList.add(...item.textCssClass.split(" ")), commandListElm.appendChild(liElm), addClickListener) { | ||
let eventGroup = isSubMenu ? "sub-menu" : "parent-menu"; | ||
@@ -158,3 +158,3 @@ this._bindingEventService.bind(liElm, "click", this.handleMenuItemClick.bind(this, item, level), void 0, eventGroup); | ||
var _a; | ||
this.grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)), (_a = this._gridMenuOptions) != null && _a.columnTitle && (this._columnTitleElm = document.createElement("div"), this._columnTitleElm.className = "title", this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(this._gridMenuOptions.columnTitle), this._menuElm.appendChild(this._columnTitleElm)), this._bindingEventService.bind(this._menuElm, "click", this.updateColumn.bind(this)), this._listElm = document.createElement("span"), this._listElm.className = "slick-gridmenu-list", this._listElm.role = "menu"; | ||
this.grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)), (_a = this._gridMenuOptions) != null && _a.columnTitle && (this._columnTitleElm = document.createElement("div"), this._columnTitleElm.className = "title", this.grid.applyHtmlCode(this._columnTitleElm, this.grid.sanitizeHtmlString(this._gridMenuOptions.columnTitle)), this._menuElm.appendChild(this._columnTitleElm)), this._bindingEventService.bind(this._menuElm, "click", this.updateColumn.bind(this)), this._listElm = document.createElement("span"), this._listElm.className = "slick-gridmenu-list", this._listElm.role = "menu"; | ||
} | ||
@@ -187,3 +187,3 @@ /** Delete and then Recreate the Grid Menu (for example when we switch from regular to a frozen grid) */ | ||
let labelElm = document.createElement("label"); | ||
labelElm.htmlFor = `${this._gridUid}-gridmenu-colpicker-${columnId}`, labelElm.innerHTML = this.grid.sanitizeHtmlString((columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel) || ""), liElm.appendChild(labelElm), this._listElm.appendChild(liElm); | ||
labelElm.htmlFor = `${this._gridUid}-gridmenu-colpicker-${columnId}`, this.grid.applyHtmlCode(labelElm, this.grid.sanitizeHtmlString((columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel) || "")), liElm.appendChild(labelElm), this._listElm.appendChild(liElm); | ||
} | ||
@@ -255,4 +255,3 @@ if (this._gridMenuOptions && (!this._gridMenuOptions.hideForceFitButton || !this._gridMenuOptions.hideSyncResizeButton) && this._listElm.appendChild(document.createElement("hr")), !((_f = this._gridMenuOptions) != null && _f.hideForceFitButton)) { | ||
updateAllTitles(gridMenuOptions) { | ||
var _a, _b; | ||
(_a = this._commandTitleElm) != null && _a.innerHTML && (this._commandTitleElm.innerHTML = this.grid.sanitizeHtmlString(gridMenuOptions.commandTitle || gridMenuOptions.customTitle || "")), (_b = this._columnTitleElm) != null && _b.innerHTML && (this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(gridMenuOptions.columnTitle || "")); | ||
this._commandTitleElm && this.grid.applyHtmlCode(this._commandTitleElm, this.grid.sanitizeHtmlString(gridMenuOptions.commandTitle || gridMenuOptions.customTitle || "")), this._columnTitleElm && this.grid.applyHtmlCode(this._columnTitleElm, this.grid.sanitizeHtmlString(gridMenuOptions.columnTitle || "")); | ||
} | ||
@@ -259,0 +258,0 @@ addSubMenuTitleWhenExists(item, commandOrOptionMenu) { |
@@ -97,3 +97,3 @@ "use strict"; | ||
let spanCloseElm = document.createElement("span"); | ||
spanCloseElm.className = "close", spanCloseElm.ariaHidden = "true", spanCloseElm.innerHTML = "×", closeButtonElm.appendChild(spanCloseElm); | ||
spanCloseElm.className = "close", spanCloseElm.ariaHidden = "true", spanCloseElm.textContent = "\xD7", closeButtonElm.appendChild(spanCloseElm); | ||
} | ||
@@ -100,0 +100,0 @@ if (!this._cellMenuProperties.hideOptionSection && optionItems.length > 0) { |
@@ -119,3 +119,3 @@ "use strict"; | ||
let tmpDiv = document.createElement("div"); | ||
tmpDiv.innerHTML = this.parseFormatterAndSanitize(formatterOrText, cell, value, columnDef, item); | ||
this._grid.applyHtmlCode(tmpDiv, this.parseFormatterAndSanitize(formatterOrText, cell, value, columnDef, item)); | ||
let tooltipText = columnDef.toolTip || "", tmpTitleElm; | ||
@@ -186,3 +186,3 @@ tooltipText || (this._cellNodeElm && this._cellNodeElm.clientWidth < this._cellNodeElm.scrollWidth && !this._cellTooltipOptions.useRegularTooltipFromFormatterOnly ? (tooltipText = (this._cellNodeElm.textContent || "").trim() || "", this._cellTooltipOptions.tooltipTextMaxLength && tooltipText.length > this._cellTooltipOptions.tooltipTextMaxLength && (tooltipText = tooltipText.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + "..."), tmpTitleElm = this._cellNodeElm) : (this._cellTooltipOptions.useRegularTooltipFromFormatterOnly ? tmpTitleElm = tmpDiv.querySelector("[title], [data-slick-tooltip]") : (tmpTitleElm = this.findFirstElementAttribute(this._cellNodeElm, ["title", "data-slick-tooltip"]) ? this._cellNodeElm : tmpDiv.querySelector("[title], [data-slick-tooltip]"), (!tmpTitleElm || !this.findFirstElementAttribute(tmpTitleElm, ["title", "data-slick-tooltip"])) && this._cellNodeElm && (tmpTitleElm = this._cellNodeElm.querySelector("[title], [data-slick-tooltip]"))), (!tooltipText || typeof formatterOrText == "function" && this._cellTooltipOptions.useRegularTooltipFromFormatterOnly) && (tooltipText = this.findFirstElementAttribute(tmpTitleElm, ["title", "data-slick-tooltip"]) || ""))), tooltipText !== "" && this.renderTooltipFormatter(formatterOrText, cell, value, columnDef, item, tooltipText), this.swapAndClearTitleAttribute(tmpTitleElm, tooltipText); | ||
let tooltipResult = formatterOrText(cell.row, cell.cell, value, columnDef, item, this._grid), formatterText = Object.prototype.toString.call(tooltipResult) !== "[object Object]" ? tooltipResult : tooltipResult.html || tooltipResult.text; | ||
return formatterText instanceof HTMLElement && (formatterText = formatterText.outerHTML), this._grid.sanitizeHtmlString(formatterText); | ||
return formatterText instanceof HTMLElement ? formatterText : this._grid.sanitizeHtmlString(formatterText); | ||
} else if (typeof formatterOrText == "string") | ||
@@ -196,5 +196,9 @@ return this._grid.sanitizeHtmlString(formatterOrText); | ||
let outputText = tooltipText || this.parseFormatterAndSanitize(formatter, cell, value, columnDef, item) || ""; | ||
outputText = this._cellTooltipOptions.tooltipTextMaxLength && outputText.length > this._cellTooltipOptions.tooltipTextMaxLength ? outputText.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + "..." : outputText; | ||
if (outputText instanceof HTMLElement) { | ||
let content = outputText.textContent || ""; | ||
this._cellTooltipOptions.tooltipTextMaxLength && content.length > this._cellTooltipOptions.tooltipTextMaxLength && (outputText.textContent = content.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + "..."); | ||
} else | ||
outputText = this._cellTooltipOptions.tooltipTextMaxLength && outputText.length > this._cellTooltipOptions.tooltipTextMaxLength ? outputText.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + "..." : outputText; | ||
let finalOutputText = ""; | ||
!tooltipText || (_a = this._cellTooltipOptions) != null && _a.renderRegularTooltipAsHtml ? (finalOutputText = this._grid.sanitizeHtmlString(outputText), this._tooltipElm.innerHTML = finalOutputText, this._tooltipElm.style.whiteSpace = (_c = (_b = this._cellTooltipOptions) == null ? void 0 : _b.whiteSpace) != null ? _c : this._defaults.whiteSpace) : (finalOutputText = outputText || "", this._tooltipElm.textContent = finalOutputText, this._tooltipElm.style.whiteSpace = (_e = (_d = this._cellTooltipOptions) == null ? void 0 : _d.regularTooltipWhiteSpace) != null ? _e : this._defaults.regularTooltipWhiteSpace), this._cellTooltipOptions.maxHeight && (this._tooltipElm.style.maxHeight = this._cellTooltipOptions.maxHeight + "px"), this._cellTooltipOptions.maxWidth && (this._tooltipElm.style.maxWidth = this._cellTooltipOptions.maxWidth + "px"), finalOutputText && (document.body.appendChild(this._tooltipElm), this.reposition(cell), this._cellTooltipOptions.hideArrow || this._tooltipElm.classList.add("tooltip-arrow"), this.swapAndClearTitleAttribute(inputTitleElm, outputText)); | ||
!tooltipText || (_a = this._cellTooltipOptions) != null && _a.renderRegularTooltipAsHtml ? (outputText instanceof HTMLElement ? (this._grid.applyHtmlCode(this._tooltipElm, outputText), finalOutputText = this._grid.sanitizeHtmlString(outputText.textContent || "")) : (finalOutputText = this._grid.sanitizeHtmlString(outputText), this._tooltipElm.innerHTML = finalOutputText), this._tooltipElm.style.whiteSpace = (_c = (_b = this._cellTooltipOptions) == null ? void 0 : _b.whiteSpace) != null ? _c : this._defaults.whiteSpace) : (finalOutputText = (outputText instanceof HTMLElement ? outputText.textContent : outputText) || "", this._tooltipElm.textContent = finalOutputText, this._tooltipElm.style.whiteSpace = (_e = (_d = this._cellTooltipOptions) == null ? void 0 : _d.regularTooltipWhiteSpace) != null ? _e : this._defaults.regularTooltipWhiteSpace), this._cellTooltipOptions.maxHeight && (this._tooltipElm.style.maxHeight = this._cellTooltipOptions.maxHeight + "px"), this._cellTooltipOptions.maxWidth && (this._tooltipElm.style.maxWidth = this._cellTooltipOptions.maxWidth + "px"), finalOutputText && (document.body.appendChild(this._tooltipElm), this.reposition(cell), this._cellTooltipOptions.hideArrow || this._tooltipElm.classList.add("tooltip-arrow"), this.swapAndClearTitleAttribute(inputTitleElm, (outputText instanceof HTMLElement ? outputText.textContent : outputText) || "")); | ||
} | ||
@@ -201,0 +205,0 @@ /** |
@@ -152,3 +152,3 @@ import type { CancellablePromiseWrapper, Column, CustomTooltipOption, DOMEvent, Formatter, GridOption } from '../models/index'; | ||
cell: number; | ||
}, value: any, columnDef: Column, item: unknown): string; | ||
}, value: any, columnDef: Column, item: unknown): string | HTMLElement; | ||
protected renderTooltipFormatter(formatter: Formatter | string | undefined, cell: { | ||
@@ -155,0 +155,0 @@ row: number; |
@@ -13,3 +13,3 @@ import type SortableInstance from 'sortablejs'; | ||
* | ||
* SlickGrid v5.5.1 | ||
* SlickGrid v5.5.2 | ||
* | ||
@@ -595,4 +595,4 @@ * NOTES: | ||
protected getDataItemValueForColumn(item: TData, columnDef: C): TData | TData[keyof TData]; | ||
protected appendRowHtml(divArrayL: HTMLElement[], divArrayR: HTMLElement[], row: number, range: CellViewportRange, dataLength: number): void; | ||
protected appendCellHtml(divRow: HTMLElement, row: number, cell: number, colspan: number, item: TData): void; | ||
protected appendRowHtml(stringArrayL: string[], stringArrayR: string[], row: number, range: CellViewportRange, dataLength: number): void; | ||
protected appendCellHtml(stringArray: string[], row: number, cell: number, colspan: number, item: TData): void; | ||
protected cleanupRows(rangeToKeep: { | ||
@@ -679,2 +679,3 @@ bottom: number; | ||
}): void; | ||
protected applyTopStyling(elements: NodeListOf<HTMLElement>): void; | ||
protected startPostProcessing(): void; | ||
@@ -681,0 +682,0 @@ protected startPostProcessingCleanup(): void; |
{ | ||
"name": "slickgrid", | ||
"version": "5.5.1", | ||
"version": "5.5.2", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "./dist/browser/index.js", |
@@ -160,3 +160,3 @@ import { BindingEventService as BindingEventService_, Event as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`; | ||
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel); | ||
this.grid.applyHtmlCode(labelElm, columnLabel); | ||
liElm.appendChild(labelElm); | ||
@@ -253,5 +253,3 @@ this._listElm.appendChild(liElm); | ||
updateAllTitles(pickerOptions: { columnTitle: string; }) { | ||
if (this._columnTitleElm?.innerHTML) { | ||
this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(pickerOptions.columnTitle); | ||
} | ||
this.grid.applyHtmlCode(this._columnTitleElm, pickerOptions.columnTitle); | ||
} | ||
@@ -258,0 +256,0 @@ |
@@ -161,3 +161,3 @@ import { BindingEventService as BindingEventService_, Event as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
labelElm.htmlFor = `${this._gridUid}colpicker-${columnId}`; | ||
labelElm.innerHTML = this.grid.sanitizeHtmlString(columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel); | ||
this.grid.applyHtmlCode(labelElm, columnLabel); | ||
liElm.appendChild(labelElm); | ||
@@ -254,5 +254,3 @@ this._listElm.appendChild(liElm); | ||
updateAllTitles(pickerOptions: { columnTitle: string; }) { | ||
if (this._columnTitleElm?.innerHTML) { | ||
this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(pickerOptions.columnTitle); | ||
} | ||
this.grid.applyHtmlCode(this._columnTitleElm, pickerOptions.columnTitle); | ||
} | ||
@@ -259,0 +257,0 @@ |
@@ -396,3 +396,3 @@ import type { | ||
this._commandTitleElm.className = 'title'; | ||
this._commandTitleElm.innerHTML = this.grid.sanitizeHtmlString((this._gridMenuOptions.commandTitle || this._gridMenuOptions.customTitle) as string); | ||
this.grid.applyHtmlCode(this._commandTitleElm, this.grid.sanitizeHtmlString((this._gridMenuOptions.commandTitle || this._gridMenuOptions.customTitle) as string)); | ||
commandListElm.appendChild(this._commandTitleElm); | ||
@@ -465,3 +465,3 @@ } | ||
textElm.className = 'slick-gridmenu-content'; | ||
textElm.innerHTML = this.grid.sanitizeHtmlString((item as GridMenuItem).title || ''); | ||
this.grid.applyHtmlCode(textElm, this.grid.sanitizeHtmlString((item as GridMenuItem).title || '')); | ||
@@ -517,3 +517,3 @@ liElm.appendChild(textElm); | ||
this._columnTitleElm.className = 'title'; | ||
this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(this._gridMenuOptions.columnTitle); | ||
this.grid.applyHtmlCode(this._columnTitleElm, this.grid.sanitizeHtmlString(this._gridMenuOptions.columnTitle)); | ||
this._menuElm.appendChild(this._columnTitleElm); | ||
@@ -598,3 +598,3 @@ } | ||
labelElm.htmlFor = `${this._gridUid}-gridmenu-colpicker-${columnId}`; | ||
labelElm.innerHTML = this.grid.sanitizeHtmlString((columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel) || ''); | ||
this.grid.applyHtmlCode(labelElm, this.grid.sanitizeHtmlString((columnLabel instanceof HTMLElement ? columnLabel.innerHTML : columnLabel) || '')); | ||
liElm.appendChild(labelElm); | ||
@@ -767,7 +767,7 @@ this._listElm.appendChild(liElm); | ||
updateAllTitles(gridMenuOptions: GridMenuOption) { | ||
if (this._commandTitleElm?.innerHTML) { | ||
this._commandTitleElm.innerHTML = this.grid.sanitizeHtmlString(gridMenuOptions.commandTitle || gridMenuOptions.customTitle || ''); | ||
if (this._commandTitleElm) { | ||
this.grid.applyHtmlCode(this._commandTitleElm, this.grid.sanitizeHtmlString(gridMenuOptions.commandTitle || gridMenuOptions.customTitle || '')); | ||
} | ||
if (this._columnTitleElm?.innerHTML) { | ||
this._columnTitleElm.innerHTML = this.grid.sanitizeHtmlString(gridMenuOptions.columnTitle || ''); | ||
if (this._columnTitleElm) { | ||
this.grid.applyHtmlCode(this._columnTitleElm, this.grid.sanitizeHtmlString(gridMenuOptions.columnTitle || '')); | ||
} | ||
@@ -774,0 +774,0 @@ } |
@@ -336,3 +336,3 @@ import { | ||
spanCloseElm.ariaHidden = 'true'; | ||
spanCloseElm.innerHTML = '×'; | ||
spanCloseElm.textContent = '×'; | ||
closeButtonElm.appendChild(spanCloseElm); | ||
@@ -339,0 +339,0 @@ } |
@@ -266,3 +266,3 @@ import type { CancellablePromiseWrapper, Column, CustomTooltipOption, DOMEvent, Formatter, FormatterResultWithHtml, FormatterResultWithText, GridOption } from '../models/index'; | ||
const tmpDiv = document.createElement('div'); | ||
tmpDiv.innerHTML = this.parseFormatterAndSanitize(formatterOrText, cell, value, columnDef, item); | ||
this._grid.applyHtmlCode(tmpDiv, this.parseFormatterAndSanitize(formatterOrText, cell, value, columnDef, item)); | ||
let tooltipText = columnDef.toolTip || ''; | ||
@@ -431,8 +431,8 @@ let tmpTitleElm; | ||
*/ | ||
protected parseFormatterAndSanitize(formatterOrText: Formatter | string | undefined, cell: { row: number; cell: number; }, value: any, columnDef: Column, item: unknown): string { | ||
protected parseFormatterAndSanitize(formatterOrText: Formatter | string | undefined, cell: { row: number; cell: number; }, value: any, columnDef: Column, item: unknown): string | HTMLElement { | ||
if (typeof formatterOrText === 'function') { | ||
const tooltipResult = formatterOrText(cell.row, cell.cell, value, columnDef, item, this._grid); | ||
let formatterText = (Object.prototype.toString.call(tooltipResult) !== '[object Object]' ? tooltipResult : (tooltipResult as FormatterResultWithHtml).html || (tooltipResult as FormatterResultWithText).text); | ||
const formatterText = (Object.prototype.toString.call(tooltipResult) !== '[object Object]' ? tooltipResult : (tooltipResult as FormatterResultWithHtml).html || (tooltipResult as FormatterResultWithText).text); | ||
if (formatterText instanceof HTMLElement) { | ||
formatterText = formatterText.outerHTML; | ||
return formatterText; | ||
} | ||
@@ -455,11 +455,23 @@ return this._grid.sanitizeHtmlString(formatterText as string); | ||
let outputText = tooltipText || this.parseFormatterAndSanitize(formatter, cell, value, columnDef, item) || ''; | ||
outputText = (this._cellTooltipOptions.tooltipTextMaxLength && outputText.length > this._cellTooltipOptions.tooltipTextMaxLength) ? outputText.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + '...' : outputText; | ||
if (outputText instanceof HTMLElement) { | ||
const content = outputText.textContent || ''; | ||
if (this._cellTooltipOptions.tooltipTextMaxLength && content.length > this._cellTooltipOptions.tooltipTextMaxLength) { | ||
outputText.textContent = content.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + '...'; | ||
} | ||
} else { | ||
outputText = (this._cellTooltipOptions.tooltipTextMaxLength && outputText.length > this._cellTooltipOptions.tooltipTextMaxLength) ? outputText.substring(0, this._cellTooltipOptions.tooltipTextMaxLength - 3) + '...' : outputText; | ||
} | ||
let finalOutputText = ''; | ||
if (!tooltipText || (this._cellTooltipOptions?.renderRegularTooltipAsHtml)) { | ||
finalOutputText = this._grid.sanitizeHtmlString(outputText); | ||
this._tooltipElm.innerHTML = finalOutputText; | ||
if (outputText instanceof HTMLElement) { | ||
this._grid.applyHtmlCode(this._tooltipElm, outputText); | ||
finalOutputText = this._grid.sanitizeHtmlString(outputText.textContent || ''); | ||
} else { | ||
finalOutputText = this._grid.sanitizeHtmlString(outputText); | ||
this._tooltipElm.innerHTML = finalOutputText; | ||
} | ||
this._tooltipElm.style.whiteSpace = this._cellTooltipOptions?.whiteSpace ?? this._defaults.whiteSpace as string; | ||
} else { | ||
finalOutputText = outputText || ''; | ||
finalOutputText = (outputText instanceof HTMLElement ? outputText.textContent : outputText) || ''; | ||
this._tooltipElm.textContent = finalOutputText; | ||
@@ -490,3 +502,3 @@ this._tooltipElm.style.whiteSpace = this._cellTooltipOptions?.regularTooltipWhiteSpace ?? this._defaults.regularTooltipWhiteSpace as string; // use `pre` so that sequences of white space are collapsed. Lines are broken at newline characters | ||
// also clear any "title" attribute to avoid showing a 2nd browser tooltip | ||
this.swapAndClearTitleAttribute(inputTitleElm, outputText); | ||
this.swapAndClearTitleAttribute(inputTitleElm, (outputText instanceof HTMLElement ? outputText.textContent : outputText) || ''); | ||
} | ||
@@ -493,0 +505,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6920802
57977