@adaptabletools/adaptable 11.1.1-canary.0 → 11.1.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/README.md +6 -4
- package/agGrid.d.ts +2 -2
- package/base.css +4 -6
- package/bundle.cjs.js +67 -67
- package/index.css +4 -6
- package/package.json +2 -2
- 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/AdaptableOptions/UserInterfaceOptions.d.ts +8 -12
- 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/EventApiImpl.js +2 -1
- 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/Implementation/UserInterfaceApiImpl.js +3 -1
- package/src/Api/InternalApi.d.ts +2 -2
- package/src/Api/QueryLanguageApi.d.ts +6 -6
- 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 +15 -15
- 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/Constants/DocumentationLinkConstants.js +1 -1
- package/src/Utilities/Emitter.d.ts +1 -1
- package/src/Utilities/Emitter.js +3 -6
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +2 -2
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +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/ActionColumnRenderer.d.ts +1 -6
- package/src/agGrid/ActionColumnRenderer.js +50 -59
- package/src/agGrid/Adaptable.d.ts +3 -2
- package/src/agGrid/Adaptable.js +97 -59
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -0
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +16 -2
- package/src/metamodel/adaptable.metamodel.d.ts +34 -34
- package/src/metamodel/adaptable.metamodel.js +77 -77
- package/src/types.d.ts +7 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/LICENSE.md +0 -264
|
@@ -1,85 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActionColumnRenderer =
|
|
3
|
+
exports.ActionColumnRenderer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButton"));
|
|
6
6
|
const react_dom_1 = require("react-dom");
|
|
7
7
|
const React = tslib_1.__importStar(require("react"));
|
|
8
|
-
|
|
9
|
-
init(params) {
|
|
10
|
-
this.eGui = document.createElement('div');
|
|
11
|
-
this.eGui.classList.add('custom-tooltip');
|
|
12
|
-
let { field, lastValidation, validationFailedMsg } = params.value;
|
|
13
|
-
this.eGui.innerHTML = `
|
|
14
|
-
<div class="validation-msg">
|
|
15
|
-
FIELD-${field.toUpperCase()} - invalid value:
|
|
16
|
-
"<span class="invalid-value"> ${lastValidation} </span>",
|
|
17
|
-
${validationFailedMsg}
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
}
|
|
21
|
-
getGui() {
|
|
22
|
-
return this.eGui;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.CustomTooltip = CustomTooltip;
|
|
8
|
+
const uuid_1 = require("../components/utils/uuid");
|
|
26
9
|
class ActionColumnRenderer {
|
|
27
10
|
// gets called once before the renderer is used
|
|
28
11
|
init(params) {
|
|
29
12
|
var _a;
|
|
30
13
|
const adaptable = params.api.__adaptable;
|
|
31
|
-
|
|
14
|
+
const actionCol = (_a = adaptable.api.userInterfaceApi
|
|
32
15
|
.getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((ac) => ac.columnId == params.colDef.colId);
|
|
33
|
-
if (actionCol) {
|
|
16
|
+
if (actionCol && actionCol.actionColumnButton) {
|
|
17
|
+
let actionButtons = Array.isArray(actionCol.actionColumnButton)
|
|
18
|
+
? actionCol.actionColumnButton
|
|
19
|
+
: [actionCol.actionColumnButton];
|
|
20
|
+
if (!actionButtons.length) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// actionButtons don't have IDs, so we need to generate them to be used later as a react component key
|
|
24
|
+
actionButtons = actionButtons.map((actionButton) => (Object.assign(Object.assign({}, actionButton), { Uuid: uuid_1.createUuid() })));
|
|
34
25
|
// create the cell
|
|
35
26
|
this.eGui = document.createElement('div');
|
|
36
27
|
this.eGui.className = 'ab-ActionColumn';
|
|
37
|
-
let pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
|
|
38
|
-
let button = actionCol.actionColumnButton;
|
|
39
|
-
let context = {
|
|
40
|
-
actionColumn: actionCol,
|
|
41
|
-
primaryKeyValue: pkValue,
|
|
42
|
-
rowNode: params.node,
|
|
43
|
-
adaptableApi: adaptable.api,
|
|
44
|
-
};
|
|
45
28
|
// if its a group node then only show if set to do so
|
|
46
29
|
if (adaptable.api.gridApi.isGroupRowNode(params.node) && !actionCol.includeGroupedRows) {
|
|
47
30
|
this.eGui.innerHTML = '';
|
|
48
31
|
return;
|
|
49
32
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
33
|
+
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(params.node);
|
|
34
|
+
const buttonContext = {
|
|
35
|
+
actionColumn: actionCol,
|
|
36
|
+
primaryKeyValue: pkValue,
|
|
37
|
+
rowNode: params.node,
|
|
38
|
+
adaptableApi: adaptable.api,
|
|
39
|
+
};
|
|
40
|
+
const renderActionButtons = (buttons, adaptableApi, context) => {
|
|
41
|
+
return (React.createElement(React.Fragment, null, buttons.map((button) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
if (button.hidden && button.hidden(button, context)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const defaultIconProps = {
|
|
47
|
+
style: {
|
|
48
|
+
height: 15,
|
|
49
|
+
width: 15,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const iconProps = button.icon && Object.assign({}, defaultIconProps, button.icon);
|
|
53
|
+
const buttonStyle = adaptableApi.internalApi.getStyleForButton(button, context);
|
|
54
|
+
const buttonLabel = adaptableApi.internalApi.getLabelForButton(button, context);
|
|
55
|
+
const buttonTooltip = adaptableApi.internalApi.getTooltipForButton(button, context);
|
|
56
|
+
const handleClick = () => {
|
|
57
|
+
button.onClick(button, context);
|
|
58
|
+
// Timeout to let any updates to be done before re-rendering the component
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
// when called again it triggers a re-render
|
|
61
|
+
// https:reactjs.org/docs/react-dom.html#render
|
|
62
|
+
doRender();
|
|
63
|
+
}, 16);
|
|
64
|
+
};
|
|
65
|
+
const disabled = button.disabled && button.disabled(button, context);
|
|
66
|
+
return (React.createElement(SimpleButton_1.default, { key: button.Uuid, variant: (_a = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.variant) !== null && _a !== void 0 ? _a : 'text', disabled: disabled, tooltip: buttonTooltip, tone: (_b = buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.tone) !== null && _b !== void 0 ? _b : 'none', onClick: handleClick, className: buttonStyle === null || buttonStyle === void 0 ? void 0 : buttonStyle.className, accessLevel: 'Full' },
|
|
67
|
+
button.icon ? React.createElement("img", Object.assign({}, iconProps)) : null,
|
|
68
|
+
buttonLabel));
|
|
69
|
+
})));
|
|
79
70
|
};
|
|
80
71
|
const eGui = this.eGui;
|
|
81
72
|
function doRender() {
|
|
82
|
-
react_dom_1.render(
|
|
73
|
+
react_dom_1.render(renderActionButtons(actionButtons, adaptable.api, buttonContext), eGui);
|
|
83
74
|
}
|
|
84
75
|
this.render = doRender;
|
|
85
76
|
doRender();
|
|
@@ -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';
|
|
@@ -74,6 +74,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
74
74
|
private _id;
|
|
75
75
|
private currentColumnDefs?;
|
|
76
76
|
private rowListeners;
|
|
77
|
+
private isCheckedColumnDataType;
|
|
77
78
|
_on: (eventName: string, callback: EmitterCallback) => (() => void);
|
|
78
79
|
_onIncludeFired: (eventName: string, callback: EmitterCallback) => (() => void);
|
|
79
80
|
_emit: (eventName: string, data?: any) => Promise<any>;
|
|
@@ -149,7 +150,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
149
150
|
private updateLayoutFromGrid;
|
|
150
151
|
setSelectedCells(): SelectedCellInfo | undefined;
|
|
151
152
|
setSelectedRows(): SelectedRowInfo | undefined;
|
|
152
|
-
setValue(
|
|
153
|
+
setValue(cellDataChangedInfo: CellDataChangedInfo): void;
|
|
153
154
|
cancelEdit(): void;
|
|
154
155
|
isCellEditable(rowNode: RowNode, column: Column): boolean;
|
|
155
156
|
getDistinctValuesForColumn(column: AdaptableColumn, visibleRowsOnly: boolean, skipRowNode?: RowNode, permittedValues?: any[]): GridCell[];
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -100,6 +100,7 @@ class Adaptable {
|
|
|
100
100
|
constructor() {
|
|
101
101
|
this.colDefPropertyCache = new Map();
|
|
102
102
|
this.gridOptionsPropertyCache = new Map();
|
|
103
|
+
this.isCheckedColumnDataType = false;
|
|
103
104
|
// only for our private / internal events used within Adaptable
|
|
104
105
|
// public events are emitted through the EventApi
|
|
105
106
|
this._on = (eventName, callback) => {
|
|
@@ -201,7 +202,6 @@ class Adaptable {
|
|
|
201
202
|
this.getGroupAndColumnDefs = () => {
|
|
202
203
|
const colDefs = [].concat(this.currentColumnDefs || this.gridOptions.columnDefs);
|
|
203
204
|
return colDefs;
|
|
204
|
-
// return this.gridOptions.columnApi.getAllColumns().map((c) => c.getColDef());
|
|
205
205
|
};
|
|
206
206
|
this.getColumnDefsWithCorrectVisibility = () => {
|
|
207
207
|
const visibleColIds = this.api.layoutApi.getCurrentVisibleColumnIdsMap();
|
|
@@ -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
|
}
|
|
@@ -2061,20 +2063,54 @@ class Adaptable {
|
|
|
2061
2063
|
});
|
|
2062
2064
|
}
|
|
2063
2065
|
updateColDefsForSpecialColumns() {
|
|
2066
|
+
const allColDefs = this.getGroupAndColumnDefs();
|
|
2064
2067
|
const specialColDefs = this.getColDefsForSpecialColumns();
|
|
2065
|
-
const
|
|
2068
|
+
const isSpecialColDef = (colDef) => {
|
|
2066
2069
|
const { type } = colDef;
|
|
2067
2070
|
if (type === GeneralConstants_1.AB_SPECIAL_COLUMN || (Array.isArray(type) && type.includes(GeneralConstants_1.AB_SPECIAL_COLUMN))) {
|
|
2068
|
-
return
|
|
2071
|
+
return true;
|
|
2069
2072
|
}
|
|
2070
|
-
return
|
|
2073
|
+
return false;
|
|
2074
|
+
};
|
|
2075
|
+
const isColGroupDef = (columnDefinition) => {
|
|
2076
|
+
// @ts-ignore
|
|
2077
|
+
return columnDefinition['children'] != null;
|
|
2078
|
+
};
|
|
2079
|
+
const processedSpecialColDefIds = [];
|
|
2080
|
+
const mapColDefs = (colDefs) => {
|
|
2081
|
+
return colDefs.map((colDef) => {
|
|
2082
|
+
if (isColGroupDef(colDef)) {
|
|
2083
|
+
// if it's a group column, recursively map its children
|
|
2084
|
+
colDef.children = mapColDefs(colDef.children);
|
|
2085
|
+
return colDef;
|
|
2086
|
+
}
|
|
2087
|
+
else {
|
|
2088
|
+
if (!isSpecialColDef(colDef)) {
|
|
2089
|
+
// if it's not a special column, return it as is
|
|
2090
|
+
return colDef;
|
|
2091
|
+
}
|
|
2092
|
+
const newlyCreatedSpecialColDef = specialColDefs.find((specialColDef) => specialColDef.colId === colDef.colId);
|
|
2093
|
+
if (newlyCreatedSpecialColDef) {
|
|
2094
|
+
// if it's a special column and we have a special col def for it, return the special col def
|
|
2095
|
+
processedSpecialColDefIds.push(colDef.colId);
|
|
2096
|
+
return newlyCreatedSpecialColDef;
|
|
2097
|
+
}
|
|
2098
|
+
else {
|
|
2099
|
+
// otherwise, return the original col def
|
|
2100
|
+
return colDef;
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
});
|
|
2071
2104
|
};
|
|
2072
|
-
|
|
2073
|
-
//
|
|
2074
|
-
//
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2105
|
+
const resultColDefs = mapColDefs(allColDefs);
|
|
2106
|
+
// check if there are any special colDefs that were not processed
|
|
2107
|
+
// in that case, add them to the end of the colDefs
|
|
2108
|
+
specialColDefs.forEach((specialColDef) => {
|
|
2109
|
+
if (!processedSpecialColDefIds.includes(specialColDef.colId)) {
|
|
2110
|
+
resultColDefs.push(specialColDef);
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
this.safeSetColDefs(resultColDefs);
|
|
2078
2114
|
this.setLayout();
|
|
2079
2115
|
}
|
|
2080
2116
|
cleanupFloatingFilters_WORKAROUND() {
|
|
@@ -3091,7 +3127,7 @@ class Adaptable {
|
|
|
3091
3127
|
}
|
|
3092
3128
|
return true;
|
|
3093
3129
|
}
|
|
3094
|
-
const
|
|
3130
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3095
3131
|
oldValue: params.oldValue,
|
|
3096
3132
|
newValue: params.newValue,
|
|
3097
3133
|
column: this.api.columnApi.getColumnFromId(params.column.getColId()),
|
|
@@ -3099,15 +3135,15 @@ class Adaptable {
|
|
|
3099
3135
|
rowNode: params.node,
|
|
3100
3136
|
trigger: 'edit',
|
|
3101
3137
|
});
|
|
3102
|
-
if (
|
|
3138
|
+
if (cellDataChangedInfo.oldValue === cellDataChangedInfo.newValue) {
|
|
3103
3139
|
return true;
|
|
3104
3140
|
}
|
|
3105
|
-
if (!this.ValidationService.performValidation(
|
|
3141
|
+
if (!this.ValidationService.performValidation(cellDataChangedInfo)) {
|
|
3106
3142
|
return false;
|
|
3107
3143
|
}
|
|
3108
3144
|
const onServerValidationCompleted = () => { };
|
|
3109
3145
|
if ((_a = this.adaptableOptions.editOptions) === null || _a === void 0 ? void 0 : _a.validateOnServer) {
|
|
3110
|
-
this.ValidationService.performServerValidation(
|
|
3146
|
+
this.ValidationService.performServerValidation(cellDataChangedInfo, {
|
|
3111
3147
|
onServerValidationCompleted,
|
|
3112
3148
|
})();
|
|
3113
3149
|
}
|
|
@@ -3176,13 +3212,13 @@ class Adaptable {
|
|
|
3176
3212
|
return;
|
|
3177
3213
|
}
|
|
3178
3214
|
// rowNode = this.getRowNodeForPrimaryKey(primaryKeyValue);
|
|
3179
|
-
let
|
|
3215
|
+
let cellDataChangedInfos = [];
|
|
3180
3216
|
Object.keys(oldData).forEach((key) => {
|
|
3181
3217
|
if (this.api.columnApi.doesColumnExist(key)) {
|
|
3182
3218
|
const oldValue = oldData[key];
|
|
3183
3219
|
const newValue = newData[key];
|
|
3184
3220
|
if (oldValue != newValue) {
|
|
3185
|
-
const
|
|
3221
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3186
3222
|
oldValue: oldValue,
|
|
3187
3223
|
newValue: newValue,
|
|
3188
3224
|
column: this.api.columnApi.getColumnFromId(key),
|
|
@@ -3190,14 +3226,14 @@ class Adaptable {
|
|
|
3190
3226
|
rowNode: rowNode,
|
|
3191
3227
|
trigger: 'tick',
|
|
3192
3228
|
});
|
|
3193
|
-
if (this.isUndoChange(
|
|
3194
|
-
|
|
3229
|
+
if (this.isUndoChange(cellDataChangedInfo)) {
|
|
3230
|
+
cellDataChangedInfo.trigger = 'undo';
|
|
3195
3231
|
}
|
|
3196
|
-
|
|
3232
|
+
cellDataChangedInfos.push(cellDataChangedInfo);
|
|
3197
3233
|
}
|
|
3198
3234
|
}
|
|
3199
3235
|
});
|
|
3200
|
-
this.performPostEditChecks(
|
|
3236
|
+
this.performPostEditChecks(cellDataChangedInfos);
|
|
3201
3237
|
}
|
|
3202
3238
|
onCellDataChanged({ rowNode, oldValue, newValue, colId, }) {
|
|
3203
3239
|
if (oldValue == newValue) {
|
|
@@ -3208,7 +3244,7 @@ class Adaptable {
|
|
|
3208
3244
|
return;
|
|
3209
3245
|
}
|
|
3210
3246
|
if (this.isGroupRowNode(rowNode)) {
|
|
3211
|
-
const
|
|
3247
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3212
3248
|
oldValue: oldValue,
|
|
3213
3249
|
newValue: newValue,
|
|
3214
3250
|
column: abColumn,
|
|
@@ -3220,14 +3256,14 @@ class Adaptable {
|
|
|
3220
3256
|
rowNode: rowNode,
|
|
3221
3257
|
trigger: 'aggChange',
|
|
3222
3258
|
});
|
|
3223
|
-
this.DataService.CreateDataChangedEvent(
|
|
3259
|
+
this.DataService.CreateDataChangedEvent(cellDataChangedInfo);
|
|
3224
3260
|
return;
|
|
3225
3261
|
}
|
|
3226
3262
|
const primaryKeyValue = this.getPrimaryKeyValueFromRowNode(rowNode);
|
|
3227
3263
|
if (!primaryKeyValue) {
|
|
3228
3264
|
return;
|
|
3229
3265
|
}
|
|
3230
|
-
const
|
|
3266
|
+
const cellDataChangedInfo = this.api.internalApi.buildDataChangedInfo({
|
|
3231
3267
|
oldValue: oldValue,
|
|
3232
3268
|
newValue: newValue,
|
|
3233
3269
|
column: abColumn,
|
|
@@ -3235,10 +3271,10 @@ class Adaptable {
|
|
|
3235
3271
|
rowNode: rowNode,
|
|
3236
3272
|
trigger: 'edit',
|
|
3237
3273
|
});
|
|
3238
|
-
if (this.isUndoChange(
|
|
3239
|
-
|
|
3274
|
+
if (this.isUndoChange(cellDataChangedInfo)) {
|
|
3275
|
+
cellDataChangedInfo.trigger = 'undo';
|
|
3240
3276
|
}
|
|
3241
|
-
this.performPostEditChecks([
|
|
3277
|
+
this.performPostEditChecks([cellDataChangedInfo]);
|
|
3242
3278
|
}
|
|
3243
3279
|
isUndoChange(dataChange) {
|
|
3244
3280
|
// check if this is not a reverted change
|
|
@@ -3248,20 +3284,20 @@ class Adaptable {
|
|
|
3248
3284
|
/**
|
|
3249
3285
|
* 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
3286
|
*/
|
|
3251
|
-
performPostEditChecks(
|
|
3252
|
-
const firstInfo =
|
|
3287
|
+
performPostEditChecks(cellDataChangedInfos) {
|
|
3288
|
+
const firstInfo = cellDataChangedInfos[0];
|
|
3253
3289
|
if (!firstInfo || !firstInfo.rowNode) {
|
|
3254
3290
|
return;
|
|
3255
3291
|
}
|
|
3256
|
-
|
|
3257
|
-
if (
|
|
3258
|
-
LoggingHelper_1.LogAdaptableInfo(`Undo data change: PK(${
|
|
3292
|
+
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3293
|
+
if (cellDataChangedInfo.trigger === 'undo') {
|
|
3294
|
+
LoggingHelper_1.LogAdaptableInfo(`Undo data change: PK(${cellDataChangedInfo.primaryKeyValue}) Col(${cellDataChangedInfo.column}) RevertedValue(${cellDataChangedInfo.oldValue}) OriginalValue(${cellDataChangedInfo.newValue})`);
|
|
3259
3295
|
}
|
|
3260
|
-
if (
|
|
3261
|
-
this.checkChangedCellCurrentlySelected(
|
|
3262
|
-
this.api.freeTextColumnApi.checkFreeTextColumnForDataChange(
|
|
3296
|
+
if (cellDataChangedInfo.trigger === 'edit' || cellDataChangedInfo.trigger === 'undo') {
|
|
3297
|
+
this.checkChangedCellCurrentlySelected(cellDataChangedInfo);
|
|
3298
|
+
this.api.freeTextColumnApi.checkFreeTextColumnForDataChange(cellDataChangedInfo);
|
|
3263
3299
|
}
|
|
3264
|
-
this.DataService.CreateDataChangedEvent(
|
|
3300
|
+
this.DataService.CreateDataChangedEvent(cellDataChangedInfo);
|
|
3265
3301
|
});
|
|
3266
3302
|
// if node is visible then check if need to refresh other columns / whole row if the updating column is:
|
|
3267
3303
|
// 1. referenced in Conditional Styles that have Expressions (refreshing whole row if Scope is All)
|
|
@@ -3271,12 +3307,12 @@ class Adaptable {
|
|
|
3271
3307
|
wholeRow: false,
|
|
3272
3308
|
columnIds: new Set(),
|
|
3273
3309
|
};
|
|
3274
|
-
this.getExpressionStylesChanges(dataChangedScope,
|
|
3310
|
+
this.getExpressionStylesChanges(dataChangedScope, cellDataChangedInfos);
|
|
3275
3311
|
if (dataChangedScope.wholeRow) {
|
|
3276
3312
|
this.redrawRow(firstInfo.rowNode);
|
|
3277
3313
|
}
|
|
3278
3314
|
else {
|
|
3279
|
-
this.getFormatColumnComparisonChanges(dataChangedScope,
|
|
3315
|
+
this.getFormatColumnComparisonChanges(dataChangedScope, cellDataChangedInfos);
|
|
3280
3316
|
if (dataChangedScope.columnIds.size > 0) {
|
|
3281
3317
|
this.refreshCells([firstInfo.rowNode], Array.from(dataChangedScope.columnIds.values()), true);
|
|
3282
3318
|
}
|
|
@@ -3284,17 +3320,17 @@ class Adaptable {
|
|
|
3284
3320
|
}
|
|
3285
3321
|
firstInfo.trigger == 'tick' ? this.filterOnTickingDataChange() : this.filterOnEditDataChange();
|
|
3286
3322
|
}
|
|
3287
|
-
getExpressionStylesChanges(dataChangedScope,
|
|
3323
|
+
getExpressionStylesChanges(dataChangedScope, cellDataChangedInfos) {
|
|
3288
3324
|
const stylesWithExpression = this.api.conditionalStyleApi.getConditionalStylesWithExpression();
|
|
3289
3325
|
if (ArrayExtensions_1.ArrayExtensions.IsNullOrEmpty(stylesWithExpression)) {
|
|
3290
3326
|
return;
|
|
3291
3327
|
}
|
|
3292
|
-
|
|
3328
|
+
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3293
3329
|
if (!dataChangedScope.wholeRow) {
|
|
3294
3330
|
stylesWithExpression.forEach((conditionalStyle) => {
|
|
3295
3331
|
if (!dataChangedScope.wholeRow) {
|
|
3296
3332
|
const columnIds = this.api.queryLanguageApi.getColumnsFromExpression(conditionalStyle.Rule.BooleanExpression);
|
|
3297
|
-
if (columnIds.includes(
|
|
3333
|
+
if (columnIds.includes(cellDataChangedInfo.column.columnId)) {
|
|
3298
3334
|
if (this.api.scopeApi.scopeIsAll(conditionalStyle.Scope)) {
|
|
3299
3335
|
dataChangedScope.wholeRow = true;
|
|
3300
3336
|
return;
|
|
@@ -3313,14 +3349,14 @@ class Adaptable {
|
|
|
3313
3349
|
}
|
|
3314
3350
|
});
|
|
3315
3351
|
}
|
|
3316
|
-
getFormatColumnComparisonChanges(dataChangedScope,
|
|
3352
|
+
getFormatColumnComparisonChanges(dataChangedScope, cellDataChangedInfos) {
|
|
3317
3353
|
this.api.formatColumnApi.getAllFormatColumn().forEach((fc) => {
|
|
3318
3354
|
let columnComparision = this.api.formatColumnApi.getColumnComparisonForFormatColumn(fc);
|
|
3319
3355
|
if (columnComparision) {
|
|
3320
3356
|
let affectedColumnIds = this.api.formatColumnApi.getColumnIdsFromColumnComparison(columnComparision);
|
|
3321
3357
|
if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(affectedColumnIds)) {
|
|
3322
|
-
|
|
3323
|
-
if (affectedColumnIds.includes(
|
|
3358
|
+
cellDataChangedInfos.forEach((cellDataChangedInfo) => {
|
|
3359
|
+
if (affectedColumnIds.includes(cellDataChangedInfo.column.columnId)) {
|
|
3324
3360
|
this.api.scopeApi
|
|
3325
3361
|
.getColumnsForScope(fc.Scope)
|
|
3326
3362
|
.map((c) => c.columnId)
|
|
@@ -3333,18 +3369,18 @@ class Adaptable {
|
|
|
3333
3369
|
}
|
|
3334
3370
|
});
|
|
3335
3371
|
}
|
|
3336
|
-
checkChangedCellCurrentlySelected(
|
|
3372
|
+
checkChangedCellCurrentlySelected(cellDataChangedInfo) {
|
|
3337
3373
|
let selectedCellInfo = this.api.gridApi.getSelectedCellInfo();
|
|
3338
3374
|
if (selectedCellInfo && ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(selectedCellInfo.gridCells)) {
|
|
3339
|
-
let matchingCell = selectedCellInfo.gridCells.find((gc) => gc.primaryKeyValue ==
|
|
3340
|
-
gc.column ==
|
|
3375
|
+
let matchingCell = selectedCellInfo.gridCells.find((gc) => gc.primaryKeyValue == cellDataChangedInfo.primaryKeyValue &&
|
|
3376
|
+
gc.column == cellDataChangedInfo.column);
|
|
3341
3377
|
if (matchingCell) {
|
|
3342
3378
|
this.setSelectedCells();
|
|
3343
3379
|
}
|
|
3344
3380
|
}
|
|
3345
3381
|
let selectedRowInfo = this.api.gridApi.getSelectedRowInfo();
|
|
3346
3382
|
if (selectedRowInfo && ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(selectedRowInfo.gridRows)) {
|
|
3347
|
-
let matchingRow = selectedRowInfo.gridRows.find((gr) => gr.primaryKeyValue ==
|
|
3383
|
+
let matchingRow = selectedRowInfo.gridRows.find((gr) => gr.primaryKeyValue == cellDataChangedInfo.primaryKeyValue);
|
|
3348
3384
|
if (matchingRow) {
|
|
3349
3385
|
this.setSelectedRows();
|
|
3350
3386
|
}
|
|
@@ -3673,7 +3709,7 @@ class Adaptable {
|
|
|
3673
3709
|
updateColumnDataTypeIfRowDataIsEmpty() {
|
|
3674
3710
|
var _a, _b;
|
|
3675
3711
|
// gridOptions?.rowData is not updated when setting data via the api
|
|
3676
|
-
if (!((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
3712
|
+
if (!this.isCheckedColumnDataType && !((_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.rowData) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
3677
3713
|
// the columns dataType is based on the rawData, when type is not set on the column
|
|
3678
3714
|
// when data is loaded async, the dataType initially is dataType=unknown
|
|
3679
3715
|
// to fix this, we need to update the columnDefs when we data is loaded
|
|
@@ -3681,6 +3717,8 @@ class Adaptable {
|
|
|
3681
3717
|
// this influences the floating filter
|
|
3682
3718
|
// need to trigger header redraw, if not, the columnDef update is not picked-up
|
|
3683
3719
|
this.redrawHeader();
|
|
3720
|
+
// ensures the check is performed only once
|
|
3721
|
+
this.isCheckedColumnDataType = true;
|
|
3684
3722
|
}
|
|
3685
3723
|
}
|
|
3686
3724
|
runAdaptableComparerFunction(columnId, columnValues) {
|
|
@@ -40,7 +40,7 @@ class AdaptableNumberEditor {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
init(params) {
|
|
43
|
-
this.value = this.
|
|
43
|
+
this.value = this.getStartValue(params);
|
|
44
44
|
this.params = params;
|
|
45
45
|
this.columnId = params.column.getColId();
|
|
46
46
|
const { valueParser } = params.column.getColDef();
|
|
@@ -72,7 +72,7 @@ class AdaptableNumberEditor {
|
|
|
72
72
|
afterGuiAttached() {
|
|
73
73
|
var _a, _b;
|
|
74
74
|
const adaptable = this.params.api.__adaptable;
|
|
75
|
-
const defaultValue = this.
|
|
75
|
+
const defaultValue = this.value;
|
|
76
76
|
const editorElement = (React.createElement(InternalAdaptableNumberEditor_1.InternalAdaptableNumberEditor, { defaultValue: defaultValue, showClearButton: (_a = this.params.showClearButton) !== null && _a !== void 0 ? _a : true, emptyValue: (_b = this.params.emptyValue) !== null && _b !== void 0 ? _b : '', onValueChange: this.onValueChange, ref: (editor) => {
|
|
77
77
|
this.editor = editor;
|
|
78
78
|
editor === null || editor === void 0 ? void 0 : editor.focus();
|
|
@@ -92,8 +92,22 @@ class AdaptableNumberEditor {
|
|
|
92
92
|
destroy() {
|
|
93
93
|
react_dom_1.unmountComponentAtNode(this.el);
|
|
94
94
|
}
|
|
95
|
+
getStartValue(params) {
|
|
96
|
+
if (this.shouldClearExistingValue(params)) {
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
if (params.charPress && this.isValidChar(params.charPress)) {
|
|
100
|
+
return params.charPress;
|
|
101
|
+
}
|
|
102
|
+
return params.value;
|
|
103
|
+
}
|
|
95
104
|
shouldClearExistingValue(params) {
|
|
96
105
|
return params.eventKey === all_modules_1.KeyCode.BACKSPACE || params.eventKey === all_modules_1.KeyCode.DELETE;
|
|
97
106
|
}
|
|
107
|
+
isValidChar(char) {
|
|
108
|
+
// allow only digits
|
|
109
|
+
return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes(char);
|
|
110
|
+
// we do NOT allow key shortcuts for starting non-digits (minus sign, decimal separators) as the input[number] handling is very buggy and we would open a can of worms
|
|
111
|
+
}
|
|
98
112
|
}
|
|
99
113
|
exports.AdaptableNumberEditor = AdaptableNumberEditor;
|
|
@@ -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;
|