@finos/legend-lego 1.1.41 → 1.1.43
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/code-editor/CodeEditor.d.ts +2 -0
- package/lib/code-editor/CodeEditor.d.ts.map +1 -1
- package/lib/code-editor/CodeEditor.js +18 -2
- package/lib/code-editor/CodeEditor.js.map +1 -1
- package/lib/data-grid/DataGrid.d.ts +5 -2
- package/lib/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/data-grid/DataGrid.js +30 -1
- package/lib/data-grid/DataGrid.js.map +1 -1
- package/lib/index.css +1 -1
- package/package.json +16 -4
- package/src/code-editor/CodeEditor.tsx +20 -0
- package/src/data-grid/DataGrid.tsx +39 -1
@@ -17,6 +17,7 @@
|
|
17
17
|
import { editor as monacoEditorAPI } from 'monaco-editor';
|
18
18
|
import { type CODE_EDITOR_LANGUAGE } from './CodeEditorUtils.js';
|
19
19
|
import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
|
20
|
+
import type { CompilationError, ParserError } from '@finos/legend-graph';
|
20
21
|
export declare const CodeEditor: React.FC<{
|
21
22
|
inputValue: string;
|
22
23
|
isReadOnly?: boolean | undefined;
|
@@ -29,5 +30,6 @@ export declare const CodeEditor: React.FC<{
|
|
29
30
|
updateInput?: ((val: string) => void) | undefined;
|
30
31
|
lineToScroll?: number | undefined;
|
31
32
|
extraEditorOptions?: (monacoEditorAPI.IEditorOptions & monacoEditorAPI.IGlobalEditorOptions) | undefined;
|
33
|
+
error?: ParserError | CompilationError | undefined;
|
32
34
|
}>;
|
33
35
|
//# sourceMappingURL=CodeEditor.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../src/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAGH,OAAO,EAAoB,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAML,KAAK,oBAAoB,
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../src/code-editor/CodeEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAGH,OAAO,EAAoB,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAML,KAAK,oBAAoB,EAG1B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEzE,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,kBAAkB,CAAC,EACf,CAAC,eAAe,CAAC,cAAc,GAAG,eAAe,CAAC,oBAAoB,CAAC,GACvE,SAAS,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,SAAS,CAAC;CACpD,CAyKA,CAAC"}
|
@@ -16,12 +16,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
*/
|
17
17
|
import { useState, useRef, useEffect } from 'react';
|
18
18
|
import { editor as monacoEditorAPI } from 'monaco-editor';
|
19
|
-
import { disposeCodeEditor, getBaseCodeEditorOptions, resetLineNumberGutterWidth, getCodeEditorValue, normalizeLineEnding, } from './CodeEditorUtils.js';
|
19
|
+
import { disposeCodeEditor, getBaseCodeEditorOptions, resetLineNumberGutterWidth, getCodeEditorValue, normalizeLineEnding, setErrorMarkers, clearMarkers, } from './CodeEditorUtils.js';
|
20
20
|
import { DEFAULT_TAB_SIZE, useApplicationStore, } from '@finos/legend-application';
|
21
21
|
import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
|
22
22
|
import { clsx, WordWrapIcon } from '@finos/legend-art';
|
23
23
|
export const CodeEditor = (props) => {
|
24
|
-
const { inputValue, updateInput, lightTheme, language, isReadOnly, hideMinimap, hideGutter, hidePadding, hideActionBar, lineToScroll, extraEditorOptions, } = props;
|
24
|
+
const { inputValue, updateInput, lightTheme, language, isReadOnly, hideMinimap, hideGutter, hidePadding, hideActionBar, lineToScroll, extraEditorOptions, error, } = props;
|
25
25
|
const applicationStore = useApplicationStore();
|
26
26
|
const [editor, setEditor] = useState();
|
27
27
|
const [isWordWrap, setIsWordWrap] = useState(false);
|
@@ -108,6 +108,22 @@ export const CodeEditor = (props) => {
|
|
108
108
|
});
|
109
109
|
const model = editor.getModel();
|
110
110
|
model?.updateOptions({ tabSize: DEFAULT_TAB_SIZE });
|
111
|
+
if (model) {
|
112
|
+
if (error?.sourceInformation) {
|
113
|
+
setErrorMarkers(model, [
|
114
|
+
{
|
115
|
+
message: error.message,
|
116
|
+
startLineNumber: error.sourceInformation.startLine,
|
117
|
+
startColumn: error.sourceInformation.startColumn,
|
118
|
+
endLineNumber: error.sourceInformation.endLine,
|
119
|
+
endColumn: error.sourceInformation.endColumn,
|
120
|
+
},
|
121
|
+
]);
|
122
|
+
}
|
123
|
+
else {
|
124
|
+
clearMarkers();
|
125
|
+
}
|
126
|
+
}
|
111
127
|
}
|
112
128
|
// dispose editor
|
113
129
|
useEffect(() => () => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../src/code-editor/CodeEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAoB,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,
|
1
|
+
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../src/code-editor/CodeEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAoB,MAAM,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EAEnB,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGvD,MAAM,CAAC,MAAM,UAAU,GAelB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EACJ,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,KAAK,GACN,GAAG,KAAK,CAAC;IACV,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAEjC,CAAC;IACJ,MAAM,CAA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,CAAC,EACF,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,oBAAoB,YAExD,KAAC,YAAY,KAAG,GACT,GACL,CACP,EACD,cACE,SAAS,EAAE,IAAI,CAAC,sBAAsB,EAAE;oBACtC,+BAA+B,EAAE,CAAC,WAAW;oBAC7C,oCAAoC,EAAE,CAAC,aAAa;iBACrD,CAAC,YAEF,cAAK,SAAS,EAAC,mBAAmB,EAAC,GAAG,EAAE,YAAY,GAAI,GACpD,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
@@ -15,8 +15,11 @@
|
|
15
15
|
*/
|
16
16
|
/// <reference types="react" resolution-mode="require"/>
|
17
17
|
import { type AgReactUiProps, type AgGridReactProps } from '@ag-grid-community/react';
|
18
|
-
import { type CellMouseOverEvent, type ICellRendererParams, type GridOptions, type ColDef } from '@ag-grid-community/core';
|
18
|
+
import { type CellMouseOverEvent, type ICellRendererParams, type GridOptions, type ColumnApi, type ColDef, type ColumnState } from '@ag-grid-community/core';
|
19
|
+
export declare const communityModules: import("@ag-grid-community/core").Module[];
|
20
|
+
export declare const enterpriseModules: import("@ag-grid-community/core").Module[];
|
21
|
+
export declare const allModules: import("@ag-grid-community/core").Module[];
|
19
22
|
export declare function DataGrid<TData = unknown>(props: AgGridReactProps<TData> | AgReactUiProps<TData>): JSX.Element;
|
20
23
|
export declare const configureDataGridComponent: () => void;
|
21
|
-
export type { CellMouseOverEvent as DataGridCellMouseOverEvent, ICellRendererParams as DataGridCellRendererParams, GridOptions as DataGridOptions, ColDef as DataGridColumnDefinition, };
|
24
|
+
export type { CellMouseOverEvent as DataGridCellMouseOverEvent, ICellRendererParams as DataGridCellRendererParams, GridOptions as DataGridOptions, ColDef as DataGridColumnDefinition, ColumnState as DataGridColumnState, ColumnApi as DataGridColumnApi, };
|
22
25
|
//# sourceMappingURL=DataGrid.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAEH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAEH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAalC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,eAAO,MAAM,gBAAgB,4CAA8C,CAAC;AAE5E,eAAO,MAAM,iBAAiB,4CAW7B,CAAC;AAEF,eAAO,MAAM,UAAU,4CAA6C,CAAC;AAIrE,wBAAgB,QAAQ,CAAC,KAAK,GAAG,OAAO,EACtC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,GACrD,GAAG,CAAC,OAAO,CAgBb;AAED,eAAO,MAAM,0BAA0B,QAAO,IAE7C,CAAC;AAEF,YAAY,EACV,kBAAkB,IAAI,0BAA0B,EAChD,mBAAmB,IAAI,0BAA0B,EACjD,WAAW,IAAI,eAAe,EAC9B,MAAM,IAAI,wBAAwB,EAClC,WAAW,IAAI,mBAAmB,EAClC,SAAS,IAAI,iBAAiB,GAC/B,CAAC"}
|
@@ -16,8 +16,37 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
*/
|
17
17
|
import { AgGridReact, } from '@ag-grid-community/react';
|
18
18
|
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
19
|
+
import { CsvExportModule } from '@ag-grid-community/csv-export';
|
20
|
+
import { ClipboardModule } from '@ag-grid-enterprise/clipboard';
|
21
|
+
import { ColumnsToolPanelModule } from '@ag-grid-enterprise/column-tool-panel';
|
22
|
+
import { ExcelExportModule } from '@ag-grid-enterprise/excel-export';
|
23
|
+
import { FiltersToolPanelModule } from '@ag-grid-enterprise/filter-tool-panel';
|
24
|
+
import { MenuModule } from '@ag-grid-enterprise/menu';
|
25
|
+
import { RangeSelectionModule } from '@ag-grid-enterprise/range-selection';
|
26
|
+
import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping';
|
27
|
+
import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model';
|
28
|
+
import { SideBarModule } from '@ag-grid-enterprise/side-bar';
|
29
|
+
import { StatusBarModule } from '@ag-grid-enterprise/status-bar';
|
19
30
|
import { ModuleRegistry, } from '@ag-grid-community/core';
|
31
|
+
import { LicenseManager } from '@ag-grid-enterprise/core';
|
32
|
+
export const communityModules = [ClientSideRowModelModule, CsvExportModule];
|
33
|
+
export const enterpriseModules = [
|
34
|
+
ClipboardModule,
|
35
|
+
ColumnsToolPanelModule,
|
36
|
+
ExcelExportModule,
|
37
|
+
FiltersToolPanelModule,
|
38
|
+
MenuModule,
|
39
|
+
RangeSelectionModule,
|
40
|
+
RowGroupingModule,
|
41
|
+
ServerSideRowModelModule,
|
42
|
+
SideBarModule,
|
43
|
+
StatusBarModule,
|
44
|
+
];
|
45
|
+
export const allModules = communityModules.concat(enterpriseModules);
|
20
46
|
export function DataGrid(props) {
|
47
|
+
if (AG_GRID_LICENSE) {
|
48
|
+
LicenseManager.setLicenseKey(AG_GRID_LICENSE);
|
49
|
+
}
|
21
50
|
return (_jsx(AgGridReact
|
22
51
|
// Temporarily disable usage the browser's ResizeObserver as sometimes, this causes the error
|
23
52
|
// `ResizeObserver loop limit exceeded` when we zoom in too much, in our cases, the problem
|
@@ -30,7 +59,7 @@ export function DataGrid(props) {
|
|
30
59
|
// seem to arise when the scrollbar visibility changes as row data is being supplied
|
31
60
|
// one way to resolve this problem is to set `alwaysShowVerticalScroll={true}`
|
32
61
|
// See https://github.com/ag-grid/ag-grid/issues/2588
|
33
|
-
suppressBrowserResizeObserver: true, ...props, modules:
|
62
|
+
suppressBrowserResizeObserver: true, ...props, modules: AG_GRID_LICENSE ? allModules : communityModules }));
|
34
63
|
}
|
35
64
|
export const configureDataGridComponent = () => {
|
36
65
|
ModuleRegistry.registerModules([ClientSideRowModelModule]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,GAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,
|
1
|
+
{"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,GAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE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
"version": "1.1.43",
|
4
4
|
"description": "Legend shared advanced application components and building blocks",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -49,11 +49,23 @@
|
|
49
49
|
"dependencies": {
|
50
50
|
"@ag-grid-community/client-side-row-model": "30.1.0",
|
51
51
|
"@ag-grid-community/core": "30.1.0",
|
52
|
+
"@ag-grid-community/csv-export": "30.1.0",
|
52
53
|
"@ag-grid-community/react": "30.1.0",
|
53
54
|
"@ag-grid-community/styles": "30.1.0",
|
54
|
-
"@
|
55
|
-
"@
|
56
|
-
"@
|
55
|
+
"@ag-grid-enterprise/clipboard": "30.1.0",
|
56
|
+
"@ag-grid-enterprise/column-tool-panel": "30.1.0",
|
57
|
+
"@ag-grid-enterprise/core": "30.1.0",
|
58
|
+
"@ag-grid-enterprise/excel-export": "30.1.0",
|
59
|
+
"@ag-grid-enterprise/filter-tool-panel": "30.1.0",
|
60
|
+
"@ag-grid-enterprise/menu": "30.1.0",
|
61
|
+
"@ag-grid-enterprise/range-selection": "30.1.0",
|
62
|
+
"@ag-grid-enterprise/row-grouping": "30.1.0",
|
63
|
+
"@ag-grid-enterprise/server-side-row-model": "30.1.0",
|
64
|
+
"@ag-grid-enterprise/side-bar": "30.1.0",
|
65
|
+
"@ag-grid-enterprise/status-bar": "30.1.0",
|
66
|
+
"@finos/legend-application": "15.0.48",
|
67
|
+
"@finos/legend-art": "7.1.2",
|
68
|
+
"@finos/legend-graph": "31.3.8",
|
57
69
|
"@finos/legend-shared": "10.0.27",
|
58
70
|
"@types/css-font-loading-module": "0.0.9",
|
59
71
|
"@types/react": "18.2.22",
|
@@ -23,6 +23,8 @@ import {
|
|
23
23
|
getCodeEditorValue,
|
24
24
|
normalizeLineEnding,
|
25
25
|
type CODE_EDITOR_LANGUAGE,
|
26
|
+
setErrorMarkers,
|
27
|
+
clearMarkers,
|
26
28
|
} from './CodeEditorUtils.js';
|
27
29
|
import {
|
28
30
|
DEFAULT_TAB_SIZE,
|
@@ -30,6 +32,7 @@ import {
|
|
30
32
|
} from '@finos/legend-application';
|
31
33
|
import { CODE_EDITOR_THEME } from './CodeEditorTheme.js';
|
32
34
|
import { clsx, WordWrapIcon } from '@finos/legend-art';
|
35
|
+
import type { CompilationError, ParserError } from '@finos/legend-graph';
|
33
36
|
|
34
37
|
export const CodeEditor: React.FC<{
|
35
38
|
inputValue: string;
|
@@ -45,6 +48,7 @@ export const CodeEditor: React.FC<{
|
|
45
48
|
extraEditorOptions?:
|
46
49
|
| (monacoEditorAPI.IEditorOptions & monacoEditorAPI.IGlobalEditorOptions)
|
47
50
|
| undefined;
|
51
|
+
error?: ParserError | CompilationError | undefined;
|
48
52
|
}> = (props) => {
|
49
53
|
const {
|
50
54
|
inputValue,
|
@@ -58,6 +62,7 @@ export const CodeEditor: React.FC<{
|
|
58
62
|
hideActionBar,
|
59
63
|
lineToScroll,
|
60
64
|
extraEditorOptions,
|
65
|
+
error,
|
61
66
|
} = props;
|
62
67
|
const applicationStore = useApplicationStore();
|
63
68
|
const [editor, setEditor] = useState<
|
@@ -158,6 +163,21 @@ export const CodeEditor: React.FC<{
|
|
158
163
|
});
|
159
164
|
const model = editor.getModel();
|
160
165
|
model?.updateOptions({ tabSize: DEFAULT_TAB_SIZE });
|
166
|
+
if (model) {
|
167
|
+
if (error?.sourceInformation) {
|
168
|
+
setErrorMarkers(model, [
|
169
|
+
{
|
170
|
+
message: error.message,
|
171
|
+
startLineNumber: error.sourceInformation.startLine,
|
172
|
+
startColumn: error.sourceInformation.startColumn,
|
173
|
+
endLineNumber: error.sourceInformation.endLine,
|
174
|
+
endColumn: error.sourceInformation.endColumn,
|
175
|
+
},
|
176
|
+
]);
|
177
|
+
} else {
|
178
|
+
clearMarkers();
|
179
|
+
}
|
180
|
+
}
|
161
181
|
}
|
162
182
|
|
163
183
|
// dispose editor
|
@@ -20,17 +20,53 @@ import {
|
|
20
20
|
type AgGridReactProps,
|
21
21
|
} from '@ag-grid-community/react';
|
22
22
|
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
23
|
+
import { CsvExportModule } from '@ag-grid-community/csv-export';
|
24
|
+
import { ClipboardModule } from '@ag-grid-enterprise/clipboard';
|
25
|
+
import { ColumnsToolPanelModule } from '@ag-grid-enterprise/column-tool-panel';
|
26
|
+
import { ExcelExportModule } from '@ag-grid-enterprise/excel-export';
|
27
|
+
import { FiltersToolPanelModule } from '@ag-grid-enterprise/filter-tool-panel';
|
28
|
+
import { MenuModule } from '@ag-grid-enterprise/menu';
|
29
|
+
import { RangeSelectionModule } from '@ag-grid-enterprise/range-selection';
|
30
|
+
import { RowGroupingModule } from '@ag-grid-enterprise/row-grouping';
|
31
|
+
import { ServerSideRowModelModule } from '@ag-grid-enterprise/server-side-row-model';
|
32
|
+
import { SideBarModule } from '@ag-grid-enterprise/side-bar';
|
33
|
+
import { StatusBarModule } from '@ag-grid-enterprise/status-bar';
|
23
34
|
import {
|
24
35
|
type CellMouseOverEvent,
|
25
36
|
type ICellRendererParams,
|
26
37
|
type GridOptions,
|
38
|
+
type ColumnApi,
|
27
39
|
type ColDef,
|
40
|
+
type ColumnState,
|
28
41
|
ModuleRegistry,
|
29
42
|
} from '@ag-grid-community/core';
|
43
|
+
import { LicenseManager } from '@ag-grid-enterprise/core';
|
44
|
+
|
45
|
+
export const communityModules = [ClientSideRowModelModule, CsvExportModule];
|
46
|
+
|
47
|
+
export const enterpriseModules = [
|
48
|
+
ClipboardModule,
|
49
|
+
ColumnsToolPanelModule,
|
50
|
+
ExcelExportModule,
|
51
|
+
FiltersToolPanelModule,
|
52
|
+
MenuModule,
|
53
|
+
RangeSelectionModule,
|
54
|
+
RowGroupingModule,
|
55
|
+
ServerSideRowModelModule,
|
56
|
+
SideBarModule,
|
57
|
+
StatusBarModule,
|
58
|
+
];
|
59
|
+
|
60
|
+
export const allModules = communityModules.concat(enterpriseModules);
|
61
|
+
|
62
|
+
declare const AG_GRID_LICENSE: string;
|
30
63
|
|
31
64
|
export function DataGrid<TData = unknown>(
|
32
65
|
props: AgGridReactProps<TData> | AgReactUiProps<TData>,
|
33
66
|
): JSX.Element {
|
67
|
+
if (AG_GRID_LICENSE) {
|
68
|
+
LicenseManager.setLicenseKey(AG_GRID_LICENSE);
|
69
|
+
}
|
34
70
|
return (
|
35
71
|
<AgGridReact
|
36
72
|
// Temporarily disable usage the browser's ResizeObserver as sometimes, this causes the error
|
@@ -40,7 +76,7 @@ export function DataGrid<TData = unknown>(
|
|
40
76
|
// See https://github.com/ag-grid/ag-grid/issues/2588
|
41
77
|
suppressBrowserResizeObserver={true}
|
42
78
|
{...props}
|
43
|
-
modules={
|
79
|
+
modules={AG_GRID_LICENSE ? allModules : communityModules}
|
44
80
|
/>
|
45
81
|
);
|
46
82
|
}
|
@@ -54,4 +90,6 @@ export type {
|
|
54
90
|
ICellRendererParams as DataGridCellRendererParams,
|
55
91
|
GridOptions as DataGridOptions,
|
56
92
|
ColDef as DataGridColumnDefinition,
|
93
|
+
ColumnState as DataGridColumnState,
|
94
|
+
ColumnApi as DataGridColumnApi,
|
57
95
|
};
|