Skip to content

Commit 8a8ec64

Browse files
authored
🤖 Merge PR DefinitelyTyped#73955 fix(tabulatur-tables) - update GlobalTooltipOptions Signature by @danielHin
1 parent 9a370b0 commit 8a8ec64

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

‎types/tabulator-tables/index.d.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,9 @@ export type GroupValuesArg = any[][];
15561556

15571557
export type TextDirection = "auto" | "ltr" | "rtl";
15581558

1559-
export type GlobalTooltipOption = boolean | ((event: MouseEvent, cell: CellComponent, onRender: () => void) => string);
1559+
export type GlobalTooltipOption =
1560+
| boolean
1561+
| ((event: MouseEvent, cell: CellComponent, onRender: () => void) => string | HTMLElement);
15601562

15611563
export type CustomMutator = (
15621564
value: any,

‎types/tabulator-tables/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/tabulator-tables",
4-
"version": "6.2.9999",
4+
"version": "6.3.9999",
55
"projects": [
66
"http://tabulator.info"
77
],

‎types/tabulator-tables/tabulator-tables-tests.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,23 @@ colDef.tooltip = (event: MouseEvent, cell: CellComponent, onRendered: (callback:
440440
return cell.getValue();
441441
};
442442

443+
// Additional tests for tooltip signature / return values
444+
// boolean values
445+
colDef.tooltip = false;
446+
colDef.tooltip = true;
447+
448+
// function returning a string
449+
colDef.tooltip = (e: MouseEvent, cell: CellComponent) => {
450+
return "Tooltip";
451+
};
452+
453+
// function returning an HTMLElement
454+
colDef.tooltip = (e: MouseEvent, cell: CellComponent) => {
455+
const el = document.createElement("div");
456+
el.innerText = "Tooltip";
457+
return el;
458+
};
459+
443460
// Cell Component
444461

445462
let cell = <CellComponent> {};

0 commit comments

Comments
 (0)