@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
package/src/setupDevTools.js
CHANGED
|
@@ -1,18 +1,145 @@
|
|
|
1
|
+
import { DEVTOOLS_HEARTBEAT_TIMEOUT_MS, DEVTOOLS_PAGE_FEATURES, DEVTOOLS_PROTOCOL_VERSION, } from '../devtools';
|
|
2
|
+
import { areAdaptableProfileTracksEnabled, deletePerfStore, getPerfStore, isRecordingPerformance, resetProfileTracksCache, } from './devTools';
|
|
3
|
+
import { onRecordingChange, readHeap, setInventoryReader, setRecordOnLoadRequest, } from './devTools/PerfStore';
|
|
4
|
+
import { buildPerfContextResult } from './devTools/perfContext';
|
|
5
|
+
import { buildMemoryInfo } from './devTools/memoryInfo';
|
|
6
|
+
import { bufferLogEntry, formatLogArg, LOG_BUFFERS, MAX_LOG_ENTRIES_PER_INSTANCE, } from './devTools/logBuffer';
|
|
7
|
+
import { API_TAGGING_TIMEOUT_MS, getMemoryTaggingInfo, onStateChangedForMemoryRoots, tagMemoryRoots, untagMemoryRoots, } from './devTools/memoryRoots';
|
|
1
8
|
import { AG_GRID_VERSION } from './agGrid/AgGridModulesAdapter';
|
|
2
9
|
import { ADAPTABLE_VERSION } from './EnvVars';
|
|
10
|
+
import { getInstanceLicenseStatus } from './Utilities/license/instanceLicense';
|
|
3
11
|
import { resolveVisibleSettingsPanelNavigationGroups } from './Utilities/Helpers/SettingsPanelHelper';
|
|
4
12
|
import { isTransientReduxAction } from './Redux/Store/isTransientReduxAction';
|
|
5
13
|
import { isPivotLayout } from './Utilities/Helpers/Layouts/LayoutHelper';
|
|
6
14
|
import { formatColumnInspectorPinning, formatColumnInspectorSizing, } from './View/Layout/Utilities/columnLayoutHelpers';
|
|
7
15
|
import { getVariableColor } from './Utilities/Helpers/StyleHelper';
|
|
8
|
-
import { isSummaryColorLabel, parseSummaryLabelValueString
|
|
16
|
+
import { isSummaryColorLabel, parseSummaryLabelValueString } from './View/Wizard/SummaryColorTag';
|
|
9
17
|
import { debug } from '@infinite-table/infinite-react';
|
|
10
18
|
import { warnOnce } from './agGrid/AdaptableLogger';
|
|
11
19
|
let DEV_TOOLS_LISTENING_STARTED = false;
|
|
12
20
|
let DEV_TOOLS_READY = false;
|
|
21
|
+
let LEGACY_EXTENSION = false;
|
|
22
|
+
let LAST_REGISTER_AT = 0;
|
|
23
|
+
let LAST_PROTOCOL_REGISTER_AT = 0;
|
|
24
|
+
let LAST_PANEL_MESSAGE_AT = 0;
|
|
25
|
+
let HANDLING_PANEL_MESSAGE = false;
|
|
26
|
+
const PANEL_GONE_MS = 10_000;
|
|
27
|
+
let LISTENING_STARTED_AT = 0;
|
|
28
|
+
const EXTENSION_GONE_MS = 90_000;
|
|
29
|
+
function isPanelGone() {
|
|
30
|
+
return Date.now() - LAST_PANEL_MESSAGE_AT > PANEL_GONE_MS;
|
|
31
|
+
}
|
|
32
|
+
function isPanelGoneSinceLoad() {
|
|
33
|
+
if (!LISTENING_STARTED_AT) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return Date.now() - Math.max(LAST_PANEL_MESSAGE_AT, LISTENING_STARTED_AT) > PANEL_GONE_MS;
|
|
37
|
+
}
|
|
38
|
+
function isPanelOpen() {
|
|
39
|
+
return Date.now() - LAST_PANEL_MESSAGE_AT <= DEVTOOLS_HEARTBEAT_TIMEOUT_MS;
|
|
40
|
+
}
|
|
41
|
+
function isDevToolsConnected() {
|
|
42
|
+
if (!DEV_TOOLS_READY) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (LEGACY_EXTENSION) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
if (Date.now() - LAST_REGISTER_AT > EXTENSION_GONE_MS && !isPanelOpen()) {
|
|
49
|
+
DEV_TOOLS_READY = false;
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
function shouldSendLiveUpdates() {
|
|
55
|
+
return isDevToolsConnected() && (LEGACY_EXTENSION || isPanelOpen());
|
|
56
|
+
}
|
|
57
|
+
const RECORD_ON_LOAD_STORAGE_KEY = 'adaptableRecordOnLoad';
|
|
58
|
+
const RECORD_ON_LOAD_MAX_AGE_MS = 30_000;
|
|
59
|
+
function getSessionStorage() {
|
|
60
|
+
try {
|
|
61
|
+
return typeof sessionStorage !== 'undefined' ? sessionStorage : undefined;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function isStateTimelinePaused(adaptableId) {
|
|
68
|
+
return isRecordingPerformance(adaptableId);
|
|
69
|
+
}
|
|
70
|
+
const STATE_CHANGED_WHILE_PAUSED = new Set();
|
|
71
|
+
function buildPageInfo(adaptableId) {
|
|
72
|
+
return {
|
|
73
|
+
protocol: DEVTOOLS_PROTOCOL_VERSION,
|
|
74
|
+
features: [...DEVTOOLS_PAGE_FEATURES],
|
|
75
|
+
stateTimelinePaused: isStateTimelinePaused(adaptableId),
|
|
76
|
+
perfRecording: isRecordingPerformance(adaptableId),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function onInstanceRecordingChange(adaptableId) {
|
|
80
|
+
const registration = getRegistration(adaptableId);
|
|
81
|
+
if (!isDevToolsConnected() || !registration) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!isStateTimelinePaused(adaptableId) && STATE_CHANGED_WHILE_PAUSED.has(adaptableId)) {
|
|
85
|
+
postStateChangeMessage(adaptableId, {
|
|
86
|
+
api: registration.api,
|
|
87
|
+
actionName: STATE_TIMELINE_RESUMED_ACTION,
|
|
88
|
+
replay: true,
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
window.postMessage(buildMessageForExtension({
|
|
93
|
+
type: 'state-change',
|
|
94
|
+
adaptableId,
|
|
95
|
+
devtools: buildPageInfo(adaptableId),
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
const STATE_TIMELINE_RESUMED_ACTION = 'Changes during recording';
|
|
99
|
+
function consumeRecordOnLoadRequest() {
|
|
100
|
+
const storage = getSessionStorage();
|
|
101
|
+
if (!storage) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
let request = null;
|
|
105
|
+
try {
|
|
106
|
+
const raw = storage.getItem(RECORD_ON_LOAD_STORAGE_KEY);
|
|
107
|
+
if (raw == null) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
storage.removeItem(RECORD_ON_LOAD_STORAGE_KEY);
|
|
111
|
+
request = JSON.parse(raw);
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!request || typeof request.at !== 'number') {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (Math.abs(Date.now() - request.at) > RECORD_ON_LOAD_MAX_AGE_MS) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
setRecordOnLoadRequest({
|
|
123
|
+
hotPaths: request.hotPaths !== false,
|
|
124
|
+
stopWhen: request.stopWithPanel ? isPanelGoneSinceLoad : undefined,
|
|
125
|
+
pauseTracksWhen: request.fromPanel ? isPanelGoneSinceLoad : undefined,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function requestRecordAfterReload(options) {
|
|
129
|
+
const storage = getSessionStorage();
|
|
130
|
+
if (!storage) {
|
|
131
|
+
throw new Error('Adaptable DevTools: sessionStorage is not available');
|
|
132
|
+
}
|
|
133
|
+
storage.setItem(RECORD_ON_LOAD_STORAGE_KEY, JSON.stringify({
|
|
134
|
+
hotPaths: options.hotPaths !== false,
|
|
135
|
+
stopWithPanel: options.stopWithPanel,
|
|
136
|
+
fromPanel: options.fromPanel,
|
|
137
|
+
at: Date.now(),
|
|
138
|
+
}));
|
|
139
|
+
window.location.reload();
|
|
140
|
+
}
|
|
13
141
|
const LOG_LEVELS = ['info', 'success', 'warn', 'error', 'perf'];
|
|
14
142
|
const LOG_CHANNEL_BASES = ['Adaptable', 'LayoutManager'];
|
|
15
|
-
const MAX_LOG_ENTRIES_PER_INSTANCE = 500;
|
|
16
143
|
const MAX_ACTION_ENTRIES_PER_INSTANCE = 200;
|
|
17
144
|
const DEFAULT_LOG_LIMIT = 100;
|
|
18
145
|
const DEFAULT_ACTION_LIMIT = 50;
|
|
@@ -57,23 +184,6 @@ function serializeAdaptableStateForPostMessage(state, parentKey) {
|
|
|
57
184
|
return acc;
|
|
58
185
|
}, {});
|
|
59
186
|
}
|
|
60
|
-
function formatLogArgForPostMessage(value) {
|
|
61
|
-
if (typeof value === 'string') {
|
|
62
|
-
return value;
|
|
63
|
-
}
|
|
64
|
-
if (value == null) {
|
|
65
|
-
return String(value);
|
|
66
|
-
}
|
|
67
|
-
if (typeof value === 'object') {
|
|
68
|
-
try {
|
|
69
|
-
return JSON.stringify(value, null, 2);
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return String(value);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return String(value);
|
|
76
|
-
}
|
|
77
187
|
function isMessageFromDevToolsContentScript(data) {
|
|
78
188
|
return (data &&
|
|
79
189
|
typeof data.source === 'string' &&
|
|
@@ -82,9 +192,11 @@ function isMessageFromDevToolsContentScript(data) {
|
|
|
82
192
|
data.source.startsWith('adaptable-devtools-contentscript'));
|
|
83
193
|
}
|
|
84
194
|
const INSTANCE_REGISTRATIONS = new Map();
|
|
85
|
-
|
|
195
|
+
let LAST_POSTED_LOG_SEQ = 0;
|
|
86
196
|
const pendingGridRuntimeUpdates = new Map();
|
|
87
197
|
const GRID_RUNTIME_FALLBACK_DELAY_MS = 100;
|
|
198
|
+
const GRID_RUNTIME_MIN_INTERVAL_MS = 500;
|
|
199
|
+
const lastGridRuntimePostAt = new Map();
|
|
88
200
|
function getRegistration(adaptableId) {
|
|
89
201
|
const registration = INSTANCE_REGISTRATIONS.get(adaptableId);
|
|
90
202
|
if (!registration || registration.instance?.isDestroyed) {
|
|
@@ -97,7 +209,9 @@ function getRegisteredApi(adaptableId) {
|
|
|
97
209
|
}
|
|
98
210
|
function describeMountedInstances() {
|
|
99
211
|
const ids = [...INSTANCE_REGISTRATIONS.keys()];
|
|
100
|
-
return ids.length
|
|
212
|
+
return ids.length
|
|
213
|
+
? `Mounted instances: ${ids.map((id) => `"${id}"`).join(', ')}.`
|
|
214
|
+
: 'No AdapTable instance is mounted.';
|
|
101
215
|
}
|
|
102
216
|
function resolveRegistration(adaptableId) {
|
|
103
217
|
if (adaptableId != null) {
|
|
@@ -132,16 +246,32 @@ function parseLogChannel(channel) {
|
|
|
132
246
|
const level = channelParts.find((part) => LOG_LEVELS.includes(part));
|
|
133
247
|
return { adaptableId, level: level ?? 'info' };
|
|
134
248
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
249
|
+
function postLogEntry(entry) {
|
|
250
|
+
LAST_POSTED_LOG_SEQ = Math.max(LAST_POSTED_LOG_SEQ, entry.seq);
|
|
251
|
+
window.postMessage({
|
|
252
|
+
...messageBase,
|
|
253
|
+
url: getPageUrlOfWindow(),
|
|
254
|
+
type: 'log',
|
|
255
|
+
payload: {
|
|
256
|
+
adaptableId: entry.adaptableId,
|
|
257
|
+
channel: entry.channel,
|
|
258
|
+
color: entry.color,
|
|
259
|
+
level: entry.level,
|
|
260
|
+
timestamp: entry.timestamp,
|
|
261
|
+
args: entry.args.map((arg) => serializeForPostMessage(arg)),
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function postUnsentLogEntries() {
|
|
266
|
+
const unsent = [];
|
|
267
|
+
for (const buffer of LOG_BUFFERS.values()) {
|
|
268
|
+
for (const entry of buffer) {
|
|
269
|
+
if (entry.seq > LAST_POSTED_LOG_SEQ) {
|
|
270
|
+
unsent.push(entry);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
144
273
|
}
|
|
274
|
+
unsent.sort((a, b) => a.seq - b.seq).forEach(postLogEntry);
|
|
145
275
|
}
|
|
146
276
|
function ensureLogIntentListening() {
|
|
147
277
|
if (LOG_INTENT_LISTENING_STARTED) {
|
|
@@ -154,58 +284,221 @@ function ensureLogIntentListening() {
|
|
|
154
284
|
if (!parsed) {
|
|
155
285
|
return;
|
|
156
286
|
}
|
|
157
|
-
const formattedArgs = args.map((arg) =>
|
|
158
|
-
bufferLogEntry({
|
|
287
|
+
const formattedArgs = args.map((arg) => formatLogArg(arg));
|
|
288
|
+
const entry = bufferLogEntry({
|
|
159
289
|
timestamp,
|
|
160
290
|
adaptableId: parsed.adaptableId,
|
|
161
291
|
channel,
|
|
292
|
+
color,
|
|
162
293
|
level: parsed.level,
|
|
163
294
|
args: formattedArgs,
|
|
164
295
|
});
|
|
165
|
-
if (!
|
|
296
|
+
if (!shouldSendLiveUpdates()) {
|
|
166
297
|
return;
|
|
167
298
|
}
|
|
168
|
-
|
|
169
|
-
...messageBase,
|
|
170
|
-
url: getPageUrlOfWindow(),
|
|
171
|
-
type: 'log',
|
|
172
|
-
payload: {
|
|
173
|
-
adaptableId: parsed.adaptableId,
|
|
174
|
-
channel,
|
|
175
|
-
color,
|
|
176
|
-
level: parsed.level,
|
|
177
|
-
timestamp,
|
|
178
|
-
args: formattedArgs.map((arg) => serializeForPostMessage(arg)),
|
|
179
|
-
},
|
|
180
|
-
});
|
|
299
|
+
postLogEntry(entry);
|
|
181
300
|
});
|
|
182
301
|
}
|
|
183
|
-
function
|
|
302
|
+
function ensureDevToolsReady() {
|
|
303
|
+
if (DEV_TOOLS_READY) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
DEV_TOOLS_READY = true;
|
|
184
307
|
for (const [adaptableId, registration] of INSTANCE_REGISTRATIONS) {
|
|
185
308
|
if (registration.instance?.isDestroyed) {
|
|
186
309
|
continue;
|
|
187
310
|
}
|
|
188
311
|
postMountMessage(adaptableId, registration.api);
|
|
189
|
-
|
|
312
|
+
postInitialState(adaptableId, registration.api, { replay: true });
|
|
313
|
+
}
|
|
314
|
+
if (shouldSendLiveUpdates()) {
|
|
315
|
+
postUnsentLogEntries();
|
|
190
316
|
}
|
|
191
317
|
}
|
|
192
|
-
function
|
|
193
|
-
if (
|
|
318
|
+
function onPanelOpened() {
|
|
319
|
+
if (!isDevToolsConnected()) {
|
|
194
320
|
return;
|
|
195
321
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
322
|
+
postUnsentLogEntries();
|
|
323
|
+
for (const [adaptableId, registration] of INSTANCE_REGISTRATIONS) {
|
|
324
|
+
if (registration.instance?.isDestroyed) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
postGridRuntimeUpdate(adaptableId, registration.api);
|
|
328
|
+
}
|
|
199
329
|
}
|
|
200
330
|
const SEEN_CONTENT_SCRIPT_IDS = new Set();
|
|
201
|
-
function handleRegisterMessage(payload
|
|
331
|
+
function handleRegisterMessage(payload) {
|
|
332
|
+
const now = Date.now();
|
|
333
|
+
LAST_REGISTER_AT = now;
|
|
334
|
+
if (typeof payload?.protocol === 'number') {
|
|
335
|
+
LAST_PROTOCOL_REGISTER_AT = now;
|
|
336
|
+
LEGACY_EXTENSION = false;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
LEGACY_EXTENSION = now - LAST_PROTOCOL_REGISTER_AT > EXTENSION_GONE_MS;
|
|
340
|
+
}
|
|
341
|
+
if (payload?.panel === true) {
|
|
342
|
+
notePanelMessage();
|
|
343
|
+
}
|
|
202
344
|
const contentScriptId = payload?.contentScriptId;
|
|
203
|
-
if (typeof contentScriptId
|
|
345
|
+
if (typeof contentScriptId === 'string' && !SEEN_CONTENT_SCRIPT_IDS.has(contentScriptId)) {
|
|
346
|
+
SEEN_CONTENT_SCRIPT_IDS.add(contentScriptId);
|
|
347
|
+
if (SEEN_CONTENT_SCRIPT_IDS.size > 1 && DEV_TOOLS_READY) {
|
|
348
|
+
DEV_TOOLS_READY = false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function notePanelMessage() {
|
|
353
|
+
const wasOpen = isPanelOpen();
|
|
354
|
+
LAST_PANEL_MESSAGE_AT = Date.now();
|
|
355
|
+
if (!wasOpen) {
|
|
356
|
+
onPanelOpened();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function handleGetPerfDataMessage(payload) {
|
|
360
|
+
const adaptableId = payload?.adaptableId;
|
|
361
|
+
if (!adaptableId) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const store = getPerfStore(adaptableId);
|
|
365
|
+
const perfData = {
|
|
366
|
+
...store.getData(payload.cursor, areAdaptableProfileTracksEnabled(adaptableId)),
|
|
367
|
+
memoryTagging: getMemoryTaggingInfo(adaptableId),
|
|
368
|
+
};
|
|
369
|
+
window.postMessage(buildMessageForExtension({ type: 'perf-data', adaptableId, perfData }));
|
|
370
|
+
}
|
|
371
|
+
function handlePerfRecordingMessage(payload) {
|
|
372
|
+
const adaptableId = payload?.adaptableId;
|
|
373
|
+
if (!adaptableId) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const store = getPerfStore(adaptableId);
|
|
377
|
+
const stopWhen = HANDLING_PANEL_MESSAGE && payload.keepRecording !== true ? isPanelGone : undefined;
|
|
378
|
+
if (payload.clear) {
|
|
379
|
+
store.clearRecording();
|
|
380
|
+
}
|
|
381
|
+
if (payload.recording === true) {
|
|
382
|
+
store.startRecording({
|
|
383
|
+
hotPaths: payload.hotPaths !== false,
|
|
384
|
+
stopWhen,
|
|
385
|
+
pauseTracksWhen: HANDLING_PANEL_MESSAGE ? isPanelGone : undefined,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
else if (payload.recording === false) {
|
|
389
|
+
store.stopRecording();
|
|
390
|
+
}
|
|
391
|
+
else if (typeof payload.keepRecording === 'boolean') {
|
|
392
|
+
store.setStopWhen(stopWhen);
|
|
393
|
+
}
|
|
394
|
+
handleGetPerfDataMessage({ adaptableId });
|
|
395
|
+
}
|
|
396
|
+
function handleRecordAndReloadMessage(payload) {
|
|
397
|
+
try {
|
|
398
|
+
requestRecordAfterReload({
|
|
399
|
+
hotPaths: payload?.hotPaths !== false,
|
|
400
|
+
stopWithPanel: HANDLING_PANEL_MESSAGE && payload?.keepRecording !== true,
|
|
401
|
+
fromPanel: HANDLING_PANEL_MESSAGE,
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
console.warn(error.message);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
function startMemoryTagging(adaptableId, durationMs) {
|
|
409
|
+
const registration = resolveRegistration(adaptableId);
|
|
410
|
+
const id = adaptableId ?? registration.api.optionsApi.getAdaptableId();
|
|
411
|
+
return tagMemoryRoots(id, registration.api, registration.instance, () => ({
|
|
412
|
+
'devtools.registration': registration,
|
|
413
|
+
'devtools.logs': LOG_BUFFERS.get(id),
|
|
414
|
+
'devtools.actions': registration.actions,
|
|
415
|
+
}), durationMs);
|
|
416
|
+
}
|
|
417
|
+
function handleTagMemoryRootsMessage(payload) {
|
|
418
|
+
if (!payload?.adaptableId) {
|
|
204
419
|
return;
|
|
205
420
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
421
|
+
try {
|
|
422
|
+
startMemoryTagging(payload.adaptableId);
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
console.warn(error);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
function setProfileTracksEnabled(enabled) {
|
|
429
|
+
const storage = getLocalStorage();
|
|
430
|
+
if (!storage) {
|
|
431
|
+
throw new Error('Adaptable DevTools: localStorage is not available');
|
|
432
|
+
}
|
|
433
|
+
if (enabled) {
|
|
434
|
+
storage.setItem(PROFILE_TRACKS_STORAGE_KEY, 'true');
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
storage.removeItem(PROFILE_TRACKS_STORAGE_KEY);
|
|
438
|
+
}
|
|
439
|
+
resetProfileTracksCache();
|
|
440
|
+
}
|
|
441
|
+
function getPerformanceContext(adaptableId) {
|
|
442
|
+
const registration = resolveRegistration(adaptableId);
|
|
443
|
+
const id = adaptableId ?? registration.api.optionsApi.getAdaptableId();
|
|
444
|
+
return buildPerfContextResult(id, registration.api, registration.instance);
|
|
445
|
+
}
|
|
446
|
+
function buildMemoryInfoFor(adaptableId) {
|
|
447
|
+
const registration = resolveRegistration(adaptableId);
|
|
448
|
+
const id = adaptableId ?? registration.api.optionsApi.getAdaptableId();
|
|
449
|
+
const info = buildMemoryInfo(id, registration.api, registration.instance, {
|
|
450
|
+
logEntries: LOG_BUFFERS.get(id)?.length ?? 0,
|
|
451
|
+
maxLogEntries: MAX_LOG_ENTRIES_PER_INSTANCE,
|
|
452
|
+
actionEntries: registration.actions.length,
|
|
453
|
+
maxActionEntries: MAX_ACTION_ENTRIES_PER_INSTANCE,
|
|
454
|
+
});
|
|
455
|
+
return { id, info };
|
|
456
|
+
}
|
|
457
|
+
function getMemoryItems(adaptableId) {
|
|
458
|
+
return buildMemoryInfoFor(adaptableId).info.items;
|
|
459
|
+
}
|
|
460
|
+
function getMemoryInfo(adaptableId) {
|
|
461
|
+
return buildMemoryInfoFor(adaptableId).info;
|
|
462
|
+
}
|
|
463
|
+
function getMemoryInfoForPanel(adaptableId) {
|
|
464
|
+
const store = getPerfStore(adaptableId);
|
|
465
|
+
const memory = store.memory;
|
|
466
|
+
if (memory && store.recording && !memory.lastItems) {
|
|
467
|
+
memory.sample(undefined, Date.now(), true);
|
|
468
|
+
}
|
|
469
|
+
const lastRead = memory?.lastItems;
|
|
470
|
+
return lastRead
|
|
471
|
+
? { adaptableId, timestamp: lastRead.timestamp, items: lastRead.items, heap: readHeap() }
|
|
472
|
+
: getMemoryInfo(adaptableId);
|
|
473
|
+
}
|
|
474
|
+
function resolveAdaptableId(adaptableId) {
|
|
475
|
+
const registration = resolveRegistration(adaptableId);
|
|
476
|
+
return adaptableId ?? registration.api.optionsApi.getAdaptableId();
|
|
477
|
+
}
|
|
478
|
+
function handleGetPerfContextMessage(payload) {
|
|
479
|
+
const adaptableId = payload?.adaptableId;
|
|
480
|
+
if (!adaptableId) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
try {
|
|
484
|
+
const perfContext = serializeForPostMessage(getPerformanceContext(adaptableId));
|
|
485
|
+
window.postMessage(buildMessageForExtension({ type: 'perf-context', adaptableId, perfContext }));
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
console.warn(error);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function handleGetMemoryInfoMessage(payload) {
|
|
492
|
+
const adaptableId = payload?.adaptableId;
|
|
493
|
+
if (!adaptableId) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
try {
|
|
497
|
+
const memoryInfo = serializeForPostMessage(getMemoryInfoForPanel(adaptableId));
|
|
498
|
+
window.postMessage(buildMessageForExtension({ type: 'memory-info', adaptableId, memoryInfo }));
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
console.warn(error);
|
|
209
502
|
}
|
|
210
503
|
}
|
|
211
504
|
function handleGetColumnInfoMessage(payload) {
|
|
@@ -339,12 +632,8 @@ function buildGridRuntime(api) {
|
|
|
339
632
|
};
|
|
340
633
|
}
|
|
341
634
|
function buildInstanceSummary(api) {
|
|
342
|
-
const options = api.optionsApi.getAdaptableOptions();
|
|
343
|
-
const globalObject = typeof globalThis !== 'undefined' ? globalThis : window;
|
|
344
|
-
const licenseKey = globalObject.ADAPTABLE_LICENSE_KEY ||
|
|
345
|
-
options.licenseKey;
|
|
346
635
|
return {
|
|
347
|
-
|
|
636
|
+
license: getInstanceLicenseStatus(api),
|
|
348
637
|
userName: api.optionsApi.getUserName(),
|
|
349
638
|
primaryKey: api.optionsApi.getPrimaryKey(),
|
|
350
639
|
};
|
|
@@ -479,6 +768,25 @@ function summaryRow(key, value) {
|
|
|
479
768
|
function yesNo(value) {
|
|
480
769
|
return value ? 'Yes' : 'No';
|
|
481
770
|
}
|
|
771
|
+
function describeScopeMatch(api, column, scope) {
|
|
772
|
+
const scopeApi = api.columnScopeApi;
|
|
773
|
+
if ('All' in scope) {
|
|
774
|
+
return 'All Columns';
|
|
775
|
+
}
|
|
776
|
+
if ('DataTypes' in scope && scopeApi.isColumnInScope(column, { DataTypes: scope.DataTypes })) {
|
|
777
|
+
return `Data Type: ${column.dataType}`;
|
|
778
|
+
}
|
|
779
|
+
if ('ColumnTypes' in scope) {
|
|
780
|
+
const matched = scope.ColumnTypes.filter((type) => column.columnTypes?.includes(type));
|
|
781
|
+
if (matched.length) {
|
|
782
|
+
return `Column Type: ${matched.join(', ')}`;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
if ('ColumnIds' in scope && scope.ColumnIds.includes(column.columnId)) {
|
|
786
|
+
return 'Column Id';
|
|
787
|
+
}
|
|
788
|
+
return undefined;
|
|
789
|
+
}
|
|
482
790
|
function buildColumnDetail(adaptableId, registration, columnId) {
|
|
483
791
|
const api = registration.api;
|
|
484
792
|
const columns = api.columnApi.getColumns();
|
|
@@ -487,7 +795,14 @@ function buildColumnDetail(adaptableId, registration, columnId) {
|
|
|
487
795
|
friendlyName: column.friendlyName,
|
|
488
796
|
}));
|
|
489
797
|
if (!columns.length) {
|
|
490
|
-
return {
|
|
798
|
+
return {
|
|
799
|
+
columnId: '',
|
|
800
|
+
columns: [],
|
|
801
|
+
summary: [],
|
|
802
|
+
scopedObjects: [],
|
|
803
|
+
checkedModules: [],
|
|
804
|
+
hiddenModules: [],
|
|
805
|
+
};
|
|
491
806
|
}
|
|
492
807
|
const resolvedId = columnId || columns[0].columnId;
|
|
493
808
|
const column = api.columnApi.getColumnWithColumnId(resolvedId);
|
|
@@ -544,27 +859,36 @@ function buildColumnDetail(adaptableId, registration, columnId) {
|
|
|
544
859
|
].filter((row) => row != null);
|
|
545
860
|
const moduleService = api.internalApi.getModuleService();
|
|
546
861
|
const scopedObjects = [];
|
|
862
|
+
const checkedModules = [];
|
|
863
|
+
const hiddenModules = [];
|
|
547
864
|
for (const moduleName of COLUMN_INFO_MODULES) {
|
|
548
865
|
const module = moduleService.getModuleById(moduleName);
|
|
549
|
-
if (!module?.
|
|
866
|
+
if (!module?.toViewAll) {
|
|
550
867
|
continue;
|
|
551
868
|
}
|
|
552
869
|
if (module.moduleInfo.ModuleName === 'CalculatedColumn' && !column.isCalculatedColumn) {
|
|
553
870
|
continue;
|
|
554
871
|
}
|
|
555
|
-
|
|
872
|
+
if (!module.isModuleVisible()) {
|
|
873
|
+
hiddenModules.push(module.moduleInfo.FriendlyName);
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
checkedModules.push(module.moduleInfo.FriendlyName);
|
|
877
|
+
for (const item of module.toViewAll()) {
|
|
878
|
+
let matchedBy;
|
|
556
879
|
if ('Scope' in item.abObject) {
|
|
557
|
-
|
|
880
|
+
matchedBy = describeScopeMatch(api, column, item.abObject.Scope);
|
|
558
881
|
}
|
|
559
|
-
if ('ColumnId' in item.abObject
|
|
560
|
-
|
|
882
|
+
else if ('ColumnId' in item.abObject &&
|
|
883
|
+
item.abObject.ColumnId === column.columnId) {
|
|
884
|
+
matchedBy = 'Column Id';
|
|
885
|
+
}
|
|
886
|
+
if (!matchedBy) {
|
|
887
|
+
continue;
|
|
561
888
|
}
|
|
562
|
-
return false;
|
|
563
|
-
});
|
|
564
|
-
for (const item of itemsInScope) {
|
|
565
889
|
const rows = serializeViewItems(item.items);
|
|
566
890
|
if (rows.length) {
|
|
567
|
-
scopedObjects.push({ module: module.moduleInfo.FriendlyName, rows });
|
|
891
|
+
scopedObjects.push({ module: module.moduleInfo.FriendlyName, matchedBy, rows });
|
|
568
892
|
}
|
|
569
893
|
}
|
|
570
894
|
}
|
|
@@ -573,10 +897,12 @@ function buildColumnDetail(adaptableId, registration, columnId) {
|
|
|
573
897
|
columns: options,
|
|
574
898
|
summary,
|
|
575
899
|
scopedObjects,
|
|
900
|
+
checkedModules,
|
|
901
|
+
hiddenModules,
|
|
576
902
|
};
|
|
577
903
|
}
|
|
578
904
|
function buildGridInfo(adaptableId, api) {
|
|
579
|
-
const {
|
|
905
|
+
const { license, userName, primaryKey } = buildInstanceSummary(api);
|
|
580
906
|
const currentLayout = api.layoutApi.getCurrentLayout();
|
|
581
907
|
const isPivot = isPivotLayout(currentLayout);
|
|
582
908
|
const selectedRowInfo = api.gridApi.getSelectedRowInfo();
|
|
@@ -593,12 +919,12 @@ function buildGridInfo(adaptableId, api) {
|
|
|
593
919
|
userName,
|
|
594
920
|
primaryKey,
|
|
595
921
|
isAutogeneratedPrimaryKey: api.optionsApi.isAutogeneratePrimaryKey(),
|
|
596
|
-
|
|
922
|
+
license,
|
|
597
923
|
layout: {
|
|
598
924
|
name: api.layoutApi.getCurrentLayoutName(),
|
|
599
925
|
type: isPivot ? 'Pivot' : 'Table',
|
|
600
926
|
rowGroups: api.layoutApi.getCurrentRowGroupsColumnIds() ?? [],
|
|
601
|
-
pivotColumns: isPivot ?
|
|
927
|
+
pivotColumns: isPivot ? currentLayout.PivotColumns ?? [] : [],
|
|
602
928
|
sorts: (api.gridApi.getColumnSorts() ?? []).map((sort) => ({
|
|
603
929
|
columnId: sort.ColumnId,
|
|
604
930
|
sortOrder: sort.SortOrder,
|
|
@@ -637,13 +963,19 @@ Omit adaptableId when one instance is mounted.
|
|
|
637
963
|
getState(id?, section?) -> full AdapTable State, or one section such as 'Layout' or 'FormatColumn'
|
|
638
964
|
getPersistentState(id?) -> the user state AdapTable persists; pass it to the MCP check_state / migrate_state tools
|
|
639
965
|
getColumns(id?) -> [{ id, friendlyName, dataType, visible, ... }]; { id, dataType } is the MCP "columns" input
|
|
640
|
-
getColumnInfo(id?, columnId?) -> read-only Column Info: summary and Settings Panel tags
|
|
966
|
+
getColumnInfo(id?, columnId?) -> read-only Column Info: summary, and the objects that apply to that column with their Settings Panel tags and why each matched
|
|
641
967
|
getLogs(id?, { level?, channel?, limit? }) -> recent AdapTable log messages, buffered without localStorage.debug
|
|
642
968
|
getRecentActions(id?, limit?) -> recent state-changing actions
|
|
643
969
|
restoreState(id, state) -> Promise; restores a snapshot from getState()/getPersistentState()
|
|
644
970
|
openSettingsPanel(id?, moduleName?) -> opens the Settings Panel (e.g. 'Layout', 'FormatColumn')
|
|
645
971
|
setLogging(pattern | null) -> sets localStorage.debug (e.g. 'Adaptable:<id>:*'); returns the previous value
|
|
646
|
-
enableProfiling(enabled?) -> toggles localStorage.adaptableProfileTracks
|
|
972
|
+
enableProfiling(enabled?) -> toggles localStorage.adaptableProfileTracks (Chrome Performance panel tracks all the time)
|
|
973
|
+
startPerfRecording(id?, { hotPaths? }) / stopPerfRecording(id?) -> one recording: operations, long frames, memory (JS heap, AdapTable's structures), Hot Paths (per-cell/per-row costs)
|
|
974
|
+
recordPerfAfterReload({ hotPaths? }) -> reloads the page and records from its start (start-up included)
|
|
975
|
+
getPerfData(id?, cursor?) -> start-up timings and the last Performance recording (operations, Hot Paths, ...)
|
|
976
|
+
getPerformanceContext(id?) -> the facts the DevTools Performance Advisor checks (its rules run in DevTools)
|
|
977
|
+
getMemoryInfo(id?) -> approximate size of what AdapTable keeps in memory, read now
|
|
978
|
+
tagMemoryRoots(id?) -> tags AdapTable's structures for 5 min, so a heap snapshot can be broken down (DevTools Memory tab)
|
|
647
979
|
getApi(id?) -> the live AdaptableApi (not serializable)
|
|
648
980
|
|
|
649
981
|
Docs: https://www.adaptabletools.com/docs/dev-guide-support-devtools`;
|
|
@@ -697,7 +1029,15 @@ function createDevToolsGlobal() {
|
|
|
697
1029
|
const { level, channel, limit = DEFAULT_LOG_LIMIT } = options ?? {};
|
|
698
1030
|
const levels = level == null ? null : new Set(Array.isArray(level) ? level : [level]);
|
|
699
1031
|
const entries = (LOG_BUFFERS.get(id) ?? []).filter((entry) => (!levels || levels.has(entry.level)) && (!channel || entry.channel.includes(channel)));
|
|
700
|
-
return entries
|
|
1032
|
+
return entries
|
|
1033
|
+
.slice(Math.max(0, entries.length - limit))
|
|
1034
|
+
.map(({ timestamp, adaptableId, channel, level, args }) => ({
|
|
1035
|
+
timestamp,
|
|
1036
|
+
adaptableId,
|
|
1037
|
+
channel,
|
|
1038
|
+
level,
|
|
1039
|
+
args: [...args],
|
|
1040
|
+
}));
|
|
701
1041
|
},
|
|
702
1042
|
getRecentActions(adaptableId, limit = DEFAULT_ACTION_LIMIT) {
|
|
703
1043
|
const { actions } = resolveRegistration(adaptableId);
|
|
@@ -724,16 +1064,36 @@ function createDevToolsGlobal() {
|
|
|
724
1064
|
return previous;
|
|
725
1065
|
},
|
|
726
1066
|
enableProfiling(enabled = true) {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
1067
|
+
setProfileTracksEnabled(enabled);
|
|
1068
|
+
},
|
|
1069
|
+
startPerfRecording(adaptableId, options) {
|
|
1070
|
+
getPerfStore(resolveAdaptableId(adaptableId)).startRecording({
|
|
1071
|
+
hotPaths: options?.hotPaths !== false,
|
|
1072
|
+
});
|
|
1073
|
+
},
|
|
1074
|
+
stopPerfRecording(adaptableId) {
|
|
1075
|
+
getPerfStore(resolveAdaptableId(adaptableId)).stopRecording();
|
|
1076
|
+
},
|
|
1077
|
+
recordPerfAfterReload(options) {
|
|
1078
|
+
requestRecordAfterReload({
|
|
1079
|
+
hotPaths: options?.hotPaths !== false,
|
|
1080
|
+
stopWithPanel: false,
|
|
1081
|
+
fromPanel: false,
|
|
1082
|
+
});
|
|
1083
|
+
},
|
|
1084
|
+
tagMemoryRoots(adaptableId) {
|
|
1085
|
+
return startMemoryTagging(adaptableId, API_TAGGING_TIMEOUT_MS);
|
|
1086
|
+
},
|
|
1087
|
+
getPerfData(adaptableId, cursor) {
|
|
1088
|
+
const registration = resolveRegistration(adaptableId);
|
|
1089
|
+
const id = adaptableId ?? registration.api.optionsApi.getAdaptableId();
|
|
1090
|
+
return serializeForPostMessage(getPerfStore(id).getData(cursor, areAdaptableProfileTracksEnabled(id)));
|
|
1091
|
+
},
|
|
1092
|
+
getPerformanceContext(adaptableId) {
|
|
1093
|
+
return serializeForPostMessage(getPerformanceContext(adaptableId));
|
|
1094
|
+
},
|
|
1095
|
+
getMemoryInfo(adaptableId) {
|
|
1096
|
+
return serializeForPostMessage(getMemoryInfo(adaptableId));
|
|
737
1097
|
},
|
|
738
1098
|
getApi(adaptableId) {
|
|
739
1099
|
return resolveRegistration(adaptableId).api;
|
|
@@ -753,12 +1113,19 @@ function ensureDevToolsGlobal() {
|
|
|
753
1113
|
});
|
|
754
1114
|
}
|
|
755
1115
|
}
|
|
1116
|
+
let RECORD_ON_LOAD_CHECKED = false;
|
|
756
1117
|
function setupDevToolsOnLoad() {
|
|
757
1118
|
if (typeof window === 'undefined') {
|
|
758
1119
|
return;
|
|
759
1120
|
}
|
|
760
1121
|
ensureDevToolsGlobal();
|
|
761
1122
|
ensureLogIntentListening();
|
|
1123
|
+
onRecordingChange(onInstanceRecordingChange);
|
|
1124
|
+
setInventoryReader(getMemoryItems);
|
|
1125
|
+
if (!RECORD_ON_LOAD_CHECKED) {
|
|
1126
|
+
RECORD_ON_LOAD_CHECKED = true;
|
|
1127
|
+
consumeRecordOnLoadRequest();
|
|
1128
|
+
}
|
|
762
1129
|
}
|
|
763
1130
|
setupDevToolsOnLoad();
|
|
764
1131
|
export function listenForDevTools(adaptableInstance) {
|
|
@@ -768,6 +1135,7 @@ export function listenForDevTools(adaptableInstance) {
|
|
|
768
1135
|
setupDevToolsOnLoad();
|
|
769
1136
|
if (!DEV_TOOLS_LISTENING_STARTED) {
|
|
770
1137
|
DEV_TOOLS_LISTENING_STARTED = true;
|
|
1138
|
+
LISTENING_STARTED_AT = Date.now();
|
|
771
1139
|
window.addEventListener('message', (event) => {
|
|
772
1140
|
if (event.source !== window) {
|
|
773
1141
|
return;
|
|
@@ -775,18 +1143,37 @@ export function listenForDevTools(adaptableInstance) {
|
|
|
775
1143
|
if (!isMessageFromDevToolsContentScript(event.data)) {
|
|
776
1144
|
return;
|
|
777
1145
|
}
|
|
778
|
-
const
|
|
779
|
-
|
|
1146
|
+
const { source, type, payload } = event.data;
|
|
1147
|
+
if (type === 'register') {
|
|
1148
|
+
handleRegisterMessage(payload);
|
|
1149
|
+
}
|
|
1150
|
+
if (!isDevToolsConnected()) {
|
|
1151
|
+
ensureDevToolsReady();
|
|
1152
|
+
}
|
|
1153
|
+
if (source === 'adaptable-devtools-contentscript-panel') {
|
|
1154
|
+
notePanelMessage();
|
|
1155
|
+
}
|
|
780
1156
|
const handlers = {
|
|
781
|
-
register: (payload) => handleRegisterMessage(payload, devToolsWasReady),
|
|
782
1157
|
'restore-state': handleRestoreStateMessage,
|
|
783
1158
|
'open-settings-panel': handleOpenSettingsPanelMessage,
|
|
784
1159
|
'get-column-info': handleGetColumnInfoMessage,
|
|
785
1160
|
'load-variant': handleLoadVariantMessage,
|
|
786
1161
|
'theme-var-change': handleThemeVarChangeMessage,
|
|
787
1162
|
'apply-theme': handleApplyThemeMessage,
|
|
1163
|
+
'get-perf-data': handleGetPerfDataMessage,
|
|
1164
|
+
'set-perf-recording': handlePerfRecordingMessage,
|
|
1165
|
+
'record-and-reload': handleRecordAndReloadMessage,
|
|
1166
|
+
'tag-memory-roots': handleTagMemoryRootsMessage,
|
|
1167
|
+
'get-perf-context': handleGetPerfContextMessage,
|
|
1168
|
+
'get-memory-info': handleGetMemoryInfoMessage,
|
|
788
1169
|
};
|
|
789
|
-
|
|
1170
|
+
HANDLING_PANEL_MESSAGE = source === 'adaptable-devtools-contentscript-panel';
|
|
1171
|
+
try {
|
|
1172
|
+
handlers[event.data.type]?.(event.data.payload);
|
|
1173
|
+
}
|
|
1174
|
+
finally {
|
|
1175
|
+
HANDLING_PANEL_MESSAGE = false;
|
|
1176
|
+
}
|
|
790
1177
|
});
|
|
791
1178
|
}
|
|
792
1179
|
const { api, adaptableOptions } = adaptableInstance;
|
|
@@ -847,6 +1234,7 @@ function postMountMessage(adaptableId, api) {
|
|
|
847
1234
|
...buildInstanceSummary(api),
|
|
848
1235
|
settingsPanelNavigation: resolveVisibleSettingsPanelNavigationGroups(api),
|
|
849
1236
|
appThemeVars: readAppThemeVars(),
|
|
1237
|
+
devtools: buildPageInfo(adaptableId),
|
|
850
1238
|
themeVariant: getThemeVariant(api),
|
|
851
1239
|
}));
|
|
852
1240
|
}
|
|
@@ -869,11 +1257,14 @@ function postStateChangeMessage(adaptableId, options) {
|
|
|
869
1257
|
if (!api) {
|
|
870
1258
|
return;
|
|
871
1259
|
}
|
|
1260
|
+
STATE_CHANGED_WHILE_PAUSED.delete(adaptableId);
|
|
872
1261
|
window.postMessage(buildMessageForExtension({
|
|
873
1262
|
type: 'state-change',
|
|
874
1263
|
adaptableId,
|
|
875
1264
|
state: serializeAdaptableStateForPostMessage(getStateSnapshot(api)),
|
|
876
1265
|
actionName: options?.actionName,
|
|
1266
|
+
replay: options?.replay,
|
|
1267
|
+
devtools: buildPageInfo(adaptableId),
|
|
877
1268
|
...buildInstanceSummary(api),
|
|
878
1269
|
settingsPanelNavigation: resolveVisibleSettingsPanelNavigationGroups(api),
|
|
879
1270
|
themeVariant: getThemeVariant(api),
|
|
@@ -882,10 +1273,53 @@ function postStateChangeMessage(adaptableId, options) {
|
|
|
882
1273
|
scheduleGridRuntimeUpdate(adaptableId, options.api);
|
|
883
1274
|
}
|
|
884
1275
|
}
|
|
1276
|
+
const MODULES_READY_ACTION = 'Modules ready';
|
|
1277
|
+
const pendingModulesReadyStateCopies = new Map();
|
|
1278
|
+
function isModuleReadyAction(actionName) {
|
|
1279
|
+
return actionName?.endsWith('_READY') === true;
|
|
1280
|
+
}
|
|
1281
|
+
function scheduleModulesReadyStateCopy(adaptableId, send) {
|
|
1282
|
+
if (pendingModulesReadyStateCopies.has(adaptableId)) {
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
pendingModulesReadyStateCopies.set(adaptableId, setTimeout(() => {
|
|
1286
|
+
pendingModulesReadyStateCopies.delete(adaptableId);
|
|
1287
|
+
send();
|
|
1288
|
+
}, 0));
|
|
1289
|
+
}
|
|
1290
|
+
function cancelModulesReadyStateCopy(adaptableId) {
|
|
1291
|
+
const pending = pendingModulesReadyStateCopies.get(adaptableId);
|
|
1292
|
+
if (pending != null) {
|
|
1293
|
+
clearTimeout(pending);
|
|
1294
|
+
pendingModulesReadyStateCopies.delete(adaptableId);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
function postInitialState(adaptableId, api, options) {
|
|
1298
|
+
if (isStateTimelinePaused(adaptableId)) {
|
|
1299
|
+
STATE_CHANGED_WHILE_PAUSED.add(adaptableId);
|
|
1300
|
+
}
|
|
1301
|
+
else {
|
|
1302
|
+
postStateChangeMessage(adaptableId, { api, replay: options?.replay });
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
885
1305
|
function postGridRuntimeUpdate(adaptableId, api) {
|
|
886
|
-
if (!
|
|
1306
|
+
if (!shouldSendLiveUpdates()) {
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
const sinceLast = Date.now() - (lastGridRuntimePostAt.get(adaptableId) ?? 0);
|
|
1310
|
+
if (sinceLast < GRID_RUNTIME_MIN_INTERVAL_MS) {
|
|
1311
|
+
if (!pendingGridRuntimeUpdates.has(adaptableId)) {
|
|
1312
|
+
scheduleGridRuntimeUpdate(adaptableId, api, GRID_RUNTIME_MIN_INTERVAL_MS - sinceLast);
|
|
1313
|
+
}
|
|
887
1314
|
return;
|
|
888
1315
|
}
|
|
1316
|
+
postGridRuntimeUpdateNow(adaptableId, api);
|
|
1317
|
+
}
|
|
1318
|
+
function postGridRuntimeUpdateNow(adaptableId, api) {
|
|
1319
|
+
if (!shouldSendLiveUpdates() || getRegistration(adaptableId)?.api !== api) {
|
|
1320
|
+
return;
|
|
1321
|
+
}
|
|
1322
|
+
lastGridRuntimePostAt.set(adaptableId, Date.now());
|
|
889
1323
|
window.postMessage(buildMessageForExtension({
|
|
890
1324
|
type: 'state-change',
|
|
891
1325
|
adaptableId,
|
|
@@ -895,6 +1329,8 @@ function postGridRuntimeUpdate(adaptableId, api) {
|
|
|
895
1329
|
}
|
|
896
1330
|
function detachAdaptableInstanceListeners(adaptableId) {
|
|
897
1331
|
cancelScheduledGridRuntimeUpdate(adaptableId);
|
|
1332
|
+
STATE_CHANGED_WHILE_PAUSED.delete(adaptableId);
|
|
1333
|
+
cancelModulesReadyStateCopy(adaptableId);
|
|
898
1334
|
const registration = INSTANCE_REGISTRATIONS.get(adaptableId);
|
|
899
1335
|
if (registration) {
|
|
900
1336
|
registration.unsubscribe();
|
|
@@ -904,7 +1340,10 @@ function detachAdaptableInstanceListeners(adaptableId) {
|
|
|
904
1340
|
function unregisterAdaptableInstanceFromDevTools(adaptableId) {
|
|
905
1341
|
detachAdaptableInstanceListeners(adaptableId);
|
|
906
1342
|
LOG_BUFFERS.delete(adaptableId);
|
|
907
|
-
|
|
1343
|
+
lastGridRuntimePostAt.delete(adaptableId);
|
|
1344
|
+
deletePerfStore(adaptableId);
|
|
1345
|
+
untagMemoryRoots(adaptableId);
|
|
1346
|
+
if (isDevToolsConnected()) {
|
|
908
1347
|
window.postMessage(buildMessageForExtension({ type: 'unmount', adaptableId }));
|
|
909
1348
|
}
|
|
910
1349
|
}
|
|
@@ -939,11 +1378,12 @@ function buildMessageForExtension(params) {
|
|
|
939
1378
|
adaptableId,
|
|
940
1379
|
adaptableVersion: payload?.adaptableVersion,
|
|
941
1380
|
agGridVersion: payload?.agGridVersion,
|
|
942
|
-
|
|
1381
|
+
license: payload?.license,
|
|
943
1382
|
userName: payload?.userName,
|
|
944
1383
|
primaryKey: payload?.primaryKey,
|
|
945
1384
|
settingsPanelNavigation: payload?.settingsPanelNavigation,
|
|
946
1385
|
appThemeVars: payload?.appThemeVars,
|
|
1386
|
+
devtools: payload?.devtools,
|
|
947
1387
|
themeVariant: payload?.themeVariant,
|
|
948
1388
|
},
|
|
949
1389
|
};
|
|
@@ -968,8 +1408,10 @@ function buildMessageForExtension(params) {
|
|
|
968
1408
|
adaptableId,
|
|
969
1409
|
state: payload?.state,
|
|
970
1410
|
actionName: payload?.actionName,
|
|
1411
|
+
replay: payload?.replay,
|
|
1412
|
+
devtools: payload?.devtools,
|
|
971
1413
|
gridRuntime: payload?.gridRuntime,
|
|
972
|
-
|
|
1414
|
+
license: payload?.license,
|
|
973
1415
|
userName: payload?.userName,
|
|
974
1416
|
primaryKey: payload?.primaryKey,
|
|
975
1417
|
settingsPanelNavigation: payload?.settingsPanelNavigation,
|
|
@@ -977,7 +1419,7 @@ function buildMessageForExtension(params) {
|
|
|
977
1419
|
},
|
|
978
1420
|
};
|
|
979
1421
|
}
|
|
980
|
-
|
|
1422
|
+
return {
|
|
981
1423
|
...messageBase,
|
|
982
1424
|
url,
|
|
983
1425
|
type,
|
|
@@ -986,7 +1428,6 @@ function buildMessageForExtension(params) {
|
|
|
986
1428
|
...(payload ?? {}),
|
|
987
1429
|
},
|
|
988
1430
|
};
|
|
989
|
-
return message;
|
|
990
1431
|
}
|
|
991
1432
|
function recordAction(registration, actionName) {
|
|
992
1433
|
registration.actions.push({ timestamp: Date.now(), actionName });
|
|
@@ -1002,6 +1443,17 @@ function registerAdaptableInstanceInDevTools(adaptableId, api, adaptableInstance
|
|
|
1002
1443
|
actions: [],
|
|
1003
1444
|
unsubscribe: () => { },
|
|
1004
1445
|
};
|
|
1446
|
+
const sendStateChange = (actionName, replay) => {
|
|
1447
|
+
if (!isDevToolsConnected()) {
|
|
1448
|
+
return;
|
|
1449
|
+
}
|
|
1450
|
+
if (isStateTimelinePaused(adaptableId)) {
|
|
1451
|
+
STATE_CHANGED_WHILE_PAUSED.add(adaptableId);
|
|
1452
|
+
}
|
|
1453
|
+
else {
|
|
1454
|
+
postStateChangeMessage(adaptableId, { actionName, api, replay });
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1005
1457
|
let themeVariant = getThemeVariant(api);
|
|
1006
1458
|
const onThemeVariantMaybeChanged = () => {
|
|
1007
1459
|
const nextVariant = getThemeVariant(api);
|
|
@@ -1012,21 +1464,23 @@ function registerAdaptableInstanceInDevTools(adaptableId, api, adaptableInstance
|
|
|
1012
1464
|
clearThemePreviewNotMatching(nextVariant);
|
|
1013
1465
|
};
|
|
1014
1466
|
const onStateChange = (info) => {
|
|
1467
|
+
onStateChangedForMemoryRoots(adaptableId);
|
|
1015
1468
|
if (isTransientReduxAction(info.actionName)) {
|
|
1016
1469
|
return;
|
|
1017
1470
|
}
|
|
1018
1471
|
onThemeVariantMaybeChanged();
|
|
1019
1472
|
recordAction(registration, info.actionName);
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
1473
|
+
if (isModuleReadyAction(info.actionName)) {
|
|
1474
|
+
scheduleModulesReadyStateCopy(adaptableId, () => sendStateChange(MODULES_READY_ACTION, true));
|
|
1475
|
+
return;
|
|
1022
1476
|
}
|
|
1477
|
+
sendStateChange(info.actionName);
|
|
1023
1478
|
};
|
|
1024
1479
|
const onStateReloaded = () => {
|
|
1480
|
+
onStateChangedForMemoryRoots(adaptableId);
|
|
1025
1481
|
onThemeVariantMaybeChanged();
|
|
1026
1482
|
recordAction(registration, 'AdaptableStateReloaded');
|
|
1027
|
-
|
|
1028
|
-
postStateChangeMessage(adaptableId, { actionName: 'AdaptableStateReloaded', api });
|
|
1029
|
-
}
|
|
1483
|
+
sendStateChange('AdaptableStateReloaded');
|
|
1030
1484
|
};
|
|
1031
1485
|
const unsubscribeStateChanged = api.eventApi.on('AdaptableStateChanged', onStateChange);
|
|
1032
1486
|
const unsubscribeStateReloaded = api.eventApi.on('AdaptableStateReloaded', onStateReloaded);
|
|
@@ -1048,9 +1502,9 @@ function registerAdaptableInstanceInDevTools(adaptableId, api, adaptableInstance
|
|
|
1048
1502
|
unsubscribeDestroy();
|
|
1049
1503
|
};
|
|
1050
1504
|
INSTANCE_REGISTRATIONS.set(adaptableId, registration);
|
|
1051
|
-
if (
|
|
1505
|
+
if (isDevToolsConnected()) {
|
|
1052
1506
|
console.log(`Registering instance "${adaptableId}" into Adaptable DevTools`);
|
|
1053
1507
|
postMountMessage(adaptableId, api);
|
|
1054
|
-
|
|
1508
|
+
postInitialState(adaptableId, api);
|
|
1055
1509
|
}
|
|
1056
1510
|
}
|