@adaptabletools/adaptable 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.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.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
  }
@@ -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';
@@ -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
  }
@@ -491,7 +491,22 @@ export class GridApiImpl extends ApiBase {
491
491
  if (gridCell.column.readOnly) {
492
492
  return false;
493
493
  }
494
- return this.adaptable.isCellEditable(gridCell.rowNode, this.adaptable.getAgGridColumnForColumnId(gridCell.column.columnId));
494
+ if (gridCell.rowNode && this.isSummaryNode(gridCell.rowNode)) {
495
+ return false;
496
+ }
497
+ const cellEditableFn = this.getEditOptions().isCellEditable;
498
+ if (cellEditableFn) {
499
+ const cellEditableContext = Object.assign({ gridCell }, this.getAdaptableApi().internalApi.buildBaseContext());
500
+ return cellEditableFn(cellEditableContext);
501
+ }
502
+ return true;
503
+ }
504
+ isCellEdited(gridCell) {
505
+ if (!gridCell) {
506
+ return false;
507
+ }
508
+ const cellDataChangedInfo = this.getDataChangeHistoryApi().getDataChangeForGridCell(gridCell);
509
+ return cellDataChangedInfo != null;
495
510
  }
496
511
  isEveryCellEditable(gridCells) {
497
512
  for (let gridCell of gridCells) {
@@ -504,6 +519,9 @@ export class GridApiImpl extends ApiBase {
504
519
  getRowCount() {
505
520
  return this.adaptable.getRowCount();
506
521
  }
522
+ getVisibleRowCount() {
523
+ return this.adaptable.getVisibleRowCount();
524
+ }
507
525
  getRowsInViewport() {
508
526
  return this.adaptable.getRowsInViewport();
509
527
  }
@@ -555,4 +573,90 @@ export class GridApiImpl extends ApiBase {
555
573
  getAllAgGridColumns() {
556
574
  return this.adaptable.getAllGridColumns();
557
575
  }
576
+ updateAgGridColumnState(columnState) {
577
+ const columnExists = this.getColumnApi().doesColumnExist(columnState.colId);
578
+ if (!columnExists) {
579
+ this.logWarn(`Column with id ${columnState.colId} does not exist, could NOT update configuration`);
580
+ return;
581
+ }
582
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
583
+ agGridApi.applyColumnState({
584
+ state: [columnState],
585
+ });
586
+ }
587
+ updateAgGridColumnStates(columnStates) {
588
+ const existingColumnStates = columnStates.filter((cc) => this.getColumnApi().doesColumnExist(cc.colId));
589
+ const notExistingColumnIds = columnStates
590
+ .filter((cc) => !this.getColumnApi().doesColumnExist(cc.colId))
591
+ .map((cc) => cc.colId);
592
+ notExistingColumnIds.forEach((colId) => {
593
+ this.logWarn(`Column with id ${colId} does not exist, could NOT update configuration`);
594
+ });
595
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
596
+ agGridApi.applyColumnState({
597
+ state: existingColumnStates,
598
+ });
599
+ }
600
+ setAgGridColumnDefinitions(columnDefinitions) {
601
+ const agGridApi = this.adaptable.agGridAdapter.getAgGridApi();
602
+ agGridApi.setGridOption('columnDefs', columnDefinitions);
603
+ this.adaptable.updateColumnModelAndRefreshGrid({ skipColDefsRefresh: true });
604
+ }
605
+ updateAgGridColumnDefinition(columnDefinitionToBeUpdated) {
606
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
607
+ const columnId = columnDefinitionToBeUpdated.colId;
608
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
609
+ if (!doesColumnExist) {
610
+ this.logWarn(`Column with id ${columnId} does not exist, will add it instead!`);
611
+ const newColDefs = [...currentColDefs, columnDefinitionToBeUpdated];
612
+ this.setAgGridColumnDefinitions(newColDefs);
613
+ return;
614
+ }
615
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
616
+ return colDef.colId === columnId ? Object.assign(Object.assign({}, colDef), columnDefinitionToBeUpdated) : colDef;
617
+ });
618
+ this.setAgGridColumnDefinitions(updatedColDefs);
619
+ }
620
+ updateAgGridColumnDefinitions(columnDefinitionsToBeUpdated) {
621
+ const currentColDefs = [...this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs()];
622
+ const updatedColDefs = this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
623
+ const newColDef = newColumnDefinitions.find((c) => c.colId === colDef.colId);
624
+ return newColDef ? Object.assign(Object.assign({}, colDef), newColDef) : colDef;
625
+ });
626
+ // find out new columns which are not in the current column definitions
627
+ const currentColIds = [];
628
+ this.adaptable.agGridAdapter.traverseColDefs(currentColDefs, (colDef) => {
629
+ currentColIds.push(colDef.colId);
630
+ return colDef;
631
+ });
632
+ const newColumnDefinitions = columnDefinitionsToBeUpdated.filter((c) => !currentColIds.includes(c.colId));
633
+ if (newColumnDefinitions.length) {
634
+ this.logWarn(`Columns with ids ${newColumnDefinitions.map((c) => c.colId).join(', ')} do not exist, will add them instead!`);
635
+ }
636
+ this.setAgGridColumnDefinitions([...updatedColDefs, ...newColumnDefinitions]);
637
+ }
638
+ removeAgGridColumnDefinition(columnId) {
639
+ const doesColumnExist = this.getColumnApi().doesColumnExist(columnId);
640
+ if (!doesColumnExist) {
641
+ this.logWarn(`Column with id ${columnId} does not exist!`);
642
+ return;
643
+ }
644
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
645
+ const updatedColDefs = this.adaptable.agGridAdapter
646
+ .traverseColDefs(currentColDefs, (colDef) => {
647
+ return colDef.colId === columnId ? null : colDef;
648
+ })
649
+ .filter(Boolean);
650
+ this.setAgGridColumnDefinitions(updatedColDefs);
651
+ }
652
+ addAgGridColumnDefinition(newColumnDefinition) {
653
+ const currentColDefs = this.adaptable.agGridAdapter.getAgGridApi().getColumnDefs();
654
+ // just in case check of there is not already an existing column with the same id and eliminate it
655
+ const sanitizedColDefs = this.adaptable.agGridAdapter
656
+ .traverseColDefs(currentColDefs, (colDef) => {
657
+ return colDef.colId === newColumnDefinition.colId ? null : colDef;
658
+ })
659
+ .filter(Boolean);
660
+ this.setAgGridColumnDefinitions([...sanitizedColDefs, newColumnDefinition]);
661
+ }
558
662
  }
@@ -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
  }
@@ -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
- const r=3988292384;function n(n=r){var t,o,u,e=new Array;for(t=0;t<256;t++){for(u=t,o=8;o>0;o--)1&~u?u>>>=1:u=u>>>1^n;e[t]=u}return e}function t(){return 4294967295}function o(r,n,t){return n=n>>>8^r[t^255&n]}function u(r){return r=(r=~r)<0?4294967295+r+1:r}export function compute_string(e,c=r){var f,i=n(c),a=0;for(a=t(),f=0;f<e.length;f++)a=o(i,a,e.charCodeAt(f));return`${a=u(a)}`}
1
+ const r=3988292384;function n(r=3988292384){var n,t,o,u=new Array;for(n=0;n<256;n++){for(o=n,t=8;t>0;t--)1&~o?o>>>=1:o=o>>>1^r;u[n]=o}return u}function t(){return 4294967295}function o(r,n,t){return n=n>>>8^r[t^255&n]}function u(r){return r=(r=~r)<0?4294967295+r+1:r}export function compute_string(r,e=3988292384){var c,f=n(e),i=0;for(i=t(),c=0;c<r.length;c++)i=o(f,i,r.charCodeAt(c));return`${i=u(i)}`}
@@ -39,6 +39,7 @@ export const GridInfoPopup = (props) => {
39
39
  returnRows.push(createReadOnlyColItem(colItems, 'Column Filters', columnFilterDescription));
40
40
  returnRows.push(createReadOnlyColItem(colItems, 'Grid Filter', gridFilterExpression));
41
41
  returnRows.push(createReadOnlyColItem(colItems, 'All Rows', props.api.gridApi.getRowCount()));
42
+ returnRows.push(createReadOnlyColItem(colItems, 'Visible Rows', props.api.gridApi.getVisibleRowCount()));
42
43
  returnRows.push(createReadOnlyColItem(colItems, 'Selected Rows', selectedRowInfo === null || selectedRowInfo === void 0 ? void 0 : selectedRowInfo.gridRows.length));
43
44
  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));
44
45
  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;