@adaptabletools/adaptable 20.0.0-canary.4 → 20.0.0-canary.5
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/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -1
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +1 -0
- package/src/AdaptableOptions/EditOptions.d.ts +13 -2
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +7 -0
- package/src/Api/Implementation/ThemeApiImpl.js +3 -1
- package/src/Api/Internal/RowFormInternalApi.js +1 -1
- package/src/Api/ThemeApi.d.ts +2 -0
- package/src/PredefinedConfig/AlertState.d.ts +1 -1
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +0 -16
- package/src/PredefinedConfig/FlashingCellState.d.ts +1 -1
- package/src/PredefinedConfig/LayoutState.d.ts +2 -2
- package/src/Utilities/Services/ThemeService.d.ts +1 -1
- package/src/Utilities/Services/ThemeService.js +5 -5
- package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +4 -1
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +7 -2
- package/src/agGrid/AdaptableAgGrid.d.ts +2 -2
- package/src/agGrid/AdaptableAgGrid.js +11 -74
- package/src/agGrid/AgGridAdapter.d.ts +1 -1
- package/src/agGrid/AgGridAdapter.js +2 -6
- package/src/agGrid/AgGridColumnAdapter.js +0 -4
- package/src/agGrid/AgGridThemeAdapter.d.ts +19 -0
- package/src/agGrid/AgGridThemeAdapter.js +122 -0
- package/src/components/OverlayTrigger/useAgGridClassName.js +1 -1
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +16 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/VersionUpgrade20.js +49 -5
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "20.0.0-canary.
|
|
3
|
+
"version": "20.0.0-canary.5",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -31,6 +31,7 @@ import { AgGridMenuAdapter } from '../agGrid/AgGridMenuAdapter';
|
|
|
31
31
|
import { RowFormService } from '../Utilities/Services/RowFormService';
|
|
32
32
|
import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
|
|
33
33
|
import { AgGridExportAdapter } from '../agGrid/AgGridExportAdapter';
|
|
34
|
+
import { AgGridThemeAdapter } from '../agGrid/AgGridThemeAdapter';
|
|
34
35
|
/**
|
|
35
36
|
* Contains AG Grid Options and Modules - used when instantiating AdapTable vanilla
|
|
36
37
|
*/
|
|
@@ -66,6 +67,7 @@ export interface IAdaptable {
|
|
|
66
67
|
agGridMenuAdapter: AgGridMenuAdapter;
|
|
67
68
|
agGridColumnAdapter: AgGridColumnAdapter;
|
|
68
69
|
agGridExportAdapter: AgGridExportAdapter;
|
|
70
|
+
agGridThemeAdapter: AgGridThemeAdapter;
|
|
69
71
|
hasAdaptableToolPanel: boolean;
|
|
70
72
|
renderReactRoot: RenderReactRootFn;
|
|
71
73
|
/**
|
|
@@ -244,7 +246,6 @@ export interface IAdaptable {
|
|
|
244
246
|
isGridRangeSelectable(): boolean;
|
|
245
247
|
isGridRowSelectable(): boolean;
|
|
246
248
|
isGridGroupingActive(): boolean;
|
|
247
|
-
getAgGridCurrentThemeName(): string;
|
|
248
249
|
applyAdaptableTheme(theme: AdaptableTheme | string): void;
|
|
249
250
|
setRowGroupColumns(columnIds: string[]): void;
|
|
250
251
|
getAllGridColumns(): Column<any>[];
|
|
@@ -39,17 +39,28 @@ export interface EditOptions<TData = any> {
|
|
|
39
39
|
*/
|
|
40
40
|
export interface CustomEditColumnValuesContext<TData = any> extends AdaptableColumnContext<TData> {
|
|
41
41
|
/**
|
|
42
|
-
* Current distinct values in
|
|
42
|
+
* Current distinct values in Column
|
|
43
43
|
*/
|
|
44
44
|
defaultValues: Required<CustomEditColumnValueInfo>[];
|
|
45
|
+
/**
|
|
46
|
+
* Search text in Edit - used when fetching values from server
|
|
47
|
+
*/
|
|
45
48
|
currentSearchValue: string;
|
|
46
49
|
/**
|
|
47
50
|
* Currently edited Grid Cell
|
|
48
51
|
*/
|
|
49
52
|
gridCell: GridCell;
|
|
50
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Information about items in the Edit Controls
|
|
56
|
+
*/
|
|
51
57
|
export interface CustomEditColumnValueInfo {
|
|
52
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Item's label
|
|
60
|
+
*/ label?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Value of Item being shown
|
|
63
|
+
*/
|
|
53
64
|
value: any;
|
|
54
65
|
}
|
|
55
66
|
/**
|
|
@@ -68,6 +68,13 @@ export interface UserInterfaceOptions<TData = any> {
|
|
|
68
68
|
* @gridInfoItem
|
|
69
69
|
*/
|
|
70
70
|
showAdapTableVersion?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Displays the AG Grid version in Grid Info section of Settings Panel
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue true
|
|
75
|
+
* @gridInfoItem
|
|
76
|
+
*/
|
|
77
|
+
showAgGridVersion?: boolean;
|
|
71
78
|
/**
|
|
72
79
|
* English variant to use in AdapTable UI
|
|
73
80
|
*
|
|
@@ -4,6 +4,7 @@ import { ApiBase } from './ApiBase';
|
|
|
4
4
|
import { StaticThemes } from '../../themes';
|
|
5
5
|
import { ThemeInternalApi } from '../Internal/ThemeInternalApi';
|
|
6
6
|
import AdaptableHelper from '../../Utilities/Helpers/AdaptableHelper';
|
|
7
|
+
import { logDeprecation } from '../../Utilities/logDeprecation';
|
|
7
8
|
export class ThemeApiImpl extends ApiBase {
|
|
8
9
|
constructor(_adaptable) {
|
|
9
10
|
super(_adaptable);
|
|
@@ -70,7 +71,8 @@ export class ThemeApiImpl extends ApiBase {
|
|
|
70
71
|
this.showModulePopup(ModuleConstants.ThemeModuleId);
|
|
71
72
|
}
|
|
72
73
|
getAgGridCurrentThemeName() {
|
|
73
|
-
|
|
74
|
+
logDeprecation(this._adaptable.logger, 'ThemeApi', 'getAgGridCurrentThemeName', null, `This is required only for AG Grid's legacy themes. See https://www.ag-grid.com/javascript-data-grid/theming-v32/`);
|
|
75
|
+
return this._adaptable.agGridThemeAdapter.getAgGridCurrentThemeClassNames();
|
|
74
76
|
}
|
|
75
77
|
editTheme(theme) {
|
|
76
78
|
this.dispatchAction(ThemeRedux.ThemeEdit(theme));
|
|
@@ -187,7 +187,7 @@ export class RowFormInternalApi extends ApiBase {
|
|
|
187
187
|
}
|
|
188
188
|
const returnValues = this.getGridApi().internalApi.getDistinctDisplayValuesForColumnOld(column.columnId);
|
|
189
189
|
// FIXME add support for asynchronous custom select cell editor values
|
|
190
|
-
// it involves refactoring the AdaptableForm &
|
|
190
|
+
// it involves refactoring the AdaptableForm & adaptableFormComponent
|
|
191
191
|
// await this.getSelectCellEditorValuesForColumn(
|
|
192
192
|
// column,
|
|
193
193
|
// gridCell
|
package/src/Api/ThemeApi.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ export interface ThemeApi {
|
|
|
81
81
|
openThemeSettingsPanel(): void;
|
|
82
82
|
/**
|
|
83
83
|
* Get the name of the current AG Grid theme
|
|
84
|
+
*
|
|
85
|
+
* @deprecated required only for legacy AG Grid themes, see https://www.ag-grid.com/javascript-data-grid/theming-v32/
|
|
84
86
|
*/
|
|
85
87
|
getAgGridCurrentThemeName(): string;
|
|
86
88
|
}
|
|
@@ -150,4 +150,4 @@ export type SystemAlertPredicateIds = SystemAlertPredicateId[];
|
|
|
150
150
|
/**
|
|
151
151
|
* List of System Predicates available for Alerts
|
|
152
152
|
*/
|
|
153
|
-
export type SystemAlertPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | '
|
|
153
|
+
export type SystemAlertPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | 'In' | 'NotIn' | 'AnyChange';
|
|
@@ -266,22 +266,6 @@ export const SystemPredicateDefs = [
|
|
|
266
266
|
toString: ({ inputs }) => `Not Between ${inputs[0] ?? ''}:${inputs[1]}`,
|
|
267
267
|
shortcuts: ['!:'],
|
|
268
268
|
},
|
|
269
|
-
{
|
|
270
|
-
id: 'IsNumeric',
|
|
271
|
-
label: 'Is Numeric',
|
|
272
|
-
icon: { text: '1' },
|
|
273
|
-
columnScope: { DataTypes: ['number'] },
|
|
274
|
-
moduleScope: ['alert', 'flashingcell'],
|
|
275
|
-
handler: ({ value }) => !isNaN(Number(value)),
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
id: 'IsNotNumeric',
|
|
279
|
-
label: 'Is Not Numeric',
|
|
280
|
-
icon: { text: '1' },
|
|
281
|
-
columnScope: { DataTypes: ['number'] },
|
|
282
|
-
moduleScope: ['alert', 'flashingcell'],
|
|
283
|
-
handler: ({ value }) => isNaN(Number(value)),
|
|
284
|
-
},
|
|
285
269
|
// String System Filters
|
|
286
270
|
{
|
|
287
271
|
id: 'Is',
|
|
@@ -72,4 +72,4 @@ export type SystemFlashingCellPredicateIds = SystemFlashingCellPredicateId[];
|
|
|
72
72
|
/**
|
|
73
73
|
* List of System Predicates available for Flashing Cells
|
|
74
74
|
*/
|
|
75
|
-
export type SystemFlashingCellPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | '
|
|
75
|
+
export type SystemFlashingCellPredicateId = 'Blanks' | 'NonBlanks' | 'Equals' | 'NotEquals' | 'GreaterThan' | 'LessThan' | 'Positive' | 'Negative' | 'Zero' | 'Between' | 'NotBetween' | 'Is' | 'IsNot' | 'Contains' | 'NotContains' | 'StartsWith' | 'EndsWith' | 'Regex' | 'Today' | 'Yesterday' | 'Tomorrow' | 'ThisWeek' | 'ThisMonth' | 'ThisQuarter' | 'ThisYear' | 'InPast' | 'InFuture' | 'Before' | 'After' | 'On' | 'NotOn' | 'NextWorkDay' | 'LastWorkDay' | 'WorkDay' | 'Holiday' | 'True' | 'False' | 'PercentChange' | 'In' | 'NotIn' | 'AnyChange';
|
|
@@ -51,7 +51,7 @@ export interface LayoutBase extends AdaptableObject {
|
|
|
51
51
|
*/
|
|
52
52
|
ColumnHeaders?: ColumnStringMap;
|
|
53
53
|
/**
|
|
54
|
-
* Whether to include aggFunc name in
|
|
54
|
+
* Whether to include aggFunc name in Column header: e.g. 'sum(Price)' becomes 'Price'
|
|
55
55
|
*/
|
|
56
56
|
SuppressAggFuncInHeader?: boolean;
|
|
57
57
|
/**
|
|
@@ -88,7 +88,7 @@ export interface TableLayout extends LayoutBase {
|
|
|
88
88
|
*/
|
|
89
89
|
RowSummaries?: RowSummary[];
|
|
90
90
|
/**
|
|
91
|
-
* Columns showing aggregated values in
|
|
91
|
+
* Columns showing aggregated values in Grouped Rows; a record of ColumnId and aggfunc (e.g. sum) or 'true' (to use default aggfunc)
|
|
92
92
|
*/
|
|
93
93
|
TableAggregationColumns?: TableAggregationColumns;
|
|
94
94
|
/**
|
|
@@ -5,10 +5,10 @@ export declare class ThemeService implements IThemeService {
|
|
|
5
5
|
private unsubscribe;
|
|
6
6
|
private styleSheetObject;
|
|
7
7
|
constructor(api: AdaptableApi);
|
|
8
|
+
destroy(): void;
|
|
8
9
|
subscribe(): void;
|
|
9
10
|
onThemeChanged: () => void;
|
|
10
11
|
applyNewThemeVariables(theme: AdaptableTheme): void;
|
|
11
|
-
destroy(): void;
|
|
12
12
|
showMissingThemeFiles(theme: AdaptableTheme): void;
|
|
13
13
|
getDOMPrefferedColorScheme(): 'dark' | 'light';
|
|
14
14
|
mapOsTheme(theme: AdaptableTheme | string): AdaptableTheme;
|
|
@@ -20,6 +20,11 @@ export class ThemeService {
|
|
|
20
20
|
];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
destroy() {
|
|
24
|
+
this.api = null;
|
|
25
|
+
this.unsubscribe();
|
|
26
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets].filter((sheet) => sheet !== this.styleSheetObject);
|
|
27
|
+
}
|
|
23
28
|
subscribe() {
|
|
24
29
|
const themeChangedUnsubscribe = this.api.eventApi.on('ThemeChanged', this.onThemeChanged);
|
|
25
30
|
const prefferedColorSchemeUnsubscribe = this.attachPrefferedColorSchemeListener();
|
|
@@ -44,11 +49,6 @@ export class ThemeService {
|
|
|
44
49
|
str += '}';
|
|
45
50
|
this.styleSheetObject.replaceSync(str);
|
|
46
51
|
}
|
|
47
|
-
destroy() {
|
|
48
|
-
this.api = null;
|
|
49
|
-
this.unsubscribe();
|
|
50
|
-
document.adoptedStyleSheets = [...document.adoptedStyleSheets].filter((sheet) => sheet !== this.styleSheetObject);
|
|
51
|
-
}
|
|
52
52
|
showMissingThemeFiles(theme) {
|
|
53
53
|
// run time defined theme
|
|
54
54
|
// because it may be an empty theme
|
|
@@ -54,7 +54,10 @@ class DataChangeHistoryPopupComponent extends React.Component {
|
|
|
54
54
|
this.props.api.dataChangeHistoryApi.clearDataChangeHistoryEntry(changeToBeUndone);
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const agGridThemeMode = this.props.api.internalApi
|
|
58
|
+
.getAdaptableInstance()
|
|
59
|
+
.agGridThemeAdapter.getAgGridThemeMode();
|
|
60
|
+
const currentAgGridTheme = agGridThemeMode === 'legacy' ? this.props.api.themeApi.getAgGridCurrentThemeName() : '';
|
|
58
61
|
return (React.createElement(PopupPanel, { headerText: this.props.moduleInfo.FriendlyName, glyphicon: this.props.moduleInfo.Glyph, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed() },
|
|
59
62
|
React.createElement(Flex, { className: "ab-DataChangeHistoryPopup", flexDirection: "column", style: { height: '100%' } },
|
|
60
63
|
React.createElement(Flex, { style: {
|
|
@@ -10,7 +10,9 @@ import { AdaptableObjectRow } from '../../Components/AdaptableObjectRow';
|
|
|
10
10
|
import { PopupPanel } from '../../Components/Popups/AdaptablePopup/PopupPanel';
|
|
11
11
|
import { AdaptableObjectsSummary } from './AdaptableObjectsSummary';
|
|
12
12
|
import { ADAPTABLE_VERSION } from '../../../EnvVars';
|
|
13
|
-
|
|
13
|
+
import { AG_GRID_VERSION } from '../../../agGrid/agGridModules';
|
|
14
|
+
const adaptableVersion = ADAPTABLE_VERSION;
|
|
15
|
+
const agGridVersion = AG_GRID_VERSION;
|
|
14
16
|
export const GridInfoPopup = (props) => {
|
|
15
17
|
const api = props.api;
|
|
16
18
|
const CreateGridSummaries = (colItems) => {
|
|
@@ -33,7 +35,10 @@ export const GridInfoPopup = (props) => {
|
|
|
33
35
|
: null;
|
|
34
36
|
const selectedRowInfo = api.gridApi.getSelectedRowInfo();
|
|
35
37
|
if (api.optionsApi.getUserInterfaceOptions()?.showAdapTableVersion) {
|
|
36
|
-
returnRows.push(createReadOnlyColItem(colItems, 'AdapTable Version',
|
|
38
|
+
returnRows.push(createReadOnlyColItem(colItems, 'AdapTable Version', adaptableVersion));
|
|
39
|
+
}
|
|
40
|
+
if (api.optionsApi.getUserInterfaceOptions()?.showAgGridVersion) {
|
|
41
|
+
returnRows.push(createReadOnlyColItem(colItems, 'AG Grid Version', agGridVersion));
|
|
37
42
|
}
|
|
38
43
|
returnRows.push(createReadOnlyColItem(colItems, 'Sorted Columns', ArrayExtensions.IsNotNullOrEmpty(sorts) ? sorts.join('; ') : 'None'));
|
|
39
44
|
returnRows.push(createReadOnlyColItem(colItems, 'Column Filters', columnFilterDescription));
|
|
@@ -29,6 +29,7 @@ import { RowFormService } from '../Utilities/Services/RowFormService';
|
|
|
29
29
|
import { GridCellWithCount } from '../PredefinedConfig/Selection/GridCell';
|
|
30
30
|
import { FlashingCellService } from '../Utilities/Services/FlashingCellService';
|
|
31
31
|
import { AgGridExportAdapter } from './AgGridExportAdapter';
|
|
32
|
+
import { AgGridThemeAdapter } from './AgGridThemeAdapter';
|
|
32
33
|
export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'agGridReady' | 'available' | 'ready' | 'preDestroyed';
|
|
33
34
|
type RenderAgGridFrameworkComponentResult = false | GridApi;
|
|
34
35
|
interface AdaptableInitInternalConfig<TData = any> {
|
|
@@ -70,6 +71,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
70
71
|
agGridColumnAdapter: AgGridColumnAdapter;
|
|
71
72
|
agGridMenuAdapter: AgGridMenuAdapter;
|
|
72
73
|
agGridExportAdapter: AgGridExportAdapter;
|
|
74
|
+
agGridThemeAdapter: AgGridThemeAdapter;
|
|
73
75
|
private DANGER_USE_GETTER_adaptableContainerElement;
|
|
74
76
|
private DANGER_USE_GETTER_agGridContainerElement;
|
|
75
77
|
api: AdaptableApi;
|
|
@@ -295,8 +297,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
295
297
|
isGridGroupingActive(): boolean;
|
|
296
298
|
setAgGridQuickSearch(searchText: string): void;
|
|
297
299
|
clearAgGridQuickSearch(): void;
|
|
298
|
-
getAgGridCurrentThemeName(): string;
|
|
299
|
-
private getAgGridLightThemeName;
|
|
300
300
|
applyAdaptableTheme(theme: AdaptableTheme | string): void;
|
|
301
301
|
setRowGroupColumns(columnIds: string[]): void;
|
|
302
302
|
getAllGridColumns(): Column<any>[];
|
|
@@ -8,7 +8,7 @@ import Emitter from '../Utilities/Emitter';
|
|
|
8
8
|
import { applyDefaultAdaptableOptions } from '../AdaptableOptions/DefaultAdaptableOptions';
|
|
9
9
|
import { AgGridAdapter } from './AgGridAdapter';
|
|
10
10
|
import * as GeneralConstants from '../Utilities/Constants/GeneralConstants';
|
|
11
|
-
import { AUTOGENERATED_PK_COLUMN,
|
|
11
|
+
import { AUTOGENERATED_PK_COLUMN, ERROR_LAYOUT, GROUP_PATH_SEPARATOR, HALF_SECOND, QUARTER_SECOND, } from '../Utilities/Constants/GeneralConstants';
|
|
12
12
|
import { DataService } from '../Utilities/Services/DataService';
|
|
13
13
|
import { AdaptableStore } from '../Redux/Store/AdaptableStore';
|
|
14
14
|
import { AdaptableApiImpl } from '../Api/Implementation/AdaptableApiImpl';
|
|
@@ -95,6 +95,7 @@ import { LayoutManager } from '../layout-manager/src';
|
|
|
95
95
|
import { isPivotLayoutModel } from '../layout-manager/src/isPivotLayoutModel';
|
|
96
96
|
import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
97
97
|
import { agGridDataTypeDefinitions } from './agGridDataTypeDefinitions';
|
|
98
|
+
import { AgGridThemeAdapter } from './AgGridThemeAdapter';
|
|
98
99
|
const LocalEventService_Prototype = LocalEventService.prototype;
|
|
99
100
|
const LocalEventService_dispatchEvent = LocalEventService_Prototype.dispatchEvent;
|
|
100
101
|
LocalEventService_Prototype.dispatchEvent = function (event) {
|
|
@@ -169,6 +170,7 @@ export class AdaptableAgGrid {
|
|
|
169
170
|
this.agGridMenuAdapter = new AgGridMenuAdapter(this);
|
|
170
171
|
this.agGridColumnAdapter = new AgGridColumnAdapter(this);
|
|
171
172
|
this.agGridExportAdapter = new AgGridExportAdapter(this);
|
|
173
|
+
this.agGridThemeAdapter = new AgGridThemeAdapter(this);
|
|
172
174
|
this.DataService = new DataService(this);
|
|
173
175
|
}
|
|
174
176
|
static forEachAdaptable(fn) {
|
|
@@ -596,12 +598,12 @@ You need to define at least one Layout!`);
|
|
|
596
598
|
this.agGridAdapter.setAgGridId(agGridId);
|
|
597
599
|
return agGridId;
|
|
598
600
|
});
|
|
599
|
-
// FIXME AFL: handle both ThemingApi and legacy CSS
|
|
600
601
|
/**
|
|
601
602
|
* `theme`
|
|
602
603
|
*/
|
|
603
|
-
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (
|
|
604
|
-
|
|
604
|
+
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'theme', (original_theme) => {
|
|
605
|
+
this.agGridThemeAdapter.setAgGridThemeMode(original_theme === 'legacy' ? 'legacy' : 'themingApi');
|
|
606
|
+
return original_theme;
|
|
605
607
|
});
|
|
606
608
|
/**
|
|
607
609
|
* `getRowId`
|
|
@@ -718,7 +720,7 @@ You need to define at least one Layout!`);
|
|
|
718
720
|
if (this.isGroupRowNode(node)) {
|
|
719
721
|
return true;
|
|
720
722
|
}
|
|
721
|
-
// first assess if the Row
|
|
723
|
+
// first assess if the Row i s filterable - if not, then return true so it appears in Grid
|
|
722
724
|
const isRowFilterable = this.api.optionsApi.getFilterOptions().isRowFilterable;
|
|
723
725
|
if (typeof isRowFilterable === 'function') {
|
|
724
726
|
const rowFilterableContext = {
|
|
@@ -2576,40 +2578,6 @@ You need to define at least one Layout!`);
|
|
|
2576
2578
|
clearAgGridQuickSearch() {
|
|
2577
2579
|
this.setAgGridQuickSearch('');
|
|
2578
2580
|
}
|
|
2579
|
-
getAgGridCurrentThemeName() {
|
|
2580
|
-
const container = this.getAgGridContainerElement();
|
|
2581
|
-
if (container && container.classList) {
|
|
2582
|
-
// we detect the ag theme class
|
|
2583
|
-
const classList = container.classList;
|
|
2584
|
-
for (let i = 0, len = classList.length; i < len; i++) {
|
|
2585
|
-
const cls = classList[i];
|
|
2586
|
-
if (cls.indexOf('ag-theme-') === 0) {
|
|
2587
|
-
return cls;
|
|
2588
|
-
}
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
return this.getAgGridLightThemeName();
|
|
2592
|
-
}
|
|
2593
|
-
getAgGridLightThemeName() {
|
|
2594
|
-
const container = this.getAgGridContainerElement();
|
|
2595
|
-
if (container && container.classList) {
|
|
2596
|
-
// we detect the ag theme class
|
|
2597
|
-
const classList = container.classList;
|
|
2598
|
-
for (let i = 0, len = classList.length; i < len; i++) {
|
|
2599
|
-
const cls = classList[i];
|
|
2600
|
-
if (cls.indexOf('ag-theme-') === 0) {
|
|
2601
|
-
// even if dark theme is included, we compute the light theme name out of it
|
|
2602
|
-
return cls.replace('-dark', '');
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
else {
|
|
2607
|
-
this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
|
|
2608
|
-
}
|
|
2609
|
-
this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
|
|
2610
|
-
// fallback to the default light theme
|
|
2611
|
-
return 'ag-theme-balham';
|
|
2612
|
-
}
|
|
2613
2581
|
applyAdaptableTheme(theme) {
|
|
2614
2582
|
const container = this.getAgGridContainerElement();
|
|
2615
2583
|
if (container != null) {
|
|
@@ -2674,41 +2642,8 @@ You need to define at least one Layout!`);
|
|
|
2674
2642
|
else if (variantTheme) {
|
|
2675
2643
|
el.classList.add(`infinite-${variantTheme}`);
|
|
2676
2644
|
}
|
|
2677
|
-
// AG THEME
|
|
2678
|
-
|
|
2679
|
-
const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
|
|
2680
|
-
if (newTheme && (isSystemTheme || variantTheme)) {
|
|
2681
|
-
if ((variantTheme || themeName) === LIGHT_THEME) {
|
|
2682
|
-
newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridLightThemeName();
|
|
2683
|
-
}
|
|
2684
|
-
if ((variantTheme || themeName) === DARK_THEME) {
|
|
2685
|
-
newTheme.AgGridClassName = newTheme.AgGridClassName || getAgGridDarkThemeName();
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
if (!newTheme.AgGridClassName) {
|
|
2689
|
-
// default AG Grid to its light theme
|
|
2690
|
-
newTheme.AgGridClassName = getAgGridLightThemeName();
|
|
2691
|
-
}
|
|
2692
|
-
if (container != null) {
|
|
2693
|
-
if (themesToRemove.length) {
|
|
2694
|
-
themesToRemove.forEach((theme) => {
|
|
2695
|
-
if (theme.AgGridClassName) {
|
|
2696
|
-
container.classList.remove(theme.AgGridClassName);
|
|
2697
|
-
}
|
|
2698
|
-
});
|
|
2699
|
-
}
|
|
2700
|
-
// also remove all AG Grid theme class names
|
|
2701
|
-
const agGridClassNamesToRemove = [];
|
|
2702
|
-
container.classList.forEach((x) => {
|
|
2703
|
-
if (x && x.indexOf('ag-theme-') === 0) {
|
|
2704
|
-
agGridClassNamesToRemove.push(x);
|
|
2705
|
-
}
|
|
2706
|
-
});
|
|
2707
|
-
agGridClassNamesToRemove.forEach((x) => container.classList.remove(x));
|
|
2708
|
-
if (newTheme && newTheme.AgGridClassName) {
|
|
2709
|
-
container.classList.add(newTheme.AgGridClassName);
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2645
|
+
// Update AG THEME
|
|
2646
|
+
this.agGridThemeAdapter.applyAgGridThemeOnAdaptableThemeChange(newTheme, variantTheme, container, themesToRemove);
|
|
2712
2647
|
// MAC LIKE SCROLLBARS
|
|
2713
2648
|
if (this.adaptableOptions.userInterfaceOptions &&
|
|
2714
2649
|
this.adaptableOptions.userInterfaceOptions.useCustomMacLikeScrollbars &&
|
|
@@ -2902,6 +2837,8 @@ You need to define at least one Layout!`);
|
|
|
2902
2837
|
this.agGridColumnAdapter = null;
|
|
2903
2838
|
this.agGridExportAdapter?.destroy();
|
|
2904
2839
|
this.agGridExportAdapter = null;
|
|
2840
|
+
this.agGridThemeAdapter?.destroy();
|
|
2841
|
+
this.agGridThemeAdapter = null;
|
|
2905
2842
|
this.rowListeners = null;
|
|
2906
2843
|
this.emitter.destroy();
|
|
2907
2844
|
this.emitter = null;
|
|
@@ -3,6 +3,7 @@ import { AdaptableAgGrid } from './AdaptableAgGrid';
|
|
|
3
3
|
import { AdaptableColumn, AdaptableColumnGroup } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
4
4
|
import { SelectedCellInfo } from '../PredefinedConfig/Selection/SelectedCellInfo';
|
|
5
5
|
import { SelectedRowInfo } from '../PredefinedConfig/Selection/SelectedRowInfo';
|
|
6
|
+
export type AgGridThemeMode = 'legacy' | 'themingApi';
|
|
6
7
|
export declare class AgGridAdapter {
|
|
7
8
|
private _adaptableInstance;
|
|
8
9
|
private DANGER_USE_GETTER_gridApi;
|
|
@@ -45,7 +46,6 @@ export declare class AgGridAdapter {
|
|
|
45
46
|
deriveSelectedCellInfoFromAgGrid(): SelectedCellInfo;
|
|
46
47
|
deriveSelectedRowInfoFromAgGrid(): SelectedRowInfo;
|
|
47
48
|
isPinnedRowNode(rowNode: IRowNode): boolean;
|
|
48
|
-
getFirstGroupedColumn(): string | undefined;
|
|
49
49
|
createAdaptableColumnFromAgGridColumn(agGridColumn: Column, colsToGroups: Record<string, AdaptableColumnGroup>): AdaptableColumn;
|
|
50
50
|
private deriveAdaptableColumnDataType;
|
|
51
51
|
private isColumnReadonly;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColumnApiModule, } from 'ag-grid-enterprise';
|
|
2
2
|
import { ACTION_COLUMN_TYPE, CALCULATED_COLUMN_TYPE, FDC3_COLUMN_TYPE, FREE_TEXT_COLUMN_TYPE, } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
3
|
-
import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME } from '../Utilities/Constants/GeneralConstants';
|
|
3
|
+
import { ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME, } from '../Utilities/Constants/GeneralConstants';
|
|
4
4
|
import { createUuid } from '../PredefinedConfig/Uuid';
|
|
5
5
|
import ArrayExtensions from '../Utilities/Extensions/ArrayExtensions';
|
|
6
6
|
import * as ModuleConstants from '../Utilities/Constants/ModuleConstants';
|
|
@@ -367,10 +367,6 @@ export class AgGridAdapter {
|
|
|
367
367
|
}
|
|
368
368
|
return false;
|
|
369
369
|
}
|
|
370
|
-
// TODO AFL MIG rename to getFirstGroupedColumnId()
|
|
371
|
-
getFirstGroupedColumn() {
|
|
372
|
-
return this.getAgGridApi?.()?.getRowGroupColumns()?.[0]?.getColId();
|
|
373
|
-
}
|
|
374
370
|
createAdaptableColumnFromAgGridColumn(agGridColumn, colsToGroups) {
|
|
375
371
|
const colId = agGridColumn.getColId();
|
|
376
372
|
const colDef = agGridColumn.getColDef();
|
|
@@ -525,7 +521,7 @@ export class AgGridAdapter {
|
|
|
525
521
|
else if (Array.isArray(value)) {
|
|
526
522
|
const arrayDataType = ALL_ADAPTABLE_DATA_TYPES.find((arrayType) => {
|
|
527
523
|
const dataTypeDefinition = agGridDataTypeDefinitions[arrayType];
|
|
528
|
-
const dataTypeMatching = dataTypeDefinition
|
|
524
|
+
const dataTypeMatching = dataTypeDefinition?.dataTypeMatcher(value);
|
|
529
525
|
return dataTypeMatching;
|
|
530
526
|
});
|
|
531
527
|
if (arrayDataType) {
|
|
@@ -138,8 +138,6 @@ export class AgGridColumnAdapter {
|
|
|
138
138
|
this.setupColumnQuickFilerText(colSetupInfo);
|
|
139
139
|
this.setupColumnAllowedAggFuncs(colSetupInfo);
|
|
140
140
|
this.setupColumnType(colSetupInfo);
|
|
141
|
-
// this is just to make sure that AG Grid does NOT infer the cellDataType
|
|
142
|
-
// https://github.com/AdaptableTools/adaptable/issues/2230 should render it obsolete
|
|
143
141
|
this.setupColumnCellDataType(colSetupInfo);
|
|
144
142
|
});
|
|
145
143
|
}
|
|
@@ -375,8 +373,6 @@ export class AgGridColumnAdapter {
|
|
|
375
373
|
}
|
|
376
374
|
setupColumnCellDataType(columnSetupInfo) {
|
|
377
375
|
const { col } = columnSetupInfo;
|
|
378
|
-
// AG Grid introduced since v30.x an inferred cellDataType
|
|
379
|
-
// the problem is that it breaks the default value formatter and/or editor (especially for Date columns)
|
|
380
376
|
this.setColDefProperty(col, 'cellDataType', (original_cellDataType) => {
|
|
381
377
|
return original_cellDataType ?? true;
|
|
382
378
|
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdaptableAgGrid } from './AdaptableAgGrid';
|
|
2
|
+
import { AgGridThemeMode } from './AgGridAdapter';
|
|
3
|
+
import { AdaptableTheme } from '../PredefinedConfig/ThemeState';
|
|
4
|
+
export declare class AgGridThemeAdapter {
|
|
5
|
+
private _adaptableInstance;
|
|
6
|
+
private agGridThemeMode;
|
|
7
|
+
constructor(_adaptableInstance: AdaptableAgGrid);
|
|
8
|
+
destroy(): void;
|
|
9
|
+
get logger(): import("./AdaptableLogger").AdaptableLogger;
|
|
10
|
+
get api(): import("../types").AdaptableApi;
|
|
11
|
+
setAgGridThemeMode(themeMode: AgGridThemeMode): void;
|
|
12
|
+
getAgGridThemeMode(): AgGridThemeMode;
|
|
13
|
+
applyAgGridThemeOnAdaptableThemeChange(adaptableTheme: AdaptableTheme, variantTheme: string, agGridContainer: HTMLElement, themesToRemove: AdaptableTheme[]): void;
|
|
14
|
+
private getAgGridContainerElement;
|
|
15
|
+
private legacy_applyAgGridThemeOnAdaptableThemeChange;
|
|
16
|
+
getAgGridCurrentThemeClassNames(): string;
|
|
17
|
+
private getAgGridLightThemeName;
|
|
18
|
+
private legacy_getAgGridCurrentThemeClassNames;
|
|
19
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { DARK_THEME, LIGHT_THEME } from '../Utilities/Constants/GeneralConstants';
|
|
2
|
+
export class AgGridThemeAdapter {
|
|
3
|
+
constructor(_adaptableInstance) {
|
|
4
|
+
this._adaptableInstance = _adaptableInstance;
|
|
5
|
+
}
|
|
6
|
+
destroy() { }
|
|
7
|
+
get logger() {
|
|
8
|
+
return this._adaptableInstance.logger;
|
|
9
|
+
}
|
|
10
|
+
get api() {
|
|
11
|
+
return this._adaptableInstance.api;
|
|
12
|
+
}
|
|
13
|
+
setAgGridThemeMode(themeMode) {
|
|
14
|
+
this.agGridThemeMode = themeMode;
|
|
15
|
+
}
|
|
16
|
+
getAgGridThemeMode() {
|
|
17
|
+
return this.agGridThemeMode;
|
|
18
|
+
}
|
|
19
|
+
applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove) {
|
|
20
|
+
if (this.agGridThemeMode === 'legacy') {
|
|
21
|
+
this.legacy_applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove);
|
|
22
|
+
}
|
|
23
|
+
const themeName = adaptableTheme.Name;
|
|
24
|
+
const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
|
|
25
|
+
if (adaptableTheme && (isSystemTheme || variantTheme)) {
|
|
26
|
+
if ((variantTheme || themeName) === LIGHT_THEME) {
|
|
27
|
+
document.body.dataset.agThemeMode = 'light';
|
|
28
|
+
}
|
|
29
|
+
if ((variantTheme || themeName) === DARK_THEME) {
|
|
30
|
+
document.body.dataset.agThemeMode = 'dark';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
getAgGridContainerElement() {
|
|
35
|
+
return this._adaptableInstance.getAgGridContainerElement();
|
|
36
|
+
}
|
|
37
|
+
legacy_applyAgGridThemeOnAdaptableThemeChange(adaptableTheme, variantTheme, agGridContainer, themesToRemove) {
|
|
38
|
+
const themeName = adaptableTheme.Name;
|
|
39
|
+
const isSystemTheme = this.api.themeApi.internalApi.isSystemTheme(themeName);
|
|
40
|
+
const getAgGridLightThemeName = () => this.getAgGridLightThemeName();
|
|
41
|
+
const getAgGridDarkThemeName = () => getAgGridLightThemeName() + '-dark';
|
|
42
|
+
if (adaptableTheme && (isSystemTheme || variantTheme)) {
|
|
43
|
+
if ((variantTheme || themeName) === LIGHT_THEME) {
|
|
44
|
+
adaptableTheme.AgGridClassName =
|
|
45
|
+
adaptableTheme.AgGridClassName || getAgGridLightThemeName();
|
|
46
|
+
}
|
|
47
|
+
if ((variantTheme || themeName) === DARK_THEME) {
|
|
48
|
+
adaptableTheme.AgGridClassName = adaptableTheme.AgGridClassName || getAgGridDarkThemeName();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!adaptableTheme.AgGridClassName) {
|
|
52
|
+
// default AG Grid to its light theme
|
|
53
|
+
adaptableTheme.AgGridClassName = getAgGridLightThemeName();
|
|
54
|
+
}
|
|
55
|
+
if (agGridContainer != null) {
|
|
56
|
+
if (themesToRemove.length) {
|
|
57
|
+
themesToRemove.forEach((theme) => {
|
|
58
|
+
if (theme.AgGridClassName) {
|
|
59
|
+
agGridContainer.classList.remove(theme.AgGridClassName);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// also remove all AG Grid theme class names
|
|
64
|
+
const agGridClassNamesToRemove = [];
|
|
65
|
+
agGridContainer.classList.forEach((x) => {
|
|
66
|
+
if (x && x.indexOf('ag-theme-') === 0) {
|
|
67
|
+
agGridClassNamesToRemove.push(x);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
agGridClassNamesToRemove.forEach((x) => agGridContainer.classList.remove(x));
|
|
71
|
+
if (adaptableTheme && adaptableTheme.AgGridClassName) {
|
|
72
|
+
agGridContainer.classList.add(adaptableTheme.AgGridClassName);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
getAgGridCurrentThemeClassNames() {
|
|
77
|
+
if (this.agGridThemeMode === 'legacy') {
|
|
78
|
+
this.legacy_getAgGridCurrentThemeClassNames();
|
|
79
|
+
}
|
|
80
|
+
const currentAgGridTheme = this._adaptableInstance.agGridAdapter.getGridOption('theme');
|
|
81
|
+
if (currentAgGridTheme === 'legacy') {
|
|
82
|
+
return this.legacy_getAgGridCurrentThemeClassNames();
|
|
83
|
+
}
|
|
84
|
+
// @ts-ignore no other way than to use internals
|
|
85
|
+
const currentAgGridTheme__cssClassCache = currentAgGridTheme?._cssClassCache;
|
|
86
|
+
return currentAgGridTheme__cssClassCache ?? '';
|
|
87
|
+
}
|
|
88
|
+
getAgGridLightThemeName() {
|
|
89
|
+
const container = this.getAgGridContainerElement();
|
|
90
|
+
if (container && container.classList) {
|
|
91
|
+
// we detect the ag theme class
|
|
92
|
+
const classList = container.classList;
|
|
93
|
+
for (let i = 0, len = classList.length; i < len; i++) {
|
|
94
|
+
const cls = classList[i];
|
|
95
|
+
if (cls.indexOf('ag-theme-') === 0) {
|
|
96
|
+
// even if dark theme is included, we compute the light theme name out of it
|
|
97
|
+
return cls.replace('-dark', '');
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.logger.warn('No AgGrid container found, defaulting to ag-theme-balham for the light theme');
|
|
103
|
+
}
|
|
104
|
+
this.logger.warn('No ag-theme- class found on the grid container, defaulting to ag-theme-balham');
|
|
105
|
+
// fallback to the default light theme
|
|
106
|
+
return 'ag-theme-balham';
|
|
107
|
+
}
|
|
108
|
+
legacy_getAgGridCurrentThemeClassNames() {
|
|
109
|
+
const container = this.getAgGridContainerElement();
|
|
110
|
+
if (container && container.classList) {
|
|
111
|
+
// we detect the ag theme class
|
|
112
|
+
const classList = container.classList;
|
|
113
|
+
for (let i = 0, len = classList.length; i < len; i++) {
|
|
114
|
+
const cls = classList[i];
|
|
115
|
+
if (cls.indexOf('ag-theme-') === 0) {
|
|
116
|
+
return cls;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return this.getAgGridLightThemeName();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -4,7 +4,7 @@ const useAgGridClassName = (deps = []) => {
|
|
|
4
4
|
const adaptable = useAdaptable();
|
|
5
5
|
return useMemo(() => {
|
|
6
6
|
if (adaptable) {
|
|
7
|
-
return adaptable.
|
|
7
|
+
return adaptable.agGridThemeAdapter.getAgGridCurrentThemeClassNames();
|
|
8
8
|
}
|
|
9
9
|
return '';
|
|
10
10
|
}, deps);
|