@adaptabletools/adaptable-cjs 19.0.1 → 19.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.cjs.tsbuildinfo +1 -1
- package/src/agGrid/CheckboxRenderer.d.ts +0 -16
- package/src/agGrid/CheckboxRenderer.js +0 -94
|
@@ -6,6 +6,7 @@ const SimpleButton_1 = tslib_1.__importDefault(require("../components/SimpleButt
|
|
|
6
6
|
const React = tslib_1.__importStar(require("react"));
|
|
7
7
|
const useRerender_1 = require("../components/utils/useRerender");
|
|
8
8
|
const renderWithAdaptableContext_1 = require("../View/renderWithAdaptableContext");
|
|
9
|
+
const LayoutRedux_1 = require("../Redux/ActionsReducers/LayoutRedux");
|
|
9
10
|
const ActionButtons = (props) => {
|
|
10
11
|
const { buttons, adaptableApi, context, rerender } = props;
|
|
11
12
|
return (React.createElement(React.Fragment, null, buttons.map((button, index) => {
|
|
@@ -69,6 +70,20 @@ const ReactActionColumnRenderer = (props) => {
|
|
|
69
70
|
if (!shouldRender) {
|
|
70
71
|
return null;
|
|
71
72
|
}
|
|
73
|
+
// subscribe to the LayoutChange event and rerender on change
|
|
74
|
+
const unsubscribe = adaptable.api.eventApi.on('AdaptableStateChanged', (eventInfo) => {
|
|
75
|
+
if (eventInfo.actionName === LayoutRedux_1.LAYOUT_SELECT) {
|
|
76
|
+
if (eventInfo.oldState.Layout.CurrentLayout !== eventInfo.newState.Layout.CurrentLayout) {
|
|
77
|
+
rerender();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// unsubscribe on unmount
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
return () => {
|
|
84
|
+
unsubscribe();
|
|
85
|
+
};
|
|
86
|
+
}, []);
|
|
72
87
|
const pkValue = adaptable.getPrimaryKeyValueFromRowNode(props.node, props.api);
|
|
73
88
|
const buttonContext = Object.assign(Object.assign({ actionColumn, primaryKeyValue: pkValue, rowNode: props.node }, adaptable.api.internalApi.buildBaseContext()), { data: props.data });
|
|
74
89
|
return (React.createElement("div", { className: "ab-ActionColumn" },
|
|
@@ -88,6 +103,7 @@ class ActionColumnRenderer {
|
|
|
88
103
|
if (!actionColumn || !actionButtons.length) {
|
|
89
104
|
return;
|
|
90
105
|
}
|
|
106
|
+
this.actionButtons = actionButtons;
|
|
91
107
|
// create the cell
|
|
92
108
|
this.eGui = document.createElement('div');
|
|
93
109
|
this.eGui.className = 'ab-ActionColumn';
|
|
@@ -119,13 +135,22 @@ class ActionColumnRenderer {
|
|
|
119
135
|
const eGui = this.eGui;
|
|
120
136
|
const doRender = () => {
|
|
121
137
|
this.unmountReactRoot = adaptable.renderReactRoot((0, renderWithAdaptableContext_1.renderWithAdaptableContext)(ActionButtons({
|
|
122
|
-
buttons: actionButtons,
|
|
138
|
+
buttons: this.actionButtons,
|
|
123
139
|
context: buttonContext,
|
|
124
140
|
rerender: doRender,
|
|
125
141
|
adaptableApi: adaptable.api,
|
|
126
142
|
}), adaptable), eGui);
|
|
127
143
|
};
|
|
128
144
|
this.render = doRender;
|
|
145
|
+
this.layoutSwitchUnsubscribe = adaptable.api.eventApi.on('AdaptableStateChanged', (eventInfo) => {
|
|
146
|
+
if (eventInfo.actionName === LayoutRedux_1.LAYOUT_SELECT) {
|
|
147
|
+
if (eventInfo.oldState.Layout.CurrentLayout !== eventInfo.newState.Layout.CurrentLayout) {
|
|
148
|
+
const { actionButtons: freshActionButtons } = adaptable.api.internalApi.getActionButtonsAndActionColumn(params.colDef);
|
|
149
|
+
this.actionButtons = freshActionButtons;
|
|
150
|
+
doRender();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
129
154
|
doRender();
|
|
130
155
|
}
|
|
131
156
|
// defined on init
|
|
@@ -143,8 +168,9 @@ class ActionColumnRenderer {
|
|
|
143
168
|
}
|
|
144
169
|
// gets called when the cell is removed from the grid
|
|
145
170
|
destroy() {
|
|
146
|
-
var _a;
|
|
147
|
-
(_a = this.
|
|
171
|
+
var _a, _b;
|
|
172
|
+
(_a = this.layoutSwitchUnsubscribe) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
173
|
+
(_b = this.unmountReactRoot) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
148
174
|
// do cleanup, remove event listener from button
|
|
149
175
|
if (this.eGui) {
|
|
150
176
|
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;
|
|
@@ -982,6 +982,14 @@ class AdaptableAgGrid {
|
|
|
982
982
|
original_processPivotResultColDef === null || original_processPivotResultColDef === void 0 ? void 0 : original_processPivotResultColDef(colDef);
|
|
983
983
|
};
|
|
984
984
|
});
|
|
985
|
+
/**
|
|
986
|
+
* `maintainColumnOrder`
|
|
987
|
+
*/
|
|
988
|
+
this.agGridOptionsService.setGridOptionsProperty(gridOptions, 'maintainColumnOrder', () => {
|
|
989
|
+
// see https://www.ag-grid.com/javascript-data-grid/column-updating-definitions/#maintain-column-order
|
|
990
|
+
// we want to always maintain the column order (provided by Adaptable Layouts), even when column definitions change
|
|
991
|
+
return true;
|
|
992
|
+
});
|
|
985
993
|
/**
|
|
986
994
|
* `columnTypes`
|
|
987
995
|
*/
|
|
@@ -1933,6 +1941,7 @@ class AdaptableAgGrid {
|
|
|
1933
1941
|
return rawValue;
|
|
1934
1942
|
}
|
|
1935
1943
|
updateColumnModelAndRefreshGrid(config) {
|
|
1944
|
+
this.logger.info(`Updating Column Model and Refreshing Grid ${config ? `with config ${JSON.stringify(config)}` : ''}`);
|
|
1936
1945
|
if (config === null || config === void 0 ? void 0 : config.preemptiveColumnStateRefresh) {
|
|
1937
1946
|
this.deriveAdaptableColumnStateFromAgGrid();
|
|
1938
1947
|
}
|
|
@@ -2492,10 +2501,6 @@ class AdaptableAgGrid {
|
|
|
2492
2501
|
}
|
|
2493
2502
|
}
|
|
2494
2503
|
}
|
|
2495
|
-
isCellEditable(rowNode, column) {
|
|
2496
|
-
// 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
|
|
2497
|
-
return column === null || column === void 0 ? void 0 : column.isCellEditable(rowNode);
|
|
2498
|
-
}
|
|
2499
2504
|
forAllRowNodesDo(func, config) {
|
|
2500
2505
|
this.agGridAdapter.getAgGridApi().forEachNode((rowNode, rowIndex) => {
|
|
2501
2506
|
const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
|
|
@@ -2696,6 +2701,10 @@ class AdaptableAgGrid {
|
|
|
2696
2701
|
return this.agGridAdapter.getAgGridApi().getChartModels();
|
|
2697
2702
|
}
|
|
2698
2703
|
getRowCount() {
|
|
2704
|
+
const allNodes = this.getAllRowNodes({ includeGroupRows: false });
|
|
2705
|
+
return allNodes.length;
|
|
2706
|
+
}
|
|
2707
|
+
getVisibleRowCount() {
|
|
2699
2708
|
return this.agGridAdapter.getAgGridApi().getDisplayedRowCount();
|
|
2700
2709
|
}
|
|
2701
2710
|
getColumnCount() {
|
|
@@ -3438,7 +3447,11 @@ class AdaptableAgGrid {
|
|
|
3438
3447
|
});
|
|
3439
3448
|
perfApplyColumnState.end();
|
|
3440
3449
|
this.api.gridApi.setColumnSorts(layout.ColumnSorts);
|
|
3441
|
-
|
|
3450
|
+
if (shouldUpdatePivoted) {
|
|
3451
|
+
// simply setting PivotColumns fires an AG Grid 'modelChanged' event which cascades to a full row reload in SSRM
|
|
3452
|
+
// this includes the case when we simply set an empty array of pivot columns
|
|
3453
|
+
this.agGridAdapter.getAgGridApi().setPivotColumns(layout.PivotColumns || []);
|
|
3454
|
+
}
|
|
3442
3455
|
// 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
|
|
3443
3456
|
// the group column is not possitioned correctly at the start of the layout
|
|
3444
3457
|
// 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
|
}
|
|
@@ -591,6 +591,18 @@ class AgGridAdapter {
|
|
|
591
591
|
};
|
|
592
592
|
colDefs.forEach((colDef) => applyPatch(colDef));
|
|
593
593
|
}
|
|
594
|
+
traverseColDefs(colDefs, modifyFn) {
|
|
595
|
+
const applyModification = (colDef) => {
|
|
596
|
+
if ('children' in colDef) {
|
|
597
|
+
const updatedChildren = colDef.children.map(applyModification).filter(Boolean);
|
|
598
|
+
return Object.assign(Object.assign({}, colDef), { children: updatedChildren });
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
return modifyFn(colDef);
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
return colDefs.map(applyModification).filter(Boolean);
|
|
605
|
+
}
|
|
594
606
|
getDefaultColumnDefinition() {
|
|
595
607
|
var _a, _b;
|
|
596
608
|
// 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.
|
|
@@ -143,6 +143,7 @@ class AgGridColumnAdapter {
|
|
|
143
143
|
const isQuickSearchActive = hasQuickSearchStyleClassName && this.isQuickSearchActive(gridCell, params);
|
|
144
144
|
const editableClassName = this.getEditableCellClass(gridCell, params);
|
|
145
145
|
const readonlyClassName = this.getReadonlyCellClass(gridCell, params);
|
|
146
|
+
const editedClassName = this.getEditedCellClass(gridCell, params);
|
|
146
147
|
const highlightAlertClassName = this.getAlertCellClass(gridCell, params);
|
|
147
148
|
const flashingClassName = this.getFlashingCellClass(gridCell, params);
|
|
148
149
|
const styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(colId);
|
|
@@ -157,6 +158,7 @@ class AgGridColumnAdapter {
|
|
|
157
158
|
isQuickSearchActive ? quickSearchStyleClassName : null,
|
|
158
159
|
editableClassName,
|
|
159
160
|
readonlyClassName,
|
|
161
|
+
editedClassName,
|
|
160
162
|
highlightAlertClassName,
|
|
161
163
|
flashingClassName,
|
|
162
164
|
noteClassName,
|
|
@@ -179,7 +181,7 @@ class AgGridColumnAdapter {
|
|
|
179
181
|
const gridCell = this.adaptableInstance.getGridCellFromRowNode(params.node, abColumn.columnId);
|
|
180
182
|
const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(gridCell, params);
|
|
181
183
|
const userDefined = typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle;
|
|
182
|
-
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));
|
|
184
|
+
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));
|
|
183
185
|
return (0, StyleHelper_1.normalizeStyleForAgGrid)(result);
|
|
184
186
|
};
|
|
185
187
|
return cellStyle;
|
|
@@ -429,19 +431,9 @@ class AgGridColumnAdapter {
|
|
|
429
431
|
if (typeof userValue === 'boolean' && userValue === false) {
|
|
430
432
|
return userValue;
|
|
431
433
|
}
|
|
432
|
-
const cellEditableFn = this.adaptableOptions.editOptions.isCellEditable;
|
|
433
434
|
const editableCallback = (params) => {
|
|
434
|
-
// Adaptable Row Summarie rows are not editable
|
|
435
|
-
// if (params.node.data[ROW_SUMMARY_ROW_ID]) {
|
|
436
|
-
if (this.adaptableApi.gridApi.isSummaryNode(params.node)) {
|
|
437
|
-
return false;
|
|
438
|
-
}
|
|
439
|
-
if (!cellEditableFn) {
|
|
440
|
-
return typeof userValue === 'function' ? userValue(params) : userValue;
|
|
441
|
-
}
|
|
442
435
|
const gridCell = this.adaptableInstance.getGridCellFromRowNode(params.node, params.column.getColId());
|
|
443
|
-
|
|
444
|
-
return cellEditableFn(cellEditableContext);
|
|
436
|
+
return this.adaptableApi.gridApi.isCellEditable(gridCell);
|
|
445
437
|
};
|
|
446
438
|
return editableCallback;
|
|
447
439
|
});
|
|
@@ -591,6 +583,14 @@ class AgGridColumnAdapter {
|
|
|
591
583
|
const isCellReadonly = !this.adaptableApi.gridApi.isCellEditable(gridCell);
|
|
592
584
|
return isCellReadonly ? readonlyCellStyle.ClassName : null;
|
|
593
585
|
}
|
|
586
|
+
getEditedCellClass(gridCell, params) {
|
|
587
|
+
const editedCellStyle = this.adaptableApi.userInterfaceApi.getEditedCellStyle();
|
|
588
|
+
if (!(editedCellStyle === null || editedCellStyle === void 0 ? void 0 : editedCellStyle.ClassName)) {
|
|
589
|
+
return null;
|
|
590
|
+
}
|
|
591
|
+
const isCellEdited = this.adaptableApi.gridApi.isCellEdited(gridCell);
|
|
592
|
+
return isCellEdited ? editedCellStyle.ClassName : null;
|
|
593
|
+
}
|
|
594
594
|
getAlertCellClass(gridCell, params) {
|
|
595
595
|
var _a, _b;
|
|
596
596
|
const alert = this.adaptableApi.alertApi.internalApi.getAdaptableAlertWithHighlightCell(gridCell.column.columnId, params.node);
|
|
@@ -691,6 +691,18 @@ class AgGridColumnAdapter {
|
|
|
691
691
|
}
|
|
692
692
|
return undefined;
|
|
693
693
|
}
|
|
694
|
+
getEditedCellStyle(gridCell, params) {
|
|
695
|
+
const editedCellStyle = this.adaptableApi.userInterfaceApi.getEditedCellStyle();
|
|
696
|
+
if (!editedCellStyle) {
|
|
697
|
+
return undefined;
|
|
698
|
+
}
|
|
699
|
+
if (gridCell) {
|
|
700
|
+
if (this.adaptableApi.gridApi.isCellEdited(gridCell)) {
|
|
701
|
+
return (0, StyleHelper_1.convertAdaptableStyleToCSS)(editedCellStyle);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return undefined;
|
|
705
|
+
}
|
|
694
706
|
/**
|
|
695
707
|
* The combination of styled column and format cells
|
|
696
708
|
* This functiond decides when the two can be merged.
|
|
@@ -288,6 +288,7 @@ const DefaultAdaptableOptions = {
|
|
|
288
288
|
colorPalette: UIHelper_1.default.getDefaultColors(),
|
|
289
289
|
editableCellStyle: undefined,
|
|
290
290
|
readOnlyCellStyle: undefined,
|
|
291
|
+
editedCellStyle: undefined,
|
|
291
292
|
styleClassNames: GeneralConstants_1.EMPTY_ARRAY,
|
|
292
293
|
permittedValues: undefined,
|
|
293
294
|
editLookUpItems: undefined,
|
package/src/env.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
4
|
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" || '',
|
|
5
|
-
PUBLISH_TIMESTAMP:
|
|
6
|
-
VERSION: "19.0.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1728328943635 || Date.now(),
|
|
6
|
+
VERSION: "19.0.2" || '--current-version--',
|
|
7
7
|
};
|