@deephaven/iris-grid 0.41.0 → 0.41.2-beta.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 +3 -0
- package/dist/IrisGrid.css.map +1 -1
- package/dist/IrisGrid.d.ts +2 -2
- package/dist/IrisGrid.d.ts.map +1 -1
- package/dist/IrisGrid.js.map +1 -1
- package/dist/IrisGridCellRendererUtils.d.ts +7 -0
- package/dist/IrisGridCellRendererUtils.d.ts.map +1 -0
- package/dist/IrisGridCellRendererUtils.js +20 -0
- package/dist/IrisGridCellRendererUtils.js.map +1 -0
- package/dist/IrisGridDataBarCellRenderer.d.ts +7 -0
- package/dist/IrisGridDataBarCellRenderer.d.ts.map +1 -0
- package/dist/IrisGridDataBarCellRenderer.js +10 -0
- package/dist/IrisGridDataBarCellRenderer.js.map +1 -0
- package/dist/IrisGridIcons.d.ts +4 -0
- package/dist/IrisGridIcons.d.ts.map +1 -0
- package/dist/IrisGridIcons.js +25 -0
- package/dist/IrisGridIcons.js.map +1 -0
- package/dist/IrisGridRenderer.d.ts +18 -26
- package/dist/IrisGridRenderer.d.ts.map +1 -1
- package/dist/IrisGridRenderer.js +64 -205
- package/dist/IrisGridRenderer.js.map +1 -1
- package/dist/IrisGridTableModelTemplate.d.ts +2 -2
- package/dist/IrisGridTableModelTemplate.d.ts.map +1 -1
- package/dist/IrisGridTableModelTemplate.js +15 -3
- package/dist/IrisGridTableModelTemplate.js.map +1 -1
- package/dist/IrisGridTextCellRenderer.d.ts +20 -0
- package/dist/IrisGridTextCellRenderer.d.ts.map +1 -0
- package/dist/IrisGridTextCellRenderer.js +139 -0
- package/dist/IrisGridTextCellRenderer.js.map +1 -0
- package/dist/IrisGridTheme.d.ts.map +1 -1
- package/dist/IrisGridTheme.js +4 -1
- package/dist/IrisGridTheme.js.map +1 -1
- package/dist/IrisGridTheme.module.css +3 -0
- package/dist/IrisGridTheme.module.css.map +1 -1
- package/dist/IrisGridUtils.d.ts +12 -12
- package/dist/IrisGridUtils.d.ts.map +1 -1
- package/dist/IrisGridUtils.js +7 -3
- package/dist/IrisGridUtils.js.map +1 -1
- package/dist/mousehandlers/IrisGridTokenMouseHandler.d.ts.map +1 -1
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js +18 -3
- package/dist/mousehandlers/IrisGridTokenMouseHandler.js.map +1 -1
- package/package.json +16 -16
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoxCoordinates, Coordinate } from '@deephaven/grid';
|
|
2
|
+
import { IrisGridRenderState } from './IrisGridRenderer';
|
|
3
|
+
declare class IrisGridCellRendererUtils {
|
|
4
|
+
static drawTreeMarker(context: CanvasRenderingContext2D, state: IrisGridRenderState, columnX: Coordinate, rowY: Coordinate, treeBox: BoxCoordinates, color: string, isExpanded: boolean): void;
|
|
5
|
+
}
|
|
6
|
+
export default IrisGridCellRendererUtils;
|
|
7
|
+
//# sourceMappingURL=IrisGridCellRendererUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridCellRendererUtils.d.ts","sourceRoot":"","sources":["../src/IrisGridCellRendererUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,cAAM,yBAAyB;IAC7B,MAAM,CAAC,cAAc,CACnB,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,OAAO,GAClB,IAAI;CAeR;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getIcon } from "./IrisGridIcons.js";
|
|
2
|
+
class IrisGridCellRendererUtils {
|
|
3
|
+
static drawTreeMarker(context, state, columnX, rowY, treeBox, color, isExpanded) {
|
|
4
|
+
context.save();
|
|
5
|
+
var {
|
|
6
|
+
x1,
|
|
7
|
+
y1
|
|
8
|
+
} = treeBox;
|
|
9
|
+
var markerIcon = isExpanded ? getIcon('caretDown') : getIcon('caretRight');
|
|
10
|
+
var iconX = columnX + x1 - 2;
|
|
11
|
+
var iconY = rowY + y1 + 2.5;
|
|
12
|
+
context.fillStyle = color;
|
|
13
|
+
context.textAlign = 'center';
|
|
14
|
+
context.translate(iconX, iconY);
|
|
15
|
+
context.fill(markerIcon);
|
|
16
|
+
context.restore();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export default IrisGridCellRendererUtils;
|
|
20
|
+
//# sourceMappingURL=IrisGridCellRendererUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridCellRendererUtils.js","names":["getIcon","IrisGridCellRendererUtils","drawTreeMarker","context","state","columnX","rowY","treeBox","color","isExpanded","save","x1","y1","markerIcon","iconX","iconY","fillStyle","textAlign","translate","fill","restore"],"sources":["../src/IrisGridCellRendererUtils.ts"],"sourcesContent":["import { BoxCoordinates, Coordinate } from '@deephaven/grid';\nimport { getIcon } from './IrisGridIcons';\nimport { IrisGridRenderState } from './IrisGridRenderer';\n\nclass IrisGridCellRendererUtils {\n static drawTreeMarker(\n context: CanvasRenderingContext2D,\n state: IrisGridRenderState,\n columnX: Coordinate,\n rowY: Coordinate,\n treeBox: BoxCoordinates,\n color: string,\n isExpanded: boolean\n ): void {\n context.save();\n const { x1, y1 } = treeBox;\n const markerIcon = isExpanded\n ? getIcon('caretDown')\n : getIcon('caretRight');\n const iconX = columnX + x1 - 2;\n const iconY = rowY + y1 + 2.5;\n\n context.fillStyle = color;\n context.textAlign = 'center';\n context.translate(iconX, iconY);\n context.fill(markerIcon);\n context.restore();\n }\n}\n\nexport default IrisGridCellRendererUtils;\n"],"mappings":"SACSA,OAAO;AAGhB,MAAMC,yBAAyB,CAAC;EAC9B,OAAOC,cAAc,CACnBC,OAAiC,EACjCC,KAA0B,EAC1BC,OAAmB,EACnBC,IAAgB,EAChBC,OAAuB,EACvBC,KAAa,EACbC,UAAmB,EACb;IACNN,OAAO,CAACO,IAAI,EAAE;IACd,IAAM;MAAEC,EAAE;MAAEC;IAAG,CAAC,GAAGL,OAAO;IAC1B,IAAMM,UAAU,GAAGJ,UAAU,GACzBT,OAAO,CAAC,WAAW,CAAC,GACpBA,OAAO,CAAC,YAAY,CAAC;IACzB,IAAMc,KAAK,GAAGT,OAAO,GAAGM,EAAE,GAAG,CAAC;IAC9B,IAAMI,KAAK,GAAGT,IAAI,GAAGM,EAAE,GAAG,GAAG;IAE7BT,OAAO,CAACa,SAAS,GAAGR,KAAK;IACzBL,OAAO,CAACc,SAAS,GAAG,QAAQ;IAC5Bd,OAAO,CAACe,SAAS,CAACJ,KAAK,EAAEC,KAAK,CAAC;IAC/BZ,OAAO,CAACgB,IAAI,CAACN,UAAU,CAAC;IACxBV,OAAO,CAACiB,OAAO,EAAE;EACnB;AACF;AAEA,eAAenB,yBAAyB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoxCoordinates, Coordinate, DataBarCellRenderer } from '@deephaven/grid';
|
|
2
|
+
import { IrisGridRenderState } from './IrisGridRenderer';
|
|
3
|
+
declare class IrisGridDataBarCellRenderer extends DataBarCellRenderer {
|
|
4
|
+
drawTreeMarker(context: CanvasRenderingContext2D, state: IrisGridRenderState, columnX: Coordinate, rowY: Coordinate, treeBox: BoxCoordinates, color: string, isExpanded: boolean): void;
|
|
5
|
+
}
|
|
6
|
+
export default IrisGridDataBarCellRenderer;
|
|
7
|
+
//# sourceMappingURL=IrisGridDataBarCellRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridDataBarCellRenderer.d.ts","sourceRoot":"","sources":["../src/IrisGridDataBarCellRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,UAAU,EACV,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,cAAM,2BAA4B,SAAQ,mBAAmB;IAC3D,cAAc,CACZ,OAAO,EAAE,wBAAwB,EACjC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,OAAO,GAClB,IAAI;CAWR;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { DataBarCellRenderer } from '@deephaven/grid';
|
|
3
|
+
import IrisGridCellRendererUtils from "./IrisGridCellRendererUtils.js";
|
|
4
|
+
class IrisGridDataBarCellRenderer extends DataBarCellRenderer {
|
|
5
|
+
drawTreeMarker(context, state, columnX, rowY, treeBox, color, isExpanded) {
|
|
6
|
+
IrisGridCellRendererUtils.drawTreeMarker(context, state, columnX, rowY, treeBox, color, isExpanded);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export default IrisGridDataBarCellRenderer;
|
|
10
|
+
//# sourceMappingURL=IrisGridDataBarCellRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridDataBarCellRenderer.js","names":["DataBarCellRenderer","IrisGridCellRendererUtils","IrisGridDataBarCellRenderer","drawTreeMarker","context","state","columnX","rowY","treeBox","color","isExpanded"],"sources":["../src/IrisGridDataBarCellRenderer.ts"],"sourcesContent":["/* eslint-disable class-methods-use-this */\nimport {\n BoxCoordinates,\n Coordinate,\n DataBarCellRenderer,\n} from '@deephaven/grid';\nimport { IrisGridRenderState } from './IrisGridRenderer';\nimport IrisGridCellRendererUtils from './IrisGridCellRendererUtils';\n\nclass IrisGridDataBarCellRenderer extends DataBarCellRenderer {\n drawTreeMarker(\n context: CanvasRenderingContext2D,\n state: IrisGridRenderState,\n columnX: Coordinate,\n rowY: Coordinate,\n treeBox: BoxCoordinates,\n color: string,\n isExpanded: boolean\n ): void {\n IrisGridCellRendererUtils.drawTreeMarker(\n context,\n state,\n columnX,\n rowY,\n treeBox,\n color,\n isExpanded\n );\n }\n}\n\nexport default IrisGridDataBarCellRenderer;\n"],"mappings":"AAAA;AACA,SAGEA,mBAAmB,QACd,iBAAiB;AAAC,OAElBC,yBAAyB;AAEhC,MAAMC,2BAA2B,SAASF,mBAAmB,CAAC;EAC5DG,cAAc,CACZC,OAAiC,EACjCC,KAA0B,EAC1BC,OAAmB,EACnBC,IAAgB,EAChBC,OAAuB,EACvBC,KAAa,EACbC,UAAmB,EACb;IACNT,yBAAyB,CAACE,cAAc,CACtCC,OAAO,EACPC,KAAK,EACLC,OAAO,EACPC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,UAAU,CACX;EACH;AACF;AAEA,eAAeR,2BAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridIcons.d.ts","sourceRoot":"","sources":["../src/IrisGridIcons.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,UAAU,GACV,WAAW,GACX,YAAY,GACZ,cAAc,CAAC;AAgCnB,wBAAgB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { memoizeClear } from '@deephaven/grid';
|
|
2
|
+
import { dhSortDown, dhSortUp, vsTriangleDown, vsTriangleRight, vsLinkExternal } from '@deephaven/icons';
|
|
3
|
+
export var ICON_SIZE = 16;
|
|
4
|
+
var iconMap = new Map([['sortUp', dhSortUp], ['sortDown', dhSortDown], ['caretDown', vsTriangleDown], ['caretRight', vsTriangleRight], ['cellOverflow', vsLinkExternal]]);
|
|
5
|
+
var makeIcon = memoizeClear(name => {
|
|
6
|
+
var faIcon = iconMap.get(name);
|
|
7
|
+
if (faIcon === undefined) {
|
|
8
|
+
throw new Error('Icon is undefined');
|
|
9
|
+
}
|
|
10
|
+
var path = Array.isArray(faIcon.icon[4]) ? faIcon.icon[4][0] : faIcon.icon[4];
|
|
11
|
+
var icon = new Path2D(path);
|
|
12
|
+
var scaledIcon = new Path2D();
|
|
13
|
+
var scaleMatrix = {
|
|
14
|
+
a: ICON_SIZE / faIcon.icon[0],
|
|
15
|
+
d: ICON_SIZE / faIcon.icon[1]
|
|
16
|
+
};
|
|
17
|
+
scaledIcon.addPath(icon, scaleMatrix);
|
|
18
|
+
return scaledIcon;
|
|
19
|
+
}, {
|
|
20
|
+
max: 1000
|
|
21
|
+
});
|
|
22
|
+
export function getIcon(name) {
|
|
23
|
+
return makeIcon(name);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=IrisGridIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridIcons.js","names":["memoizeClear","dhSortDown","dhSortUp","vsTriangleDown","vsTriangleRight","vsLinkExternal","ICON_SIZE","iconMap","Map","makeIcon","name","faIcon","get","undefined","Error","path","Array","isArray","icon","Path2D","scaledIcon","scaleMatrix","a","d","addPath","max","getIcon"],"sources":["../src/IrisGridIcons.ts"],"sourcesContent":["import { memoizeClear } from '@deephaven/grid';\nimport {\n dhSortDown,\n dhSortUp,\n vsTriangleDown,\n vsTriangleRight,\n vsLinkExternal,\n IconDefinition,\n} from '@deephaven/icons';\n\nexport const ICON_SIZE = 16;\n\nexport type IconName =\n | 'sortUp'\n | 'sortDown'\n | 'caretDown'\n | 'caretRight'\n | 'cellOverflow';\n\nconst iconMap = new Map<IconName, IconDefinition>([\n ['sortUp', dhSortUp],\n ['sortDown', dhSortDown],\n ['caretDown', vsTriangleDown],\n ['caretRight', vsTriangleRight],\n ['cellOverflow', vsLinkExternal],\n]);\n\nconst makeIcon = memoizeClear(\n (name: IconName) => {\n const faIcon = iconMap.get(name);\n if (faIcon === undefined) {\n throw new Error('Icon is undefined');\n }\n\n const path = Array.isArray(faIcon.icon[4])\n ? faIcon.icon[4][0]\n : faIcon.icon[4];\n const icon = new Path2D(path);\n const scaledIcon = new Path2D();\n const scaleMatrix = {\n a: ICON_SIZE / faIcon.icon[0],\n d: ICON_SIZE / faIcon.icon[1],\n };\n scaledIcon.addPath(icon, scaleMatrix);\n return scaledIcon;\n },\n { max: 1000 }\n);\n\nexport function getIcon(name: IconName): Path2D {\n return makeIcon(name);\n}\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,iBAAiB;AAC9C,SACEC,UAAU,EACVC,QAAQ,EACRC,cAAc,EACdC,eAAe,EACfC,cAAc,QAET,kBAAkB;AAEzB,OAAO,IAAMC,SAAS,GAAG,EAAE;AAS3B,IAAMC,OAAO,GAAG,IAAIC,GAAG,CAA2B,CAChD,CAAC,QAAQ,EAAEN,QAAQ,CAAC,EACpB,CAAC,UAAU,EAAED,UAAU,CAAC,EACxB,CAAC,WAAW,EAAEE,cAAc,CAAC,EAC7B,CAAC,YAAY,EAAEC,eAAe,CAAC,EAC/B,CAAC,cAAc,EAAEC,cAAc,CAAC,CACjC,CAAC;AAEF,IAAMI,QAAQ,GAAGT,YAAY,CAC1BU,IAAc,IAAK;EAClB,IAAMC,MAAM,GAAGJ,OAAO,CAACK,GAAG,CAACF,IAAI,CAAC;EAChC,IAAIC,MAAM,KAAKE,SAAS,EAAE;IACxB,MAAM,IAAIC,KAAK,CAAC,mBAAmB,CAAC;EACtC;EAEA,IAAMC,IAAI,GAAGC,KAAK,CAACC,OAAO,CAACN,MAAM,CAACO,IAAI,CAAC,CAAC,CAAC,CAAC,GACtCP,MAAM,CAACO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACjBP,MAAM,CAACO,IAAI,CAAC,CAAC,CAAC;EAClB,IAAMA,IAAI,GAAG,IAAIC,MAAM,CAACJ,IAAI,CAAC;EAC7B,IAAMK,UAAU,GAAG,IAAID,MAAM,EAAE;EAC/B,IAAME,WAAW,GAAG;IAClBC,CAAC,EAAEhB,SAAS,GAAGK,MAAM,CAACO,IAAI,CAAC,CAAC,CAAC;IAC7BK,CAAC,EAAEjB,SAAS,GAAGK,MAAM,CAACO,IAAI,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,CAACI,OAAO,CAACN,IAAI,EAAEG,WAAW,CAAC;EACrC,OAAOD,UAAU;AACnB,CAAC,EACD;EAAEK,GAAG,EAAE;AAAK,CAAC,CACd;AAED,OAAO,SAASC,OAAO,CAAChB,IAAc,EAAU;EAC9C,OAAOD,QAAQ,CAACC,IAAI,CAAC;AACvB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BoundedAxisRange, BoxCoordinates, Coordinate, GridMetrics, GridRangeIndex, GridRenderer, GridRenderState, GridThemeType, VisibleIndex } from '@deephaven/grid';
|
|
1
|
+
import { BoundedAxisRange, Coordinate, GridMetrics, GridRangeIndex, GridRenderer, GridRenderState, GridThemeType, VisibleIndex } from '@deephaven/grid';
|
|
3
2
|
import type { Sort } from '@deephaven/jsapi-types';
|
|
4
3
|
import { ReverseType } from '@deephaven/jsapi-utils';
|
|
5
4
|
import { ReadonlyAdvancedFilterMap, ReadonlyQuickFilterMap, AdvancedFilter, QuickFilter } from './CommonTypes';
|
|
6
5
|
import { IrisGridThemeType } from './IrisGridTheme';
|
|
7
6
|
import IrisGridModel from './IrisGridModel';
|
|
7
|
+
import IrisGridTextCellRenderer from './IrisGridTextCellRenderer';
|
|
8
|
+
import IrisGridDataBarCellRenderer from './IrisGridDataBarCellRenderer';
|
|
8
9
|
export type IrisGridRenderState = GridRenderState & {
|
|
9
10
|
model: IrisGridModel;
|
|
10
11
|
theme: IrisGridThemeType;
|
|
@@ -22,16 +23,26 @@ export type IrisGridRenderState = GridRenderState & {
|
|
|
22
23
|
* */
|
|
23
24
|
declare class IrisGridRenderer extends GridRenderer {
|
|
24
25
|
static isFilterValid(advancedFilter: AdvancedFilter | undefined | null, quickFilter: QuickFilter | undefined | null): boolean;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
initIcons(): void;
|
|
28
|
-
setIcon(name: string, faIcon: IconDefinition): void;
|
|
29
|
-
getIcon(name: string): Path2D;
|
|
26
|
+
protected textCellRenderer: IrisGridTextCellRenderer;
|
|
27
|
+
protected dataBarCellRenderer: IrisGridDataBarCellRenderer;
|
|
30
28
|
getSortIcon(sort: Sort | null): Path2D | null;
|
|
31
29
|
drawCanvas(state: IrisGridRenderState): void;
|
|
32
30
|
drawGrid(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
33
31
|
drawGridLines(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
34
32
|
drawCellContent(context: CanvasRenderingContext2D, state: IrisGridRenderState, column: VisibleIndex, row: VisibleIndex): void;
|
|
33
|
+
getCellOverflowButtonPosition({ mouseX, mouseY, metrics, theme, }: {
|
|
34
|
+
mouseX: Coordinate | null;
|
|
35
|
+
mouseY: Coordinate | null;
|
|
36
|
+
metrics: GridMetrics | undefined;
|
|
37
|
+
theme: GridThemeType;
|
|
38
|
+
}): {
|
|
39
|
+
left: Coordinate | null;
|
|
40
|
+
top: Coordinate | null;
|
|
41
|
+
width: number | null;
|
|
42
|
+
height: number | null;
|
|
43
|
+
};
|
|
44
|
+
shouldRenderOverflowButton(state: IrisGridRenderState): boolean;
|
|
45
|
+
drawCellOverflowButton(state: IrisGridRenderState): void;
|
|
35
46
|
drawGroupedColumnLine(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
36
47
|
drawPendingRowLine(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
37
48
|
drawMouseColumnHover(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
@@ -52,26 +63,7 @@ declare class IrisGridRenderer extends GridRenderer {
|
|
|
52
63
|
drawExpandedFilterHeader(context: CanvasRenderingContext2D, state: IrisGridRenderState, column: VisibleIndex, columnX: Coordinate, columnWidth: number): void;
|
|
53
64
|
drawCollapsedFilterHeaders(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
54
65
|
drawCollapsedFilterHeader(context: CanvasRenderingContext2D, state: IrisGridRenderState, column: VisibleIndex, columnX: Coordinate, columnWidth: number): void;
|
|
55
|
-
drawTreeMarker(context: CanvasRenderingContext2D, state: IrisGridRenderState, columnX: Coordinate, rowY: Coordinate, treeBox: BoxCoordinates, color: string, isExpanded: boolean): void;
|
|
56
66
|
drawRowFooters(context: CanvasRenderingContext2D, state: IrisGridRenderState): void;
|
|
57
|
-
getTextRenderMetrics(state: IrisGridRenderState, column: VisibleIndex, row: VisibleIndex): {
|
|
58
|
-
width: number;
|
|
59
|
-
x: Coordinate;
|
|
60
|
-
y: Coordinate;
|
|
61
|
-
};
|
|
62
|
-
shouldRenderOverflowButton(state: IrisGridRenderState): boolean;
|
|
63
|
-
getCellOverflowButtonPosition({ mouseX, mouseY, metrics, theme, }: {
|
|
64
|
-
mouseX: Coordinate | null;
|
|
65
|
-
mouseY: Coordinate | null;
|
|
66
|
-
metrics: GridMetrics | undefined;
|
|
67
|
-
theme: GridThemeType;
|
|
68
|
-
}): {
|
|
69
|
-
left: Coordinate | null;
|
|
70
|
-
top: Coordinate | null;
|
|
71
|
-
width: number | null;
|
|
72
|
-
height: number | null;
|
|
73
|
-
};
|
|
74
|
-
drawCellOverflowButton(state: IrisGridRenderState): void;
|
|
75
67
|
getExpandButtonPosition({ mouseX, mouseY, metrics, theme, }: {
|
|
76
68
|
mouseX: Coordinate | null;
|
|
77
69
|
mouseY: Coordinate | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IrisGridRenderer.d.ts","sourceRoot":"","sources":["../src/IrisGridRenderer.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"IrisGridRenderer.d.ts","sourceRoot":"","sources":["../src/IrisGridRenderer.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C,KAAK,EAAE,mBAAmB,GACzB,IAAI;IAsGP,uBAAuB,CACrB,EACE,MAAM,EACN,MAAM,EACN,OAAO,EACP,KAAK,GACN,EAAE;QACD,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;QACjC,KAAK,EAAE,aAAa,CAAC;KACtB,EACD,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB;QACD,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;QACxB,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB;CA4BF;AAED,eAAe,gBAAgB,CAAC"}
|
package/dist/IrisGridRenderer.js
CHANGED
|
@@ -6,10 +6,12 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
6
6
|
/* eslint react/destructuring-assignment: "off" */
|
|
7
7
|
/* eslint class-methods-use-this: "off" */
|
|
8
8
|
/* eslint no-param-reassign: "off" */
|
|
9
|
-
import {
|
|
10
|
-
import { GridRenderer, GridUtils } from '@deephaven/grid';
|
|
9
|
+
import { DEFAULT_FONT_WIDTH, GridRenderer, GridUtils } from '@deephaven/grid';
|
|
11
10
|
import { TableUtils } from '@deephaven/jsapi-utils';
|
|
12
11
|
import { assertNotNull, getOrThrow } from '@deephaven/utils';
|
|
12
|
+
import IrisGridTextCellRenderer from "./IrisGridTextCellRenderer.js";
|
|
13
|
+
import IrisGridDataBarCellRenderer from "./IrisGridDataBarCellRenderer.js";
|
|
14
|
+
import { getIcon } from "./IrisGridIcons.js";
|
|
13
15
|
var ICON_NAMES = Object.freeze({
|
|
14
16
|
SORT_UP: 'sortUp',
|
|
15
17
|
SORT_DOWN: 'sortDown',
|
|
@@ -18,54 +20,29 @@ var ICON_NAMES = Object.freeze({
|
|
|
18
20
|
CELL_OVERFLOW: 'cellOverflow'
|
|
19
21
|
});
|
|
20
22
|
var EXPAND_ICON_SIZE = 10;
|
|
21
|
-
var ICON_SIZE = 16;
|
|
22
23
|
/**
|
|
23
24
|
* Handles rendering some of the Iris specific features, such as sorting icons, sort bar display
|
|
24
25
|
* */
|
|
25
26
|
class IrisGridRenderer extends GridRenderer {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
_defineProperty(this, "textCellRenderer", new IrisGridTextCellRenderer());
|
|
30
|
+
_defineProperty(this, "dataBarCellRenderer", new IrisGridDataBarCellRenderer());
|
|
31
|
+
}
|
|
26
32
|
static isFilterValid(advancedFilter, quickFilter) {
|
|
27
33
|
var isAdvancedFilterValid = advancedFilter == null || advancedFilter.filter != null;
|
|
28
34
|
var isQuickFilterValid = quickFilter == null || quickFilter.filter != null;
|
|
29
35
|
return isAdvancedFilterValid && isQuickFilterValid;
|
|
30
36
|
}
|
|
31
|
-
constructor() {
|
|
32
|
-
super();
|
|
33
|
-
_defineProperty(this, "icons", void 0);
|
|
34
|
-
this.icons = {};
|
|
35
|
-
this.initIcons();
|
|
36
|
-
}
|
|
37
|
-
initIcons() {
|
|
38
|
-
this.setIcon(ICON_NAMES.SORT_UP, dhSortUp);
|
|
39
|
-
this.setIcon(ICON_NAMES.SORT_DOWN, dhSortDown);
|
|
40
|
-
this.setIcon(ICON_NAMES.CARET_DOWN, vsTriangleDown);
|
|
41
|
-
this.setIcon(ICON_NAMES.CARET_RIGHT, vsTriangleRight);
|
|
42
|
-
this.setIcon(ICON_NAMES.CELL_OVERFLOW, vsLinkExternal);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Scales the icon to be square and match the global ICON_SIZE
|
|
46
|
-
setIcon(name, faIcon) {
|
|
47
|
-
var path = Array.isArray(faIcon.icon[4]) ? faIcon.icon[4][0] : faIcon.icon[4];
|
|
48
|
-
var icon = new Path2D(path);
|
|
49
|
-
var scaledIcon = new Path2D();
|
|
50
|
-
var scaleMatrix = {
|
|
51
|
-
a: ICON_SIZE / faIcon.icon[0],
|
|
52
|
-
d: ICON_SIZE / faIcon.icon[1]
|
|
53
|
-
};
|
|
54
|
-
scaledIcon.addPath(icon, scaleMatrix);
|
|
55
|
-
this.icons[name] = scaledIcon;
|
|
56
|
-
}
|
|
57
|
-
getIcon(name) {
|
|
58
|
-
return this.icons[name];
|
|
59
|
-
}
|
|
60
37
|
getSortIcon(sort) {
|
|
61
38
|
if (!sort) {
|
|
62
39
|
return null;
|
|
63
40
|
}
|
|
64
41
|
if (sort.direction === TableUtils.sortDirection.ascending) {
|
|
65
|
-
return
|
|
42
|
+
return getIcon(ICON_NAMES.SORT_UP);
|
|
66
43
|
}
|
|
67
44
|
if (sort.direction === TableUtils.sortDirection.descending) {
|
|
68
|
-
return
|
|
45
|
+
return getIcon(ICON_NAMES.SORT_DOWN);
|
|
69
46
|
}
|
|
70
47
|
return null;
|
|
71
48
|
}
|
|
@@ -83,7 +60,6 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
83
60
|
this.drawPendingRowLine(context, state);
|
|
84
61
|
}
|
|
85
62
|
drawCellContent(context, state, column, row) {
|
|
86
|
-
var _model$columns$modelC;
|
|
87
63
|
var {
|
|
88
64
|
metrics,
|
|
89
65
|
model
|
|
@@ -92,23 +68,61 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
92
68
|
modelColumns,
|
|
93
69
|
modelRows
|
|
94
70
|
} = metrics;
|
|
95
|
-
var modelRow = getOrThrow(modelRows, row);
|
|
96
71
|
var modelColumn = modelColumns.get(column);
|
|
72
|
+
var modelRow = getOrThrow(modelRows, row);
|
|
97
73
|
if (modelColumn === undefined) {
|
|
98
74
|
return;
|
|
99
75
|
}
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
76
|
+
var renderType = model.renderTypeForCell(modelColumn, modelRow);
|
|
77
|
+
var cellRenderer = this.getCellRenderer(renderType);
|
|
78
|
+
cellRenderer.drawCellContent(context, state, column, row);
|
|
79
|
+
}
|
|
80
|
+
getCellOverflowButtonPosition(_ref) {
|
|
81
|
+
var {
|
|
82
|
+
mouseX,
|
|
83
|
+
mouseY,
|
|
84
|
+
metrics,
|
|
85
|
+
theme
|
|
86
|
+
} = _ref;
|
|
87
|
+
return this.textCellRenderer.getCellOverflowButtonPosition(mouseX, mouseY, metrics, theme);
|
|
88
|
+
}
|
|
89
|
+
shouldRenderOverflowButton(state) {
|
|
90
|
+
return this.textCellRenderer.shouldRenderOverflowButton(state);
|
|
91
|
+
}
|
|
92
|
+
drawCellOverflowButton(state) {
|
|
93
|
+
var {
|
|
94
|
+
context,
|
|
95
|
+
mouseX,
|
|
96
|
+
mouseY,
|
|
97
|
+
theme
|
|
98
|
+
} = state;
|
|
99
|
+
if (mouseX == null || mouseY == null) return;
|
|
100
|
+
if (!this.shouldRenderOverflowButton(state)) {
|
|
101
|
+
return;
|
|
110
102
|
}
|
|
111
|
-
|
|
103
|
+
var {
|
|
104
|
+
left: buttonLeft,
|
|
105
|
+
top: buttonTop,
|
|
106
|
+
width: buttonWidth,
|
|
107
|
+
height: buttonHeight
|
|
108
|
+
} = this.getCellOverflowButtonPosition(state);
|
|
109
|
+
var {
|
|
110
|
+
cellHorizontalPadding,
|
|
111
|
+
overflowButtonColor,
|
|
112
|
+
overflowButtonHoverColor
|
|
113
|
+
} = theme;
|
|
114
|
+
context.save();
|
|
115
|
+
if (overflowButtonHoverColor != null && buttonLeft != null && buttonWidth != null && buttonTop != null && buttonHeight != null && mouseX >= buttonLeft && mouseX <= buttonLeft + buttonWidth && mouseY >= buttonTop && mouseY <= buttonTop + buttonHeight) {
|
|
116
|
+
context.fillStyle = overflowButtonHoverColor;
|
|
117
|
+
} else if (overflowButtonColor != null) {
|
|
118
|
+
context.fillStyle = overflowButtonColor;
|
|
119
|
+
}
|
|
120
|
+
var icon = getIcon(ICON_NAMES.CELL_OVERFLOW);
|
|
121
|
+
if (buttonLeft != null && buttonTop != null) {
|
|
122
|
+
context.translate(buttonLeft + cellHorizontalPadding, buttonTop + 2);
|
|
123
|
+
}
|
|
124
|
+
context.fill(icon);
|
|
125
|
+
context.restore();
|
|
112
126
|
}
|
|
113
127
|
drawGroupedColumnLine(context, state) {
|
|
114
128
|
var {
|
|
@@ -330,7 +344,7 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
330
344
|
super.drawColumnHeadersAtDepth(context, state, range, bounds, depth);
|
|
331
345
|
}
|
|
332
346
|
drawColumnHeaderAtIndex(context, state, index, bounds) {
|
|
333
|
-
var _model$columns$
|
|
347
|
+
var _model$columns$modelC, _fontWidths$get;
|
|
334
348
|
super.drawColumnHeaderAtIndex(context, state, index, bounds);
|
|
335
349
|
var {
|
|
336
350
|
metrics,
|
|
@@ -354,7 +368,7 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
354
368
|
if (modelColumn == null) {
|
|
355
369
|
return;
|
|
356
370
|
}
|
|
357
|
-
var columnName = (_model$columns$
|
|
371
|
+
var columnName = (_model$columns$modelC = model.columns[modelColumn]) === null || _model$columns$modelC === void 0 ? void 0 : _model$columns$modelC.name;
|
|
358
372
|
if (columnName == null) {
|
|
359
373
|
return;
|
|
360
374
|
}
|
|
@@ -370,7 +384,7 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
370
384
|
if (text === undefined) {
|
|
371
385
|
return;
|
|
372
386
|
}
|
|
373
|
-
var fontWidth = (_fontWidths$get = fontWidths.get(context.font)) !== null && _fontWidths$get !== void 0 ? _fontWidths$get :
|
|
387
|
+
var fontWidth = (_fontWidths$get = fontWidths.get(context.font)) !== null && _fontWidths$get !== void 0 ? _fontWidths$get : DEFAULT_FONT_WIDTH;
|
|
374
388
|
assertNotNull(fontWidth);
|
|
375
389
|
var textWidth = text.length * fontWidth;
|
|
376
390
|
var textRight = gridX + columnX + textWidth + headerHorizontalPadding;
|
|
@@ -639,21 +653,6 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
639
653
|
context.fillRect(x, y, rectWidth, rectHeight);
|
|
640
654
|
context.restore();
|
|
641
655
|
}
|
|
642
|
-
drawTreeMarker(context, state, columnX, rowY, treeBox, color, isExpanded) {
|
|
643
|
-
context.save();
|
|
644
|
-
var {
|
|
645
|
-
x1,
|
|
646
|
-
y1
|
|
647
|
-
} = treeBox;
|
|
648
|
-
var markerIcon = isExpanded ? this.getIcon(ICON_NAMES.CARET_DOWN) : this.getIcon(ICON_NAMES.CARET_RIGHT);
|
|
649
|
-
var iconX = columnX + x1 - 2;
|
|
650
|
-
var iconY = rowY + y1 + 2.5;
|
|
651
|
-
context.fillStyle = color;
|
|
652
|
-
context.textAlign = 'center';
|
|
653
|
-
context.translate(iconX, iconY);
|
|
654
|
-
context.fill(markerIcon);
|
|
655
|
-
context.restore();
|
|
656
|
-
}
|
|
657
656
|
drawRowFooters(context, state) {
|
|
658
657
|
var {
|
|
659
658
|
metrics,
|
|
@@ -738,146 +737,6 @@ class IrisGridRenderer extends GridRenderer {
|
|
|
738
737
|
}
|
|
739
738
|
context.translate(-gridX, -gridY);
|
|
740
739
|
}
|
|
741
|
-
|
|
742
|
-
// This will shrink the size the text may take when the overflow button is rendered
|
|
743
|
-
// The text will truncate to a smaller width and won't overlap the button
|
|
744
|
-
getTextRenderMetrics(state, column, row) {
|
|
745
|
-
var textMetrics = super.getTextRenderMetrics(state, column, row);
|
|
746
|
-
var {
|
|
747
|
-
mouseX,
|
|
748
|
-
mouseY,
|
|
749
|
-
metrics
|
|
750
|
-
} = state;
|
|
751
|
-
if (mouseX == null || mouseY == null) {
|
|
752
|
-
return textMetrics;
|
|
753
|
-
}
|
|
754
|
-
var {
|
|
755
|
-
column: mouseColumn,
|
|
756
|
-
row: mouseRow
|
|
757
|
-
} = GridUtils.getGridPointFromXY(mouseX, mouseY, metrics);
|
|
758
|
-
if (column === mouseColumn && row === mouseRow) {
|
|
759
|
-
var {
|
|
760
|
-
left
|
|
761
|
-
} = this.getCellOverflowButtonPosition(state);
|
|
762
|
-
if (this.shouldRenderOverflowButton(state) && left != null) {
|
|
763
|
-
textMetrics.width = left - metrics.gridX - textMetrics.x;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
return textMetrics;
|
|
767
|
-
}
|
|
768
|
-
shouldRenderOverflowButton(state) {
|
|
769
|
-
var _model$textForCell, _metrics$fontWidths$g;
|
|
770
|
-
var {
|
|
771
|
-
context,
|
|
772
|
-
mouseX,
|
|
773
|
-
mouseY,
|
|
774
|
-
metrics,
|
|
775
|
-
model,
|
|
776
|
-
theme
|
|
777
|
-
} = state;
|
|
778
|
-
if (mouseX == null || mouseY == null) {
|
|
779
|
-
return false;
|
|
780
|
-
}
|
|
781
|
-
var {
|
|
782
|
-
row,
|
|
783
|
-
column,
|
|
784
|
-
modelRow,
|
|
785
|
-
modelColumn
|
|
786
|
-
} = GridUtils.getCellInfoFromXY(mouseX, mouseY, metrics);
|
|
787
|
-
if (row == null || column == null || modelRow == null || modelColumn == null || !TableUtils.isStringType(model.columns[modelColumn].type)) {
|
|
788
|
-
return false;
|
|
789
|
-
}
|
|
790
|
-
var text = (_model$textForCell = model.textForCell(modelColumn, modelRow)) !== null && _model$textForCell !== void 0 ? _model$textForCell : '';
|
|
791
|
-
var {
|
|
792
|
-
width: textWidth
|
|
793
|
-
} = super.getTextRenderMetrics(state, column, row);
|
|
794
|
-
var fontWidth = (_metrics$fontWidths$g = metrics.fontWidths.get(theme.font)) !== null && _metrics$fontWidths$g !== void 0 ? _metrics$fontWidths$g : IrisGridRenderer.DEFAULT_FONT_WIDTH;
|
|
795
|
-
context.save();
|
|
796
|
-
context.font = theme.font;
|
|
797
|
-
var truncatedText = this.getCachedTruncatedString(context, text, textWidth, fontWidth, model.truncationCharForCell(modelColumn, modelRow));
|
|
798
|
-
context.restore();
|
|
799
|
-
return text !== '' && truncatedText !== text;
|
|
800
|
-
}
|
|
801
|
-
getCellOverflowButtonPosition(_ref) {
|
|
802
|
-
var {
|
|
803
|
-
mouseX,
|
|
804
|
-
mouseY,
|
|
805
|
-
metrics,
|
|
806
|
-
theme
|
|
807
|
-
} = _ref;
|
|
808
|
-
var NULL_POSITION = {
|
|
809
|
-
left: null,
|
|
810
|
-
top: null,
|
|
811
|
-
width: null,
|
|
812
|
-
height: null
|
|
813
|
-
};
|
|
814
|
-
if (mouseX == null || mouseY == null || metrics == null) {
|
|
815
|
-
return NULL_POSITION;
|
|
816
|
-
}
|
|
817
|
-
var {
|
|
818
|
-
rowHeight,
|
|
819
|
-
columnWidth,
|
|
820
|
-
left,
|
|
821
|
-
top
|
|
822
|
-
} = GridUtils.getCellInfoFromXY(mouseX, mouseY, metrics);
|
|
823
|
-
if (left == null || columnWidth == null || top == null) {
|
|
824
|
-
return NULL_POSITION;
|
|
825
|
-
}
|
|
826
|
-
var {
|
|
827
|
-
width: gridWidth,
|
|
828
|
-
verticalBarWidth
|
|
829
|
-
} = metrics;
|
|
830
|
-
var {
|
|
831
|
-
cellHorizontalPadding
|
|
832
|
-
} = theme;
|
|
833
|
-
var width = ICON_SIZE + 2 * cellHorizontalPadding;
|
|
834
|
-
var height = rowHeight;
|
|
835
|
-
// Right edge of column or of visible grid, whichever is smaller
|
|
836
|
-
var right = Math.min(metrics.gridX + left + columnWidth, gridWidth - verticalBarWidth);
|
|
837
|
-
var buttonLeft = right - width;
|
|
838
|
-
var buttonTop = metrics.gridY + top;
|
|
839
|
-
return {
|
|
840
|
-
left: buttonLeft,
|
|
841
|
-
top: buttonTop,
|
|
842
|
-
width,
|
|
843
|
-
height
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
drawCellOverflowButton(state) {
|
|
847
|
-
var {
|
|
848
|
-
context,
|
|
849
|
-
mouseX,
|
|
850
|
-
mouseY,
|
|
851
|
-
theme
|
|
852
|
-
} = state;
|
|
853
|
-
if (mouseX == null || mouseY == null) return;
|
|
854
|
-
if (!this.shouldRenderOverflowButton(state)) {
|
|
855
|
-
return;
|
|
856
|
-
}
|
|
857
|
-
var {
|
|
858
|
-
left: buttonLeft,
|
|
859
|
-
top: buttonTop,
|
|
860
|
-
width: buttonWidth,
|
|
861
|
-
height: buttonHeight
|
|
862
|
-
} = this.getCellOverflowButtonPosition(state);
|
|
863
|
-
var {
|
|
864
|
-
cellHorizontalPadding,
|
|
865
|
-
overflowButtonColor,
|
|
866
|
-
overflowButtonHoverColor
|
|
867
|
-
} = theme;
|
|
868
|
-
context.save();
|
|
869
|
-
if (overflowButtonHoverColor != null && buttonLeft != null && buttonWidth != null && buttonTop != null && buttonHeight != null && mouseX >= buttonLeft && mouseX <= buttonLeft + buttonWidth && mouseY >= buttonTop && mouseY <= buttonTop + buttonHeight) {
|
|
870
|
-
context.fillStyle = overflowButtonHoverColor;
|
|
871
|
-
} else if (overflowButtonColor != null) {
|
|
872
|
-
context.fillStyle = overflowButtonColor;
|
|
873
|
-
}
|
|
874
|
-
var icon = this.getIcon(ICON_NAMES.CELL_OVERFLOW);
|
|
875
|
-
if (buttonLeft != null && buttonTop != null) {
|
|
876
|
-
context.translate(buttonLeft + cellHorizontalPadding, buttonTop + 2);
|
|
877
|
-
}
|
|
878
|
-
context.fill(icon);
|
|
879
|
-
context.restore();
|
|
880
|
-
}
|
|
881
740
|
getExpandButtonPosition(_ref2, depth) {
|
|
882
741
|
var {
|
|
883
742
|
mouseX,
|