@adaptabletools/adaptable-cjs 21.1.2 → 21.1.3
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/Strategy/CommentModule.js +3 -1
- package/src/Strategy/LayoutModule.js +2 -1
- package/src/Strategy/NoteModule.js +3 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -1
- package/src/agGrid/AdaptableAgGrid.js +3 -2
- package/src/agGrid/AgGridColumnAdapter.js +22 -1
- package/src/agGrid/AgGridExportAdapter.d.ts +3 -2
- package/src/agGrid/AgGridExportAdapter.js +83 -37
- package/src/env.js +2 -2
- package/tsconfig.cjs.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable-cjs",
|
|
3
|
-
"version": "21.1.
|
|
3
|
+
"version": "21.1.3",
|
|
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",
|
|
@@ -34,7 +34,9 @@ class CommentModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
34
34
|
if (!this.api.commentApi.internalApi.areCommentsSupportedInLayout()) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
if (menuContext.isRowGroupColumn ||
|
|
37
|
+
if (menuContext.isRowGroupColumn ||
|
|
38
|
+
menuContext.isGroupedNode ||
|
|
39
|
+
!menuContext.isSingleSelectedCell) {
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
42
|
const items = [];
|
|
@@ -287,7 +287,8 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
287
287
|
};
|
|
288
288
|
let columns = (layout.TableColumns || [])
|
|
289
289
|
.filter((c) => !this.api.columnApi.isAutoRowGroupColumn(c))
|
|
290
|
-
.filter((c) => !this.api.columnApi.isPivotResultColumn(c))
|
|
290
|
+
.filter((c) => !this.api.columnApi.isPivotResultColumn(c))
|
|
291
|
+
.filter((c) => !this.api.columnApi.isSelectionColumn(c));
|
|
291
292
|
if (columns.length >
|
|
292
293
|
maxColumnsToDisplay + 1 /* +1 is to show tag only beginning with 2, 'other 2' */) {
|
|
293
294
|
const extraColumns = columns.length - maxColumnsToDisplay;
|
|
@@ -22,7 +22,9 @@ class NoteModule extends AdaptableModuleBase_1.AdaptableModuleBase {
|
|
|
22
22
|
if (!this.api.noteApi.internalApi.areNotesSupported()) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
-
if (menuContext.isRowGroupColumn ||
|
|
25
|
+
if (menuContext.isRowGroupColumn ||
|
|
26
|
+
menuContext.isGroupedNode ||
|
|
27
|
+
!menuContext.isSingleSelectedCell) {
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
28
30
|
const isReadOnly = this.api.entitlementApi.getEntitlementAccessLevelForModule(this.moduleInfo.ModuleName) ===
|
|
@@ -44,7 +44,8 @@ const ColumnsSectionSummary = () => {
|
|
|
44
44
|
const data = React.useMemo(() => {
|
|
45
45
|
return ColumnIds.map((columnId) => {
|
|
46
46
|
if (adaptable.api.columnApi.isPivotResultColumn(columnId) ||
|
|
47
|
-
adaptable.api.columnApi.isAutoRowGroupColumn(columnId)
|
|
47
|
+
adaptable.api.columnApi.isAutoRowGroupColumn(columnId) ||
|
|
48
|
+
adaptable.api.columnApi.isSelectionColumn(columnId)) {
|
|
48
49
|
return null;
|
|
49
50
|
}
|
|
50
51
|
const friendlyName = adaptable.api.columnApi.getFriendlyNameForColumnId(columnId, layout);
|
|
@@ -1148,8 +1148,9 @@ You need to define at least one Layout!`);
|
|
|
1148
1148
|
format: '0.###############',
|
|
1149
1149
|
},
|
|
1150
1150
|
});
|
|
1151
|
-
|
|
1152
|
-
this.agGridExportAdapter.
|
|
1151
|
+
// store original excel styles, we will have to revert to them after each VISUAL EXPORT
|
|
1152
|
+
this.agGridExportAdapter.originalExcelStyles = [...excelStyles];
|
|
1153
|
+
this.agGridExportAdapter.DANGER_excelStyles = excelStyles;
|
|
1153
1154
|
// this array reference will be used for the entire AG Grid session
|
|
1154
1155
|
return this.agGridExportAdapter.DANGER_excelStyles;
|
|
1155
1156
|
});
|
|
@@ -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) {
|
|
@@ -450,13 +461,14 @@ class AgGridExportAdapter {
|
|
|
450
461
|
}
|
|
451
462
|
patchExcelStyles(exportContext) {
|
|
452
463
|
const exportExcelStyles = this.buildExcelStyles(exportContext);
|
|
453
|
-
//
|
|
454
|
-
this.DANGER_excelStyles.
|
|
464
|
+
// Concatenate exportExcelStyles to DANGER_excelStyles without changing the array reference
|
|
465
|
+
this.DANGER_excelStyles.push(...exportExcelStyles);
|
|
455
466
|
}
|
|
456
467
|
resetExcelStyles() {
|
|
468
|
+
// Revert to original state without changing the array reference
|
|
457
469
|
this.DANGER_excelStyles.splice(0, this.DANGER_excelStyles.length, ...this.originalExcelStyles);
|
|
458
470
|
this.excelStylesCache = {};
|
|
459
|
-
this.
|
|
471
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = {};
|
|
460
472
|
this.excelStylesWithFormattedDate = {};
|
|
461
473
|
}
|
|
462
474
|
buildExcelStyles(exportContext) {
|
|
@@ -493,6 +505,60 @@ class AgGridExportAdapter {
|
|
|
493
505
|
});
|
|
494
506
|
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
495
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
|
|
496
562
|
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
497
563
|
const rowParams = {
|
|
498
564
|
node,
|
|
@@ -529,7 +595,7 @@ class AgGridExportAdapter {
|
|
|
529
595
|
return cellClassParams;
|
|
530
596
|
};
|
|
531
597
|
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
532
|
-
const
|
|
598
|
+
const excelCellStyles = [];
|
|
533
599
|
// add user defined excel styles
|
|
534
600
|
let userColDefCellClass = this._adaptableInstance.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
535
601
|
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
@@ -542,10 +608,10 @@ class AgGridExportAdapter {
|
|
|
542
608
|
: userDefinedCellClass?.includes?.(excelStyle.id);
|
|
543
609
|
});
|
|
544
610
|
if (userDefinedExcelStyle) {
|
|
545
|
-
|
|
611
|
+
excelCellStyles.push(userDefinedExcelStyle);
|
|
546
612
|
}
|
|
547
613
|
// add adaptable derived styles (format column etc.)
|
|
548
|
-
const
|
|
614
|
+
const adaptableCellStyle = {
|
|
549
615
|
...rowStyle,
|
|
550
616
|
...Object.keys(cellStyle).reduce((result, key) => {
|
|
551
617
|
if (cellStyle[key] !== null) {
|
|
@@ -554,20 +620,20 @@ class AgGridExportAdapter {
|
|
|
554
620
|
return result;
|
|
555
621
|
}, {}),
|
|
556
622
|
};
|
|
557
|
-
const
|
|
558
|
-
if (Object.values(
|
|
559
|
-
|
|
623
|
+
const sanitizedAdaptableCellStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableCellStyle);
|
|
624
|
+
if (Object.values(sanitizedAdaptableCellStyle).some((style) => style != null)) {
|
|
625
|
+
excelCellStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableCellStyle));
|
|
560
626
|
}
|
|
561
627
|
const excelDataType = this.getExcelDataType(adaptableColumn.dataType);
|
|
562
628
|
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
563
629
|
// don't add the cell style if it has no adaptable custom styles
|
|
564
|
-
if (!
|
|
630
|
+
if (!excelCellStyles.length &&
|
|
565
631
|
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
566
632
|
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
567
633
|
return;
|
|
568
634
|
}
|
|
569
635
|
const cellClassId = AgGridExportAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(node), userDefinedCellClass);
|
|
570
|
-
const finalCellExcelStyle = Object.assign({}, ...
|
|
636
|
+
const finalCellExcelStyle = Object.assign({}, ...excelCellStyles);
|
|
571
637
|
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
572
638
|
let dateFormatPattern = this.exportOptions.exportDateFormat;
|
|
573
639
|
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
@@ -606,27 +672,6 @@ class AgGridExportAdapter {
|
|
|
606
672
|
this.registerExcelStyle(finalCellExcelStyle, cellClassId);
|
|
607
673
|
});
|
|
608
674
|
}, forAllVisibleRowNodesDoConfig);
|
|
609
|
-
// see #EXCEL_EXPORT_DATA_TYPES
|
|
610
|
-
this.excelStylesCache['stringExcelType'] = {
|
|
611
|
-
id: 'stringExcelType',
|
|
612
|
-
dataType: 'String',
|
|
613
|
-
};
|
|
614
|
-
this.excelStylesCache['booleanExcelType'] = {
|
|
615
|
-
id: 'booleanExcelType',
|
|
616
|
-
dataType: 'Boolean',
|
|
617
|
-
};
|
|
618
|
-
this.excelStylesCache['dateExcelType'] = {
|
|
619
|
-
id: 'dateExcelType',
|
|
620
|
-
dataType: 'DateTime',
|
|
621
|
-
};
|
|
622
|
-
this.excelStylesCache['numberExcelType'] = {
|
|
623
|
-
id: 'numberExcelType',
|
|
624
|
-
// dataType: 'Number',
|
|
625
|
-
// AG Grid requires either dataType or numberFormat to be set for Numbers
|
|
626
|
-
numberFormat: {
|
|
627
|
-
format: '0.###############',
|
|
628
|
-
},
|
|
629
|
-
};
|
|
630
675
|
return Object.values(this.excelStylesCache);
|
|
631
676
|
}
|
|
632
677
|
registerExcelStyle(excelStyle, cellClassKey) {
|
|
@@ -636,7 +681,8 @@ class AgGridExportAdapter {
|
|
|
636
681
|
const excelStyleWithId = { ...excelStyle, id: excelStyleId };
|
|
637
682
|
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
638
683
|
}
|
|
639
|
-
this.
|
|
684
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap[cellClassKey] =
|
|
685
|
+
this.excelStylesCache[excelStyleKey].id;
|
|
640
686
|
}
|
|
641
687
|
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
642
688
|
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
@@ -720,8 +766,8 @@ class AgGridExportAdapter {
|
|
|
720
766
|
return 'String';
|
|
721
767
|
}
|
|
722
768
|
}
|
|
723
|
-
|
|
724
|
-
return this.
|
|
769
|
+
getExcelStyleIdForClassKey(cellOrHeaderClassKey) {
|
|
770
|
+
return this.cellOrHeaderClassKey2ExcelStyleIdMap[cellOrHeaderClassKey];
|
|
725
771
|
}
|
|
726
772
|
getExcelStyleWithFormattedDate(cellClassId) {
|
|
727
773
|
return this.excelStylesWithFormattedDate[cellClassId];
|
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.1.
|
|
5
|
+
PUBLISH_TIMESTAMP: 1765888708948 || Date.now(),
|
|
6
|
+
VERSION: "21.1.3" || '--current-version--',
|
|
7
7
|
};
|