@adaptabletools/adaptable 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.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
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",
|
|
@@ -30,7 +30,9 @@ export class CommentModule extends AdaptableModuleBase {
|
|
|
30
30
|
if (!this.api.commentApi.internalApi.areCommentsSupportedInLayout()) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (menuContext.isRowGroupColumn ||
|
|
33
|
+
if (menuContext.isRowGroupColumn ||
|
|
34
|
+
menuContext.isGroupedNode ||
|
|
35
|
+
!menuContext.isSingleSelectedCell) {
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
const items = [];
|
|
@@ -283,7 +283,8 @@ export class LayoutModule extends AdaptableModuleBase {
|
|
|
283
283
|
};
|
|
284
284
|
let columns = (layout.TableColumns || [])
|
|
285
285
|
.filter((c) => !this.api.columnApi.isAutoRowGroupColumn(c))
|
|
286
|
-
.filter((c) => !this.api.columnApi.isPivotResultColumn(c))
|
|
286
|
+
.filter((c) => !this.api.columnApi.isPivotResultColumn(c))
|
|
287
|
+
.filter((c) => !this.api.columnApi.isSelectionColumn(c));
|
|
287
288
|
if (columns.length >
|
|
288
289
|
maxColumnsToDisplay + 1 /* +1 is to show tag only beginning with 2, 'other 2' */) {
|
|
289
290
|
const extraColumns = columns.length - maxColumnsToDisplay;
|
|
@@ -18,7 +18,9 @@ export class NoteModule extends AdaptableModuleBase {
|
|
|
18
18
|
if (!this.api.noteApi.internalApi.areNotesSupported()) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
if (menuContext.isRowGroupColumn ||
|
|
21
|
+
if (menuContext.isRowGroupColumn ||
|
|
22
|
+
menuContext.isGroupedNode ||
|
|
23
|
+
!menuContext.isSingleSelectedCell) {
|
|
22
24
|
return;
|
|
23
25
|
}
|
|
24
26
|
const isReadOnly = this.api.entitlementApi.getEntitlementAccessLevelForModule(this.moduleInfo.ModuleName) ===
|
|
@@ -40,7 +40,8 @@ export const ColumnsSectionSummary = () => {
|
|
|
40
40
|
const data = React.useMemo(() => {
|
|
41
41
|
return ColumnIds.map((columnId) => {
|
|
42
42
|
if (adaptable.api.columnApi.isPivotResultColumn(columnId) ||
|
|
43
|
-
adaptable.api.columnApi.isAutoRowGroupColumn(columnId)
|
|
43
|
+
adaptable.api.columnApi.isAutoRowGroupColumn(columnId) ||
|
|
44
|
+
adaptable.api.columnApi.isSelectionColumn(columnId)) {
|
|
44
45
|
return null;
|
|
45
46
|
}
|
|
46
47
|
const friendlyName = adaptable.api.columnApi.getFriendlyNameForColumnId(columnId, layout);
|
|
@@ -185,7 +185,7 @@ export class AgGridColumnAdapter {
|
|
|
185
185
|
}
|
|
186
186
|
if (isVisualDataExport) {
|
|
187
187
|
const cellClassKey = AgGridExportAdapter.getExcelClassNameForCell(colId, gridCell.primaryKeyValue, userDefinedCellClass);
|
|
188
|
-
const customCellClass = this.adaptableInstance.agGridExportAdapter.
|
|
188
|
+
const customCellClass = this.adaptableInstance.agGridExportAdapter.getExcelStyleIdForClassKey(cellClassKey);
|
|
189
189
|
if (customCellClass) {
|
|
190
190
|
excelStyleClasses.push(customCellClass);
|
|
191
191
|
}
|
|
@@ -251,6 +251,27 @@ export class AgGridColumnAdapter {
|
|
|
251
251
|
// see https://github.com/AdaptableTools/adaptable/issues/2947#issuecomment-3062304655
|
|
252
252
|
return baseHeaderClass;
|
|
253
253
|
}
|
|
254
|
+
const isExcelExport = this.adaptableApi.exportApi.internalApi.isExcelExportInProgress();
|
|
255
|
+
const isVisualDataExport = this.adaptableApi.exportApi.internalApi.isVisualDataExportInProgress();
|
|
256
|
+
if (isExcelExport || isVisualDataExport) {
|
|
257
|
+
const excelStyleHeaderClasses = [];
|
|
258
|
+
if (userDefinedHeaderClass) {
|
|
259
|
+
if (Array.isArray(userDefinedHeaderClass)) {
|
|
260
|
+
excelStyleHeaderClasses.push(...userDefinedHeaderClass.filter(Boolean));
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
excelStyleHeaderClasses.push(userDefinedHeaderClass);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (isVisualDataExport) {
|
|
267
|
+
const headerClassKey = AgGridExportAdapter.getExcelClassNameForHeader(colId, userDefinedHeaderClass);
|
|
268
|
+
const customHeaderClass = this.adaptableInstance.agGridExportAdapter.getExcelStyleIdForClassKey(headerClassKey);
|
|
269
|
+
if (customHeaderClass) {
|
|
270
|
+
excelStyleHeaderClasses.push(customHeaderClass);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return excelStyleHeaderClasses.length ? excelStyleHeaderClasses : null;
|
|
274
|
+
}
|
|
254
275
|
const columnId = params.column.getColId();
|
|
255
276
|
const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
256
277
|
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;
|
|
@@ -17,7 +17,7 @@ export class AgGridExportAdapter {
|
|
|
17
17
|
this.DANGER_excelStyles = [];
|
|
18
18
|
this.originalExcelStyles = [];
|
|
19
19
|
this.excelStylesCache = {};
|
|
20
|
-
this.
|
|
20
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = {};
|
|
21
21
|
this.excelStylesWithFormattedDate = {};
|
|
22
22
|
}
|
|
23
23
|
get agGridApi() {
|
|
@@ -43,9 +43,20 @@ export class AgGridExportAdapter {
|
|
|
43
43
|
: userDefinedCellClass}`
|
|
44
44
|
: excelClassName;
|
|
45
45
|
}
|
|
46
|
+
static getExcelClassNameForHeader(colId, userDefinedHeaderClass) {
|
|
47
|
+
let excelClassName = `--excel-header-${colId}`;
|
|
48
|
+
if (excelClassName.indexOf(' ') > 0) {
|
|
49
|
+
excelClassName = excelClassName.replace(/\s/g, '_');
|
|
50
|
+
}
|
|
51
|
+
return userDefinedHeaderClass != null
|
|
52
|
+
? `${excelClassName}-${Array.isArray(userDefinedHeaderClass)
|
|
53
|
+
? userDefinedHeaderClass.join('-')
|
|
54
|
+
: userDefinedHeaderClass}`
|
|
55
|
+
: excelClassName;
|
|
56
|
+
}
|
|
46
57
|
destroy() {
|
|
47
58
|
this.excelStylesCache = null;
|
|
48
|
-
this.
|
|
59
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = null;
|
|
49
60
|
this.excelStylesWithFormattedDate = null;
|
|
50
61
|
}
|
|
51
62
|
async exportData(config) {
|
|
@@ -453,7 +464,7 @@ export class AgGridExportAdapter {
|
|
|
453
464
|
// Revert to original state without changing the array reference
|
|
454
465
|
this.DANGER_excelStyles.splice(0, this.DANGER_excelStyles.length, ...this.originalExcelStyles);
|
|
455
466
|
this.excelStylesCache = {};
|
|
456
|
-
this.
|
|
467
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap = {};
|
|
457
468
|
this.excelStylesWithFormattedDate = {};
|
|
458
469
|
}
|
|
459
470
|
buildExcelStyles(exportContext) {
|
|
@@ -490,6 +501,60 @@ export class AgGridExportAdapter {
|
|
|
490
501
|
});
|
|
491
502
|
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
492
503
|
const userExcelStyles = this.DANGER_excelStyles;
|
|
504
|
+
// 1. Header Styles
|
|
505
|
+
agGridDisplayedColumns.forEach((column, columnIndex) => {
|
|
506
|
+
const colDef = colDefs[columnIndex];
|
|
507
|
+
const columnId = column.getId();
|
|
508
|
+
const adaptableColumn = getAdaptableColumnWithColumnId(columnId);
|
|
509
|
+
if (!adaptableColumn) {
|
|
510
|
+
this.logger.warn(`Export Styling: Column with id ${columnId} not found in Adaptable`);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
let headerClassParams = {
|
|
514
|
+
colDef,
|
|
515
|
+
column,
|
|
516
|
+
floatingFilter: false,
|
|
517
|
+
api: this.agGridApi,
|
|
518
|
+
context: this.agGridApi.getGridOption('context'),
|
|
519
|
+
};
|
|
520
|
+
const headerStyle = typeof colDef.headerStyle === 'function' ? colDef.headerStyle(headerClassParams) : {};
|
|
521
|
+
const excelHeaderStyles = [];
|
|
522
|
+
// add user defined excel styles
|
|
523
|
+
let userColDefHeaderClass = this._adaptableInstance.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'headerClass');
|
|
524
|
+
const userDefinedHeaderClass = typeof userColDefHeaderClass === 'function'
|
|
525
|
+
? userColDefHeaderClass(headerClassParams)
|
|
526
|
+
: userColDefHeaderClass;
|
|
527
|
+
const userDefinedExcelHeaderStyle = userDefinedHeaderClass &&
|
|
528
|
+
userExcelStyles.find((excelStyle) => {
|
|
529
|
+
return typeof userDefinedHeaderClass === 'string'
|
|
530
|
+
? userDefinedHeaderClass === excelStyle.id
|
|
531
|
+
: userDefinedHeaderClass?.includes?.(excelStyle.id);
|
|
532
|
+
});
|
|
533
|
+
if (userDefinedExcelHeaderStyle) {
|
|
534
|
+
excelHeaderStyles.push(userDefinedExcelHeaderStyle);
|
|
535
|
+
}
|
|
536
|
+
// add adaptable derived styles (format column etc.)
|
|
537
|
+
const adaptableHeaderStyle = {
|
|
538
|
+
...Object.keys(headerStyle).reduce((result, key) => {
|
|
539
|
+
if (headerStyle[key] !== null) {
|
|
540
|
+
result[key] = headerStyle[key];
|
|
541
|
+
}
|
|
542
|
+
return result;
|
|
543
|
+
}, {}),
|
|
544
|
+
};
|
|
545
|
+
const sanitizedAdaptableHeaderStyle = sanitizeStyle(adaptableHeaderStyle);
|
|
546
|
+
if (Object.values(sanitizedAdaptableHeaderStyle).some((style) => style != null)) {
|
|
547
|
+
excelHeaderStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableHeaderStyle));
|
|
548
|
+
}
|
|
549
|
+
// don't add the header style if it has no adaptable custom styles
|
|
550
|
+
if (!excelHeaderStyles.length) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
const headerClassId = AgGridExportAdapter.getExcelClassNameForHeader(column.getId(), userDefinedHeaderClass);
|
|
554
|
+
const finalHeaderExcelStyle = Object.assign({}, ...excelHeaderStyles);
|
|
555
|
+
this.registerExcelStyle(finalHeaderExcelStyle, headerClassId);
|
|
556
|
+
});
|
|
557
|
+
// 2. Cell Styles
|
|
493
558
|
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
494
559
|
const rowParams = {
|
|
495
560
|
node,
|
|
@@ -526,7 +591,7 @@ export class AgGridExportAdapter {
|
|
|
526
591
|
return cellClassParams;
|
|
527
592
|
};
|
|
528
593
|
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
529
|
-
const
|
|
594
|
+
const excelCellStyles = [];
|
|
530
595
|
// add user defined excel styles
|
|
531
596
|
let userColDefCellClass = this._adaptableInstance.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
532
597
|
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
@@ -539,10 +604,10 @@ export class AgGridExportAdapter {
|
|
|
539
604
|
: userDefinedCellClass?.includes?.(excelStyle.id);
|
|
540
605
|
});
|
|
541
606
|
if (userDefinedExcelStyle) {
|
|
542
|
-
|
|
607
|
+
excelCellStyles.push(userDefinedExcelStyle);
|
|
543
608
|
}
|
|
544
609
|
// add adaptable derived styles (format column etc.)
|
|
545
|
-
const
|
|
610
|
+
const adaptableCellStyle = {
|
|
546
611
|
...rowStyle,
|
|
547
612
|
...Object.keys(cellStyle).reduce((result, key) => {
|
|
548
613
|
if (cellStyle[key] !== null) {
|
|
@@ -551,20 +616,20 @@ export class AgGridExportAdapter {
|
|
|
551
616
|
return result;
|
|
552
617
|
}, {}),
|
|
553
618
|
};
|
|
554
|
-
const
|
|
555
|
-
if (Object.values(
|
|
556
|
-
|
|
619
|
+
const sanitizedAdaptableCellStyle = sanitizeStyle(adaptableCellStyle);
|
|
620
|
+
if (Object.values(sanitizedAdaptableCellStyle).some((style) => style != null)) {
|
|
621
|
+
excelCellStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableCellStyle));
|
|
557
622
|
}
|
|
558
623
|
const excelDataType = this.getExcelDataType(adaptableColumn.dataType);
|
|
559
624
|
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
560
625
|
// don't add the cell style if it has no adaptable custom styles
|
|
561
|
-
if (!
|
|
626
|
+
if (!excelCellStyles.length &&
|
|
562
627
|
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
563
628
|
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
564
629
|
return;
|
|
565
630
|
}
|
|
566
631
|
const cellClassId = AgGridExportAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(node), userDefinedCellClass);
|
|
567
|
-
const finalCellExcelStyle = Object.assign({}, ...
|
|
632
|
+
const finalCellExcelStyle = Object.assign({}, ...excelCellStyles);
|
|
568
633
|
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
569
634
|
let dateFormatPattern = this.exportOptions.exportDateFormat;
|
|
570
635
|
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
@@ -612,7 +677,8 @@ export class AgGridExportAdapter {
|
|
|
612
677
|
const excelStyleWithId = { ...excelStyle, id: excelStyleId };
|
|
613
678
|
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
614
679
|
}
|
|
615
|
-
this.
|
|
680
|
+
this.cellOrHeaderClassKey2ExcelStyleIdMap[cellClassKey] =
|
|
681
|
+
this.excelStylesCache[excelStyleKey].id;
|
|
616
682
|
}
|
|
617
683
|
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
618
684
|
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
@@ -696,8 +762,8 @@ export class AgGridExportAdapter {
|
|
|
696
762
|
return 'String';
|
|
697
763
|
}
|
|
698
764
|
}
|
|
699
|
-
|
|
700
|
-
return this.
|
|
765
|
+
getExcelStyleIdForClassKey(cellOrHeaderClassKey) {
|
|
766
|
+
return this.cellOrHeaderClassKey2ExcelStyleIdMap[cellOrHeaderClassKey];
|
|
701
767
|
}
|
|
702
768
|
getExcelStyleWithFormattedDate(cellClassId) {
|
|
703
769
|
return this.excelStylesWithFormattedDate[cellClassId];
|
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: "21.1.3
|
|
3
|
+
PUBLISH_TIMESTAMP: 1765888673719 || Date.now(),
|
|
4
|
+
VERSION: "21.1.3" || '--current-version--',
|
|
5
5
|
};
|