@deephaven/iris-grid 0.31.2-beta.8 → 0.31.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IrisGrid.css +0 -7
- package/dist/IrisGrid.css.map +1 -1
- package/dist/IrisGrid.d.ts +0 -3
- package/dist/IrisGrid.d.ts.map +1 -1
- package/dist/IrisGrid.js +57 -84
- package/dist/IrisGrid.js.map +1 -1
- package/dist/IrisGridRenderer.d.ts +1 -1
- package/dist/IrisGridRenderer.d.ts.map +1 -1
- package/dist/IrisGridRenderer.js +13 -22
- package/dist/IrisGridRenderer.js.map +1 -1
- package/dist/IrisGridTheme.d.ts.map +1 -1
- package/dist/IrisGridTheme.js +0 -1
- package/dist/IrisGridTheme.js.map +1 -1
- package/dist/IrisGridTheme.module.css +0 -1
- package/dist/IrisGridTheme.module.css.map +1 -1
- package/dist/IrisGridUtils.d.ts +4 -10
- package/dist/IrisGridUtils.d.ts.map +1 -1
- package/dist/IrisGridUtils.js +3 -3
- package/dist/IrisGridUtils.js.map +1 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.js +1 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.js.map +1 -1
- package/dist/mousehandlers/index.d.ts +0 -1
- package/dist/mousehandlers/index.d.ts.map +1 -1
- package/dist/mousehandlers/index.js +0 -1
- package/dist/mousehandlers/index.js.map +1 -1
- package/package.json +15 -15
- package/dist/mousehandlers/IrisGridTokenMouseHandler.d.ts +0 -17
- package/dist/mousehandlers/IrisGridTokenMouseHandler.d.ts.map +0 -1
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js +0 -136
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js.map +0 -1
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import { GridMouseHandler, GridUtils, isLinkToken } from '@deephaven/grid';
|
|
5
|
-
import deepEqual from 'deep-equal';
|
|
6
|
-
class IrisGridTokenMouseHandler extends GridMouseHandler {
|
|
7
|
-
// Stores the current hovered token box if it exists with translated coordinates
|
|
8
|
-
|
|
9
|
-
constructor(irisGrid) {
|
|
10
|
-
super();
|
|
11
|
-
_defineProperty(this, "irisGrid", void 0);
|
|
12
|
-
_defineProperty(this, "currentLinkBox", void 0);
|
|
13
|
-
this.irisGrid = irisGrid;
|
|
14
|
-
}
|
|
15
|
-
destroyTooltip() {
|
|
16
|
-
this.irisGrid.setState({
|
|
17
|
-
linkHoverTooltipProps: null
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
isHoveringLink(gridPoint, grid) {
|
|
21
|
-
var {
|
|
22
|
-
column,
|
|
23
|
-
row,
|
|
24
|
-
x,
|
|
25
|
-
y
|
|
26
|
-
} = gridPoint;
|
|
27
|
-
var {
|
|
28
|
-
renderer,
|
|
29
|
-
metrics
|
|
30
|
-
} = grid;
|
|
31
|
-
if (column == null || row == null || metrics == null) {
|
|
32
|
-
this.currentLinkBox = undefined;
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
if (this.currentLinkBox != null) {
|
|
36
|
-
var {
|
|
37
|
-
x1: left,
|
|
38
|
-
y1: top,
|
|
39
|
-
x2: right,
|
|
40
|
-
y2: bottom
|
|
41
|
-
} = this.currentLinkBox;
|
|
42
|
-
if (x >= left && x <= right && y >= top && y <= bottom) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
var renderState = grid.updateRenderState();
|
|
47
|
-
var tokensInCell = renderer.getTokenBoxesForVisibleCell(column, row, renderState);
|
|
48
|
-
|
|
49
|
-
// Loop through each link and check if cursor is in bounds
|
|
50
|
-
for (var i = 0; i < tokensInCell.length; i += 1) {
|
|
51
|
-
if (isLinkToken(tokensInCell[i].token)) {
|
|
52
|
-
var translatedTokenBox = GridUtils.translateTokenBox(tokensInCell[i], metrics);
|
|
53
|
-
var {
|
|
54
|
-
x1: _left,
|
|
55
|
-
x2: _right,
|
|
56
|
-
y1: _top,
|
|
57
|
-
y2: _bottom
|
|
58
|
-
} = translatedTokenBox;
|
|
59
|
-
if (x >= _left && x <= _right && y >= _top && y <= _bottom) {
|
|
60
|
-
this.currentLinkBox = translatedTokenBox;
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// If this point is reached, that means the cursor was not hovering any of the links or there are no links
|
|
67
|
-
this.currentLinkBox = undefined;
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
setCursor(gridPoint, grid) {
|
|
71
|
-
if (this.isHoveringLink(gridPoint, grid)) {
|
|
72
|
-
this.cursor = 'pointer';
|
|
73
|
-
return {
|
|
74
|
-
stopPropagation: false,
|
|
75
|
-
preventDefault: false
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
this.cursor = null;
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
onMove(gridPoint, grid) {
|
|
82
|
-
var isUserHoveringLink = this.isHoveringLink(gridPoint, grid);
|
|
83
|
-
if (isUserHoveringLink && this.currentLinkBox != null && isLinkToken(this.currentLinkBox.token)) {
|
|
84
|
-
var {
|
|
85
|
-
linkHoverTooltipProps
|
|
86
|
-
} = this.irisGrid.state;
|
|
87
|
-
if (this.currentLinkBox == null) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
var {
|
|
91
|
-
x1: left,
|
|
92
|
-
y1: top,
|
|
93
|
-
x2: right,
|
|
94
|
-
y2: bottom
|
|
95
|
-
} = this.currentLinkBox;
|
|
96
|
-
var {
|
|
97
|
-
href
|
|
98
|
-
} = this.currentLinkBox.token;
|
|
99
|
-
var width = right - left;
|
|
100
|
-
var height = bottom - top;
|
|
101
|
-
var newProps = {
|
|
102
|
-
left,
|
|
103
|
-
top: top + 1,
|
|
104
|
-
width,
|
|
105
|
-
height
|
|
106
|
-
};
|
|
107
|
-
if (!deepEqual(linkHoverTooltipProps, newProps)) {
|
|
108
|
-
this.irisGrid.setState({
|
|
109
|
-
linkHoverTooltipProps: newProps,
|
|
110
|
-
linkHoverDisplayValue: href
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
} else {
|
|
114
|
-
this.destroyTooltip();
|
|
115
|
-
}
|
|
116
|
-
return this.setCursor(gridPoint, grid);
|
|
117
|
-
}
|
|
118
|
-
onDown() {
|
|
119
|
-
this.destroyTooltip();
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
onContextMenu() {
|
|
123
|
-
this.destroyTooltip();
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
onWheel() {
|
|
127
|
-
this.destroyTooltip();
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
onLeave() {
|
|
131
|
-
this.destroyTooltip();
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export default IrisGridTokenMouseHandler;
|
|
136
|
-
//# sourceMappingURL=IrisGridTokenMouseHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IrisGridTokenMouseHandler.js","names":["GridMouseHandler","GridUtils","isLinkToken","deepEqual","IrisGridTokenMouseHandler","constructor","irisGrid","destroyTooltip","setState","linkHoverTooltipProps","isHoveringLink","gridPoint","grid","column","row","x","y","renderer","metrics","currentLinkBox","undefined","x1","left","y1","top","x2","right","y2","bottom","renderState","updateRenderState","tokensInCell","getTokenBoxesForVisibleCell","i","length","token","translatedTokenBox","translateTokenBox","setCursor","cursor","stopPropagation","preventDefault","onMove","isUserHoveringLink","state","href","width","height","newProps","linkHoverDisplayValue","onDown","onContextMenu","onWheel","onLeave"],"sources":["../../src/mousehandlers/IrisGridTokenMouseHandler.ts"],"sourcesContent":["import {\n EventHandlerResult,\n Grid,\n GridMouseHandler,\n GridPoint,\n GridUtils,\n isLinkToken,\n TokenBox,\n} from '@deephaven/grid';\nimport deepEqual from 'deep-equal';\nimport IrisGrid from '../IrisGrid';\n\nclass IrisGridTokenMouseHandler extends GridMouseHandler {\n private irisGrid: IrisGrid;\n\n // Stores the current hovered token box if it exists with translated coordinates\n private currentLinkBox?: TokenBox;\n\n constructor(irisGrid: IrisGrid) {\n super();\n\n this.irisGrid = irisGrid;\n }\n\n private destroyTooltip(): void {\n this.irisGrid.setState({ linkHoverTooltipProps: null });\n }\n\n isHoveringLink(gridPoint: GridPoint, grid: Grid): boolean {\n const { column, row, x, y } = gridPoint;\n const { renderer, metrics } = grid;\n\n if (column == null || row == null || metrics == null) {\n this.currentLinkBox = undefined;\n return false;\n }\n\n if (this.currentLinkBox != null) {\n const { x1: left, y1: top, x2: right, y2: bottom } = this.currentLinkBox;\n if (x >= left && x <= right && y >= top && y <= bottom) {\n return true;\n }\n }\n\n const renderState = grid.updateRenderState();\n const tokensInCell = renderer.getTokenBoxesForVisibleCell(\n column,\n row,\n renderState\n );\n\n // Loop through each link and check if cursor is in bounds\n for (let i = 0; i < tokensInCell.length; i += 1) {\n if (isLinkToken(tokensInCell[i].token)) {\n const translatedTokenBox = GridUtils.translateTokenBox(\n tokensInCell[i],\n metrics\n );\n const { x1: left, x2: right, y1: top, y2: bottom } = translatedTokenBox;\n if (x >= left && x <= right && y >= top && y <= bottom) {\n this.currentLinkBox = translatedTokenBox;\n return true;\n }\n }\n }\n\n // If this point is reached, that means the cursor was not hovering any of the links or there are no links\n this.currentLinkBox = undefined;\n return false;\n }\n\n private setCursor(gridPoint: GridPoint, grid: Grid): EventHandlerResult {\n if (this.isHoveringLink(gridPoint, grid)) {\n this.cursor = 'pointer';\n return { stopPropagation: false, preventDefault: false };\n }\n this.cursor = null;\n return false;\n }\n\n onMove(gridPoint: GridPoint, grid: Grid): EventHandlerResult {\n const isUserHoveringLink = this.isHoveringLink(gridPoint, grid);\n if (\n isUserHoveringLink &&\n this.currentLinkBox != null &&\n isLinkToken(this.currentLinkBox.token)\n ) {\n const { linkHoverTooltipProps } = this.irisGrid.state;\n if (this.currentLinkBox == null) {\n return false;\n }\n const { x1: left, y1: top, x2: right, y2: bottom } = this.currentLinkBox;\n const { href } = this.currentLinkBox.token;\n const width = right - left;\n const height = bottom - top;\n const newProps = { left, top: top + 1, width, height };\n if (!deepEqual(linkHoverTooltipProps, newProps)) {\n this.irisGrid.setState({\n linkHoverTooltipProps: newProps,\n linkHoverDisplayValue: href,\n });\n }\n } else {\n this.destroyTooltip();\n }\n\n return this.setCursor(gridPoint, grid);\n }\n\n onDown(): EventHandlerResult {\n this.destroyTooltip();\n return false;\n }\n\n onContextMenu(): EventHandlerResult {\n this.destroyTooltip();\n return false;\n }\n\n onWheel(): EventHandlerResult {\n this.destroyTooltip();\n return false;\n }\n\n onLeave(): EventHandlerResult {\n this.destroyTooltip();\n return false;\n }\n}\n\nexport default IrisGridTokenMouseHandler;\n"],"mappings":";;;AAAA,SAGEA,gBAAgB,EAEhBC,SAAS,EACTC,WAAW,QAEN,iBAAiB;AACxB,OAAOC,SAAS,MAAM,YAAY;AAGlC,MAAMC,yBAAyB,SAASJ,gBAAgB,CAAC;EAGvD;;EAGAK,WAAW,CAACC,QAAkB,EAAE;IAC9B,KAAK,EAAE;IAAC;IAAA;IAER,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEQC,cAAc,GAAS;IAC7B,IAAI,CAACD,QAAQ,CAACE,QAAQ,CAAC;MAAEC,qBAAqB,EAAE;IAAK,CAAC,CAAC;EACzD;EAEAC,cAAc,CAACC,SAAoB,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