@adaptabletools/adaptable-cjs 19.0.1 → 19.0.2

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 +53 -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 +11 -2
  15. package/src/Api/Implementation/GridApiImpl.js +105 -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 +1 -1
  27. package/src/agGrid/AdaptableAgGrid.js +18 -5
  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.2",
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';
@@ -480,6 +480,10 @@ export interface GridApi {
480
480
  * Returns number of rows in Data Source
481
481
  */
482
482
  getRowCount(): number;
483
+ /**
484
+ * Returns number of rows in Data Source
485
+ */
486
+ getVisibleRowCount(): number;
483
487
  /**
484
488
  * Returns number of columns in Data Source
485
489
  */
@@ -494,9 +498,14 @@ export interface GridApi {
494
498
  destroy(): void;
495
499
  /**
496
500
  * Checks if given Grid Cell is editable
497
- * @param gridCell cell to check
501
+ * @param gridCell Cell to check
498
502
  */
499
503
  isCellEditable(gridCell: GridCell): boolean;
504
+ /**
505
+ * Checks if given Grid Cell has been edited (uses Data Change History)
506
+ * @param gridCell Cell to check
507
+ */
508
+ isCellEdited(gridCell: GridCell): boolean;
500
509
  /**
501
510
  * Checks if all of given Grid Cells are editable
502
511
  * @param gridCells cells to check
@@ -530,4 +539,46 @@ export interface GridApi {
530
539
  * Return all AG Grid columns
531
540
  */
532
541
  getAllAgGridColumns(): Column<any>[];
542
+ /**
543
+ * 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.
544
+ * @param columnState - the AG Grid ColumnState to set
545
+ */
546
+ updateAgGridColumnState(columnState: ColumnState): void;
547
+ /**
548
+ * 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.
549
+ * @param columnStates - the AG Grid ColumnState to set
550
+ */
551
+ updateAgGridColumnStates(columnStates: ColumnState[]): void;
552
+ /**
553
+ * Sets the Column Definitions for the Grid
554
+ */
555
+ setAgGridColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
556
+ /**
557
+ * Updates the Column Definition for a given Column. The provided column properties are merged with the existing Column Definition.
558
+ * @param columnId - the ColumnId to update
559
+ * @param columnDefinition - the new Column Definition
560
+ */
561
+ updateAgGridColumnDefinition(columnDefinition: ColDefWithId): void;
562
+ /**
563
+ * Updates the Column Definitions for the given Columns. The provided column properties are merged with the existing Column Definitions.
564
+ * @param columnId - the ColumnId to update
565
+ * @param columnDefinition - the new Column Definition
566
+ */
567
+ updateAgGridColumnDefinitions(columnDefinitions: ColDefWithId[]): void;
568
+ /**
569
+ * Removes the Column Definition for a given Column.
570
+ * @param columnId - the ColumnId to remove
571
+ */
572
+ removeAgGridColumnDefinition(columnId: string): void;
573
+ /**
574
+ * Adds a Column Definition to the Grid
575
+ * @param columnDefinition - the new Column Definition
576
+ */
577
+ addAgGridColumnDefinition(columnDefinition: ColDefWithId): void;
533
578
  }
579
+ /**
580
+ * Column Definition with a mandatory `colId` property
581
+ */
582
+ export type ColDefWithId = Omit<ColDef, 'colId'> & {
583
+ colId: string;
584
+ };
@@ -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';
@@ -122,8 +122,10 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
122
122
  refreshRowNodes(rowNodes: IRowNode[]): void;
123
123
  refreshGroupRowNodes(): void;
124
124
  isCellEditable(gridCell: GridCell): boolean;
125
+ isCellEdited(gridCell: GridCell): boolean;
125
126
  isEveryCellEditable(gridCells: GridCell[]): boolean;
126
127
  getRowCount(): number;
128
+ getVisibleRowCount(): number;
127
129
  getRowsInViewport(): IRowNode[];
128
130
  getColumnCount(): number;
129
131
  getVisibleColumnCount(): number;
@@ -135,4 +137,11 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
135
137
  getAgGridRowModelType(): RowModelType;
136
138
  showTransposedView(transposeConfig?: TransposeConfig): void;
137
139
  getAllAgGridColumns(): Column<any>[];
140
+ updateAgGridColumnState(columnState: ColumnState): void;
141
+ updateAgGridColumnStates(columnStates: ColumnState[]): void;
142
+ setAgGridColumnDefinitions(columnDefinitions: (ColDef | ColGroupDef)[]): void;
143
+ updateAgGridColumnDefinition(columnDefinitionToBeUpdated: ColDefWithId): void;
144
+ updateAgGridColumnDefinitions(columnDefinitionsToBeUpdated: ColDefWithId[]): void;
145
+ removeAgGridColumnDefinition(columnId: string): void;
146
+ addAgGridColumnDefinition(newColumnDefinition: ColDefWithId): void;
138
147
  }
@@ -495,7 +495,22 @@ class GridApiImpl extends ApiBase_1.ApiBase {
495
495
  if (gridCell.column.readOnly) {
496
496
  return false;
497
497
  }
498
- return this.adaptable.isCellEditable(gridCell.rowNode, this.adaptable.getAgGridColumnForColumnId(gridCell.column.columnId));
498
+ if (gridCell.rowNode && this.isSummaryNode(gridCell.rowNode)) {
499
+ return false;
500
+ }
501
+ const cellEditableFn = this.getEditOptions().isCellEditable;
502
+ if (cellEditableFn) {
503
+ const cellEditableContext = Object.assign({ gridCell }, this.getAdaptableApi().internalApi.buildBaseContext());
504
+ return cellEditableFn(cellEditableContext);
505
+ }
506
+ return true;
507
+ }
508
+ isCellEdited(gridCell) {
509
+ if (!gridCell) {
510
+ return false;
511
+ }
512
+ const cellDataChangedInfo = this.getDataChangeHistoryApi().getDataChangeForGridCell(gridCell);
513
+ return cellDataChangedInfo != null;
499
514
  }
500
515
  isEveryCellEditable(gridCells) {
501
516
  for (let gridCell of gridCells) {
@@ -508,6 +523,9 @@ class GridApiImpl extends ApiBase_1.ApiBase {
508
523
  getRowCount() {
509
524
  return this.adaptable.getRowCount();
510
525
  }
526
+ getVisibleRowCount() {
527
+ return this.adaptable.getVisibleRowCount();
528
+ }
511
529
  getRowsInViewport() {
512
530
  return this.adaptable.getRowsInViewport();
513
531
  }
@@ -559,5 +577,91 @@ class GridApiImpl extends ApiBase_1.ApiBase {
559
577
  getAllAgGridColumns() {
560
578
  return this.adaptable.getAllGridColumns();
561
579
  }
580
+ updateAgGridColumnState(columnState) {
581
+ const columnExists = this.getColumnApi().doesColumnExist(columnState.colId);
582
+ if (!columnExists) {
583
+ this.logWarn(`Column with id ${columnState.colId} does not exist, could NOT update configuration`);
584
+ return;
585
+ }
586
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
587
+ agGridApi.applyColumnState({
588
+ state: [columnState],
589
+ });
590
+ }
591
+ updateAgGridColumnStates(columnStates) {
592
+ const existingColumnStates = columnStates.filter((cc) => this.getColumnApi().doesColumnExist(cc.colId));
593
+ const notExistingColumnIds = columnStates
594
+ .filter((cc) => !this.getColumnApi().doesColumnExist(cc.colId))
595
+ .map((cc) => cc.colId);
596
+ notExistingColumnIds.forEach((colId) => {
597
+ this.logWarn(`Column with id ${colId} does not exist, could NOT update configuration`);
598
+ });
599
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
600
+ agGridApi.applyColumnState({
601
+ state: existingColumnStates,
602
+ });
603
+ }
604
+ setAgGridColumnDefinitions(columnDefinitions) {
605
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
606
+ agGridApi.setGridOption('columnDefs', columnDefinitions);
607
+ this.adaptable.updateColumnModelAndRefreshGrid({ skipColDefsRefresh: true });
608
+ }
609
+ updateAgGridColumnDefinition(columnDefinitionToBeUpdated) {
610
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
611
+ const columnId = columnDefinitionToBeUpdated.colId;
612
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
613
+ if (!doesColumnExist) {
614
+ this.logWarn(`Column with id ${columnId} does not exist, will add it instead!`);
615
+ const newColDefs = [...currentColDefs, columnDefinitionToBeUpdated];
616
+ this.setAgGridColumnDefinitions(newColDefs);
617
+ return;
618
+ }
619
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
620
+ return colDef.colId === columnId ? Object.assign(Object.assign({}, colDef), columnDefinitionToBeUpdated) : colDef;
621
+ });
622
+ this.setAgGridColumnDefinitions(updatedColDefs);
623
+ }
624
+ updateAgGridColumnDefinitions(columnDefinitionsToBeUpdated) {
625
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
626
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
627
+ const newColDef = newColumnDefinitions.find((c) => c.colId === colDef.colId);
628
+ return newColDef ? Object.assign(Object.assign({}, colDef), newColDef) : colDef;
629
+ });
630
+ // find out new columns which are not in the current column definitions
631
+ const currentColIds = [];
632
+ this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
633
+ currentColIds.push(colDef.colId);
634
+ return colDef;
635
+ });
636
+ const newColumnDefinitions = columnDefinitionsToBeUpdated.filter((c) => !currentColIds.includes(c.colId));
637
+ if (newColumnDefinitions.length) {
638
+ this.logWarn(`Columns with ids ${newColumnDefinitions.map((c) => c.colId).join(', ')} do not exist, will add them instead!`);
639
+ }
640
+ this.setAgGridColumnDefinitions([...updatedColDefs, ...newColumnDefinitions]);
641
+ }
642
+ removeAgGridColumnDefinition(columnId) {
643
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
644
+ if (!doesColumnExist) {
645
+ this.logWarn(`Column with id ${columnId} does not exist!`);
646
+ return;
647
+ }
648
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
649
+ const updatedColDefs = this.adaptable.agGridAdapter
650
+ .traverseColDefs(currentColDefs, (colDef) => {
651
+ return colDef.colId === columnId ? null : colDef;
652
+ })
653
+ .filter(Boolean);
654
+ this.setAgGridColumnDefinitions(updatedColDefs);
655
+ }
656
+ addAgGridColumnDefinition(newColumnDefinition) {
657
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
658
+ // just in case check of there is not already an existing column with the same id and eliminate it
659
+ const sanitizedColDefs = this.adaptable.agGridAdapter
660
+ .traverseColDefs(currentColDefs, (colDef) => {
661
+ return colDef.colId === newColumnDefinition.colId ? null : colDef;
662
+ })
663
+ .filter(Boolean);
664
+ this.setAgGridColumnDefinitions([...sanitizedColDefs, newColumnDefinition]);
665
+ }
562
666
  }
563
667
  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;
@@ -55,11 +55,15 @@ export interface UserInterfaceApi {
55
55
  */
56
56
  getEditLookUpValuesForEditLookUpItem(editLookUpItem: EditLookUpPermittedValues, gridCell: GridCell): any[] | undefined;
57
57
  /**
58
- * Returns Style set for Editable cells
58
+ * Returns Style set for Editable Cells
59
59
  */
60
60
  getEditableCellStyle(): AdaptableStyle | undefined;
61
61
  /**
62
- * Returns Style set for ReadOnly cells
62
+ * Returns Style for Cells that have been edited
63
+ */
64
+ getEditedCellStyle(): AdaptableStyle | undefined;
65
+ /**
66
+ * Returns Style set for ReadOnly Cells
63
67
  */
64
68
  getReadOnlyCellStyle(): AdaptableStyle | undefined;
65
69
  /**
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compute_string=void 0;const r=3988292384;function t(t=r){var e,n,o,u=new Array;for(e=0;e<256;e++){for(o=e,n=8;n>0;n--)1&~o?o>>>=1:o=o>>>1^t;u[e]=o}return u}function e(){return 4294967295}function n(r,t,e){return t=t>>>8^r[e^255&t]}function o(r){return r=(r=~r)<0?4294967295+r+1:r}function u(u,c=r){var i,f=t(c),s=0;for(s=e(),i=0;i<u.length;i++)s=n(f,s,u.charCodeAt(i));return`${s=o(s)}`}exports.compute_string=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compute_string=void 0;const r=3988292384;function t(r=3988292384){var t,e,n,o=new Array;for(t=0;t<256;t++){for(n=t,e=8;e>0;e--)1&~n?n>>>=1:n=n>>>1^r;o[t]=n}return o}function e(){return 4294967295}function n(r,t,e){return t=t>>>8^r[e^255&t]}function o(r){return r=(r=~r)<0?4294967295+r+1:r}function u(r,u=3988292384){var c,i=t(u),f=0;for(f=e(),c=0;c<r.length;c++)f=n(i,f,r.charCodeAt(c));return`${f=o(f)}`}exports.compute_string=u;
@@ -43,6 +43,7 @@ const GridInfoPopup = (props) => {
43
43
  returnRows.push(createReadOnlyColItem(colItems, 'Column Filters', columnFilterDescription));
44
44
  returnRows.push(createReadOnlyColItem(colItems, 'Grid Filter', gridFilterExpression));
45
45
  returnRows.push(createReadOnlyColItem(colItems, 'All Rows', props.api.gridApi.getRowCount()));
46
+ returnRows.push(createReadOnlyColItem(colItems, 'Visible Rows', props.api.gridApi.getVisibleRowCount()));
46
47
  returnRows.push(createReadOnlyColItem(colItems, 'Selected Rows', selectedRowInfo === null || selectedRowInfo === void 0 ? void 0 : selectedRowInfo.gridRows.length));
47
48
  returnRows.push(createReadOnlyColItem(colItems, 'Visible Selected Rows', selectedRowInfo === null || selectedRowInfo === void 0 ? void 0 : selectedRowInfo.gridRows.filter((gr) => { var _a; return ((_a = gr.rowNode) === null || _a === void 0 ? void 0 : _a.displayed) == true; }).length));
48
49
  returnRows.push(createReadOnlyColItem(colItems, 'All Columns', props.api.gridApi.getColumnCount()));
@@ -7,6 +7,8 @@ export declare class ActionColumnRenderer implements ICellRendererComp {
7
7
  private eGui;
8
8
  private eventListener;
9
9
  private unmountReactRoot?;
10
+ private layoutSwitchUnsubscribe?;
11
+ private actionButtons;
10
12
  init(params: ActionColumnCellRendererParams): void;
11
13
  render(): void;
12
14
  getGui(): HTMLElement;