@adaptabletools/adaptable 18.0.0-canary.11 → 18.0.0-canary.13
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 +5 -1
- package/base.css.map +1 -1
- package/index.css +7 -1
- package/index.css.map +1 -1
- package/package.json +1 -1
- package/src/AdaptableOptions/AdaptableOptions.d.ts +2 -2
- package/src/AdaptableOptions/ColumnOptions.d.ts +7 -4
- package/src/AdaptableOptions/CommentOptions.d.ts +9 -7
- package/src/AdaptableOptions/MenuOptions.d.ts +1 -53
- package/src/AdaptableOptions/MenuOptions.js +3 -3
- package/src/AdaptableOptions/NoteOptions.d.ts +4 -1
- package/src/Api/AdaptableApi.d.ts +4 -4
- package/src/Api/ColumnApi.d.ts +4 -0
- package/src/Api/CommentApi.d.ts +11 -12
- package/src/Api/ConfigApi.d.ts +3 -4
- package/src/Api/EventApi.d.ts +7 -9
- package/src/Api/Events/CommentChanged.d.ts +11 -0
- package/src/Api/GridApi.d.ts +6 -1
- package/src/Api/Implementation/ActionColumnApiImpl.js +3 -6
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -2
- package/src/Api/Implementation/AdaptableApiImpl.js +2 -2
- package/src/Api/Implementation/ApiBase.d.ts +2 -2
- package/src/Api/Implementation/ApiBase.js +1 -1
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +10 -0
- package/src/Api/Implementation/CommentsApiImpl.d.ts +1 -2
- package/src/Api/Implementation/ConfigApiImpl.d.ts +2 -2
- package/src/Api/Implementation/ConfigApiImpl.js +8 -8
- package/src/Api/Implementation/GridApiImpl.d.ts +3 -1
- package/src/Api/Implementation/GridApiImpl.js +17 -1
- package/src/Api/Implementation/{NotesApiImpl.d.ts → NoteApiImpl.d.ts} +8 -8
- package/src/Api/Implementation/{NotesApiImpl.js → NoteApiImpl.js} +12 -12
- package/src/Api/Implementation/OptionsApiImpl.d.ts +4 -5
- package/src/Api/Implementation/OptionsApiImpl.js +2 -12
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +0 -3
- package/src/Api/Implementation/UserInterfaceApiImpl.js +0 -8
- package/src/Api/Internal/ActionRowInternalApi.js +1 -1
- package/src/Api/Internal/AdaptableInternalApi.d.ts +3 -3
- package/src/Api/Internal/AdaptableInternalApi.js +11 -11
- package/src/Api/Internal/CalculatedColumnInternalApi.js +3 -2
- package/src/Api/Internal/ExportInternalApi.d.ts +2 -1
- package/src/Api/Internal/ExportInternalApi.js +4 -1
- package/src/Api/Internal/Fdc3InternalApi.js +2 -2
- package/src/Api/Internal/FreeTextColumnInternalApi.js +3 -2
- package/src/Api/Internal/GridInternalApi.d.ts +2 -0
- package/src/Api/Internal/GridInternalApi.js +15 -0
- package/src/Api/Internal/{NotesInternalApi.d.ts → NoteInternalApi.d.ts} +1 -1
- package/src/Api/Internal/{NotesInternalApi.js → NoteInternalApi.js} +1 -1
- package/src/Api/NoteApi.d.ts +48 -0
- package/src/Api/OptionsApi.d.ts +8 -12
- package/src/Api/UserInterfaceApi.d.ts +0 -11
- package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
- package/src/PredefinedConfig/CommentState.d.ts +27 -23
- package/src/PredefinedConfig/Common/RowSummary.d.ts +6 -0
- package/src/PredefinedConfig/Common/TransposeConfig.d.ts +6 -0
- package/src/PredefinedConfig/Common/Types.d.ts +4 -4
- package/src/PredefinedConfig/Common/Types.js +4 -1
- package/src/PredefinedConfig/{NotesState.d.ts → NoteState.d.ts} +3 -3
- package/src/PredefinedConfig/NoteState.js +1 -0
- package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -2
- package/src/PredefinedConfig/Selection/GridCell.d.ts +13 -0
- package/src/PredefinedConfig/SystemState.d.ts +2 -3
- package/src/Redux/ActionsReducers/NoteRedux.d.ts +38 -0
- package/src/Redux/ActionsReducers/{NotesRedux.js → NoteRedux.js} +21 -21
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/SystemRedux.js +3 -3
- package/src/Redux/Store/AdaptableStore.js +11 -17
- package/src/Strategy/{CommentsModule.d.ts → CommentModule.d.ts} +1 -5
- package/src/Strategy/{CommentsModule.js → CommentModule.js} +9 -10
- package/src/Strategy/LayoutModule.d.ts +1 -0
- package/src/Strategy/LayoutModule.js +17 -1
- package/src/Strategy/{NotesModule.d.ts → NoteModule.d.ts} +2 -1
- package/src/Strategy/{NotesModule.js → NoteModule.js} +11 -7
- package/src/Strategy/Utilities/getScopeViewItems.js +3 -0
- package/src/Utilities/Constants/ModuleConstants.d.ts +6 -6
- package/src/Utilities/Constants/ModuleConstants.js +6 -6
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +2 -2
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +10 -0
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +3 -3
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -1
- package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +15 -0
- package/src/Utilities/ObjectFactory.d.ts +3 -3
- package/src/Utilities/ObjectFactory.js +4 -24
- package/src/Utilities/Services/AggregatedScalarLiveValue.d.ts +1 -0
- package/src/Utilities/Services/AggregatedScalarLiveValue.js +12 -10
- package/src/Utilities/Services/CellPopupService.js +2 -2
- package/src/Utilities/Services/Interface/IReportService.d.ts +1 -4
- package/src/Utilities/Services/ModuleService.js +4 -0
- package/src/Utilities/Services/QueryLanguageService.js +2 -2
- package/src/Utilities/Services/ReportService.d.ts +7 -5
- package/src/Utilities/Services/ReportService.js +238 -22
- package/src/Utilities/Services/SummaryService.d.ts +1 -1
- package/src/Utilities/adaptableQlUtils.d.ts +2 -0
- package/src/Utilities/adaptableQlUtils.js +14 -0
- package/src/View/AdaptableViewFactory.js +2 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +1 -1
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +1 -1
- package/src/View/Comments/CommentsEditor.js +1 -1
- package/src/View/Comments/CommentsPopup.js +8 -4
- package/src/View/Components/NewScopeComponent.js +2 -2
- package/src/View/Components/Popups/GridCellPopup/GridCellPopup.js +6 -6
- package/src/View/Components/ValueSelector/index.d.ts +1 -0
- package/src/View/Components/ValueSelector/index.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +0 -1
- package/src/View/FreeTextColumn/FreeTextColumnSummary.js +1 -1
- package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +3 -1
- package/src/View/Layout/LayoutViewPanel.js +2 -1
- package/src/View/Layout/TransposedPopup.js +19 -18
- package/src/View/Layout/Wizard/LayoutWizard.js +11 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.d.ts +8 -0
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +140 -0
- package/src/View/Note/NotePopup.d.ts +2 -0
- package/src/View/{Notes/NotesPopup.js → Note/NotePopup.js} +6 -6
- package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +2 -0
- package/src/agGrid/AdaptableAgGrid.js +97 -58
- package/src/agGrid/AgGridAdapter.d.ts +2 -0
- package/src/agGrid/AgGridAdapter.js +8 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
- package/src/agGrid/AgGridColumnAdapter.js +4 -4
- package/src/agGrid/AgGridOptionsService.d.ts +4 -1
- package/src/agGrid/AgGridOptionsService.js +22 -0
- package/src/agGrid/defaultAdaptableOptions.js +0 -7
- package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +2 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.d.ts +0 -1
- package/src/components/ExpressionEditor/QueryBuilder/utils.js +1 -14
- package/src/components/icons/note.js +2 -2
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +77 -14
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/parser/src/parser.js +117 -1257
- package/src/parser/src/predicate/mapExpressionToQlPredicate.js +1 -1
- package/src/parser/src/predicate/mapQlPredicateToExpression.js +2 -1
- package/src/parser/src/types.d.ts +2 -2
- package/src/types.d.ts +23 -20
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/Api/Events/CommentsChangedInfo.d.ts +0 -5
- package/src/Api/NotesApi.d.ts +0 -48
- package/src/PredefinedConfig/CellAddress.d.ts +0 -13
- package/src/PredefinedConfig/CellAddress.js +0 -4
- package/src/Redux/ActionsReducers/NotesRedux.d.ts +0 -38
- package/src/View/Notes/NotesPopup.d.ts +0 -2
- /package/src/Api/Events/{CommentsChangedInfo.js → CommentChanged.js} +0 -0
- /package/src/Api/{NotesApi.js → NoteApi.js} +0 -0
- /package/src/PredefinedConfig/{NotesState.js → Common/TransposeConfig.js} +0 -0
- /package/src/View/{Notes → Note}/NoteEditor.d.ts +0 -0
- /package/src/View/{Notes → Note}/NoteEditor.js +0 -0
|
@@ -7,6 +7,8 @@ import StringExtensions from '../Extensions/StringExtensions';
|
|
|
7
7
|
import { ExportModuleId } from '../Constants/ModuleConstants';
|
|
8
8
|
import { createUuid } from '../../components/utils/uuid';
|
|
9
9
|
import { createBaseContext } from '../ObjectFactory';
|
|
10
|
+
import { convertCSSAbsoluteFontSizeToPt, getVariableColor, sanitizeStyle, } from '../Helpers/StyleHelper';
|
|
11
|
+
import tinycolor from 'tinycolor2';
|
|
10
12
|
export class ReportService {
|
|
11
13
|
constructor(adaptableApi) {
|
|
12
14
|
this.adaptableApi = adaptableApi;
|
|
@@ -15,29 +17,12 @@ export class ReportService {
|
|
|
15
17
|
this.excelStylesWithFormattedDate = {};
|
|
16
18
|
this.adaptableApi = adaptableApi;
|
|
17
19
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.cellClassKey2excelStyleIdMap = {};
|
|
21
|
-
this.excelStylesWithFormattedDate = {};
|
|
22
|
-
}
|
|
23
|
-
registerExcelStyle(excelStyle, cellClassKey) {
|
|
24
|
-
const excelStyleKey = JSON.stringify(excelStyle);
|
|
25
|
-
if (!this.excelStylesCache[excelStyleKey]) {
|
|
26
|
-
const excelStyleId = createUuid();
|
|
27
|
-
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
28
|
-
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
29
|
-
}
|
|
30
|
-
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
31
|
-
}
|
|
32
|
-
getRegisteredExcelStyles() {
|
|
33
|
-
return Object.values(this.excelStylesCache);
|
|
20
|
+
destroy() {
|
|
21
|
+
// TO DO
|
|
34
22
|
}
|
|
35
23
|
getExcelStyleIdForCellClassKey(cellClassKey) {
|
|
36
24
|
return this.cellClassKey2excelStyleIdMap[cellClassKey];
|
|
37
25
|
}
|
|
38
|
-
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
39
|
-
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
40
|
-
}
|
|
41
26
|
getExcelStyleWithFormattedDate(cellClassId) {
|
|
42
27
|
return this.excelStylesWithFormattedDate[cellClassId];
|
|
43
28
|
}
|
|
@@ -365,9 +350,6 @@ export class ReportService {
|
|
|
365
350
|
}
|
|
366
351
|
return fileName;
|
|
367
352
|
}
|
|
368
|
-
destroy() {
|
|
369
|
-
// TO DO
|
|
370
|
-
}
|
|
371
353
|
getCustomExportDateFormat() {
|
|
372
354
|
return this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
373
355
|
}
|
|
@@ -379,4 +361,238 @@ export class ReportService {
|
|
|
379
361
|
: // type === formattedValue
|
|
380
362
|
this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
|
|
381
363
|
}
|
|
364
|
+
// aggregate and merge all acive Adaptable styles with the user proviided ExcelStyles
|
|
365
|
+
buildExcelStylesForVisualReports() {
|
|
366
|
+
// for historical reasons, the styles are merged as class variables
|
|
367
|
+
// we could/should refactor this to be more functional
|
|
368
|
+
this.createExcelStyleMemoization();
|
|
369
|
+
return Object.values(this.excelStylesCache);
|
|
370
|
+
}
|
|
371
|
+
createExcelStyleMemoization() {
|
|
372
|
+
this.resetExcelStyleMemoization();
|
|
373
|
+
// we memoize as much as possible, as this is called quite A LOT
|
|
374
|
+
const adaptableColumnMap = {};
|
|
375
|
+
const getAdaptableColumnWithColumnId = (columnId) => {
|
|
376
|
+
const memoizedColumn = adaptableColumnMap[columnId];
|
|
377
|
+
if (memoizedColumn) {
|
|
378
|
+
return memoizedColumn;
|
|
379
|
+
}
|
|
380
|
+
const abColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
381
|
+
adaptableColumnMap[columnId] = abColumn;
|
|
382
|
+
return abColumn;
|
|
383
|
+
};
|
|
384
|
+
const formatColumnsWithDisplayFormatForColumn = {};
|
|
385
|
+
const getFormatColumnsWithDisplayFormatForColumn = (columnId) => {
|
|
386
|
+
const memoizedFormatColumns = formatColumnsWithDisplayFormatForColumn[columnId];
|
|
387
|
+
if (memoizedFormatColumns) {
|
|
388
|
+
return memoizedFormatColumns;
|
|
389
|
+
}
|
|
390
|
+
const abColumn = getAdaptableColumnWithColumnId(columnId);
|
|
391
|
+
const formatColumns = this.adaptableApi.formatColumnApi.internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
|
|
392
|
+
formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
|
|
393
|
+
return formatColumns;
|
|
394
|
+
};
|
|
395
|
+
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue();
|
|
396
|
+
const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
|
|
397
|
+
const colDefs = displayedColumns.map((column) => {
|
|
398
|
+
return column.getColDef();
|
|
399
|
+
});
|
|
400
|
+
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
401
|
+
const agGridApi = this.adaptableApi.agGridApi;
|
|
402
|
+
const userExcelStyles = this.adaptableApi.internalApi
|
|
403
|
+
.getAdaptableInstance()
|
|
404
|
+
.agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
|
|
405
|
+
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
406
|
+
var _a;
|
|
407
|
+
const rowParams = {
|
|
408
|
+
node,
|
|
409
|
+
data: node.data,
|
|
410
|
+
rowIndex,
|
|
411
|
+
api: agGridApi,
|
|
412
|
+
columnApi: null,
|
|
413
|
+
context: ((_a = agGridApi.__getContext) === null || _a === void 0 ? void 0 : _a.call(agGridApi)) || {},
|
|
414
|
+
};
|
|
415
|
+
const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
|
|
416
|
+
const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
|
|
417
|
+
displayedColumns.forEach((column, columnIndex) => {
|
|
418
|
+
var _a, _b, _c;
|
|
419
|
+
const colDef = colDefs[columnIndex];
|
|
420
|
+
let cellClassParams;
|
|
421
|
+
const getLazyCellClassParams = () => {
|
|
422
|
+
if (!cellClassParams) {
|
|
423
|
+
cellClassParams = {
|
|
424
|
+
colDef,
|
|
425
|
+
node,
|
|
426
|
+
column,
|
|
427
|
+
data: node.data,
|
|
428
|
+
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId()),
|
|
429
|
+
rowIndex,
|
|
430
|
+
api: agGridApi,
|
|
431
|
+
columnApi: null,
|
|
432
|
+
context: {},
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
return cellClassParams;
|
|
436
|
+
};
|
|
437
|
+
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
438
|
+
const excelStyles = [];
|
|
439
|
+
// add user defined excel styles
|
|
440
|
+
let userColDefCellClass = this.adaptableApi.internalApi
|
|
441
|
+
.getAdaptableInstance()
|
|
442
|
+
.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
443
|
+
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
444
|
+
? userColDefCellClass(getLazyCellClassParams())
|
|
445
|
+
: userColDefCellClass;
|
|
446
|
+
const userDefinedExcelStyle = userDefinedCellClass &&
|
|
447
|
+
userExcelStyles.find((excelStyle) => {
|
|
448
|
+
var _a;
|
|
449
|
+
return typeof userDefinedCellClass === 'string'
|
|
450
|
+
? userDefinedCellClass === excelStyle.id
|
|
451
|
+
: (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
|
|
452
|
+
});
|
|
453
|
+
if (userDefinedExcelStyle) {
|
|
454
|
+
excelStyles.push(userDefinedExcelStyle);
|
|
455
|
+
}
|
|
456
|
+
// add adaptable derived styles (format column etc.)
|
|
457
|
+
const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
|
|
458
|
+
if (cellStyle[key] !== null) {
|
|
459
|
+
result[key] = cellStyle[key];
|
|
460
|
+
}
|
|
461
|
+
return result;
|
|
462
|
+
}, {}));
|
|
463
|
+
const sanitizedAdaptableStyle = sanitizeStyle(adaptableStyle);
|
|
464
|
+
if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
|
|
465
|
+
excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
|
|
466
|
+
}
|
|
467
|
+
const excelDataType = this.adaptableApi.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
|
|
468
|
+
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
469
|
+
// don't add the cell style if it has no adaptable custom styles
|
|
470
|
+
if (!excelStyles.length &&
|
|
471
|
+
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
472
|
+
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
const cellClassId = this.adaptableApi.internalApi
|
|
476
|
+
.getAdaptableInstance()
|
|
477
|
+
.agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.internalApi
|
|
478
|
+
.getAdaptableInstance()
|
|
479
|
+
.getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
|
|
480
|
+
const finalCellExcelStyle = Object.assign({}, ...excelStyles);
|
|
481
|
+
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
482
|
+
let dateFormatPattern = this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
483
|
+
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
484
|
+
if (!dateFormatPattern) {
|
|
485
|
+
const mostRelevantFormatColumn = this.adaptableApi.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
|
|
486
|
+
dateFormatPattern =
|
|
487
|
+
((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
|
|
488
|
+
((_c = (_b = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _b === void 0 ? void 0 : _b.Options) === null || _c === void 0 ? void 0 : _c.Pattern);
|
|
489
|
+
}
|
|
490
|
+
if (dateFormatPattern) {
|
|
491
|
+
const normalisedValue = this.adaptableApi.internalApi
|
|
492
|
+
.getAdaptableInstance()
|
|
493
|
+
.getNormalisedValueFromRawValue(rawValue, abColumn);
|
|
494
|
+
if (normalisedValue) {
|
|
495
|
+
// we have to pass the date in the ISO format to Excel
|
|
496
|
+
// see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
|
|
497
|
+
// we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
|
|
498
|
+
const isoFormattedValue = DateFormatter(normalisedValue, {
|
|
499
|
+
Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
|
|
500
|
+
});
|
|
501
|
+
if (isoFormattedValue) {
|
|
502
|
+
finalCellExcelStyle.dataType = 'DateTime';
|
|
503
|
+
finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
|
|
504
|
+
// create a new cell key to ensure any user provided className does not interfere
|
|
505
|
+
const cellKey = this.adaptableApi.internalApi
|
|
506
|
+
.getAdaptableInstance()
|
|
507
|
+
.agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptableApi.internalApi
|
|
508
|
+
.getAdaptableInstance()
|
|
509
|
+
.getPrimaryKeyValueFromRowNode(node));
|
|
510
|
+
// we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
|
|
511
|
+
this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
this.registerExcelStyle(finalCellExcelStyle, cellClassId);
|
|
517
|
+
});
|
|
518
|
+
}, forAllVisibleRowNodesDoConfig);
|
|
519
|
+
}
|
|
520
|
+
convertCSSToExcelStyle(style) {
|
|
521
|
+
const getHexColor = (color) => {
|
|
522
|
+
const preparedColor = getVariableColor(color);
|
|
523
|
+
const t = tinycolor(preparedColor);
|
|
524
|
+
const a = t.getAlpha();
|
|
525
|
+
return tinycolor.mix(tinycolor('white'), t, a * 100).toHexString();
|
|
526
|
+
};
|
|
527
|
+
let result = {};
|
|
528
|
+
if (style.backgroundColor != null) {
|
|
529
|
+
result.interior = {
|
|
530
|
+
color: getHexColor(style.backgroundColor),
|
|
531
|
+
pattern: 'Solid',
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
if (style.borderColor != null) {
|
|
535
|
+
const excelBorder = {
|
|
536
|
+
color: style.borderColor,
|
|
537
|
+
lineStyle: 'Continuous',
|
|
538
|
+
weight: 1,
|
|
539
|
+
};
|
|
540
|
+
result.borders = {
|
|
541
|
+
borderBottom: excelBorder,
|
|
542
|
+
borderLeft: excelBorder,
|
|
543
|
+
borderRight: excelBorder,
|
|
544
|
+
borderTop: excelBorder,
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
if (style.textAlign) {
|
|
548
|
+
result.alignment = {
|
|
549
|
+
horizontal: StringExtensions.CapitaliseFirstLetter(style.textAlign),
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
if (style.color != null) {
|
|
553
|
+
if (!result.font) {
|
|
554
|
+
result.font = {};
|
|
555
|
+
}
|
|
556
|
+
result.font = {
|
|
557
|
+
color: getHexColor(style.color),
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
if (style.fontStyle === 'italic') {
|
|
561
|
+
if (!result.font) {
|
|
562
|
+
result.font = {};
|
|
563
|
+
}
|
|
564
|
+
result.font.italic = true;
|
|
565
|
+
}
|
|
566
|
+
if (style.fontWeight != null &&
|
|
567
|
+
(style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
|
|
568
|
+
if (!result.font) {
|
|
569
|
+
result.font = {};
|
|
570
|
+
}
|
|
571
|
+
result.font.bold = true;
|
|
572
|
+
}
|
|
573
|
+
if (style.fontSize != null) {
|
|
574
|
+
if (!result.font) {
|
|
575
|
+
result.font = {};
|
|
576
|
+
}
|
|
577
|
+
result.font.size = convertCSSAbsoluteFontSizeToPt(style.fontSize);
|
|
578
|
+
}
|
|
579
|
+
return result;
|
|
580
|
+
}
|
|
581
|
+
resetExcelStyleMemoization() {
|
|
582
|
+
this.excelStylesCache = {};
|
|
583
|
+
this.cellClassKey2excelStyleIdMap = {};
|
|
584
|
+
this.excelStylesWithFormattedDate = {};
|
|
585
|
+
}
|
|
586
|
+
registerExcelStyle(excelStyle, cellClassKey) {
|
|
587
|
+
const excelStyleKey = JSON.stringify(excelStyle);
|
|
588
|
+
if (!this.excelStylesCache[excelStyleKey]) {
|
|
589
|
+
const excelStyleId = createUuid();
|
|
590
|
+
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
591
|
+
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
592
|
+
}
|
|
593
|
+
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
594
|
+
}
|
|
595
|
+
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
596
|
+
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
597
|
+
}
|
|
382
598
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRowNode } from '@ag-grid-community/core';
|
|
2
|
-
import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
|
|
3
2
|
import { AdaptableApi, AdaptableModule } from '../../types';
|
|
3
|
+
import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
|
|
4
4
|
export declare const summarySupportedExpressions: readonly ["SUM", "AVG", "MIN", "MAX", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "STD_DEVIATION"];
|
|
5
5
|
export type SummarySupportedExpression = (typeof summarySupportedExpressions)[number];
|
|
6
6
|
export type SumaryConfig = {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const mapColumnDataTypeToExpressionFunctionType = (dataType) => {
|
|
2
|
+
if (dataType === 'Number') {
|
|
3
|
+
return 'number';
|
|
4
|
+
}
|
|
5
|
+
if (dataType === 'Boolean') {
|
|
6
|
+
return 'boolean';
|
|
7
|
+
}
|
|
8
|
+
if (dataType === 'String') {
|
|
9
|
+
return 'text';
|
|
10
|
+
}
|
|
11
|
+
if (dataType === 'Date') {
|
|
12
|
+
return 'date';
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -29,7 +29,7 @@ import { StatusBarPopup } from './StatusBar/StatusBarPopup';
|
|
|
29
29
|
import { ChartingViewPanel } from './Charting/ChartingViewPanel';
|
|
30
30
|
import { GridFilterPopup } from './GridFilter/GridFilterPopup';
|
|
31
31
|
import { ColumnInfoPopup } from './ColumnInfo/ColumnInfoPopup';
|
|
32
|
-
import {
|
|
32
|
+
import { NotePopup } from './Note/NotePopup';
|
|
33
33
|
import { CommentsPopup } from './Comments/CommentsPopup';
|
|
34
34
|
import { DataImportPopup } from './DataImport/DataImportPopup';
|
|
35
35
|
export const AdaptableViewFactory = {
|
|
@@ -46,7 +46,7 @@ export const AdaptableViewFactory = {
|
|
|
46
46
|
ToolPanelPopup,
|
|
47
47
|
SystemStatusPopup,
|
|
48
48
|
DataChangeHistoryPopup,
|
|
49
|
-
|
|
49
|
+
NotePopup,
|
|
50
50
|
CommentsPopup,
|
|
51
51
|
DataImportPopup,
|
|
52
52
|
GridFilterPopup,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { CalculatedColumn } from '../../../types';
|
|
3
3
|
import { AdaptableOnePageWizardProps } from '../../Wizard/Interface/IAdaptableWizard';
|
|
4
4
|
export declare const calculatedColumnTypes: readonly ["ScalarExpression", "AggregatedScalarExpression", "CumulativeAggregatedExpression", "QuantileAggregatedExpression"];
|
|
5
|
-
export type ExpressionType =
|
|
5
|
+
export type ExpressionType = typeof calculatedColumnTypes[number];
|
|
6
6
|
export interface CalculatedColumnWizardProps extends AdaptableOnePageWizardProps<CalculatedColumn> {
|
|
7
7
|
}
|
|
8
8
|
export declare const CalculatedColumnWizard: (props: CalculatedColumnWizardProps) => JSX.Element;
|
|
@@ -36,7 +36,7 @@ export const CalculatedColumnWizard = (props) => {
|
|
|
36
36
|
return cloneObject(calculatedColumn);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
return ObjectFactory.CreateEmptyCalculatedColumn();
|
|
39
|
+
return ObjectFactory.CreateEmptyCalculatedColumn(adaptable.api.gridApi.internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef());
|
|
40
40
|
});
|
|
41
41
|
const dispatch = useDispatch();
|
|
42
42
|
const isEdit = Boolean(props.data) || ((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Edit';
|
|
@@ -85,7 +85,7 @@ export const CommentsEditor = (props) => {
|
|
|
85
85
|
}
|
|
86
86
|
}, mt: 2, mb: "2", width: "100%", placeholder: "Write new comment" }),
|
|
87
87
|
React.createElement(SimpleButton, { width: "100%", variant: "raised", onClick: () => {
|
|
88
|
-
adaptable.api.settingsPanelApi.openSettingsPanel('
|
|
88
|
+
adaptable.api.settingsPanelApi.openSettingsPanel('Comment');
|
|
89
89
|
adaptable.api.internalApi.getCellPopupService().hidePopup();
|
|
90
90
|
} },
|
|
91
91
|
React.createElement(Box, { mr: 2 },
|
|
@@ -45,14 +45,18 @@ const CellComments = (props) => {
|
|
|
45
45
|
const columnFriendlyName = adaptable.api.columnApi.getFriendlyNameForColumnId(props.commentThread.ColumnId);
|
|
46
46
|
return (React.createElement(Panel, { mb: 2, header: React.createElement(Flex, { width: "100%", alignItems: "center" },
|
|
47
47
|
React.createElement(Box, { mr: 2 },
|
|
48
|
-
"Cell Value:
|
|
48
|
+
React.createElement("b", null, "Cell Value:"),
|
|
49
|
+
" ",
|
|
49
50
|
cellValue),
|
|
50
51
|
React.createElement(Box, { mr: 2 },
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
React.createElement("b", null,
|
|
53
|
+
primaryKeyHeader,
|
|
54
|
+
":"),
|
|
55
|
+
" ",
|
|
53
56
|
props.commentThread.PrimaryKeyValue),
|
|
54
57
|
React.createElement(Box, null,
|
|
55
|
-
"Column:
|
|
58
|
+
React.createElement("b", null, "Column:"),
|
|
59
|
+
" ",
|
|
56
60
|
columnFriendlyName),
|
|
57
61
|
React.createElement(Box, { flex: 1 }),
|
|
58
62
|
React.createElement(AdaptableButtonComponent, { mr: 1, variant: "text", icon: "visibility-on", onClick: () => {
|
|
@@ -139,7 +139,7 @@ export const NewScopeComponent = (props) => {
|
|
|
139
139
|
}
|
|
140
140
|
const hasColumnTypes = React.useMemo(() => {
|
|
141
141
|
var _a;
|
|
142
|
-
return ((_a = api.
|
|
142
|
+
return ((_a = api.columnApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
143
143
|
}, []);
|
|
144
144
|
return (React.createElement(Tabs, { "data-name": 'scope-component', className: "ab-ScopeComponent", value: scopeChoice, style: Object.assign({ height: '100%' }, props.style), onValueChange: onScopeSelectChanged },
|
|
145
145
|
props.hideWholeRow ? null : (React.createElement(Tabs.Tab, { value: "Row" },
|
|
@@ -165,7 +165,7 @@ export const NewScopeComponent = (props) => {
|
|
|
165
165
|
React.createElement(Flex, { flexDirection: "column" }, dataTypeOptions.map((dataTypeOption) => (React.createElement(CheckBox, { "data-name": "scope", "data-value": dataTypeOption.value, key: dataTypeOption.value, checked: dataTypesInScope && dataTypesInScope.includes(dataTypeOption.value), onChange: (checked) => onCheckBoxDataTypeChecked(checked, dataTypeOption.value) }, dataTypeOption.label))))))),
|
|
166
166
|
hasColumnTypes && (React.createElement(Tabs.Content, { value: "ColumnType", style: { flex: 'none' }, "data-name": "column-type-scope" },
|
|
167
167
|
React.createElement(Box, null,
|
|
168
|
-
React.createElement(Flex, { flexDirection: "column" }, (_b = (_a = api.
|
|
168
|
+
React.createElement(Flex, { flexDirection: "column" }, (_b = (_a = api.columnApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnType) => {
|
|
169
169
|
var _a;
|
|
170
170
|
return (React.createElement(CheckBox, { "data-name": "scope", "data-value": columnType, key: columnType, checked: 'ColumnTypes' in props.scope && ((_a = props.scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.includes(columnType)), onChange: (checked) => {
|
|
171
171
|
let columnTypes = [].concat(props.scope.ColumnTypes);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
3
|
import { Flex } from 'rebass';
|
|
4
|
-
import { GetNotesSelector } from '../../../../Redux/ActionsReducers/
|
|
4
|
+
import { GetNotesSelector } from '../../../../Redux/ActionsReducers/NoteRedux';
|
|
5
5
|
import { SystemCommentsAndNotesEditModeSelector, SystemCommentsAndNotesFocusedEntitySelector, SystemCommentsAndNotesSelector, } from '../../../../Redux/ActionsReducers/SystemRedux';
|
|
6
6
|
import { useAdaptable } from '../../../AdaptableContext';
|
|
7
7
|
import { CommentsEditor } from '../../../Comments/CommentsEditor';
|
|
8
|
-
import { NoteEditor } from '../../../
|
|
8
|
+
import { NoteEditor } from '../../../Note/NoteEditor';
|
|
9
9
|
import { CellPopup } from '../../CellPopup';
|
|
10
10
|
const ConnectedNoteEditor = ({ enableEditMode }) => {
|
|
11
11
|
const { api } = useAdaptable();
|
|
12
|
-
const isReadonly = api.entitlementApi.isModuleReadOnlyEntitlement('
|
|
12
|
+
const isReadonly = api.entitlementApi.isModuleReadOnlyEntitlement('Note');
|
|
13
13
|
const editMode = useSelector((state) => SystemCommentsAndNotesEditModeSelector(state.System));
|
|
14
14
|
const cellPopupService = api.internalApi.getCellPopupService();
|
|
15
15
|
const cellAddress = useSelector((state) => SystemCommentsAndNotesSelector(state.System));
|
|
@@ -17,12 +17,12 @@ const ConnectedNoteEditor = ({ enableEditMode }) => {
|
|
|
17
17
|
// Only handle first note for now
|
|
18
18
|
// Later we can handle multiple notes
|
|
19
19
|
note,] = useSelector((state) => {
|
|
20
|
-
return cellAddress ? GetNotesSelector(state.
|
|
20
|
+
return cellAddress ? GetNotesSelector(state.Note, cellAddress) : [];
|
|
21
21
|
});
|
|
22
22
|
const handleNoteChange = React.useCallback((value) => {
|
|
23
|
-
api.
|
|
23
|
+
api.noteApi.updateNoteText(value, note);
|
|
24
24
|
}, [note]);
|
|
25
|
-
return (React.createElement(Flex, { onClick: () => enableEditMode(), flexDirection: "column", className: "ab-
|
|
25
|
+
return (React.createElement(Flex, { onClick: () => enableEditMode(), flexDirection: "column", className: "ab-NotePopup" },
|
|
26
26
|
React.createElement(NoteEditor, { isReadonly: isReadonly, editMode: editMode, key: note === null || note === void 0 ? void 0 : note.Uuid, onClose: () => cellPopupService.hidePopup(), note: note === null || note === void 0 ? void 0 : note.Text, onNoteChange: (value) => handleNoteChange(value) })));
|
|
27
27
|
};
|
|
28
28
|
export const GridCellPopup = (props) => {
|
|
@@ -26,6 +26,7 @@ export type ValueSelectorProps<OPTION_TYPE, ID_TYPE extends number | string> = {
|
|
|
26
26
|
onShowSelectedOnlyChange?: (selectedOnly: boolean) => void;
|
|
27
27
|
isOptionDisabled?: (option: OPTION_TYPE) => boolean;
|
|
28
28
|
disabled?: boolean;
|
|
29
|
+
style?: React.CSSProperties;
|
|
29
30
|
};
|
|
30
31
|
export declare function ValueSelector<OPTION_TYPE, ID_TYPE extends number | string>(props: ValueSelectorProps<OPTION_TYPE, ID_TYPE>): JSX.Element;
|
|
31
32
|
export declare namespace ValueSelector {
|
|
@@ -111,7 +111,7 @@ export function ValueSelector(props) {
|
|
|
111
111
|
};
|
|
112
112
|
const showOnlySelectedCheckbox = (React.createElement(CheckBox, { disabled: !value.length, checked: selectedOnly, onChange: setSelectedOnly }, showSelectedOnlyLabel !== null && showSelectedOnlyLabel !== void 0 ? showSelectedOnlyLabel : 'Show Selected Only'));
|
|
113
113
|
const showSelectedOnlyPosition = (_a = props.showSelectedOnlyPosition) !== null && _a !== void 0 ? _a : 'floating';
|
|
114
|
-
return (React.createElement(Flex, { className: baseClassName, flexDirection: "column", flex: 1 },
|
|
114
|
+
return (React.createElement(Flex, { style: props.style, className: baseClassName, flexDirection: "column", flex: 1 },
|
|
115
115
|
React.createElement(Flex, { mb: 1 },
|
|
116
116
|
showFilterInput && filter ? (React.createElement(AdaptableFormControlTextClear, { value: searchInputValue, OnTextChange: setSearchInputValue, placeholder: "Type to search", style: { flex: 1, border: 0, margin: 3 } })) : (React.createElement(Box, { flex: 1 })),
|
|
117
117
|
showSelectedOnlyPosition === 'top' && React.createElement(Box, { ml: 20 }, showOnlySelectedCheckbox)),
|
|
@@ -45,7 +45,7 @@ export class FreeTextColumnSummaryComponent extends React.Component {
|
|
|
45
45
|
this.state.editedAdaptableObject && (React.createElement(FreeTextColumnWizard, { moduleInfo: this.props.moduleInfo, data: this.state.editedAdaptableObject, configEntities: this.props.FreeTextColumns, onCloseWizard: () => this.onCloseWizard(), onFinishWizard: this.onFinishWizard }))));
|
|
46
46
|
}
|
|
47
47
|
onNew() {
|
|
48
|
-
let configEntity = ObjectFactory.CreateEmptyFreeTextColumn();
|
|
48
|
+
let configEntity = ObjectFactory.CreateEmptyFreeTextColumn(this.props.api.gridApi.internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef());
|
|
49
49
|
configEntity.ColumnId = this.props.summarisedColumn.columnId;
|
|
50
50
|
this.setState({
|
|
51
51
|
editedAdaptableObject: configEntity,
|
|
@@ -8,8 +8,10 @@ import ObjectFactory from '../../../Utilities/ObjectFactory';
|
|
|
8
8
|
import * as FreeTextColumnRedux from '../../../Redux/ActionsReducers/FreeTextColumnRedux';
|
|
9
9
|
import { useDispatch, useSelector } from 'react-redux';
|
|
10
10
|
import { ObjectTagsWizardSection, renderObjectTagsSummary, } from '../../Wizard/ObjectTagsWizardSection';
|
|
11
|
+
import { useAdaptable } from '../../AdaptableContext';
|
|
11
12
|
export const FreeTextColumnWizard = (props) => {
|
|
12
13
|
var _a;
|
|
14
|
+
const adaptable = useAdaptable();
|
|
13
15
|
const allFreeTextColumns = useSelector((state) => state.FreeTextColumn.FreeTextColumns);
|
|
14
16
|
const [freeTextColumn, setFreeTextColumn] = useState(() => {
|
|
15
17
|
var _a, _b;
|
|
@@ -19,7 +21,7 @@ export const FreeTextColumnWizard = (props) => {
|
|
|
19
21
|
if (((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Edit' && ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.column)) {
|
|
20
22
|
return allFreeTextColumns.find((column) => column.ColumnId === props.popupParams.column.columnId);
|
|
21
23
|
}
|
|
22
|
-
return ObjectFactory.CreateEmptyFreeTextColumn();
|
|
24
|
+
return ObjectFactory.CreateEmptyFreeTextColumn(adaptable.api.gridApi.internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef());
|
|
23
25
|
});
|
|
24
26
|
const dispatch = useDispatch();
|
|
25
27
|
const isEdit = props.data || ((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Edit';
|
|
@@ -25,8 +25,9 @@ class LayoutViewPanelComponent extends React.Component {
|
|
|
25
25
|
return Object.assign(Object.assign({}, layout), { label: layout.Name, value: layout.Name, onClick: () => this.props.onSelectLayout(layout.Name) });
|
|
26
26
|
});
|
|
27
27
|
const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
28
|
+
let layoutSelectStyle = elementType === 'ToolPanel' ? { minWidth: '100%' } : {};
|
|
28
29
|
return (React.createElement(Flex, { flexDirection: "row", className: `ab-${elementType}__Layout__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
|
|
29
|
-
React.createElement(Flex, { flex: 1 },
|
|
30
|
+
React.createElement(Flex, { style: layoutSelectStyle, flex: 1 },
|
|
30
31
|
React.createElement(Select, { style: { width: '100%' }, options: availableLayoutOptions, className: `ab-${elementType}__Layout__select`, value: layoutEntity ? layoutEntity.Name : null, onChange: (layout) => this.props.onSelectLayout(layout) })),
|
|
31
32
|
React.createElement(Flex, { flexDirection: "row", className: join(this.props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__Layout__wrap`) },
|
|
32
33
|
isManualSaveLayout && (React.createElement(ButtonSave, { className: `ab-${elementType}__Layout__save`, onClick: () => this.onSaveLayout(), tooltip: "Save Changes to Current Layout", disabled: !this.props.CanSave, accessLevel: accessLevel })),
|
|
@@ -7,21 +7,21 @@ import { ColumnSelector } from '../Components/Selectors/ColumnSelector';
|
|
|
7
7
|
import { AdaptableAgGrid } from '../../agGrid/AdaptableAgGrid';
|
|
8
8
|
export const TransposedPopup = (props) => {
|
|
9
9
|
const adaptable = useAdaptable();
|
|
10
|
+
const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows } = props.popupProps;
|
|
10
11
|
const rowNodes = React.useMemo(() => {
|
|
11
|
-
return
|
|
12
|
+
return props.popupProps.visibleRows
|
|
13
|
+
? adaptable.api.gridApi.getVisibleRowNodes()
|
|
14
|
+
: adaptable.api.gridApi.getAllRowNodes();
|
|
12
15
|
}, [
|
|
13
|
-
// can be later triggered by
|
|
16
|
+
// can be later triggered by tickng data
|
|
14
17
|
]);
|
|
15
|
-
const { transposedColumnId, hideTransposedColumn = true } = props.popupProps;
|
|
16
18
|
const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
|
|
17
|
-
|
|
18
|
-
const transposeByColumnId = primaryKey;
|
|
19
|
-
// Only used to show nice values a the top of the grid, istead on the value
|
|
20
|
-
// of the primarykey
|
|
21
|
-
const [synteticTransposedByColumnId, setSynteticTransposedByColumnId] = React.useState(transposedColumnId !== null && transposedColumnId !== void 0 ? transposedColumnId : primaryKey);
|
|
19
|
+
const [syntheticTransposedByColumnId, setSyntheticTransposedByColumnId] = React.useState(transposedColumnId);
|
|
22
20
|
const columns = React.useMemo(() => {
|
|
23
21
|
// customisable
|
|
24
|
-
return
|
|
22
|
+
return visibleColumns
|
|
23
|
+
? adaptable.api.columnApi.getVisibleColumns()
|
|
24
|
+
: adaptable.api.columnApi.getColumns();
|
|
25
25
|
}, []);
|
|
26
26
|
const adaptableContainerId = 'transposed-adaptable-container';
|
|
27
27
|
const agGridContainerId = 'transposed-adaptable-ag-grid-container';
|
|
@@ -40,9 +40,10 @@ export const TransposedPopup = (props) => {
|
|
|
40
40
|
for (const row of rowNodes) {
|
|
41
41
|
// we force the col-ids to be strings, easer to work with
|
|
42
42
|
//row[transposeByColumnId] + '';
|
|
43
|
-
const colId = adaptable.api.gridApi.getNormalisedValueFromRowNode(row,
|
|
43
|
+
const colId = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, primaryKey) + '';
|
|
44
44
|
//row[synteticTransposedByColumnId] + '';
|
|
45
|
-
const header = adaptable.api.gridApi.getNormalisedValueFromRowNode(row,
|
|
45
|
+
const header = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, syntheticTransposedByColumnId) +
|
|
46
|
+
'';
|
|
46
47
|
transposedColumns.push({
|
|
47
48
|
colId,
|
|
48
49
|
header,
|
|
@@ -52,7 +53,7 @@ export const TransposedPopup = (props) => {
|
|
|
52
53
|
/**
|
|
53
54
|
* We can hide the transposed column, if we want
|
|
54
55
|
*/
|
|
55
|
-
if (hideTransposedColumn && column.columnId ===
|
|
56
|
+
if (hideTransposedColumn && column.columnId === syntheticTransposedByColumnId) {
|
|
56
57
|
continue;
|
|
57
58
|
}
|
|
58
59
|
const transposedRow = {
|
|
@@ -63,7 +64,7 @@ export const TransposedPopup = (props) => {
|
|
|
63
64
|
};
|
|
64
65
|
for (let row of rowNodes) {
|
|
65
66
|
// [transposed-by-column-value[n]]: [other column value[n]]
|
|
66
|
-
const key = adaptable.api.gridApi.getNormalisedValueFromRowNode(row,
|
|
67
|
+
const key = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, primaryKey);
|
|
67
68
|
// row[column.field]
|
|
68
69
|
let value = adaptable.api.gridApi.getDisplayValueFromRowNode(row, column.columnId);
|
|
69
70
|
if (value instanceof Date) {
|
|
@@ -77,7 +78,7 @@ export const TransposedPopup = (props) => {
|
|
|
77
78
|
transposedColumns,
|
|
78
79
|
transposedRows,
|
|
79
80
|
};
|
|
80
|
-
}, [rowNodes, primaryKey,
|
|
81
|
+
}, [rowNodes, primaryKey, syntheticTransposedByColumnId]);
|
|
81
82
|
React.useEffect(() => {
|
|
82
83
|
// Mounting in an effect, so the nodes are rendered/available
|
|
83
84
|
const hostAdaptableOptions = adaptable.adaptableOptions;
|
|
@@ -121,7 +122,7 @@ export const TransposedPopup = (props) => {
|
|
|
121
122
|
};
|
|
122
123
|
const firstColumn = {
|
|
123
124
|
field: transposedFirstColumnHeader,
|
|
124
|
-
headerName: adaptable.api.columnApi.getFriendlyNameForColumnId(
|
|
125
|
+
headerName: adaptable.api.columnApi.getFriendlyNameForColumnId(syntheticTransposedByColumnId),
|
|
125
126
|
};
|
|
126
127
|
const agGridOptions = {
|
|
127
128
|
suppressLoadingOverlay: true,
|
|
@@ -173,7 +174,7 @@ export const TransposedPopup = (props) => {
|
|
|
173
174
|
transposedAdaptableApi.destroy();
|
|
174
175
|
}
|
|
175
176
|
};
|
|
176
|
-
}, [
|
|
177
|
+
}, [syntheticTransposedByColumnId]);
|
|
177
178
|
/**
|
|
178
179
|
* Need to get all data, manualy pivot the grid using the primary key.
|
|
179
180
|
*
|
|
@@ -185,8 +186,8 @@ export const TransposedPopup = (props) => {
|
|
|
185
186
|
React.createElement(Panel, null,
|
|
186
187
|
React.createElement(FormLayout, null,
|
|
187
188
|
React.createElement(FormRow, { label: "Elevated Column" },
|
|
188
|
-
React.createElement(ColumnSelector, { value:
|
|
189
|
-
|
|
189
|
+
React.createElement(ColumnSelector, { value: syntheticTransposedByColumnId, onChange: (colId) => {
|
|
190
|
+
setSyntheticTransposedByColumnId(colId);
|
|
190
191
|
} })))),
|
|
191
192
|
React.createElement(Flex, { height: "100%" },
|
|
192
193
|
React.createElement(Box, { id: "transposed-adaptable-container" }),
|