@adaptabletools/adaptable 24.0.1 → 24.0.3
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/devtools.d.ts +506 -5
- package/devtools.js +11 -1
- package/index.css +15 -5
- package/package.json +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +6 -1
- package/src/AdaptableOptions/DataImportOptions.d.ts +1 -1
- package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
- package/src/AdaptableState/Common/AdaptableFormat.d.ts +2 -10
- package/src/AdaptableState/Common/RowSummary.d.ts +2 -0
- package/src/AdaptableState/LayoutState.d.ts +1 -1
- package/src/Api/Implementation/AlertApiImpl.js +2 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +25 -3
- package/src/Api/Internal/ExportInternalApi.d.ts +2 -0
- package/src/Api/Internal/ExportInternalApi.js +39 -3
- package/src/Api/Internal/FormatColumnInternalApi.d.ts +3 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +15 -7
- package/src/Api/Internal/LayoutInternalApi.d.ts +11 -1
- package/src/Api/Internal/LayoutInternalApi.js +34 -3
- package/src/Api/Internal/NoteInternalApi.d.ts +12 -0
- package/src/Api/Internal/NoteInternalApi.js +11 -0
- package/src/EnvVars.d.ts +1 -0
- package/src/EnvVars.js +1 -0
- package/src/Redux/Store/AdaptableStore.js +4 -7
- package/src/Strategy/FlashingCellModule.js +2 -0
- package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +1 -0
- package/src/Utilities/Services/CalculatedColumnExpressionService.js +15 -0
- package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +7 -0
- package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +17 -1
- package/src/Utilities/Services/QueryLanguageService.d.ts +11 -1
- package/src/Utilities/Services/QueryLanguageService.js +47 -2
- package/src/Utilities/Services/RowSummaryService.d.ts +2 -0
- package/src/Utilities/Services/RowSummaryService.js +6 -1
- package/src/Utilities/license/instanceLicense.d.ts +12 -0
- package/src/Utilities/license/instanceLicense.js +10 -0
- package/src/Utilities/license/licenseStatus.d.ts +26 -0
- package/src/Utilities/license/licenseStatus.js +72 -0
- package/src/View/Components/CellPopup/index.js +15 -10
- package/src/View/GridInfo/GridInfoPopup.js +6 -1
- package/src/View/Layout/TransposedPopup.js +1 -0
- package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +3 -5
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +10 -24
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -1
- package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.d.ts +5 -1
- package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.js +6 -3
- package/src/agGrid/AdaptableAgGrid.d.ts +7 -3
- package/src/agGrid/AdaptableAgGrid.js +144 -78
- package/src/agGrid/AdaptableFilterHandler.d.ts +2 -0
- package/src/agGrid/AdaptableFilterHandler.js +34 -0
- package/src/agGrid/AgGridAdapter.d.ts +9 -0
- package/src/agGrid/AgGridAdapter.js +23 -12
- package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
- package/src/agGrid/AgGridColumnAdapter.js +124 -78
- package/src/agGrid/AgGridExportAdapter.d.ts +5 -0
- package/src/agGrid/AgGridExportAdapter.js +31 -0
- package/src/agGrid/AgGridMenuAdapter.js +1 -1
- package/src/agGrid/applyGlobalGridOptions.d.ts +9 -0
- package/src/agGrid/applyGlobalGridOptions.js +36 -0
- package/src/agGrid/cellRenderers/BadgeRenderer.js +22 -0
- package/src/agGrid/columnMinMaxCache.d.ts +33 -0
- package/src/agGrid/columnMinMaxCache.js +50 -0
- package/src/devTools/PerfStore.d.ts +218 -0
- package/src/devTools/PerfStore.js +717 -0
- package/src/devTools/index.d.ts +33 -0
- package/src/devTools/index.js +132 -56
- package/src/devTools/logBuffer.d.ts +17 -0
- package/src/devTools/logBuffer.js +33 -0
- package/src/devTools/memoryInfo.d.ts +15 -0
- package/src/devTools/memoryInfo.js +229 -0
- package/src/devTools/memoryRoots.d.ts +41 -0
- package/src/devTools/memoryRoots.js +136 -0
- package/src/devTools/perfContext.d.ts +5 -0
- package/src/devTools/perfContext.js +155 -0
- package/src/devTools/perfInstrumentation.d.ts +13 -0
- package/src/devTools/perfInstrumentation.js +78 -0
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +3 -1
- package/src/layout-manager/src/expandAllRowGroups.d.ts +6 -0
- package/src/layout-manager/src/expandAllRowGroups.js +13 -0
- package/src/layout-manager/src/index.js +18 -10
- package/src/setupDevTools.js +560 -106
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/vendor/aql/api/QueryLanguageApi.d.ts +2 -1
- package/vendor/aql/api/QueryLanguageApi.d.ts.map +1 -1
- package/vendor/aql/api/QueryLanguageApi.js +28 -108
- package/vendor/aql/api/QueryLanguageApi.js.map +1 -1
- package/vendor/aql/contract/index.js +0 -34
- package/vendor/aql/contract/index.js.map +1 -1
- package/vendor/aql/corpus/corpusExpressions.js +0 -13
- package/vendor/aql/corpus/corpusExpressions.js.map +1 -1
- package/vendor/aql/corpus/corpusFixture.js +0 -7
- package/vendor/aql/corpus/corpusFixture.js.map +1 -1
- package/vendor/aql/draft/index.js +0 -4
- package/vendor/aql/draft/index.js.map +1 -1
- package/vendor/aql/evaluate.js +0 -22
- package/vendor/aql/evaluate.js.map +1 -1
- package/vendor/aql/evaluator/ExpressionEvaluationError.js +0 -4
- package/vendor/aql/evaluator/ExpressionEvaluationError.js.map +1 -1
- package/vendor/aql/evaluator/ExpressionNaError.js +0 -4
- package/vendor/aql/evaluator/ExpressionNaError.js.map +1 -1
- package/vendor/aql/evaluator/evaluateNode.js +0 -23
- package/vendor/aql/evaluator/evaluateNode.js.map +1 -1
- package/vendor/aql/functions/dateUtils.js +0 -63
- package/vendor/aql/functions/dateUtils.js.map +1 -1
- package/vendor/aql/functions/numberUtils.js +0 -12
- package/vendor/aql/functions/numberUtils.js.map +1 -1
- package/vendor/aql/functions/operatorFunctions.js +0 -13
- package/vendor/aql/functions/operatorFunctions.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/AND.js +0 -5
- package/vendor/aql/functions/scalar/functions/AND.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/ANY_CHANGE.js +0 -4
- package/vendor/aql/functions/scalar/functions/ANY_CHANGE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/ANY_CONTAINS.js +0 -4
- package/vendor/aql/functions/scalar/functions/ANY_CONTAINS.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/AVG.js +0 -1
- package/vendor/aql/functions/scalar/functions/AVG.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/CASE.js +2 -2
- package/vendor/aql/functions/scalar/functions/CASE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/COL.js +0 -2
- package/vendor/aql/functions/scalar/functions/COL.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/CONTAINS.js +0 -3
- package/vendor/aql/functions/scalar/functions/CONTAINS.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/DATE.js +0 -2
- package/vendor/aql/functions/scalar/functions/DATE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/ENDS_WITH.js +0 -1
- package/vendor/aql/functions/scalar/functions/ENDS_WITH.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/EQ.js +0 -5
- package/vendor/aql/functions/scalar/functions/EQ.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/GT.js +0 -3
- package/vendor/aql/functions/scalar/functions/GT.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/GTE.js +0 -3
- package/vendor/aql/functions/scalar/functions/GTE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IF.js +0 -5
- package/vendor/aql/functions/scalar/functions/IF.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IFERROR.js +0 -4
- package/vendor/aql/functions/scalar/functions/IFERROR.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IFNA.js +0 -5
- package/vendor/aql/functions/scalar/functions/IFNA.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IN.d.ts.map +1 -1
- package/vendor/aql/functions/scalar/functions/IN.js +54 -11
- package/vendor/aql/functions/scalar/functions/IN.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IS_BLANK.js +0 -1
- package/vendor/aql/functions/scalar/functions/IS_BLANK.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IS_DIFFERENT_DAY.js +0 -1
- package/vendor/aql/functions/scalar/functions/IS_DIFFERENT_DAY.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/IS_NOT_BLANK.js +0 -1
- package/vendor/aql/functions/scalar/functions/IS_NOT_BLANK.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/LT.js +0 -3
- package/vendor/aql/functions/scalar/functions/LT.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/LTE.js +0 -3
- package/vendor/aql/functions/scalar/functions/LTE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/NA.js +0 -3
- package/vendor/aql/functions/scalar/functions/NA.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/NOT_CONTAINS.js +0 -1
- package/vendor/aql/functions/scalar/functions/NOT_CONTAINS.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/NOT_IN.js +0 -3
- package/vendor/aql/functions/scalar/functions/NOT_IN.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/OR.js +0 -4
- package/vendor/aql/functions/scalar/functions/OR.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/PRODUCT.js +0 -6
- package/vendor/aql/functions/scalar/functions/PRODUCT.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/QUERY.js +0 -1
- package/vendor/aql/functions/scalar/functions/QUERY.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/REGEX.js +0 -1
- package/vendor/aql/functions/scalar/functions/REGEX.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/SCOPE.js +0 -4
- package/vendor/aql/functions/scalar/functions/SCOPE.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/STARTS_WITH.js +0 -1
- package/vendor/aql/functions/scalar/functions/STARTS_WITH.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/SUB.js +0 -1
- package/vendor/aql/functions/scalar/functions/SUB.js.map +1 -1
- package/vendor/aql/functions/scalar/functions/SUM.js +0 -5
- package/vendor/aql/functions/scalar/functions/SUM.js.map +1 -1
- package/vendor/aql/functions/scalar/helpers.js +0 -3
- package/vendor/aql/functions/scalar/helpers.js.map +1 -1
- package/vendor/aql/functions/shared/FIELD.js +0 -3
- package/vendor/aql/functions/shared/FIELD.js.map +1 -1
- package/vendor/aql/functions/shared/VAR.js +0 -4
- package/vendor/aql/functions/shared/VAR.js.map +1 -1
- package/vendor/aql/functions/shared/index.js +0 -9
- package/vendor/aql/functions/shared/index.js.map +1 -1
- package/vendor/aql/functions/stringUtils.js +0 -25
- package/vendor/aql/functions/stringUtils.js.map +1 -1
- package/vendor/aql/functions/utils.js +0 -20
- package/vendor/aql/functions/utils.js.map +1 -1
- package/vendor/aql/host/access.js +0 -2
- package/vendor/aql/host/access.js.map +1 -1
- package/vendor/aql/host/createHostExpressionContext.js +0 -25
- package/vendor/aql/host/createHostExpressionContext.js.map +1 -1
- package/vendor/aql/host/createObjectDataHost.js +0 -9
- package/vendor/aql/host/createObjectDataHost.js.map +1 -1
- package/vendor/aql/index.js +0 -2
- package/vendor/aql/index.js.map +1 -1
- package/vendor/aql/normalize/canonicalize.js +0 -7
- package/vendor/aql/normalize/canonicalize.js.map +1 -1
- package/vendor/aql/normalize/migrateExpression.js +0 -8
- package/vendor/aql/normalize/migrateExpression.js.map +1 -1
- package/vendor/aql/normalize/names.js +0 -72
- package/vendor/aql/normalize/names.js.map +1 -1
- package/vendor/aql/normalize/normalizeAst.js +0 -102
- package/vendor/aql/normalize/normalizeAst.js.map +1 -1
- package/vendor/aql/normalize/print.js +0 -35
- package/vendor/aql/normalize/print.js.map +1 -1
- package/vendor/aql/operator/primitiveSlots.js +0 -4
- package/vendor/aql/operator/primitiveSlots.js.map +1 -1
- package/vendor/aql/operator/resolve.js +0 -18
- package/vendor/aql/operator/resolve.js.map +1 -1
- package/vendor/aql/parser/parser.js +4 -125
- package/vendor/aql/parser/parser.js.map +1 -1
- package/vendor/aql/plan/catalogue.js +0 -35
- package/vendor/aql/plan/catalogue.js.map +1 -1
- package/vendor/aql/plan/compile.js +0 -68
- package/vendor/aql/plan/compile.js.map +1 -1
- package/vendor/aql/plan/deepMap.js +0 -16
- package/vendor/aql/plan/deepMap.js.map +1 -1
- package/vendor/aql/plan/execute.js +0 -91
- package/vendor/aql/plan/execute.js.map +1 -1
- package/vendor/aql/plan/magnitudeLiteral.js +0 -29
- package/vendor/aql/plan/magnitudeLiteral.js.map +1 -1
- package/vendor/aql/plan/observable.js +0 -31
- package/vendor/aql/plan/observable.js.map +1 -1
- package/vendor/aql/plan/observableFixture.js +0 -3
- package/vendor/aql/plan/observableFixture.js.map +1 -1
- package/vendor/aql/plan/operators.js +0 -35
- package/vendor/aql/plan/operators.js.map +1 -1
- package/vendor/aql/plan/outer.js +0 -16
- package/vendor/aql/plan/outer.js.map +1 -1
- package/vendor/aql/predicate/mapExpressionToQlPredicate.js +1 -46
- package/vendor/aql/predicate/mapExpressionToQlPredicate.js.map +1 -1
- package/vendor/aql/predicate/mapQlPredicateToExpression.js +0 -13
- package/vendor/aql/predicate/mapQlPredicateToExpression.js.map +1 -1
- package/vendor/aql/store/computedValueStore.js +0 -35
- package/vendor/aql/store/computedValueStore.js.map +1 -1
- package/vendor/aql/store/history/clock.js +0 -1
- package/vendor/aql/store/history/clock.js.map +1 -1
- package/vendor/aql/store/history/historyStore.js +0 -14
- package/vendor/aql/store/history/historyStore.js.map +1 -1
- package/vendor/aql/store/history/monotonicDeque.js +0 -9
- package/vendor/aql/store/history/monotonicDeque.js.map +1 -1
- package/vendor/aql/store/history/operators.js +0 -13
- package/vendor/aql/store/history/operators.js.map +1 -1
- package/vendor/aql/store/history/ringBuffer.js +0 -12
- package/vendor/aql/store/history/ringBuffer.js.map +1 -1
- package/vendor/aql/store/history/rowSeries.js +0 -17
- package/vendor/aql/store/history/rowSeries.js.map +1 -1
- package/vendor/aql/store/history/types.js +0 -18
- package/vendor/aql/store/history/types.js.map +1 -1
- package/vendor/aql/tokenizer/tokenizer.js +0 -3
- package/vendor/aql/tokenizer/tokenizer.js.map +1 -1
- package/vendor/aql/types.js +0 -27
- package/vendor/aql/types.js.map +1 -1
- package/vendor/aql/utils/astUtils.js +0 -1
- package/vendor/aql/utils/astUtils.js.map +1 -1
- package/vendor/aql/utils/dependencyCycle.js +0 -5
- package/vendor/aql/utils/dependencyCycle.js.map +1 -1
- package/vendor/aql/validation/classifyExpression.js +0 -4
- package/vendor/aql/validation/classifyExpression.js.map +1 -1
- package/vendor/aql/validation/functionMetadata.js +0 -31
- package/vendor/aql/validation/functionMetadata.js.map +1 -1
- package/vendor/aql/validation/validateAqlExpression.js +2 -81
- package/vendor/aql/validation/validateAqlExpression.js.map +1 -1
- package/vendor/aql/validation/validateExpressionTypes.js +0 -64
- package/vendor/aql/validation/validateExpressionTypes.js.map +1 -1
- package/vendor/components/Button/index.js +0 -6
- package/vendor/components/Button/index.js.map +1 -1
- package/vendor/components/ColorField/index.js +0 -18
- package/vendor/components/ColorField/index.js.map +1 -1
- package/vendor/components/ColorPicker/colorPickerTab.js +0 -6
- package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -1
- package/vendor/components/ColorPicker/index.js +1 -66
- package/vendor/components/ColorPicker/index.js.map +1 -1
- package/vendor/components/ColorPicker/themeColors.js +0 -55
- package/vendor/components/ColorPicker/themeColors.js.map +1 -1
- package/vendor/components/Combobox/VirtualizedList.js +0 -5
- package/vendor/components/Combobox/VirtualizedList.js.map +1 -1
- package/vendor/components/Combobox/comboboxUtils.js +0 -5
- package/vendor/components/Combobox/comboboxUtils.js.map +1 -1
- package/vendor/components/Combobox/index.js +7 -106
- package/vendor/components/Combobox/index.js.map +1 -1
- package/vendor/components/Combobox/useScrollNearEnd.js +0 -6
- package/vendor/components/Combobox/useScrollNearEnd.js.map +1 -1
- package/vendor/components/DropdownButton/index.js +0 -5
- package/vendor/components/DropdownButton/index.js.map +1 -1
- package/vendor/components/NumberInput/index.js +0 -10
- package/vendor/components/NumberInput/index.js.map +1 -1
- package/vendor/components/Radio/index.d.ts.map +1 -1
- package/vendor/components/Radio/index.js +1 -1
- package/vendor/components/Radio/index.js.map +1 -1
- package/vendor/components/Resizable/index.d.ts +14 -9
- package/vendor/components/Resizable/index.d.ts.map +1 -1
- package/vendor/components/Resizable/index.js +26 -26
- package/vendor/components/Resizable/index.js.map +1 -1
- package/vendor/components/Resizable/resizableUtils.d.ts +24 -13
- package/vendor/components/Resizable/resizableUtils.d.ts.map +1 -1
- package/vendor/components/Resizable/resizableUtils.js +13 -27
- package/vendor/components/Resizable/resizableUtils.js.map +1 -1
- package/vendor/components/SearchInput/index.js +0 -5
- package/vendor/components/SearchInput/index.js.map +1 -1
- package/vendor/components/Tree/TreeDropdown/index.js +3 -139
- package/vendor/components/Tree/TreeDropdown/index.js.map +1 -1
- package/vendor/components/Tree/treeUtils.js +0 -4
- package/vendor/components/Tree/treeUtils.js.map +1 -1
- package/vendor/components/index.css +12 -5
- package/vendor/components/index.js +0 -5
- package/vendor/components/index.js.map +1 -1
- package/vendor/components/lib/useProperty.js +0 -18
- package/vendor/components/lib/useProperty.js.map +1 -1
- package/vendor/components/twMerge.js +0 -2
- package/vendor/components/twMerge.js.map +1 -1
- package/vendor/components/twUtils.js +3 -12
- package/vendor/components/twUtils.js.map +1 -1
- package/vendor/components/ui/alert-dialog.js +0 -4
- package/vendor/components/ui/alert-dialog.js.map +1 -1
- package/vendor/components/ui/calendar.js +1 -9
- package/vendor/components/ui/calendar.js.map +1 -1
- package/vendor/components/ui/combobox.js +3 -39
- package/vendor/components/ui/combobox.js.map +1 -1
- package/vendor/components/ui/dialog.js +0 -4
- package/vendor/components/ui/dialog.js.map +1 -1
- package/vendor/components/ui/input-group.js +3 -12
- package/vendor/components/ui/input-group.js.map +1 -1
- package/vendor/components/ui/input.js +1 -1
- package/vendor/components/ui/input.js.map +1 -1
- package/vendor/components/ui/select.js +1 -1
- package/vendor/components/ui/select.js.map +1 -1
- package/vendor/components/ui/tabs.js +0 -3
- package/vendor/components/ui/tabs.js.map +1 -1
- package/vendor/components/ui/textarea.js +1 -1
- package/vendor/components/ui/textarea.js.map +1 -1
- package/vendor/components/ui/tooltip.d.ts.map +1 -1
- package/vendor/components/ui/tooltip.js +3 -1
- package/vendor/components/ui/tooltip.js.map +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getPerfRecorder } from '../devTools/PerfStore';
|
|
1
2
|
import { kebabCase } from '../Utilities/Extensions/StringExtensions';
|
|
2
3
|
import { resolveDisplayFormat } from '../AdaptableState/Common/AdaptableFormatPresets';
|
|
3
4
|
import { merge } from '../Utilities/Extensions/ObjectExtensions';
|
|
@@ -71,6 +72,13 @@ const STABLE_CALLBACK_COL_DEF_PROPERTIES = new Set([
|
|
|
71
72
|
'cellEditorParams',
|
|
72
73
|
'suppressNoteActions',
|
|
73
74
|
]);
|
|
75
|
+
const PERF_HOT_PATH_KINDS = {
|
|
76
|
+
cellStyle: 'cellStyle',
|
|
77
|
+
cellClass: 'cellClass',
|
|
78
|
+
valueFormatter: 'valueFormatter',
|
|
79
|
+
comparator: 'comparator',
|
|
80
|
+
getQuickFilterText: 'quickFilterText',
|
|
81
|
+
};
|
|
74
82
|
export function getEditorForColumnDataType(columnDataType, variant) {
|
|
75
83
|
if (columnDataType === 'number') {
|
|
76
84
|
return variant === 'react' ? AdaptableReactNumberEditor : AdaptableNumberEditor;
|
|
@@ -175,6 +183,10 @@ export class AgGridColumnAdapter {
|
|
|
175
183
|
this.stableCallbackImplementations.set(key, implementation);
|
|
176
184
|
let stableCallback = this.stableCallbacks.get(key);
|
|
177
185
|
if (!stableCallback) {
|
|
186
|
+
const perfKind = PERF_HOT_PATH_KINDS[propertyName];
|
|
187
|
+
const perfKey = perfKind ? `${perfKind}:${colId}` : '';
|
|
188
|
+
const describePerf = () => ({ columnId: colId });
|
|
189
|
+
const adaptableId = this.adaptableInstance?.adaptableOptions?.adaptableId;
|
|
178
190
|
stableCallback = (...args) => {
|
|
179
191
|
if (!this.adaptableInstance || this.adaptableInstance.isDestroyed) {
|
|
180
192
|
const userValue = this.colDefPropertyCache?.get(`user.${colId}.${propertyName}`);
|
|
@@ -183,7 +195,20 @@ export class AgGridColumnAdapter {
|
|
|
183
195
|
}
|
|
184
196
|
return userValue;
|
|
185
197
|
}
|
|
186
|
-
|
|
198
|
+
const implementation = this.stableCallbackImplementations?.get(key);
|
|
199
|
+
if (perfKind && implementation) {
|
|
200
|
+
const recorder = getPerfRecorder(adaptableId);
|
|
201
|
+
if (recorder) {
|
|
202
|
+
const start = performance.now();
|
|
203
|
+
try {
|
|
204
|
+
return implementation(...args);
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
recorder.add(perfKind, perfKey, start, describePerf);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return implementation?.(...args);
|
|
187
212
|
};
|
|
188
213
|
this.stableCallbacks.set(key, stableCallback);
|
|
189
214
|
this.stableCallbackOwners.set(stableCallback, { colId, propertyName });
|
|
@@ -677,101 +702,122 @@ export class AgGridColumnAdapter {
|
|
|
677
702
|
});
|
|
678
703
|
}
|
|
679
704
|
setupColumnTooltip({ col, colId, abColumn }) {
|
|
680
|
-
|
|
681
|
-
this.setColDefProperty(col, 'tooltip', () => {
|
|
705
|
+
this.setColDefProperty(col, 'tooltip', (userTooltip) => {
|
|
682
706
|
const styledColumn = this.adaptableApi.styledColumnApi.getStyledColumnForColumnId(colId);
|
|
683
707
|
if (!styledColumn || styledColumn.IsSuspended) {
|
|
684
708
|
return undefined;
|
|
685
709
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
return undefined;
|
|
690
|
-
}
|
|
691
|
-
hasTooptip = true;
|
|
692
|
-
return (params) => {
|
|
693
|
-
const parts = [];
|
|
694
|
-
if (iconTokens.includes('CellValue')) {
|
|
695
|
-
parts.push(String(params.value ?? ''));
|
|
696
|
-
}
|
|
697
|
-
if (iconTokens.includes('IconDescription')) {
|
|
698
|
-
const matched = findIconStyleMappingForValue(styledColumn.IconStyle, params.value);
|
|
699
|
-
if (matched?.Description) {
|
|
700
|
-
parts.push(matched.Description);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
const trimmed = parts.filter(Boolean).join(' · ').trim();
|
|
704
|
-
return trimmed ? trimmed : String(params.value ?? '');
|
|
705
|
-
};
|
|
710
|
+
const styledColumnTooltip = this.getStyledColumnTooltip(styledColumn, abColumn);
|
|
711
|
+
if (!styledColumnTooltip) {
|
|
712
|
+
return undefined;
|
|
706
713
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
return
|
|
714
|
+
return (params) => {
|
|
715
|
+
if (params.node &&
|
|
716
|
+
!shouldRenderStyledColumnOnRow(styledColumn, params.node, this.adaptableApi)) {
|
|
717
|
+
return this.resolveColDefTooltip(userTooltip, params);
|
|
711
718
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
const tooltipStyle = styledColumn.PercentBarStyle ??
|
|
733
|
-
styledColumn.BulletChartStyle ??
|
|
734
|
-
styledColumn.GradientStyle ??
|
|
735
|
-
styledColumn.RangeBarStyle;
|
|
736
|
-
const textOptions = tooltipStyle?.ToolTipText;
|
|
737
|
-
if (!tooltipStyle || !textOptions || textOptions.length === 0) {
|
|
719
|
+
return styledColumnTooltip(params);
|
|
720
|
+
};
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
resolveColDefTooltip(userTooltip, params) {
|
|
724
|
+
if (typeof userTooltip === 'function') {
|
|
725
|
+
return userTooltip(params);
|
|
726
|
+
}
|
|
727
|
+
if (typeof userTooltip === 'string') {
|
|
728
|
+
return userTooltip;
|
|
729
|
+
}
|
|
730
|
+
if (userTooltip === true) {
|
|
731
|
+
return params.valueFormatted ?? params.value;
|
|
732
|
+
}
|
|
733
|
+
return undefined;
|
|
734
|
+
}
|
|
735
|
+
getStyledColumnTooltip(styledColumn, abColumn) {
|
|
736
|
+
if (styledColumn.IconStyle && !isUnsupportedColumnDataTypeForIconStyle(abColumn.dataType)) {
|
|
737
|
+
const iconTokens = styledColumn.IconStyle.ToolTipText ?? [];
|
|
738
|
+
if (iconTokens.length === 0) {
|
|
738
739
|
return undefined;
|
|
739
740
|
}
|
|
740
|
-
hasTooptip = true;
|
|
741
741
|
return (params) => {
|
|
742
|
-
const
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
if (isRangeBar) {
|
|
746
|
-
const rangeStyle = styledColumn.RangeBarStyle;
|
|
747
|
-
min = this.resolveRangeBarBound(rangeStyle.Min, abColumn, params.node);
|
|
748
|
-
max = this.resolveRangeBarBound(rangeStyle.Max, abColumn, params.node);
|
|
742
|
+
const parts = [];
|
|
743
|
+
if (iconTokens.includes('CellValue')) {
|
|
744
|
+
parts.push(String(params.value ?? ''));
|
|
749
745
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
746
|
+
if (iconTokens.includes('IconDescription')) {
|
|
747
|
+
const matched = findIconStyleMappingForValue(styledColumn.IconStyle, params.value);
|
|
748
|
+
if (matched?.Description) {
|
|
749
|
+
parts.push(matched.Description);
|
|
750
|
+
}
|
|
753
751
|
}
|
|
752
|
+
const trimmed = parts.filter(Boolean).join(' · ').trim();
|
|
753
|
+
return trimmed ? trimmed : String(params.value ?? '');
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
if (styledColumn.RatingStyle) {
|
|
757
|
+
const ratingToolTip = styledColumn.RatingStyle.ToolTipText ?? [];
|
|
758
|
+
if (ratingToolTip.length === 0) {
|
|
759
|
+
return undefined;
|
|
760
|
+
}
|
|
761
|
+
const ratingMax = styledColumn.RatingStyle.Max ?? 5;
|
|
762
|
+
return (params) => {
|
|
754
763
|
let returnValue = '';
|
|
755
|
-
if (
|
|
764
|
+
if (ratingToolTip.includes('CellValue')) {
|
|
756
765
|
returnValue = String(params.value ?? '');
|
|
757
766
|
}
|
|
758
|
-
if (
|
|
759
|
-
|
|
760
|
-
if (
|
|
761
|
-
const
|
|
762
|
-
percentageValue =
|
|
767
|
+
if (ratingToolTip.includes('PercentageValue') && ratingMax > 0) {
|
|
768
|
+
const n = Number(params.value);
|
|
769
|
+
if (!isNaN(n)) {
|
|
770
|
+
const clamped = clamp(n, 0, ratingMax);
|
|
771
|
+
const percentageValue = (clamped / ratingMax) * 100;
|
|
772
|
+
const pct = `${percentageValue.toFixed(0)}%`;
|
|
773
|
+
returnValue = returnValue ? `${returnValue} (${pct})` : pct;
|
|
763
774
|
}
|
|
764
|
-
else {
|
|
765
|
-
const scaleSpan = max - min;
|
|
766
|
-
const clamped = clamp(Number(params.value), min, max);
|
|
767
|
-
percentageValue = scaleSpan === 0 ? 0 : ((clamped - min) / scaleSpan) * 100;
|
|
768
|
-
}
|
|
769
|
-
returnValue += ` (${percentageValue.toFixed(0)}%)`;
|
|
770
775
|
}
|
|
771
776
|
const trimmed = returnValue.trim();
|
|
772
777
|
return trimmed ? trimmed : String(params.value ?? '');
|
|
773
778
|
};
|
|
774
|
-
}
|
|
779
|
+
}
|
|
780
|
+
const tooltipStyle = styledColumn.PercentBarStyle ??
|
|
781
|
+
styledColumn.BulletChartStyle ??
|
|
782
|
+
styledColumn.GradientStyle ??
|
|
783
|
+
styledColumn.RangeBarStyle;
|
|
784
|
+
const textOptions = tooltipStyle?.ToolTipText;
|
|
785
|
+
if (!tooltipStyle || !textOptions || textOptions.length === 0) {
|
|
786
|
+
return undefined;
|
|
787
|
+
}
|
|
788
|
+
return (params) => {
|
|
789
|
+
const isRangeBar = tooltipStyle === styledColumn.RangeBarStyle;
|
|
790
|
+
let min;
|
|
791
|
+
let max;
|
|
792
|
+
if (isRangeBar) {
|
|
793
|
+
const rangeStyle = styledColumn.RangeBarStyle;
|
|
794
|
+
min = this.resolveRangeBarBound(rangeStyle.Min, abColumn, params.node);
|
|
795
|
+
max = this.resolveRangeBarBound(rangeStyle.Max, abColumn, params.node);
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
min = this.adaptableApi.styledColumnApi.internalApi.getNumericStyleMinValue(styledColumn, abColumn, params.node, params.value);
|
|
799
|
+
max = this.adaptableApi.styledColumnApi.internalApi.getNumericStyleMaxValue(styledColumn, abColumn, params.node, params.value);
|
|
800
|
+
}
|
|
801
|
+
let returnValue = '';
|
|
802
|
+
if (textOptions.includes('CellValue')) {
|
|
803
|
+
returnValue = String(params.value ?? '');
|
|
804
|
+
}
|
|
805
|
+
if (textOptions.includes('PercentageValue') && min != undefined && max != undefined) {
|
|
806
|
+
let percentageValue;
|
|
807
|
+
if (styledColumn.PercentBarStyle?.ColumnComparison) {
|
|
808
|
+
const absMax = Math.abs(max);
|
|
809
|
+
percentageValue = absMax === 0 ? 0 : (Number(params.value) / absMax) * 100;
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
const scaleSpan = max - min;
|
|
813
|
+
const clamped = clamp(Number(params.value), min, max);
|
|
814
|
+
percentageValue = scaleSpan === 0 ? 0 : ((clamped - min) / scaleSpan) * 100;
|
|
815
|
+
}
|
|
816
|
+
returnValue += ` (${percentageValue.toFixed(0)}%)`;
|
|
817
|
+
}
|
|
818
|
+
const trimmed = returnValue.trim();
|
|
819
|
+
return trimmed ? trimmed : String(params.value ?? '');
|
|
820
|
+
};
|
|
775
821
|
}
|
|
776
822
|
resolveRangeBarBound(bound, abColumn, rowNode) {
|
|
777
823
|
if (bound == undefined) {
|
|
@@ -1293,7 +1339,7 @@ export class AgGridColumnAdapter {
|
|
|
1293
1339
|
if (!note) {
|
|
1294
1340
|
return;
|
|
1295
1341
|
}
|
|
1296
|
-
const noteType =
|
|
1342
|
+
const noteType = this.adaptableApi.noteApi.internalApi.getNoteType(note);
|
|
1297
1343
|
return `ab-NoteType-${noteType}`;
|
|
1298
1344
|
}
|
|
1299
1345
|
getCommentCellClassName(gridCell, params) {
|
|
@@ -52,6 +52,11 @@ export declare class AgGridExportAdapter {
|
|
|
52
52
|
buildExportProcessData(config: ExportConfig): ExportProcessData;
|
|
53
53
|
private buildExportParams;
|
|
54
54
|
private buildBaseExportParams;
|
|
55
|
+
/**
|
|
56
|
+
* Excel cannot colour the note indicator per comment, so when any Note has a non-default type,
|
|
57
|
+
* the type is prepended to every exported note text (e.g. `Warning: <text>`).
|
|
58
|
+
*/
|
|
59
|
+
private computeProcessNoteCallback;
|
|
55
60
|
private computeProcessRowGroupCallback;
|
|
56
61
|
private computeProcessCellCallback;
|
|
57
62
|
private getReportColsAndRows;
|
|
@@ -137,10 +137,18 @@ export class AgGridExportAdapter {
|
|
|
137
137
|
if (exportContext.format === 'Excel' || exportContext.format === 'VisualExcel') {
|
|
138
138
|
const excelExportParams = baseExportParams;
|
|
139
139
|
excelExportParams.sheetName = resolveValueOrFunction(this.exportOptions.excelSheetName, this.adaptableApi.exportApi.internalApi.buildBaseExportContext(exportContext.report.Name, exportContext.format, exportContext.destination));
|
|
140
|
+
excelExportParams.processNoteCallback = this.computeProcessNoteCallback();
|
|
140
141
|
return excelExportParams;
|
|
141
142
|
}
|
|
142
143
|
const csvExportParams = baseExportParams;
|
|
143
144
|
csvExportParams.columnSeparator = this.getCsvSeparator(exportContext);
|
|
145
|
+
if (exportContext.format !== 'CSV') {
|
|
146
|
+
Object.keys(this.agGridApi.getGridOption('defaultCsvExportParams') ?? {}).forEach((key) => {
|
|
147
|
+
if (!(key in csvExportParams)) {
|
|
148
|
+
csvExportParams[key] = undefined;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
144
152
|
return csvExportParams;
|
|
145
153
|
}
|
|
146
154
|
buildBaseExportParams(exportContext) {
|
|
@@ -161,6 +169,29 @@ export class AgGridExportAdapter {
|
|
|
161
169
|
params.processRowGroupCallback = this.computeProcessRowGroupCallback(exportContext);
|
|
162
170
|
return params;
|
|
163
171
|
}
|
|
172
|
+
computeProcessNoteCallback() {
|
|
173
|
+
const noteInternalApi = this.adaptableApi.noteApi.internalApi;
|
|
174
|
+
if (!noteInternalApi.isAgGridNotesActive() || !noteInternalApi.hasNonDefaultNoteTypes()) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
return (params) => {
|
|
178
|
+
const { excelNote, node, column } = params;
|
|
179
|
+
if (!excelNote || !node || !column) {
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
const note = this.adaptableApi.noteApi.getNoteForCell({
|
|
183
|
+
PrimaryKeyValue: this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(node),
|
|
184
|
+
ColumnId: column.getColId(),
|
|
185
|
+
});
|
|
186
|
+
if (!note) {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
...excelNote,
|
|
191
|
+
text: `${noteInternalApi.getNoteType(note)}: ${excelNote.text}`,
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
}
|
|
164
195
|
computeProcessRowGroupCallback(exportContext) {
|
|
165
196
|
return (params) => {
|
|
166
197
|
let rowGroupNode = params.node;
|
|
@@ -182,7 +182,7 @@ export class AgGridMenuAdapter {
|
|
|
182
182
|
const agGridMenuItems = this.filterSuppressedAgGridDualUiMenuItems(params.defaultItems ? [...params.defaultItems] : []);
|
|
183
183
|
const agGridCopyItems = agGridMenuItems.filter((item) => ['copy', 'copyWithHeaders', 'copyWithGroupHeaders', 'cut', 'paste'].includes(item));
|
|
184
184
|
const otherAgGridItems = agGridMenuItems.filter((item) => !agGridCopyItems.includes(item) &&
|
|
185
|
-
!['export', 'csvExport', 'excelExport'].includes(item));
|
|
185
|
+
!['export', 'csvExport', 'excelExport', 'pdfExport'].includes(item));
|
|
186
186
|
const agGridDefaultStructure = [
|
|
187
187
|
{
|
|
188
188
|
menuType: 'Group',
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GridOptions } from 'ag-grid-enterprise';
|
|
2
|
+
/**
|
|
3
|
+
* Copies onto `gridOptions` the options set with AG Grid's `provideGlobalGridOptions` which the grid
|
|
4
|
+
* itself does not set, so AdapTable handles them exactly as if they were set on the grid.
|
|
5
|
+
*
|
|
6
|
+
* Must run before AdapTable reads or wraps any GridOptions property: AdapTable writes its own value
|
|
7
|
+
* for the properties it manages, and AG Grid's global merge never overrides a value set on the grid.
|
|
8
|
+
*/
|
|
9
|
+
export declare function applyGlobalGridOptions(gridOptions: GridOptions): GridOptions;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { _getGlobalGridOption, _GET_ALL_GRID_OPTIONS } from 'ag-grid-enterprise';
|
|
2
|
+
export function applyGlobalGridOptions(gridOptions) {
|
|
3
|
+
if (!gridOptions) {
|
|
4
|
+
return gridOptions;
|
|
5
|
+
}
|
|
6
|
+
const options = gridOptions;
|
|
7
|
+
for (const key of _GET_ALL_GRID_OPTIONS()) {
|
|
8
|
+
if (options[key] !== undefined) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const globalValue = _getGlobalGridOption(key);
|
|
12
|
+
if (globalValue !== undefined) {
|
|
13
|
+
options[key] = copyGlobalValue(globalValue);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return gridOptions;
|
|
17
|
+
}
|
|
18
|
+
function copyGlobalValue(value) {
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
return [...value];
|
|
21
|
+
}
|
|
22
|
+
return copyPlainObjects(value);
|
|
23
|
+
}
|
|
24
|
+
function copyPlainObjects(value) {
|
|
25
|
+
if (!isPlainObject(value)) {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
const copy = {};
|
|
29
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
30
|
+
copy[key] = copyPlainObjects(nestedValue);
|
|
31
|
+
}
|
|
32
|
+
return copy;
|
|
33
|
+
}
|
|
34
|
+
function isPlainObject(value) {
|
|
35
|
+
return typeof value === 'object' && value !== null && value.constructor === Object;
|
|
36
|
+
}
|
|
@@ -2,6 +2,7 @@ import { Badge } from '../../View/StyledColumn/Badge';
|
|
|
2
2
|
import { renderWithAdaptableContext } from '../../View/AdaptableContext';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { shouldRenderStyledColumnOnRow } from '../../Utilities/Helpers/StyledColumns/StyledColumnHelper';
|
|
5
|
+
import { getPerfRecorder } from '../../devTools/PerfStore';
|
|
5
6
|
const OVERFLOW_CLASS = {
|
|
6
7
|
Truncate: 'ab-Badge__wrapper--truncate',
|
|
7
8
|
Wrap: 'ab-Badge__wrapper--wrap',
|
|
@@ -25,6 +26,13 @@ export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
25
26
|
const wrapperClassName = `ab-Badge__wrapper ${OVERFLOW_CLASS[overflowMode]}`;
|
|
26
27
|
const spacing = typeof badgeStyle.Spacing === 'number' ? badgeStyle.Spacing : null;
|
|
27
28
|
const rowJustify = resolveBadgeRowJustify(badgeStyle.Font?.Alignment);
|
|
29
|
+
const perfKey = `badge:${abColumn.columnId}`;
|
|
30
|
+
const describePerf = () => ({
|
|
31
|
+
module: 'StyledColumn',
|
|
32
|
+
objectId: styledColumn.Uuid,
|
|
33
|
+
objectName: styledColumn.Name,
|
|
34
|
+
columnId: abColumn.columnId,
|
|
35
|
+
});
|
|
28
36
|
return class BadgetRenderer {
|
|
29
37
|
eGui;
|
|
30
38
|
unmountReactRoot;
|
|
@@ -33,6 +41,20 @@ export const getBadgeRendererForColumn = (styledColumn, abColumn, api) => {
|
|
|
33
41
|
return adaptable;
|
|
34
42
|
}
|
|
35
43
|
init(params) {
|
|
44
|
+
const recorder = getPerfRecorder(this.getAdaptableInstance(params)?.adaptableOptions?.adaptableId);
|
|
45
|
+
if (!recorder) {
|
|
46
|
+
this.initNow(params);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const start = performance.now();
|
|
50
|
+
try {
|
|
51
|
+
this.initNow(params);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
recorder.add('badge', perfKey, start, describePerf);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
initNow(params) {
|
|
36
58
|
const adaptable = this.getAdaptableInstance(params);
|
|
37
59
|
const adaptableApi = adaptable.api;
|
|
38
60
|
this.eGui = document.createElement('div');
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cached aggregations of a numeric column's distinct values (Styled Columns use them for
|
|
3
|
+
* percent bars, gradients and ranges such as "Col-Min" / "Col-Max").
|
|
4
|
+
*/
|
|
5
|
+
export type ColumnMinMaxCacheEntry = {
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
avg?: number;
|
|
9
|
+
median?: number;
|
|
10
|
+
};
|
|
11
|
+
/** Lowest and highest value in one pass (no spread: very large columns overflow the stack) */
|
|
12
|
+
export declare function computeMinMax(values: number[]): {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
} | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* The cache entry after one cell changed from `oldValue` to `newValue`, without reading the
|
|
18
|
+
* column again: ticking data would otherwise make the next render scan every row, on every tick.
|
|
19
|
+
*
|
|
20
|
+
* - A new value beyond the min or max becomes the new min or max.
|
|
21
|
+
* - When the old value *was* the min or max, it may have been the only one: that aggregation is
|
|
22
|
+
* dropped and recomputed when next asked.
|
|
23
|
+
* - Average and median depend on every distinct value: always recomputed.
|
|
24
|
+
* - Anything that is not a plain numeric change (or `trigger` other than edit, tick or undo)
|
|
25
|
+
* drops the whole entry.
|
|
26
|
+
*
|
|
27
|
+
* Returns `undefined` when nothing is left to keep.
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateColumnMinMaxCacheEntry(entry: ColumnMinMaxCacheEntry | undefined, change: {
|
|
30
|
+
oldValue?: unknown;
|
|
31
|
+
newValue?: unknown;
|
|
32
|
+
trigger?: string;
|
|
33
|
+
}): ColumnMinMaxCacheEntry | undefined;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function isNumber(value) {
|
|
2
|
+
return typeof value === 'number' && !isNaN(value);
|
|
3
|
+
}
|
|
4
|
+
export function computeMinMax(values) {
|
|
5
|
+
if (!values.length) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
let min = values[0];
|
|
9
|
+
let max = values[0];
|
|
10
|
+
for (let index = 1; index < values.length; index++) {
|
|
11
|
+
const value = values[index];
|
|
12
|
+
if (value < min) {
|
|
13
|
+
min = value;
|
|
14
|
+
}
|
|
15
|
+
else if (value > max) {
|
|
16
|
+
max = value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return { min, max };
|
|
20
|
+
}
|
|
21
|
+
export function updateColumnMinMaxCacheEntry(entry, change) {
|
|
22
|
+
if (!entry) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const { oldValue, newValue, trigger } = change;
|
|
26
|
+
const incremental = (trigger === 'edit' || trigger === 'tick' || trigger === 'undo') &&
|
|
27
|
+
isNumber(newValue) &&
|
|
28
|
+
(oldValue == null || isNumber(oldValue));
|
|
29
|
+
if (!incremental) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const next = {};
|
|
33
|
+
if (entry.min !== undefined) {
|
|
34
|
+
if (newValue <= entry.min) {
|
|
35
|
+
next.min = newValue;
|
|
36
|
+
}
|
|
37
|
+
else if (oldValue !== entry.min) {
|
|
38
|
+
next.min = entry.min;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (entry.max !== undefined) {
|
|
42
|
+
if (newValue >= entry.max) {
|
|
43
|
+
next.max = newValue;
|
|
44
|
+
}
|
|
45
|
+
else if (oldValue !== entry.max) {
|
|
46
|
+
next.max = entry.max;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return next.min === undefined && next.max === undefined ? undefined : next;
|
|
50
|
+
}
|