@adaptabletools/adaptable-cjs 20.1.7 → 20.2.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/base.css +27 -0
  2. package/base.css.map +1 -1
  3. package/index.css +22 -0
  4. package/index.css.map +1 -1
  5. package/package.json +2 -2
  6. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
  7. package/src/AdaptableOptions/DefaultAdaptableOptions.js +2 -1
  8. package/src/AdaptableOptions/ExportOptions.d.ts +91 -8
  9. package/src/AdaptableOptions/QuickSearchOptions.d.ts +1 -6
  10. package/src/AdaptableState/FormatColumnState.d.ts +8 -0
  11. package/src/AdaptableState/LayoutState.d.ts +15 -2
  12. package/src/AdaptableState/QuickSearchState.d.ts +8 -0
  13. package/src/Api/ColumnApi.d.ts +5 -0
  14. package/src/Api/ExportApi.d.ts +23 -7
  15. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
  16. package/src/Api/Implementation/ColumnApiImpl.js +15 -31
  17. package/src/Api/Implementation/ExportApiImpl.d.ts +11 -4
  18. package/src/Api/Implementation/ExportApiImpl.js +50 -8
  19. package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -0
  20. package/src/Api/Implementation/LayoutApiImpl.js +9 -0
  21. package/src/Api/Implementation/LayoutHelpers.js +44 -0
  22. package/src/Api/Implementation/QuickSearchApiImpl.d.ts +4 -0
  23. package/src/Api/Implementation/QuickSearchApiImpl.js +12 -0
  24. package/src/Api/Internal/AlertInternalApi.js +1 -1
  25. package/src/Api/Internal/ExportInternalApi.d.ts +3 -8
  26. package/src/Api/Internal/ExportInternalApi.js +1 -74
  27. package/src/Api/Internal/ExpressionInternalApi.d.ts +1 -1
  28. package/src/Api/Internal/ExpressionInternalApi.js +1 -32
  29. package/src/Api/Internal/FormatColumnInternalApi.d.ts +2 -1
  30. package/src/Api/Internal/FormatColumnInternalApi.js +62 -0
  31. package/src/Api/LayoutApi.d.ts +6 -2
  32. package/src/Api/QuickSearchApi.d.ts +16 -0
  33. package/src/Redux/Store/AdaptableStore.js +3 -2
  34. package/src/Utilities/Constants/GeneralConstants.js +2 -1
  35. package/src/View/Components/Forms/AdaptableFormControlTextClear.d.ts +1 -0
  36. package/src/View/Components/Forms/AdaptableFormControlTextClear.js +1 -0
  37. package/src/View/Dashboard/Dashboard.js +2 -4
  38. package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
  39. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +2 -2
  40. package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +6 -1
  41. package/src/View/Layout/Wizard/sections/RowGroupingSection.d.ts +4 -0
  42. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +24 -20
  43. package/src/View/QuickSearch/QuickSearchInput.js +6 -1
  44. package/src/View/QuickSearch/QuickSearchPopup.js +2 -3
  45. package/src/agGrid/AdaptableAgGrid.d.ts +2 -0
  46. package/src/agGrid/AdaptableAgGrid.js +123 -44
  47. package/src/agGrid/AgGridAdapter.d.ts +4 -1
  48. package/src/agGrid/AgGridAdapter.js +89 -12
  49. package/src/agGrid/AgGridColumnAdapter.d.ts +4 -0
  50. package/src/agGrid/AgGridColumnAdapter.js +144 -37
  51. package/src/agGrid/AgGridExportAdapter.d.ts +6 -1
  52. package/src/agGrid/AgGridExportAdapter.js +110 -17
  53. package/src/agGrid/FloatingFilterWrapper.js +30 -4
  54. package/src/env.js +2 -2
  55. package/src/layout-manager/src/LayoutManagerModel.d.ts +16 -2
  56. package/src/layout-manager/src/index.d.ts +1 -1
  57. package/src/layout-manager/src/index.js +133 -18
  58. package/src/layout-manager/src/normalizeLayoutModel.d.ts +2 -4
  59. package/src/layout-manager/src/normalizeLayoutModel.js +13 -18
  60. package/src/layout-manager/src/simplifyLayoutModel.js +14 -2
  61. package/src/metamodel/adaptable.metamodel.d.ts +71 -0
  62. package/src/metamodel/adaptable.metamodel.js +1 -1
  63. package/src/types.d.ts +1 -1
  64. package/tsconfig.cjs.tsbuildinfo +1 -1
  65. package/src/Utilities/buildSortedColumnStateForLayout.d.ts +0 -7
  66. package/src/Utilities/buildSortedColumnStateForLayout.js +0 -135
@@ -1,7 +0,0 @@
1
- import { ColumnState, GridOptions } from 'ag-grid-enterprise';
2
- import { Layout } from '../../types';
3
- export declare function buildSortedColumnStateForLayout(params: {
4
- columnState: ColumnState[];
5
- layout: Layout;
6
- groupDisplayType: GridOptions['groupDisplayType'];
7
- }): ColumnState[];
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildSortedColumnStateForLayout = void 0;
4
- const sortColumnStateForVisibleColumns_1 = require("./sortColumnStateForVisibleColumns");
5
- const ColumnApiImpl_1 = require("../Api/Implementation/ColumnApiImpl");
6
- const ColumnInternalApi_1 = require("../Api/Internal/ColumnInternalApi");
7
- const GeneralConstants_1 = require("./Constants/GeneralConstants");
8
- const LayoutHelpers_1 = require("../Api/Implementation/LayoutHelpers");
9
- function buildSortedColumnStateForLayout(params) {
10
- const { columnState, layout, groupDisplayType } = params;
11
- const isPivot = (0, LayoutHelpers_1.isPivotLayout)(layout);
12
- let orderedColumns = isPivot ? layout.PivotColumns : layout.TableColumns;
13
- const columnVisibilityMap = layout.ColumnVisibility || {};
14
- const multipleGroupColumns = groupDisplayType === 'multipleColumns';
15
- const singleGroupColumn = !multipleGroupColumns;
16
- const rowGroupedColumnsIndexes = {};
17
- let generatedRowGroupColumnsIds = [];
18
- const rowGroupedColumns = isPivot ? layout.PivotGroupedColumns : layout.RowGroupedColumns;
19
- // here we make sure the visibleColumnList includes all the generated group columns
20
- if (rowGroupedColumns) {
21
- rowGroupedColumns.forEach((colId, index) => {
22
- rowGroupedColumnsIndexes[colId] = index;
23
- rowGroupedColumnsIndexes[(0, ColumnInternalApi_1.getAutoRowGroupColumnIdFor)(colId)] = index;
24
- });
25
- // if the layout does not include the grouped columns,
26
- // make sure we add the grouped columns to the visible column list
27
- // at the start of the list
28
- if (singleGroupColumn) {
29
- if (!orderedColumns.includes(GeneralConstants_1.AG_GRID_GROUPED_COLUMN)) {
30
- orderedColumns = [GeneralConstants_1.AG_GRID_GROUPED_COLUMN, ...orderedColumns];
31
- }
32
- generatedRowGroupColumnsIds.push(GeneralConstants_1.AG_GRID_GROUPED_COLUMN);
33
- }
34
- else {
35
- let missingGroupColumns = 0;
36
- [...rowGroupedColumns].reverse().forEach((colId) => {
37
- const groupColId = (0, ColumnInternalApi_1.getAutoRowGroupColumnIdFor)(colId);
38
- if (!orderedColumns.includes(groupColId)) {
39
- orderedColumns = [groupColId, ...orderedColumns];
40
- missingGroupColumns++;
41
- }
42
- generatedRowGroupColumnsIds = [groupColId, ...generatedRowGroupColumnsIds];
43
- });
44
- // now we need to sort the visibleColumnList to contain the group columns
45
- // in the correct order
46
- // but we only need to do this if the layout.Columns list missed some of the
47
- // group columns, but not all of them. if all were missing, we already
48
- // inserted them at the start of the list
49
- if (missingGroupColumns && missingGroupColumns < rowGroupedColumns.length) {
50
- orderedColumns.sort((colId1, colId2) => {
51
- const isRowGroup1 = (0, ColumnApiImpl_1.isAutoRowGroupColumn)(colId1);
52
- const isRowGroup2 = (0, ColumnApiImpl_1.isAutoRowGroupColumn)(colId2);
53
- if (isRowGroup1 && isRowGroup2) {
54
- return rowGroupedColumnsIndexes[colId1] - rowGroupedColumnsIndexes[colId2];
55
- }
56
- return 0;
57
- });
58
- }
59
- }
60
- }
61
- const pivotMode = isPivot;
62
- if (pivotMode) {
63
- // in pivot mode, we sort the Visible columns of the layout
64
- // to make sure the group cols are at the beginning
65
- const groupCols = orderedColumns.filter(ColumnApiImpl_1.isAutoRowGroupColumn);
66
- orderedColumns = orderedColumns.filter((colId) => !(0, ColumnApiImpl_1.isAutoRowGroupColumn)(colId));
67
- orderedColumns = [...groupCols, ...orderedColumns];
68
- }
69
- // we're now ready to go over the columnState
70
- // we want as much as possible to keep the order of the columns
71
- // as they are in the column state.
72
- // if the order is different in the visibleColumns, we only move those columns around
73
- // if some columns in the columnState are not in the visibleColumns, we need to return them as hide: true
74
- // first step - keep the same order, but filter out old group columns
75
- // VERY IMPORTANT to only filter out OLD group columns, that is,
76
- // group columns that are not in the layout anymore
77
- // since we might have different group columns in the layout
78
- let newColumnState = [...columnState].filter((colState) => {
79
- const { colId } = colState;
80
- if ((0, ColumnApiImpl_1.isAutoRowGroupColumn)(colId) && rowGroupedColumnsIndexes[colId] == null) {
81
- return false;
82
- }
83
- return true;
84
- });
85
- // second step - keep the same order
86
- // but make sure the visibility is adjusted to reflect the
87
- // visible columns in the layout
88
- newColumnState = newColumnState.map((colState) => {
89
- const { colId } = colState;
90
- const hidden = columnVisibilityMap[colId] === false || !orderedColumns.includes(colId);
91
- if (hidden) {
92
- return {
93
- ...colState,
94
- hide: true,
95
- };
96
- }
97
- return { ...colState, hide: null };
98
- });
99
- // third step - correctly mark the columns that are grouped
100
- newColumnState = newColumnState.map((colState) => {
101
- const { colId } = colState;
102
- const groupIndex = rowGroupedColumnsIndexes[colId];
103
- if (groupIndex != null) {
104
- return {
105
- ...colState,
106
- rowGroup: true,
107
- rowGroupIndex: groupIndex,
108
- };
109
- }
110
- return {
111
- ...colState,
112
- rowGroup: false,
113
- rowGroupIndex: null,
114
- };
115
- });
116
- // fourth step - add the new group columns, if they are missing
117
- const columnStateIndexes = newColumnState.reduce((acc, colState, index) => {
118
- acc[colState.colId] = index;
119
- return acc;
120
- }, {});
121
- generatedRowGroupColumnsIds.reverse().forEach((rowGroupColId) => {
122
- if (columnStateIndexes[rowGroupColId] == null) {
123
- newColumnState = [
124
- {
125
- colId: rowGroupColId,
126
- },
127
- ...newColumnState,
128
- ];
129
- }
130
- });
131
- // fitfth step - sort the column state to respect the order of the visible columns
132
- // we can't simply call sort in this case
133
- return (0, sortColumnStateForVisibleColumns_1.sortColumnStateForVisibleColumns)(newColumnState, orderedColumns);
134
- }
135
- exports.buildSortedColumnStateForLayout = buildSortedColumnStateForLayout;