@adaptabletools/adaptable 11.1.1-canary.0 → 11.1.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.cjs.js +8 -8
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -2
- package/src/AdaptableOptions/AlertOptions.d.ts +2 -2
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +2 -2
- package/src/AdaptableOptions/EditOptions.d.ts +2 -2
- package/src/Api/AlertApi.d.ts +3 -5
- package/src/Api/DataChangeHistoryApi.d.ts +3 -3
- package/src/Api/Events/CellChanged.d.ts +2 -2
- package/src/Api/ExportApi.d.ts +3 -3
- package/src/Api/FreeTextColumnApi.d.ts +3 -3
- package/src/Api/GridApi.d.ts +4 -4
- package/src/Api/Implementation/AlertApiImpl.d.ts +3 -3
- package/src/Api/Implementation/AlertApiImpl.js +20 -20
- package/src/Api/Implementation/DataChangeHistoryApiImpl.d.ts +3 -3
- package/src/Api/Implementation/ExportApiImpl.d.ts +2 -2
- package/src/Api/Implementation/ExportApiImpl.js +7 -8
- package/src/Api/Implementation/FreeTextColumnApiImpl.d.ts +2 -2
- package/src/Api/Implementation/FreeTextColumnApiImpl.js +7 -7
- package/src/Api/Implementation/GridApiImpl.d.ts +3 -3
- package/src/Api/Implementation/GridApiImpl.js +5 -5
- package/src/Api/Implementation/InternalApiImpl.d.ts +2 -2
- package/src/Api/Implementation/InternalApiImpl.js +6 -6
- package/src/Api/InternalApi.d.ts +2 -2
- package/src/PredefinedConfig/Common/AdaptableAlert.d.ts +2 -2
- package/src/PredefinedConfig/Common/AdaptableFlashingCell.d.ts +2 -2
- package/src/PredefinedConfig/Common/{DataChangedInfo.d.ts → CellDataChangedInfo.d.ts} +1 -5
- package/src/PredefinedConfig/Common/{DataChangedInfo.js → CellDataChangedInfo.js} +0 -0
- package/src/PredefinedConfig/Common/DataChangedScope.d.ts +4 -0
- package/src/PredefinedConfig/Common/DataChangedScope.js +2 -0
- package/src/PredefinedConfig/SystemState.d.ts +2 -2
- package/src/Redux/ActionsReducers/GridRedux.d.ts +5 -5
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +5 -5
- package/src/Redux/ActionsReducers/SystemRedux.js +5 -5
- package/src/Redux/Store/AdaptableStore.js +14 -14
- package/src/Strategy/AlertModule.js +12 -10
- package/src/Strategy/BulkUpdateModule.js +2 -2
- package/src/Strategy/DataChangeHistoryModule.js +8 -6
- package/src/Strategy/FlashingCellModule.d.ts +2 -2
- package/src/Strategy/FlashingCellModule.js +21 -15
- package/src/Strategy/FormatColumnModule.js +4 -2
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +2 -2
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -1
- package/src/Utilities/ObjectFactory.d.ts +2 -2
- package/src/Utilities/ObjectFactory.js +2 -2
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +3 -3
- package/src/Utilities/Services/DataService.d.ts +5 -5
- package/src/Utilities/Services/DataService.js +12 -10
- package/src/Utilities/Services/Interface/IAlertService.d.ts +2 -2
- package/src/Utilities/Services/Interface/IDataService.d.ts +6 -6
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +3 -3
- package/src/Utilities/Services/Interface/IValidationService.d.ts +4 -4
- package/src/Utilities/Services/QueryLanguageService.d.ts +3 -3
- package/src/Utilities/Services/ValidationService.d.ts +4 -4
- package/src/Utilities/Services/ValidationService.js +17 -17
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.d.ts +2 -2
- package/src/View/DataChangeHistory/DataChangeHistoryPopup.d.ts +2 -2
- package/src/agGrid/Adaptable.d.ts +2 -2
- package/src/agGrid/Adaptable.js +50 -48
- package/src/metamodel/adaptable.metamodel.d.ts +34 -34
- package/src/metamodel/adaptable.metamodel.js +67 -67
- package/src/types.d.ts +2 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -20,11 +20,11 @@ class DataService {
|
|
|
20
20
|
this.undoChangeLog = new Map();
|
|
21
21
|
this.undoChangeTimers = new Map();
|
|
22
22
|
}
|
|
23
|
-
CreateDataChangedEvent(
|
|
24
|
-
if (
|
|
25
|
-
this.emitter.emitSync('
|
|
26
|
-
this.adaptable.api.gridApi.fireCellChangedEvent(
|
|
27
|
-
this.logDataChange(
|
|
23
|
+
CreateDataChangedEvent(cellDataChangedInfo) {
|
|
24
|
+
if (cellDataChangedInfo.newValue != cellDataChangedInfo.oldValue) {
|
|
25
|
+
this.emitter.emitSync('CellDataChanged', cellDataChangedInfo);
|
|
26
|
+
this.adaptable.api.gridApi.fireCellChangedEvent(cellDataChangedInfo);
|
|
27
|
+
this.logDataChange(cellDataChangedInfo);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
// we need this temporary "shared memory" because the value change and the AG Grid cellChanged event are asynchronous
|
|
@@ -69,16 +69,18 @@ class DataService {
|
|
|
69
69
|
newValue,
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
logDataChange(
|
|
73
|
-
const dataChangeLogEntry = this.extractDataChangeLogEntry(
|
|
72
|
+
logDataChange(cellDataChangedInfo) {
|
|
73
|
+
const dataChangeLogEntry = this.extractDataChangeLogEntry(cellDataChangedInfo);
|
|
74
74
|
this.dataChangeLogSubject$.next(dataChangeLogEntry);
|
|
75
75
|
}
|
|
76
|
-
extractDataChangeLogEntry(
|
|
76
|
+
extractDataChangeLogEntry(cellDataChangedInfo) {
|
|
77
77
|
// create rowData snapshot
|
|
78
|
-
const rowData =
|
|
78
|
+
const rowData = cellDataChangedInfo.rowData
|
|
79
|
+
? Helper_1.default.cloneObject(cellDataChangedInfo.rowData)
|
|
80
|
+
: null;
|
|
79
81
|
// strip down rowNode properties as it is pretty "heavy" on the memory
|
|
80
82
|
const rowNode = rowData ? { data: rowData } : null;
|
|
81
|
-
return Object.assign(Object.assign({},
|
|
83
|
+
return Object.assign(Object.assign({}, cellDataChangedInfo), { rowNode,
|
|
82
84
|
rowData });
|
|
83
85
|
}
|
|
84
86
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AlertDefinition } from '../../../PredefinedConfig/AlertState';
|
|
2
|
-
import {
|
|
2
|
+
import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
3
3
|
import { IAdaptableService } from './IAdaptableService';
|
|
4
4
|
export declare type ReactiveAlertInfo = {
|
|
5
5
|
alertDefinition: AlertDefinition;
|
|
6
6
|
type: 'alert';
|
|
7
|
-
dataChangeLogEntry:
|
|
7
|
+
dataChangeLogEntry: CellDataChangedInfo;
|
|
8
8
|
};
|
|
9
9
|
export interface IAlertService extends IAdaptableService {
|
|
10
10
|
createReactiveAlert(alertDefinition: AlertDefinition): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { IAdaptableService } from './IAdaptableService';
|
|
4
4
|
export interface IDataService extends IAdaptableService {
|
|
5
|
-
CreateDataChangedEvent(
|
|
6
|
-
on(eventName: '
|
|
7
|
-
readonly dataChangeLog$: Observable<
|
|
8
|
-
logUndoChange(undoChange:
|
|
9
|
-
extractUndoChange(undoChange:
|
|
5
|
+
CreateDataChangedEvent(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
6
|
+
on(eventName: 'CellDataChanged', callback: (cellDataChangedInfo: CellDataChangedInfo) => void): () => void;
|
|
7
|
+
readonly dataChangeLog$: Observable<CellDataChangedInfo>;
|
|
8
|
+
logUndoChange(undoChange: CellDataChangedInfo): void;
|
|
9
|
+
extractUndoChange(undoChange: CellDataChangedInfo): CellDataChangedInfo | undefined;
|
|
10
10
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { IAdaptableService } from './IAdaptableService';
|
|
3
3
|
import { RowNode } from '@ag-grid-community/all-modules';
|
|
4
|
-
import {
|
|
4
|
+
import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
5
5
|
import { AdaptableModule } from '../../../PredefinedConfig/Common/Types';
|
|
6
6
|
import { AggregationParameter } from '../../ExpressionFunctions/aggregatedScalarExpressionFunctions';
|
|
7
7
|
import { ModuleExpressionFunctions } from '../../../AdaptableOptions/AdaptableQLOptions';
|
|
8
8
|
export interface IQueryLanguageService extends IAdaptableService {
|
|
9
9
|
evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: RowNode): boolean;
|
|
10
10
|
evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
|
|
11
|
-
evaluateObservableExpression(expression: string, module: AdaptableModule): Observable<
|
|
12
|
-
evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule): Observable<
|
|
11
|
+
evaluateObservableExpression(expression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
|
|
12
|
+
evaluateAggregatedBooleanExpression(expression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
|
|
13
13
|
evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): AggregationParameter;
|
|
14
14
|
validateBoolean(expression: string, module: AdaptableModule, config?: {
|
|
15
15
|
force?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CellDataChangedInfo } from '../../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
2
2
|
import { AlertDefinition } from '../../../PredefinedConfig/AlertState';
|
|
3
3
|
import { IAdaptableService } from './IAdaptableService';
|
|
4
4
|
export interface IValidationService extends IAdaptableService {
|
|
5
|
-
getValidationRulesForDataChange(
|
|
6
|
-
performValidation(
|
|
7
|
-
performServerValidation(
|
|
5
|
+
getValidationRulesForDataChange(cellDataChangedInfo: CellDataChangedInfo): AlertDefinition[];
|
|
6
|
+
performValidation(cellDataChangedInfo: CellDataChangedInfo): boolean;
|
|
7
|
+
performServerValidation(cellDataChangedInfo: CellDataChangedInfo, config: {
|
|
8
8
|
onServerValidationCompleted: () => void;
|
|
9
9
|
}): () => boolean;
|
|
10
10
|
createValidationDescription(alertDefinition: AlertDefinition): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IQueryLanguageService } from './Interface/IQueryLanguageService';
|
|
2
2
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
-
import {
|
|
4
|
+
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
5
5
|
import { RowNode } from '@ag-grid-community/all-modules';
|
|
6
6
|
import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
|
|
7
7
|
import { ModuleExpressionFunctions } from '../../AdaptableOptions/AdaptableQLOptions';
|
|
@@ -17,8 +17,8 @@ export declare class QueryLanguageService implements IQueryLanguageService {
|
|
|
17
17
|
evaluateBooleanExpression(expression: string, module: AdaptableModule, rowNode: any): any;
|
|
18
18
|
evaluateScalarExpression(expression: string, module: AdaptableModule, rowNode: RowNode): any;
|
|
19
19
|
evaluateAggregatedScalarExpression(expression: string, module: AdaptableModule): AggregationParameter;
|
|
20
|
-
evaluateObservableExpression(reactiveExpression: string, module: AdaptableModule): Observable<
|
|
21
|
-
evaluateAggregatedBooleanExpression(aggregationExpression: string, module: AdaptableModule): Observable<
|
|
20
|
+
evaluateObservableExpression(reactiveExpression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
|
|
21
|
+
evaluateAggregatedBooleanExpression(aggregationExpression: string, module: AdaptableModule): Observable<CellDataChangedInfo>;
|
|
22
22
|
validateBoolean(expressionInput: string, module: AdaptableModule, config?: {
|
|
23
23
|
force?: boolean;
|
|
24
24
|
}): {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
|
|
2
|
-
import {
|
|
2
|
+
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
3
3
|
import { IValidationService } from './Interface/IValidationService';
|
|
4
4
|
import { AlertDefinition } from '../../PredefinedConfig/AlertState';
|
|
5
5
|
export declare class ValidationService implements IValidationService {
|
|
6
6
|
private adaptable;
|
|
7
7
|
constructor(adaptable: IAdaptable);
|
|
8
|
-
getValidationRulesForDataChange(
|
|
9
|
-
performValidation(
|
|
8
|
+
getValidationRulesForDataChange(cellDataChangedInfo: CellDataChangedInfo): AlertDefinition[];
|
|
9
|
+
performValidation(cellDataChangedInfo: CellDataChangedInfo): boolean;
|
|
10
10
|
private IsAlertDefinitionTriggered;
|
|
11
|
-
performServerValidation(
|
|
11
|
+
performServerValidation(cellDataChangedInfo: CellDataChangedInfo, config: {
|
|
12
12
|
onServerValidationCompleted: () => void;
|
|
13
13
|
}): () => boolean;
|
|
14
14
|
createValidationDescription(alertDefinition: AlertDefinition): string;
|
|
@@ -11,28 +11,28 @@ class ValidationService {
|
|
|
11
11
|
this.adaptable = adaptable;
|
|
12
12
|
}
|
|
13
13
|
// Not sure where to put this: was in the Module but might be better here until I can work out a way of having an event with a callback...
|
|
14
|
-
getValidationRulesForDataChange(
|
|
14
|
+
getValidationRulesForDataChange(cellDataChangedInfo) {
|
|
15
15
|
// if the new value is the same as the old value then we can get out as we dont see it as an edit?
|
|
16
|
-
if (
|
|
16
|
+
if (cellDataChangedInfo.oldValue == cellDataChangedInfo.newValue) {
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
19
|
let editingRules = this.adaptable.api.alertApi
|
|
20
20
|
.getAlertDefinitionsWithPreventEdit()
|
|
21
|
-
.filter((v) => this.adaptable.api.scopeApi.isColumnInScope(
|
|
21
|
+
.filter((v) => this.adaptable.api.scopeApi.isColumnInScope(cellDataChangedInfo.column, v.Scope));
|
|
22
22
|
let failedValidations = [];
|
|
23
23
|
if (ArrayExtensions_1.ArrayExtensions.IsNotEmpty(editingRules)) {
|
|
24
24
|
editingRules.forEach((alertDefinition) => {
|
|
25
25
|
if (alertDefinition.Rule.BooleanExpression) {
|
|
26
|
-
let isSatisfiedExpression =
|
|
26
|
+
let isSatisfiedExpression = cellDataChangedInfo.rowNode != null &&
|
|
27
27
|
this.adaptable.api.internalApi
|
|
28
28
|
.getQueryLanguageService()
|
|
29
|
-
.evaluateBooleanExpression(alertDefinition.Rule.BooleanExpression, ModuleConstants_1.AlertModuleId,
|
|
29
|
+
.evaluateBooleanExpression(alertDefinition.Rule.BooleanExpression, ModuleConstants_1.AlertModuleId, cellDataChangedInfo.rowNode);
|
|
30
30
|
if (isSatisfiedExpression) {
|
|
31
31
|
failedValidations.push(alertDefinition);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
if (this.IsAlertDefinitionTriggered(alertDefinition,
|
|
35
|
+
if (this.IsAlertDefinitionTriggered(alertDefinition, cellDataChangedInfo)) {
|
|
36
36
|
failedValidations.push(alertDefinition);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -40,15 +40,15 @@ class ValidationService {
|
|
|
40
40
|
}
|
|
41
41
|
return failedValidations;
|
|
42
42
|
}
|
|
43
|
-
performValidation(
|
|
44
|
-
const failedRules = this.getValidationRulesForDataChange(
|
|
43
|
+
performValidation(cellDataChangedInfo) {
|
|
44
|
+
const failedRules = this.getValidationRulesForDataChange(cellDataChangedInfo);
|
|
45
45
|
if (failedRules.length > 0) {
|
|
46
46
|
let alert = {
|
|
47
47
|
alertType: 'cellChanged',
|
|
48
48
|
header: 'Alert',
|
|
49
49
|
message: 'Perform Edit Alert Fired',
|
|
50
50
|
alertDefinition: failedRules[0],
|
|
51
|
-
|
|
51
|
+
cellDataChangedInfo: cellDataChangedInfo,
|
|
52
52
|
};
|
|
53
53
|
this.adaptable.api.alertApi.publishAlertFiredEvent(alert);
|
|
54
54
|
return false;
|
|
@@ -64,25 +64,25 @@ class ValidationService {
|
|
|
64
64
|
column: dataChangedEvent.column,
|
|
65
65
|
}, false);
|
|
66
66
|
}
|
|
67
|
-
performServerValidation(
|
|
67
|
+
performServerValidation(cellDataChangedInfo, config) {
|
|
68
68
|
return () => {
|
|
69
69
|
this.adaptable.adaptableOptions.editOptions
|
|
70
|
-
.validateOnServer(
|
|
70
|
+
.validateOnServer(cellDataChangedInfo)
|
|
71
71
|
.then((validationResult) => {
|
|
72
72
|
var _a, _b;
|
|
73
73
|
if (validationResult.NewValue === undefined) {
|
|
74
|
-
validationResult.NewValue =
|
|
74
|
+
validationResult.NewValue = cellDataChangedInfo.newValue;
|
|
75
75
|
}
|
|
76
76
|
// If they have changed the return value then we should update the grid, log the function change
|
|
77
77
|
// otherwise the value will persist
|
|
78
|
-
if (validationResult.NewValue !==
|
|
79
|
-
|
|
80
|
-
// this.adaptable.setValue(
|
|
81
|
-
const row = (_a =
|
|
78
|
+
if (validationResult.NewValue !== cellDataChangedInfo.newValue) {
|
|
79
|
+
cellDataChangedInfo.newValue = validationResult.NewValue;
|
|
80
|
+
// this.adaptable.setValue(cellDataChangedInfo, false);
|
|
81
|
+
const row = (_a = cellDataChangedInfo.rowNode) === null || _a === void 0 ? void 0 : _a.data;
|
|
82
82
|
if (!row) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
row[(_b = this.adaptable.api.columnApi.getAgGridColumnFieldForAdaptableColumn(
|
|
85
|
+
row[(_b = this.adaptable.api.columnApi.getAgGridColumnFieldForAdaptableColumn(cellDataChangedInfo.column.columnId)) !== null && _b !== void 0 ? _b : cellDataChangedInfo.column.columnId] = validationResult.NewValue;
|
|
86
86
|
this.adaptable.api.gridApi.updateGridData([row]);
|
|
87
87
|
if (StringExtensions_1.default.IsNotNullOrEmpty(validationResult.ValidationMessage) &&
|
|
88
88
|
this.adaptable.adaptableOptions.editOptions.displayServerValidationMessages) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
3
3
|
export interface DataChangeHistoryGridProps {
|
|
4
4
|
adaptableContainerId: string;
|
|
5
5
|
agGridContainerId: string;
|
|
6
|
-
changeHistoryLog: Record<string,
|
|
6
|
+
changeHistoryLog: Record<string, CellDataChangedInfo>;
|
|
7
7
|
onUndoChange: (changeKey: string) => void;
|
|
8
8
|
}
|
|
9
9
|
export declare const DataChangeHistoryGrid: (props: DataChangeHistoryGridProps) => JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ModuleViewPopupProps } from '../Components/SharedProps/ModuleViewPopupProps';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
4
4
|
import { SystemDataChangeHistoryDisableAction, SystemDataChangeHistoryEnableAction, SystemDataChangeHistoryResumeAction, SystemDataChangeHistorySuspendAction } from '../../Redux/ActionsReducers/SystemRedux';
|
|
5
5
|
import { DataChangeHistoryMode } from '../../PredefinedConfig/SystemState';
|
|
6
6
|
import { AdaptableApi } from '../../Api/AdaptableApi';
|
|
7
7
|
interface DataChangeHistoryPopupProps extends ModuleViewPopupProps<DataChangeHistoryPopupComponent> {
|
|
8
|
-
changeHistoryLog: Record<string,
|
|
8
|
+
changeHistoryLog: Record<string, CellDataChangedInfo>;
|
|
9
9
|
changeHistoryMode: DataChangeHistoryMode;
|
|
10
10
|
activationTime: Date;
|
|
11
11
|
suspensionTime: Date;
|
|
@@ -7,7 +7,7 @@ import { AdaptableApi } from '../Api/AdaptableApi';
|
|
|
7
7
|
import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
|
|
8
8
|
import { AdaptableStyle } from '../PredefinedConfig/Common/AdaptableStyle';
|
|
9
9
|
import { ColumnSort } from '../PredefinedConfig/Common/ColumnSort';
|
|
10
|
-
import {
|
|
10
|
+
import { CellDataChangedInfo } from '../PredefinedConfig/Common/CellDataChangedInfo';
|
|
11
11
|
import { DataUpdateConfig } from '../PredefinedConfig/Common/DataUpdateConfig';
|
|
12
12
|
import { AdaptableMenuItem } from '../PredefinedConfig/Common/Menu';
|
|
13
13
|
import { ReportData } from '../PredefinedConfig/ExportState';
|
|
@@ -149,7 +149,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
149
149
|
private updateLayoutFromGrid;
|
|
150
150
|
setSelectedCells(): SelectedCellInfo | undefined;
|
|
151
151
|
setSelectedRows(): SelectedRowInfo | undefined;
|
|
152
|
-
setValue(
|
|
152
|
+
setValue(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
153
153
|
cancelEdit(): void;
|
|
154
154
|
isCellEditable(rowNode: RowNode, column: Column): boolean;
|
|
155
155
|
getDistinctValuesForColumn(column: AdaptableColumn, visibleRowsOnly: boolean, skipRowNode?: RowNode, permittedValues?: any[]): GridCell[];
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -1483,25 +1483,27 @@ class Adaptable {
|
|
|
1483
1483
|
this.agGridHelper.fireSelectionChangedEvent();
|
|
1484
1484
|
return selectedRowInfo;
|
|
1485
1485
|
}
|
|
1486
|
-
setValue(
|
|
1486
|
+
setValue(cellDataChangedInfo) {
|
|
1487
1487
|
// note: because we use RowNode.setDataValue() this will cause Validation to fire
|
|
1488
1488
|
// see https://www.ag-grid.com/javascript-data-grid/change-detection/#triggering-value-change-detection
|
|
1489
1489
|
let newValue;
|
|
1490
|
-
let dataType =
|
|
1490
|
+
let dataType = cellDataChangedInfo.column.dataType;
|
|
1491
1491
|
newValue =
|
|
1492
|
-
dataType == Enums_1.DataType.Number
|
|
1492
|
+
dataType == Enums_1.DataType.Number
|
|
1493
|
+
? Number(cellDataChangedInfo.newValue)
|
|
1494
|
+
: cellDataChangedInfo.newValue;
|
|
1493
1495
|
if (dataType == undefined) {
|
|
1494
1496
|
return; // no point continuing as probably a wrong column
|
|
1495
1497
|
}
|
|
1496
|
-
if (
|
|
1497
|
-
|
|
1498
|
+
if (cellDataChangedInfo.rowNode) {
|
|
1499
|
+
cellDataChangedInfo.rowNode.setDataValue(cellDataChangedInfo.column.columnId, newValue);
|
|
1498
1500
|
}
|
|
1499
1501
|
else {
|
|
1500
1502
|
if (this.useRowNodeLookUp) {
|
|
1501
|
-
const rowNode = this.gridOptions.api.getRowNode(
|
|
1503
|
+
const rowNode = this.gridOptions.api.getRowNode(cellDataChangedInfo.primaryKeyValue);
|
|
1502
1504
|
if (rowNode != null) {
|
|
1503
|
-
rowNode.setDataValue(
|
|
1504
|
-
|
|
1505
|
+
rowNode.setDataValue(cellDataChangedInfo.column.columnId, newValue);
|
|
1506
|
+
cellDataChangedInfo.rowNode = rowNode;
|
|
1505
1507
|
}
|
|
1506
1508
|
}
|
|
1507
1509
|
else {
|
|
@@ -1509,9 +1511,9 @@ class Adaptable {
|
|
|
1509
1511
|
// prefer not to use this method but if we do then at least we can prevent further lookups once we find
|
|
1510
1512
|
this.gridOptions.api.getModel().forEachNode((rowNode) => {
|
|
1511
1513
|
if (!isUpdated) {
|
|
1512
|
-
if (
|
|
1513
|
-
rowNode.setDataValue(
|
|
1514
|
-
|
|
1514
|
+
if (cellDataChangedInfo.primaryKeyValue == this.getPrimaryKeyValueFromRowNode(rowNode)) {
|
|
1515
|
+
rowNode.setDataValue(cellDataChangedInfo.column.columnId, newValue);
|
|
1516
|
+
cellDataChangedInfo.rowNode = rowNode;
|
|
1515
1517
|
isUpdated = true;
|
|
1516
1518
|
}
|
|
1517
1519
|
}
|
|
@@ -3091,7 +3093,7 @@ class Adaptable {
|
|
|
3091
3093
|
}
|
|
3092
3094
|
return true;
|
|
3093
3095
|
}
|
|
3094
|
-
const
|
|
3096
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3095
3097
|
oldValue: params.oldValue,
|
|
3096
3098
|
newValue: params.newValue,
|
|
3097
3099
|
column: this.api.columnApi.getColumnFromId(params.column.getColId()),
|
|
@@ -3099,15 +3101,15 @@ class Adaptable {
|
|
|
3099
3101
|
rowNode: params.node,
|
|
3100
3102
|
trigger: 'edit',
|
|
3101
3103
|
});
|
|
3102
|
-
if (
|
|
3104
|
+
if (cellDataChangedInfo.oldValue === cellDataChangedInfo.newValue) {
|
|
3103
3105
|
return true;
|
|
3104
3106
|
}
|
|
3105
|
-
if (!this.ValidationService.performValidation(
|
|
3107
|
+
if (!this.ValidationService.performValidation(cellDataChangedInfo)) {
|
|
3106
3108
|
return false;
|
|
3107
3109
|
}
|
|
3108
3110
|
const onServerValidationCompleted = () => { };
|
|
3109
3111
|
if ((_a = this.adaptableOptions.editOptions) === null || _a === void 0 ? void 0 : _a.validateOnServer) {
|
|
3110
|
-
this.ValidationService.performServerValidation(
|
|
3112
|
+
this.ValidationService.performServerValidation(cellDataChangedInfo, {
|
|
3111
3113
|
onServerValidationCompleted,
|
|
3112
3114
|
})();
|
|
3113
3115
|
}
|
|
@@ -3176,13 +3178,13 @@ class Adaptable {
|
|
|
3176
3178
|
return;
|
|
3177
3179
|
}
|
|
3178
3180
|
// rowNode = this.getRowNodeForPrimaryKey(primaryKeyValue);
|
|
3179
|
-
let
|
|
3181
|
+
let cellDataChangedInfos = [];
|
|
3180
3182
|
Object.keys(oldData).forEach((key) => {
|
|
3181
3183
|
if (this.api.columnApi.doesColumnExist(key)) {
|
|
3182
3184
|
const oldValue = oldData[key];
|
|
3183
3185
|
const newValue = newData[key];
|
|
3184
3186
|
if (oldValue != newValue) {
|
|
3185
|
-
const
|
|
3187
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3186
3188
|
oldValue: oldValue,
|
|
3187
3189
|
newValue: newValue,
|
|
3188
3190
|
column: this.api.columnApi.getColumnFromId(key),
|
|
@@ -3190,14 +3192,14 @@ class Adaptable {
|
|
|
3190
3192
|
rowNode: rowNode,
|
|
3191
3193
|
trigger: 'tick',
|
|
3192
3194
|
});
|
|
3193
|
-
if (this.isUndoChange(
|
|
3194
|
-
|
|
3195
|
+
if (this.isUndoChange(cellDataChangedInfo)) {
|
|
3196
|
+
cellDataChangedInfo.trigger = 'undo';
|
|
3195
3197
|
}
|
|
3196
|
-
|
|
3198
|
+
cellDataChangedInfos.push(cellDataChangedInfo);
|
|
3197
3199
|
}
|
|
3198
3200
|
}
|
|
3199
3201
|
});
|
|
3200
|
-
this.performPostEditChecks(
|
|
3202
|
+
this.performPostEditChecks(cellDataChangedInfos);
|
|
3201
3203
|
}
|
|
3202
3204
|
onCellDataChanged({ rowNode, oldValue, newValue, colId, }) {
|
|
3203
3205
|
if (oldValue == newValue) {
|
|
@@ -3208,7 +3210,7 @@ class Adaptable {
|
|
|
3208
3210
|
return;
|
|
3209
3211
|
}
|
|
3210
3212
|
if (this.isGroupRowNode(rowNode)) {
|
|
3211
|
-
const
|
|
3213
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3212
3214
|
oldValue: oldValue,
|
|
3213
3215
|
newValue: newValue,
|
|
3214
3216
|
column: abColumn,
|
|
@@ -3220,14 +3222,14 @@ class Adaptable {
|
|
|
3220
3222
|
rowNode: rowNode,
|
|
3221
3223
|
trigger: 'aggChange',
|
|
3222
3224
|
});
|
|
3223
|
-
this.DataService.CreateDataChangedEvent(
|
|
3225
|
+
this.DataService.CreateDataChangedEvent(cellDataChangedInfo);
|
|
3224
3226
|
return;
|
|
3225
3227
|
}
|
|
3226
3228
|
const primaryKeyValue = this.getPrimaryKeyValueFromRowNode(rowNode);
|
|
3227
3229
|
if (!primaryKeyValue) {
|
|
3228
3230
|
return;
|
|
3229
3231
|
}
|
|
3230
|
-
const
|
|
3232
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3231
3233
|
oldValue: oldValue,
|
|
3232
3234
|
newValue: newValue,
|
|
3233
3235
|
column: abColumn,
|
|
@@ -3235,10 +3237,10 @@ class Adaptable {
|
|
|
3235
3237
|
rowNode: rowNode,
|
|
3236
3238
|
trigger: 'edit',
|
|
3237
3239
|
});
|
|
3238
|
-
if (this.isUndoChange(
|
|
3239
|
-
|
|
3240
|
+
if (this.isUndoChange(cellDataChangedInfo)) {
|
|
3241
|
+
cellDataChangedInfo.trigger = 'undo';
|
|
3240
3242
|
}
|
|
3241
|
-
this.performPostEditChecks([
|
|
3243
|
+
this.performPostEditChecks([cellDataChangedInfo]);
|
|
3242
3244
|
}
|
|
3243
3245
|
isUndoChange(dataChange) {
|
|
3244
3246
|
// check if this is not a reverted change
|
|
@@ -3248,20 +3250,20 @@ class Adaptable {
|
|
|
3248
3250
|
/**
|
|
3249
3251
|
* There are a few things that we need to do AFTER we edit a cell and it makes sense to put them in one place
|
|
3250
3252
|
*/
|
|
3251
|
-
performPostEditChecks(
|
|
3252
|
-
const firstInfo =
|
|
3253
|
+
performPostEditChecks(cellDataChangedInfos) {
|
|
3254
|
+
const firstInfo = cellDataChangedInfos[0];
|
|
3253
3255
|
if (!firstInfo || !firstInfo.rowNode) {
|
|
3254
3256
|
return;
|
|
3255
3257
|
}
|
|
3256
|
-
|
|
3257
|
-
if (
|
|
3258
|
-
LoggingHelper_1.LogAdaptableInfo(`Undo data change: PK(${
|
|
3258
|
+
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3259
|
+
if (cellDataChangedInfo.trigger === 'undo') {
|
|
3260
|
+
LoggingHelper_1.LogAdaptableInfo(`Undo data change: PK(${cellDataChangedInfo.primaryKeyValue}) Col(${cellDataChangedInfo.column}) RevertedValue(${cellDataChangedInfo.oldValue}) OriginalValue(${cellDataChangedInfo.newValue})`);
|
|
3259
3261
|
}
|
|
3260
|
-
if (
|
|
3261
|
-
this.checkChangedCellCurrentlySelected(
|
|
3262
|
-
this.api.freeTextColumnApi.checkFreeTextColumnForDataChange(
|
|
3262
|
+
if (cellDataChangedInfo.trigger === 'edit' || cellDataChangedInfo.trigger === 'undo') {
|
|
3263
|
+
this.checkChangedCellCurrentlySelected(cellDataChangedInfo);
|
|
3264
|
+
this.api.freeTextColumnApi.checkFreeTextColumnForDataChange(cellDataChangedInfo);
|
|
3263
3265
|
}
|
|
3264
|
-
this.DataService.CreateDataChangedEvent(
|
|
3266
|
+
this.DataService.CreateDataChangedEvent(cellDataChangedInfo);
|
|
3265
3267
|
});
|
|
3266
3268
|
// if node is visible then check if need to refresh other columns / whole row if the updating column is:
|
|
3267
3269
|
// 1. referenced in Conditional Styles that have Expressions (refreshing whole row if Scope is All)
|
|
@@ -3271,12 +3273,12 @@ class Adaptable {
|
|
|
3271
3273
|
wholeRow: false,
|
|
3272
3274
|
columnIds: new Set(),
|
|
3273
3275
|
};
|
|
3274
|
-
this.getExpressionStylesChanges(dataChangedScope,
|
|
3276
|
+
this.getExpressionStylesChanges(dataChangedScope, cellDataChangedInfos);
|
|
3275
3277
|
if (dataChangedScope.wholeRow) {
|
|
3276
3278
|
this.redrawRow(firstInfo.rowNode);
|
|
3277
3279
|
}
|
|
3278
3280
|
else {
|
|
3279
|
-
this.getFormatColumnComparisonChanges(dataChangedScope,
|
|
3281
|
+
this.getFormatColumnComparisonChanges(dataChangedScope, cellDataChangedInfos);
|
|
3280
3282
|
if (dataChangedScope.columnIds.size > 0) {
|
|
3281
3283
|
this.refreshCells([firstInfo.rowNode], Array.from(dataChangedScope.columnIds.values()), true);
|
|
3282
3284
|
}
|
|
@@ -3284,17 +3286,17 @@ class Adaptable {
|
|
|
3284
3286
|
}
|
|
3285
3287
|
firstInfo.trigger == 'tick' ? this.filterOnTickingDataChange() : this.filterOnEditDataChange();
|
|
3286
3288
|
}
|
|
3287
|
-
getExpressionStylesChanges(dataChangedScope,
|
|
3289
|
+
getExpressionStylesChanges(dataChangedScope, cellDataChangedInfos) {
|
|
3288
3290
|
const stylesWithExpression = this.api.conditionalStyleApi.getConditionalStylesWithExpression();
|
|
3289
3291
|
if (ArrayExtensions_1.ArrayExtensions.IsNullOrEmpty(stylesWithExpression)) {
|
|
3290
3292
|
return;
|
|
3291
3293
|
}
|
|
3292
|
-
|
|
3294
|
+
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3293
3295
|
if (!dataChangedScope.wholeRow) {
|
|
3294
3296
|
stylesWithExpression.forEach((conditionalStyle) => {
|
|
3295
3297
|
if (!dataChangedScope.wholeRow) {
|
|
3296
3298
|
const columnIds = this.api.queryLanguageApi.getColumnsFromExpression(conditionalStyle.Rule.BooleanExpression);
|
|
3297
|
-
if (columnIds.includes(
|
|
3299
|
+
if (columnIds.includes(cellDataChangedInfo.column.columnId)) {
|
|
3298
3300
|
if (this.api.scopeApi.scopeIsAll(conditionalStyle.Scope)) {
|
|
3299
3301
|
dataChangedScope.wholeRow = true;
|
|
3300
3302
|
return;
|
|
@@ -3313,14 +3315,14 @@ class Adaptable {
|
|
|
3313
3315
|
}
|
|
3314
3316
|
});
|
|
3315
3317
|
}
|
|
3316
|
-
getFormatColumnComparisonChanges(dataChangedScope,
|
|
3318
|
+
getFormatColumnComparisonChanges(dataChangedScope, cellDataChangedInfos) {
|
|
3317
3319
|
this.api.formatColumnApi.getAllFormatColumn().forEach((fc) => {
|
|
3318
3320
|
let columnComparision = this.api.formatColumnApi.getColumnComparisonForFormatColumn(fc);
|
|
3319
3321
|
if (columnComparision) {
|
|
3320
3322
|
let affectedColumnIds = this.api.formatColumnApi.getColumnIdsFromColumnComparison(columnComparision);
|
|
3321
3323
|
if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(affectedColumnIds)) {
|
|
3322
|
-
|
|
3323
|
-
if (affectedColumnIds.includes(
|
|
3324
|
+
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3325
|
+
if (affectedColumnIds.includes(cellDataChangedInfo.column.columnId)) {
|
|
3324
3326
|
this.api.scopeApi
|
|
3325
3327
|
.getColumnsForScope(fc.Scope)
|
|
3326
3328
|
.map((c) => c.columnId)
|
|
@@ -3333,18 +3335,18 @@ class Adaptable {
|
|
|
3333
3335
|
}
|
|
3334
3336
|
});
|
|
3335
3337
|
}
|
|
3336
|
-
checkChangedCellCurrentlySelected(
|
|
3338
|
+
checkChangedCellCurrentlySelected(cellDataChangedInfo) {
|
|
3337
3339
|
let selectedCellInfo = this.api.gridApi.getSelectedCellInfo();
|
|
3338
3340
|
if (selectedCellInfo && ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(selectedCellInfo.gridCells)) {
|
|
3339
|
-
let matchingCell = selectedCellInfo.gridCells.find((gc) => gc.primaryKeyValue ==
|
|
3340
|
-
gc.column ==
|
|
3341
|
+
let matchingCell = selectedCellInfo.gridCells.find((gc) => gc.primaryKeyValue == cellDataChangedInfo.primaryKeyValue &&
|
|
3342
|
+
gc.column == cellDataChangedInfo.column);
|
|
3341
3343
|
if (matchingCell) {
|
|
3342
3344
|
this.setSelectedCells();
|
|
3343
3345
|
}
|
|
3344
3346
|
}
|
|
3345
3347
|
let selectedRowInfo = this.api.gridApi.getSelectedRowInfo();
|
|
3346
3348
|
if (selectedRowInfo && ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(selectedRowInfo.gridRows)) {
|
|
3347
|
-
let matchingRow = selectedRowInfo.gridRows.find((gr) => gr.primaryKeyValue ==
|
|
3349
|
+
let matchingRow = selectedRowInfo.gridRows.find((gr) => gr.primaryKeyValue == cellDataChangedInfo.primaryKeyValue);
|
|
3348
3350
|
if (matchingRow) {
|
|
3349
3351
|
this.setSelectedRows();
|
|
3350
3352
|
}
|
|
@@ -1000,6 +1000,40 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
1000
1000
|
isOptional: boolean;
|
|
1001
1001
|
})[];
|
|
1002
1002
|
};
|
|
1003
|
+
CellDataChangedInfo: {
|
|
1004
|
+
name: string;
|
|
1005
|
+
kind: string;
|
|
1006
|
+
description: string;
|
|
1007
|
+
properties: ({
|
|
1008
|
+
name: string;
|
|
1009
|
+
kind: string;
|
|
1010
|
+
description: string;
|
|
1011
|
+
uiLabel: string;
|
|
1012
|
+
reference?: undefined;
|
|
1013
|
+
isOptional?: undefined;
|
|
1014
|
+
} | {
|
|
1015
|
+
name: string;
|
|
1016
|
+
kind: string;
|
|
1017
|
+
description: string;
|
|
1018
|
+
uiLabel: string;
|
|
1019
|
+
reference: string;
|
|
1020
|
+
isOptional?: undefined;
|
|
1021
|
+
} | {
|
|
1022
|
+
name: string;
|
|
1023
|
+
kind: string;
|
|
1024
|
+
description: string;
|
|
1025
|
+
uiLabel: string;
|
|
1026
|
+
isOptional: boolean;
|
|
1027
|
+
reference?: undefined;
|
|
1028
|
+
} | {
|
|
1029
|
+
name: string;
|
|
1030
|
+
kind: string;
|
|
1031
|
+
description: string;
|
|
1032
|
+
uiLabel: string;
|
|
1033
|
+
isOptional: boolean;
|
|
1034
|
+
reference: string;
|
|
1035
|
+
})[];
|
|
1036
|
+
};
|
|
1003
1037
|
CellHighlightInfo: {
|
|
1004
1038
|
name: string;
|
|
1005
1039
|
kind: string;
|
|
@@ -1595,40 +1629,6 @@ export declare const ADAPTABLE_METAMODEL: {
|
|
|
1595
1629
|
uiLabel: string;
|
|
1596
1630
|
}[];
|
|
1597
1631
|
};
|
|
1598
|
-
DataChangedInfo: {
|
|
1599
|
-
name: string;
|
|
1600
|
-
kind: string;
|
|
1601
|
-
description: string;
|
|
1602
|
-
properties: ({
|
|
1603
|
-
name: string;
|
|
1604
|
-
kind: string;
|
|
1605
|
-
description: string;
|
|
1606
|
-
uiLabel: string;
|
|
1607
|
-
reference?: undefined;
|
|
1608
|
-
isOptional?: undefined;
|
|
1609
|
-
} | {
|
|
1610
|
-
name: string;
|
|
1611
|
-
kind: string;
|
|
1612
|
-
description: string;
|
|
1613
|
-
uiLabel: string;
|
|
1614
|
-
reference: string;
|
|
1615
|
-
isOptional?: undefined;
|
|
1616
|
-
} | {
|
|
1617
|
-
name: string;
|
|
1618
|
-
kind: string;
|
|
1619
|
-
description: string;
|
|
1620
|
-
uiLabel: string;
|
|
1621
|
-
isOptional: boolean;
|
|
1622
|
-
reference?: undefined;
|
|
1623
|
-
} | {
|
|
1624
|
-
name: string;
|
|
1625
|
-
kind: string;
|
|
1626
|
-
description: string;
|
|
1627
|
-
uiLabel: string;
|
|
1628
|
-
isOptional: boolean;
|
|
1629
|
-
reference: string;
|
|
1630
|
-
})[];
|
|
1631
|
-
};
|
|
1632
1632
|
DataChangeHistoryApi: {
|
|
1633
1633
|
name: string;
|
|
1634
1634
|
kind: string;
|