@adaptabletools/adaptable-cjs 22.0.0 → 22.0.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/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/AdaptablePlugin.d.ts +4 -0
- package/src/AdaptableOptions/AdaptablePlugin.js +1 -0
- package/src/Api/EventApi.d.ts +14 -2
- package/src/Api/Events/BeforeAdaptableStateChange.d.ts +20 -0
- package/src/Api/Events/BeforeAdaptableStateChange.js +2 -0
- package/src/Api/GridApi.d.ts +4 -0
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +3 -0
- package/src/Api/Implementation/RowFormApiImpl.d.ts +1 -0
- package/src/Api/Implementation/RowFormApiImpl.js +13 -0
- package/src/Api/Internal/ActionColumnInternalApi.js +2 -19
- package/src/Api/Internal/EventInternalApi.d.ts +1 -0
- package/src/Api/Internal/EventInternalApi.js +9 -0
- package/src/Api/Internal/ExportInternalApi.js +1 -1
- package/src/Api/RowFormApi.d.ts +5 -0
- package/src/Redux/Store/AdaptableStore.d.ts +2 -0
- package/src/Redux/Store/AdaptableStore.js +15 -0
- package/src/Redux/Store/Interface/IAdaptableStore.d.ts +1 -0
- package/src/Strategy/CellSummaryModule.d.ts +1 -0
- package/src/Strategy/CellSummaryModule.js +3 -0
- package/src/Strategy/LayoutModule.js +22 -18
- package/src/Strategy/PlusMinusModule.d.ts +1 -0
- package/src/Strategy/PlusMinusModule.js +8 -2
- package/src/Utilities/only.d.ts +6 -3
- package/src/Utilities/only.js +20 -34
- package/src/Utilities/weightedAverage.d.ts +11 -0
- package/src/Utilities/weightedAverage.js +59 -45
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
- package/src/agGrid/AdaptableAgGrid.js +11 -1
- package/src/env.js +2 -2
- package/src/types.d.ts +1 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.1-canary.1",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -143,6 +143,7 @@ export interface IAdaptable {
|
|
|
143
143
|
refreshCells(rowNode: IRowNode, columns: (string | any)[], forceUpdate: boolean, suppressFlash?: boolean): void;
|
|
144
144
|
refreshAllCells(forceUpdate?: boolean): void;
|
|
145
145
|
refreshColumns(columns: (string | Column)[], forceUpdate: boolean, suppressFlash?: boolean): void;
|
|
146
|
+
refreshGridHeader(): void;
|
|
146
147
|
refreshSelectedCellsState(): SelectedCellInfo | undefined;
|
|
147
148
|
refreshSelectedRowsState(): SelectedRowInfo | undefined;
|
|
148
149
|
selectColumn(columnId: string, config?: {
|
|
@@ -34,6 +34,10 @@ export declare abstract class AdaptablePlugin {
|
|
|
34
34
|
afterInitStore(adaptable: IAdaptable): void;
|
|
35
35
|
afterInit(ab: IAdaptable): void;
|
|
36
36
|
afterSetLayout(adaptable: IAdaptable, layout: Layout): void;
|
|
37
|
+
onBeforeStoreEvent(eventName: string, data: {
|
|
38
|
+
action: Redux.Action;
|
|
39
|
+
state: AdaptableState;
|
|
40
|
+
}, adaptableStore: IAdaptableStore): void;
|
|
37
41
|
onStoreEvent(eventName: string, data: {
|
|
38
42
|
action: Redux.Action;
|
|
39
43
|
state: AdaptableState;
|
|
@@ -42,6 +42,7 @@ class AdaptablePlugin {
|
|
|
42
42
|
afterInit(ab) { }
|
|
43
43
|
// hook executed after each layout update (Adaptable.setLayout())
|
|
44
44
|
afterSetLayout(adaptable, layout) { }
|
|
45
|
+
onBeforeStoreEvent(eventName, data, adaptableStore) { }
|
|
45
46
|
onStoreEvent(eventName, data, adaptableStore) { }
|
|
46
47
|
onAdaptableReady(adaptable, adaptableOptions) { }
|
|
47
48
|
interceptSetupColumnProperty;
|
package/src/Api/EventApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptableReadyInfo, AdaptableStateChangedInfo, AdaptableStateReloadedInfo, AlertFiredInfo, CalculatedColumnChangedInfo, CellChangedInfo, CellSelectionChangedInfo, ChartChangedInfo, ColumnFilterAppliedInfo, CommentChangedInfo, CustomToolbarConfiguredInfo, DashboardChangedInfo, DataImportedInfo, DataSetSelectedInfo, Fdc3MessageInfo, FlashingCellDisplayedInfo, GridFilterAppliedInfo, GridSortedInfo, LayoutChangedInfo, LiveDataChangedInfo, RowChangedInfo, RowFormSubmittedInfo, RowSelectionChangedInfo, ScheduleTriggeredInfo, SystemStatusMessageDisplayedInfo, TeamSharingEntityChangedInfo, ThemeChangedInfo } from '../types';
|
|
1
|
+
import { AdaptableReadyInfo, AdaptableStateChangedInfo, AdaptableStateReloadedInfo, BeforeAdaptableStateChangeInfo, AlertFiredInfo, CalculatedColumnChangedInfo, CellChangedInfo, CellSelectionChangedInfo, ChartChangedInfo, ColumnFilterAppliedInfo, CommentChangedInfo, CustomToolbarConfiguredInfo, DashboardChangedInfo, DataImportedInfo, DataSetSelectedInfo, Fdc3MessageInfo, FlashingCellDisplayedInfo, GridFilterAppliedInfo, GridSortedInfo, LayoutChangedInfo, LiveDataChangedInfo, RowChangedInfo, RowFormSubmittedInfo, RowSelectionChangedInfo, ScheduleTriggeredInfo, SystemStatusMessageDisplayedInfo, TeamSharingEntityChangedInfo, ThemeChangedInfo } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Responsible for publishing the many Events that AdapTable fires
|
|
4
4
|
*/
|
|
@@ -210,6 +210,17 @@ export interface EventApi {
|
|
|
210
210
|
* Unsubscribe from DashboardChanged
|
|
211
211
|
*/
|
|
212
212
|
off(eventName: 'DashboardChanged', callback: (dashboardChangedInfo: DashboardChangedInfo) => void): void;
|
|
213
|
+
/**
|
|
214
|
+
* Event fired **before** Adaptable State changes (before the action is processed)
|
|
215
|
+
* @param eventName BeforeAdaptableStateChange
|
|
216
|
+
* @param callback BeforeAdaptableStateChangeInfo
|
|
217
|
+
* @returns the unsubscribe function
|
|
218
|
+
*/
|
|
219
|
+
on(eventName: 'BeforeAdaptableStateChange', callback: (beforeAdaptableStateChangeInfo: BeforeAdaptableStateChangeInfo) => void): () => void;
|
|
220
|
+
/**
|
|
221
|
+
* Unsubscribe from BeforeAdaptableStateChange
|
|
222
|
+
*/
|
|
223
|
+
off(eventName: 'BeforeAdaptableStateChange', callback: (beforeAdaptableStateChangeInfo: BeforeAdaptableStateChangeInfo) => void): void;
|
|
213
224
|
/**
|
|
214
225
|
* Event fired whenever **Adaptable State changes**
|
|
215
226
|
* @param eventName AdaptableStateChanged
|
|
@@ -336,9 +347,10 @@ export interface EventApi {
|
|
|
336
347
|
* @param callbackFdc3MessageInfo
|
|
337
348
|
*/
|
|
338
349
|
off(eventName: 'Fdc3Message', callback: (fdc3MessageInfo: Fdc3MessageInfo) => void): void;
|
|
350
|
+
emitSync(eventName: 'BeforeAdaptableStateChange', data?: any): any[];
|
|
339
351
|
emitSync(eventName: 'DashboardChanged', data?: any): any[];
|
|
340
352
|
emitSync(eventName: 'FlashingCellDisplayed', data?: any): any[];
|
|
341
353
|
emitSync(eventName: 'AdaptableDestroy'): any[];
|
|
342
|
-
emit(eventName: 'RowFormSubmitted' | 'AdaptableReady' | 'AlertFired' | 'AdaptableStateChanged' | 'AdaptableStateReloaded' | 'CellChanged' | 'ChartChanged' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'DashboardChanged' | 'DataImported' | 'DataSetSelected' | 'ColumnFilterApplied' | 'Fdc3Message' | 'RowChanged' | 'GridSorted' | 'LayoutChanged' | 'CalculatedColumnChanged' | 'LiveDataChanged' | 'ScheduleTriggered' | 'SearchChanged' | 'CellSelectionChanged' | 'RowSelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'GridFilterApplied' | 'CommentChanged', data?: any): Promise<any>;
|
|
354
|
+
emit(eventName: 'RowFormSubmitted' | 'AdaptableReady' | 'AlertFired' | 'BeforeAdaptableStateChange' | 'AdaptableStateChanged' | 'AdaptableStateReloaded' | 'CellChanged' | 'ChartChanged' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'DashboardChanged' | 'DataImported' | 'DataSetSelected' | 'ColumnFilterApplied' | 'Fdc3Message' | 'RowChanged' | 'GridSorted' | 'LayoutChanged' | 'CalculatedColumnChanged' | 'LiveDataChanged' | 'ScheduleTriggered' | 'SearchChanged' | 'CellSelectionChanged' | 'RowSelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'GridFilterApplied' | 'CommentChanged', data?: any): Promise<any>;
|
|
343
355
|
destroy(): void;
|
|
344
356
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Redux from 'redux';
|
|
2
|
+
import { AdaptableState } from '../../AdaptableState/AdaptableState';
|
|
3
|
+
import { BaseContext } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Object returned by the `BeforeAdaptableStateChange` event, fired before the action is processed by the reducer
|
|
6
|
+
*/
|
|
7
|
+
export interface BeforeAdaptableStateChangeInfo extends BaseContext {
|
|
8
|
+
/**
|
|
9
|
+
* Name of the Action about to be performed
|
|
10
|
+
*/
|
|
11
|
+
actionName: string;
|
|
12
|
+
/**
|
|
13
|
+
* The Redux Action that is about to be invoked
|
|
14
|
+
*/
|
|
15
|
+
action: Redux.Action;
|
|
16
|
+
/**
|
|
17
|
+
* Current Adaptable State (before the Action is applied)
|
|
18
|
+
*/
|
|
19
|
+
state: AdaptableState;
|
|
20
|
+
}
|
package/src/Api/GridApi.d.ts
CHANGED
|
@@ -537,6 +537,10 @@ export interface GridApi {
|
|
|
537
537
|
* @param rowNodes AG Grid rows
|
|
538
538
|
*/
|
|
539
539
|
refreshRowNodes(rowNodes?: IRowNode[]): void;
|
|
540
|
+
/**
|
|
541
|
+
* Forces a re-render of the Grid Header
|
|
542
|
+
*/
|
|
543
|
+
refreshGridHeader(): void;
|
|
540
544
|
/**
|
|
541
545
|
* Forces a re-render of all Group Rows (including aggregations)
|
|
542
546
|
*/
|
|
@@ -138,6 +138,7 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
|
|
|
138
138
|
refreshRowNode(rowNode: IRowNode): void;
|
|
139
139
|
refreshRowNodes(rowNodes?: IRowNode[]): void;
|
|
140
140
|
refreshGroupRowNodes(): void;
|
|
141
|
+
refreshGridHeader(): void;
|
|
141
142
|
isCellEditable(gridCell: GridCell): boolean;
|
|
142
143
|
isCellEdited(gridCell: GridCell): boolean;
|
|
143
144
|
isEveryCellEditable(gridCells: GridCell[]): boolean;
|
|
@@ -551,6 +551,9 @@ class GridApiImpl extends ApiBase_1.ApiBase {
|
|
|
551
551
|
this.getAgGridApi().refreshClientSideRowModel('group');
|
|
552
552
|
this._adaptable.updateRowGroupsAndColumnGroupsExpandedState();
|
|
553
553
|
}
|
|
554
|
+
refreshGridHeader() {
|
|
555
|
+
this._adaptable.refreshGridHeader();
|
|
556
|
+
}
|
|
554
557
|
isCellEditable(gridCell) {
|
|
555
558
|
// If not Grid Cell or Column then return false - GridCell.column may be undefined for cells from synthetic columns created by AG Grid (ex. autoGroup columns)
|
|
556
559
|
if (!gridCell || !gridCell.column || !gridCell.rowNode) {
|
|
@@ -47,5 +47,18 @@ class RowFormApiImpl extends ApiBase_1.ApiBase {
|
|
|
47
47
|
},
|
|
48
48
|
}));
|
|
49
49
|
}
|
|
50
|
+
displayDeleteRowForm(primaryKey) {
|
|
51
|
+
const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKey);
|
|
52
|
+
if (!rowNode) {
|
|
53
|
+
this.logWarn(`Can NOT delete row: rowNode not found for primaryKey ${primaryKey}`);
|
|
54
|
+
}
|
|
55
|
+
const eventInfo = {
|
|
56
|
+
type: 'rowDeleted',
|
|
57
|
+
rowNode: rowNode,
|
|
58
|
+
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
59
|
+
};
|
|
60
|
+
this.getEventApi().internalApi.fireRowFormSubmittedEvent(eventInfo);
|
|
61
|
+
this.getRowFormOptions().onRowFormSubmit?.(eventInfo);
|
|
62
|
+
}
|
|
50
63
|
}
|
|
51
64
|
exports.RowFormApiImpl = RowFormApiImpl;
|
|
@@ -112,27 +112,10 @@ class ActionColumnInternalApi extends ApiBase_1.ApiBase {
|
|
|
112
112
|
break;
|
|
113
113
|
case 'delete':
|
|
114
114
|
button.onClick = (button, context) => {
|
|
115
|
-
|
|
116
|
-
type: 'rowDeleted',
|
|
117
|
-
rowNode: context.rowNode,
|
|
118
|
-
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
119
|
-
};
|
|
120
|
-
this.getEventApi().internalApi.fireRowFormSubmittedEvent(eventInfo);
|
|
121
|
-
this.getRowFormOptions().onRowFormSubmit?.(eventInfo);
|
|
115
|
+
this.getRowFormApi().displayDeleteRowForm(context.primaryKeyValue);
|
|
122
116
|
};
|
|
123
117
|
button.tooltip = button.tooltip ? button.tooltip : 'Delete Row';
|
|
124
|
-
button.icon = button.icon ?? {
|
|
125
|
-
name: 'delete',
|
|
126
|
-
};
|
|
127
|
-
break;
|
|
128
|
-
case 'edit':
|
|
129
|
-
button.onClick = (button, context) => {
|
|
130
|
-
this.getRowFormApi().displayEditRowForm(context.primaryKeyValue);
|
|
131
|
-
};
|
|
132
|
-
button.tooltip = button.tooltip ? button.tooltip : 'Edit Row';
|
|
133
|
-
button.icon = button.icon ?? {
|
|
134
|
-
name: 'edit',
|
|
135
|
-
};
|
|
118
|
+
button.icon = button.icon ?? { name: 'delete' };
|
|
136
119
|
break;
|
|
137
120
|
}
|
|
138
121
|
}
|
|
@@ -17,6 +17,7 @@ export declare class EventInternalApi extends ApiBase {
|
|
|
17
17
|
fireDataSetSelectedEvent(dataSet: DataSet): void;
|
|
18
18
|
fireSystemStatusMessageDisplayedEvent(systemStatusMessageInfo: SystemStatusMessageInfo): void;
|
|
19
19
|
fireDataImportedEvent(importData: any[], addedRows: IRowNode[], updatedRows: IRowNode[]): DataImportedInfo;
|
|
20
|
+
fireBeforeAdaptableStateChangeEvent(action: Redux.Action, state: AdaptableState): void;
|
|
20
21
|
fireAdaptableStateChangedEvent(action: Redux.Action, oldState: AdaptableState, newState: AdaptableState): void;
|
|
21
22
|
fireAdaptableStateReloadedEvent(oldState: AdaptablePersistentState, newState: AdaptablePersistentState): void;
|
|
22
23
|
fireCalculatedColumnChangedEvent(trigger: string, calculatedColumn: CalculatedColumn): void;
|
|
@@ -133,6 +133,15 @@ class EventInternalApi extends ApiBase_1.ApiBase {
|
|
|
133
133
|
this.getEventApi().emit('DataImported', dataImportedInfo);
|
|
134
134
|
return dataImportedInfo;
|
|
135
135
|
}
|
|
136
|
+
fireBeforeAdaptableStateChangeEvent(action, state) {
|
|
137
|
+
const beforeAdaptableStateChangeInfo = {
|
|
138
|
+
actionName: action.type,
|
|
139
|
+
...this.getAdaptableInternalApi().buildBaseContext(),
|
|
140
|
+
action: action,
|
|
141
|
+
state: state,
|
|
142
|
+
};
|
|
143
|
+
this.getEventApi().emitSync('BeforeAdaptableStateChange', beforeAdaptableStateChangeInfo);
|
|
144
|
+
}
|
|
136
145
|
fireAdaptableStateChangedEvent(action, oldState, newState) {
|
|
137
146
|
const adaptableStateChangedInfo = {
|
|
138
147
|
actionName: action.type,
|
|
@@ -45,7 +45,7 @@ class ExportInternalApi extends ApiBase_1.ApiBase {
|
|
|
45
45
|
}
|
|
46
46
|
break;
|
|
47
47
|
case 'VisibleColumns':
|
|
48
|
-
// hope that
|
|
48
|
+
// hope that visible column property is updated whenever the layout changes... (need to check!)
|
|
49
49
|
if (!cellDataChangedInfo.column.visible) {
|
|
50
50
|
return false;
|
|
51
51
|
}
|
package/src/Api/RowFormApi.d.ts
CHANGED
|
@@ -16,4 +16,9 @@ export interface RowFormApi {
|
|
|
16
16
|
* @param primaryKey - Primary Key of the duplicated row
|
|
17
17
|
*/
|
|
18
18
|
displayCloneRowForm(primaryKey?: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* Deletes row from grid (with event fired) - note: no visible Row Form is displayed
|
|
21
|
+
* @param primaryKey - Primary Key of the deleted row
|
|
22
|
+
*/
|
|
23
|
+
displayDeleteRowForm(primaryKey?: any): void;
|
|
19
24
|
}
|
|
@@ -22,6 +22,7 @@ export declare class AdaptableStore implements IAdaptableStore {
|
|
|
22
22
|
TheStore: Redux.Store<AdaptableState, Redux.Action>;
|
|
23
23
|
Load: Promise<any>;
|
|
24
24
|
private emitter;
|
|
25
|
+
private beforeEmitter;
|
|
25
26
|
private storageEngine;
|
|
26
27
|
private currentStorageState?;
|
|
27
28
|
private previousStorageState?;
|
|
@@ -29,6 +30,7 @@ export declare class AdaptableStore implements IAdaptableStore {
|
|
|
29
30
|
private loadStateOnStartup;
|
|
30
31
|
on: (eventName: string, callback: EmitterCallback) => (() => void);
|
|
31
32
|
onAny: (callback: EmitterAnyCallback) => (() => void);
|
|
33
|
+
onBeforeAny: (callback: EmitterAnyCallback) => (() => void);
|
|
32
34
|
emit: (eventName: string, data: any) => Promise<any>;
|
|
33
35
|
/**
|
|
34
36
|
*
|
|
@@ -76,6 +76,7 @@ class AdaptableStore {
|
|
|
76
76
|
TheStore;
|
|
77
77
|
Load;
|
|
78
78
|
emitter;
|
|
79
|
+
beforeEmitter;
|
|
79
80
|
storageEngine;
|
|
80
81
|
currentStorageState;
|
|
81
82
|
previousStorageState;
|
|
@@ -87,6 +88,9 @@ class AdaptableStore {
|
|
|
87
88
|
onAny = (callback) => {
|
|
88
89
|
return this.emitter.onAny(callback);
|
|
89
90
|
};
|
|
91
|
+
onBeforeAny = (callback) => {
|
|
92
|
+
return this.beforeEmitter.onAny(callback);
|
|
93
|
+
};
|
|
90
94
|
emit = (eventName, data) => {
|
|
91
95
|
return this.emitter.emit(eventName, data);
|
|
92
96
|
};
|
|
@@ -155,6 +159,7 @@ class AdaptableStore {
|
|
|
155
159
|
};
|
|
156
160
|
let storageEngine;
|
|
157
161
|
this.emitter = new Emitter_1.default();
|
|
162
|
+
this.beforeEmitter = new Emitter_1.default();
|
|
158
163
|
// If the user has remote storage set then we use Remote Engine, otherwise we use Local Enginge
|
|
159
164
|
// not sure we can do this as we need to be backwardly compatible with existing users so need to stick with adaptable id (which should be unique)
|
|
160
165
|
// const localStorageKey = 'adaptable-adaptable-state-' + adaptable.adaptableOptions.primaryKey;
|
|
@@ -210,6 +215,13 @@ class AdaptableStore {
|
|
|
210
215
|
}
|
|
211
216
|
return finalState;
|
|
212
217
|
};
|
|
218
|
+
const beforeEmitterMiddleware = (middlewareAPI) => (next) => (action) => {
|
|
219
|
+
this.beforeEmitter.emitSync(action.type, {
|
|
220
|
+
action,
|
|
221
|
+
state: middlewareAPI.getState(),
|
|
222
|
+
});
|
|
223
|
+
return next(action);
|
|
224
|
+
};
|
|
213
225
|
const devToolsActionMarkerMiddleware = createDevToolsActionMarkerMiddleware(adaptable);
|
|
214
226
|
const pluginsMiddleware = [];
|
|
215
227
|
adaptable.forPlugins((plugin) => {
|
|
@@ -218,6 +230,7 @@ class AdaptableStore {
|
|
|
218
230
|
}
|
|
219
231
|
});
|
|
220
232
|
const middlewares = [
|
|
233
|
+
beforeEmitterMiddleware, // fires before anything else processes the action
|
|
221
234
|
devToolsActionMarkerMiddleware,
|
|
222
235
|
adaptableMiddleware(adaptable), // the main middleware that actually does stuff,
|
|
223
236
|
...pluginsMiddleware, // the plugins middleware
|
|
@@ -230,6 +243,8 @@ class AdaptableStore {
|
|
|
230
243
|
destroy() {
|
|
231
244
|
this.emitter?.clearListeners();
|
|
232
245
|
this.emitter = null;
|
|
246
|
+
this.beforeEmitter?.clearListeners();
|
|
247
|
+
this.beforeEmitter = null;
|
|
233
248
|
}
|
|
234
249
|
getCurrentStorageState() {
|
|
235
250
|
return this.currentStorageState;
|
|
@@ -17,6 +17,7 @@ export interface IAdaptableStore {
|
|
|
17
17
|
saveStateNow: (adaptable: IAdaptable) => Promise<any>;
|
|
18
18
|
on: (eventName: string, callback: (data?: any) => any) => () => void;
|
|
19
19
|
onAny: (callback: (eventName: string, data?: any) => any) => () => void;
|
|
20
|
+
onBeforeAny: (callback: (eventName: string, data?: any) => any) => () => void;
|
|
20
21
|
emit: (eventName: string, data: any) => Promise<any>;
|
|
21
22
|
destroy: () => void;
|
|
22
23
|
}
|
|
@@ -18,6 +18,7 @@ export type WeightedAverageConfig = {
|
|
|
18
18
|
export declare class CellSummaryModule extends AdaptableModuleBase implements ICellSummaryModule {
|
|
19
19
|
cachedCellSummary: WeakMap<SelectedCellInfo<any>, CellSummmaryInfo>;
|
|
20
20
|
constructor(api: AdaptableApi);
|
|
21
|
+
isModuleAvailable(): boolean;
|
|
21
22
|
getViewAccessLevel(): AccessLevel;
|
|
22
23
|
createColumnMenuItems(column: AdaptableColumn): import("../Utilities/MenuItem").MenuItemShowPopup<"separator" | "calculated-column-edit" | "cell-summary-show" | "chart-show" | "column-group" | "column-filter-group" | "column-filter-bar-hide" | "column-filter-bar-show" | "column-filter-clear" | "column-filter-suspend" | "column-filter-unsuspend" | "column-info-show" | "custom-sort-add" | "custom-sort-edit" | "dashboard-group" | "dashboard-collapse" | "dashboard-configure" | "dashboard-dock" | "dashboard-expand" | "dashboard-float" | "dashboard-hide" | "dashboard-show" | "data-import" | "flashing-cell-add" | "flashing-cell-delete" | "format-column-add" | "format-column-edit" | "free-text-column-edit" | "grid-group" | "grid-info-show" | "layout-column-caption-change" | "layout-column-hide" | "layout-edit" | "layout-column-select" | "layout-column-select-preserve" | "layout-column-select-reset" | "layout-grid-select" | "plus-minus-add" | "settings-panel-open" | "styling-group" | "styled-column-badge-add" | "styled-column-badge-edit" | "styled-column-gradient-add" | "styled-column-gradient-edit" | "styled-column-percent-bar-add" | "styled-column-percent-bar-edit" | "styled-column-sparkline-add" | "styled-column-sparkline-edit" | "system-status-show" | "_navbar">[];
|
|
23
24
|
createContextMenuItems(menuContext: ContextMenuContext): import("../Utilities/MenuItem").MenuItemShowPopup<"calculated-column-edit" | "cell-summary-show" | "column-group" | "column-filter-group" | "column-filter-clear" | "column-filter-suspend" | "column-filter-unsuspend" | "column-info-show" | "dashboard-group" | "dashboard-collapse" | "dashboard-configure" | "dashboard-dock" | "dashboard-expand" | "dashboard-float" | "dashboard-hide" | "dashboard-show" | "data-import" | "grid-group" | "grid-info-show" | "layout-edit" | "settings-panel-open" | "system-status-show" | "menu-group" | "alert-clear" | "bulk-update-apply" | "column-filter-on-cell-value" | "comment-add" | "comment-remove" | "edit-group" | "export-group" | "export-all-data" | "export-all-data-excel-download" | "export-all-data-visualexcel-download" | "export-all-data-csv" | "export-all-data-csv-download" | "export-all-data-csv-clipboard" | "export-all-data-json" | "export-all-data-json-download" | "export-all-data-json-clipboard" | "export-current-layout" | "export-current-layout-excel-download" | "export-current-layout-visualexcel-download" | "export-current-layout-csv" | "export-current-layout-csv-download" | "export-current-layout-csv-clipboard" | "export-current-layout-json" | "export-current-layout-json-download" | "export-current-layout-json-clipboard" | "export-selected-data" | "export-selected-data-excel-download" | "export-selected-data-visualexcel-download" | "export-selected-data-csv" | "export-selected-data-csv-download" | "export-selected-data-csv-clipboard" | "export-selected-data-json" | "export-selected-data-json-download" | "export-selected-data-json-clipboard" | "fdc3-broadcast" | "fdc3-raise-intent" | "flashing-cell-clear" | "flashing-row-clear" | "layout-aggregated-view" | "layout-auto-size" | "layout-clear-selection" | "layout-select-all" | "note-add" | "note-remove" | "smart-edit-apply">[];
|
|
@@ -16,6 +16,9 @@ class CellSummaryModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
16
16
|
constructor(api) {
|
|
17
17
|
super(ModuleConstants.CellSummaryModuleId, ModuleConstants.CellSummaryFriendlyName, 'cells', 'CellSummaryPopup', 'See summary information on a group of numeric cells using multiple summary operations', api);
|
|
18
18
|
}
|
|
19
|
+
isModuleAvailable() {
|
|
20
|
+
return super.isModuleAvailable() && this.api.gridApi.isGridRangeSelectable();
|
|
21
|
+
}
|
|
19
22
|
getViewAccessLevel() {
|
|
20
23
|
return 'Full';
|
|
21
24
|
}
|
|
@@ -147,24 +147,26 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
147
147
|
this.api.columnApi.hideColumn(column.columnId);
|
|
148
148
|
}));
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
this.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.
|
|
150
|
+
if (this.api.gridApi.isGridRangeSelectable()) {
|
|
151
|
+
const hasExistingSelection = this.api.gridApi.getSelectedCellInfo()?.gridCells?.length;
|
|
152
|
+
if (hasExistingSelection) {
|
|
153
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select-preserve', 'Select Column (Preserve Selection)', 'select-fwd', () => {
|
|
154
|
+
this.api.columnApi.addColumnToSelection(column.columnId);
|
|
155
|
+
}));
|
|
156
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select-reset', 'Select Column (Reset Selection)', 'tab-unselected', () => {
|
|
157
|
+
this.api.columnApi.selectColumn(column.columnId);
|
|
158
|
+
}));
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-column-select', 'Select Column', 'tab-unselected', () => {
|
|
162
|
+
this.api.columnApi.selectColumn(column.columnId);
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-grid-select', 'Select Grid', 'select-all', () => {
|
|
166
|
+
this.api.gridApi.selectAll();
|
|
162
167
|
}));
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
|
-
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-grid-select', 'Select Grid', 'select-all', () => {
|
|
166
|
-
this.api.gridApi.selectAll();
|
|
167
|
-
}));
|
|
168
170
|
return returnColumnMenuItems;
|
|
169
171
|
}
|
|
170
172
|
createContextMenuItems(menuContext) {
|
|
@@ -183,9 +185,11 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
183
185
|
this.api.gridApi.deselectAll();
|
|
184
186
|
}));
|
|
185
187
|
}
|
|
186
|
-
|
|
187
|
-
this.
|
|
188
|
-
|
|
188
|
+
if (this.api.gridApi.isGridRangeSelectable()) {
|
|
189
|
+
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-select-all', 'Select Grid', 'select-all', () => {
|
|
190
|
+
this.api.gridApi.selectAll();
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
189
193
|
returnColumnMenuItems.push(this.createMenuItemClickFunction('layout-auto-size', 'Auto Size', 'arrow-expand', () => {
|
|
190
194
|
this.api.columnApi.autosizeAllColumns();
|
|
191
195
|
}));
|
|
@@ -12,6 +12,7 @@ export declare class PlusMinusModule extends AdaptableModuleBase implements IPlu
|
|
|
12
12
|
private shouldHandleKeyDown;
|
|
13
13
|
private adaptable;
|
|
14
14
|
constructor(api: AdaptableApi);
|
|
15
|
+
isModuleAvailable(): boolean;
|
|
15
16
|
getModuleAdaptableObjects(config?: LayoutExtendedConfig): AdaptableObject[];
|
|
16
17
|
getExplicitlyReferencedColumnIds(plusMinusNudge: PlusMinusNudge): string[];
|
|
17
18
|
getReferencedNamedQueryNames(plusMinusNudge: PlusMinusNudge): string[];
|
|
@@ -22,6 +22,9 @@ class PlusMinusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
22
22
|
this.shouldHandleKeyDown = false;
|
|
23
23
|
this.adaptable = api.internalApi.getAdaptableInstance();
|
|
24
24
|
}
|
|
25
|
+
isModuleAvailable() {
|
|
26
|
+
return super.isModuleAvailable() && this.api.gridApi.isGridRangeSelectable();
|
|
27
|
+
}
|
|
25
28
|
getModuleAdaptableObjects(config) {
|
|
26
29
|
return this.api.plusMinusApi.getAllPlusMinus(config);
|
|
27
30
|
}
|
|
@@ -40,11 +43,14 @@ class PlusMinusModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
40
43
|
return this.api.namedQueryApi.internalApi.getReferencedNamedQueryNames(plusMinusNudge.Rule?.BooleanExpression);
|
|
41
44
|
}
|
|
42
45
|
onAdaptableReady() {
|
|
43
|
-
|
|
44
|
-
this.shouldHandleKeyDown =
|
|
46
|
+
const hasPlusMinusNudges = ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(this.api.plusMinusApi.getAllPlusMinus());
|
|
47
|
+
this.shouldHandleKeyDown = this.isModuleAvailable() && hasPlusMinusNudges;
|
|
45
48
|
if (this.shouldHandleKeyDown) {
|
|
46
49
|
this.setupKeyDownListener();
|
|
47
50
|
}
|
|
51
|
+
else if (hasPlusMinusNudges && !this.api.gridApi.isGridRangeSelectable()) {
|
|
52
|
+
this.api.consoleWarn('Plus/Minus module is not available because AG Grid is not selectable');
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
setupKeyDownListener() {
|
|
50
56
|
this.adaptable._on('KeyDown', (keyDownEvent) => {
|
package/src/Utilities/only.d.ts
CHANGED
|
@@ -8,8 +8,11 @@ interface OnlyAggResult {
|
|
|
8
8
|
* AG Grid aggFunc that returns the column value only when all rows in the group
|
|
9
9
|
* share the same value. Returns null when values differ (or when there are no values).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* params.values already respects suppressAggFilteredOnly, containing either:
|
|
12
|
+
* - Raw cell values (string | number) for leaf children
|
|
13
|
+
* - OnlyAggResult objects for sub-group children (with pre-computed distinct values)
|
|
14
|
+
*
|
|
15
|
+
* Bails out early as soon as two distinct values are found.
|
|
13
16
|
*/
|
|
14
|
-
export declare const only: (params: IAggFuncParams
|
|
17
|
+
export declare const only: (params: IAggFuncParams) => OnlyAggResult;
|
|
15
18
|
export {};
|
package/src/Utilities/only.js
CHANGED
|
@@ -15,44 +15,30 @@ function createOnlyResult(distinctValues) {
|
|
|
15
15
|
* AG Grid aggFunc that returns the column value only when all rows in the group
|
|
16
16
|
* share the same value. Returns null when values differ (or when there are no values).
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* params.values already respects suppressAggFilteredOnly, containing either:
|
|
19
|
+
* - Raw cell values (string | number) for leaf children
|
|
20
|
+
* - OnlyAggResult objects for sub-group children (with pre-computed distinct values)
|
|
21
|
+
*
|
|
22
|
+
* Bails out early as soon as two distinct values are found.
|
|
20
23
|
*/
|
|
21
|
-
const only = (params
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const childNodes = (filteredOnly ? groupRowNode.childrenAfterFilter : groupRowNode.childrenAfterGroup) ?? [];
|
|
29
|
-
const distinctValues = new Set();
|
|
30
|
-
for (const rowNode of childNodes) {
|
|
31
|
-
const rawValue = gridApi.getCellValue({ colKey: columnId, rowNode });
|
|
32
|
-
if (typeof rawValue === 'number' || typeof rawValue === 'string') {
|
|
33
|
-
distinctValues.add(rawValue);
|
|
34
|
-
if (distinctValues.size > 1) {
|
|
35
|
-
return createOnlyResult(distinctValues);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
24
|
+
const only = (params) => {
|
|
25
|
+
const { values } = params;
|
|
26
|
+
const distinctValues = new Set();
|
|
27
|
+
for (let i = 0; i < values.length; i++) {
|
|
28
|
+
const value = values[i];
|
|
29
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
30
|
+
distinctValues.add(value);
|
|
38
31
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// `params.values` contains the OnlyAggResult objects they returned.
|
|
44
|
-
// We merge their distinctValues sets instead of re-traversing leaf rows.
|
|
45
|
-
const mergedDistinctValues = new Set();
|
|
46
|
-
for (const childResult of values) {
|
|
47
|
-
if (childResult && typeof childResult === 'object' && 'distinctValues' in childResult) {
|
|
48
|
-
for (const val of childResult.distinctValues) {
|
|
49
|
-
mergedDistinctValues.add(val);
|
|
50
|
-
if (mergedDistinctValues.size > 1) {
|
|
51
|
-
return createOnlyResult(mergedDistinctValues);
|
|
52
|
-
}
|
|
32
|
+
else if (value != null && typeof value === 'object' && 'distinctValues' in value) {
|
|
33
|
+
// sub-group: merge pre-computed distinct values (set has at most 2 elements)
|
|
34
|
+
for (const v of value.distinctValues) {
|
|
35
|
+
distinctValues.add(v);
|
|
53
36
|
}
|
|
54
37
|
}
|
|
38
|
+
if (distinctValues.size > 1) {
|
|
39
|
+
return createOnlyResult(distinctValues);
|
|
40
|
+
}
|
|
55
41
|
}
|
|
56
|
-
return createOnlyResult(
|
|
42
|
+
return createOnlyResult(distinctValues);
|
|
57
43
|
};
|
|
58
44
|
exports.only = only;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { IAggFuncParams } from 'ag-grid-enterprise';
|
|
2
2
|
export declare const getNumericValue: (input: unknown) => number | null;
|
|
3
|
+
/**
|
|
4
|
+
* Computes a weighted average aggregation: Σ(value × weight) / Σ(weight)
|
|
5
|
+
*
|
|
6
|
+
* AG Grid calls agg functions bottom-up through the group hierarchy. For each group:
|
|
7
|
+
* - Leaf children contribute their raw value × weight
|
|
8
|
+
* - Sub-group children already have partial sums from a previous pass,
|
|
9
|
+
* so we combine those directly instead of re-traversing to leaves
|
|
10
|
+
*
|
|
11
|
+
* The returned object stores partial sums ([columnId] and [weightColumnId])
|
|
12
|
+
* so parent groups can combine sub-group results correctly.
|
|
13
|
+
*/
|
|
3
14
|
export declare const weightedAverage: (params: IAggFuncParams, columnId: string, weightColumnId: string) => {
|
|
4
15
|
[x: string]: number | (() => string) | (() => number);
|
|
5
16
|
toString: () => string;
|