@adaptabletools/adaptable 19.0.1 → 19.0.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.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
  3. package/src/AdaptableOptions/ActionRowOptions.d.ts +2 -2
  4. package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +2 -2
  5. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +6 -2
  6. package/src/Api/ColumnApi.d.ts +14 -15
  7. package/src/Api/DataChangeHistoryApi.d.ts +5 -0
  8. package/src/Api/Events/GridSorted.d.ts +3 -3
  9. package/src/Api/GridApi.d.ts +63 -2
  10. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
  11. package/src/Api/Implementation/ColumnApiImpl.js +13 -30
  12. package/src/Api/Implementation/DataChangeHistoryApiImpl.d.ts +2 -0
  13. package/src/Api/Implementation/DataChangeHistoryApiImpl.js +5 -0
  14. package/src/Api/Implementation/GridApiImpl.d.ts +13 -2
  15. package/src/Api/Implementation/GridApiImpl.js +114 -1
  16. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +1 -0
  17. package/src/Api/Implementation/UserInterfaceApiImpl.js +3 -0
  18. package/src/Api/Internal/ActionRowInternalApi.d.ts +1 -1
  19. package/src/Api/Internal/ActionRowInternalApi.js +10 -8
  20. package/src/Api/Internal/GridFilterInternalApi.js +4 -1
  21. package/src/Api/UserInterfaceApi.d.ts +6 -2
  22. package/src/Utilities/license/hashing.js +1 -1
  23. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +1 -0
  24. package/src/agGrid/ActionColumnRenderer.d.ts +2 -0
  25. package/src/agGrid/ActionColumnRenderer.js +29 -3
  26. package/src/agGrid/AdaptableAgGrid.d.ts +3 -1
  27. package/src/agGrid/AdaptableAgGrid.js +24 -7
  28. package/src/agGrid/AgGridAdapter.d.ts +1 -0
  29. package/src/agGrid/AgGridAdapter.js +12 -0
  30. package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
  31. package/src/agGrid/AgGridColumnAdapter.js +24 -12
  32. package/src/agGrid/defaultAdaptableOptions.js +1 -0
  33. package/src/env.js +2 -2
  34. package/src/metamodel/adaptable.metamodel.js +1 -1
  35. package/src/types.d.ts +2 -2
  36. package/tsconfig.esm.tsbuildinfo +1 -1
  37. package/src/agGrid/CheckboxRenderer.d.ts +0 -16
  38. package/src/agGrid/CheckboxRenderer.js +0 -89
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "19.0.1",
3
+ "version": "19.0.3",
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",
@@ -186,7 +186,6 @@ export interface IAdaptable {
186
186
  getPluginProperty(pluginId: string, propertyName: string, ...args: any): any;
187
187
  getPlugin(pluginId: string): AdaptablePlugin;
188
188
  setDataValue(value: any, column: AdaptableColumn, primaryKeyValue: any, rowNode?: IRowNode): void;
189
- isCellEditable(rowNode: IRowNode, column: Column): boolean;
190
189
  getFirstRowNode(): IRowNode | undefined;
191
190
  getFirstDisplayedRowNode(): IRowNode | undefined;
192
191
  forAllRowNodesDo(func: (rowNode: IRowNode) => void, config?: {
@@ -236,6 +235,7 @@ export interface IAdaptable {
236
235
  getChartModels(): ChartModel[];
237
236
  getAgGridRowModelType(): RowModelType;
238
237
  getRowCount(): number;
238
+ getVisibleRowCount(): number;
239
239
  getColumnCount(): number;
240
240
  getVisibleColumnCount(): number;
241
241
  isGridRangeSelectable(): boolean;
@@ -79,11 +79,11 @@ export interface ActionRowFormOptions<TData = any> {
79
79
  */
80
80
  formFieldLabel?: (context: ActionRowParamFieldContext<TData>) => string;
81
81
  /**
82
- * Custom form buttons provider. If provided, the custom implementation is responsible for firing the 'ActionRowSubmitted' and/or invoking the 'onFormSubmit' callback (if necessary).
82
+ * Custom form buttons; if provided, need to handle form submission explicitly
83
83
  */
84
84
  formButtons?: AdaptableButton<ActionRowFormContext<TData>>[];
85
85
  /**
86
- * Event published when the form in an Action Row is submitted via a standard button (provided by AdapTable). This is not invoked when custom form buttons are provided!
86
+ * Event fired when an Action Row Form is submitted via a standard button provided by AdapTable; this is not invoked when custom form buttons are provided
87
87
  *
88
88
  * @param actionRowSubmittedInfo the form submitted info
89
89
  * @defaultValue undefined
@@ -5,7 +5,7 @@ import { ActionColumnContext, AdaptableApi, AdaptableButton } from '../types';
5
5
  */
6
6
  export interface DataChangeHistoryOptions<TData = any> {
7
7
  /**
8
- * Whether data change history should be active by default
8
+ * Make Data Change History active by default
9
9
  *
10
10
  * @defaultValue false
11
11
  * @gridInfoItem
@@ -26,7 +26,7 @@ export interface DataChangeHistoryOptions<TData = any> {
26
26
  */
27
27
  changeHistoryButton?: DataChangeHistoryButton<TData> | DataChangeHistoryButton<TData>[];
28
28
  /**
29
- * Show all changes for each Cell or just the last one
29
+ * Show all changes for a Cell or just the last one
30
30
  * @defaultValue true
31
31
  */
32
32
  showLastDataChangeOnly?: boolean;
@@ -55,13 +55,17 @@ export interface UserInterfaceOptions<TData = any> {
55
55
  */
56
56
  colorPalette?: string[] | ((currentTheme: string) => string[]);
57
57
  /**
58
- * Style to set for editable cells
58
+ * Style to set for editable Cells
59
59
  */
60
60
  editableCellStyle?: AdaptableStyle;
61
61
  /**
62
- * Style to set for non-editable cells
62
+ * Style to set for non-editable Cells
63
63
  */
64
64
  readOnlyCellStyle?: AdaptableStyle;
65
+ /**
66
+ * Style to set for Cells which have been edited
67
+ */
68
+ editedCellStyle?: AdaptableStyle;
65
69
  /**
66
70
  * Optional list of CSS styles that can be used when creating Adaptable Styles in Adaptable (e.g. in Format Column and other Modules)
67
71
  *
@@ -280,20 +280,6 @@ export interface ColumnApi {
280
280
  * Returns all columns currently Row Grouped
281
281
  */
282
282
  getRowGroupedColumns(): AdaptableColumn[];
283
- /**
284
- * Updates the Column Configuration for a given Column. It will update the current Layout with the new configuration.
285
- * @param columnConfiguration - the Column Configuration to set
286
- */
287
- updateColumnConfiguration(columnConfiguration: ColumnConfig): void;
288
- /**
289
- * Updates the Column Configurations for a list of Columns. It will update the current Layout with the new configurations.
290
- * @param columnConfigurations - the Column Configurations to set
291
- */
292
- updateColumnConfigurations(columnConfigurations: ColumnConfig[]): void;
293
- /**
294
- * Sets the Column Definitions for the Grid
295
- */
296
- setColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
297
283
  /**
298
284
  * Returns all the distinct display values in a given Column
299
285
  * @param columnId Column to Check
@@ -305,9 +291,22 @@ export interface ColumnApi {
305
291
  * @param caption New Caption to display
306
292
  */
307
293
  setColumnCaption(columnId: string, caption: string): void;
294
+ /**
295
+ * @deprecated use `GridApi.setAgGridColumnDefinitions()` instead
296
+ */
297
+ setColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
298
+ /**
299
+ * @deprecated use `GridApi.updateAgGridColumnState()` instead
300
+ */
301
+ updateColumnConfiguration(columnConfiguration: ColumnConfig): void;
302
+ /**
303
+ * @deprecated use `GridApi.updateAgGridColumnState()` instead
304
+ */
305
+ updateColumnConfigurations(columnConfigurations: ColumnConfig[]): void;
308
306
  }
309
307
  /**
310
- * Configuration of an AG Grid Column, used for runtime updating of ColDefs
308
+ * Column State is stateful information and represents changing properties of the grid columns.
309
+ * @deprecated use `ColumnState` from `@ag-grid-community/core` instead
311
310
  */
312
311
  export interface ColumnConfig {
313
312
  /** Column Id (mandatory) */
@@ -1,4 +1,5 @@
1
1
  import { CellDataChangedInfo } from '../PredefinedConfig/Common/CellDataChangedInfo';
2
+ import { GridCell } from '../types';
2
3
  /**
3
4
  * Provides run-time access to the Data Change History Module
4
5
  **/
@@ -25,6 +26,10 @@ export interface DataChangeHistoryApi {
25
26
  * Retrieves all data changes which are currently available
26
27
  */
27
28
  getDataChangeHistoryLog(): CellDataChangedInfo[];
29
+ /**
30
+ * Retrieves last data change for a given Cell
31
+ */
32
+ getDataChangeForGridCell(gridCell: GridCell): CellDataChangedInfo | undefined;
28
33
  /**
29
34
  * Adds item to Data Change History log
30
35
  *
@@ -11,15 +11,15 @@ export interface GridSortedInfo extends BaseEventInfo {
11
11
  adaptableSortState: AdaptableSortState;
12
12
  }
13
13
  /**
14
- * Overview of current sorting state in the grid
14
+ * Overview of current sorting state in AG Grid
15
15
  */
16
16
  export interface AdaptableSortState {
17
17
  /**
18
- * Which columns have sorting applied and,if so, which direction
18
+ * Which Columns have sorting applied and,if so, in which direction
19
19
  */
20
20
  columnSorts: ColumnSort[];
21
21
  /**
22
- * All the Custom Sorts in State; this is always sent even if no custom sorts are active
22
+ * All Custom Sorts in State (note: this is always sent, even if no custom sorts are active)
23
23
  */
24
24
  customSorts: CustomSort[];
25
25
  }
@@ -7,7 +7,7 @@ import { DataUpdateConfig } from '../PredefinedConfig/Common/DataUpdateConfig';
7
7
  import { CellDataChangedInfo } from '../PredefinedConfig/Common/CellDataChangedInfo';
8
8
  import { CellHighlightInfo } from '../PredefinedConfig/Common/CellHighlightInfo';
9
9
  import { RowHighlightInfo } from '../PredefinedConfig/Common/RowHighlightInfo';
10
- import { Column, IRowNode, RowModelType } from '@ag-grid-community/core';
10
+ import { ColDef, ColGroupDef, Column, ColumnState, IRowNode, RowModelType } from '@ag-grid-community/core';
11
11
  import { GridCellRange } from '../PredefinedConfig/Selection/GridCellRange';
12
12
  import { RowsHighlightInfo } from '../PredefinedConfig/Common/RowsHighlightInfo';
13
13
  import { TransposeConfig } from '../PredefinedConfig/Common/TransposeConfig';
@@ -457,6 +457,16 @@ export interface GridApi {
457
457
  * @param columnIds ColumnIds which contain cells to refresh
458
458
  */
459
459
  refreshCells(rowNodes: IRowNode[], columnIds: string[]): void;
460
+ /**
461
+ * Refreshes a single Grid Cell
462
+ * @param gridCell GridCell to refresh
463
+ */
464
+ refreshGridCell(gridCell: GridCell): void;
465
+ /**
466
+ * Refreshes a single Grid Cell
467
+ * @param gridCells GridCells to refresh
468
+ */
469
+ refreshGridCells(gridCells: GridCell[]): void;
460
470
  /**
461
471
  * Forces a re-render of the row with the given primary key value
462
472
  * @param primaryKey row primary key
@@ -480,6 +490,10 @@ export interface GridApi {
480
490
  * Returns number of rows in Data Source
481
491
  */
482
492
  getRowCount(): number;
493
+ /**
494
+ * Returns number of rows in Data Source
495
+ */
496
+ getVisibleRowCount(): number;
483
497
  /**
484
498
  * Returns number of columns in Data Source
485
499
  */
@@ -494,9 +508,14 @@ export interface GridApi {
494
508
  destroy(): void;
495
509
  /**
496
510
  * Checks if given Grid Cell is editable
497
- * @param gridCell cell to check
511
+ * @param gridCell Cell to check
498
512
  */
499
513
  isCellEditable(gridCell: GridCell): boolean;
514
+ /**
515
+ * Checks if given Grid Cell has been edited (uses Data Change History)
516
+ * @param gridCell Cell to check
517
+ */
518
+ isCellEdited(gridCell: GridCell): boolean;
500
519
  /**
501
520
  * Checks if all of given Grid Cells are editable
502
521
  * @param gridCells cells to check
@@ -530,4 +549,46 @@ export interface GridApi {
530
549
  * Return all AG Grid columns
531
550
  */
532
551
  getAllAgGridColumns(): Column<any>[];
552
+ /**
553
+ * Updates the Column State for a given Column. Column State is stateful information and represents changing values of the grid. It will update the current Layout with the new state.
554
+ * @param columnState - the AG Grid ColumnState to set
555
+ */
556
+ updateAgGridColumnState(columnState: ColumnState): void;
557
+ /**
558
+ * Updates the Column State for a given Columns. Column State is stateful information and represents changing values of the grid. It will update the current Layout with the new state.
559
+ * @param columnStates - the AG Grid ColumnState to set
560
+ */
561
+ updateAgGridColumnStates(columnStates: ColumnState[]): void;
562
+ /**
563
+ * Sets the Column Definitions for the Grid
564
+ */
565
+ setAgGridColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
566
+ /**
567
+ * Updates the Column Definition for a given Column. The provided column properties are merged with the existing Column Definition.
568
+ * @param columnId - the ColumnId to update
569
+ * @param columnDefinition - the new Column Definition
570
+ */
571
+ updateAgGridColumnDefinition(columnDefinition: ColDefWithId): void;
572
+ /**
573
+ * Updates the Column Definitions for the given Columns. The provided column properties are merged with the existing Column Definitions.
574
+ * @param columnId - the ColumnId to update
575
+ * @param columnDefinition - the new Column Definition
576
+ */
577
+ updateAgGridColumnDefinitions(columnDefinitions: ColDefWithId[]): void;
578
+ /**
579
+ * Removes the Column Definition for a given Column.
580
+ * @param columnId - the ColumnId to remove
581
+ */
582
+ removeAgGridColumnDefinition(columnId: string): void;
583
+ /**
584
+ * Adds a Column Definition to the Grid
585
+ * @param columnDefinition - the new Column Definition
586
+ */
587
+ addAgGridColumnDefinition(columnDefinition: ColDefWithId): void;
533
588
  }
589
+ /**
590
+ * Column Definition with a mandatory `colId` property
591
+ */
592
+ export type ColDefWithId = Omit<ColDef, 'colId'> & {
593
+ colId: string;
594
+ };
@@ -70,9 +70,9 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
70
70
  getColumnTypes(): string[];
71
71
  getColumnsByColumnType(columnType: string): AdaptableColumn[];
72
72
  getRowGroupedColumns(): AdaptableColumn[];
73
+ getDistinctDisplayValuesForColumn(columnId: string): any[];
74
+ setColumnCaption(columnId: string, caption: string): void;
73
75
  updateColumnConfiguration(columnConfig: ColumnConfig): void;
74
76
  updateColumnConfigurations(columnConfigs: ColumnConfig[]): void;
75
77
  setColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
76
- getDistinctDisplayValuesForColumn(columnId: string): any[];
77
- setColumnCaption(columnId: string, caption: string): void;
78
78
  }
@@ -4,6 +4,7 @@ import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
4
4
  import { ColumnInternalApi } from '../Internal/ColumnInternalApi';
5
5
  import { createBaseContext } from '../../Utilities/ObjectFactory';
6
6
  import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
7
+ import { logDeprecationExternal } from '../../Utilities/logDeprecation';
7
8
  export function isAutoRowGroupColumn(columnId) {
8
9
  // put this here as there might be other indicators we are not aware of
9
10
  // perhaps with non auto groups ?
@@ -369,40 +370,22 @@ export class ColumnApiImpl extends ApiBase {
369
370
  return this.getColumnWithColumnId(n);
370
371
  });
371
372
  }
372
- updateColumnConfiguration(columnConfig) {
373
- const columnExists = this.doesColumnExist(columnConfig.colId);
374
- if (!columnExists) {
375
- this.logWarn(`Column with id ${columnConfig.colId} does not exist, could NOT update configuration`);
376
- return;
377
- }
378
- const columnState = columnConfig;
379
- const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
380
- agGridApi.applyColumnState({
381
- state: [columnState],
382
- });
383
- }
384
- updateColumnConfigurations(columnConfigs) {
385
- const existingColumnConfigs = columnConfigs.filter((cc) => this.doesColumnExist(cc.colId));
386
- const notExistingColumnIds = columnConfigs
387
- .filter((cc) => !this.doesColumnExist(cc.colId))
388
- .map((cc) => cc.colId);
389
- notExistingColumnIds.forEach((colId) => {
390
- this.logWarn(`Column with id ${colId} does not exist, could NOT update configuration`);
391
- });
392
- const columnStates = existingColumnConfigs;
393
- const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
394
- agGridApi.applyColumnState({
395
- state: columnStates,
396
- });
397
- }
398
- setColumnDefinitions(columnDefinitions) {
399
- const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
400
- agGridApi.setGridOption('columnDefs', columnDefinitions);
401
- }
402
373
  getDistinctDisplayValuesForColumn(columnId) {
403
374
  return this.getAdaptableApi().gridApi.internalApi.getDistinctDisplayValuesForColumn(columnId);
404
375
  }
405
376
  setColumnCaption(columnId, caption) {
406
377
  return this.getAdaptableApi().layoutApi.setColumnCaption(columnId, caption);
407
378
  }
379
+ updateColumnConfiguration(columnConfig) {
380
+ logDeprecationExternal(this.adaptable.logger, 'ColumnApi', 'updateColumnConfiguration', 'GridApi', 'updateAgGridColumnState');
381
+ this.getGridApi().updateAgGridColumnState(columnConfig);
382
+ }
383
+ updateColumnConfigurations(columnConfigs) {
384
+ logDeprecationExternal(this.adaptable.logger, 'ColumnApi', 'updateColumnConfigurations', 'GridApi', 'updateAgGridColumnStates');
385
+ this.getGridApi().updateAgGridColumnStates(columnConfigs);
386
+ }
387
+ setColumnDefinitions(columnDefinitions) {
388
+ logDeprecationExternal(this.adaptable.logger, 'ColumnApi', 'setColumnDefinitions', 'GridApi', 'setColumnDefinitions');
389
+ this.getGridApi().setAgGridColumnDefinitions(columnDefinitions);
390
+ }
408
391
  }
@@ -1,12 +1,14 @@
1
1
  import { DataChangeHistoryApi } from '../DataChangeHistoryApi';
2
2
  import { ApiBase } from './ApiBase';
3
3
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
4
+ import { GridCell } from '../../types';
4
5
  export declare class DataChangeHistoryApiImpl extends ApiBase implements DataChangeHistoryApi {
5
6
  getDataChangeHistoryMode(): 'ACTIVE' | 'INACTIVE' | 'SUSPENDED';
6
7
  activateDataChangeHistory(forceReset?: boolean): void;
7
8
  deactivateDataChangeHistory(): void;
8
9
  suspendDataChangeHistory(): void;
9
10
  getDataChangeHistoryLog(): CellDataChangedInfo[];
11
+ getDataChangeForGridCell(gridCell: GridCell): CellDataChangedInfo | undefined;
10
12
  addDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
11
13
  undoDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
12
14
  clearDataChangeHistoryEntry(dataChangeInfo: CellDataChangedInfo): void;
@@ -48,6 +48,11 @@ export class DataChangeHistoryApiImpl extends ApiBase {
48
48
  const changeLog = (_a = this.getAdaptableState().System.DataChangeHistory.logs) !== null && _a !== void 0 ? _a : {};
49
49
  return Object.values(changeLog);
50
50
  }
51
+ getDataChangeForGridCell(gridCell) {
52
+ const allChanges = this.getDataChangeHistoryLog();
53
+ return allChanges.find((c) => c.primaryKeyValue == gridCell.primaryKeyValue &&
54
+ c.column.columnId == gridCell.column.columnId);
55
+ }
51
56
  addDataChangeHistoryEntry(dataChangeInfo) {
52
57
  const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
53
58
  this.dispatchAction(SystemDataChangeHistoryAdd(dataChangeInfo, uniqueKey));
@@ -1,5 +1,5 @@
1
1
  import { ApiBase } from './ApiBase';
2
- import { GridApi } from '../GridApi';
2
+ import { ColDefWithId, GridApi } from '../GridApi';
3
3
  import { GridState } from '../../PredefinedConfig/GridState';
4
4
  import { SelectedCellInfo } from '../../PredefinedConfig/Selection/SelectedCellInfo';
5
5
  import { SelectedRowInfo } from '../../PredefinedConfig/Selection/SelectedRowInfo';
@@ -8,7 +8,7 @@ import { ColumnSort } from '../../PredefinedConfig/Common/ColumnSort';
8
8
  import { DataUpdateConfig } from '../../PredefinedConfig/Common/DataUpdateConfig';
9
9
  import { CellHighlightInfo } from '../../PredefinedConfig/Common/CellHighlightInfo';
10
10
  import { RowHighlightInfo } from '../../PredefinedConfig/Common/RowHighlightInfo';
11
- import { Column, IRowNode, RowModelType } from '@ag-grid-community/core';
11
+ import { ColDef, ColGroupDef, Column, ColumnState, IRowNode, RowModelType } from '@ag-grid-community/core';
12
12
  import { GridCellRange } from '../../PredefinedConfig/Selection/GridCellRange';
13
13
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
14
14
  import { RowsHighlightInfo } from '../../PredefinedConfig/Common/RowsHighlightInfo';
@@ -115,6 +115,8 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
115
115
  unHighlightRows(primaryKeyValues: RowsHighlightInfo['primaryKeyValues']): void;
116
116
  unHighlightAllRows(): void;
117
117
  refreshCells(rowNodes: IRowNode[], columnIds: string[]): void;
118
+ refreshGridCell(gridCell: GridCell): void;
119
+ refreshGridCells(gridCells: GridCell[]): void;
118
120
  refreshColumn(columnId: string): void;
119
121
  refreshColumns(columnIds: string[]): void;
120
122
  refreshRowByPrimaryKey(primaryKey: any): void;
@@ -122,8 +124,10 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
122
124
  refreshRowNodes(rowNodes: IRowNode[]): void;
123
125
  refreshGroupRowNodes(): void;
124
126
  isCellEditable(gridCell: GridCell): boolean;
127
+ isCellEdited(gridCell: GridCell): boolean;
125
128
  isEveryCellEditable(gridCells: GridCell[]): boolean;
126
129
  getRowCount(): number;
130
+ getVisibleRowCount(): number;
127
131
  getRowsInViewport(): IRowNode[];
128
132
  getColumnCount(): number;
129
133
  getVisibleColumnCount(): number;
@@ -135,4 +139,11 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
135
139
  getAgGridRowModelType(): RowModelType;
136
140
  showTransposedView(transposeConfig?: TransposeConfig): void;
137
141
  getAllAgGridColumns(): Column<any>[];
142
+ updateAgGridColumnState(columnState: ColumnState): void;
143
+ updateAgGridColumnStates(columnStates: ColumnState[]): void;
144
+ setAgGridColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
145
+ updateAgGridColumnDefinition(columnDefinitionToBeUpdated: ColDefWithId): void;
146
+ updateAgGridColumnDefinitions(columnDefinitionsToBeUpdated: ColDefWithId[]): void;
147
+ removeAgGridColumnDefinition(columnId: string): void;
148
+ addAgGridColumnDefinition(newColumnDefinition: ColDefWithId): void;
138
149
  }
@@ -98,6 +98,7 @@ export class GridApiImpl extends ApiBase {
98
98
  return;
99
99
  }
100
100
  this.adaptable.setDataValue(cellUpdateRequest.newValue, abColumn, cellUpdateRequest.primaryKeyValue, rowNode);
101
+ this.refreshCells([rowNode], [abColumn.columnId]);
101
102
  }
102
103
  setCellValues(cellUpdateRequests) {
103
104
  cellUpdateRequests === null || cellUpdateRequests === void 0 ? void 0 : cellUpdateRequests.forEach((cellUpdateRequest) => this.setCellValue(cellUpdateRequest));
@@ -459,6 +460,14 @@ export class GridApiImpl extends ApiBase {
459
460
  refreshCells(rowNodes, columnIds) {
460
461
  this.adaptable.refreshCells(rowNodes, columnIds, true);
461
462
  }
463
+ refreshGridCell(gridCell) {
464
+ this.refreshCells([gridCell.rowNode], [gridCell.column.columnId]);
465
+ }
466
+ refreshGridCells(gridCells) {
467
+ gridCells.forEach((gc) => {
468
+ this.refreshGridCell(gc);
469
+ });
470
+ }
462
471
  refreshColumn(columnId) {
463
472
  this.adaptable.refreshCells(null, [columnId], true);
464
473
  }
@@ -491,7 +500,22 @@ export class GridApiImpl extends ApiBase {
491
500
  if (gridCell.column.readOnly) {
492
501
  return false;
493
502
  }
494
- return this.adaptable.isCellEditable(gridCell.rowNode, this.adaptable.getAgGridColumnForColumnId(gridCell.column.columnId));
503
+ if (gridCell.rowNode && this.isSummaryNode(gridCell.rowNode)) {
504
+ return false;
505
+ }
506
+ const cellEditableFn = this.getEditOptions().isCellEditable;
507
+ if (cellEditableFn) {
508
+ const cellEditableContext = Object.assign({ gridCell }, this.getAdaptableApi().internalApi.buildBaseContext());
509
+ return cellEditableFn(cellEditableContext);
510
+ }
511
+ return true;
512
+ }
513
+ isCellEdited(gridCell) {
514
+ if (!gridCell) {
515
+ return false;
516
+ }
517
+ const cellDataChangedInfo = this.getDataChangeHistoryApi().getDataChangeForGridCell(gridCell);
518
+ return cellDataChangedInfo != null;
495
519
  }
496
520
  isEveryCellEditable(gridCells) {
497
521
  for (let gridCell of gridCells) {
@@ -504,6 +528,9 @@ export class GridApiImpl extends ApiBase {
504
528
  getRowCount() {
505
529
  return this.adaptable.getRowCount();
506
530
  }
531
+ getVisibleRowCount() {
532
+ return this.adaptable.getVisibleRowCount();
533
+ }
507
534
  getRowsInViewport() {
508
535
  return this.adaptable.getRowsInViewport();
509
536
  }
@@ -555,4 +582,90 @@ export class GridApiImpl extends ApiBase {
555
582
  getAllAgGridColumns() {
556
583
  return this.adaptable.getAllGridColumns();
557
584
  }
585
+ updateAgGridColumnState(columnState) {
586
+ const columnExists = this.getColumnApi().doesColumnExist(columnState.colId);
587
+ if (!columnExists) {
588
+ this.logWarn(`Column with id ${columnState.colId} does not exist, could NOT update configuration`);
589
+ return;
590
+ }
591
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
592
+ agGridApi.applyColumnState({
593
+ state: [columnState],
594
+ });
595
+ }
596
+ updateAgGridColumnStates(columnStates) {
597
+ const existingColumnStates = columnStates.filter((cc) => this.getColumnApi().doesColumnExist(cc.colId));
598
+ const notExistingColumnIds = columnStates
599
+ .filter((cc) => !this.getColumnApi().doesColumnExist(cc.colId))
600
+ .map((cc) => cc.colId);
601
+ notExistingColumnIds.forEach((colId) => {
602
+ this.logWarn(`Column with id ${colId} does not exist, could NOT update configuration`);
603
+ });
604
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
605
+ agGridApi.applyColumnState({
606
+ state: existingColumnStates,
607
+ });
608
+ }
609
+ setAgGridColumnDefinitions(columnDefinitions) {
610
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
611
+ agGridApi.setGridOption('columnDefs', columnDefinitions);
612
+ this.adaptable.updateColumnModelAndRefreshGrid({ skipColDefsRefresh: true });
613
+ }
614
+ updateAgGridColumnDefinition(columnDefinitionToBeUpdated) {
615
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
616
+ const columnId = columnDefinitionToBeUpdated.colId;
617
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
618
+ if (!doesColumnExist) {
619
+ this.logWarn(`Column with id ${columnId} does not exist, will add it instead!`);
620
+ const newColDefs = [...currentColDefs, columnDefinitionToBeUpdated];
621
+ this.setAgGridColumnDefinitions(newColDefs);
622
+ return;
623
+ }
624
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
625
+ return colDef.colId === columnId ? Object.assign(Object.assign({}, colDef), columnDefinitionToBeUpdated) : colDef;
626
+ });
627
+ this.setAgGridColumnDefinitions(updatedColDefs);
628
+ }
629
+ updateAgGridColumnDefinitions(columnDefinitionsToBeUpdated) {
630
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
631
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
632
+ const newColDef = newColumnDefinitions.find((c) => c.colId === colDef.colId);
633
+ return newColDef ? Object.assign(Object.assign({}, colDef), newColDef) : colDef;
634
+ });
635
+ // find out new columns which are not in the current column definitions
636
+ const currentColIds = [];
637
+ this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
638
+ currentColIds.push(colDef.colId);
639
+ return colDef;
640
+ });
641
+ const newColumnDefinitions = columnDefinitionsToBeUpdated.filter((c) => !currentColIds.includes(c.colId));
642
+ if (newColumnDefinitions.length) {
643
+ this.logWarn(`Columns with ids ${newColumnDefinitions.map((c) => c.colId).join(', ')} do not exist, will add them instead!`);
644
+ }
645
+ this.setAgGridColumnDefinitions([...updatedColDefs, ...newColumnDefinitions]);
646
+ }
647
+ removeAgGridColumnDefinition(columnId) {
648
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
649
+ if (!doesColumnExist) {
650
+ this.logWarn(`Column with id ${columnId} does not exist!`);
651
+ return;
652
+ }
653
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
654
+ const updatedColDefs = this.adaptable.agGridAdapter
655
+ .traverseColDefs(currentColDefs, (colDef) => {
656
+ return colDef.colId === columnId ? null : colDef;
657
+ })
658
+ .filter(Boolean);
659
+ this.setAgGridColumnDefinitions(updatedColDefs);
660
+ }
661
+ addAgGridColumnDefinition(newColumnDefinition) {
662
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
663
+ // just in case check of there is not already an existing column with the same id and eliminate it
664
+ const sanitizedColDefs = this.adaptable.agGridAdapter
665
+ .traverseColDefs(currentColDefs, (colDef) => {
666
+ return colDef.colId === newColumnDefinition.colId ? null : colDef;
667
+ })
668
+ .filter(Boolean);
669
+ this.setAgGridColumnDefinitions([...sanitizedColDefs, newColumnDefinition]);
670
+ }
558
671
  }
@@ -26,6 +26,7 @@ export declare class UserInterfaceApiImpl extends ApiBase implements UserInterfa
26
26
  getEditLookUpItemForColumn(column: AdaptableColumn): EditLookUpPermittedValues | undefined;
27
27
  getEditLookUpValuesForEditLookUpItem(editLookUpItem: EditLookUpPermittedValues, gridCell: GridCell): any[] | undefined;
28
28
  getEditableCellStyle(): AdaptableStyle | undefined;
29
+ getEditedCellStyle(): AdaptableStyle | undefined;
29
30
  getReadOnlyCellStyle(): AdaptableStyle | undefined;
30
31
  getAdaptableObjectTags(): AdaptableObjectTag[] | undefined;
31
32
  getCustomIconDefinition(iconName: string): import("../../types").AdaptableIcon | import("../../types").CustomIcon;
@@ -142,6 +142,9 @@ export class UserInterfaceApiImpl extends ApiBase {
142
142
  getEditableCellStyle() {
143
143
  return this.getUserInterfaceOptions().editableCellStyle;
144
144
  }
145
+ getEditedCellStyle() {
146
+ return this.getUserInterfaceOptions().editedCellStyle;
147
+ }
145
148
  getReadOnlyCellStyle() {
146
149
  return this.getUserInterfaceOptions().readOnlyCellStyle;
147
150
  }
@@ -18,7 +18,7 @@ export declare class ActionRowInternalApi extends ApiBase {
18
18
  private buidActionRowButtons;
19
19
  private prepareCreateData;
20
20
  private prepareEditData;
21
- private isColumnEditable;
21
+ private isCellEditable;
22
22
  private buildFormField;
23
23
  private getFormFieldLabel;
24
24
  private buildFormFieldLabelContext;
@@ -49,7 +49,7 @@ export class ActionRowInternalApi extends ApiBase {
49
49
  .columnApi.getColumns()
50
50
  .filter((column) => {
51
51
  // if there is NO rowNode, do NOT display the non-editable fields as they will be empty
52
- return !!rowNode || this.isColumnEditable(column, rowNode);
52
+ return !!rowNode || this.isCellEditable(column, rowNode);
53
53
  })
54
54
  .filter((column) => !this.getAdaptableApi().columnApi.internalApi.isActionRowButtonColumn(column.columnId) &&
55
55
  this.showColumnInActionRowForm(column, actionRowType));
@@ -116,21 +116,23 @@ export class ActionRowInternalApi extends ApiBase {
116
116
  dataToSave[this.getOptions().primaryKey] = pkValue;
117
117
  return dataToSave;
118
118
  }
119
- isColumnEditable(column, rowNode) {
120
- return rowNode
121
- ? this.adaptableInstance.isCellEditable(rowNode, this.adaptableInstance.getAgGridColumnForColumnId(column.columnId))
122
- : !column.readOnly;
119
+ isCellEditable(column, rowNode) {
120
+ if (!rowNode) {
121
+ return !column.readOnly;
122
+ }
123
+ const gridCell = this.getAdaptableApi().gridApi.getGridCellFromRowNode(rowNode, column.columnId);
124
+ return this.getAdaptableApi().gridApi.isCellEditable(gridCell);
123
125
  }
124
126
  buildFormField(type, column, rowNode) {
125
- const isColumnEditable = this.isColumnEditable(column, rowNode);
127
+ const isCellEditable = this.isCellEditable(column, rowNode);
126
128
  const fieldValueOptions = this.getFieldValueOptions(column, rowNode);
127
- const fieldType = isColumnEditable
129
+ const fieldType = isCellEditable
128
130
  ? !!(fieldValueOptions === null || fieldValueOptions === void 0 ? void 0 : fieldValueOptions.length)
129
131
  ? 'select'
130
132
  : this.getFieldTypeFromColumnType(column)
131
133
  : 'textOutput';
132
134
  const defaultValue = rowNode
133
- ? isColumnEditable
135
+ ? isCellEditable
134
136
  ? this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, column.columnId)
135
137
  : this.getAdaptableApi().gridApi.getDisplayValueFromRowNode(rowNode, column.columnId)
136
138
  : null;
@@ -14,6 +14,9 @@ export class GridFilterInternalApi extends ApiBase {
14
14
  * Compares to Grid Filter to see if they are identical
15
15
  */
16
16
  isGridFilterDifferent(oldFilter, newFilter) {
17
- return (oldFilter === null || oldFilter === void 0 ? void 0 : oldFilter.Expression) === (newFilter === null || newFilter === void 0 ? void 0 : newFilter.Expression);
17
+ if (oldFilter == undefined && newFilter == undefined) {
18
+ return false;
19
+ }
20
+ return (oldFilter === null || oldFilter === void 0 ? void 0 : oldFilter.Expression) !== (newFilter === null || newFilter === void 0 ? void 0 : newFilter.Expression);
18
21
  }
19
22
  }