@adaptabletools/adaptable 20.0.5-canary.0 → 20.0.5
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/package.json +1 -1
- package/src/AdaptableState/Common/AggregationColumns.d.ts +1 -8
- package/src/AdaptableState/LayoutState.d.ts +0 -12
- package/src/Api/Implementation/ColumnApiImpl.d.ts +0 -1
- package/src/Api/Implementation/ColumnApiImpl.js +1 -11
- package/src/Api/Implementation/LayoutHelpers.js +2 -25
- package/src/Utilities/Constants/GeneralConstants.d.ts +0 -1
- package/src/Utilities/Constants/GeneralConstants.js +0 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +29 -1
- package/src/agGrid/FilterWrapper.js +6 -4
- package/src/env.js +2 -2
- package/src/layout-manager/src/LayoutManagerModel.d.ts +20 -23
- package/src/layout-manager/src/index.d.ts +1 -18
- package/src/layout-manager/src/index.js +2 -288
- package/src/layout-manager/src/normalizeLayoutModel.js +0 -3
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "20.0.5
|
|
3
|
+
"version": "20.0.5",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -12,14 +12,7 @@ export type TableAggregationColumns = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Defines an Aggregated Column in a Pivot Layout
|
|
14
14
|
*/
|
|
15
|
-
export type PivotAggregationColumns =
|
|
16
|
-
ColumnId: string;
|
|
17
|
-
AggFunc: AggregationColumnValue;
|
|
18
|
-
TotalColumn?: boolean | 'before' | 'after' | {
|
|
19
|
-
PivotColumnId: string;
|
|
20
|
-
ShowTotal?: boolean | 'before' | 'after';
|
|
21
|
-
}[];
|
|
22
|
-
}[];
|
|
15
|
+
export type PivotAggregationColumns = TableAggregationColumns;
|
|
23
16
|
export declare const WEIGHTED_AVERAGE_AGG_FN_NAME = "weightedAvg";
|
|
24
17
|
/**
|
|
25
18
|
* Defines a Weighted Average Agg
|
|
@@ -148,18 +148,6 @@ export interface PivotLayout extends LayoutBase {
|
|
|
148
148
|
* Row Grouped Columns Columns - must NOT be provided
|
|
149
149
|
*/
|
|
150
150
|
RowGroupedColumns?: never;
|
|
151
|
-
/**
|
|
152
|
-
* Display Grand Total Row at the top or bottom of the Pivot Table
|
|
153
|
-
*/
|
|
154
|
-
GrandTotalRow?: 'top' | 'bottom' | boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Display automatically calculated Totals of all Pivot Columns, in the position specified
|
|
157
|
-
*/
|
|
158
|
-
GrandTotalColumn?: 'before' | 'after' | boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Display automatically calculated Totals within EACH Pivot Column Group, in the position specified
|
|
161
|
-
*/
|
|
162
|
-
PivotGroupTotalColumn?: 'before' | 'after' | boolean;
|
|
163
151
|
}
|
|
164
152
|
/**
|
|
165
153
|
* Manages how (and which) Row Group values are stored
|
|
@@ -11,7 +11,6 @@ export declare function generateAutoTreeSingleColumn(): AdaptableColumn;
|
|
|
11
11
|
export declare function generateAutoRowGroupColumnForColumn(column: AdaptableColumn): AdaptableColumn;
|
|
12
12
|
export declare function getFriendlyNameForPivotResultColumn(columnId: string): string;
|
|
13
13
|
export declare function isPivotResultColumn(columnId: string): boolean;
|
|
14
|
-
export declare function isPivotGrandTotalColumn(columnId: string): boolean;
|
|
15
14
|
export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
|
|
16
15
|
internalApi: ColumnInternalApi;
|
|
17
16
|
constructor(_adaptable: IAdaptable);
|
|
@@ -63,13 +63,6 @@ export function generateAutoRowGroupColumnForColumn(column) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
export function getFriendlyNameForPivotResultColumn(columnId) {
|
|
66
|
-
if (isPivotGrandTotalColumn(columnId)) {
|
|
67
|
-
return `[Grand Total] ${columnId
|
|
68
|
-
.split('_')
|
|
69
|
-
.slice(2)
|
|
70
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
71
|
-
.join(' ')}`;
|
|
72
|
-
}
|
|
73
66
|
return `[Pivot] ${columnId
|
|
74
67
|
.split('_')
|
|
75
68
|
.slice(1)
|
|
@@ -80,9 +73,6 @@ export function isPivotResultColumn(columnId) {
|
|
|
80
73
|
// put this here as there might be other indicators we are not aware of?
|
|
81
74
|
return columnId?.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
|
|
82
75
|
}
|
|
83
|
-
export function isPivotGrandTotalColumn(columnId) {
|
|
84
|
-
return columnId?.startsWith(GeneralConstants.AG_GRID_PIVOT_GRAND_TOTAL_COLUMN);
|
|
85
|
-
}
|
|
86
76
|
export class ColumnApiImpl extends ApiBase {
|
|
87
77
|
constructor(_adaptable) {
|
|
88
78
|
super(_adaptable);
|
|
@@ -146,7 +136,7 @@ export class ColumnApiImpl extends ApiBase {
|
|
|
146
136
|
return isAutoRowGroupColumn(columnId);
|
|
147
137
|
}
|
|
148
138
|
isPivotResultColumn(columnId) {
|
|
149
|
-
return isPivotResultColumn(columnId)
|
|
139
|
+
return isPivotResultColumn(columnId);
|
|
150
140
|
}
|
|
151
141
|
isAutoRowGroupColumnForSingle(columnId) {
|
|
152
142
|
return columnId === GROUP_COLUMN_ID__SINGLE;
|
|
@@ -197,16 +197,12 @@ export const pivotLayoutToPivotLayoutModel = (pivotLayout) => {
|
|
|
197
197
|
ColumnPinning: pivotLayout.ColumnPinning,
|
|
198
198
|
PivotColumns: pivotLayout.PivotColumns,
|
|
199
199
|
PivotExpandLevel: pivotLayout.PivotExpandLevel,
|
|
200
|
-
PivotAggregationColumns: (pivotLayout.PivotAggregationColumns || []).map(({ ColumnId, AggFunc
|
|
200
|
+
PivotAggregationColumns: (pivotLayout.PivotAggregationColumns || []).map(({ ColumnId, AggFunc }) => {
|
|
201
201
|
return {
|
|
202
202
|
ColumnId,
|
|
203
203
|
AggFunc: toAggFunc(AggFunc),
|
|
204
|
-
TotalColumn,
|
|
205
204
|
};
|
|
206
205
|
}),
|
|
207
|
-
GrandTotalRow: pivotLayout.GrandTotalRow,
|
|
208
|
-
GrandTotalColumn: pivotLayout.GrandTotalColumn,
|
|
209
|
-
PivotGroupTotalColumn: pivotLayout.PivotGroupTotalColumn,
|
|
210
206
|
RowGroupValues: pivotLayout.RowGroupValues
|
|
211
207
|
? pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-collapsed' ||
|
|
212
208
|
pivotLayout.RowGroupValues.RowGroupDefaultBehavior === 'always-expanded'
|
|
@@ -330,29 +326,10 @@ export const pivotLayoutModelToPivotLayout = (layoutModel, defaults) => {
|
|
|
330
326
|
else {
|
|
331
327
|
delete pivotLayout.RowGroupValues;
|
|
332
328
|
}
|
|
333
|
-
if (layoutModel.GrandTotalRow) {
|
|
334
|
-
pivotLayout.GrandTotalRow = layoutModel.GrandTotalRow;
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
delete pivotLayout.GrandTotalRow;
|
|
338
|
-
}
|
|
339
|
-
if (layoutModel.GrandTotalColumn) {
|
|
340
|
-
pivotLayout.GrandTotalColumn = layoutModel.GrandTotalColumn;
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
delete pivotLayout.GrandTotalColumn;
|
|
344
|
-
}
|
|
345
|
-
if (layoutModel.PivotGroupTotalColumn) {
|
|
346
|
-
pivotLayout.PivotGroupTotalColumn = layoutModel.PivotGroupTotalColumn;
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
delete pivotLayout.PivotGroupTotalColumn;
|
|
350
|
-
}
|
|
351
329
|
if (layoutModel.PivotAggregationColumns) {
|
|
352
|
-
pivotLayout.PivotAggregationColumns = (layoutModel.PivotAggregationColumns || []).map(({ ColumnId, AggFunc
|
|
330
|
+
pivotLayout.PivotAggregationColumns = (layoutModel.PivotAggregationColumns || []).map(({ ColumnId, AggFunc }) => ({
|
|
353
331
|
ColumnId,
|
|
354
332
|
AggFunc: toAggregationColumnValue(AggFunc),
|
|
355
|
-
TotalColumn,
|
|
356
333
|
}));
|
|
357
334
|
}
|
|
358
335
|
else {
|
|
@@ -24,7 +24,6 @@ export declare const GROUP_PATH_SEPARATOR: string;
|
|
|
24
24
|
export declare const AG_GRID_GROUPED_COLUMN: string;
|
|
25
25
|
export declare const AG_GRID_SELECTION_COLUMN: string;
|
|
26
26
|
export declare const AG_GRID_PIVOT_COLUMN: string;
|
|
27
|
-
export declare const AG_GRID_PIVOT_GRAND_TOTAL_COLUMN: string;
|
|
28
27
|
export declare const AG_GRID_CHART_WINDOW = "AG Grid Window";
|
|
29
28
|
export declare const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = "(FDC3ActionColumn)";
|
|
30
29
|
export declare const DEFAULT_DATE_FORMAT_PATTERN = "dd-MM-yyyy";
|
|
@@ -23,7 +23,6 @@ export const GROUP_PATH_SEPARATOR = '/';
|
|
|
23
23
|
export const AG_GRID_GROUPED_COLUMN = 'ag-Grid-AutoColumn';
|
|
24
24
|
export const AG_GRID_SELECTION_COLUMN = 'ag-Grid-SelectionColumn';
|
|
25
25
|
export const AG_GRID_PIVOT_COLUMN = 'pivot_';
|
|
26
|
-
export const AG_GRID_PIVOT_GRAND_TOTAL_COLUMN = 'PivotRowTotal_pivot_';
|
|
27
26
|
export const AG_GRID_CHART_WINDOW = 'AG Grid Window';
|
|
28
27
|
export const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = '(FDC3ActionColumn)';
|
|
29
28
|
// FIXME AFL - load this from DateInputOptions
|
|
@@ -100,15 +100,43 @@ export const ColumnFilterInput = ({ type, value, onChange: onChangeProp, onClear
|
|
|
100
100
|
// autoFocus has to be FALSE because if the input receives focus in the init phase,
|
|
101
101
|
// it may scroll the AG Grid header viewport into view and de-synchronize it (relative to the content viewport)
|
|
102
102
|
autoFocus: false, value: liveValue ?? '', onKeyDown: onKeyDown, showClearButton: false, onChange: (e) => {
|
|
103
|
+
const prevValue = `${liveValue}`;
|
|
103
104
|
const value = e.target.value;
|
|
104
105
|
if (value) {
|
|
105
106
|
if (type === 'number') {
|
|
106
107
|
let numericValue = parseFloat(value);
|
|
108
|
+
let liveValue = numericValue;
|
|
107
109
|
if (isNaN(numericValue)) {
|
|
108
110
|
numericValue = null;
|
|
111
|
+
liveValue = null;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
const prevValueHasSeparator = prevValue.includes('.');
|
|
115
|
+
const newValueEndsWithSeparator = value.endsWith('.');
|
|
116
|
+
const newValueStartsWithSeparator = value.startsWith('.');
|
|
117
|
+
const newValueEndsWithZero = value.endsWith('0');
|
|
118
|
+
const separatorCount = (value.match(/[.,]/g) || []).length;
|
|
119
|
+
if (prevValueHasSeparator && separatorCount > 1) {
|
|
120
|
+
// not a valid number
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (newValueEndsWithSeparator) {
|
|
124
|
+
const valueWithoutLastChar = value.slice(0, -1);
|
|
125
|
+
if (numericValue === parseFloat(valueWithoutLastChar)) {
|
|
126
|
+
liveValue = value;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (newValueEndsWithZero) {
|
|
130
|
+
liveValue = value;
|
|
131
|
+
}
|
|
132
|
+
if (newValueStartsWithSeparator) {
|
|
133
|
+
if (numericValue === parseFloat('0' + value)) {
|
|
134
|
+
liveValue = value;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
109
137
|
}
|
|
110
138
|
onChange(numericValue);
|
|
111
|
-
setLiveValue(
|
|
139
|
+
setLiveValue(liveValue);
|
|
112
140
|
}
|
|
113
141
|
else {
|
|
114
142
|
onChange(value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { AdaptableColumnFilter } from '../View/Components/ColumnFilter/AdaptableColumnFilter';
|
|
3
3
|
import { renderWithAdaptableContext } from '../View/renderWithAdaptableContext';
|
|
4
|
+
import { getAgGridFilterNotifyModelFn } from './getAgGridFilterNotifyModelFn';
|
|
4
5
|
export const FilterWrapperFactory = (adaptable) => {
|
|
5
6
|
function isFilterActive(colId) {
|
|
6
7
|
// we need this here
|
|
@@ -108,14 +109,15 @@ export const FilterWrapperFactory = (adaptable) => {
|
|
|
108
109
|
this.unmountReactRoot?.();
|
|
109
110
|
const columnId = this.column.getColId();
|
|
110
111
|
let column = adaptable.api.columnApi.getColumnWithColumnId(columnId);
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
function getNotifyModel(colId, onModelChange) {
|
|
113
|
+
return getAgGridFilterNotifyModelFn(adaptable.api, colId, onModelChange);
|
|
114
|
+
}
|
|
115
|
+
const notifyModel = getNotifyModel(columnId, this.params.filterChangedCallback);
|
|
113
116
|
if (column) {
|
|
114
117
|
this.unmountReactRoot = adaptable.renderReactRoot(renderWithAdaptableContext(React.createElement(AdaptableColumnFilter, {
|
|
115
118
|
columnId,
|
|
116
119
|
wrapperProps: { p: 2 },
|
|
117
|
-
|
|
118
|
-
// onChange: notifyModel,
|
|
120
|
+
onChange: notifyModel,
|
|
119
121
|
}), adaptable),
|
|
120
122
|
// AdaptableColumnFilter(filterProps),
|
|
121
123
|
this.filterContainer);
|
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:
|
|
4
|
-
VERSION: "20.0.5
|
|
3
|
+
PUBLISH_TIMESTAMP: 1744964803967 || Date.now(),
|
|
4
|
+
VERSION: "20.0.5" || '--current-version--',
|
|
5
5
|
};
|
|
@@ -62,17 +62,26 @@ export type ColumnAggregationModel = {
|
|
|
62
62
|
aggFunc: string | true;
|
|
63
63
|
weightedColumnId?: string;
|
|
64
64
|
};
|
|
65
|
-
export type
|
|
65
|
+
export type AggregationColumnsModel = {
|
|
66
66
|
ColumnId: string;
|
|
67
67
|
AggFunc: ColumnAggregationModel;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
}[];
|
|
69
|
+
type RowSummaryPosition = 'Top' | 'Bottom';
|
|
70
|
+
export interface RowSummaryModel {
|
|
71
|
+
/**
|
|
72
|
+
* Where Row Summary appears - 'Top' or 'Bottom'
|
|
73
|
+
*/
|
|
74
|
+
Position?: RowSummaryPosition;
|
|
75
|
+
/**
|
|
76
|
+
* Map of Columns with Summary Expressions
|
|
77
|
+
*/
|
|
78
|
+
ColumnsMap: Record<string, string>;
|
|
79
|
+
/**
|
|
80
|
+
* Evaluates only currently filtered rows in the summary
|
|
81
|
+
* @defaultValue true
|
|
82
|
+
*/
|
|
83
|
+
IncludeOnlyFilteredRows?: boolean;
|
|
84
|
+
}
|
|
76
85
|
export interface TableLayoutModel extends BaseLayoutModel {
|
|
77
86
|
TableColumns: string[];
|
|
78
87
|
/**
|
|
@@ -87,7 +96,6 @@ export interface TableLayoutModel extends BaseLayoutModel {
|
|
|
87
96
|
* @defaultValue 'single'
|
|
88
97
|
*/
|
|
89
98
|
RowGroupDisplayType?: 'single' | 'multi';
|
|
90
|
-
PivotAggregationColumns?: never;
|
|
91
99
|
PivotColumns?: never;
|
|
92
100
|
PivotGroupedColumns?: never;
|
|
93
101
|
PivotExpandLevel?: never;
|
|
@@ -102,24 +110,13 @@ export interface PivotLayoutModel extends BaseLayoutModel {
|
|
|
102
110
|
/**
|
|
103
111
|
* Columns showing aggregated values in Group Rows; 1st value in record is Column name, 2nd is either aggfunc (e.g. sum, avg etc.) or 'true' (to use default aggfunc)
|
|
104
112
|
*/
|
|
105
|
-
PivotAggregationColumns?:
|
|
113
|
+
PivotAggregationColumns?: AggregationColumnsModel;
|
|
106
114
|
TableAggregationColumns?: never;
|
|
107
115
|
/**
|
|
108
116
|
* Columns which are row-grouped when the Layout is applied
|
|
109
117
|
*/
|
|
110
118
|
PivotGroupedColumns?: string[];
|
|
111
119
|
RowGroupedColumns?: never;
|
|
112
|
-
/**
|
|
113
|
-
* Display Grand Total Row at the top or bottom of the Pivot Table
|
|
114
|
-
*/
|
|
115
|
-
GrandTotalRow?: 'top' | 'bottom' | boolean;
|
|
116
|
-
/**
|
|
117
|
-
* Display Total of all Pivot Columns before or after the Pivot Columns
|
|
118
|
-
*/
|
|
119
|
-
GrandTotalColumn?: 'before' | 'after' | boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Display automatically calculated Totals within EACH Pivot Column Group, in the position specified
|
|
122
|
-
*/
|
|
123
|
-
PivotGroupTotalColumn?: 'before' | 'after' | boolean;
|
|
124
120
|
}
|
|
125
121
|
export type LayoutModel = TableLayoutModel | PivotLayoutModel;
|
|
122
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnState, GridApi, GridOptions, GridState } from 'ag-grid-enterprise';
|
|
2
2
|
import { PivotLayoutModel, TableLayoutModel } from './LayoutManagerModel';
|
|
3
3
|
import { LMEmitter } from './LMEmitter';
|
|
4
4
|
export type LayoutManagerOptions = {
|
|
@@ -69,24 +69,7 @@ export declare class LayoutManager<DATA_TYPE = any> extends LMEmitter {
|
|
|
69
69
|
private computeColumnOrderAndVisibility;
|
|
70
70
|
autoSizeColumns(columnIds?: string[]): false | string[];
|
|
71
71
|
private applyPivotLayout;
|
|
72
|
-
applyPivotTotals(layout: PivotLayoutModel): void;
|
|
73
72
|
applyPivotExpandLevel(layout: PivotLayoutModel): void;
|
|
74
73
|
private withSuppressColumnAnimation;
|
|
75
|
-
private setupPivotTotals;
|
|
76
|
-
private isPivotRowTotalColDef;
|
|
77
|
-
private patchGrandTotalColumn;
|
|
78
|
-
private isPivotGroupTotalColumn;
|
|
79
|
-
private patchPivotGroupTotalColumn;
|
|
80
|
-
private patchPivotTotalColumn;
|
|
81
|
-
destructurePivotColumnId(colDef: ColDef, currentModel: {
|
|
82
|
-
pivotColIds: string[];
|
|
83
|
-
aggColIds: string[];
|
|
84
|
-
}): '!unknown!' | {
|
|
85
|
-
pivotColumnIds: string[];
|
|
86
|
-
pivotKeys: string[];
|
|
87
|
-
pivotColumnId: string;
|
|
88
|
-
aggregationColumnId?: string;
|
|
89
|
-
};
|
|
90
|
-
private getPivotTotalColumnConfig;
|
|
91
74
|
}
|
|
92
75
|
export {};
|