@adaptabletools/adaptable 12.1.7 → 12.1.8-canary.0
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/base.css +11 -49
- package/bundle.cjs.js +105 -105
- package/index.css +13 -60
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/FilterOptions.d.ts +12 -0
- package/src/AdaptableOptions/FinancePluginOptions.d.ts +22 -1
- package/src/AdaptableOptions/StateOptions.d.ts +25 -12
- package/src/Api/ColumnApi.d.ts +5 -0
- package/src/Api/ExportApi.d.ts +5 -0
- package/src/Api/FilterApi.d.ts +23 -0
- package/src/Api/GridApi.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +5 -0
- package/src/Api/Implementation/ExportApiImpl.d.ts +3 -1
- package/src/Api/Implementation/ExportApiImpl.js +19 -3
- package/src/Api/Implementation/FilterApiImpl.d.ts +5 -0
- package/src/Api/Implementation/FilterApiImpl.js +25 -2
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
- package/src/Api/Implementation/InternalApiImpl.js +0 -3
- package/src/Api/Implementation/PredicateApiImpl.js +4 -0
- package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -1
- package/src/Api/InternalApi.d.ts +0 -1
- package/src/PredefinedConfig/CalculatedColumnState.d.ts +2 -2
- package/src/PredefinedConfig/Common/AdaptablePredicate.js +16 -4
- package/src/PredefinedConfig/Common/AdaptableQuery.js +1 -1
- package/src/PredefinedConfig/Common/AggregationColumns.d.ts +6 -0
- package/src/PredefinedConfig/Common/AggregationColumns.js +4 -0
- package/src/PredefinedConfig/Common/ColumnFilter.d.ts +2 -2
- package/src/PredefinedConfig/Common/Enums.d.ts +0 -15
- package/src/PredefinedConfig/Common/Enums.js +1 -18
- package/src/PredefinedConfig/ExportState.d.ts +12 -4
- package/src/PredefinedConfig/LayoutState.d.ts +2 -1
- package/src/PredefinedConfig/PopupState.d.ts +1 -2
- package/src/Redux/ActionsReducers/AlertRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/AlertRedux.js +1 -1
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/ConditionalStyleRedux.js +1 -1
- package/src/Redux/ActionsReducers/CustomSortRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/CustomSortRedux.js +1 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/FlashingCellRedux.js +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/FormatColumnRedux.js +1 -1
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +28 -0
- package/src/Redux/ActionsReducers/LayoutRedux.js +80 -2
- package/src/Redux/ActionsReducers/PlusMinusRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/PlusMinusRedux.js +1 -1
- package/src/Redux/ActionsReducers/PopupRedux.d.ts +0 -2
- package/src/Redux/ActionsReducers/PopupRedux.js +1 -28
- package/src/Redux/ActionsReducers/ScheduleRedux.d.ts +5 -5
- package/src/Redux/ActionsReducers/ScheduleRedux.js +5 -5
- package/src/Redux/ActionsReducers/ShortcutRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/ShortcutRedux.js +1 -1
- package/src/Redux/Store/AdaptableStore.js +15 -6
- package/src/Strategy/AlertModule.d.ts +1 -0
- package/src/Strategy/AlertModule.js +20 -0
- package/src/Strategy/CalculatedColumnModule.js +2 -2
- package/src/Strategy/ExportModule.d.ts +0 -1
- package/src/Strategy/ExportModule.js +0 -16
- package/src/Strategy/FilterModule.js +6 -0
- package/src/Strategy/Interface/IModule.d.ts +4 -0
- package/src/Strategy/LayoutModule.js +20 -20
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +16 -1
- package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +15 -11
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +2 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +2 -0
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +12 -2
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +30 -66
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +22 -6
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +423 -220
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +7 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +23 -7
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.d.ts +0 -1
- package/src/Utilities/ExpressionFunctions/scalarAggregationHelper.js +6 -54
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +17 -5
- package/src/Utilities/Interface/MessagePopups.d.ts +0 -4
- package/src/Utilities/ObjectFactory.d.ts +4 -2
- package/src/Utilities/ObjectFactory.js +16 -3
- package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +25 -0
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +103 -0
- package/src/Utilities/Services/AlertService.d.ts +0 -1
- package/src/Utilities/Services/AlertService.js +5 -17
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +4 -4
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +29 -154
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +2 -2
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +6 -3
- package/src/Utilities/Services/QueryLanguageService.d.ts +6 -3
- package/src/Utilities/Services/QueryLanguageService.js +23 -6
- package/src/Utilities/Services/ReportService.js +47 -46
- package/src/View/AdaptableView.js +1 -2
- package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingsTags.d.ts +2 -0
- package/src/View/CalculatedColumn/Utilities/{getCalculatedColumnSettingTags.js → getCalculatedColumnSettingsTags.js} +3 -3
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.d.ts +10 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +80 -0
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +20 -11
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.d.ts +1 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -52
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +17 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +42 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +1 -1
- package/src/View/Components/EntityRulesEditor/index.js +26 -5
- package/src/View/Components/FilterForm/FilterForm.js +8 -4
- package/src/View/Components/FilterForm/ListBoxFilterForm.js +1 -0
- package/src/View/Components/FilterForm/QuickFilterForm.js +10 -6
- package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.d.ts +9 -0
- package/src/View/Components/PermittedValuesSelector/PermitedValuesSelector.js +28 -0
- package/src/View/Components/PermittedValuesSelector/index.d.ts +1 -0
- package/src/View/Components/PermittedValuesSelector/index.js +5 -0
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +2 -2
- package/src/View/Components/Popups/AdaptableToaster.js +2 -7
- package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
- package/src/View/Components/Popups/WindowPopups/windowFactory.js +1 -4
- package/src/View/Export/ExportViewPanel.d.ts +1 -2
- package/src/View/Export/ExportViewPanel.js +2 -6
- package/src/View/Export/Wizard/ReportColumnTypeWizard.d.ts +1 -2
- package/src/View/Export/Wizard/ReportColumnTypeWizard.js +11 -12
- package/src/View/Export/Wizard/ReportRowTypeWizard.d.ts +1 -2
- package/src/View/Export/Wizard/ReportRowTypeWizard.js +12 -13
- package/src/View/Export/Wizard/ReportSettingsWizard.js +1 -2
- package/src/View/Filter/FilterViewPanel.js +20 -4
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
- package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.d.ts +0 -0
- package/src/View/Layout/Wizard/{LayoutEditor → Components}/ColumnLabels.js +0 -0
- package/src/View/Layout/Wizard/LayoutWizard.js +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +69 -8
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/View/Query/QueryViewPanel.js +1 -1
- package/src/agGrid/Adaptable.d.ts +10 -3
- package/src/agGrid/Adaptable.js +211 -142
- package/src/agGrid/agGridHelper.d.ts +1 -0
- package/src/agGrid/agGridHelper.js +5 -3
- package/src/agGrid/agGridMenuHelper.d.ts +1 -0
- package/src/agGrid/agGridMenuHelper.js +4 -2
- package/src/agGrid/weightedAverage.d.ts +6 -0
- package/src/agGrid/weightedAverage.js +66 -0
- package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -0
- package/src/components/ExpressionEditor/BaseEditorInput.js +2 -3
- package/src/components/ExpressionEditor/EditorInput.d.ts +1 -1
- package/src/components/ExpressionEditor/EditorInput.js +24 -4
- package/src/components/ExpressionEditor/{EditorInputReactive.d.ts → EditorInputWithWhereClause.d.ts} +3 -3
- package/src/components/ExpressionEditor/{EditorInputReactive.js → EditorInputWithWhereClause.js} +6 -5
- package/src/components/ExpressionEditor/editorButtonsAggregatedBoolean.d.ts +2 -0
- package/src/components/ExpressionEditor/{editorButtonsReactive.js → editorButtonsAggregatedBoolean.js} +22 -37
- package/src/components/ExpressionEditor/editorButtonsAggregatedScalar.js +5 -10
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsCumulativeAggregatedScalar.js +50 -0
- package/src/components/ExpressionEditor/editorButtonsObservable.d.ts +2 -0
- package/src/components/ExpressionEditor/editorButtonsObservable.js +40 -0
- package/src/components/ExpressionEditor/index.d.ts +1 -1
- package/src/components/ExpressionEditor/index.js +26 -5
- package/src/metamodel/adaptable.metamodel.d.ts +55 -1
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +3 -3
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/src/View/CalculatedColumn/Utilities/getCalculatedColumnSettingTags.d.ts +0 -2
- package/src/View/Layout/LayoutEditorStandalonePopup.d.ts +0 -3
- package/src/View/Layout/LayoutEditorStandalonePopup.js +0 -78
- package/src/View/Layout/Wizard/LayoutEditor/ColumnList.d.ts +0 -27
- package/src/View/Layout/Wizard/LayoutEditor/ColumnList.js +0 -86
- package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.d.ts +0 -16
- package/src/View/Layout/Wizard/LayoutEditor/ColumnSortList.js +0 -89
- package/src/View/Layout/Wizard/LayoutEditor/PivotList.d.ts +0 -15
- package/src/View/Layout/Wizard/LayoutEditor/PivotList.js +0 -70
- package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.d.ts +0 -15
- package/src/View/Layout/Wizard/LayoutEditor/RowGroupsList.js +0 -70
- package/src/View/Layout/Wizard/LayoutEditor/droppableIds.d.ts +0 -7
- package/src/View/Layout/Wizard/LayoutEditor/droppableIds.js +0 -11
- package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.d.ts +0 -6
- package/src/View/Layout/Wizard/LayoutEditor/getItemStyle.js +0 -26
- package/src/View/Layout/Wizard/LayoutEditor/index.d.ts +0 -9
- package/src/View/Layout/Wizard/LayoutEditor/index.js +0 -367
- package/src/View/Layout/Wizard/LayoutEditor/reducer.d.ts +0 -28
- package/src/View/Layout/Wizard/LayoutEditor/reducer.js +0 -46
- package/src/View/Layout/Wizard/LayoutEditor/utils.d.ts +0 -10
- package/src/View/Layout/Wizard/LayoutEditor/utils.js +0 -14
- package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +0 -30
- package/src/View/Layout/Wizard/LayoutEditorWizard.js +0 -132
- package/src/components/ExpressionEditor/editorButtonsReactive.d.ts +0 -2
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -62,6 +62,8 @@ const StatusBarState_1 = require("../PredefinedConfig/StatusBarState");
|
|
|
62
62
|
const createAgStatusPanelComponent_1 = require("./createAgStatusPanelComponent");
|
|
63
63
|
const AdaptableStatusBar_1 = require("../View/StatusBar/AdaptableStatusBar");
|
|
64
64
|
const RowEditService_1 = require("../Utilities/Services/RowEditService");
|
|
65
|
+
const weightedAverage_1 = require("./weightedAverage");
|
|
66
|
+
const AggregationColumns_1 = require("../PredefinedConfig/Common/AggregationColumns");
|
|
65
67
|
const tinycolor = require('tinycolor2');
|
|
66
68
|
all_modules_1.ModuleRegistry.registerModules(all_modules_1.AllCommunityModules);
|
|
67
69
|
const GROUP_PATH_SEPARATOR = '/';
|
|
@@ -365,6 +367,7 @@ class Adaptable {
|
|
|
365
367
|
this.isInitialised = false;
|
|
366
368
|
this.useRowNodeLookUp = false; // we will set later in instantiate if possible to be true
|
|
367
369
|
this.forPlugins((plugin) => plugin.afterInitOptions(this, this.adaptableOptions));
|
|
370
|
+
this.registerAdaptableAggFuncs(adaptableOptions);
|
|
368
371
|
// get the api ready
|
|
369
372
|
this.api = new AdaptableApiImpl_1.AdaptableApiImpl(this);
|
|
370
373
|
this.forPlugins((plugin) => plugin.afterInitApi(this, this.api));
|
|
@@ -375,10 +378,13 @@ class Adaptable {
|
|
|
375
378
|
this.agGridMenuHelper = new agGridMenuHelper_1.agGridMenuHelper(this, this.gridOptions);
|
|
376
379
|
// Build the default group sort comparator - will get custom sort values (but not functions) in real time
|
|
377
380
|
// TODO: if a custom 'aggFunc' property is defined (see setupColumnAggFunc()), it won't be evaluated
|
|
378
|
-
if (
|
|
379
|
-
this.
|
|
380
|
-
|
|
381
|
-
|
|
381
|
+
if (this.adaptableOptions.columnOptions.autoOrderGroupedColumns) {
|
|
382
|
+
this.setGridOptionsProperty('initialGroupOrderComparator', (userPropertyValue) => {
|
|
383
|
+
if (userPropertyValue) {
|
|
384
|
+
return userPropertyValue;
|
|
385
|
+
}
|
|
386
|
+
return this.agGridHelper.runAdaptableGroupComparerFunction();
|
|
387
|
+
});
|
|
382
388
|
}
|
|
383
389
|
// we prefer the grid to be NOT instantiated so that we can do it
|
|
384
390
|
// perhaps in future we will force instantiation only?
|
|
@@ -571,15 +577,6 @@ class Adaptable {
|
|
|
571
577
|
}
|
|
572
578
|
if ((_a = this.adaptableOptions.generalOptions) === null || _a === void 0 ? void 0 : _a.hideEmptyGroupRows) {
|
|
573
579
|
LoggingHelper_1.ConsoleLogWarning(`DEPRECATED: 'GeneralOptions.hideEmptyGroupRows' is deprecated and will no longer be evaluated!`);
|
|
574
|
-
// disabled due to showstopper starting with AG Grid v26
|
|
575
|
-
// the internal implementation of AG Grids GroupCellRenderer has changed A LOT!
|
|
576
|
-
// this.gridOptions.components = this.gridOptions.components || {};
|
|
577
|
-
//
|
|
578
|
-
// this.gridOptions.autoGroupColumnDef = this.gridOptions.autoGroupColumnDef || {};
|
|
579
|
-
// if (!this.gridOptions.autoGroupColumnDef.cellRenderer) {
|
|
580
|
-
// this.gridOptions.autoGroupColumnDef.cellRenderer = '__adaptableGroupCellRenderer';
|
|
581
|
-
// this.gridOptions.components.__adaptableGroupCellRenderer = AdaptableGroupCellRenderer;
|
|
582
|
-
// }
|
|
583
580
|
}
|
|
584
581
|
const adaptableSideBarDef = this.createAdaptableSideBarDef();
|
|
585
582
|
if (!!adaptableSideBarDef) {
|
|
@@ -587,12 +584,9 @@ class Adaptable {
|
|
|
587
584
|
this.gridOptions.components.AdaptableToolPanel = AdaptableToolPanel_1.getAdaptableToolPanelAgGridComponent(this);
|
|
588
585
|
}
|
|
589
586
|
if (this.agGridHelper.isSideBarDefObject(adaptableSideBarDef)) {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
else {
|
|
594
|
-
this.gridOptions.sideBar = adaptableSideBarDef;
|
|
595
|
-
}
|
|
587
|
+
this.setGridOptionsProperty('sideBar', () => {
|
|
588
|
+
return adaptableSideBarDef;
|
|
589
|
+
});
|
|
596
590
|
this.hasAdaptableToolPanel = true;
|
|
597
591
|
}
|
|
598
592
|
this.createStatusBars();
|
|
@@ -720,24 +714,25 @@ class Adaptable {
|
|
|
720
714
|
}
|
|
721
715
|
}
|
|
722
716
|
createStatusBars() {
|
|
723
|
-
var _a, _b;
|
|
724
|
-
const statusBarOptions = Object.assign({}, this.gridOptions.statusBar);
|
|
725
717
|
const adaptableStatusPanelKeys = [];
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
718
|
+
this.setGridOptionsProperty('statusBar', (originalStatusBar) => {
|
|
719
|
+
var _a, _b;
|
|
720
|
+
const statusPanels = (_b = ((_a = originalStatusBar === null || originalStatusBar === void 0 ? void 0 : originalStatusBar.statusPanels) !== null && _a !== void 0 ? _a : [])) === null || _b === void 0 ? void 0 : _b.map((statusPanel) => {
|
|
721
|
+
if (statusPanel.statusPanel === StatusBarState_1.ADAPTABLE_STATUS_PANEL) {
|
|
722
|
+
adaptableStatusPanelKeys.push(statusPanel.key);
|
|
723
|
+
const context = {
|
|
724
|
+
Key: statusPanel.key,
|
|
725
|
+
};
|
|
726
|
+
return Object.assign(Object.assign({}, statusPanel), { statusPanel: createAgStatusPanelComponent_1.createAgStatusPanelComponent(AdaptableStatusBar_1.AdaptableStatusBar, this, context) });
|
|
727
|
+
}
|
|
728
|
+
return statusPanel;
|
|
729
|
+
});
|
|
730
|
+
return Object.assign(Object.assign({}, originalStatusBar), { statusPanels });
|
|
735
731
|
});
|
|
736
|
-
statusBarOptions.statusPanels = statusPanels;
|
|
737
|
-
this.gridOptions.statusBar = statusBarOptions;
|
|
738
732
|
const statusBarModule = this.ModuleService.getModuleById(ModuleConstants.StatusBarModuleId);
|
|
739
733
|
this.api.eventApi.on('AdaptableReady', () => {
|
|
740
|
-
|
|
734
|
+
var _a, _b;
|
|
735
|
+
const adaptableStatusPanels = (_b = (_a = this.gridOptions.statusBar) === null || _a === void 0 ? void 0 : _a.statusPanels) === null || _b === void 0 ? void 0 : _b.filter((statusPanel) => adaptableStatusPanelKeys.includes(statusPanel.key));
|
|
741
736
|
// need to add only the adaptable panels
|
|
742
737
|
statusBarModule.syncStateWithOptions(adaptableStatusPanels);
|
|
743
738
|
});
|
|
@@ -1331,15 +1326,25 @@ class Adaptable {
|
|
|
1331
1326
|
newColState.aggFunc = null;
|
|
1332
1327
|
if (aggregationFunctionsColumnsMap[colId] != null) {
|
|
1333
1328
|
const colDef = (_b = (_a = this.gridOptions) === null || _a === void 0 ? void 0 : _a.api) === null || _b === void 0 ? void 0 : _b.getColumnDef(colId);
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
:
|
|
1329
|
+
let aggFunc = null;
|
|
1330
|
+
const aggFuncFromLayout = aggregationFunctionsColumnsMap[colId];
|
|
1331
|
+
const adaptableAggFunc = this.getActiveAdaptableAggFuncForCol(colId);
|
|
1332
|
+
if (aggFuncFromLayout === true) {
|
|
1333
|
+
// if we have true, it means - take the default aggFunc from colDef
|
|
1334
|
+
// NOTE: colState gives us the current aggFunc, which can be null,
|
|
1335
|
+
// while the colDef gives us the initially configured aggFunc for that column
|
|
1336
|
+
aggFunc =
|
|
1337
|
+
(_e = (_d = (_c = colState.aggFunc) !== null && _c !== void 0 ? _c : colDef === null || colDef === void 0 ? void 0 : colDef.aggFunc) !== null && _d !== void 0 ? _d :
|
|
1338
|
+
// @ts-ignore available only wth ag-Grid v27.3.x
|
|
1339
|
+
colDef === null || colDef === void 0 ? void 0 : colDef.defaultAggFunc) !== null && _e !== void 0 ? _e : 'sum';
|
|
1340
|
+
}
|
|
1341
|
+
else if (adaptableAggFunc && adaptableAggFunc.type === 'weightedAverage') {
|
|
1342
|
+
aggFunc = AggregationColumns_1.WEIGHTED_AVERAGE_AGG_FN_NAME;
|
|
1343
|
+
}
|
|
1344
|
+
else if (typeof aggFuncFromLayout === 'string') {
|
|
1345
|
+
aggFunc = aggFuncFromLayout;
|
|
1346
|
+
}
|
|
1347
|
+
newColState.aggFunc = aggFunc;
|
|
1343
1348
|
}
|
|
1344
1349
|
if (sortModelMap[colId]) {
|
|
1345
1350
|
newColState.sort = sortModelMap[colId].sort;
|
|
@@ -1524,7 +1529,8 @@ class Adaptable {
|
|
|
1524
1529
|
layout.ColumnSorts = columnSorts;
|
|
1525
1530
|
layout.RowGroupedColumns = groupedColumns;
|
|
1526
1531
|
if (Object.keys(aggregatedColumns).length) {
|
|
1527
|
-
|
|
1532
|
+
// ag-grid aggregations are not 1-1 with adaptable column-aggregations
|
|
1533
|
+
layout.AggregationColumns = this.handleUpdateWeightedAvgFromGrid(aggregatedColumns);
|
|
1528
1534
|
}
|
|
1529
1535
|
layout.EnablePivot = this.gridOptions.columnApi.isPivotMode();
|
|
1530
1536
|
layout.PivotColumns = pivotColumns;
|
|
@@ -2028,7 +2034,9 @@ class Adaptable {
|
|
|
2028
2034
|
getAllRowNodes(config) {
|
|
2029
2035
|
let rowNodes = [];
|
|
2030
2036
|
this.gridOptions.api.forEachNode((rowNode, rowIndex) => {
|
|
2031
|
-
|
|
2037
|
+
const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
|
|
2038
|
+
const filterFnFulfilled = !(config === null || config === void 0 ? void 0 : config.filterFn) || (config === null || config === void 0 ? void 0 : config.filterFn(rowNode));
|
|
2039
|
+
if (includeGroupRows && filterFnFulfilled) {
|
|
2032
2040
|
rowNodes.push(rowNode);
|
|
2033
2041
|
}
|
|
2034
2042
|
});
|
|
@@ -2186,10 +2194,31 @@ class Adaptable {
|
|
|
2186
2194
|
return newColDef;
|
|
2187
2195
|
});
|
|
2188
2196
|
}
|
|
2189
|
-
setupColumnValueGetter({ col }) {
|
|
2190
|
-
// need this here if we want plugins to intercept
|
|
2197
|
+
setupColumnValueGetter({ col, abColumn }) {
|
|
2191
2198
|
this.setColDefProperty(col, 'valueGetter', (userValue) => {
|
|
2192
|
-
return
|
|
2199
|
+
return (params) => {
|
|
2200
|
+
const columnId = abColumn.columnId;
|
|
2201
|
+
let evaluatedUserValue = userValue;
|
|
2202
|
+
if (typeof userValue === 'function') {
|
|
2203
|
+
evaluatedUserValue = userValue(params);
|
|
2204
|
+
}
|
|
2205
|
+
const defaultValue = evaluatedUserValue
|
|
2206
|
+
? evaluatedUserValue
|
|
2207
|
+
: (params === null || params === void 0 ? void 0 : params.data)
|
|
2208
|
+
? params.data[columnId]
|
|
2209
|
+
: undefined;
|
|
2210
|
+
const adaptableAggFunc = this.getActiveAdaptableAggFuncForCol(columnId);
|
|
2211
|
+
if (adaptableAggFunc && adaptableAggFunc.type === 'weightedAverage' && !params.node.group) {
|
|
2212
|
+
const weightedColumnId = adaptableAggFunc.weightedColumnId;
|
|
2213
|
+
return {
|
|
2214
|
+
[columnId]: defaultValue,
|
|
2215
|
+
[weightedColumnId]: params.data[weightedColumnId],
|
|
2216
|
+
toString: () => (defaultValue ? `${defaultValue}` : ''),
|
|
2217
|
+
valueOf: () => defaultValue,
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
return defaultValue;
|
|
2221
|
+
};
|
|
2193
2222
|
});
|
|
2194
2223
|
}
|
|
2195
2224
|
setupColumnAggFunc({ col }) {
|
|
@@ -2377,39 +2406,6 @@ class Adaptable {
|
|
|
2377
2406
|
this.safeSetColDefs(resultColDefs);
|
|
2378
2407
|
this.setLayout();
|
|
2379
2408
|
}
|
|
2380
|
-
cleanupFloatingFilters_WORKAROUND() {
|
|
2381
|
-
// since AG Grid v26.2.0 floating filters have a memory leak due to an dangling reference to an obsolete agSetFilter instance
|
|
2382
|
-
var _a, _b;
|
|
2383
|
-
// 1a. The initial floating filter component is defaulted to the 'agSetColumnFloatingFilter'
|
|
2384
|
-
// (see https://github.com/ag-grid/ag-grid/blob/v26.2.0/community-modules/core/src/ts/headerRendering/cells/floatingFilter/headerFilterCellCtrl.ts#L210) and a corresponding bean component is instantiated.
|
|
2385
|
-
// 1b. A listener to the 'filterChanged' event is created, referencing the newly created bean instance: https://github.com/ag-grid/ag-grid/blob/v26.2.0/community-modules/core/src/ts/headerRendering/cells/floatingFilter/headerFilterCellCtrl.ts#L298
|
|
2386
|
-
// 2a. The floating filter is set to a custom component (via https://www.ag-grid.com/javascript-data-grid/column-properties/#reference-filtering-floatingFilterComponent), triggering the creation of a new floating filter bean component
|
|
2387
|
-
// 2b. Another listener to the 'filterChanged' event is created, referencing the newly created (in step 2a) bean instance https://github.com/ag-grid/ag-grid/blob/v26.2.0/community-modules/core/src/ts/headerRendering/cells/floatingFilter/headerFilterCellCtrl.ts#L298
|
|
2388
|
-
// BUT the listener created in step 1b is NOT destroyed, leading to a state where the 'filterChanged' event has listeners stemming from both the current floating filter bean but also from the initial(now obsolete) bean
|
|
2389
|
-
//
|
|
2390
|
-
// As a consequence, any 'filterChanged' event will be processed by both listeners (1b, 2b) and will more often than not lead to a runtime exception due to the dangling references from the obsolete listener
|
|
2391
|
-
// AG Grid team tracks this issue in AG-6179
|
|
2392
|
-
// until a fix arrives, a workaround is to hide all the visible columns (thus destroying all the HeaderFilterCellCtrl instances)
|
|
2393
|
-
if (!((_b = (_a = this.adaptableOptions) === null || _a === void 0 ? void 0 : _a.filterOptions) === null || _b === void 0 ? void 0 : _b.useAdaptableQuickFilter)) {
|
|
2394
|
-
// no need to do anything if we don't use adaptable quick filter
|
|
2395
|
-
return;
|
|
2396
|
-
}
|
|
2397
|
-
if (this.gridOptions.columnApi.isPivotMode()) {
|
|
2398
|
-
// floating filters are NOT available in pivot mode
|
|
2399
|
-
return;
|
|
2400
|
-
}
|
|
2401
|
-
// floating filter instances (HeaderFilterCellCtrl) are created only for rendered columns (in viewport)
|
|
2402
|
-
// so we have to handle only the displayed columns
|
|
2403
|
-
const allDisplayedCols = this.gridOptions.columnApi.getAllDisplayedColumns();
|
|
2404
|
-
const colsWithFloatingFilter = allDisplayedCols.filter((col) => {
|
|
2405
|
-
const colDef = col.getColDef();
|
|
2406
|
-
return (colDef.floatingFilter ||
|
|
2407
|
-
colDef.floatingFilterComponent ||
|
|
2408
|
-
this.api.columnApi.usesAdaptableQuickFilter(col.getColId()));
|
|
2409
|
-
});
|
|
2410
|
-
colsWithFloatingFilter.forEach((col) => this.gridOptions.columnApi.setColumnsVisible(colsWithFloatingFilter, false));
|
|
2411
|
-
// !! it is important to NOT set the columns visible again as this is already taken care of in the next performed method (this.updateColDefsForSpecialColumns())
|
|
2412
|
-
}
|
|
2413
2409
|
getColDefsForCalculatedColumns() {
|
|
2414
2410
|
const defaultCalculatedColumnSettings = ObjectFactory_1.CreateEmptyCalculatedColumn().CalculatedColumnSettings;
|
|
2415
2411
|
const isExternalEvaluation = !this.api.internalApi.runModuleInAdaptableQL('CalculatedColumn');
|
|
@@ -2540,7 +2536,22 @@ class Adaptable {
|
|
|
2540
2536
|
this.throttleFilterOnTickingDataChange = null;
|
|
2541
2537
|
this.gridOptions.api.__adaptable = null;
|
|
2542
2538
|
this.gridOptions.api.setColumnDefs = GridApi_setColumnDefs;
|
|
2543
|
-
this.
|
|
2539
|
+
this.revertGridOptionsPropertiesToUserValue([
|
|
2540
|
+
'getRowStyle',
|
|
2541
|
+
'getRowClass',
|
|
2542
|
+
'excelStyles',
|
|
2543
|
+
'suppressAggFuncInHeader',
|
|
2544
|
+
'initialGroupOrderComparator',
|
|
2545
|
+
'getContextMenuItems',
|
|
2546
|
+
'getMainMenuItems',
|
|
2547
|
+
'isExternalFilterPresent',
|
|
2548
|
+
'doesExternalFilterPass',
|
|
2549
|
+
'statusBar',
|
|
2550
|
+
'sideBar',
|
|
2551
|
+
]);
|
|
2552
|
+
if (this.gridOptions.components) {
|
|
2553
|
+
this.gridOptions.components.AdaptableToolPanel = null;
|
|
2554
|
+
}
|
|
2544
2555
|
if (config && config.destroyApi === false) {
|
|
2545
2556
|
}
|
|
2546
2557
|
else {
|
|
@@ -2560,6 +2571,8 @@ class Adaptable {
|
|
|
2560
2571
|
this.emitter.destroy();
|
|
2561
2572
|
this.emitter = null;
|
|
2562
2573
|
this._adaptableReady = false;
|
|
2574
|
+
this.agGridHelper.destroy();
|
|
2575
|
+
this.agGridMenuHelper.destroy();
|
|
2563
2576
|
Adaptable.dismissInstance(this);
|
|
2564
2577
|
const abContainerElement = this.getAdaptableContainerElement();
|
|
2565
2578
|
if (config && !config.unmount) {
|
|
@@ -2894,74 +2907,76 @@ class Adaptable {
|
|
|
2894
2907
|
},
|
|
2895
2908
|
};
|
|
2896
2909
|
// We plug our filter mechanism and if there is already something like external widgets... we save ref to the function
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2910
|
+
this.setGridOptionsProperty('isExternalFilterPresent', (originalIsExternalFilterPresent) => {
|
|
2911
|
+
return (params) => {
|
|
2912
|
+
if (this.isDestroyed) {
|
|
2913
|
+
return true;
|
|
2914
|
+
}
|
|
2915
|
+
const columnFilters = this.api.filterApi.getActiveColumnFilters();
|
|
2916
|
+
const isFilterActive = ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(columnFilters);
|
|
2917
|
+
const isQueryActive = StringExtensions_1.StringExtensions.IsNotNullOrEmpty(this.api.queryApi.getCurrentQuery());
|
|
2918
|
+
return (isFilterActive ||
|
|
2919
|
+
isQueryActive ||
|
|
2920
|
+
// it means that originalIsExternalFilterPresent will be called so we reinit that collection
|
|
2921
|
+
(originalIsExternalFilterPresent ? originalIsExternalFilterPresent(params) : false));
|
|
2922
|
+
};
|
|
2923
|
+
});
|
|
2911
2924
|
const evaluateQueryOnClient = this.api.internalApi.runModuleInAdaptableQL('Query');
|
|
2912
2925
|
const evaluateFilterOnClient = this.api.internalApi.runModuleInAdaptableQL('Filter');
|
|
2913
|
-
this.
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
!
|
|
2924
|
-
.
|
|
2925
|
-
|
|
2926
|
-
|
|
2926
|
+
this.setGridOptionsProperty('doesExternalFilterPass', (originalDoesExternalFilterPass) => {
|
|
2927
|
+
return (node) => {
|
|
2928
|
+
if (this.isDestroyed) {
|
|
2929
|
+
return true;
|
|
2930
|
+
}
|
|
2931
|
+
// first we assess Query (if its running locally)
|
|
2932
|
+
if (evaluateQueryOnClient && !this.isGroupRowNode(node)) {
|
|
2933
|
+
const currentQuery = this.api.queryApi.getCurrentQuery();
|
|
2934
|
+
if (currentQuery) {
|
|
2935
|
+
const isCurrentQueryValid = this.api.queryLanguageApi.isValidBooleanExpression(currentQuery, ModuleConstants_1.QueryModuleId, `Invalid CurrentQuery '${currentQuery}'`);
|
|
2936
|
+
if (!isCurrentQueryValid ||
|
|
2937
|
+
!this.api.internalApi
|
|
2938
|
+
.getQueryLanguageService()
|
|
2939
|
+
.evaluateBooleanExpression(currentQuery, ModuleConstants_1.QueryModuleId, node)) {
|
|
2940
|
+
return false;
|
|
2941
|
+
}
|
|
2927
2942
|
}
|
|
2928
2943
|
}
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2944
|
+
try {
|
|
2945
|
+
// we then assess filters (if running locally)
|
|
2946
|
+
if (evaluateFilterOnClient) {
|
|
2947
|
+
const columnFilters = this.api.filterApi.getActiveColumnFilters();
|
|
2948
|
+
if (columnFilters.length > 0) {
|
|
2949
|
+
for (const columnFilter of columnFilters) {
|
|
2950
|
+
if (!this.api.filterApi.evaluateColumnFilter(columnFilter, node)) {
|
|
2951
|
+
return false;
|
|
2952
|
+
}
|
|
2938
2953
|
}
|
|
2939
2954
|
}
|
|
2940
2955
|
}
|
|
2941
2956
|
}
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
};
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
};
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
};
|
|
2957
|
+
catch (ex) {
|
|
2958
|
+
LoggingHelper_1.LogAdaptableError(ex);
|
|
2959
|
+
return false;
|
|
2960
|
+
}
|
|
2961
|
+
return originalDoesExternalFilterPass ? originalDoesExternalFilterPass(node) : true;
|
|
2962
|
+
};
|
|
2963
|
+
});
|
|
2964
|
+
this.setGridOptionsProperty('getMainMenuItems', (userPropertyValue) => {
|
|
2965
|
+
return (params) => {
|
|
2966
|
+
// couldnt find a way to listen for menu close. There is a Menu Item Select, but you can also close menu from filter and clicking outside menu....
|
|
2967
|
+
return this.agGridMenuHelper.buildColumnMenu(params, userPropertyValue);
|
|
2968
|
+
};
|
|
2969
|
+
});
|
|
2970
|
+
this.setGridOptionsProperty('getContextMenuItems', (userPropertyValue) => {
|
|
2971
|
+
return (params) => {
|
|
2972
|
+
return this.agGridMenuHelper.buildContextMenu(params, userPropertyValue);
|
|
2973
|
+
};
|
|
2974
|
+
});
|
|
2960
2975
|
this.prepareGrid();
|
|
2961
2976
|
}
|
|
2962
2977
|
updateColumnFilterActiveState() {
|
|
2963
2978
|
var _a;
|
|
2964
|
-
const columnFilters = this.api.filterApi.
|
|
2979
|
+
const columnFilters = this.api.filterApi.getActiveColumnFilters();
|
|
2965
2980
|
const activeFilters = (_a = columnFilters === null || columnFilters === void 0 ? void 0 : columnFilters.filter) === null || _a === void 0 ? void 0 : _a.call(columnFilters, (columnFilter) => this.api.filterApi.isFilterActive(columnFilter));
|
|
2966
2981
|
const isFilterActive = ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(activeFilters);
|
|
2967
2982
|
const columnsWithActiveFilters = {};
|
|
@@ -3043,6 +3058,7 @@ class Adaptable {
|
|
|
3043
3058
|
this.setupColumnCellEditor(colSetupInfo);
|
|
3044
3059
|
this.setupColumnHeader(colSetupInfo);
|
|
3045
3060
|
this.setupColumnQuickFilerText(colSetupInfo);
|
|
3061
|
+
this.setupAllowedAggFuncs(colSetupInfo);
|
|
3046
3062
|
});
|
|
3047
3063
|
this.setupRowStyling();
|
|
3048
3064
|
// setupAggregationColumnHeaders() is executed on every setLayout()
|
|
@@ -3052,6 +3068,14 @@ class Adaptable {
|
|
|
3052
3068
|
this.redrawBody();
|
|
3053
3069
|
this.redrawHeader();
|
|
3054
3070
|
}
|
|
3071
|
+
revertGridOptionsPropertiesToUserValue(propertyNames) {
|
|
3072
|
+
for (const propertyName of propertyNames) {
|
|
3073
|
+
// see this.setGridOptionsProperty(...)
|
|
3074
|
+
const userKey = `user.${propertyName}`;
|
|
3075
|
+
const userValue = this.gridOptionsPropertyCache.get(userKey);
|
|
3076
|
+
this.gridOptions[propertyName] = userValue;
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3055
3079
|
setGridOptionsProperty(propertyName, propertyGetter) {
|
|
3056
3080
|
if (this.isDestroyed) {
|
|
3057
3081
|
return;
|
|
@@ -3290,6 +3314,11 @@ class Adaptable {
|
|
|
3290
3314
|
};
|
|
3291
3315
|
});
|
|
3292
3316
|
}
|
|
3317
|
+
setupAllowedAggFuncs({ col, abColumn }) {
|
|
3318
|
+
this.setColDefProperty(col, 'allowedAggFuncs', () => {
|
|
3319
|
+
return abColumn.availableAggregationFunctions;
|
|
3320
|
+
});
|
|
3321
|
+
}
|
|
3293
3322
|
setupColumnHeader({ col, abColumn }) {
|
|
3294
3323
|
var _a, _b;
|
|
3295
3324
|
const previousColumnHeader = (_a = col === null || col === void 0 ? void 0 : col.getColDef()) === null || _a === void 0 ? void 0 : _a.headerName;
|
|
@@ -3487,11 +3516,6 @@ class Adaptable {
|
|
|
3487
3516
|
applyCurrentTheme() {
|
|
3488
3517
|
this.api.themeApi.applyCurrentTheme();
|
|
3489
3518
|
}
|
|
3490
|
-
getInitialGroupOrderComparator(gridOptions) {
|
|
3491
|
-
var _a, _b;
|
|
3492
|
-
// fallback to deprecated forms
|
|
3493
|
-
return ((_b = (_a = gridOptions.initialGroupOrderComparator) !== null && _a !== void 0 ? _a : gridOptions.defaultGroupOrderComparator) !== null && _b !== void 0 ? _b : gridOptions.defaultGroupSortComparator);
|
|
3494
|
-
}
|
|
3495
3519
|
applyFinalRendering() {
|
|
3496
3520
|
this.embedColumnMenu = this.isModulePresent('menu');
|
|
3497
3521
|
if (this.gridOptions.treeData && this.gridOptions.treeData == true) {
|
|
@@ -4625,6 +4649,51 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
|
|
|
4625
4649
|
}
|
|
4626
4650
|
return this.gridOptions.api.getChartModels();
|
|
4627
4651
|
}
|
|
4652
|
+
getActiveAdaptableAggFuncForCol(columnId) {
|
|
4653
|
+
if (!columnId) {
|
|
4654
|
+
return null;
|
|
4655
|
+
}
|
|
4656
|
+
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
4657
|
+
const aggregationFunctionsColumnsMap = currentLayout.AggregationColumns || {};
|
|
4658
|
+
const adaptableAggFunc = aggregationFunctionsColumnsMap[columnId];
|
|
4659
|
+
if (typeof adaptableAggFunc === 'object' &&
|
|
4660
|
+
'type' in adaptableAggFunc &&
|
|
4661
|
+
adaptableAggFunc.type === 'weightedAverage') {
|
|
4662
|
+
return adaptableAggFunc;
|
|
4663
|
+
}
|
|
4664
|
+
return null;
|
|
4665
|
+
}
|
|
4666
|
+
registerAdaptableAggFuncs(adaptableOptions) {
|
|
4667
|
+
adaptableOptions.gridOptions.aggFuncs = this.adaptableOptions.gridOptions.aggFuncs || {};
|
|
4668
|
+
adaptableOptions.gridOptions.aggFuncs[AggregationColumns_1.WEIGHTED_AVERAGE_AGG_FN_NAME] = (params) => {
|
|
4669
|
+
const columnId = params.column.getColId();
|
|
4670
|
+
const adaptableAggFunc = this.getActiveAdaptableAggFuncForCol(columnId);
|
|
4671
|
+
if (!adaptableAggFunc) {
|
|
4672
|
+
return undefined;
|
|
4673
|
+
}
|
|
4674
|
+
if (adaptableAggFunc.type === 'weightedAverage') {
|
|
4675
|
+
return weightedAverage_1.weightedAverage(params, params.colDef.colId, adaptableAggFunc.weightedColumnId);
|
|
4676
|
+
}
|
|
4677
|
+
return undefined;
|
|
4678
|
+
};
|
|
4679
|
+
}
|
|
4680
|
+
/**
|
|
4681
|
+
* When reading the state from the grid, we have to make sure 'avg' is not overriden with the 'avg' string.
|
|
4682
|
+
*/
|
|
4683
|
+
handleUpdateWeightedAvgFromGrid(aggFuncFromGrid) {
|
|
4684
|
+
const currentLayout = this.api.layoutApi.getCurrentLayout();
|
|
4685
|
+
return Object.entries(aggFuncFromGrid).reduce((acc, [colId, agg]) => {
|
|
4686
|
+
const adaptableAggFunc = this.getActiveAdaptableAggFuncForCol(colId);
|
|
4687
|
+
if ((adaptableAggFunc === null || adaptableAggFunc === void 0 ? void 0 : adaptableAggFunc.type) === 'weightedAverage' && agg === AggregationColumns_1.WEIGHTED_AVERAGE_AGG_FN_NAME) {
|
|
4688
|
+
// do not override the agg func
|
|
4689
|
+
acc[colId] = currentLayout.AggregationColumns[colId];
|
|
4690
|
+
}
|
|
4691
|
+
else {
|
|
4692
|
+
acc[colId] = agg;
|
|
4693
|
+
}
|
|
4694
|
+
return acc;
|
|
4695
|
+
}, {});
|
|
4696
|
+
}
|
|
4628
4697
|
}
|
|
4629
4698
|
exports.Adaptable = Adaptable;
|
|
4630
4699
|
class AdaptableNoCodeWizard {
|
|
@@ -16,6 +16,7 @@ export declare class agGridHelper {
|
|
|
16
16
|
private gridOptions;
|
|
17
17
|
private initialAgGridColDefs;
|
|
18
18
|
constructor(adaptable: IAdaptable, gridOptions: GridOptions);
|
|
19
|
+
destroy(): void;
|
|
19
20
|
getAgGridLightThemeName(): string;
|
|
20
21
|
getAgGridDarkThemeName(): string;
|
|
21
22
|
setUpModules(): Map<AdaptableModule, IModule>;
|
|
@@ -41,8 +41,8 @@ const PercentBarRenderer_1 = require("./PercentBarRenderer");
|
|
|
41
41
|
const Helper_1 = require("../Utilities/Helpers/Helper");
|
|
42
42
|
const StatusBarModule_1 = require("../Strategy/StatusBarModule");
|
|
43
43
|
const GeneralConstants = tslib_1.__importStar(require("../Utilities/Constants/GeneralConstants"));
|
|
44
|
-
const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
|
|
45
44
|
const GeneralConstants_1 = require("../Utilities/Constants/GeneralConstants");
|
|
45
|
+
const UIHelper_1 = tslib_1.__importDefault(require("../View/UIHelper"));
|
|
46
46
|
const tinycolor = require('tinycolor2');
|
|
47
47
|
/**
|
|
48
48
|
* Adaptable AG Grid implementation is getting really big and unwieldy
|
|
@@ -55,8 +55,10 @@ class agGridHelper {
|
|
|
55
55
|
this.adaptable = adaptable;
|
|
56
56
|
this.gridOptions = gridOptions;
|
|
57
57
|
this.initialAgGridColDefs = {};
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
}
|
|
59
|
+
destroy() {
|
|
60
|
+
this.adaptable = null;
|
|
61
|
+
this.gridOptions = null;
|
|
60
62
|
}
|
|
61
63
|
getAgGridLightThemeName() {
|
|
62
64
|
// we try not to call these two methods, as we try to detect the default grid
|
|
@@ -6,6 +6,7 @@ export declare class agGridMenuHelper {
|
|
|
6
6
|
private adaptable;
|
|
7
7
|
private gridOptions;
|
|
8
8
|
constructor(adaptable: IAdaptable, gridOptions: GridOptions);
|
|
9
|
+
destroy(): void;
|
|
9
10
|
buildColumnMenu(params: GetMainMenuItemsParams, originalgetMainMenuItems: GetMainMenuItems): (string | MenuItemDef)[];
|
|
10
11
|
buildContextMenu(params: GetContextMenuItemsParams, originalgetContextMenuItems: GetContextMenuItems): (string | MenuItemDef)[];
|
|
11
12
|
createRemoveGroupsMenuItem(x: AdaptableMenuItem): MenuItemDef;
|
|
@@ -11,8 +11,10 @@ class agGridMenuHelper {
|
|
|
11
11
|
constructor(adaptable, gridOptions) {
|
|
12
12
|
this.adaptable = adaptable;
|
|
13
13
|
this.gridOptions = gridOptions;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
}
|
|
15
|
+
destroy() {
|
|
16
|
+
this.adaptable = null;
|
|
17
|
+
this.gridOptions = null;
|
|
16
18
|
}
|
|
17
19
|
buildColumnMenu(params, originalgetMainMenuItems) {
|
|
18
20
|
// couldnt find a way to listen for menu close. There is a Menu Item Select, but you can also close menu from filter and clicking outside menu....
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IAggFuncParams } from '@ag-grid-community/all-modules';
|
|
2
|
+
export declare const weightedAverage: (params: IAggFuncParams, columnId: string, weightColumnId: string) => {
|
|
3
|
+
[x: string]: number | (() => number | "");
|
|
4
|
+
toString: () => number | "";
|
|
5
|
+
valueOf: () => number;
|
|
6
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.weightedAverage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const StringExtensions_1 = tslib_1.__importDefault(require("../Utilities/Extensions/StringExtensions"));
|
|
6
|
+
const weightedAverage = (params, columnId, weightColumnId) => {
|
|
7
|
+
let weightedColumnValueSum = 0;
|
|
8
|
+
let columnValueSum = 0;
|
|
9
|
+
params.values.forEach((value) => {
|
|
10
|
+
if (!value) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// when editing values become string
|
|
14
|
+
const rawColumnValue = value[columnId];
|
|
15
|
+
if (typeof rawColumnValue === 'object') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const columnValue = StringExtensions_1.default.IsNotNullOrEmpty(rawColumnValue)
|
|
19
|
+
? Number(value[columnId])
|
|
20
|
+
: null;
|
|
21
|
+
const rawWeightedColumnValue = value[weightColumnId];
|
|
22
|
+
if (typeof rawWeightedColumnValue === 'object') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const weightedColumnValue = StringExtensions_1.default.IsNotNullOrEmpty(rawWeightedColumnValue)
|
|
26
|
+
? Number(value[weightColumnId])
|
|
27
|
+
: null;
|
|
28
|
+
if (params.rowNode.leafGroup) {
|
|
29
|
+
if (weightedColumnValue !== null) {
|
|
30
|
+
weightedColumnValueSum += weightedColumnValue;
|
|
31
|
+
}
|
|
32
|
+
if (columnValue !== null && weightedColumnValue !== null) {
|
|
33
|
+
columnValueSum += weightedColumnValue * columnValue;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (weightedColumnValue !== null) {
|
|
38
|
+
weightedColumnValueSum += weightedColumnValue;
|
|
39
|
+
}
|
|
40
|
+
if (columnValue !== null) {
|
|
41
|
+
columnValueSum += columnValue;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
toString: () => {
|
|
47
|
+
const rez = columnValueSum / weightedColumnValueSum;
|
|
48
|
+
// 0 / 0 = NaN
|
|
49
|
+
if (isNaN(rez)) {
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
return rez;
|
|
53
|
+
},
|
|
54
|
+
valueOf: () => {
|
|
55
|
+
const rez = columnValueSum / weightedColumnValueSum;
|
|
56
|
+
// 0 / 0 = NaN
|
|
57
|
+
if (isNaN(rez)) {
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
return rez;
|
|
61
|
+
},
|
|
62
|
+
[columnId]: columnValueSum,
|
|
63
|
+
[weightColumnId]: weightedColumnValueSum,
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
exports.weightedAverage = weightedAverage;
|
|
@@ -2,6 +2,7 @@ import { ExpressionFunction, ExpressionFunctionMap } from '../../parser/src/type
|
|
|
2
2
|
import { AdaptableApi } from '../../Api/AdaptableApi';
|
|
3
3
|
import { CSSProperties } from 'react';
|
|
4
4
|
interface BaseEditorInputProps {
|
|
5
|
+
type: 'main' | 'secondary';
|
|
5
6
|
value: string;
|
|
6
7
|
onChange: (value: string) => void;
|
|
7
8
|
disabled?: boolean;
|