@adaptabletools/adaptable 23.0.22 → 23.1.0-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/package.json +3 -2
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +37 -1
  3. package/src/AdaptableOptions/ColumnMenuOptions.d.ts +1 -1
  4. package/src/AdaptableOptions/ContextMenuOptions.d.ts +1 -1
  5. package/src/AdaptableOptions/FilterOptions.d.ts +22 -6
  6. package/src/Api/Internal/FormatColumnInternalApi.d.ts +12 -2
  7. package/src/Api/Internal/FormatColumnInternalApi.js +4 -0
  8. package/src/Redux/Store/AdaptableStore.js +20 -6
  9. package/src/Strategy/LayoutModule.js +4 -1
  10. package/src/Utilities/Helpers/StyledColumns/SparklineStyleHelper.d.ts +2 -0
  11. package/src/Utilities/Helpers/StyledColumns/SparklineStyleHelper.js +13 -10
  12. package/src/Utilities/Hooks/useAdaptableOptions.d.ts +1 -1
  13. package/src/Utilities/Services/AnnotationsService.js +8 -8
  14. package/src/View/Components/ColumnFilter/components/FloatingFilterValues.d.ts +3 -9
  15. package/src/View/Components/ColumnFilter/components/FloatingFilterValues.js +10 -6
  16. package/src/View/Components/PredicateEditor/PredicateEditor.js +8 -4
  17. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +18 -8
  18. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +2 -2
  19. package/src/View/Wizard/OnePageWizards.d.ts +1 -1
  20. package/src/agGrid/AdaptableAgGrid.d.ts +71 -10
  21. package/src/agGrid/AdaptableAgGrid.js +125 -88
  22. package/src/agGrid/AgGridAdapter.d.ts +33 -1
  23. package/src/agGrid/AgGridAdapter.js +91 -0
  24. package/src/agGrid/AgGridColumnAdapter.d.ts +68 -1
  25. package/src/agGrid/AgGridColumnAdapter.js +191 -73
  26. package/src/agGrid/AgGridMenuAdapter.d.ts +8 -2
  27. package/src/agGrid/AgGridMenuAdapter.js +17 -4
  28. package/src/agGrid/AgGridModulesAdapter.js +6 -1
  29. package/src/agGrid/AgGridThemeAdapter.d.ts +17 -0
  30. package/src/agGrid/AgGridThemeAdapter.js +37 -6
  31. package/src/agGrid/gridRefreshScope.d.ts +20 -0
  32. package/src/agGrid/gridRefreshScope.js +39 -0
  33. package/src/components/Radio/index.d.ts +2 -2
  34. package/src/devTools/DevToolsTracks.d.ts +6 -0
  35. package/src/devTools/DevToolsTracks.js +6 -0
  36. package/src/devTools/index.d.ts +25 -1
  37. package/src/env.js +2 -2
  38. package/src/layout-manager/src/index.d.ts +9 -0
  39. package/src/layout-manager/src/index.js +38 -17
  40. package/src/parser/src/types.d.ts +3 -1
  41. package/src/types.d.ts +1 -1
  42. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -0,0 +1,20 @@
1
+ import type { GridRefreshScope } from '../AdaptableInterfaces/IAdaptable';
2
+ /**
3
+ * see #narrow_column_model_refresh
4
+ *
5
+ * Helpers for the refresh scope of a column-model pass (`AdaptableAgGrid.updateColumnModelAndRefreshGrid`).
6
+ */
7
+ /** The legacy behaviour: destroy & recreate every rendered row and every header cell. */
8
+ export declare const FULL_GRID_REFRESH_SCOPE: Readonly<GridRefreshScope>;
9
+ /** Re-run the cell-level callbacks on the rendered cells; rows and header are kept. */
10
+ export declare const CELLS_GRID_REFRESH_SCOPE: Readonly<GridRefreshScope>;
11
+ /** Only set up the columns; whatever colDef value changed is refreshed by AG Grid itself (see #col_def_commit). */
12
+ export declare const NO_GRID_REFRESH_SCOPE: Readonly<GridRefreshScope>;
13
+ export declare const mergeGridRefreshScopes: (a: GridRefreshScope, b: GridRefreshScope) => GridRefreshScope;
14
+ /**
15
+ * The part of `requested` that `done` did not cover, or `null` when `done` already covers everything.
16
+ * A row redraw covers a cell refresh (the cells are recreated with the rows).
17
+ */
18
+ export declare const getMissingGridRefreshScope: (done: GridRefreshScope, requested: GridRefreshScope) => GridRefreshScope | null;
19
+ /** eg `rows+header`, `cells`, `none` - used in the perf track details and the log line */
20
+ export declare const describeGridRefreshScope: (scope: GridRefreshScope) => string;
@@ -0,0 +1,39 @@
1
+ export const FULL_GRID_REFRESH_SCOPE = Object.freeze({
2
+ rows: true,
3
+ header: true,
4
+ });
5
+ export const CELLS_GRID_REFRESH_SCOPE = Object.freeze({
6
+ cells: true,
7
+ });
8
+ export const NO_GRID_REFRESH_SCOPE = Object.freeze({});
9
+ export const mergeGridRefreshScopes = (a, b) => ({
10
+ rows: !!(a.rows || b.rows),
11
+ cells: !!(a.cells || b.cells),
12
+ header: !!(a.header || b.header),
13
+ });
14
+ export const getMissingGridRefreshScope = (done, requested) => {
15
+ const missing = {};
16
+ if (requested.rows && !done.rows) {
17
+ missing.rows = true;
18
+ }
19
+ if (requested.cells && !done.cells && !done.rows && !missing.rows) {
20
+ missing.cells = true;
21
+ }
22
+ if (requested.header && !done.header) {
23
+ missing.header = true;
24
+ }
25
+ return Object.keys(missing).length ? missing : null;
26
+ };
27
+ export const describeGridRefreshScope = (scope) => {
28
+ const parts = [];
29
+ if (scope.rows) {
30
+ parts.push('rows');
31
+ }
32
+ else if (scope.cells) {
33
+ parts.push('cells');
34
+ }
35
+ if (scope.header) {
36
+ parts.push('header');
37
+ }
38
+ return parts.length ? parts.join('+') : 'none';
39
+ };
@@ -22,14 +22,14 @@ export interface RadioProps extends TypeProps, Omit<BoxProps, keyof TypeProps> {
22
22
  onClick?: React.MouseEventHandler<HTMLDivElement>;
23
23
  onFocus?: React.FocusEventHandler<HTMLDivElement>;
24
24
  }
25
- export declare const useRadioContext: <T extends unknown>() => {
25
+ export declare const useRadioContext: <T extends any>() => {
26
26
  value: T;
27
27
  onChange: (value: T) => void;
28
28
  name: string;
29
29
  variant: Variant;
30
30
  };
31
31
  declare const Radio: ({ children, checked, onChange, value, name, gapDistance, childrenPosition, as, id, tabIndex, disabled, ...props }: RadioProps) => React.JSX.Element;
32
- export declare const RadioGroup: <T extends unknown>(props: {
32
+ export declare const RadioGroup: <T extends any>(props: {
33
33
  orientation: "horizontal" | "vertical";
34
34
  value?: T;
35
35
  name?: string;
@@ -20,6 +20,12 @@ export declare const DevToolsTracks: {
20
20
  readonly track: "Runtime";
21
21
  readonly labels: {
22
22
  readonly SetLayout: "Setting layout";
23
+ readonly UpdateColumnModel: "Update column model & refresh grid";
24
+ readonly DeriveColumnState: "Derive column state from AG Grid";
25
+ readonly SetupColumns: "Setup columns";
26
+ readonly RedrawBody: "Redraw body";
27
+ readonly RefreshCells: "Refresh cells";
28
+ readonly RefreshHeader: "Refresh header";
23
29
  };
24
30
  };
25
31
  readonly Redux: {
@@ -20,6 +20,12 @@ export const DevToolsTracks = {
20
20
  track: 'Runtime',
21
21
  labels: {
22
22
  SetLayout: 'Setting layout',
23
+ UpdateColumnModel: 'Update column model & refresh grid',
24
+ DeriveColumnState: 'Derive column state from AG Grid',
25
+ SetupColumns: 'Setup columns',
26
+ RedrawBody: 'Redraw body',
27
+ RefreshCells: 'Refresh cells',
28
+ RefreshHeader: 'Refresh header',
23
29
  },
24
30
  },
25
31
  Redux: {
@@ -73,13 +73,37 @@ export declare class DevToolsMarker implements PerfMarker {
73
73
  readonly Runtime: {
74
74
  start: DevToolsMarker["start"];
75
75
  end: (markerDetails: Omit<DevToolsMarkerDetails, "track"> & {
76
- label: "SetLayout";
76
+ label: "SetLayout" | "UpdateColumnModel" | "DeriveColumnState" | "SetupColumns" | "RedrawBody" | "RefreshCells" | "RefreshHeader";
77
77
  }) => DevToolsMarker;
78
78
  label: {
79
79
  readonly SetLayout: {
80
80
  end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
81
81
  start: DevToolsMarker["start"];
82
82
  };
83
+ readonly UpdateColumnModel: {
84
+ end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
85
+ start: DevToolsMarker["start"];
86
+ };
87
+ readonly DeriveColumnState: {
88
+ end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
89
+ start: DevToolsMarker["start"];
90
+ };
91
+ readonly SetupColumns: {
92
+ end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
93
+ start: DevToolsMarker["start"];
94
+ };
95
+ readonly RedrawBody: {
96
+ end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
97
+ start: DevToolsMarker["start"];
98
+ };
99
+ readonly RefreshCells: {
100
+ end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
101
+ start: DevToolsMarker["start"];
102
+ };
103
+ readonly RefreshHeader: {
104
+ end: EndMethod<Omit<DevToolsMarkerDetails, "track" | "label">>;
105
+ start: DevToolsMarker["start"];
106
+ };
83
107
  };
84
108
  };
85
109
  readonly Redux: {
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: 1789246590646 || Date.now(),
4
- VERSION: "23.0.22" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1789562482621 || Date.now(),
4
+ VERSION: "23.1.0-canary.1" || '--current-version--',
5
5
  };
@@ -104,6 +104,15 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
104
104
  private computeColumnOrderAndVisibility;
105
105
  autoSizeColumns(columnIds?: string[]): false | string[];
106
106
  private applyPivotLayout;
107
+ /**
108
+ * Applies the layout state that targets pivot result columns (order, sorts, pinning).
109
+ *
110
+ * Must be called after the primary applyColumnState call(s) - i.e. after the pivot
111
+ * result columns have been (re)generated by AG Grid - because pivot result column
112
+ * state included in the same call that changes pivot/aggregation config is applied
113
+ * to the previous generation of pivot result columns (see AG Grid 36 notes in applyPivotLayout).
114
+ */
115
+ private applyPivotResultColumnsState;
107
116
  applyPivotTotals(layout: PivotLayoutModel): void;
108
117
  applyColumnGroupCollapseExpandState(layout: PivotLayoutModel | TableLayoutModel): void;
109
118
  private withSuppressColumnAnimation;
@@ -1340,20 +1340,6 @@ export class LayoutManager extends LMEmitter {
1340
1340
  this.computeColumnSorts(layout, columnState);
1341
1341
  this.computePinnedColumns(layout, columnState);
1342
1342
  this.computePivotAggregations(layout, columnState);
1343
- if (Array.isArray(layout.PivotResultColumnsOrder)) {
1344
- const pivotResultColumnsOrderSet = new Set(layout.PivotResultColumnsOrder);
1345
- const existingPivotResultState = {};
1346
- columnState.state = columnState.state.filter((colState) => {
1347
- if (pivotResultColumnsOrderSet.has(colState.colId)) {
1348
- existingPivotResultState[colState.colId] = colState;
1349
- return false;
1350
- }
1351
- return true;
1352
- });
1353
- layout.PivotResultColumnsOrder.forEach((colId) => {
1354
- columnState.state.push(existingPivotResultState[colId] || { colId });
1355
- });
1356
- }
1357
1343
  return columnState;
1358
1344
  }
1359
1345
  computePivotAggregations(layout, columnState) {
@@ -1583,10 +1569,8 @@ export class LayoutManager extends LMEmitter {
1583
1569
  this.gridApi.applyColumnState(columnState);
1584
1570
  });
1585
1571
  this.computePivotAggregations(layout, columnState);
1586
- if (Array.isArray(layout.PivotResultColumnsOrder)) {
1587
- columnState.applyOrder = true;
1588
- }
1589
1572
  this.gridApi.applyColumnState(columnState);
1573
+ this.applyPivotResultColumnsState(layout);
1590
1574
  if (layout.ColumnSizing) {
1591
1575
  const colWidthForPivotResultColumns = [];
1592
1576
  (this.gridApi.getPivotResultColumns() || []).forEach((col) => {
@@ -1608,6 +1592,43 @@ export class LayoutManager extends LMEmitter {
1608
1592
  }
1609
1593
  });
1610
1594
  }
1595
+ applyPivotResultColumnsState(layout) {
1596
+ const existingPivotResultColIds = (this.gridApi.getPivotResultColumns() || []).map((col) => col.getColId());
1597
+ if (!existingPivotResultColIds.length) {
1598
+ return;
1599
+ }
1600
+ const existingSet = new Set(existingPivotResultColIds);
1601
+ const persistedOrder = Array.isArray(layout.PivotResultColumnsOrder) && layout.PivotResultColumnsOrder.length > 0
1602
+ ? layout.PivotResultColumnsOrder
1603
+ : null;
1604
+ let orderedColIds = existingPivotResultColIds;
1605
+ if (persistedOrder) {
1606
+ const desiredSet = new Set(persistedOrder);
1607
+ const knownColIds = existingPivotResultColIds.filter((colId) => desiredSet.has(colId));
1608
+ const extraColIds = existingPivotResultColIds.filter((colId) => !desiredSet.has(colId));
1609
+ orderedColIds = [
1610
+ ...sortColumnIdsByOrder(knownColIds, persistedOrder).filter((colId) => existingSet.has(colId)),
1611
+ ...extraColIds,
1612
+ ];
1613
+ }
1614
+ const sorts = layout.ColumnSorts || [];
1615
+ const sortIndexes = new Map(sorts.map((sort, index) => [sort.ColumnId, index]));
1616
+ const pinning = layout.ColumnPinning || {};
1617
+ const state = orderedColIds.map((colId) => {
1618
+ const sortIndex = sortIndexes.get(colId);
1619
+ const sort = sortIndex != null ? sorts[sortIndex] : undefined;
1620
+ return {
1621
+ colId,
1622
+ sort: sort ? (sort.SortOrder === 'Asc' ? 'asc' : 'desc') : null,
1623
+ sortIndex: sort ? sortIndex : null,
1624
+ pinned: pinning[colId] ?? null,
1625
+ };
1626
+ });
1627
+ this.gridApi.applyColumnState({
1628
+ state,
1629
+ applyOrder: !!persistedOrder,
1630
+ });
1631
+ }
1611
1632
  applyPivotTotals(layout) {
1612
1633
  if (layout.PivotGrandTotal) {
1613
1634
  const pivotGrandTotal = layout.PivotGrandTotal === true || layout.PivotGrandTotal === 'before'
@@ -63,7 +63,9 @@ export interface ExpressionContext extends BaseContext {
63
63
  */
64
64
  dataChangedEvent?: CellDataChangedInfo;
65
65
  /**
66
- * Pivot Result Column when evaluating a Pivoted Column
66
+ * The Pivot Result Column when evaluating an expression for a pivot result cell:
67
+ * `COL` / `$SCOPE` of its base column resolve to the pivot result cell value.
68
+ * See #derived_pivot_cell_style (`AgGridColumnAdapter`)
67
69
  */
68
70
  pivotResultColumn?: Column;
69
71
  /**
package/src/types.d.ts CHANGED
@@ -34,7 +34,7 @@ export type { OpenFinPluginOptions } from './AdaptableOptions/OpenFinPluginOptio
34
34
  export type { InteropioPluginOptions } from './AdaptableOptions/InteropioPluginOptions';
35
35
  export type { MasterDetailPluginOptions, DetailInitContext, } from './AdaptableOptions/MasterDetailPluginOptions';
36
36
  export type { DateInputOptions } from './AdaptableOptions/DateInputOptions';
37
- export type { FilterOptions, ColumnFilterOptions, GridFilterOptions, IsRowFilterableContext, InFilterValueInfo, InFilterValueResult, InFilterValue, CustomInFilterValuesContext, GridFilterEditors, DefaultPredicateFilterContext, AdaptableFilterComponentLocation, } from './AdaptableOptions/FilterOptions';
37
+ export type { FilterOptions, ColumnFilterOptions, GridFilterOptions, IsRowFilterableContext, InFilterValueInfo, InFilterValueResult, InFilterValue, CustomInFilterValuesContext, InFilterLabelContext, GridFilterEditors, DefaultPredicateFilterContext, AdaptableFilterComponentLocation, } from './AdaptableOptions/FilterOptions';
38
38
  export type { QuickSearchOptions, QuickSearchContext } from './AdaptableOptions/QuickSearchOptions';
39
39
  export type { FormatColumnOptions, CustomDisplayFormatter, CustomDisplayFormatterContext, } from './AdaptableOptions/FormatColumnOptions';
40
40
  export type { PlusMinusOptions } from './AdaptableOptions/EditOptions';