@deephaven/js-plugin-ag-grid 0.3.0 → 0.5.0

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.
Files changed (94) hide show
  1. package/README.md +68 -3
  2. package/dist/AgGridPlugin.js +3 -3
  3. package/dist/AgGridPlugin.js.map +1 -1
  4. package/dist/bundle/index.js +67476 -65226
  5. package/dist/components/AgGridView.d.ts +18 -0
  6. package/dist/components/AgGridView.d.ts.map +1 -0
  7. package/dist/{AgGridView.js → components/AgGridView.js} +3 -6
  8. package/dist/components/AgGridView.js.map +1 -0
  9. package/dist/{AgGridWidget.d.ts → components/AgGridWidget.d.ts} +0 -1
  10. package/dist/components/AgGridWidget.d.ts.map +1 -0
  11. package/dist/{AgGridWidget.js → components/AgGridWidget.js} +5 -6
  12. package/dist/components/AgGridWidget.js.map +1 -0
  13. package/dist/components/LoadingOverlay.d.ts +10 -0
  14. package/dist/components/LoadingOverlay.d.ts.map +1 -0
  15. package/dist/components/LoadingOverlay.js +12 -0
  16. package/dist/components/LoadingOverlay.js.map +1 -0
  17. package/dist/components/LoadingSpinner.d.ts +7 -0
  18. package/dist/components/LoadingSpinner.d.ts.map +1 -0
  19. package/dist/components/LoadingSpinner.js +14 -0
  20. package/dist/components/LoadingSpinner.js.map +1 -0
  21. package/dist/components/index.d.ts +5 -0
  22. package/dist/components/index.d.ts.map +1 -0
  23. package/dist/components/index.js +5 -0
  24. package/dist/components/index.js.map +1 -0
  25. package/dist/datasources/DeephavenViewportDatasource.d.ts +2 -2
  26. package/dist/datasources/DeephavenViewportDatasource.d.ts.map +1 -1
  27. package/dist/datasources/DeephavenViewportDatasource.js +1 -2
  28. package/dist/datasources/DeephavenViewportDatasource.js.map +1 -1
  29. package/dist/hooks/useWidgetFetch.d.ts +1 -1
  30. package/dist/hooks/useWidgetFetch.d.ts.map +1 -1
  31. package/dist/hooks/useWidgetFetch.js +18 -20
  32. package/dist/hooks/useWidgetFetch.js.map +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +1 -0
  36. package/dist/index.js.map +1 -1
  37. package/dist/renderers/TreeCellRenderer.d.ts +1 -2
  38. package/dist/renderers/TreeCellRenderer.d.ts.map +1 -1
  39. package/dist/renderers/TreeCellRenderer.js +3 -3
  40. package/dist/renderers/TreeCellRenderer.js.map +1 -1
  41. package/dist/types/AgGridTableType.d.ts.map +1 -0
  42. package/dist/types/AgGridTableType.js.map +1 -0
  43. package/dist/types/index.d.ts +2 -0
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/index.js +2 -0
  46. package/dist/types/index.js.map +1 -0
  47. package/dist/utils/AgGridAggUtils.d.ts +1 -1
  48. package/dist/utils/AgGridAggUtils.d.ts.map +1 -1
  49. package/dist/utils/AgGridAggUtils.js.map +1 -1
  50. package/dist/{AgGridDhTheme.d.ts → utils/AgGridDhTheme.d.ts} +3 -4
  51. package/dist/utils/AgGridDhTheme.d.ts.map +1 -0
  52. package/dist/{AgGridDhTheme.js → utils/AgGridDhTheme.js} +3 -2
  53. package/dist/utils/AgGridDhTheme.js.map +1 -0
  54. package/dist/utils/AgGridFilterUtils.d.ts +3 -3
  55. package/dist/utils/AgGridFilterUtils.d.ts.map +1 -1
  56. package/dist/utils/AgGridFilterUtils.js +2 -1
  57. package/dist/utils/AgGridFilterUtils.js.map +1 -1
  58. package/dist/utils/AgGridFormatter.d.ts +3 -2
  59. package/dist/utils/AgGridFormatter.d.ts.map +1 -1
  60. package/dist/utils/AgGridFormatter.js +2 -1
  61. package/dist/utils/AgGridFormatter.js.map +1 -1
  62. package/dist/utils/AgGridPivotUtils.d.ts +1 -1
  63. package/dist/utils/AgGridPivotUtils.d.ts.map +1 -1
  64. package/dist/utils/AgGridPivotUtils.js.map +1 -1
  65. package/dist/utils/AgGridRenderUtils.d.ts +1 -1
  66. package/dist/utils/AgGridRenderUtils.d.ts.map +1 -1
  67. package/dist/utils/AgGridSortUtils.d.ts +3 -2
  68. package/dist/utils/AgGridSortUtils.d.ts.map +1 -1
  69. package/dist/utils/AgGridSortUtils.js +2 -1
  70. package/dist/utils/AgGridSortUtils.js.map +1 -1
  71. package/dist/utils/AgGridTableUtils.d.ts +2 -2
  72. package/dist/utils/AgGridTableUtils.d.ts.map +1 -1
  73. package/dist/utils/AgGridTableUtils.js +2 -0
  74. package/dist/utils/AgGridTableUtils.js.map +1 -1
  75. package/dist/utils/AgGridUtils.d.ts +1 -1
  76. package/dist/utils/AgGridUtils.d.ts.map +1 -1
  77. package/dist/utils/AgGridUtils.js +6 -4
  78. package/dist/utils/AgGridUtils.js.map +1 -1
  79. package/dist/utils/index.d.ts +1 -0
  80. package/dist/utils/index.d.ts.map +1 -1
  81. package/dist/utils/index.js +1 -0
  82. package/dist/utils/index.js.map +1 -1
  83. package/package.json +6 -14
  84. package/dist/AgGridDhTheme.d.ts.map +0 -1
  85. package/dist/AgGridDhTheme.js.map +0 -1
  86. package/dist/AgGridTableType.d.ts.map +0 -1
  87. package/dist/AgGridTableType.js.map +0 -1
  88. package/dist/AgGridView.d.ts +0 -16
  89. package/dist/AgGridView.d.ts.map +0 -1
  90. package/dist/AgGridView.js.map +0 -1
  91. package/dist/AgGridWidget.d.ts.map +0 -1
  92. package/dist/AgGridWidget.js.map +0 -1
  93. /package/dist/{AgGridTableType.d.ts → types/AgGridTableType.d.ts} +0 -0
  94. /package/dist/{AgGridTableType.js → types/AgGridTableType.js} +0 -0
package/README.md CHANGED
@@ -4,10 +4,73 @@ This package can be used to display Deephaven tables using [AG Grid](https://www
4
4
 
5
5
  ## Usage
6
6
 
7
- Import the DeephavenViewportDatasource and use it with your AG Grid view. For example, in React:
7
+ The easiest way to use this plugin is to import and use the provided `AgGridView` component directly. You must wrap it with an `ApiContext.Provider` to provide the Deephaven API instance:
8
8
 
9
9
  ```tsx
10
- import React, { useEffect, useRef } from 'react';
10
+ import React from 'react';
11
+ import type { dh as DhType } from '@deephaven/jsapi-types';
12
+ // Only if using Core+ features
13
+ import type { dh as CorePlusDhType } from '@deephaven-enterprise/jsapi-coreplus-types';
14
+ import { AgGridView } from '@deephaven/js-plugin-ag-grid';
15
+ import { ApiContext } from '@deephaven/jsapi-bootstrap';
16
+
17
+ function DeephavenAgGridComponent({
18
+ api,
19
+ table,
20
+ }: {
21
+ api: typeof DhType;
22
+ table: DhType.Table | DhType.TreeTable | CorePlusDhType.PivotTable;
23
+ }) {
24
+ return (
25
+ <ApiContext.Provider value={api}>
26
+ <AgGridView table={table} />
27
+ </ApiContext.Provider>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ### Formatting
33
+
34
+ You can pass in custom `Settings` to the `AgGridView` component to configure the grid's formatting. For example, to apply the Singapore time zone, display time down to the nanosecond, and show decimals to 4 places by default:
35
+
36
+ ```tsx
37
+ import React, { useMemo } from 'react';
38
+ import type { dh as DhType } from '@deephaven/jsapi-types';
39
+ import { AgGridView } from '@deephaven/js-plugin-ag-grid';
40
+ import { ApiContext } from '@deephaven/jsapi-bootstrap';
41
+
42
+ function FormattedAgGridComponent({
43
+ api,
44
+ table,
45
+ }: {
46
+ api: typeof DhType;
47
+ table: DhType.Table | DhType.TreeTable;
48
+ }) {
49
+ const settings = useMemo(
50
+ () => ({
51
+ timeZone: 'Singapore',
52
+ defaultDateTimeFormat: 'yyyy-MM-dd HH:mm:ss.SSSSSSSSS',
53
+ defaultDecimalFormatOptions: {
54
+ defaultFormatString: '###,##0.0000',
55
+ },
56
+ }),
57
+ []
58
+ );
59
+
60
+ return (
61
+ <ApiContext.Provider value={api}>
62
+ <AgGridView table={table} settings={settings} />
63
+ </ApiContext.Provider>
64
+ );
65
+ }
66
+ ```
67
+
68
+ ## Advanced Usage
69
+
70
+ You can import the datasource directly if you want to manipulate the `AgGridReact` component directly. Import the DeephavenViewportDatasource and use it with your AG Grid view:
71
+
72
+ ```tsx
73
+ import React, { useMemo } from 'react';
11
74
  import { AgGridReact } from 'ag-grid-react';
12
75
  import type { dh as DhType } from '@deephaven/jsapi-types';
13
76
  import { DeephavenViewportDatasource } from '@deephaven/js-plugin-ag-grid';
@@ -31,7 +94,7 @@ function DeephavenAgGridComponent({
31
94
  }}
32
95
  rowModelType="viewport"
33
96
  viewportDatasource={datasource}
34
- // other AG Grid properties
97
+ // ...other AG Grid properties
35
98
  />
36
99
  );
37
100
  }
@@ -46,3 +109,5 @@ The [`DeephavenViewportDatasource` listens to the grid's events](./src/datasourc
46
109
  - [AgGridFilterUtils](./src/utils/AgGridFilterUtils.ts): Utility functions for mapping AG Grid filter models to Deephaven table operations.
47
110
  - [AgGridSortUtils](./src/utils/AgGridSortUtils.ts): Utility functions for mapping AG Grid sort models to Deephaven table operations.
48
111
  - [AgGridAggUtils](./src/utils/AgGridAggUtils.ts): Utility functions for mapping AG Grid aggregation and grouping models to Deephaven table operations.
112
+ - [AgGridPivotUtils](./src/utils/AgGridPivotUtils.ts): Utility functions for handling pivot tables in AG Grid with Deephaven.
113
+ - [AgGridFormatter](./src/utils/AgGridFormatter.ts): AG Grid formatter that takes Deephaven workspace settings to format columns.
@@ -1,8 +1,8 @@
1
1
  var _a, _b;
2
2
  import { PluginType } from '@deephaven/plugin';
3
3
  import { vsTable } from '@deephaven/icons';
4
- import { LicenseManager } from '@ag-grid-enterprise/core';
5
- import { AgGridWidget } from './AgGridWidget';
4
+ import { LicenseManager } from 'ag-grid-enterprise';
5
+ import { AgGridWidget } from './components';
6
6
  const key = (_b = (_a = import.meta.env) === null || _a === void 0 ? void 0 : _a.VITE_AG_GRID_LICENSE_KEY) !== null && _b !== void 0 ? _b : '';
7
7
  if (key != null && key !== '') {
8
8
  LicenseManager.setLicenseKey(key);
@@ -10,7 +10,7 @@ if (key != null && key !== '') {
10
10
  export const AgGridPlugin = {
11
11
  name: '@deephaven/js-plugin-ag-grid',
12
12
  type: PluginType.WIDGET_PLUGIN,
13
- supportedTypes: ['deephaven.ag_grid.AgGrid', 'PivotTable'],
13
+ supportedTypes: ['deephaven.ag_grid.AgGrid'],
14
14
  component: AgGridWidget,
15
15
  icon: vsTable,
16
16
  title: 'AG Grid',
@@ -1 +1 @@
1
- {"version":3,"file":"AgGridPlugin.js","sourceRoot":"","sources":["../src/AgGridPlugin.ts"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,GAAG,GAAG,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAE,wBAAwB,mCAAI,EAAE,CAAC;AAC5D,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,EAAE;IAC7B,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;CACnC;AAED,MAAM,CAAC,MAAM,YAAY,GAA4B;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,UAAU,CAAC,aAAa;IAC9B,cAAc,EAAE,CAAC,0BAA0B,EAAE,YAAY,CAAC;IAC1D,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"AgGridPlugin.js","sourceRoot":"","sources":["../src/AgGridPlugin.ts"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,GAAG,GAAG,MAAA,MAAA,MAAM,CAAC,IAAI,CAAC,GAAG,0CAAE,wBAAwB,mCAAI,EAAE,CAAC;AAC5D,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;IAC9B,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAA4B;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,UAAU,CAAC,aAAa;IAC9B,cAAc,EAAE,CAAC,0BAA0B,CAAC;IAC5C,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,eAAe,YAAY,CAAC"}