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