@adaptabletools/adaptable 18.1.14 → 19.0.0-canary.0
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 +2 -2
- package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -5
- package/src/AdaptableOptions/AlertOptions.d.ts +2 -1
- package/src/AdaptableOptions/ChartingOptions.d.ts +5 -1
- package/src/AdaptableOptions/ColumnFilterOptions.d.ts +5 -1
- package/src/AdaptableOptions/DashboardOptions.d.ts +5 -1
- package/src/AdaptableOptions/FlashingCellOptions.d.ts +5 -1
- package/src/AdaptableOptions/LayoutOptions.d.ts +5 -1
- package/src/AdaptableOptions/NotificationsOptions.d.ts +6 -2
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +5 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -1
- package/src/Api/ChartingApi.d.ts +2 -2
- package/src/Api/ColumnApi.d.ts +6 -0
- package/src/Api/ConfigApi.d.ts +22 -2
- package/src/Api/Events/LiveDataChanged.d.ts +1 -1
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -1
- package/src/Api/Implementation/ChartingApiImpl.d.ts +1 -1
- package/src/Api/Implementation/ChartingApiImpl.js +2 -2
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
- package/src/Api/Implementation/ColumnApiImpl.js +3 -0
- package/src/Api/Implementation/ConfigApiImpl.d.ts +4 -1
- package/src/Api/Implementation/ConfigApiImpl.js +16 -1
- package/src/Api/Implementation/EntitlementApiImpl.d.ts +4 -1
- package/src/Api/Implementation/EntitlementApiImpl.js +31 -6
- package/src/Api/Implementation/ExportApiImpl.js +5 -7
- package/src/Api/Implementation/GridApiImpl.js +1 -1
- package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -0
- package/src/Api/Implementation/LayoutApiImpl.js +61 -0
- package/src/Api/Implementation/TeamSharingApiImpl.js +2 -6
- package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -6
- package/src/Api/Internal/AdaptableInternalApi.js +5 -11
- package/src/Api/Internal/EntitlementInternalApi.d.ts +4 -0
- package/src/Api/Internal/EntitlementInternalApi.js +11 -0
- package/src/Api/Internal/ExportInternalApi.d.ts +33 -8
- package/src/Api/Internal/ExportInternalApi.js +576 -5
- package/src/Api/Internal/NamedQueryInternalApi.d.ts +0 -1
- package/src/Api/Internal/NamedQueryInternalApi.js +0 -4
- package/src/Api/LayoutApi.d.ts +7 -0
- package/src/PredefinedConfig/AdaptableState.d.ts +0 -5
- package/src/PredefinedConfig/Common/ExtendedLayoutInfo.d.ts +12 -0
- package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +2 -1
- package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
- package/src/Redux/ActionsReducers/GridRedux.d.ts +6 -6
- package/src/Redux/ActionsReducers/GridRedux.js +8 -8
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
- package/src/Redux/ActionsReducers/LayoutRedux.js +9 -9
- package/src/Redux/ActionsReducers/NamedQueryRedux.d.ts +1 -1
- package/src/Redux/ActionsReducers/NamedQueryRedux.js +1 -1
- package/src/Redux/ActionsReducers/PluginsRedux.d.ts +2 -2
- package/src/Redux/ActionsReducers/PluginsRedux.js +2 -2
- package/src/Redux/Store/AdaptableReduxMerger.js +3 -3
- package/src/Redux/Store/AdaptableStore.js +2 -4
- package/src/Strategy/AdaptableModuleBase.js +1 -2
- package/src/Strategy/ColumnFilterModule.js +1 -2
- package/src/Strategy/ExportModule.js +17 -44
- package/src/Strategy/FlashingCellModule.js +2 -10
- package/src/Strategy/ScheduleModule.js +4 -6
- package/src/Strategy/SmartEditModule.js +1 -7
- package/src/Strategy/TeamSharingModule.js +2 -2
- package/src/Strategy/Utilities/Export/getExportColumnsViewItems.js +1 -1
- package/src/Strategy/Utilities/Export/getExportRowsViewItems.js +1 -3
- package/src/Utilities/Constants/FilterConstants.d.ts +10 -0
- package/src/Utilities/Constants/FilterConstants.js +8 -0
- package/src/Utilities/Constants/GeneralConstants.d.ts +41 -4
- package/src/Utilities/Constants/GeneralConstants.js +42 -3
- package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +0 -2
- package/src/Utilities/Defaults/DefaultSettingsPanel.js +0 -5
- package/src/Utilities/Extensions/ArrayExtensions.d.ts +14 -0
- package/src/Utilities/Extensions/ArrayExtensions.js +65 -0
- package/src/Utilities/Extensions/EnumExtensions.d.ts +0 -4
- package/src/Utilities/Extensions/EnumExtensions.js +2 -12
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +4 -10
- package/src/Utilities/Helpers/AdaptableHelper.js +7 -59
- package/src/Utilities/Helpers/FormatHelper.d.ts +9 -0
- package/src/Utilities/Helpers/FormatHelper.js +26 -14
- package/src/Utilities/Helpers/Helper.d.ts +0 -10
- package/src/Utilities/Helpers/Helper.js +0 -70
- package/src/Utilities/Services/ChartingService.d.ts +2 -2
- package/src/Utilities/Services/ChartingService.js +5 -11
- package/src/Utilities/Services/ModuleService.js +35 -31
- package/src/Utilities/Services/RowEditService.js +1 -6
- package/src/Utilities/Services/RowSummaryService.js +2 -2
- package/src/Utilities/Services/ValidationService.js +2 -16
- package/src/View/Alert/AlertEmptyView.js +1 -2
- package/src/View/Charting/ChartingStatusBarPopover.js +1 -2
- package/src/View/Charting/useChartingElements.js +1 -1
- package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +2 -6
- package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +2 -4
- package/src/View/Components/FilterForm/QuickFilterForm.js +2 -12
- package/src/View/Components/ModuleValueSelector/index.js +2 -2
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -5
- package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +1 -3
- package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +2 -1
- package/src/View/Components/Popups/AdaptablePopupAlert.js +1 -7
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +6 -12
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +3 -23
- package/src/View/Components/ToolPanel/ToolPanelPopup.js +4 -5
- package/src/View/Components/ToolPanel/ToolPanelWrapper.js +1 -3
- package/src/View/Components/ValueSelector/index.js +2 -2
- package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +2 -2
- package/src/View/Dashboard/CustomDashboardButton.js +1 -6
- package/src/View/Dashboard/CustomToolbar.js +2 -9
- package/src/View/Dashboard/Dashboard.js +2 -4
- package/src/View/Dashboard/DashboardPopup.js +1 -3
- package/src/View/Dashboard/DashboardToolbarFactory.js +1 -2
- package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -2
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -3
- package/src/View/Export/ExportViewPanel.js +2 -4
- package/src/View/Export/Wizard/ReportSummaryWizard.js +2 -6
- package/src/View/GridFilter/GridFilterExpressionEditor.js +2 -2
- package/src/View/GridFilter/useGridFilterExpressionEditor.js +2 -6
- package/src/View/Layout/LayoutViewPanel.js +1 -1
- package/src/View/Layout/PivotDetailsPopoup.js +1 -7
- package/src/View/Layout/SaveLayoutButton.js +1 -3
- package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -2
- package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +2 -2
- package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
- package/src/View/Layout/Wizard/sections/RowSummarySection.js +2 -2
- package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
- package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +3 -3
- package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
- package/src/View/SystemStatus/SystemStatusPopup.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +2 -2
- package/src/agGrid/ActionColumnRenderer.js +8 -22
- package/src/agGrid/AdaptableAgGrid.d.ts +6 -7
- package/src/agGrid/AdaptableAgGrid.js +165 -146
- package/src/agGrid/AgGridAdapter.d.ts +0 -1
- package/src/agGrid/AgGridAdapter.js +8 -11
- package/src/agGrid/AgGridColumnAdapter.d.ts +3 -1
- package/src/agGrid/AgGridColumnAdapter.js +40 -14
- package/src/agGrid/BadgeRenderer.js +4 -22
- package/src/agGrid/FloatingFilterWrapper.js +21 -0
- package/src/agGrid/buildSortedColumnStateForLayout.d.ts +1 -1
- package/src/agGrid/buildSortedColumnStateForLayout.js +2 -2
- package/src/agGrid/defaultAdaptableOptions.js +35 -30
- package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +3 -15
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +89 -8
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +10 -9
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/Redux/ActionsReducers/QueryRedux.d.ts +0 -10
- package/src/Redux/ActionsReducers/QueryRedux.js +0 -20
- package/src/Utilities/Helpers/FormatContentHelper.d.ts +0 -22
- package/src/Utilities/Helpers/FormatContentHelper.js +0 -34
- package/src/Utilities/Services/EntitlementService.d.ts +0 -14
- package/src/Utilities/Services/EntitlementService.js +0 -63
- package/src/Utilities/Services/Interface/IEntitlementService.d.ts +0 -10
- package/src/Utilities/Services/Interface/IReportService.d.ts +0 -27
- package/src/Utilities/Services/Interface/IReportService.js +0 -1
- package/src/Utilities/Services/ReportService.d.ts +0 -41
- package/src/Utilities/Services/ReportService.js +0 -603
- package/src/Utilities/isAdaptableObject.d.ts +0 -2
- package/src/Utilities/isAdaptableObject.js +0 -4
- package/src/Utilities/reorder.d.ts +0 -1
- package/src/Utilities/reorder.js +0 -13
- package/src/Utilities/sortWithOrder.d.ts +0 -11
- package/src/Utilities/sortWithOrder.js +0 -50
- /package/src/{Utilities/Services/Interface/IEntitlementService.js → PredefinedConfig/Common/ExtendedLayoutInfo.js} +0 -0
|
@@ -1,603 +0,0 @@
|
|
|
1
|
-
import groupBy from 'lodash/groupBy';
|
|
2
|
-
import { ExportDestination } from '../../PredefinedConfig/Common/Enums';
|
|
3
|
-
import { ALL_DATA_REPORT, CURRENT_DATA_REPORT, SELECTED_CELLS_REPORT, SELECTED_ROWS_REPORT, VISUAL_DATA_REPORT, } from '../Constants/GeneralConstants';
|
|
4
|
-
import ArrayExtensions from '../Extensions/ArrayExtensions';
|
|
5
|
-
import FormatHelper, { DateFormatter } from '../Helpers/FormatHelper';
|
|
6
|
-
import StringExtensions from '../Extensions/StringExtensions';
|
|
7
|
-
import { ExportModuleId } from '../Constants/ModuleConstants';
|
|
8
|
-
import { createUuid } from '../../components/utils/uuid';
|
|
9
|
-
import { createBaseContext } from '../ObjectFactory';
|
|
10
|
-
import { convertCSSAbsoluteFontSizeToPt, getVariableColor, sanitizeStyle, } from '../Helpers/StyleHelper';
|
|
11
|
-
import tinycolor from 'tinycolor2';
|
|
12
|
-
export class ReportService {
|
|
13
|
-
constructor(adaptableApi) {
|
|
14
|
-
this.adaptableApi = adaptableApi;
|
|
15
|
-
this.excelStylesCache = {};
|
|
16
|
-
this.cellClassKey2excelStyleIdMap = {};
|
|
17
|
-
this.excelStylesWithFormattedDate = {};
|
|
18
|
-
this.adaptableApi = adaptableApi;
|
|
19
|
-
}
|
|
20
|
-
destroy() {
|
|
21
|
-
// TO DO
|
|
22
|
-
}
|
|
23
|
-
getExcelStyleIdForCellClassKey(cellClassKey) {
|
|
24
|
-
return this.cellClassKey2excelStyleIdMap[cellClassKey];
|
|
25
|
-
}
|
|
26
|
-
getExcelStyleWithFormattedDate(cellClassId) {
|
|
27
|
-
return this.excelStylesWithFormattedDate[cellClassId];
|
|
28
|
-
}
|
|
29
|
-
CreateSystemReport(systemReportName) {
|
|
30
|
-
switch (systemReportName) {
|
|
31
|
-
case VISUAL_DATA_REPORT:
|
|
32
|
-
return {
|
|
33
|
-
Uuid: createUuid(),
|
|
34
|
-
Name: VISUAL_DATA_REPORT,
|
|
35
|
-
ReportColumnScope: 'VisibleColumns',
|
|
36
|
-
ReportRowScope: 'VisibleRows',
|
|
37
|
-
Query: undefined,
|
|
38
|
-
IsReadOnly: true,
|
|
39
|
-
};
|
|
40
|
-
case ALL_DATA_REPORT:
|
|
41
|
-
return {
|
|
42
|
-
Uuid: createUuid(),
|
|
43
|
-
Name: ALL_DATA_REPORT,
|
|
44
|
-
ReportColumnScope: 'AllColumns',
|
|
45
|
-
ReportRowScope: 'AllRows',
|
|
46
|
-
Query: undefined,
|
|
47
|
-
IsReadOnly: true,
|
|
48
|
-
};
|
|
49
|
-
case CURRENT_DATA_REPORT:
|
|
50
|
-
return {
|
|
51
|
-
Uuid: createUuid(),
|
|
52
|
-
Name: CURRENT_DATA_REPORT,
|
|
53
|
-
ReportColumnScope: 'VisibleColumns',
|
|
54
|
-
ReportRowScope: 'VisibleRows',
|
|
55
|
-
Query: undefined,
|
|
56
|
-
IsReadOnly: true,
|
|
57
|
-
};
|
|
58
|
-
case SELECTED_CELLS_REPORT:
|
|
59
|
-
return {
|
|
60
|
-
Uuid: createUuid(),
|
|
61
|
-
Name: SELECTED_CELLS_REPORT,
|
|
62
|
-
ReportColumnScope: 'SelectedColumns',
|
|
63
|
-
ReportRowScope: 'SelectedCellRows',
|
|
64
|
-
Query: undefined,
|
|
65
|
-
IsReadOnly: true,
|
|
66
|
-
};
|
|
67
|
-
case SELECTED_ROWS_REPORT:
|
|
68
|
-
return {
|
|
69
|
-
Uuid: createUuid(),
|
|
70
|
-
Name: SELECTED_ROWS_REPORT,
|
|
71
|
-
ReportColumnScope: 'VisibleColumns',
|
|
72
|
-
ReportRowScope: 'SelectedRows',
|
|
73
|
-
Query: undefined,
|
|
74
|
-
IsReadOnly: true,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
IsSystemReport(reportName) {
|
|
79
|
-
return (reportName == null ||
|
|
80
|
-
reportName == ALL_DATA_REPORT ||
|
|
81
|
-
reportName == CURRENT_DATA_REPORT ||
|
|
82
|
-
reportName == SELECTED_CELLS_REPORT ||
|
|
83
|
-
reportName == SELECTED_ROWS_REPORT ||
|
|
84
|
-
reportName == VISUAL_DATA_REPORT);
|
|
85
|
-
}
|
|
86
|
-
IsSystemReportActive(reportName) {
|
|
87
|
-
if (reportName == SELECTED_CELLS_REPORT) {
|
|
88
|
-
return this.adaptableApi.gridApi.isGridRangeSelectable();
|
|
89
|
-
}
|
|
90
|
-
if (reportName == SELECTED_ROWS_REPORT) {
|
|
91
|
-
return this.adaptableApi.gridApi.isGridRowSelectable();
|
|
92
|
-
}
|
|
93
|
-
if (reportName === VISUAL_DATA_REPORT) {
|
|
94
|
-
return this.adaptableApi.exportApi
|
|
95
|
-
.getAvailableExportDestinations()
|
|
96
|
-
.includes(ExportDestination.Excel);
|
|
97
|
-
}
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
IsSystemExportDestinationActive(exportDestination) {
|
|
101
|
-
if (exportDestination === ExportDestination.Excel) {
|
|
102
|
-
return this.adaptableApi.exportApi.canExportToExcel();
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
GetReportColumnScopeShortDescription(report) {
|
|
107
|
-
var _a, _b;
|
|
108
|
-
if (this.adaptableApi.exportApi.isExternalReport(report)) {
|
|
109
|
-
return ['[Custom Columns]'];
|
|
110
|
-
}
|
|
111
|
-
switch (report.ReportColumnScope) {
|
|
112
|
-
case 'AllColumns':
|
|
113
|
-
return ['[All Columns]'];
|
|
114
|
-
case 'VisibleColumns':
|
|
115
|
-
return ['[Visible Columns]'];
|
|
116
|
-
case 'SelectedColumns':
|
|
117
|
-
return ['[Selected Columns]'];
|
|
118
|
-
case 'ScopeColumns':
|
|
119
|
-
if ('ColumnIds' in (report === null || report === void 0 ? void 0 : report.Scope)) {
|
|
120
|
-
return (_b = (_a = report.Scope.ColumnIds).map) === null || _b === void 0 ? void 0 : _b.call(_a, (columnId) => { var _a; return (_a = this.adaptableApi.columnApi.getFriendlyNameForColumnId(columnId)) !== null && _a !== void 0 ? _a : columnId; });
|
|
121
|
-
}
|
|
122
|
-
return ['[Bespoke Columns]'];
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
GetReportColumnScopeLongDescription(report) {
|
|
126
|
-
if (this.adaptableApi.exportApi.isExternalReport(report)) {
|
|
127
|
-
return '[Custom Columns]';
|
|
128
|
-
}
|
|
129
|
-
switch (report.ReportColumnScope) {
|
|
130
|
-
case 'AllColumns':
|
|
131
|
-
return '[All Columns]';
|
|
132
|
-
case 'VisibleColumns':
|
|
133
|
-
return '[Visible Columns]';
|
|
134
|
-
case 'SelectedColumns':
|
|
135
|
-
return '[Selected Columns]';
|
|
136
|
-
case 'ScopeColumns':
|
|
137
|
-
return this.adaptableApi.columnScopeApi.getScopeDescription(report.Scope);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
GetReportExpressionDescription(report, cols) {
|
|
141
|
-
if (this.adaptableApi.exportApi.isExternalReport(report)) {
|
|
142
|
-
return '[Custom Data]';
|
|
143
|
-
}
|
|
144
|
-
if (this.IsSystemReport(report.Name)) {
|
|
145
|
-
if (report.Name == ALL_DATA_REPORT) {
|
|
146
|
-
return '[All Data]';
|
|
147
|
-
}
|
|
148
|
-
else if (report.Name == CURRENT_DATA_REPORT) {
|
|
149
|
-
return '[All Current Data]';
|
|
150
|
-
}
|
|
151
|
-
else if (report.Name == SELECTED_CELLS_REPORT) {
|
|
152
|
-
return '[Selected Cells Data]';
|
|
153
|
-
}
|
|
154
|
-
else if (report.Name == SELECTED_ROWS_REPORT) {
|
|
155
|
-
return '[Selected Rows Data]';
|
|
156
|
-
}
|
|
157
|
-
else if (report.Name == VISUAL_DATA_REPORT) {
|
|
158
|
-
return '[Current Data as WYSIWYG]';
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
switch (report.ReportRowScope) {
|
|
163
|
-
case 'AllRows':
|
|
164
|
-
return '[All Rows]';
|
|
165
|
-
case 'VisibleRows':
|
|
166
|
-
return '[Visible Rows]';
|
|
167
|
-
case 'SelectedRows':
|
|
168
|
-
return '[Selected Rows]';
|
|
169
|
-
case 'ExpressionRows':
|
|
170
|
-
return this.adaptableApi.internalApi.getAdaptableQueryExpressionText(report.Query);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
getReportDataColumns(report, includePrimaryKey = false) {
|
|
175
|
-
let reportColumns = [];
|
|
176
|
-
let gridColumns = this.adaptableApi.columnApi.getExportableColumns();
|
|
177
|
-
if (this.adaptableApi.exportApi.isExternalReport(report)) {
|
|
178
|
-
return reportColumns;
|
|
179
|
-
}
|
|
180
|
-
// first get the cols depending on the Column Scope
|
|
181
|
-
switch (report.ReportColumnScope) {
|
|
182
|
-
case 'AllColumns':
|
|
183
|
-
reportColumns = gridColumns;
|
|
184
|
-
break;
|
|
185
|
-
case 'VisibleColumns':
|
|
186
|
-
reportColumns = gridColumns.filter((c) => c.visible);
|
|
187
|
-
break;
|
|
188
|
-
case 'SelectedColumns':
|
|
189
|
-
// we extract the selected columns from the grid columns to preserve the grid column order
|
|
190
|
-
const selectedColumnIds = this.adaptableApi.gridApi
|
|
191
|
-
.getSelectedCellInfo()
|
|
192
|
-
.columns.map((column) => column.columnId);
|
|
193
|
-
reportColumns = gridColumns.filter((gridColumn) => selectedColumnIds.includes(gridColumn.columnId));
|
|
194
|
-
break;
|
|
195
|
-
case 'ScopeColumns':
|
|
196
|
-
if ('ColumnIds' in report.Scope) {
|
|
197
|
-
reportColumns = report.Scope.ColumnIds.map((columnId) => this.adaptableApi.columnApi.getColumnWithColumnId(columnId)).filter((c) => c);
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
reportColumns = this.adaptableApi.columnScopeApi.getColumnsForScope(report.Scope);
|
|
201
|
-
}
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
if (includePrimaryKey) {
|
|
205
|
-
const pkColumn = reportColumns.find((column) => column.columnId === this.adaptableApi.optionsApi.getPrimaryKey());
|
|
206
|
-
// TODO simplify after we fix the IsPrimaryKey bug
|
|
207
|
-
// const pkColumn = reportColumns.find(column => column.IsPrimaryKey);
|
|
208
|
-
if (!pkColumn && !!this.adaptableApi.columnApi.getPrimaryKeyColumn()) {
|
|
209
|
-
reportColumns.push(this.adaptableApi.columnApi.getPrimaryKeyColumn());
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return reportColumns.map((column) => {
|
|
213
|
-
var _a;
|
|
214
|
-
return ({
|
|
215
|
-
columnId: column.columnId,
|
|
216
|
-
friendlyName: column.friendlyName,
|
|
217
|
-
dataType: column.dataType,
|
|
218
|
-
field: (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId,
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
getReportDataRows(report, columns, includePrimaryKey) {
|
|
223
|
-
var _a, _b;
|
|
224
|
-
if (ArrayExtensions.IsNullOrEmpty(columns)) {
|
|
225
|
-
return [];
|
|
226
|
-
}
|
|
227
|
-
const columnIds = columns.map((column) => column.columnId);
|
|
228
|
-
const resultRowData = [];
|
|
229
|
-
switch (report.ReportRowScope) {
|
|
230
|
-
case 'AllRows':
|
|
231
|
-
this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
|
|
232
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
|
|
233
|
-
});
|
|
234
|
-
break;
|
|
235
|
-
case 'VisibleRows':
|
|
236
|
-
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((rowNode) => {
|
|
237
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
|
|
238
|
-
});
|
|
239
|
-
break;
|
|
240
|
-
case 'ExpressionRows':
|
|
241
|
-
this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
|
|
242
|
-
var _a;
|
|
243
|
-
if (this.adaptableApi.internalApi
|
|
244
|
-
.getQueryLanguageService()
|
|
245
|
-
.evaluateBooleanExpression((_a = report.Query) === null || _a === void 0 ? void 0 : _a.BooleanExpression, ExportModuleId, rowNode)) {
|
|
246
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
break;
|
|
250
|
-
case 'SelectedCellRows':
|
|
251
|
-
const selectedCellInfo = this.adaptableApi.gridApi.getSelectedCellInfo();
|
|
252
|
-
const { gridCells: GridCells } = selectedCellInfo;
|
|
253
|
-
let selectedCellsByPrimaryKey = groupBy(GridCells, 'primaryKeyValue');
|
|
254
|
-
// we iterate over all visibleRowNodes to preserve the current order
|
|
255
|
-
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((rowNode) => {
|
|
256
|
-
const rowPrimaryKeyValue = this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
|
|
257
|
-
const selectedRowCells = selectedCellsByPrimaryKey[rowPrimaryKeyValue];
|
|
258
|
-
if (selectedRowCells) {
|
|
259
|
-
const selectedRowColumnIds = selectedRowCells.map((rowCell) => rowCell.column.columnId);
|
|
260
|
-
const selectedColumnIds = columnIds.filter((columnId) => selectedRowColumnIds.includes(columnId));
|
|
261
|
-
const row = this.getRowObjectForColumnIds(rowNode, selectedColumnIds);
|
|
262
|
-
if (includePrimaryKey) {
|
|
263
|
-
row[this.adaptableApi.optionsApi.getPrimaryKey()] = rowPrimaryKeyValue;
|
|
264
|
-
}
|
|
265
|
-
resultRowData.push(row);
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
break;
|
|
269
|
-
case 'SelectedRows':
|
|
270
|
-
const selectedRowInfo = this.adaptableApi.gridApi.getSelectedRowInfo();
|
|
271
|
-
const selectedGridRowPrimaryKeys = (_b = (_a = selectedRowInfo === null || selectedRowInfo === void 0 ? void 0 : selectedRowInfo.gridRows) === null || _a === void 0 ? void 0 : _a.filter((gr) => gr.rowInfo.isGroup == false).map((gridRow) => gridRow.primaryKeyValue)) !== null && _b !== void 0 ? _b : [];
|
|
272
|
-
if (selectedGridRowPrimaryKeys.length) {
|
|
273
|
-
this.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
|
|
274
|
-
const rowPrimaryKeyValue = this.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
|
|
275
|
-
if (selectedGridRowPrimaryKeys.includes(rowPrimaryKeyValue)) {
|
|
276
|
-
resultRowData.push(this.getRowObjectForColumnIds(rowNode, columnIds));
|
|
277
|
-
}
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
return resultRowData;
|
|
283
|
-
}
|
|
284
|
-
getReportData(report, includePrimaryKey = false) {
|
|
285
|
-
if (this.adaptableApi.exportApi.isExternalReport(report)) {
|
|
286
|
-
return this.adaptableApi.exportApi.runExternalReport(report.Name);
|
|
287
|
-
}
|
|
288
|
-
const columns = this.getReportDataColumns(report, includePrimaryKey);
|
|
289
|
-
const rows = this.getReportDataRows(report, columns, includePrimaryKey);
|
|
290
|
-
return { columns, rows };
|
|
291
|
-
}
|
|
292
|
-
getReportDataAsArray(report, includePrimaryKey = false) {
|
|
293
|
-
const reportData = this.getReportData(report, includePrimaryKey);
|
|
294
|
-
return this.convertReportDataToArray(reportData);
|
|
295
|
-
}
|
|
296
|
-
convertReportDataToArray(reportData) {
|
|
297
|
-
return [
|
|
298
|
-
reportData.columns.map((column) => column.friendlyName),
|
|
299
|
-
...reportData.rows.map((row) => reportData.columns.map((column) => row[column.columnId])),
|
|
300
|
-
];
|
|
301
|
-
}
|
|
302
|
-
getRowObjectForColumnIds(rowNode, columnIds) {
|
|
303
|
-
return columnIds.reduce((result, columnId) => {
|
|
304
|
-
result[columnId] = this.getCellExportValueFromRowNode(rowNode, columnId);
|
|
305
|
-
return result;
|
|
306
|
-
}, {});
|
|
307
|
-
}
|
|
308
|
-
PublishLiveLiveDataChangedEvent(reportDestination, liveDataTrigger, liveReport) {
|
|
309
|
-
const liveDataChangedInfo = {
|
|
310
|
-
adaptableApi: this.adaptableApi,
|
|
311
|
-
reportDestination: reportDestination,
|
|
312
|
-
liveDataTrigger: liveDataTrigger,
|
|
313
|
-
liveReport: liveReport,
|
|
314
|
-
userName: this.adaptableApi.optionsApi.getUserName(),
|
|
315
|
-
adaptableId: this.adaptableApi.optionsApi.getAdaptableId(),
|
|
316
|
-
};
|
|
317
|
-
this.adaptableApi.eventApi.emit('LiveDataChanged', liveDataChangedInfo);
|
|
318
|
-
}
|
|
319
|
-
getCellExportValueFromRowNode(rowNode, columnId) {
|
|
320
|
-
return this.getCellExportValueFromRawValue(rowNode, this.adaptableApi.gridApi.getRawValueFromRowNode(rowNode, columnId), columnId);
|
|
321
|
-
}
|
|
322
|
-
getCellExportValueFromRawValue(rowNode, cellRawValue, columnId) {
|
|
323
|
-
if (StringExtensions.IsNullOrEmpty(cellRawValue)) {
|
|
324
|
-
return cellRawValue;
|
|
325
|
-
}
|
|
326
|
-
const column = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
327
|
-
const columnDataType = column.dataType;
|
|
328
|
-
// if this is a date column and there is a custom export date format provided, that will take precedence
|
|
329
|
-
if (columnDataType === 'Date' && !!this.getCustomExportDateFormat()) {
|
|
330
|
-
const exportDateFormat = this.getCustomExportDateFormat();
|
|
331
|
-
return FormatHelper.DateFormatter(cellRawValue, {
|
|
332
|
-
Pattern: exportDateFormat,
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
// otherwise check the general export format types
|
|
336
|
-
let cellExportFormat = this.adaptableApi.exportApi.internalApi.getCellExportFormatType(column, columnDataType);
|
|
337
|
-
return this.getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId, cellExportFormat);
|
|
338
|
-
}
|
|
339
|
-
getReportFileName(reportName, destination) {
|
|
340
|
-
let fileName;
|
|
341
|
-
const reportFilename = this.adaptableApi.optionsApi.getExportOptions().reportFilename;
|
|
342
|
-
if (reportFilename) {
|
|
343
|
-
const reportFileNameContext = Object.assign(Object.assign({}, createBaseContext(this.adaptableApi)), { reportName,
|
|
344
|
-
destination });
|
|
345
|
-
fileName = reportFilename(reportFileNameContext);
|
|
346
|
-
}
|
|
347
|
-
else {
|
|
348
|
-
fileName = StringExtensions.ReplaceEmptySpacesWithUnderscore(reportName);
|
|
349
|
-
if (this.adaptableApi.optionsApi.getExportOptions().appendFileTimestamp) {
|
|
350
|
-
fileName = `${fileName}_${DateFormatter(new Date(), {
|
|
351
|
-
Pattern: 'yyyyMMdd_HHmmss',
|
|
352
|
-
})}`;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
return fileName;
|
|
356
|
-
}
|
|
357
|
-
getCustomExportDateFormat() {
|
|
358
|
-
return this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
359
|
-
}
|
|
360
|
-
getCellExportValueFromRawValueByType(rowNode, cellRawValue, columnId,
|
|
361
|
-
// default to rawValue if, for some reason, the configs provide invalid values
|
|
362
|
-
type = 'rawValue') {
|
|
363
|
-
return type === 'rawValue'
|
|
364
|
-
? cellRawValue
|
|
365
|
-
: // type === formattedValue
|
|
366
|
-
this.adaptableApi.gridApi.getDisplayValueFromRawValue(rowNode, columnId, cellRawValue);
|
|
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 displayedColumns = this.adaptableApi.agGridApi.getAllDisplayedColumns();
|
|
400
|
-
const colDefs = displayedColumns.map((column) => {
|
|
401
|
-
return column.getColDef();
|
|
402
|
-
});
|
|
403
|
-
const forAllVisibleRowNodesDoConfig = { includeGroupRows: true };
|
|
404
|
-
const agGridApi = this.adaptableApi.agGridApi;
|
|
405
|
-
const userExcelStyles = this.adaptableApi.internalApi
|
|
406
|
-
.getAdaptableInstance()
|
|
407
|
-
.agGridAdapter.getUserGridOptionsProperty('excelStyles') || [];
|
|
408
|
-
this.adaptableApi.internalApi.forAllVisibleRowNodesDo((node, rowIndex) => {
|
|
409
|
-
const rowParams = {
|
|
410
|
-
node,
|
|
411
|
-
data: node.data,
|
|
412
|
-
rowIndex,
|
|
413
|
-
api: agGridApi,
|
|
414
|
-
columnApi: null,
|
|
415
|
-
context: agGridApi.getGridOption('context') || {},
|
|
416
|
-
};
|
|
417
|
-
const getRowStyleFn = agGridApi.getGridOption('getRowStyle');
|
|
418
|
-
const rowStyle = getRowStyleFn ? getRowStyleFn(rowParams) : {};
|
|
419
|
-
displayedColumns.forEach((column, columnIndex) => {
|
|
420
|
-
var _a, _b, _c;
|
|
421
|
-
const colDef = colDefs[columnIndex];
|
|
422
|
-
const columnId = column.getId();
|
|
423
|
-
const adaptableColumn = this.adaptableApi.columnApi.getColumnWithColumnId(columnId);
|
|
424
|
-
const isDateCellExportedAsFormattedValue = this.adaptableApi.exportApi.internalApi.isDateCellExportedAsFormattedValue(adaptableColumn);
|
|
425
|
-
let cellClassParams;
|
|
426
|
-
const getLazyCellClassParams = () => {
|
|
427
|
-
if (!cellClassParams) {
|
|
428
|
-
cellClassParams = {
|
|
429
|
-
colDef,
|
|
430
|
-
node,
|
|
431
|
-
column,
|
|
432
|
-
data: node.data,
|
|
433
|
-
value: this.adaptableApi.gridApi.getRawValueFromRowNode(node, columnId),
|
|
434
|
-
rowIndex,
|
|
435
|
-
api: agGridApi,
|
|
436
|
-
columnApi: null,
|
|
437
|
-
context: {},
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
return cellClassParams;
|
|
441
|
-
};
|
|
442
|
-
const cellStyle = typeof colDef.cellStyle === 'function' ? colDef.cellStyle(getLazyCellClassParams()) : {};
|
|
443
|
-
const excelStyles = [];
|
|
444
|
-
// add user defined excel styles
|
|
445
|
-
let userColDefCellClass = this.adaptableApi.internalApi
|
|
446
|
-
.getAdaptableInstance()
|
|
447
|
-
.agGridColumnAdapter.getUserColDefProperty(column.getColId(), 'cellClass');
|
|
448
|
-
const userDefinedCellClass = typeof userColDefCellClass === 'function'
|
|
449
|
-
? userColDefCellClass(getLazyCellClassParams())
|
|
450
|
-
: userColDefCellClass;
|
|
451
|
-
const userDefinedExcelStyle = userDefinedCellClass &&
|
|
452
|
-
userExcelStyles.find((excelStyle) => {
|
|
453
|
-
var _a;
|
|
454
|
-
return typeof userDefinedCellClass === 'string'
|
|
455
|
-
? userDefinedCellClass === excelStyle.id
|
|
456
|
-
: (_a = userDefinedCellClass === null || userDefinedCellClass === void 0 ? void 0 : userDefinedCellClass.includes) === null || _a === void 0 ? void 0 : _a.call(userDefinedCellClass, excelStyle.id);
|
|
457
|
-
});
|
|
458
|
-
if (userDefinedExcelStyle) {
|
|
459
|
-
excelStyles.push(userDefinedExcelStyle);
|
|
460
|
-
}
|
|
461
|
-
// add adaptable derived styles (format column etc.)
|
|
462
|
-
const adaptableStyle = Object.assign(Object.assign({}, rowStyle), Object.keys(cellStyle).reduce((result, key) => {
|
|
463
|
-
if (cellStyle[key] !== null) {
|
|
464
|
-
result[key] = cellStyle[key];
|
|
465
|
-
}
|
|
466
|
-
return result;
|
|
467
|
-
}, {}));
|
|
468
|
-
const sanitizedAdaptableStyle = sanitizeStyle(adaptableStyle);
|
|
469
|
-
if (Object.values(sanitizedAdaptableStyle).some((style) => style != null)) {
|
|
470
|
-
excelStyles.push(this.convertCSSToExcelStyle(sanitizedAdaptableStyle));
|
|
471
|
-
}
|
|
472
|
-
const excelDataType = this.adaptableApi.exportApi.internalApi.getExcelDataType(colDef === null || colDef === void 0 ? void 0 : colDef.type);
|
|
473
|
-
const rawValue = this.adaptableApi.gridApi.getRawValueFromRowNode(node, column.getId());
|
|
474
|
-
// don't add the cell style if it has no adaptable custom styles
|
|
475
|
-
if (!excelStyles.length &&
|
|
476
|
-
// if this is a formatted Date value, we still need to add the AG GRID specific type & numberFormat below
|
|
477
|
-
!(excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue)) {
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
const cellClassId = this.adaptableApi.internalApi
|
|
481
|
-
.getAdaptableInstance()
|
|
482
|
-
.agGridColumnAdapter.getExcelClassNameForCell(column.getId(), this.adaptableApi.internalApi
|
|
483
|
-
.getAdaptableInstance()
|
|
484
|
-
.getPrimaryKeyValueFromRowNode(node), userDefinedCellClass);
|
|
485
|
-
const finalCellExcelStyle = Object.assign({}, ...excelStyles);
|
|
486
|
-
if (excelDataType === 'DateTime' && isDateCellExportedAsFormattedValue) {
|
|
487
|
-
let dateFormatPattern = this.adaptableApi.optionsApi.getExportOptions().exportDateFormat;
|
|
488
|
-
const abColumn = getAdaptableColumnWithColumnId(column.getColId());
|
|
489
|
-
if (!dateFormatPattern) {
|
|
490
|
-
const mostRelevantFormatColumn = this.adaptableApi.formatColumnApi.internalApi.getMostRelevantFormatColumnForColumn(getFormatColumnsWithDisplayFormatForColumn(column.getColId()), abColumn, { node, value: rawValue });
|
|
491
|
-
dateFormatPattern =
|
|
492
|
-
((_a = mostRelevantFormatColumn === null || mostRelevantFormatColumn === void 0 ? void 0 : mostRelevantFormatColumn.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Formatter) === 'DateFormatter' &&
|
|
493
|
-
((_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);
|
|
494
|
-
}
|
|
495
|
-
if (dateFormatPattern) {
|
|
496
|
-
const normalisedValue = this.adaptableApi.internalApi
|
|
497
|
-
.getAdaptableInstance()
|
|
498
|
-
.getNormalisedValueFromRawValue(rawValue, abColumn);
|
|
499
|
-
if (normalisedValue) {
|
|
500
|
-
// we have to pass the date in the ISO format to Excel
|
|
501
|
-
// see https://www.ag-grid.com/javascript-data-grid/excel-export-data-types/#dates
|
|
502
|
-
// we can NOT use Date.toISOString() because we don't want the timezone corrections to kick in
|
|
503
|
-
const isoFormattedValue = DateFormatter(normalisedValue, {
|
|
504
|
-
Pattern: `yyyy-MM-dd'T'HH:mm:ss.SSS`,
|
|
505
|
-
});
|
|
506
|
-
if (isoFormattedValue) {
|
|
507
|
-
finalCellExcelStyle.dataType = 'DateTime';
|
|
508
|
-
finalCellExcelStyle.numberFormat = { format: dateFormatPattern };
|
|
509
|
-
// create a new cell key to ensure any user provided className does not interfere
|
|
510
|
-
const cellKey = this.adaptableApi.internalApi
|
|
511
|
-
.getAdaptableInstance()
|
|
512
|
-
.agGridColumnAdapter.getExcelClassNameForCell(column.getColId(), this.adaptableApi.internalApi
|
|
513
|
-
.getAdaptableInstance()
|
|
514
|
-
.getPrimaryKeyValueFromRowNode(node));
|
|
515
|
-
// we need to register so that later the cellProcessor will put the isoFormattedValue through (thus giving the formatting responsability to Excel)
|
|
516
|
-
this.registerExcelStyleWithFormattedDate(cellKey, isoFormattedValue);
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
this.registerExcelStyle(finalCellExcelStyle, cellClassId);
|
|
522
|
-
});
|
|
523
|
-
}, forAllVisibleRowNodesDoConfig);
|
|
524
|
-
}
|
|
525
|
-
convertCSSToExcelStyle(style) {
|
|
526
|
-
const getHexColor = (color) => {
|
|
527
|
-
const preparedColor = getVariableColor(color);
|
|
528
|
-
const t = tinycolor(preparedColor);
|
|
529
|
-
const a = t.getAlpha();
|
|
530
|
-
return tinycolor.mix(tinycolor('white'), t, a * 100).toHexString();
|
|
531
|
-
};
|
|
532
|
-
let result = {};
|
|
533
|
-
if (style.backgroundColor != null) {
|
|
534
|
-
result.interior = {
|
|
535
|
-
color: getHexColor(style.backgroundColor),
|
|
536
|
-
pattern: 'Solid',
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
if (style.borderColor != null) {
|
|
540
|
-
const excelBorder = {
|
|
541
|
-
color: style.borderColor,
|
|
542
|
-
lineStyle: 'Continuous',
|
|
543
|
-
weight: 1,
|
|
544
|
-
};
|
|
545
|
-
result.borders = {
|
|
546
|
-
borderBottom: excelBorder,
|
|
547
|
-
borderLeft: excelBorder,
|
|
548
|
-
borderRight: excelBorder,
|
|
549
|
-
borderTop: excelBorder,
|
|
550
|
-
};
|
|
551
|
-
}
|
|
552
|
-
if (style.textAlign) {
|
|
553
|
-
result.alignment = {
|
|
554
|
-
horizontal: StringExtensions.CapitaliseFirstLetter(style.textAlign),
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
if (style.color != null) {
|
|
558
|
-
if (!result.font) {
|
|
559
|
-
result.font = {};
|
|
560
|
-
}
|
|
561
|
-
result.font = {
|
|
562
|
-
color: getHexColor(style.color),
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
if (style.fontStyle === 'italic') {
|
|
566
|
-
if (!result.font) {
|
|
567
|
-
result.font = {};
|
|
568
|
-
}
|
|
569
|
-
result.font.italic = true;
|
|
570
|
-
}
|
|
571
|
-
if (style.fontWeight != null &&
|
|
572
|
-
(style.fontWeight === 'bold' || Number(style.fontWeight) >= 600)) {
|
|
573
|
-
if (!result.font) {
|
|
574
|
-
result.font = {};
|
|
575
|
-
}
|
|
576
|
-
result.font.bold = true;
|
|
577
|
-
}
|
|
578
|
-
if (style.fontSize != null) {
|
|
579
|
-
if (!result.font) {
|
|
580
|
-
result.font = {};
|
|
581
|
-
}
|
|
582
|
-
result.font.size = convertCSSAbsoluteFontSizeToPt(style.fontSize);
|
|
583
|
-
}
|
|
584
|
-
return result;
|
|
585
|
-
}
|
|
586
|
-
resetExcelStyleMemoization() {
|
|
587
|
-
this.excelStylesCache = {};
|
|
588
|
-
this.cellClassKey2excelStyleIdMap = {};
|
|
589
|
-
this.excelStylesWithFormattedDate = {};
|
|
590
|
-
}
|
|
591
|
-
registerExcelStyle(excelStyle, cellClassKey) {
|
|
592
|
-
const excelStyleKey = JSON.stringify(excelStyle);
|
|
593
|
-
if (!this.excelStylesCache[excelStyleKey]) {
|
|
594
|
-
const excelStyleId = createUuid();
|
|
595
|
-
const excelStyleWithId = Object.assign(Object.assign({}, excelStyle), { id: excelStyleId });
|
|
596
|
-
this.excelStylesCache[excelStyleKey] = excelStyleWithId;
|
|
597
|
-
}
|
|
598
|
-
this.cellClassKey2excelStyleIdMap[cellClassKey] = this.excelStylesCache[excelStyleKey].id;
|
|
599
|
-
}
|
|
600
|
-
registerExcelStyleWithFormattedDate(cellClassId, isoFormattedValue) {
|
|
601
|
-
this.excelStylesWithFormattedDate[cellClassId] = isoFormattedValue;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const reorder: (list: any[], startIndex: number, endIndex: number) => any[];
|
package/src/Utilities/reorder.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const reorder = (list, startIndex, endIndex) => {
|
|
2
|
-
const result = [...list];
|
|
3
|
-
if (startIndex > list.length - 1) {
|
|
4
|
-
// not much that we can do if the dragged item is out of bounds...
|
|
5
|
-
return result;
|
|
6
|
-
}
|
|
7
|
-
if (endIndex > list.length - 1) {
|
|
8
|
-
endIndex = list.length - 1;
|
|
9
|
-
}
|
|
10
|
-
const [removed] = result.splice(startIndex, 1);
|
|
11
|
-
result.splice(endIndex, 0, removed);
|
|
12
|
-
return result;
|
|
13
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare function sortWithOrderArray<T>(arr: T[], order: T[],
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
* The array can contain items which are not listed in the order array.
|
|
5
|
-
* So sortUnorderedItems decides whether to leave these items untouched
|
|
6
|
-
* in the current order in which they are in the array (sortUnorderedItems: false)
|
|
7
|
-
* or to sort them using normal comparison rules
|
|
8
|
-
*/
|
|
9
|
-
{ sortUnorderedItems: sortUnorderedItems }: {
|
|
10
|
-
sortUnorderedItems: boolean;
|
|
11
|
-
}): T[];
|