@adaptabletools/adaptable-cjs 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} +14 -14
- 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} +3 -3
- 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/{CellAddress.js → NoteState.js} +0 -3
- 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} +27 -27
- package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/SystemRedux.js +3 -3
- package/src/Redux/Store/AdaptableStore.js +10 -16
- package/src/Strategy/{CommentsModule.d.ts → CommentModule.d.ts} +1 -5
- package/src/Strategy/{CommentsModule.js → CommentModule.js} +11 -12
- 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} +13 -9
- package/src/Strategy/Utilities/getScopeViewItems.js +3 -0
- package/src/Utilities/Constants/ModuleConstants.d.ts +6 -6
- package/src/Utilities/Constants/ModuleConstants.js +7 -7
- 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 +18 -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 +146 -0
- package/src/View/Note/NotePopup.d.ts +2 -0
- package/src/View/{Notes/NotesPopup.js → Note/NotePopup.js} +8 -8
- 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 +3 -17
- 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.cjs.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/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
|
@@ -11,6 +11,8 @@ const StringExtensions_1 = tslib_1.__importDefault(require("../Extensions/String
|
|
|
11
11
|
const ModuleConstants_1 = require("../Constants/ModuleConstants");
|
|
12
12
|
const uuid_1 = require("../../components/utils/uuid");
|
|
13
13
|
const ObjectFactory_1 = require("../ObjectFactory");
|
|
14
|
+
const StyleHelper_1 = require("../Helpers/StyleHelper");
|
|
15
|
+
const tinycolor2_1 = tslib_1.__importDefault(require("tinycolor2"));
|
|
14
16
|
class ReportService {
|
|
15
17
|
constructor(adaptableApi) {
|
|
16
18
|
this.adaptableApi = adaptableApi;
|
|
@@ -19,29 +21,12 @@ class ReportService {
|
|
|
19
21
|
this.excelStylesWithFormattedDate = {};
|
|
20
22
|
this.adaptableApi = adaptableApi;
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.cellClassKey2excelStyleIdMap = {};
|
|
25
|
-
this.excelStylesWithFormattedDate = {};
|
|
26
|
-
}
|
|
27
|
-
registerExcelStyle(excelStyle, cellClassKey) {
|
|
28
|
-
const excelStyleKey = JSON.stringify(excelStyle);
|
|
29
|
-
if (!this.excelStylesCache[excelStyleKey]) {
|
|
30
|
-
const excelStyleId = (0, uuid_1.createUuid)();
|
|
31
|
-
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
32
|
-
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
33
|
-
}
|
|
34
|
-
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
35
|
-
}
|
|
36
|
-
getRegisteredExcelStyles() {
|
|
37
|
-
return Object.values(this.excelStylesCache);
|
|
24
|
+
destroy() {
|
|
25
|
+
// TO DO
|
|
38
26
|
}
|
|
39
27
|
getExcelStyleIdForCellClassKey(cellClassKey) {
|
|
40
28
|
return this.cellClassKey2excelStyleIdMap[cellClassKey];
|
|
41
29
|
}
|
|
42
|
-
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
43
|
-
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
44
|
-
}
|
|
45
30
|
getExcelStyleWithFormattedDate(cellClassId) {
|
|
46
31
|
return this.excelStylesWithFormattedDate[cellClassId];
|
|
47
32
|
}
|
|
@@ -369,9 +354,6 @@ class ReportService {
|
|
|
369
354
|
}
|
|
370
355
|
return fileName;
|
|
371
356
|
}
|
|
372
|
-
destroy() {
|
|
373
|
-
// TO DO
|
|
374
|
-
}
|
|
375
357
|
getCustomExportDateFormat() {
|
|
376
358
|
return this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
377
359
|
}
|
|
@@ -383,5 +365,239 @@ class ReportService {
|
|
|
383
365
|
: // type === formattedValue
|
|
384
366
|
this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
|
|
385
367
|
}
|
|
368
|
+
// aggregate and merge all acive Adaptable styles with the user proviided ExcelStyles
|
|
369
|
+
buildExcelStylesForVisualReports() {
|
|
370
|
+
// for historical reasons, the styles are merged as class variables
|
|
371
|
+
// we could/should refactor this to be more functional
|
|
372
|
+
this.createExcelStyleMemoization();
|
|
373
|
+
return Object.values(this.excelStylesCache);
|
|
374
|
+
}
|
|
375
|
+
createExcelStyleMemoization() {
|
|
376
|
+
this.resetExcelStyleMemoization();
|
|
377
|
+
// we memoize as much as possible, as this is called quite A LOT
|
|
378
|
+
const adaptableColumnMap = {};
|
|
379
|
+
const getAdaptableColumnWithColumnId = (columnId) => {
|
|
380
|
+
const memoizedColumn = adaptableColumnMap[columnId];
|
|
381
|
+
if (memoizedColumn) {
|
|
382
|
+
return memoizedColumn;
|
|
383
|
+
}
|
|
384
|
+
const abColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
385
|
+
adaptableColumnMap[columnId] = abColumn;
|
|
386
|
+
return abColumn;
|
|
387
|
+
};
|
|
388
|
+
const formatColumnsWithDisplayFormatForColumn = {};
|
|
389
|
+
const getFormatColumnsWithDisplayFormatForColumn = (columnId) => {
|
|
390
|
+
const memoizedFormatColumns = formatColumnsWithDisplayFormatForColumn[columnId];
|
|
391
|
+
if (memoizedFormatColumns) {
|
|
392
|
+
return memoizedFormatColumns;
|
|
393
|
+
}
|
|
394
|
+
const abColumn = getAdaptableColumnWithColumnId(columnId);
|
|
395
|
+
const formatColumns = this.adaptableApi.formatColumnApi.internalApi.getFormatColumnsWithDisplayFormatForColumn(abColumn);
|
|
396
|
+
formatColumnsWithDisplayFormatForColumn[columnId] = formatColumns;
|
|
397
|
+
return formatColumns;
|
|
398
|
+
};
|
|
399
|
+
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue();
|
|
400
|
+
const displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
|
|
401
|
+
const colDefs = displayedColumns.map((column) => {
|
|
402
|
+
return column.getColDef();
|
|
403
|
+
});
|
|
404
|
+
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
405
|
+
const agGridApi = this.adaptableApi.agGridApi;
|
|
406
|
+
const userExcelStyles = this.adaptableApi.internalApi
|
|
407
|
+
.getAdaptableInstance()
|
|
408
|
+
.agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
|
|
409
|
+
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
410
|
+
var _a;
|
|
411
|
+
const rowParams = {
|
|
412
|
+
node,
|
|
413
|
+
data: node.data,
|
|
414
|
+
rowIndex,
|
|
415
|
+
api: agGridApi,
|
|
416
|
+
columnApi: null,
|
|
417
|
+
context: ((_a = agGridApi.__getContext) === null || _a === void 0 ? void 0 : _a.call(agGridApi)) || {},
|
|
418
|
+
};
|
|
419
|
+
const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
|
|
420
|
+
const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
|
|
421
|
+
displayedColumns.forEach((column, columnIndex) => {
|
|
422
|
+
var _a, _b, _c;
|
|
423
|
+
const colDef = colDefs[columnIndex];
|
|
424
|
+
let cellClassParams;
|
|
425
|
+
const getLazyCellClassParams = () => {
|
|
426
|
+
if (!cellClassParams) {
|
|
427
|
+
cellClassParams = {
|
|
428
|
+
colDef,
|
|
429
|
+
node,
|
|
430
|
+
column,
|
|
431
|
+
data: node.data,
|
|
432
|
+
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId()),
|
|
433
|
+
rowIndex,
|
|
434
|
+
api: agGridApi,
|
|
435
|
+
columnApi: null,
|
|
436
|
+
context: {},
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
return cellClassParams;
|
|
440
|
+
};
|
|
441
|
+
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
442
|
+
const excelStyles = [];
|
|
443
|
+
// add user defined excel styles
|
|
444
|
+
let userColDefCellClass = this.adaptableApi.internalApi
|
|
445
|
+
.getAdaptableInstance()
|
|
446
|
+
.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
447
|
+
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
448
|
+
? userColDefCellClass(getLazyCellClassParams())
|
|
449
|
+
: userColDefCellClass;
|
|
450
|
+
const userDefinedExcelStyle = userDefinedCellClass &&
|
|
451
|
+
userExcelStyles.find((excelStyle) => {
|
|
452
|
+
var _a;
|
|
453
|
+
return typeof userDefinedCellClass === 'string'
|
|
454
|
+
? userDefinedCellClass === excelStyle.id
|
|
455
|
+
: (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
|
|
456
|
+
});
|
|
457
|
+
if (userDefinedExcelStyle) {
|
|
458
|
+
excelStyles.push(userDefinedExcelStyle);
|
|
459
|
+
}
|
|
460
|
+
// add adaptable derived styles (format column etc.)
|
|
461
|
+
const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
|
|
462
|
+
if (cellStyle[key] !== null) {
|
|
463
|
+
result[key] = cellStyle[key];
|
|
464
|
+
}
|
|
465
|
+
return result;
|
|
466
|
+
}, {}));
|
|
467
|
+
const sanitizedAdaptableStyle = (0, StyleHelper_1.sanitizeStyle)(adaptableStyle);
|
|
468
|
+
if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
|
|
469
|
+
excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
|
|
470
|
+
}
|
|
471
|
+
const excelDataType = this.adaptableApi.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
|
|
472
|
+
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
473
|
+
// don't add the cell style if it has no adaptable custom styles
|
|
474
|
+
if (!excelStyles.length &&
|
|
475
|
+
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
476
|
+
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
const cellClassId = this.adaptableApi.internalApi
|
|
480
|
+
.getAdaptableInstance()
|
|
481
|
+
.agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.internalApi
|
|
482
|
+
.getAdaptableInstance()
|
|
483
|
+
.getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
|
|
484
|
+
const finalCellExcelStyle = Object.assign({}, ...excelStyles);
|
|
485
|
+
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
486
|
+
let dateFormatPattern = this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
487
|
+
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
488
|
+
if (!dateFormatPattern) {
|
|
489
|
+
const mostRelevantFormatColumn = this.adaptableApi.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
|
|
490
|
+
dateFormatPattern =
|
|
491
|
+
((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
|
|
492
|
+
((_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);
|
|
493
|
+
}
|
|
494
|
+
if (dateFormatPattern) {
|
|
495
|
+
const normalisedValue = this.adaptableApi.internalApi
|
|
496
|
+
.getAdaptableInstance()
|
|
497
|
+
.getNormalisedValueFromRawValue(rawValue, abColumn);
|
|
498
|
+
if (normalisedValue) {
|
|
499
|
+
// we have to pass the date in the ISO format to Excel
|
|
500
|
+
// see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
|
|
501
|
+
// we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
|
|
502
|
+
const isoFormattedValue = (0, FormatHelper_1.DateFormatter)(normalisedValue, {
|
|
503
|
+
Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
|
|
504
|
+
});
|
|
505
|
+
if (isoFormattedValue) {
|
|
506
|
+
finalCellExcelStyle.dataType = 'DateTime';
|
|
507
|
+
finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
|
|
508
|
+
// create a new cell key to ensure any user provided className does not interfere
|
|
509
|
+
const cellKey = this.adaptableApi.internalApi
|
|
510
|
+
.getAdaptableInstance()
|
|
511
|
+
.agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptableApi.internalApi
|
|
512
|
+
.getAdaptableInstance()
|
|
513
|
+
.getPrimaryKeyValueFromRowNode(node));
|
|
514
|
+
// we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
|
|
515
|
+
this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
this.registerExcelStyle(finalCellExcelStyle, cellClassId);
|
|
521
|
+
});
|
|
522
|
+
}, forAllVisibleRowNodesDoConfig);
|
|
523
|
+
}
|
|
524
|
+
convertCSSToExcelStyle(style) {
|
|
525
|
+
const getHexColor = (color) => {
|
|
526
|
+
const preparedColor = (0, StyleHelper_1.getVariableColor)(color);
|
|
527
|
+
const t = (0, tinycolor2_1.default)(preparedColor);
|
|
528
|
+
const a = t.getAlpha();
|
|
529
|
+
return tinycolor2_1.default.mix((0, tinycolor2_1.default)('white'), t, a * 100).toHexString();
|
|
530
|
+
};
|
|
531
|
+
let result = {};
|
|
532
|
+
if (style.backgroundColor != null) {
|
|
533
|
+
result.interior = {
|
|
534
|
+
color: getHexColor(style.backgroundColor),
|
|
535
|
+
pattern: 'Solid',
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
if (style.borderColor != null) {
|
|
539
|
+
const excelBorder = {
|
|
540
|
+
color: style.borderColor,
|
|
541
|
+
lineStyle: 'Continuous',
|
|
542
|
+
weight: 1,
|
|
543
|
+
};
|
|
544
|
+
result.borders = {
|
|
545
|
+
borderBottom: excelBorder,
|
|
546
|
+
borderLeft: excelBorder,
|
|
547
|
+
borderRight: excelBorder,
|
|
548
|
+
borderTop: excelBorder,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
if (style.textAlign) {
|
|
552
|
+
result.alignment = {
|
|
553
|
+
horizontal: StringExtensions_1.default.CapitaliseFirstLetter(style.textAlign),
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
if (style.color != null) {
|
|
557
|
+
if (!result.font) {
|
|
558
|
+
result.font = {};
|
|
559
|
+
}
|
|
560
|
+
result.font = {
|
|
561
|
+
color: getHexColor(style.color),
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
if (style.fontStyle === 'italic') {
|
|
565
|
+
if (!result.font) {
|
|
566
|
+
result.font = {};
|
|
567
|
+
}
|
|
568
|
+
result.font.italic = true;
|
|
569
|
+
}
|
|
570
|
+
if (style.fontWeight != null &&
|
|
571
|
+
(style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
|
|
572
|
+
if (!result.font) {
|
|
573
|
+
result.font = {};
|
|
574
|
+
}
|
|
575
|
+
result.font.bold = true;
|
|
576
|
+
}
|
|
577
|
+
if (style.fontSize != null) {
|
|
578
|
+
if (!result.font) {
|
|
579
|
+
result.font = {};
|
|
580
|
+
}
|
|
581
|
+
result.font.size = (0, StyleHelper_1.convertCSSAbsoluteFontSizeToPt)(style.fontSize);
|
|
582
|
+
}
|
|
583
|
+
return result;
|
|
584
|
+
}
|
|
585
|
+
resetExcelStyleMemoization() {
|
|
586
|
+
this.excelStylesCache = {};
|
|
587
|
+
this.cellClassKey2excelStyleIdMap = {};
|
|
588
|
+
this.excelStylesWithFormattedDate = {};
|
|
589
|
+
}
|
|
590
|
+
registerExcelStyle(excelStyle, cellClassKey) {
|
|
591
|
+
const excelStyleKey = JSON.stringify(excelStyle);
|
|
592
|
+
if (!this.excelStylesCache[excelStyleKey]) {
|
|
593
|
+
const excelStyleId = (0, uuid_1.createUuid)();
|
|
594
|
+
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
595
|
+
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
596
|
+
}
|
|
597
|
+
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
598
|
+
}
|
|
599
|
+
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
600
|
+
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
601
|
+
}
|
|
386
602
|
}
|
|
387
603
|
exports.ReportService = ReportService;
|
|
@@ -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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapColumnDataTypeToExpressionFunctionType = void 0;
|
|
4
|
+
const mapColumnDataTypeToExpressionFunctionType = (dataType) => {
|
|
5
|
+
if (dataType === 'Number') {
|
|
6
|
+
return 'number';
|
|
7
|
+
}
|
|
8
|
+
if (dataType === 'Boolean') {
|
|
9
|
+
return 'boolean';
|
|
10
|
+
}
|
|
11
|
+
if (dataType === 'String') {
|
|
12
|
+
return 'text';
|
|
13
|
+
}
|
|
14
|
+
if (dataType === 'Date') {
|
|
15
|
+
return 'date';
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.mapColumnDataTypeToExpressionFunctionType = mapColumnDataTypeToExpressionFunctionType;
|
|
@@ -33,7 +33,7 @@ const StatusBarPopup_1 = require("./StatusBar/StatusBarPopup");
|
|
|
33
33
|
const ChartingViewPanel_1 = require("./Charting/ChartingViewPanel");
|
|
34
34
|
const GridFilterPopup_1 = require("./GridFilter/GridFilterPopup");
|
|
35
35
|
const ColumnInfoPopup_1 = require("./ColumnInfo/ColumnInfoPopup");
|
|
36
|
-
const
|
|
36
|
+
const NotePopup_1 = require("./Note/NotePopup");
|
|
37
37
|
const CommentsPopup_1 = require("./Comments/CommentsPopup");
|
|
38
38
|
const DataImportPopup_1 = require("./DataImport/DataImportPopup");
|
|
39
39
|
exports.AdaptableViewFactory = {
|
|
@@ -50,7 +50,7 @@ exports.AdaptableViewFactory = {
|
|
|
50
50
|
ToolPanelPopup: ToolPanelPopup_1.ToolPanelPopup,
|
|
51
51
|
SystemStatusPopup: SystemStatusPopup_1.SystemStatusPopup,
|
|
52
52
|
DataChangeHistoryPopup: DataChangeHistoryPopup_1.DataChangeHistoryPopup,
|
|
53
|
-
|
|
53
|
+
NotePopup: NotePopup_1.NotePopup,
|
|
54
54
|
CommentsPopup: CommentsPopup_1.CommentsPopup,
|
|
55
55
|
DataImportPopup: DataImportPopup_1.DataImportPopup,
|
|
56
56
|
GridFilterPopup: GridFilterPopup_1.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;
|
|
@@ -40,7 +40,7 @@ const CalculatedColumnWizard = (props) => {
|
|
|
40
40
|
return (0, Helper_1.cloneObject)(calculatedColumn);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
return ObjectFactory_1.default.CreateEmptyCalculatedColumn();
|
|
43
|
+
return ObjectFactory_1.default.CreateEmptyCalculatedColumn(adaptable.api.gridApi.internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef());
|
|
44
44
|
});
|
|
45
45
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
46
46
|
const isEdit = Boolean(props.data) || ((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Edit';
|
|
@@ -89,7 +89,7 @@ const CommentsEditor = (props) => {
|
|
|
89
89
|
}
|
|
90
90
|
}, mt: 2, mb: "2", width: "100%", placeholder: "Write new comment" }),
|
|
91
91
|
React.createElement(SimpleButton_1.default, { width: "100%", variant: "raised", onClick: () => {
|
|
92
|
-
adaptable.api.settingsPanelApi.openSettingsPanel('
|
|
92
|
+
adaptable.api.settingsPanelApi.openSettingsPanel('Comment');
|
|
93
93
|
adaptable.api.internalApi.getCellPopupService().hidePopup();
|
|
94
94
|
} },
|
|
95
95
|
React.createElement(rebass_1.Box, { mr: 2 },
|
|
@@ -49,14 +49,18 @@ const CellComments = (props) => {
|
|
|
49
49
|
const columnFriendlyName = adaptable.api.columnApi.getFriendlyNameForColumnId(props.commentThread.ColumnId);
|
|
50
50
|
return (React.createElement(Panel_1.default, { mb: 2, header: React.createElement(rebass_1.Flex, { width: "100%", alignItems: "center" },
|
|
51
51
|
React.createElement(rebass_1.Box, { mr: 2 },
|
|
52
|
-
"Cell Value:
|
|
52
|
+
React.createElement("b", null, "Cell Value:"),
|
|
53
|
+
" ",
|
|
53
54
|
cellValue),
|
|
54
55
|
React.createElement(rebass_1.Box, { mr: 2 },
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
React.createElement("b", null,
|
|
57
|
+
primaryKeyHeader,
|
|
58
|
+
":"),
|
|
59
|
+
" ",
|
|
57
60
|
props.commentThread.PrimaryKeyValue),
|
|
58
61
|
React.createElement(rebass_1.Box, null,
|
|
59
|
-
"Column:
|
|
62
|
+
React.createElement("b", null, "Column:"),
|
|
63
|
+
" ",
|
|
60
64
|
columnFriendlyName),
|
|
61
65
|
React.createElement(rebass_1.Box, { flex: 1 }),
|
|
62
66
|
React.createElement(AdaptableButton_1.AdaptableButtonComponent, { mr: 1, variant: "text", icon: "visibility-on", onClick: () => {
|
|
@@ -145,7 +145,7 @@ const NewScopeComponent = (props) => {
|
|
|
145
145
|
}
|
|
146
146
|
const hasColumnTypes = React.useMemo(() => {
|
|
147
147
|
var _a;
|
|
148
|
-
return ((_a = api.
|
|
148
|
+
return ((_a = api.columnApi.getColumnTypes()) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
149
149
|
}, []);
|
|
150
150
|
return (React.createElement(Tabs_1.Tabs, { "data-name": 'scope-component', className: "ab-ScopeComponent", value: scopeChoice, style: Object.assign({ height: '100%' }, props.style), onValueChange: onScopeSelectChanged },
|
|
151
151
|
props.hideWholeRow ? null : (React.createElement(Tabs_1.Tabs.Tab, { value: "Row" },
|
|
@@ -171,7 +171,7 @@ const NewScopeComponent = (props) => {
|
|
|
171
171
|
React.createElement(rebass_1.Flex, { flexDirection: "column" }, dataTypeOptions.map((dataTypeOption) => (React.createElement(CheckBox_1.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))))))),
|
|
172
172
|
hasColumnTypes && (React.createElement(Tabs_1.Tabs.Content, { value: "ColumnType", style: { flex: 'none' }, "data-name": "column-type-scope" },
|
|
173
173
|
React.createElement(rebass_1.Box, null,
|
|
174
|
-
React.createElement(rebass_1.Flex, { flexDirection: "column" }, (_b = (_a = api.
|
|
174
|
+
React.createElement(rebass_1.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) => {
|
|
175
175
|
var _a;
|
|
176
176
|
return (React.createElement(CheckBox_1.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) => {
|
|
177
177
|
let columnTypes = [].concat(props.scope.ColumnTypes);
|
|
@@ -5,15 +5,15 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const react_redux_1 = require("react-redux");
|
|
7
7
|
const rebass_1 = require("rebass");
|
|
8
|
-
const
|
|
8
|
+
const NoteRedux_1 = require("../../../../Redux/ActionsReducers/NoteRedux");
|
|
9
9
|
const SystemRedux_1 = require("../../../../Redux/ActionsReducers/SystemRedux");
|
|
10
10
|
const AdaptableContext_1 = require("../../../AdaptableContext");
|
|
11
11
|
const CommentsEditor_1 = require("../../../Comments/CommentsEditor");
|
|
12
|
-
const NoteEditor_1 = require("../../../
|
|
12
|
+
const NoteEditor_1 = require("../../../Note/NoteEditor");
|
|
13
13
|
const CellPopup_1 = require("../../CellPopup");
|
|
14
14
|
const ConnectedNoteEditor = ({ enableEditMode }) => {
|
|
15
15
|
const { api } = (0, AdaptableContext_1.useAdaptable)();
|
|
16
|
-
const isReadonly = api.entitlementApi.isModuleReadOnlyEntitlement('
|
|
16
|
+
const isReadonly = api.entitlementApi.isModuleReadOnlyEntitlement('Note');
|
|
17
17
|
const editMode = (0, react_redux_1.useSelector)((state) => (0, SystemRedux_1.SystemCommentsAndNotesEditModeSelector)(state.System));
|
|
18
18
|
const cellPopupService = api.internalApi.getCellPopupService();
|
|
19
19
|
const cellAddress = (0, react_redux_1.useSelector)((state) => (0, SystemRedux_1.SystemCommentsAndNotesSelector)(state.System));
|
|
@@ -21,12 +21,12 @@ const ConnectedNoteEditor = ({ enableEditMode }) => {
|
|
|
21
21
|
// Only handle first note for now
|
|
22
22
|
// Later we can handle multiple notes
|
|
23
23
|
note,] = (0, react_redux_1.useSelector)((state) => {
|
|
24
|
-
return cellAddress ? (0,
|
|
24
|
+
return cellAddress ? (0, NoteRedux_1.GetNotesSelector)(state.Note, cellAddress) : [];
|
|
25
25
|
});
|
|
26
26
|
const handleNoteChange = React.useCallback((value) => {
|
|
27
|
-
api.
|
|
27
|
+
api.noteApi.updateNoteText(value, note);
|
|
28
28
|
}, [note]);
|
|
29
|
-
return (React.createElement(rebass_1.Flex, { onClick: () => enableEditMode(), flexDirection: "column", className: "ab-
|
|
29
|
+
return (React.createElement(rebass_1.Flex, { onClick: () => enableEditMode(), flexDirection: "column", className: "ab-NotePopup" },
|
|
30
30
|
React.createElement(NoteEditor_1.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) })));
|
|
31
31
|
};
|
|
32
32
|
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 {
|
|
@@ -115,7 +115,7 @@ function ValueSelector(props) {
|
|
|
115
115
|
};
|
|
116
116
|
const showOnlySelectedCheckbox = (React.createElement(CheckBox_1.CheckBox, { disabled: !value.length, checked: selectedOnly, onChange: setSelectedOnly }, showSelectedOnlyLabel !== null && showSelectedOnlyLabel !== void 0 ? showSelectedOnlyLabel : 'Show Selected Only'));
|
|
117
117
|
const showSelectedOnlyPosition = (_a = props.showSelectedOnlyPosition) !== null && _a !== void 0 ? _a : 'floating';
|
|
118
|
-
return (React.createElement(rebass_1.Flex, { className: baseClassName, flexDirection: "column", flex: 1 },
|
|
118
|
+
return (React.createElement(rebass_1.Flex, { style: props.style, className: baseClassName, flexDirection: "column", flex: 1 },
|
|
119
119
|
React.createElement(rebass_1.Flex, { mb: 1 },
|
|
120
120
|
showFilterInput && filter ? (React.createElement(AdaptableFormControlTextClear_1.AdaptableFormControlTextClear, { value: searchInputValue, OnTextChange: setSearchInputValue, placeholder: "Type to search", style: { flex: 1, border: 0, margin: 3 } })) : (React.createElement(rebass_1.Box, { flex: 1 })),
|
|
121
121
|
showSelectedOnlyPosition === 'top' && React.createElement(rebass_1.Box, { ml: 20 }, showOnlySelectedCheckbox)),
|
|
@@ -49,7 +49,7 @@ class FreeTextColumnSummaryComponent extends React.Component {
|
|
|
49
49
|
this.state.editedAdaptableObject && (React.createElement(FreeTextColumnWizard_1.FreeTextColumnWizard, { moduleInfo: this.props.moduleInfo, data: this.state.editedAdaptableObject, configEntities: this.props.FreeTextColumns, onCloseWizard: () => this.onCloseWizard(), onFinishWizard: this.onFinishWizard }))));
|
|
50
50
|
}
|
|
51
51
|
onNew() {
|
|
52
|
-
let configEntity = ObjectFactory_1.ObjectFactory.CreateEmptyFreeTextColumn();
|
|
52
|
+
let configEntity = ObjectFactory_1.ObjectFactory.CreateEmptyFreeTextColumn(this.props.api.gridApi.internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef());
|
|
53
53
|
configEntity.ColumnId = this.props.summarisedColumn.columnId;
|
|
54
54
|
this.setState({
|
|
55
55
|
editedAdaptableObject: configEntity,
|
|
@@ -12,8 +12,10 @@ const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/Obje
|
|
|
12
12
|
const FreeTextColumnRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/FreeTextColumnRedux"));
|
|
13
13
|
const react_redux_1 = require("react-redux");
|
|
14
14
|
const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
|
|
15
|
+
const AdaptableContext_1 = require("../../AdaptableContext");
|
|
15
16
|
const FreeTextColumnWizard = (props) => {
|
|
16
17
|
var _a;
|
|
18
|
+
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
17
19
|
const allFreeTextColumns = (0, react_redux_1.useSelector)((state) => state.FreeTextColumn.FreeTextColumns);
|
|
18
20
|
const [freeTextColumn, setFreeTextColumn] = (0, react_1.useState)(() => {
|
|
19
21
|
var _a, _b;
|
|
@@ -23,7 +25,7 @@ const FreeTextColumnWizard = (props) => {
|
|
|
23
25
|
if (((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Edit' && ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.column)) {
|
|
24
26
|
return allFreeTextColumns.find((column) => column.ColumnId === props.popupParams.column.columnId);
|
|
25
27
|
}
|
|
26
|
-
return ObjectFactory_1.default.CreateEmptyFreeTextColumn();
|
|
28
|
+
return ObjectFactory_1.default.CreateEmptyFreeTextColumn(adaptable.api.gridApi.internalApi.deriveSpecialColumnSettingsFromAgGridDefaultColDef());
|
|
27
29
|
});
|
|
28
30
|
const dispatch = (0, react_redux_1.useDispatch)();
|
|
29
31
|
const isEdit = props.data || ((_a = props.popupParams) === null || _a === void 0 ? void 0 : _a.action) === 'Edit';
|
|
@@ -29,8 +29,9 @@ class LayoutViewPanelComponent extends React.Component {
|
|
|
29
29
|
return Object.assign(Object.assign({}, layout), { label: layout.Name, value: layout.Name, onClick: () => this.props.onSelectLayout(layout.Name) });
|
|
30
30
|
});
|
|
31
31
|
const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
|
|
32
|
+
let layoutSelectStyle = elementType === 'ToolPanel' ? { minWidth: '100%' } : {};
|
|
32
33
|
return (React.createElement(rebass_1.Flex, { flexDirection: "row", className: `ab-${elementType}__Layout__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
|
|
33
|
-
React.createElement(rebass_1.Flex, { flex: 1 },
|
|
34
|
+
React.createElement(rebass_1.Flex, { style: layoutSelectStyle, flex: 1 },
|
|
34
35
|
React.createElement(Select_1.Select, { style: { width: '100%' }, options: availableLayoutOptions, className: `ab-${elementType}__Layout__select`, value: layoutEntity ? layoutEntity.Name : null, onChange: (layout) => this.props.onSelectLayout(layout) })),
|
|
35
36
|
React.createElement(rebass_1.Flex, { flexDirection: "row", className: (0, join_1.default)(this.props.accessLevel == 'ReadOnly' ? GeneralConstants.READ_ONLY_STYLE : '', `ab-${elementType}__Layout__wrap`) },
|
|
36
37
|
isManualSaveLayout && (React.createElement(ButtonSave_1.ButtonSave, { className: `ab-${elementType}__Layout__save`, onClick: () => this.onSaveLayout(), tooltip: "Save Changes to Current Layout", disabled: !this.props.CanSave, accessLevel: accessLevel })),
|
|
@@ -11,21 +11,21 @@ const ColumnSelector_1 = require("../Components/Selectors/ColumnSelector");
|
|
|
11
11
|
const AdaptableAgGrid_1 = require("../../agGrid/AdaptableAgGrid");
|
|
12
12
|
const TransposedPopup = (props) => {
|
|
13
13
|
const adaptable = (0, AdaptableContext_1.useAdaptable)();
|
|
14
|
+
const { transposedColumnId, hideTransposedColumn, visibleColumns, visibleRows } = props.popupProps;
|
|
14
15
|
const rowNodes = React.useMemo(() => {
|
|
15
|
-
return
|
|
16
|
+
return props.popupProps.visibleRows
|
|
17
|
+
? adaptable.api.gridApi.getVisibleRowNodes()
|
|
18
|
+
: adaptable.api.gridApi.getAllRowNodes();
|
|
16
19
|
}, [
|
|
17
|
-
// can be later triggered by
|
|
20
|
+
// can be later triggered by tickng data
|
|
18
21
|
]);
|
|
19
|
-
const { transposedColumnId, hideTransposedColumn = true } = props.popupProps;
|
|
20
22
|
const primaryKey = adaptable.api.optionsApi.getPrimaryKey();
|
|
21
|
-
|
|
22
|
-
const transposeByColumnId = primaryKey;
|
|
23
|
-
// Only used to show nice values a the top of the grid, istead on the value
|
|
24
|
-
// of the primarykey
|
|
25
|
-
const [synteticTransposedByColumnId, setSynteticTransposedByColumnId] = React.useState(transposedColumnId !== null && transposedColumnId !== void 0 ? transposedColumnId : primaryKey);
|
|
23
|
+
const [syntheticTransposedByColumnId, setSyntheticTransposedByColumnId] = React.useState(transposedColumnId);
|
|
26
24
|
const columns = React.useMemo(() => {
|
|
27
25
|
// customisable
|
|
28
|
-
return
|
|
26
|
+
return visibleColumns
|
|
27
|
+
? adaptable.api.columnApi.getVisibleColumns()
|
|
28
|
+
: adaptable.api.columnApi.getColumns();
|
|
29
29
|
}, []);
|
|
30
30
|
const adaptableContainerId = 'transposed-adaptable-container';
|
|
31
31
|
const agGridContainerId = 'transposed-adaptable-ag-grid-container';
|
|
@@ -44,9 +44,10 @@ const TransposedPopup = (props) => {
|
|
|
44
44
|
for (const row of rowNodes) {
|
|
45
45
|
// we force the col-ids to be strings, easer to work with
|
|
46
46
|
//row[transposeByColumnId] + '';
|
|
47
|
-
const colId = adaptable.api.gridApi.getNormalisedValueFromRowNode(row,
|
|
47
|
+
const colId = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, primaryKey) + '';
|
|
48
48
|
//row[synteticTransposedByColumnId] + '';
|
|
49
|
-
const header = adaptable.api.gridApi.getNormalisedValueFromRowNode(row,
|
|
49
|
+
const header = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, syntheticTransposedByColumnId) +
|
|
50
|
+
'';
|
|
50
51
|
transposedColumns.push({
|
|
51
52
|
colId,
|
|
52
53
|
header,
|
|
@@ -56,7 +57,7 @@ const TransposedPopup = (props) => {
|
|
|
56
57
|
/**
|
|
57
58
|
* We can hide the transposed column, if we want
|
|
58
59
|
*/
|
|
59
|
-
if (hideTransposedColumn && column.columnId ===
|
|
60
|
+
if (hideTransposedColumn && column.columnId === syntheticTransposedByColumnId) {
|
|
60
61
|
continue;
|
|
61
62
|
}
|
|
62
63
|
const transposedRow = {
|
|
@@ -67,7 +68,7 @@ const TransposedPopup = (props) => {
|
|
|
67
68
|
};
|
|
68
69
|
for (let row of rowNodes) {
|
|
69
70
|
// [transposed-by-column-value[n]]: [other column value[n]]
|
|
70
|
-
const key = adaptable.api.gridApi.getNormalisedValueFromRowNode(row,
|
|
71
|
+
const key = adaptable.api.gridApi.getNormalisedValueFromRowNode(row, primaryKey);
|
|
71
72
|
// row[column.field]
|
|
72
73
|
let value = adaptable.api.gridApi.getDisplayValueFromRowNode(row, column.columnId);
|
|
73
74
|
if (value instanceof Date) {
|
|
@@ -81,7 +82,7 @@ const TransposedPopup = (props) => {
|
|
|
81
82
|
transposedColumns,
|
|
82
83
|
transposedRows,
|
|
83
84
|
};
|
|
84
|
-
}, [rowNodes, primaryKey,
|
|
85
|
+
}, [rowNodes, primaryKey, syntheticTransposedByColumnId]);
|
|
85
86
|
React.useEffect(() => {
|
|
86
87
|
// Mounting in an effect, so the nodes are rendered/available
|
|
87
88
|
const hostAdaptableOptions = adaptable.adaptableOptions;
|
|
@@ -125,7 +126,7 @@ const TransposedPopup = (props) => {
|
|
|
125
126
|
};
|
|
126
127
|
const firstColumn = {
|
|
127
128
|
field: transposedFirstColumnHeader,
|
|
128
|
-
headerName: adaptable.api.columnApi.getFriendlyNameForColumnId(
|
|
129
|
+
headerName: adaptable.api.columnApi.getFriendlyNameForColumnId(syntheticTransposedByColumnId),
|
|
129
130
|
};
|
|
130
131
|
const agGridOptions = {
|
|
131
132
|
suppressLoadingOverlay: true,
|
|
@@ -177,7 +178,7 @@ const TransposedPopup = (props) => {
|
|
|
177
178
|
transposedAdaptableApi.destroy();
|
|
178
179
|
}
|
|
179
180
|
};
|
|
180
|
-
}, [
|
|
181
|
+
}, [syntheticTransposedByColumnId]);
|
|
181
182
|
/**
|
|
182
183
|
* Need to get all data, manualy pivot the grid using the primary key.
|
|
183
184
|
*
|
|
@@ -189,8 +190,8 @@ const TransposedPopup = (props) => {
|
|
|
189
190
|
React.createElement(Panel_1.default, null,
|
|
190
191
|
React.createElement(FormLayout_1.default, null,
|
|
191
192
|
React.createElement(FormLayout_1.FormRow, { label: "Elevated Column" },
|
|
192
|
-
React.createElement(ColumnSelector_1.ColumnSelector, { value:
|
|
193
|
-
|
|
193
|
+
React.createElement(ColumnSelector_1.ColumnSelector, { value: syntheticTransposedByColumnId, onChange: (colId) => {
|
|
194
|
+
setSyntheticTransposedByColumnId(colId);
|
|
194
195
|
} })))),
|
|
195
196
|
React.createElement(rebass_1.Flex, { height: "100%" },
|
|
196
197
|
React.createElement(rebass_1.Box, { id: "transposed-adaptable-container" }),
|