@adaptabletools/adaptable 24.0.2 → 24.0.4

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.
Files changed (117) hide show
  1. package/devtools.d.ts +506 -5
  2. package/devtools.js +11 -1
  3. package/index.css +15 -5
  4. package/package.json +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +13 -1
  6. package/src/AdaptableOptions/DataImportOptions.d.ts +1 -1
  7. package/src/AdaptableOptions/ExportOptions.d.ts +2 -2
  8. package/src/AdaptableState/Common/AdaptableFormat.d.ts +2 -10
  9. package/src/AdaptableState/Common/RowSummary.d.ts +2 -0
  10. package/src/AdaptableState/LayoutState.d.ts +1 -1
  11. package/src/Api/AdaptableApi.d.ts +12 -0
  12. package/src/Api/GridApi.d.ts +13 -3
  13. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
  14. package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
  15. package/src/Api/Implementation/AlertApiImpl.js +2 -0
  16. package/src/Api/Implementation/FlashingCellApiImpl.js +3 -8
  17. package/src/Api/Implementation/GridApiImpl.js +1 -1
  18. package/src/Api/Internal/AlertInternalApi.d.ts +7 -0
  19. package/src/Api/Internal/AlertInternalApi.js +42 -9
  20. package/src/Api/Internal/CalculatedColumnInternalApi.js +25 -3
  21. package/src/Api/Internal/ExportInternalApi.d.ts +2 -0
  22. package/src/Api/Internal/ExportInternalApi.js +39 -3
  23. package/src/Api/Internal/LayoutInternalApi.d.ts +11 -1
  24. package/src/Api/Internal/LayoutInternalApi.js +34 -3
  25. package/src/Api/Internal/NoteInternalApi.d.ts +12 -0
  26. package/src/Api/Internal/NoteInternalApi.js +11 -0
  27. package/src/EnvVars.d.ts +1 -0
  28. package/src/EnvVars.js +1 -0
  29. package/src/Redux/Store/AdaptableStore.js +4 -7
  30. package/src/Strategy/FlashingCellModule.js +4 -1
  31. package/src/Utilities/Helpers/CellValueHelper.d.ts +20 -0
  32. package/src/Utilities/Helpers/CellValueHelper.js +35 -0
  33. package/src/Utilities/Services/CalculatedColumnExpressionService.d.ts +26 -1
  34. package/src/Utilities/Services/CalculatedColumnExpressionService.js +175 -42
  35. package/src/Utilities/Services/DataService.js +10 -6
  36. package/src/Utilities/Services/FlashingCellService.d.ts +12 -0
  37. package/src/Utilities/Services/FlashingCellService.js +40 -3
  38. package/src/Utilities/Services/Interface/ICalculatedColumnExpressionService.d.ts +12 -0
  39. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +22 -1
  40. package/src/Utilities/Services/QueryLanguageService.d.ts +17 -1
  41. package/src/Utilities/Services/QueryLanguageService.js +75 -2
  42. package/src/Utilities/Services/RowSummaryService.d.ts +2 -0
  43. package/src/Utilities/Services/RowSummaryService.js +6 -1
  44. package/src/Utilities/license/instanceLicense.d.ts +12 -0
  45. package/src/Utilities/license/instanceLicense.js +10 -0
  46. package/src/Utilities/license/licenseStatus.d.ts +26 -0
  47. package/src/Utilities/license/licenseStatus.js +72 -0
  48. package/src/View/Components/CellPopup/index.js +15 -10
  49. package/src/View/GridInfo/GridInfoPopup.js +6 -1
  50. package/src/View/Layout/TransposedPopup.js +1 -0
  51. package/src/View/Layout/Wizard/sections/AggregationsSection.d.ts +3 -5
  52. package/src/View/Layout/Wizard/sections/AggregationsSection.js +10 -24
  53. package/src/View/Layout/Wizard/sections/RowSummarySection.js +5 -1
  54. package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.d.ts +5 -1
  55. package/src/View/ObjectItemViews/Layout/aggregationSummaryHelpers.js +6 -3
  56. package/src/agGrid/AdaptableAgGrid.d.ts +87 -17
  57. package/src/agGrid/AdaptableAgGrid.js +586 -168
  58. package/src/agGrid/AdaptableFilterHandler.d.ts +2 -0
  59. package/src/agGrid/AdaptableFilterHandler.js +34 -0
  60. package/src/agGrid/AgGridAdapter.d.ts +19 -1
  61. package/src/agGrid/AgGridAdapter.js +39 -12
  62. package/src/agGrid/AgGridColumnAdapter.d.ts +2 -0
  63. package/src/agGrid/AgGridColumnAdapter.js +124 -78
  64. package/src/agGrid/AgGridExportAdapter.d.ts +5 -0
  65. package/src/agGrid/AgGridExportAdapter.js +31 -0
  66. package/src/agGrid/AgGridMenuAdapter.js +1 -1
  67. package/src/agGrid/applyGlobalGridOptions.d.ts +9 -0
  68. package/src/agGrid/applyGlobalGridOptions.js +36 -0
  69. package/src/agGrid/cellRenderers/BadgeRenderer.js +22 -0
  70. package/src/agGrid/columnMinMaxCache.d.ts +33 -0
  71. package/src/agGrid/columnMinMaxCache.js +50 -0
  72. package/src/devTools/PerfStore.d.ts +218 -0
  73. package/src/devTools/PerfStore.js +717 -0
  74. package/src/devTools/index.d.ts +33 -0
  75. package/src/devTools/index.js +132 -56
  76. package/src/devTools/logBuffer.d.ts +17 -0
  77. package/src/devTools/logBuffer.js +33 -0
  78. package/src/devTools/memoryInfo.d.ts +15 -0
  79. package/src/devTools/memoryInfo.js +229 -0
  80. package/src/devTools/memoryRoots.d.ts +41 -0
  81. package/src/devTools/memoryRoots.js +136 -0
  82. package/src/devTools/perfContext.d.ts +5 -0
  83. package/src/devTools/perfContext.js +155 -0
  84. package/src/devTools/perfInstrumentation.d.ts +13 -0
  85. package/src/devTools/perfInstrumentation.js +78 -0
  86. package/src/env.js +2 -2
  87. package/src/layout-manager/src/LayoutManagerModel.d.ts +3 -1
  88. package/src/layout-manager/src/expandAllRowGroups.d.ts +6 -0
  89. package/src/layout-manager/src/expandAllRowGroups.js +13 -0
  90. package/src/layout-manager/src/index.js +18 -10
  91. package/src/setupDevTools.js +560 -106
  92. package/tsconfig.esm.tsbuildinfo +1 -1
  93. package/vendor/components/Combobox/index.js +1 -1
  94. package/vendor/components/Combobox/index.js.map +1 -1
  95. package/vendor/components/Radio/index.d.ts.map +1 -1
  96. package/vendor/components/Radio/index.js +1 -1
  97. package/vendor/components/Radio/index.js.map +1 -1
  98. package/vendor/components/Resizable/index.d.ts +14 -9
  99. package/vendor/components/Resizable/index.d.ts.map +1 -1
  100. package/vendor/components/Resizable/index.js +23 -0
  101. package/vendor/components/Resizable/index.js.map +1 -1
  102. package/vendor/components/Resizable/resizableUtils.d.ts +24 -13
  103. package/vendor/components/Resizable/resizableUtils.d.ts.map +1 -1
  104. package/vendor/components/Resizable/resizableUtils.js +13 -3
  105. package/vendor/components/Resizable/resizableUtils.js.map +1 -1
  106. package/vendor/components/index.css +12 -5
  107. package/vendor/components/ui/combobox.js +1 -1
  108. package/vendor/components/ui/combobox.js.map +1 -1
  109. package/vendor/components/ui/input.js +1 -1
  110. package/vendor/components/ui/input.js.map +1 -1
  111. package/vendor/components/ui/select.js +1 -1
  112. package/vendor/components/ui/select.js.map +1 -1
  113. package/vendor/components/ui/textarea.js +1 -1
  114. package/vendor/components/ui/textarea.js.map +1 -1
  115. package/vendor/components/ui/tooltip.d.ts.map +1 -1
  116. package/vendor/components/ui/tooltip.js +3 -1
  117. package/vendor/components/ui/tooltip.js.map +1 -1
@@ -0,0 +1,136 @@
1
+ import { getPerfStore } from './PerfStore';
2
+ export const MEMORY_ROOTS_GLOBAL = '__ADAPTABLE_MEMORY_ROOTS__';
3
+ const TAGGING_TIMEOUT_MS = 15_000;
4
+ export const API_TAGGING_TIMEOUT_MS = 5 * 60_000;
5
+ const TAGGINGS = new Map();
6
+ let ACTIVE_TAGGINGS = 0;
7
+ function getRegistry() {
8
+ if (typeof WeakRef === 'undefined' || typeof globalThis === 'undefined') {
9
+ return undefined;
10
+ }
11
+ const holder = globalThis;
12
+ holder[MEMORY_ROOTS_GLOBAL] ??= {};
13
+ return holder[MEMORY_ROOTS_GLOBAL];
14
+ }
15
+ function isTaggable(value) {
16
+ return value != null && (typeof value === 'object' || typeof value === 'function');
17
+ }
18
+ function isDomNode(value) {
19
+ return typeof Node !== 'undefined' && value instanceof Node;
20
+ }
21
+ function tag(roots, key, value) {
22
+ if (!isTaggable(value)) {
23
+ delete roots[key];
24
+ return;
25
+ }
26
+ if (roots[key]?.deref() !== value) {
27
+ roots[key] = new WeakRef(value);
28
+ }
29
+ }
30
+ function refresh(adaptableId, tagging) {
31
+ const { api, instance, roots } = tagging;
32
+ const safe = (fn) => {
33
+ try {
34
+ return fn();
35
+ }
36
+ catch {
37
+ return undefined;
38
+ }
39
+ };
40
+ tag(roots, 'instance', instance);
41
+ tag(roots, 'api', api);
42
+ for (const [field, value] of Object.entries(api)) {
43
+ if (isTaggable(value)) {
44
+ tag(roots, `api.${field}`, value);
45
+ }
46
+ }
47
+ if (instance) {
48
+ for (const [field, value] of Object.entries(instance)) {
49
+ if (isTaggable(value) && !isDomNode(value)) {
50
+ tag(roots, `instance.${field}`, value);
51
+ }
52
+ }
53
+ }
54
+ const state = safe(() => api.stateApi.getAllState());
55
+ tag(roots, 'state', state);
56
+ if (state) {
57
+ for (const [key, value] of Object.entries(state)) {
58
+ if (key === 'Internal' && isTaggable(value)) {
59
+ for (const [internalKey, internalValue] of Object.entries(value)) {
60
+ tag(roots, `state.Internal.${internalKey}`, internalValue);
61
+ }
62
+ continue;
63
+ }
64
+ tag(roots, `state.${key}`, value);
65
+ }
66
+ }
67
+ tag(roots, 'runtime.expressionEngine', safe(() => api.internalApi.getQueryLanguageService()));
68
+ tag(roots, 'runtime.columnMinMax', safe(() => instance
69
+ ?.columnMinMaxValuesCache));
70
+ tag(roots, 'devtools.perf', getPerfStore(adaptableId));
71
+ tag(roots, 'devtools.global', globalThis.__ADAPTABLE_DEVTOOLS__);
72
+ const gridApi = safe(() => instance?.agGridAdapter?.getAgGridApi());
73
+ tag(roots, 'boundary.agGrid', gridApi);
74
+ const rowNode = safe(() => gridApi?.getDisplayedRowAtIndex(0));
75
+ let rootNode = rowNode;
76
+ for (let depth = 0; rootNode?.parent && depth < 100; depth++) {
77
+ rootNode = rootNode.parent;
78
+ }
79
+ tag(roots, 'boundary.agGridRootNode', rootNode);
80
+ tag(roots, 'boundary.agGridBeans', rowNode?.beans);
81
+ for (const [key, value] of Object.entries(tagging.extra())) {
82
+ tag(roots, key, value);
83
+ }
84
+ const registry = getRegistry();
85
+ if (registry) {
86
+ registry[adaptableId] = roots;
87
+ }
88
+ }
89
+ function stop(adaptableId) {
90
+ const tagging = TAGGINGS.get(adaptableId);
91
+ if (!tagging) {
92
+ return;
93
+ }
94
+ clearTimeout(tagging.timer);
95
+ TAGGINGS.delete(adaptableId);
96
+ ACTIVE_TAGGINGS = TAGGINGS.size;
97
+ const registry = getRegistry();
98
+ if (registry) {
99
+ delete registry[adaptableId];
100
+ }
101
+ }
102
+ export function tagMemoryRoots(adaptableId, api, instance, extra = () => ({}), durationMs = TAGGING_TIMEOUT_MS) {
103
+ if (!getRegistry()) {
104
+ return false;
105
+ }
106
+ let tagging = TAGGINGS.get(adaptableId);
107
+ if (!tagging || tagging.api !== api) {
108
+ stop(adaptableId);
109
+ tagging = { api, instance, extra, until: 0, roots: {} };
110
+ TAGGINGS.set(adaptableId, tagging);
111
+ ACTIVE_TAGGINGS = TAGGINGS.size;
112
+ }
113
+ tagging.until = Math.max(tagging.until, Date.now() + durationMs);
114
+ clearTimeout(tagging.timer);
115
+ tagging.timer = setTimeout(() => stop(adaptableId), tagging.until - Date.now());
116
+ refresh(adaptableId, tagging);
117
+ return true;
118
+ }
119
+ export function onStateChangedForMemoryRoots(adaptableId) {
120
+ if (ACTIVE_TAGGINGS === 0) {
121
+ return;
122
+ }
123
+ const tagging = TAGGINGS.get(adaptableId);
124
+ if (tagging) {
125
+ refresh(adaptableId, tagging);
126
+ }
127
+ }
128
+ export function untagMemoryRoots(adaptableId) {
129
+ stop(adaptableId);
130
+ }
131
+ export function getMemoryTaggingInfo(adaptableId) {
132
+ const tagging = TAGGINGS.get(adaptableId);
133
+ return tagging
134
+ ? { tagging: true, until: tagging.until, structures: Object.keys(tagging.roots).length }
135
+ : { tagging: false };
136
+ }
@@ -0,0 +1,5 @@
1
+ import type { DevToolsPerfContext, DevToolsPerfContextResult } from '../../devtools';
2
+ import type { AdaptableAgGrid } from '../agGrid/AdaptableAgGrid';
3
+ import type { AdaptableApi } from '../Api/AdaptableApi';
4
+ export declare function buildPerfContext(api: AdaptableApi, instance: AdaptableAgGrid | undefined): DevToolsPerfContext;
5
+ export declare function buildPerfContextResult(adaptableId: string, api: AdaptableApi, instance: AdaptableAgGrid | undefined): DevToolsPerfContextResult;
@@ -0,0 +1,155 @@
1
+ import { AG_GRID_VERSION } from '../agGrid/AgGridModulesAdapter';
2
+ import { ADAPTABLE_VERSION } from '../EnvVars';
3
+ import { getAlertType } from '../Utilities/Helpers/AlertTypeHelper';
4
+ import { getPerfStore } from './PerfStore';
5
+ function isScopeAll(scope) {
6
+ return !!scope && 'All' in scope && scope.All === true;
7
+ }
8
+ function safe(fn, fallback) {
9
+ try {
10
+ return fn();
11
+ }
12
+ catch {
13
+ return fallback;
14
+ }
15
+ }
16
+ export function buildPerfContext(api, instance) {
17
+ const gridApi = instance?.agGridAdapter?.getAgGridApi();
18
+ const getGridOption = (name) => safe(() => gridApi?.getGridOption(name), undefined);
19
+ const columnIdsInScope = (scope) => safe(() => api.columnScopeApi.getColumnsInScope(scope).map((column) => column.columnId), []);
20
+ const isModuleAvailable = (module) => safe(() => api.internalApi.getModuleService().getModuleById(module)?.isModuleAvailable(), false) ?? false;
21
+ const calculatedColumnsState = safe(() => api.calculatedColumnApi.getCalculatedColumns(), []);
22
+ const calculatedIds = new Set(calculatedColumnsState.map((column) => column.ColumnId));
23
+ const expressions = [];
24
+ const addExpression = (module, objectName, expression, validate) => {
25
+ if (!expression?.trim()) {
26
+ return;
27
+ }
28
+ expressions.push({
29
+ module,
30
+ objectName,
31
+ expression,
32
+ valid: safe(() => validate(expression), false),
33
+ });
34
+ };
35
+ const formatColumns = safe(() => api.formatColumnApi.getActiveFormatColumns(), []).map((formatColumn) => {
36
+ addExpression('FormatColumn', formatColumn.Name, formatColumn.Rule, (rule) => api.expressionApi.isValidScalarExpression(rule, 'FormatColumn'));
37
+ const scopeAll = isScopeAll(formatColumn.Scope);
38
+ return {
39
+ name: formatColumn.Name,
40
+ scopeAll,
41
+ hasRule: !!formatColumn.Rule?.trim(),
42
+ columnIds: scopeAll ? [] : columnIdsInScope(formatColumn.Scope),
43
+ };
44
+ });
45
+ const calculatedColumns = calculatedColumnsState.map((column) => {
46
+ const kind = safe(() => api.expressionApi.getExpressionKind(column.Expression, 'CalculatedColumn'), 'scalar');
47
+ addExpression('CalculatedColumn', column.FriendlyName || column.ColumnId, column.Expression, (expression) => kind === 'aggregated'
48
+ ? api.expressionApi.isValidAggregatedExpression(expression, 'CalculatedColumn')
49
+ : api.expressionApi.isValidValueExpression(expression, 'CalculatedColumn'));
50
+ const referenced = safe(() => api.expressionApi.getColumnsFromExpression(column.Expression), []);
51
+ return {
52
+ columnId: column.ColumnId,
53
+ name: column.FriendlyName || column.ColumnId,
54
+ kind,
55
+ referencedCalculatedColumnIds: [...new Set(referenced)].filter((columnId) => columnId !== column.ColumnId && calculatedIds.has(columnId)),
56
+ };
57
+ });
58
+ const flashingColumnIds = new Set();
59
+ safe(() => api.flashingCellApi.getActiveFlashingCellDefinitions(), []).forEach((definition) => {
60
+ addExpression('FlashingCell', definition.Name, definition.Rule, (rule) => api.expressionApi.isValidScalarExpression(rule, 'FlashingCell'));
61
+ columnIdsInScope(definition.Scope).forEach((columnId) => flashingColumnIds.add(columnId));
62
+ });
63
+ const badgeColumnIds = [];
64
+ safe(() => api.styledColumnApi.getActiveStyledColumns(), []).forEach((styledColumn) => {
65
+ if (!styledColumn.BadgeStyle) {
66
+ return;
67
+ }
68
+ badgeColumnIds.push({ name: styledColumn.Name, columnId: styledColumn.ColumnId });
69
+ (styledColumn.BadgeStyle.Badges ?? []).forEach((badge, index) => {
70
+ addExpression('StyledColumn', `${styledColumn.Name} (badge ${index + 1})`, badge.Rule, (rule) => api.expressionApi.isValidScalarExpression(rule, 'StyledColumn'));
71
+ });
72
+ });
73
+ const alerts = safe(() => api.alertApi.getActiveAlertDefinitions(), []).map((alert) => {
74
+ const rule = alert.Rule;
75
+ const kind = rule
76
+ ? safe(() => api.expressionApi.getExpressionKind(rule, 'Alert'), 'scalar')
77
+ : undefined;
78
+ if (rule) {
79
+ addExpression('Alert', alert.Name, rule, (expression) => kind === 'aggregated'
80
+ ? api.expressionApi.isValidAggregatedExpression(expression, 'Alert')
81
+ : api.expressionApi.isValidScalarExpression(expression, 'Alert'));
82
+ }
83
+ return {
84
+ name: alert.Name,
85
+ type: safe(() => getAlertType(alert, kind), null),
86
+ };
87
+ });
88
+ const gridFilter = safe(() => api.filterApi.gridFilterApi.getCurrentGridFilterExpression(), '');
89
+ addExpression('GridFilter', 'Current Grid Filter', gridFilter, (expression) => api.expressionApi.isValidScalarExpression(expression, 'GridFilter'));
90
+ const dataChangeHistoryOptions = safe(() => api.optionsApi.getDataChangeHistoryOptions(), {});
91
+ const diagnostics = safe(() => api.internalApi.getQueryLanguageService().getDiagnostics(), undefined);
92
+ const adaptableId = safe(() => api.optionsApi.getAdaptableId(), '');
93
+ const perfStore = adaptableId ? getPerfStore(adaptableId) : undefined;
94
+ const perfData = perfStore && (perfStore.ticking.hasData() || perfStore.hotPaths.size > 0)
95
+ ? perfStore.getData({
96
+ measures: Infinity,
97
+ longFrames: Infinity,
98
+ heap: Infinity,
99
+ inventory: Infinity,
100
+ })
101
+ : undefined;
102
+ return {
103
+ rowModelType: getGridOption('rowModelType') ?? 'clientSide',
104
+ rowCount: safe(() => api.gridApi.getRowCount(), 0),
105
+ columnCount: safe(() => api.gridApi.getColumnCount(), 0),
106
+ visibleColumnCount: safe(() => api.gridApi.getVisibleColumnCount(), 0),
107
+ primaryKey: safe(() => api.optionsApi.getPrimaryKey(), undefined),
108
+ isAutogeneratedPrimaryKey: safe(() => api.optionsApi.isAutogeneratePrimaryKey(), false),
109
+ hasRowGroups: safe(() => (api.layoutApi.getCurrentRowGroupsColumnIds() ?? []).length > 0, false),
110
+ gridOptions: {
111
+ cacheQuickFilter: getGridOption('cacheQuickFilter') === true,
112
+ valueCache: getGridOption('valueCache') === true,
113
+ },
114
+ quickSearch: {
115
+ filterGridAfterQuickSearch: safe(() => api.optionsApi.getQuickSearchOptions().filterGridAfterQuickSearch, false) ===
116
+ true,
117
+ },
118
+ dataChangeHistory: {
119
+ available: isModuleAvailable('DataChangeHistory'),
120
+ mode: safe(() => api.dataChangeHistoryApi.getDataChangeHistoryMode(), 'INACTIVE'),
121
+ activeByDefault: dataChangeHistoryOptions.activeByDefault === true,
122
+ maxDataChangesInStore: dataChangeHistoryOptions.maxDataChangesInStore,
123
+ entries: safe(() => api.dataChangeHistoryApi.getDataChangeHistoryLog().length, 0),
124
+ },
125
+ expressionOptions: {
126
+ maxHistoryPerCell: safe(() => api.optionsApi.getExpressionOptions().maxHistoryPerCell, undefined),
127
+ maxTimeframeSize: safe(() => api.optionsApi.getExpressionOptions().maxTimeframeSize, undefined),
128
+ },
129
+ formatColumns,
130
+ calculatedColumns,
131
+ badgeColumnIds,
132
+ flashingColumnIds: [...flashingColumnIds],
133
+ alerts,
134
+ expressions,
135
+ observableHistoryEntries: diagnostics?.history?.entries,
136
+ expressionCache: diagnostics
137
+ ? {
138
+ size: diagnostics.rowEvaluatorCache,
139
+ limit: diagnostics.rowEvaluatorCacheLimit,
140
+ evictions: diagnostics.rowEvaluatorEvictions ?? 0,
141
+ }
142
+ : undefined,
143
+ ticking: perfData?.ticking,
144
+ hotPaths: perfData?.hotPaths ?? [],
145
+ };
146
+ }
147
+ export function buildPerfContextResult(adaptableId, api, instance) {
148
+ return {
149
+ adaptableId,
150
+ generatedAt: Date.now(),
151
+ adaptableVersion: ADAPTABLE_VERSION,
152
+ agGridVersion: AG_GRID_VERSION,
153
+ context: buildPerfContext(api, instance),
154
+ };
155
+ }
@@ -0,0 +1,13 @@
1
+ import type { DevToolsHotPathStat } from '../../devtools';
2
+ import type { AdaptableApi } from '../Api/AdaptableApi';
3
+ import type { AdaptableModule } from '../AdaptableState/Common/Types';
4
+ import type { PerfRecorder } from './PerfStore';
5
+ /**
6
+ * Helpers for the hot paths that report to a DevTools recording (see `PerfRecorder`).
7
+ * Everything here only runs while a recording is active.
8
+ */
9
+ type ExpressionOwner = Pick<DevToolsHotPathStat, 'objectId' | 'objectName' | 'columnId'>;
10
+ /** Which AdapTable object an expression belongs to, so the cost can be attributed to it */
11
+ export declare function findExpressionOwner(api: AdaptableApi, module: AdaptableModule, expression: string): ExpressionOwner;
12
+ export declare function recordExpressionEvaluation(recorder: PerfRecorder, api: AdaptableApi, module: AdaptableModule, expression: string, start: number): void;
13
+ export {};
@@ -0,0 +1,78 @@
1
+ function matches(candidate, expression) {
2
+ return !!candidate && candidate.trim() === expression.trim();
3
+ }
4
+ export function findExpressionOwner(api, module, expression) {
5
+ try {
6
+ switch (module) {
7
+ case 'FormatColumn': {
8
+ const owner = api.formatColumnApi
9
+ .getFormatColumns()
10
+ .find((formatColumn) => matches(formatColumn.Rule, expression));
11
+ return owner ? { objectId: owner.Uuid, objectName: owner.Name } : {};
12
+ }
13
+ case 'Alert': {
14
+ const owner = api.alertApi
15
+ .getAlertDefinitions()
16
+ .find((alert) => matches(alert.Rule, expression));
17
+ return owner ? { objectId: owner.Uuid, objectName: owner.Name } : {};
18
+ }
19
+ case 'FlashingCell': {
20
+ const owner = api.flashingCellApi
21
+ .getFlashingCellDefinitions()
22
+ .find((definition) => matches(definition.Rule, expression));
23
+ return owner ? { objectId: owner.Uuid, objectName: owner.Name } : {};
24
+ }
25
+ case 'CalculatedColumn': {
26
+ const owner = api.calculatedColumnApi
27
+ .getCalculatedColumns()
28
+ .find((column) => matches(column.Expression, expression));
29
+ return owner
30
+ ? {
31
+ objectId: owner.Uuid,
32
+ objectName: owner.FriendlyName || owner.ColumnId,
33
+ columnId: owner.ColumnId,
34
+ }
35
+ : {};
36
+ }
37
+ case 'StyledColumn': {
38
+ for (const styledColumn of api.styledColumnApi.getStyledColumns()) {
39
+ if (styledColumn.BadgeStyle?.Badges?.some((badge) => matches(badge.Rule, expression))) {
40
+ return {
41
+ objectId: styledColumn.Uuid,
42
+ objectName: styledColumn.Name,
43
+ columnId: styledColumn.ColumnId,
44
+ };
45
+ }
46
+ }
47
+ return {};
48
+ }
49
+ case 'GridFilter':
50
+ return { objectName: 'Grid Filter' };
51
+ case 'NamedQuery': {
52
+ const owner = api.namedQueryApi
53
+ .getNamedQueries()
54
+ .find((query) => matches(query.Expression, expression));
55
+ return owner ? { objectId: owner.Uuid, objectName: owner.Name } : {};
56
+ }
57
+ default:
58
+ return {};
59
+ }
60
+ }
61
+ catch {
62
+ return {};
63
+ }
64
+ }
65
+ const MAX_EXPRESSION_LENGTH = 300;
66
+ export function recordExpressionEvaluation(recorder, api, module, expression, start) {
67
+ recorder.add('expression', `expression:${module}:${expression}`, start, () => {
68
+ const owner = findExpressionOwner(api, module, expression);
69
+ return {
70
+ module,
71
+ ...owner,
72
+ objectName: owner.objectName ?? `${module} expression`,
73
+ expression: expression.length > MAX_EXPRESSION_LENGTH
74
+ ? `${expression.slice(0, MAX_EXPRESSION_LENGTH)}…`
75
+ : expression,
76
+ };
77
+ });
78
+ }
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  NEXT_PUBLIC_INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1793805399874 || Date.now(),
4
- VERSION: "24.0.2" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1795455639991 || Date.now(),
4
+ VERSION: "24.0.4" || '--current-version--',
5
5
  };
@@ -118,7 +118,9 @@ export interface BaseLayoutModel {
118
118
  };
119
119
  RowSelection?: LayoutRowSelection | false;
120
120
  /**
121
- * Display Grand Total Row of the Pivot Table
121
+ * Where the grand total row is shown, in Table and Pivot Layouts.
122
+ *
123
+ * `'top'`, `'bottom'`, `'pinnedTop'` or `'pinnedBottom'`. `true` is the same as `'top'`. `false`, or omitting the property, turns the grand total row off.
122
124
  */
123
125
  GrandTotalRow?: 'top' | 'bottom' | 'pinnedTop' | 'pinnedBottom' | boolean;
124
126
  }
@@ -0,0 +1,6 @@
1
+ import { GridApi } from 'ag-grid-enterprise';
2
+ /**
3
+ * Expands all Row Groups, but not Master rows: AG Grid `expandAll()` also expands Master rows
4
+ * on the Client-Side Row Model.
5
+ */
6
+ export declare function expandAllRowGroups(gridApi: GridApi): void;
@@ -0,0 +1,13 @@
1
+ export function expandAllRowGroups(gridApi) {
2
+ const isClientSideRowModel = (gridApi.getGridOption('rowModelType') ?? 'clientSide') === 'clientSide';
3
+ if (!gridApi.getGridOption('masterDetail') || !isClientSideRowModel) {
4
+ gridApi.expandAll();
5
+ return;
6
+ }
7
+ gridApi.forEachNode((node) => {
8
+ if (node.group) {
9
+ node.expanded = true;
10
+ }
11
+ });
12
+ gridApi.onGroupExpandedOrCollapsed();
13
+ }
@@ -10,6 +10,7 @@ import { destructurePivotColumnId } from './destructurePivotColumnId';
10
10
  import { isPivotAggTotalColumn } from './isPivotAggTotalColumn';
11
11
  import { isPivotGrandTotal } from './isPivotGrandTotal';
12
12
  import { isPivotColumnTotal } from './isPivotColumnTotal';
13
+ import { expandAllRowGroups } from './expandAllRowGroups';
13
14
  import { getMarker } from '../../devTools';
14
15
  export const PIVOT_ANY_TOTAL_COL_TYPE = 'pivotAnyTotal';
15
16
  export const PIVOT_GRAND_TOTAL_COL_TYPE = 'pivotGrandTotal';
@@ -434,7 +435,7 @@ export class LayoutManager extends LMEmitter {
434
435
  this.initialColumnWidths[colId.replace(AUTO_GROUP_COLUMN_ID__MULTI_PREFIX, '')];
435
436
  }
436
437
  }
437
- if (colState.flex != undefined) {
438
+ if (colState.flex != undefined && colState.flex > 0) {
438
439
  const colSizing = { ...ColumnSizing[colId] };
439
440
  delete colSizing.Width;
440
441
  colSizing.Flex = colState.flex;
@@ -442,7 +443,7 @@ export class LayoutManager extends LMEmitter {
442
443
  }
443
444
  else if (colState.width && initialWidth != colState.width) {
444
445
  const colSizing = { ...ColumnSizing[colId] };
445
- if (colSizing.Flex == null) {
446
+ if (!colSizing.Flex) {
446
447
  delete colSizing.Flex;
447
448
  colSizing.Width = colState.width;
448
449
  ColumnSizing[colId] = colSizing;
@@ -1025,9 +1026,11 @@ export class LayoutManager extends LMEmitter {
1025
1026
  this.gridApi.setGridOption('pivotMode', true);
1026
1027
  this.applyPivotLayout(layout, options);
1027
1028
  perfApplyPivot.end();
1028
- marker.end({
1029
- details: this.getLayoutDetailsAsString(layout),
1030
- });
1029
+ if (marker.isActive) {
1030
+ marker.end({
1031
+ details: this.getLayoutDetailsAsString(layout),
1032
+ });
1033
+ }
1031
1034
  }
1032
1035
  finally {
1033
1036
  resume();
@@ -1042,9 +1045,11 @@ export class LayoutManager extends LMEmitter {
1042
1045
  }
1043
1046
  this.applyTableLayout(layout, options);
1044
1047
  perfApplyTable.end();
1045
- marker.end({
1046
- details: this.getLayoutDetailsAsString(layout),
1047
- });
1048
+ if (marker.isActive) {
1049
+ marker.end({
1050
+ details: this.getLayoutDetailsAsString(layout),
1051
+ });
1052
+ }
1048
1053
  }
1049
1054
  finally {
1050
1055
  resume();
@@ -1264,7 +1269,7 @@ export class LayoutManager extends LMEmitter {
1264
1269
  return;
1265
1270
  }
1266
1271
  if (RowGroupValues.RowGroupDisplay === 'always-expanded') {
1267
- this.gridApi.expandAll();
1272
+ expandAllRowGroups(this.gridApi);
1268
1273
  return;
1269
1274
  }
1270
1275
  if (RowGroupValues.RowGroupDisplay === 'always-collapsed') {
@@ -1486,9 +1491,12 @@ export class LayoutManager extends LMEmitter {
1486
1491
  if (colSizing.Width != undefined) {
1487
1492
  colState.width = colSizing.Width;
1488
1493
  }
1489
- else if (colSizing.Flex != undefined) {
1494
+ else if (colSizing.Flex != undefined && colSizing.Flex > 0) {
1490
1495
  colState.flex = colSizing.Flex;
1491
1496
  }
1497
+ else if (colSizing.Flex != undefined) {
1498
+ colState.width = this.getDefaultColumnWidthForCol(colState.colId);
1499
+ }
1492
1500
  }
1493
1501
  else {
1494
1502
  let defaultColState;