@adaptabletools/adaptable-cjs 21.1.3-canary.0 → 21.2.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 +1 -0
- package/base.css.map +1 -1
- package/index.css +1 -0
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/PredicateOptions.d.ts +5 -5
- package/src/AdaptableState/Common/AdaptablePredicate.d.ts +8 -1
- package/src/Api/ColumnApi.d.ts +6 -0
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +11 -0
- package/src/Api/Implementation/CommentsApiImpl.d.ts +1 -1
- package/src/Api/Implementation/CommentsApiImpl.js +6 -6
- package/src/Api/Implementation/NoteApiImpl.d.ts +1 -1
- package/src/Api/Implementation/NoteApiImpl.js +2 -2
- package/src/Api/Internal/AlertInternalApi.js +2 -2
- package/src/Api/Internal/ColumnFilterInternalApi.js +3 -2
- package/src/Api/Internal/FormatColumnInternalApi.js +1 -0
- package/src/Api/NoteApi.d.ts +2 -2
- package/src/Redux/ActionsReducers/CommentsRedux.d.ts +34 -31
- package/src/Redux/ActionsReducers/CommentsRedux.js +39 -36
- package/src/Redux/Store/AdaptableStore.js +6 -6
- package/src/Strategy/CommentModule.js +3 -1
- package/src/Strategy/FlashingCellModule.js +3 -3
- package/src/Strategy/LayoutModule.js +2 -1
- package/src/Strategy/NoteModule.js +3 -1
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +32 -4
- package/src/Utilities/Services/ValidationService.js +1 -0
- package/src/Utilities/weightedAverage.d.ts +3 -3
- package/src/Utilities/weightedAverage.js +27 -14
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +32 -15
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +5 -5
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -1
- package/src/View/StateManagement/components/ExportDropdown.js +2 -2
- package/src/View/StateManagement/handleExportState.d.ts +2 -1
- package/src/View/StateManagement/handleExportState.js +2 -2
- package/src/agGrid/AdaptableAgGrid.js +2 -1
- package/src/agGrid/AgGridAdapter.js +4 -2
- package/src/agGrid/AgGridColumnAdapter.js +22 -1
- package/src/agGrid/AgGridExportAdapter.d.ts +3 -2
- package/src/agGrid/AgGridExportAdapter.js +80 -14
- package/src/agGrid/cellRenderers/BadgeRenderer.js +2 -0
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -1768,7 +1768,8 @@ You need to define at least one Layout!`);
|
|
|
1768
1768
|
let _displayValue = defaults ? defaults.displayValue : undefined;
|
|
1769
1769
|
let _normalisedValue = defaults ? defaults.normalisedValue : undefined;
|
|
1770
1770
|
let _isRowGroupCell;
|
|
1771
|
-
const _isPivotCell = this.api.columnApi.isPivotResultColumn(columnId)
|
|
1771
|
+
const _isPivotCell = this.api.columnApi.isPivotResultColumn(columnId) ||
|
|
1772
|
+
this.api.columnApi.isPivotAggColumnWithNoPivotColumns(columnId);
|
|
1772
1773
|
const self = this;
|
|
1773
1774
|
const api = this.api;
|
|
1774
1775
|
const getRawValue = () => {
|
|
@@ -158,7 +158,8 @@ class AgGridAdapter {
|
|
|
158
158
|
const pivotColumnFilters = self.adaptableApi.filterApi.columnFilterApi
|
|
159
159
|
.getActiveColumnFilters()
|
|
160
160
|
.filter((columnFilter) => self.adaptableApi.columnApi.isPivotResultColumn(columnFilter.ColumnId) ||
|
|
161
|
-
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(columnFilter.ColumnId)
|
|
161
|
+
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(columnFilter.ColumnId) ||
|
|
162
|
+
self.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(columnFilter.ColumnId));
|
|
162
163
|
try {
|
|
163
164
|
if (pivotColumnFilters.length > 0) {
|
|
164
165
|
for (const columnFilter of pivotColumnFilters) {
|
|
@@ -182,7 +183,8 @@ class AgGridAdapter {
|
|
|
182
183
|
this.DANGER_isAggFilterPresentMonkeyPatcher = function () {
|
|
183
184
|
const columnFilters = self.adaptableApi.filterApi.columnFilterApi.getActiveColumnFilters();
|
|
184
185
|
return columnFilters.some((colFilter) => self.adaptableApi.columnApi.isPivotResultColumn(colFilter.ColumnId) ||
|
|
185
|
-
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(colFilter.ColumnId)
|
|
186
|
+
self.adaptableApi.columnApi.isAutoRowGroupColumnForSingle(colFilter.ColumnId) ||
|
|
187
|
+
self.adaptableApi.columnApi.isPivotAggColumnWithNoPivotColumns(colFilter.ColumnId));
|
|
186
188
|
};
|
|
187
189
|
agGridColumnFilterService.isAggFilterPresent = this.DANGER_isAggFilterPresentMonkeyPatcher;
|
|
188
190
|
}
|
|
@@ -190,7 +190,7 @@ class AgGridColumnAdapter {
|
|
|
190
190
|
}
|
|
191
191
|
if (isVisualDataExport) {
|
|
192
192
|
const cellClassKey = AgGridExportAdapter_1.AgGridExportAdapter.getExcelClassNameForCell(colId, gridCell.primaryKeyValue, userDefinedCellClass);
|
|
193
|
-
const customCellClass = this.adaptableInstance.agGridExportAdapter.
|
|
193
|
+
const customCellClass = this.adaptableInstance.agGridExportAdapter.getExcelStyleIdForClassKey(cellClassKey);
|
|
194
194
|
if (customCellClass) {
|
|
195
195
|
excelStyleClasses.push(customCellClass);
|
|
196
196
|
}
|
|
@@ -256,6 +256,27 @@ class AgGridColumnAdapter {
|
|
|
256
256
|
// see https://github.com/AdaptableTools/adaptable/issues/2947#issuecomment-3062304655
|
|
257
257
|
return baseHeaderClass;
|
|
258
258
|
}
|
|
259
|
+
const isExcelExport = this.adaptableApi.exportApi.internalApi.isExcelExportInProgress();
|
|
260
|
+
const isVisualDataExport = this.adaptableApi.exportApi.internalApi.isVisualDataExportInProgress();
|
|
261
|
+
if (isExcelExport || isVisualDataExport) {
|
|
262
|
+
const excelStyleHeaderClasses = [];
|
|
263
|
+
if (userDefinedHeaderClass) {
|
|
264
|
+
if (Array.isArray(userDefinedHeaderClass)) {
|
|
265
|
+
excelStyleHeaderClasses.push(...userDefinedHeaderClass.filter(Boolean));
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
excelStyleHeaderClasses.push(userDefinedHeaderClass);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (isVisualDataExport) {
|
|
272
|
+
const headerClassKey = AgGridExportAdapter_1.AgGridExportAdapter.getExcelClassNameForHeader(colId, userDefinedHeaderClass);
|
|
273
|
+
const customHeaderClass = this.adaptableInstance.agGridExportAdapter.getExcelStyleIdForClassKey(headerClassKey);
|
|
274
|
+
if (customHeaderClass) {
|
|
275
|
+
excelStyleHeaderClasses.push(customHeaderClass);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return excelStyleHeaderClasses.length ? excelStyleHeaderClasses : null;
|
|
279
|
+
}
|
|
259
280
|
const columnId = params.column.getColId();
|
|
260
281
|
const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
261
282
|
if (!adaptableColumn) {
|
|
@@ -35,7 +35,7 @@ export declare class AgGridExportAdapter {
|
|
|
35
35
|
DANGER_excelStyles: ExcelStyle[];
|
|
36
36
|
originalExcelStyles: ExcelStyle[];
|
|
37
37
|
private excelStylesCache;
|
|
38
|
-
private
|
|
38
|
+
private cellOrHeaderClassKey2ExcelStyleIdMap;
|
|
39
39
|
private excelStylesWithFormattedDate;
|
|
40
40
|
constructor(_adaptableInstance: AdaptableAgGrid);
|
|
41
41
|
private get agGridApi();
|
|
@@ -43,6 +43,7 @@ export declare class AgGridExportAdapter {
|
|
|
43
43
|
private get exportOptions();
|
|
44
44
|
private get logger();
|
|
45
45
|
static getExcelClassNameForCell(colId: string, primaryKeyValue: any, userDefinedCellClass?: string | string[]): string;
|
|
46
|
+
static getExcelClassNameForHeader(colId: string, userDefinedHeaderClass?: string | string[]): string;
|
|
46
47
|
destroy(): void;
|
|
47
48
|
exportData(config: ExportConfig): Promise<null | ExportResultData>;
|
|
48
49
|
/**
|
|
@@ -66,7 +67,7 @@ export declare class AgGridExportAdapter {
|
|
|
66
67
|
private isDateCellExportedAsFormattedValue;
|
|
67
68
|
private convertCSSToExcelStyle;
|
|
68
69
|
private getExcelDataType;
|
|
69
|
-
|
|
70
|
+
getExcelStyleIdForClassKey(cellOrHeaderClassKey: string): string;
|
|
70
71
|
private getExcelStyleWithFormattedDate;
|
|
71
72
|
private mapCsvToJson;
|
|
72
73
|
private getCsvSeparator;
|
|
@@ -21,7 +21,7 @@ class AgGridExportAdapter {
|
|
|
21
21
|
this.DANGER_excelStyles = [];
|
|
22
22
|
this.originalExcelStyles = [];
|
|
23
23
|
this.excelStylesCache = {};
|
|
24
|
-
this.
|
|
24
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = {};
|
|
25
25
|
this.excelStylesWithFormattedDate = {};
|
|
26
26
|
}
|
|
27
27
|
get agGridApi() {
|
|
@@ -47,9 +47,20 @@ class AgGridExportAdapter {
|
|
|
47
47
|
: userDefinedCellClass}`
|
|
48
48
|
: excelClassName;
|
|
49
49
|
}
|
|
50
|
+
static getExcelClassNameForHeader(colId, userDefinedHeaderClass) {
|
|
51
|
+
let excelClassName = `--excel-header-${colId}`;
|
|
52
|
+
if (excelClassName.indexOf(' ') > 0) {
|
|
53
|
+
excelClassName = excelClassName.replace(/\s/g, '_');
|
|
54
|
+
}
|
|
55
|
+
return userDefinedHeaderClass != null
|
|
56
|
+
? `${excelClassName}-${Array.isArray(userDefinedHeaderClass)
|
|
57
|
+
? userDefinedHeaderClass.join('-')
|
|
58
|
+
: userDefinedHeaderClass}`
|
|
59
|
+
: excelClassName;
|
|
60
|
+
}
|
|
50
61
|
destroy() {
|
|
51
62
|
this.excelStylesCache = null;
|
|
52
|
-
this.
|
|
63
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = null;
|
|
53
64
|
this.excelStylesWithFormattedDate = null;
|
|
54
65
|
}
|
|
55
66
|
async exportData(config) {
|
|
@@ -457,7 +468,7 @@ class AgGridExportAdapter {
|
|
|
457
468
|
// Revert to original state without changing the array reference
|
|
458
469
|
this.DANGER_excelStyles.splice(0, this.DANGER_excelStyles.length, ...this.originalExcelStyles);
|
|
459
470
|
this.excelStylesCache = {};
|
|
460
|
-
this.
|
|
471
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = {};
|
|
461
472
|
this.excelStylesWithFormattedDate = {};
|
|
462
473
|
}
|
|
463
474
|
buildExcelStyles(exportContext) {
|
|
@@ -494,6 +505,60 @@ class AgGridExportAdapter {
|
|
|
494
505
|
});
|
|
495
506
|
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
496
507
|
const userExcelStyles = this.DANGER_excelStyles;
|
|
508
|
+
// 1. Header Styles
|
|
509
|
+
agGridDisplayedColumns.forEach((column, columnIndex) => {
|
|
510
|
+
const colDef = colDefs[columnIndex];
|
|
511
|
+
const columnId = column.getId();
|
|
512
|
+
const adaptableColumn = getAdaptableColumnWithColumnId(columnId);
|
|
513
|
+
if (!adaptableColumn) {
|
|
514
|
+
this.logger.warn(`Export Styling: Column with id ${columnId} not found in Adaptable`);
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
let headerClassParams = {
|
|
518
|
+
colDef,
|
|
519
|
+
column,
|
|
520
|
+
floatingFilter: false,
|
|
521
|
+
api: this.agGridApi,
|
|
522
|
+
context: this.agGridApi.getGridOption('context'),
|
|
523
|
+
};
|
|
524
|
+
const headerStyle = typeof colDef.headerStyle === 'function' ? colDef.headerStyle(headerClassParams) : {};
|
|
525
|
+
const excelHeaderStyles = [];
|
|
526
|
+
// add user defined excel styles
|
|
527
|
+
let userColDefHeaderClass = this._adaptableInstance.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'headerClass');
|
|
528
|
+
const userDefinedHeaderClass = typeof userColDefHeaderClass === 'function'
|
|
529
|
+
? userColDefHeaderClass(headerClassParams)
|
|
530
|
+
: userColDefHeaderClass;
|
|
531
|
+
const userDefinedExcelHeaderStyle = userDefinedHeaderClass &&
|
|
532
|
+
userExcelStyles.find((excelStyle) => {
|
|
533
|
+
return typeof userDefinedHeaderClass === 'string'
|
|
534
|
+
? userDefinedHeaderClass === excelStyle.id
|
|
535
|
+
: userDefinedHeaderClass?.includes?.(excelStyle.id);
|
|
536
|
+
});
|
|
537
|
+
if (userDefinedExcelHeaderStyle) {
|
|
538
|
+
excelHeaderStyles.push(userDefinedExcelHeaderStyle);
|
|
539
|
+
}
|
|
540
|
+
// add adaptable derived styles (format column etc.)
|
|
541
|
+
const adaptableHeaderStyle = {
|
|
542
|
+
...Object.keys(headerStyle).reduce((result, key) => {
|
|
543
|
+
if (headerStyle[key] !== null) {
|
|
544
|
+
result[key] = headerStyle[key];
|
|
545
|
+
}
|
|
546
|
+
return result;
|
|
547
|
+
}, {}),
|
|
548
|
+
};
|
|
549
|
+
const sanitizedAdaptableHeaderStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableHeaderStyle);
|
|
550
|
+
if (Object.values(sanitizedAdaptableHeaderStyle).some((style) => style != null)) {
|
|
551
|
+
excelHeaderStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableHeaderStyle));
|
|
552
|
+
}
|
|
553
|
+
// don't add the header style if it has no adaptable custom styles
|
|
554
|
+
if (!excelHeaderStyles.length) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
const headerClassId = AgGridExportAdapter.getExcelClassNameForHeader(column.getId(), userDefinedHeaderClass);
|
|
558
|
+
const finalHeaderExcelStyle = Object.assign({}, ...excelHeaderStyles);
|
|
559
|
+
this.registerExcelStyle(finalHeaderExcelStyle, headerClassId);
|
|
560
|
+
});
|
|
561
|
+
// 2. Cell Styles
|
|
497
562
|
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
498
563
|
const rowParams = {
|
|
499
564
|
node,
|
|
@@ -530,7 +595,7 @@ class AgGridExportAdapter {
|
|
|
530
595
|
return cellClassParams;
|
|
531
596
|
};
|
|
532
597
|
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
533
|
-
const
|
|
598
|
+
const excelCellStyles = [];
|
|
534
599
|
// add user defined excel styles
|
|
535
600
|
let userColDefCellClass = this._adaptableInstance.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
536
601
|
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
@@ -543,10 +608,10 @@ class AgGridExportAdapter {
|
|
|
543
608
|
: userDefinedCellClass?.includes?.(excelStyle.id);
|
|
544
609
|
});
|
|
545
610
|
if (userDefinedExcelStyle) {
|
|
546
|
-
|
|
611
|
+
excelCellStyles.push(userDefinedExcelStyle);
|
|
547
612
|
}
|
|
548
613
|
// add adaptable derived styles (format column etc.)
|
|
549
|
-
const
|
|
614
|
+
const adaptableCellStyle = {
|
|
550
615
|
...rowStyle,
|
|
551
616
|
...Object.keys(cellStyle).reduce((result, key) => {
|
|
552
617
|
if (cellStyle[key] !== null) {
|
|
@@ -555,20 +620,20 @@ class AgGridExportAdapter {
|
|
|
555
620
|
return result;
|
|
556
621
|
}, {}),
|
|
557
622
|
};
|
|
558
|
-
const
|
|
559
|
-
if (Object.values(
|
|
560
|
-
|
|
623
|
+
const sanitizedAdaptableCellStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableCellStyle);
|
|
624
|
+
if (Object.values(sanitizedAdaptableCellStyle).some((style) => style != null)) {
|
|
625
|
+
excelCellStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableCellStyle));
|
|
561
626
|
}
|
|
562
627
|
const excelDataType = this.getExcelDataType(adaptableColumn.dataType);
|
|
563
628
|
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
564
629
|
// don't add the cell style if it has no adaptable custom styles
|
|
565
|
-
if (!
|
|
630
|
+
if (!excelCellStyles.length &&
|
|
566
631
|
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
567
632
|
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
568
633
|
return;
|
|
569
634
|
}
|
|
570
635
|
const cellClassId = AgGridExportAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(node), userDefinedCellClass);
|
|
571
|
-
const finalCellExcelStyle = Object.assign({}, ...
|
|
636
|
+
const finalCellExcelStyle = Object.assign({}, ...excelCellStyles);
|
|
572
637
|
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
573
638
|
let dateFormatPattern = this.exportOptions.exportDateFormat;
|
|
574
639
|
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
@@ -616,7 +681,8 @@ class AgGridExportAdapter {
|
|
|
616
681
|
const excelStyleWithId = { ...excelStyle, id: excelStyleId };
|
|
617
682
|
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
618
683
|
}
|
|
619
|
-
this.
|
|
684
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap[cellClassKey] =
|
|
685
|
+
this.excelStylesCache[excelStyleKey].id;
|
|
620
686
|
}
|
|
621
687
|
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
622
688
|
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
@@ -700,8 +766,8 @@ class AgGridExportAdapter {
|
|
|
700
766
|
return 'String';
|
|
701
767
|
}
|
|
702
768
|
}
|
|
703
|
-
|
|
704
|
-
return this.
|
|
769
|
+
getExcelStyleIdForClassKey(cellOrHeaderClassKey) {
|
|
770
|
+
return this.cellOrHeaderClassKey2ExcelStyleIdMap[cellOrHeaderClassKey];
|
|
705
771
|
}
|
|
706
772
|
getExcelStyleWithFormattedDate(cellClassId) {
|
|
707
773
|
return this.excelStylesWithFormattedDate[cellClassId];
|
|
@@ -63,6 +63,7 @@ const getBadgeRendererForColumn = (badgeStyle, abColumn, api) => {
|
|
|
63
63
|
for (const value of params.value) {
|
|
64
64
|
const predicateDefHandlerContext = {
|
|
65
65
|
value: value,
|
|
66
|
+
rawValue: value,
|
|
66
67
|
oldValue: null,
|
|
67
68
|
displayValue: params.formatValue,
|
|
68
69
|
node: params.node,
|
|
@@ -86,6 +87,7 @@ const getBadgeRendererForColumn = (badgeStyle, abColumn, api) => {
|
|
|
86
87
|
let formattedValue = params.formatValue?.(params.value) ?? params.value ?? '';
|
|
87
88
|
const predicateDefHandlerContext = {
|
|
88
89
|
value: params.value,
|
|
90
|
+
rawValue: params.value,
|
|
89
91
|
oldValue: null,
|
|
90
92
|
displayValue: params.formatValue,
|
|
91
93
|
node: params.node,
|
package/src/env.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
4
|
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" || '',
|
|
5
|
-
PUBLISH_TIMESTAMP:
|
|
6
|
-
VERSION: "21.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1767878413718 || Date.now(),
|
|
6
|
+
VERSION: "21.2.0" || '--current-version--',
|
|
7
7
|
};
|