@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.
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
- package/src/AdaptableOptions/ActionRowOptions.d.ts +2 -2
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +2 -2
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +6 -2
- package/src/Api/ColumnApi.d.ts +14 -15
- package/src/Api/DataChangeHistoryApi.d.ts +5 -0
- package/src/Api/Events/GridSorted.d.ts +3 -3
- package/src/Api/GridApi.d.ts +53 -2
- package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
- package/src/Api/Implementation/ColumnApiImpl.js +13 -30
- package/src/Api/Implementation/DataChangeHistoryApiImpl.d.ts +2 -0
- package/src/Api/Implementation/DataChangeHistoryApiImpl.js +5 -0
- package/src/Api/Implementation/GridApiImpl.d.ts +11 -2
- package/src/Api/Implementation/GridApiImpl.js +105 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +1 -0
- package/src/Api/Implementation/UserInterfaceApiImpl.js +3 -0
- package/src/Api/Internal/ActionRowInternalApi.d.ts +1 -1
- package/src/Api/Internal/ActionRowInternalApi.js +10 -8
- package/src/Api/Internal/GridFilterInternalApi.js +4 -1
- package/src/Api/UserInterfaceApi.d.ts +6 -2
- package/src/Utilities/license/hashing.js +1 -1
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +1 -0
- package/src/agGrid/ActionColumnRenderer.d.ts +2 -0
- package/src/agGrid/ActionColumnRenderer.js +29 -3
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -1
- package/src/agGrid/AdaptableAgGrid.js +18 -5
- package/src/agGrid/AgGridAdapter.d.ts +1 -0
- package/src/agGrid/AgGridAdapter.js +12 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
- package/src/agGrid/AgGridColumnAdapter.js +24 -12
- package/src/agGrid/defaultAdaptableOptions.js +1 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +2 -2
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/agGrid/CheckboxRenderer.d.ts +0 -16
- package/src/agGrid/CheckboxRenderer.js +0 -89
|
@@ -2,6 +2,7 @@ import SimpleButton from '../components/SimpleButton';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useRerender } from '../components/utils/useRerender';
|
|
4
4
|
import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext';
|
|
5
|
+
import { LAYOUT_SELECT } from '../Redux/ActionsReducers/LayoutRedux';
|
|
5
6
|
const ActionButtons = (props) => {
|
|
6
7
|
const { buttons, adaptableApi, context, rerender } = props;
|
|
7
8
|
return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
|
|
@@ -65,6 +66,20 @@ export const ReactActionColumnRenderer = (props) => {
|
|
|
65
66
|
if (!shouldRender) {
|
|
66
67
|
return null;
|
|
67
68
|
}
|
|
69
|
+
// subscribe to the LayoutChange event and rerender on change
|
|
70
|
+
const unsubscribe = adaptable.api.eventApi.on('AdaptableStateChanged', (eventInfo) => {
|
|
71
|
+
if (eventInfo.actionName === LAYOUT_SELECT) {
|
|
72
|
+
if (eventInfo.oldState.Layout.CurrentLayout !== eventInfo.newState.Layout.CurrentLayout) {
|
|
73
|
+
rerender();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// unsubscribe on unmount
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
return () => {
|
|
80
|
+
unsubscribe();
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
68
83
|
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(props.node, props.api);
|
|
69
84
|
const buttonContext = Object.assign(Object.assign({ actionColumn, primaryKeyValue: pkValue, rowNode: props.node }, adaptable.api.internalApi.buildBaseContext()), { data: props.data });
|
|
70
85
|
return (React.createElement("div", { className: "ab-ActionColumn" },
|
|
@@ -83,6 +98,7 @@ export class ActionColumnRenderer {
|
|
|
83
98
|
if (!actionColumn || !actionButtons.length) {
|
|
84
99
|
return;
|
|
85
100
|
}
|
|
101
|
+
this.actionButtons = actionButtons;
|
|
86
102
|
// create the cell
|
|
87
103
|
this.eGui = document.createElement('div');
|
|
88
104
|
this.eGui.className = 'ab-ActionColumn';
|
|
@@ -114,13 +130,22 @@ export class ActionColumnRenderer {
|
|
|
114
130
|
const eGui = this.eGui;
|
|
115
131
|
const doRender = () => {
|
|
116
132
|
this.unmountReactRoot = adaptable.renderReactRoot(renderWithAdaptableContext(ActionButtons({
|
|
117
|
-
buttons: actionButtons,
|
|
133
|
+
buttons: this.actionButtons,
|
|
118
134
|
context: buttonContext,
|
|
119
135
|
rerender: doRender,
|
|
120
136
|
adaptableApi: adaptable.api,
|
|
121
137
|
}), adaptable), eGui);
|
|
122
138
|
};
|
|
123
139
|
this.render = doRender;
|
|
140
|
+
this.layoutSwitchUnsubscribe = adaptable.api.eventApi.on('AdaptableStateChanged', (eventInfo) => {
|
|
141
|
+
if (eventInfo.actionName === LAYOUT_SELECT) {
|
|
142
|
+
if (eventInfo.oldState.Layout.CurrentLayout !== eventInfo.newState.Layout.CurrentLayout) {
|
|
143
|
+
const { actionButtons: freshActionButtons } = adaptable.api.internalApi.getActionButtonsAndActionColumn(params.colDef);
|
|
144
|
+
this.actionButtons = freshActionButtons;
|
|
145
|
+
doRender();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
124
149
|
doRender();
|
|
125
150
|
}
|
|
126
151
|
// defined on init
|
|
@@ -138,8 +163,9 @@ export class ActionColumnRenderer {
|
|
|
138
163
|
}
|
|
139
164
|
// gets called when the cell is removed from the grid
|
|
140
165
|
destroy() {
|
|
141
|
-
var _a;
|
|
142
|
-
(_a = this.
|
|
166
|
+
var _a, _b;
|
|
167
|
+
(_a = this.layoutSwitchUnsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
168
|
+
(_b = this.unmountReactRoot) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
143
169
|
// do cleanup, remove event listener from button
|
|
144
170
|
if (this.eGui) {
|
|
145
171
|
this.eGui.removeEventListener('click', this.eventListener);
|
|
@@ -249,7 +249,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
249
249
|
getRowNodeByIndex(index: number): IRowNode;
|
|
250
250
|
getAgGridStatusPanels(): import("@ag-grid-community/core").StatusPanelDef[];
|
|
251
251
|
setDataValue(value: any, column: AdaptableColumn, primaryKeyValue: any, rowNode?: IRowNode): void;
|
|
252
|
-
isCellEditable(rowNode: IRowNode, column: Column): boolean;
|
|
253
252
|
forAllRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void, config?: {
|
|
254
253
|
includeGroupRows?: boolean;
|
|
255
254
|
filterFn?: (rowNode: IRowNode) => boolean;
|
|
@@ -285,6 +284,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
|
|
|
285
284
|
updateChart(chart: ChartDefinition): void;
|
|
286
285
|
getChartModels(): import("@ag-grid-community/core").ChartModel[];
|
|
287
286
|
getRowCount(): number;
|
|
287
|
+
getVisibleRowCount(): number;
|
|
288
288
|
getColumnCount(): number;
|
|
289
289
|
getVisibleColumnCount(): number;
|
|
290
290
|
isGridGroupable(): boolean;
|
|
@@ -978,6 +978,14 @@ export class AdaptableAgGrid {
|
|
|
978
978
|
original_processPivotResultColDef === null || original_processPivotResultColDef === void 0 ? void 0 : original_processPivotResultColDef(colDef);
|
|
979
979
|
};
|
|
980
980
|
});
|
|
981
|
+
/**
|
|
982
|
+
* `maintainColumnOrder`
|
|
983
|
+
*/
|
|
984
|
+
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'maintainColumnOrder', () => {
|
|
985
|
+
// see https://www.ag-grid.com/javascript-data-grid/column-updating-definitions/#maintain-column-order
|
|
986
|
+
// we want to always maintain the column order (provided by Adaptable Layouts), even when column definitions change
|
|
987
|
+
return true;
|
|
988
|
+
});
|
|
981
989
|
/**
|
|
982
990
|
* `columnTypes`
|
|
983
991
|
*/
|
|
@@ -1929,6 +1937,7 @@ export class AdaptableAgGrid {
|
|
|
1929
1937
|
return rawValue;
|
|
1930
1938
|
}
|
|
1931
1939
|
updateColumnModelAndRefreshGrid(config) {
|
|
1940
|
+
this.logger.info(`Updating Column Model and Refreshing Grid ${config ? `with config ${JSON.stringify(config)}` : ''}`);
|
|
1932
1941
|
if (config === null || config === void 0 ? void 0 : config.preemptiveColumnStateRefresh) {
|
|
1933
1942
|
this.deriveAdaptableColumnStateFromAgGrid();
|
|
1934
1943
|
}
|
|
@@ -2488,10 +2497,6 @@ export class AdaptableAgGrid {
|
|
|
2488
2497
|
}
|
|
2489
2498
|
}
|
|
2490
2499
|
}
|
|
2491
|
-
isCellEditable(rowNode, column) {
|
|
2492
|
-
// it's safe to rely on the AG Grid implementation because we override the colDef.editable property, which is in this case the single source of truth
|
|
2493
|
-
return column === null || column === void 0 ? void 0 : column.isCellEditable(rowNode);
|
|
2494
|
-
}
|
|
2495
2500
|
forAllRowNodesDo(func, config) {
|
|
2496
2501
|
this.agGridAdapter.getAgGridApi().forEachNode((rowNode, rowIndex) => {
|
|
2497
2502
|
const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
|
|
@@ -2692,6 +2697,10 @@ export class AdaptableAgGrid {
|
|
|
2692
2697
|
return this.agGridAdapter.getAgGridApi().getChartModels();
|
|
2693
2698
|
}
|
|
2694
2699
|
getRowCount() {
|
|
2700
|
+
const allNodes = this.getAllRowNodes({ includeGroupRows: false });
|
|
2701
|
+
return allNodes.length;
|
|
2702
|
+
}
|
|
2703
|
+
getVisibleRowCount() {
|
|
2695
2704
|
return this.agGridAdapter.getAgGridApi().getDisplayedRowCount();
|
|
2696
2705
|
}
|
|
2697
2706
|
getColumnCount() {
|
|
@@ -3434,7 +3443,11 @@ export class AdaptableAgGrid {
|
|
|
3434
3443
|
});
|
|
3435
3444
|
perfApplyColumnState.end();
|
|
3436
3445
|
this.api.gridApi.setColumnSorts(layout.ColumnSorts);
|
|
3437
|
-
|
|
3446
|
+
if (shouldUpdatePivoted) {
|
|
3447
|
+
// simply setting PivotColumns fires an AG Grid 'modelChanged' event which cascades to a full row reload in SSRM
|
|
3448
|
+
// this includes the case when we simply set an empty array of pivot columns
|
|
3449
|
+
this.agGridAdapter.getAgGridApi().setPivotColumns(layout.PivotColumns || []);
|
|
3450
|
+
}
|
|
3438
3451
|
// aggrid 25.1.0 introduced a bug such that a layout that has a grouped column, if the column has enableRowGroup: true but not rowGroup: true
|
|
3439
3452
|
// the group column is not possitioned correctly at the start of the layout
|
|
3440
3453
|
// see the test in layout/layout-switch/"should be able to switch from grouped to non-grouped and back"
|
|
@@ -60,6 +60,7 @@ export declare class AgGridAdapter {
|
|
|
60
60
|
*/
|
|
61
61
|
assignColumnIdsToColDefs(colDefs?: (ColDef | ColGroupDef)[]): void;
|
|
62
62
|
patchColDefs(colDefs: (ColDef | ColGroupDef)[], patchFn: (colDef: ColDef) => void): void;
|
|
63
|
+
traverseColDefs(colDefs: (ColDef | ColGroupDef)[], modifyFn: (colDef: ColDef) => ColDef | null): (ColDef | ColGroupDef)[];
|
|
63
64
|
getDefaultColumnDefinition(): GridOptions['defaultColDef'];
|
|
64
65
|
_agGridApi_getValue(colKey: string | Column, rowNode: IRowNode, gridApi?: GridApi): any;
|
|
65
66
|
}
|
|
@@ -587,6 +587,18 @@ export class AgGridAdapter {
|
|
|
587
587
|
};
|
|
588
588
|
colDefs.forEach((colDef) => applyPatch(colDef));
|
|
589
589
|
}
|
|
590
|
+
traverseColDefs(colDefs, modifyFn) {
|
|
591
|
+
const applyModification = (colDef) => {
|
|
592
|
+
if ('children' in colDef) {
|
|
593
|
+
const updatedChildren = colDef.children.map(applyModification).filter(Boolean);
|
|
594
|
+
return Object.assign(Object.assign({}, colDef), { children: updatedChildren });
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
return modifyFn(colDef);
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
return colDefs.map(applyModification).filter(Boolean);
|
|
601
|
+
}
|
|
590
602
|
getDefaultColumnDefinition() {
|
|
591
603
|
var _a, _b;
|
|
592
604
|
// for early init phase, gridApi might not be ready yet
|
|
@@ -36,6 +36,7 @@ export declare class AgGridColumnAdapter {
|
|
|
36
36
|
private isQuickSearchActive;
|
|
37
37
|
private getEditableCellClass;
|
|
38
38
|
private getReadonlyCellClass;
|
|
39
|
+
private getEditedCellClass;
|
|
39
40
|
private getAlertCellClass;
|
|
40
41
|
private getFlashingCellClass;
|
|
41
42
|
private getNoteCellClassName;
|
|
@@ -44,6 +45,7 @@ export declare class AgGridColumnAdapter {
|
|
|
44
45
|
private getQuickSearchCellStyle;
|
|
45
46
|
private getReadOnlyCellStyle;
|
|
46
47
|
private getEditableCellStyle;
|
|
48
|
+
private getEditedCellStyle;
|
|
47
49
|
/**
|
|
48
50
|
* The combination of styled column and format cells
|
|
49
51
|
* This functiond decides when the two can be merged.
|
|
@@ -138,6 +138,7 @@ export class AgGridColumnAdapter {
|
|
|
138
138
|
const isQuickSearchActive = hasQuickSearchStyleClassName && this.isQuickSearchActive(gridCell, params);
|
|
139
139
|
const editableClassName = this.getEditableCellClass(gridCell, params);
|
|
140
140
|
const readonlyClassName = this.getReadonlyCellClass(gridCell, params);
|
|
141
|
+
const editedClassName = this.getEditedCellClass(gridCell, params);
|
|
141
142
|
const highlightAlertClassName = this.getAlertCellClass(gridCell, params);
|
|
142
143
|
const flashingClassName = this.getFlashingCellClass(gridCell, params);
|
|
143
144
|
const styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(colId);
|
|
@@ -152,6 +153,7 @@ export class AgGridColumnAdapter {
|
|
|
152
153
|
isQuickSearchActive ? quickSearchStyleClassName : null,
|
|
153
154
|
editableClassName,
|
|
154
155
|
readonlyClassName,
|
|
156
|
+
editedClassName,
|
|
155
157
|
highlightAlertClassName,
|
|
156
158
|
flashingClassName,
|
|
157
159
|
noteClassName,
|
|
@@ -174,7 +176,7 @@ export class AgGridColumnAdapter {
|
|
|
174
176
|
const gridCell = this.adaptableInstance.getGridCellFromRowNode(params.node, abColumn.columnId);
|
|
175
177
|
const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(gridCell, params);
|
|
176
178
|
const userDefined = typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle;
|
|
177
|
-
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, userDefined), this.getReadOnlyCellStyle(gridCell, params)), this.getEditableCellStyle(gridCell, params)), this.getFormatColumnAndStyledColumnCellStyle(gridCell, params)), (isQuickSearchActive ? quickSearchStyle : {})), this.getAlertCellStyle(gridCell, params)), this.getFlashingCellStyle(gridCell, params)), this.getCellHighlightStyle(gridCell, params));
|
|
179
|
+
const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, userDefined), this.getReadOnlyCellStyle(gridCell, params)), this.getEditableCellStyle(gridCell, params)), this.getEditedCellStyle(gridCell, params)), this.getFormatColumnAndStyledColumnCellStyle(gridCell, params)), (isQuickSearchActive ? quickSearchStyle : {})), this.getAlertCellStyle(gridCell, params)), this.getFlashingCellStyle(gridCell, params)), this.getCellHighlightStyle(gridCell, params));
|
|
178
180
|
return normalizeStyleForAgGrid(result);
|
|
179
181
|
};
|
|
180
182
|
return cellStyle;
|
|
@@ -424,19 +426,9 @@ export class AgGridColumnAdapter {
|
|
|
424
426
|
if (typeof userValue === 'boolean' && userValue === false) {
|
|
425
427
|
return userValue;
|
|
426
428
|
}
|
|
427
|
-
const cellEditableFn = this.adaptableOptions.editOptions.isCellEditable;
|
|
428
429
|
const editableCallback = (params) => {
|
|
429
|
-
// Adaptable Row Summarie rows are not editable
|
|
430
|
-
// if (params.node.data[ROW_SUMMARY_ROW_ID]) {
|
|
431
|
-
if (this.adaptableApi.gridApi.isSummaryNode(params.node)) {
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
if (!cellEditableFn) {
|
|
435
|
-
return typeof userValue === 'function' ? userValue(params) : userValue;
|
|
436
|
-
}
|
|
437
430
|
const gridCell = this.adaptableInstance.getGridCellFromRowNode(params.node, params.column.getColId());
|
|
438
|
-
|
|
439
|
-
return cellEditableFn(cellEditableContext);
|
|
431
|
+
return this.adaptableApi.gridApi.isCellEditable(gridCell);
|
|
440
432
|
};
|
|
441
433
|
return editableCallback;
|
|
442
434
|
});
|
|
@@ -586,6 +578,14 @@ export class AgGridColumnAdapter {
|
|
|
586
578
|
const isCellReadonly = !this.adaptableApi.gridApi.isCellEditable(gridCell);
|
|
587
579
|
return isCellReadonly ? readonlyCellStyle.ClassName : null;
|
|
588
580
|
}
|
|
581
|
+
getEditedCellClass(gridCell, params) {
|
|
582
|
+
const editedCellStyle = this.adaptableApi.userInterfaceApi.getEditedCellStyle();
|
|
583
|
+
if (!(editedCellStyle === null || editedCellStyle === void 0 ? void 0 : editedCellStyle.ClassName)) {
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
const isCellEdited = this.adaptableApi.gridApi.isCellEdited(gridCell);
|
|
587
|
+
return isCellEdited ? editedCellStyle.ClassName : null;
|
|
588
|
+
}
|
|
589
589
|
getAlertCellClass(gridCell, params) {
|
|
590
590
|
var _a, _b;
|
|
591
591
|
const alert = this.adaptableApi.alertApi.internalApi.getAdaptableAlertWithHighlightCell(gridCell.column.columnId, params.node);
|
|
@@ -686,6 +686,18 @@ export class AgGridColumnAdapter {
|
|
|
686
686
|
}
|
|
687
687
|
return undefined;
|
|
688
688
|
}
|
|
689
|
+
getEditedCellStyle(gridCell, params) {
|
|
690
|
+
const editedCellStyle = this.adaptableApi.userInterfaceApi.getEditedCellStyle();
|
|
691
|
+
if (!editedCellStyle) {
|
|
692
|
+
return undefined;
|
|
693
|
+
}
|
|
694
|
+
if (gridCell) {
|
|
695
|
+
if (this.adaptableApi.gridApi.isCellEdited(gridCell)) {
|
|
696
|
+
return convertAdaptableStyleToCSS(editedCellStyle);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return undefined;
|
|
700
|
+
}
|
|
689
701
|
/**
|
|
690
702
|
* The combination of styled column and format cells
|
|
691
703
|
* This functiond decides when the two can be merged.
|
|
@@ -284,6 +284,7 @@ const DefaultAdaptableOptions = {
|
|
|
284
284
|
colorPalette: UIHelper.getDefaultColors(),
|
|
285
285
|
editableCellStyle: undefined,
|
|
286
286
|
readOnlyCellStyle: undefined,
|
|
287
|
+
editedCellStyle: undefined,
|
|
287
288
|
styleClassNames: EMPTY_ARRAY,
|
|
288
289
|
permittedValues: undefined,
|
|
289
290
|
editLookUpItems: undefined,
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "19.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1728328912394 || Date.now(),
|
|
4
|
+
VERSION: "19.0.2" || '--current-version--',
|
|
5
5
|
};
|