@adaptabletools/adaptable-cjs 21.1.3-canary.0 → 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/AgGridColumnAdapter.js +22 -1
- package/src/agGrid/AgGridExportAdapter.d.ts +3 -2
- package/src/agGrid/AgGridExportAdapter.js +80 -14
- 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
|
|
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);
|
|
@@ -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];
|
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.3
|
|
5
|
+
PUBLISH_TIMESTAMP: 1765888708948 || Date.now(),
|
|
6
|
+
VERSION: "21.1.3" || '--current-version--',
|
|
7
7
|
};
|