@adaptabletools/adaptable-cjs 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.cjs.tsbuildinfo +1 -1
  37. package/src/agGrid/CheckboxRenderer.d.ts +0 -16
  38. package/src/agGrid/CheckboxRenderer.js +0 -94
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-cjs",
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
  }
@@ -8,6 +8,7 @@ const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/
8
8
  const ColumnInternalApi_1 = require("../Internal/ColumnInternalApi");
9
9
  const ObjectFactory_1 = require("../../Utilities/ObjectFactory");
10
10
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
11
+ const logDeprecation_1 = require("../../Utilities/logDeprecation");
11
12
  function isAutoRowGroupColumn(columnId) {
12
13
  // put this here as there might be other indicators we are not aware of
13
14
  // perhaps with non auto groups ?
@@ -375,41 +376,23 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
375
376
  return this.getColumnWithColumnId(n);
376
377
  });
377
378
  }
378
- updateColumnConfiguration(columnConfig) {
379
- const columnExists = this.doesColumnExist(columnConfig.colId);
380
- if (!columnExists) {
381
- this.logWarn(`Column with id ${columnConfig.colId} does not exist, could NOT update configuration`);
382
- return;
383
- }
384
- const columnState = columnConfig;
385
- const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
386
- agGridApi.applyColumnState({
387
- state: [columnState],
388
- });
389
- }
390
- updateColumnConfigurations(columnConfigs) {
391
- const existingColumnConfigs = columnConfigs.filter((cc) => this.doesColumnExist(cc.colId));
392
- const notExistingColumnIds = columnConfigs
393
- .filter((cc) => !this.doesColumnExist(cc.colId))
394
- .map((cc) => cc.colId);
395
- notExistingColumnIds.forEach((colId) => {
396
- this.logWarn(`Column with id ${colId} does not exist, could NOT update configuration`);
397
- });
398
- const columnStates = existingColumnConfigs;
399
- const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
400
- agGridApi.applyColumnState({
401
- state: columnStates,
402
- });
403
- }
404
- setColumnDefinitions(columnDefinitions) {
405
- const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
406
- agGridApi.setGridOption('columnDefs', columnDefinitions);
407
- }
408
379
  getDistinctDisplayValuesForColumn(columnId) {
409
380
  return this.getAdaptableApi().gridApi.internalApi.getDistinctDisplayValuesForColumn(columnId);
410
381
  }
411
382
  setColumnCaption(columnId, caption) {
412
383
  return this.getAdaptableApi().layoutApi.setColumnCaption(columnId, caption);
413
384
  }
385
+ updateColumnConfiguration(columnConfig) {
386
+ (0, logDeprecation_1.logDeprecationExternal)(this.adaptable.logger, 'ColumnApi', 'updateColumnConfiguration', 'GridApi', 'updateAgGridColumnState');
387
+ this.getGridApi().updateAgGridColumnState(columnConfig);
388
+ }
389
+ updateColumnConfigurations(columnConfigs) {
390
+ (0, logDeprecation_1.logDeprecationExternal)(this.adaptable.logger, 'ColumnApi', 'updateColumnConfigurations', 'GridApi', 'updateAgGridColumnStates');
391
+ this.getGridApi().updateAgGridColumnStates(columnConfigs);
392
+ }
393
+ setColumnDefinitions(columnDefinitions) {
394
+ (0, logDeprecation_1.logDeprecationExternal)(this.adaptable.logger, 'ColumnApi', 'setColumnDefinitions', 'GridApi', 'setColumnDefinitions');
395
+ this.getGridApi().setAgGridColumnDefinitions(columnDefinitions);
396
+ }
414
397
  }
415
398
  exports.ColumnApiImpl = ColumnApiImpl;
@@ -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;
@@ -52,6 +52,11 @@ class DataChangeHistoryApiImpl extends ApiBase_1.ApiBase {
52
52
  const changeLog = (_a = this.getAdaptableState().System.DataChangeHistory.logs) !== null && _a !== void 0 ? _a : {};
53
53
  return Object.values(changeLog);
54
54
  }
55
+ getDataChangeForGridCell(gridCell) {
56
+ const allChanges = this.getDataChangeHistoryLog();
57
+ return allChanges.find((c) => c.primaryKeyValue == gridCell.primaryKeyValue &&
58
+ c.column.columnId == gridCell.column.columnId);
59
+ }
55
60
  addDataChangeHistoryEntry(dataChangeInfo) {
56
61
  const uniqueKey = this.getDataChangeHistoryKey(dataChangeInfo);
57
62
  this.dispatchAction((0, SystemRedux_1.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
  }
@@ -102,6 +102,7 @@ class GridApiImpl extends ApiBase_1.ApiBase {
102
102
  return;
103
103
  }
104
104
  this.adaptable.setDataValue(cellUpdateRequest.newValue, abColumn, cellUpdateRequest.primaryKeyValue, rowNode);
105
+ this.refreshCells([rowNode], [abColumn.columnId]);
105
106
  }
106
107
  setCellValues(cellUpdateRequests) {
107
108
  cellUpdateRequests === null || cellUpdateRequests === void 0 ? void 0 : cellUpdateRequests.forEach((cellUpdateRequest) => this.setCellValue(cellUpdateRequest));
@@ -463,6 +464,14 @@ class GridApiImpl extends ApiBase_1.ApiBase {
463
464
  refreshCells(rowNodes, columnIds) {
464
465
  this.adaptable.refreshCells(rowNodes, columnIds, true);
465
466
  }
467
+ refreshGridCell(gridCell) {
468
+ this.refreshCells([gridCell.rowNode], [gridCell.column.columnId]);
469
+ }
470
+ refreshGridCells(gridCells) {
471
+ gridCells.forEach((gc) => {
472
+ this.refreshGridCell(gc);
473
+ });
474
+ }
466
475
  refreshColumn(columnId) {
467
476
  this.adaptable.refreshCells(null, [columnId], true);
468
477
  }
@@ -495,7 +504,22 @@ class GridApiImpl extends ApiBase_1.ApiBase {
495
504
  if (gridCell.column.readOnly) {
496
505
  return false;
497
506
  }
498
- return this.adaptable.isCellEditable(gridCell.rowNode, this.adaptable.getAgGridColumnForColumnId(gridCell.column.columnId));
507
+ if (gridCell.rowNode && this.isSummaryNode(gridCell.rowNode)) {
508
+ return false;
509
+ }
510
+ const cellEditableFn = this.getEditOptions().isCellEditable;
511
+ if (cellEditableFn) {
512
+ const cellEditableContext = Object.assign({ gridCell }, this.getAdaptableApi().internalApi.buildBaseContext());
513
+ return cellEditableFn(cellEditableContext);
514
+ }
515
+ return true;
516
+ }
517
+ isCellEdited(gridCell) {
518
+ if (!gridCell) {
519
+ return false;
520
+ }
521
+ const cellDataChangedInfo = this.getDataChangeHistoryApi().getDataChangeForGridCell(gridCell);
522
+ return cellDataChangedInfo != null;
499
523
  }
500
524
  isEveryCellEditable(gridCells) {
501
525
  for (let gridCell of gridCells) {
@@ -508,6 +532,9 @@ class GridApiImpl extends ApiBase_1.ApiBase {
508
532
  getRowCount() {
509
533
  return this.adaptable.getRowCount();
510
534
  }
535
+ getVisibleRowCount() {
536
+ return this.adaptable.getVisibleRowCount();
537
+ }
511
538
  getRowsInViewport() {
512
539
  return this.adaptable.getRowsInViewport();
513
540
  }
@@ -559,5 +586,91 @@ class GridApiImpl extends ApiBase_1.ApiBase {
559
586
  getAllAgGridColumns() {
560
587
  return this.adaptable.getAllGridColumns();
561
588
  }
589
+ updateAgGridColumnState(columnState) {
590
+ const columnExists = this.getColumnApi().doesColumnExist(columnState.colId);
591
+ if (!columnExists) {
592
+ this.logWarn(`Column with id ${columnState.colId} does not exist, could NOT update configuration`);
593
+ return;
594
+ }
595
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
596
+ agGridApi.applyColumnState({
597
+ state: [columnState],
598
+ });
599
+ }
600
+ updateAgGridColumnStates(columnStates) {
601
+ const existingColumnStates = columnStates.filter((cc) => this.getColumnApi().doesColumnExist(cc.colId));
602
+ const notExistingColumnIds = columnStates
603
+ .filter((cc) => !this.getColumnApi().doesColumnExist(cc.colId))
604
+ .map((cc) => cc.colId);
605
+ notExistingColumnIds.forEach((colId) => {
606
+ this.logWarn(`Column with id ${colId} does not exist, could NOT update configuration`);
607
+ });
608
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
609
+ agGridApi.applyColumnState({
610
+ state: existingColumnStates,
611
+ });
612
+ }
613
+ setAgGridColumnDefinitions(columnDefinitions) {
614
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
615
+ agGridApi.setGridOption('columnDefs', columnDefinitions);
616
+ this.adaptable.updateColumnModelAndRefreshGrid({ skipColDefsRefresh: true });
617
+ }
618
+ updateAgGridColumnDefinition(columnDefinitionToBeUpdated) {
619
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
620
+ const columnId = columnDefinitionToBeUpdated.colId;
621
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
622
+ if (!doesColumnExist) {
623
+ this.logWarn(`Column with id ${columnId} does not exist, will add it instead!`);
624
+ const newColDefs = [...currentColDefs, columnDefinitionToBeUpdated];
625
+ this.setAgGridColumnDefinitions(newColDefs);
626
+ return;
627
+ }
628
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
629
+ return colDef.colId === columnId ? Object.assign(Object.assign({}, colDef), columnDefinitionToBeUpdated) : colDef;
630
+ });
631
+ this.setAgGridColumnDefinitions(updatedColDefs);
632
+ }
633
+ updateAgGridColumnDefinitions(columnDefinitionsToBeUpdated) {
634
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
635
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
636
+ const newColDef = newColumnDefinitions.find((c) => c.colId === colDef.colId);
637
+ return newColDef ? Object.assign(Object.assign({}, colDef), newColDef) : colDef;
638
+ });
639
+ // find out new columns which are not in the current column definitions
640
+ const currentColIds = [];
641
+ this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
642
+ currentColIds.push(colDef.colId);
643
+ return colDef;
644
+ });
645
+ const newColumnDefinitions = columnDefinitionsToBeUpdated.filter((c) => !currentColIds.includes(c.colId));
646
+ if (newColumnDefinitions.length) {
647
+ this.logWarn(`Columns with ids ${newColumnDefinitions.map((c) => c.colId).join(', ')} do not exist, will add them instead!`);
648
+ }
649
+ this.setAgGridColumnDefinitions([...updatedColDefs, ...newColumnDefinitions]);
650
+ }
651
+ removeAgGridColumnDefinition(columnId) {
652
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
653
+ if (!doesColumnExist) {
654
+ this.logWarn(`Column with id ${columnId} does not exist!`);
655
+ return;
656
+ }
657
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
658
+ const updatedColDefs = this.adaptable.agGridAdapter
659
+ .traverseColDefs(currentColDefs, (colDef) => {
660
+ return colDef.colId === columnId ? null : colDef;
661
+ })
662
+ .filter(Boolean);
663
+ this.setAgGridColumnDefinitions(updatedColDefs);
664
+ }
665
+ addAgGridColumnDefinition(newColumnDefinition) {
666
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
667
+ // just in case check of there is not already an existing column with the same id and eliminate it
668
+ const sanitizedColDefs = this.adaptable.agGridAdapter
669
+ .traverseColDefs(currentColDefs, (colDef) => {
670
+ return colDef.colId === newColumnDefinition.colId ? null : colDef;
671
+ })
672
+ .filter(Boolean);
673
+ this.setAgGridColumnDefinitions([...sanitizedColDefs, newColumnDefinition]);
674
+ }
562
675
  }
563
676
  exports.GridApiImpl = GridApiImpl;
@@ -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;
@@ -146,6 +146,9 @@ class UserInterfaceApiImpl extends ApiBase_1.ApiBase {
146
146
  getEditableCellStyle() {
147
147
  return this.getUserInterfaceOptions().editableCellStyle;
148
148
  }
149
+ getEditedCellStyle() {
150
+ return this.getUserInterfaceOptions().editedCellStyle;
151
+ }
149
152
  getReadOnlyCellStyle() {
150
153
  return this.getUserInterfaceOptions().readOnlyCellStyle;
151
154
  }
@@ -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;
@@ -53,7 +53,7 @@ class ActionRowInternalApi extends ApiBase_1.ApiBase {
53
53
  .columnApi.getColumns()
54
54
  .filter((column) => {
55
55
  // if there is NO rowNode, do NOT display the non-editable fields as they will be empty
56
- return !!rowNode || this.isColumnEditable(column, rowNode);
56
+ return !!rowNode || this.isCellEditable(column, rowNode);
57
57
  })
58
58
  .filter((column) => !this.getAdaptableApi().columnApi.internalApi.isActionRowButtonColumn(column.columnId) &&
59
59
  this.showColumnInActionRowForm(column, actionRowType));
@@ -120,21 +120,23 @@ class ActionRowInternalApi extends ApiBase_1.ApiBase {
120
120
  dataToSave[this.getOptions().primaryKey] = pkValue;
121
121
  return dataToSave;
122
122
  }
123
- isColumnEditable(column, rowNode) {
124
- return rowNode
125
- ? this.adaptableInstance.isCellEditable(rowNode, this.adaptableInstance.getAgGridColumnForColumnId(column.columnId))
126
- : !column.readOnly;
123
+ isCellEditable(column, rowNode) {
124
+ if (!rowNode) {
125
+ return !column.readOnly;
126
+ }
127
+ const gridCell = this.getAdaptableApi().gridApi.getGridCellFromRowNode(rowNode, column.columnId);
128
+ return this.getAdaptableApi().gridApi.isCellEditable(gridCell);
127
129
  }
128
130
  buildFormField(type, column, rowNode) {
129
- const isColumnEditable = this.isColumnEditable(column, rowNode);
131
+ const isCellEditable = this.isCellEditable(column, rowNode);
130
132
  const fieldValueOptions = this.getFieldValueOptions(column, rowNode);
131
- const fieldType = isColumnEditable
133
+ const fieldType = isCellEditable
132
134
  ? !!(fieldValueOptions === null || fieldValueOptions === void 0 ? void 0 : fieldValueOptions.length)
133
135
  ? 'select'
134
136
  : this.getFieldTypeFromColumnType(column)
135
137
  : 'textOutput';
136
138
  const defaultValue = rowNode
137
- ? isColumnEditable
139
+ ? isCellEditable
138
140
  ? this.getAdaptableApi().gridApi.getRawValueFromRowNode(rowNode, column.columnId)
139
141
  : this.getAdaptableApi().gridApi.getDisplayValueFromRowNode(rowNode, column.columnId)
140
142
  : null;
@@ -17,7 +17,10 @@ class GridFilterInternalApi extends ApiBase_1.ApiBase {
17
17
  * Compares to Grid Filter to see if they are identical
18
18
  */
19
19
  isGridFilterDifferent(oldFilter, newFilter) {
20
- return (oldFilter === null || oldFilter === void 0 ? void 0 : oldFilter.Expression) === (newFilter === null || newFilter === void 0 ? void 0 : newFilter.Expression);
20
+ if (oldFilter == undefined && newFilter == undefined) {
21
+ return false;
22
+ }
23
+ return (oldFilter === null || oldFilter === void 0 ? void 0 : oldFilter.Expression) !== (newFilter === null || newFilter === void 0 ? void 0 : newFilter.Expression);
21
24
  }
22
25
  }
23
26
  exports.GridFilterInternalApi = GridFilterInternalApi;