@adaptabletools/adaptable 18.0.0-canary.4 → 18.0.0-canary.5
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/agGrid.d.ts +4 -21
- package/agGrid.js +9 -26
- package/base.css +1 -1
- package/base.css.map +1 -1
- package/index.css +74 -68
- package/index.css.map +1 -1
- package/package.json +3 -4
- package/src/AdaptableInterfaces/IAdaptable.d.ts +55 -109
- package/src/AdaptableOptions/AdaptableOptions.d.ts +6 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -0
- package/src/Api/AdaptableApi.d.ts +5 -0
- package/src/Api/ColumnFilterApi.d.ts +0 -5
- package/src/Api/Events/AdaptableReady.d.ts +3 -3
- package/src/Api/Events/GridDataChanged.d.ts +4 -4
- package/src/Api/GridApi.d.ts +14 -13
- package/src/Api/Implementation/ActionColumnApiImpl.d.ts +2 -0
- package/src/Api/Implementation/ActionColumnApiImpl.js +33 -0
- package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -0
- package/src/Api/Implementation/AdaptableApiImpl.js +3 -0
- package/src/Api/Implementation/ApiBase.d.ts +2 -1
- package/src/Api/Implementation/ApiBase.js +3 -0
- package/src/Api/Implementation/ColumnFilterApiImpl.d.ts +0 -1
- package/src/Api/Implementation/ColumnFilterApiImpl.js +0 -10
- package/src/Api/Implementation/CommentsApiImpl.js +2 -1
- package/src/Api/Implementation/ConfigApiImpl.js +8 -3
- package/src/Api/Implementation/GridApiImpl.d.ts +3 -3
- package/src/Api/Implementation/GridApiImpl.js +20 -14
- package/src/Api/Implementation/StatusBarApiImpl.d.ts +0 -1
- package/src/Api/Implementation/StatusBarApiImpl.js +0 -3
- package/src/Api/Implementation/ToolPanelApiImpl.js +6 -6
- package/src/Api/Internal/ActionRowInternalApi.d.ts +5 -1
- package/src/Api/Internal/ActionRowInternalApi.js +106 -0
- package/src/Api/Internal/AdaptableInternalApi.d.ts +3 -4
- package/src/Api/Internal/AdaptableInternalApi.js +10 -8
- package/src/Api/Internal/CalculatedColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/CalculatedColumnInternalApi.js +70 -0
- package/src/Api/Internal/ColumnFilterInternalApi.d.ts +1 -0
- package/src/Api/Internal/ColumnFilterInternalApi.js +11 -1
- package/src/Api/Internal/ColumnInternalApi.d.ts +4 -1
- package/src/Api/Internal/ColumnInternalApi.js +12 -0
- package/src/Api/Internal/CustomSortInternalApi.d.ts +3 -2
- package/src/Api/Internal/CustomSortInternalApi.js +32 -1
- package/src/Api/Internal/DataSetInternalApi.js +1 -1
- package/src/Api/Internal/FreeTextColumnInternalApi.d.ts +2 -0
- package/src/Api/Internal/FreeTextColumnInternalApi.js +59 -0
- package/src/Api/Internal/GridFilterInternalApi.js +1 -1
- package/src/Api/Internal/GridInternalApi.d.ts +21 -3
- package/src/Api/Internal/GridInternalApi.js +126 -7
- package/src/Api/Internal/TeamSharingInternalApi.js +1 -1
- package/src/EnvVars.d.ts +3 -0
- package/src/EnvVars.js +4 -0
- package/src/PredefinedConfig/Common/AggregationColumns.d.ts +1 -0
- package/src/PredefinedConfig/Common/AggregationColumns.js +3 -0
- package/src/Redux/Store/AdaptableStore.d.ts +4 -6
- package/src/Redux/Store/AdaptableStore.js +22 -50
- package/src/Redux/Store/Interface/IAdaptableStore.d.ts +7 -1
- package/src/Strategy/AdaptableModuleBase.d.ts +2 -3
- package/src/Strategy/AdaptableModuleBase.js +4 -7
- package/src/Strategy/AlertModule.d.ts +1 -2
- package/src/Strategy/AlertModule.js +2 -55
- package/src/Strategy/CalculatedColumnModule.d.ts +2 -3
- package/src/Strategy/CalculatedColumnModule.js +5 -25
- package/src/Strategy/ChartingModule.d.ts +0 -1
- package/src/Strategy/ChartingModule.js +0 -21
- package/src/Strategy/ColumnFilterModule.d.ts +1 -2
- package/src/Strategy/ColumnFilterModule.js +1 -64
- package/src/Strategy/CommentsModule.d.ts +1 -0
- package/src/Strategy/CommentsModule.js +2 -1
- package/src/Strategy/CustomSortModule.js +1 -1
- package/src/Strategy/DashboardModule.d.ts +1 -2
- package/src/Strategy/DashboardModule.js +1 -8
- package/src/Strategy/DataChangeHistoryModule.d.ts +1 -0
- package/src/Strategy/DataChangeHistoryModule.js +3 -1
- package/src/Strategy/DataSetModule.d.ts +1 -1
- package/src/Strategy/DataSetModule.js +1 -1
- package/src/Strategy/FlashingCellModule.d.ts +1 -2
- package/src/Strategy/FlashingCellModule.js +2 -15
- package/src/Strategy/FormatColumnModule.d.ts +0 -2
- package/src/Strategy/FormatColumnModule.js +0 -47
- package/src/Strategy/FreeTextColumnModule.d.ts +0 -1
- package/src/Strategy/FreeTextColumnModule.js +0 -30
- package/src/Strategy/GridFilterModule.d.ts +0 -1
- package/src/Strategy/GridFilterModule.js +0 -37
- package/src/Strategy/Interface/IModule.d.ts +0 -1
- package/src/Strategy/LayoutModule.d.ts +1 -3
- package/src/Strategy/LayoutModule.js +6 -50
- package/src/Strategy/NamedQueryModule.d.ts +0 -1
- package/src/Strategy/NamedQueryModule.js +0 -19
- package/src/Strategy/PlusMinusModule.d.ts +1 -1
- package/src/Strategy/PlusMinusModule.js +1 -1
- package/src/Strategy/ScheduleModule.d.ts +1 -1
- package/src/Strategy/ScheduleModule.js +1 -1
- package/src/Strategy/ShortcutModule.d.ts +1 -1
- package/src/Strategy/ShortcutModule.js +1 -1
- package/src/Strategy/StyledColumnModule.d.ts +0 -1
- package/src/Strategy/StyledColumnModule.js +0 -21
- package/src/Strategy/TeamSharingModule.d.ts +1 -0
- package/src/Strategy/TeamSharingModule.js +5 -5
- package/src/Strategy/ToolPanelModule.d.ts +0 -1
- package/src/Strategy/ToolPanelModule.js +0 -23
- package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
- package/src/Utilities/Constants/GeneralConstants.js +1 -0
- package/src/Utilities/Helpers/AdaptableHelper.d.ts +0 -3
- package/src/Utilities/Helpers/AdaptableHelper.js +0 -58
- package/src/Utilities/Services/CellPopupService.js +0 -1
- package/src/Utilities/Services/LicenseService/index.d.ts +3 -0
- package/src/Utilities/Services/LicenseService/index.js +10 -3
- package/src/Utilities/Services/MetamodelService.d.ts +1 -1
- package/src/Utilities/Services/MetamodelService.js +6 -3
- package/src/Utilities/Services/RowEditService.d.ts +3 -2
- package/src/Utilities/Services/RowEditService.js +3 -1
- package/src/View/AdaptableView.js +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +2 -2
- package/src/View/CalculatedColumn/utils.d.ts +1 -1
- package/src/View/CellSummary/CellSummaryPopup.js +1 -1
- package/src/View/Components/Popups/AdaptableLoadingScreen.d.ts +6 -5
- package/src/View/Components/Popups/AdaptableLoadingScreen.js +19 -9
- package/src/View/CustomSort/CustomSortSummary.js +1 -1
- package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -1
- package/src/View/GridFilter/GridFilterViewPanel.js +6 -2
- package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +2 -3
- package/src/View/Layout/Wizard/LayoutWizard.js +1 -1
- package/src/agGrid/ActionColumnRenderer.js +4 -4
- package/src/agGrid/Adaptable.d.ts +3 -455
- package/src/agGrid/Adaptable.js +8 -5292
- package/src/agGrid/AdaptableAgGrid.d.ts +336 -0
- package/src/agGrid/AdaptableAgGrid.js +3780 -0
- package/src/agGrid/AdaptableLogger.js +77 -11
- package/src/agGrid/AgGridAdapter.d.ts +54 -0
- package/src/agGrid/AgGridAdapter.js +549 -0
- package/src/agGrid/AgGridColumnAdapter.d.ts +56 -0
- package/src/agGrid/AgGridColumnAdapter.js +813 -0
- package/src/agGrid/AgGridMenuAdapter.d.ts +28 -0
- package/src/agGrid/AgGridMenuAdapter.js +271 -0
- package/src/agGrid/AgGridOptionsService.d.ts +11 -0
- package/src/agGrid/AgGridOptionsService.js +50 -0
- package/src/agGrid/BadgeRenderer.js +1 -1
- package/src/agGrid/CheckboxRenderer.js +1 -1
- package/src/agGrid/FilterWrapper.d.ts +2 -2
- package/src/agGrid/FilterWrapper.js +1 -1
- package/src/agGrid/attachAddaptableColumnTypes.d.ts +12 -12
- package/src/agGrid/defaultAdaptableOptions.d.ts +3 -0
- package/src/{Utilities/Defaults/DefaultAdaptableOptions.js → agGrid/defaultAdaptableOptions.js} +69 -8
- package/src/agGrid/editors/AdaptableDateEditor/index.js +2 -2
- package/src/agGrid/editors/AdaptableNumberEditor/index.js +2 -2
- package/src/components/Datepicker/index.d.ts +1 -1
- package/src/components/InfiniteTable/index.js +2 -2
- package/src/components/Modal/index.d.ts +1 -0
- package/src/components/Modal/index.js +4 -3
- package/src/env.js +2 -2
- package/src/metamodel/adaptable.metamodel.d.ts +9 -9
- package/src/metamodel/adaptable.metamodel.js +7 -0
- package/src/migration/AdaptableUpgradeHelper.d.ts +38 -0
- package/src/migration/AdaptableUpgradeHelper.js +48 -0
- package/src/migration/VersionUpgrade.d.ts +8 -0
- package/src/migration/VersionUpgrade.js +11 -0
- package/src/migration/VersionUpgrade17.d.ts +18 -0
- package/src/migration/VersionUpgrade17.js +342 -0
- package/src/migration/VersionUpgrade18.d.ts +5 -0
- package/src/migration/VersionUpgrade18.js +6 -0
- package/src/types.d.ts +5 -4
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/Utilities/Defaults/DefaultAdaptableOptions.d.ts +0 -2
- package/src/Utilities/Services/Interface/IRowEditService.d.ts +0 -3
- package/src/Utilities/Services/Interface/IRowEditService.js +0 -1
- package/src/agGrid/agGridHelper.d.ts +0 -57
- package/src/agGrid/agGridHelper.js +0 -686
- package/src/agGrid/agGridMenuHelper.d.ts +0 -46
- package/src/agGrid/agGridMenuHelper.js +0 -668
|
@@ -4,6 +4,7 @@ import { SystemHighlightCellAdd, SystemHighlightCellDelete, SystemHighlightCellD
|
|
|
4
4
|
import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
|
|
5
5
|
import { GridInternalApi } from '../Internal/GridInternalApi';
|
|
6
6
|
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
7
|
+
import { logDeprecation } from '../../Utilities/logDeprecation';
|
|
7
8
|
export class GridApiImpl extends ApiBase {
|
|
8
9
|
constructor(adaptable) {
|
|
9
10
|
super(adaptable);
|
|
@@ -12,13 +13,18 @@ export class GridApiImpl extends ApiBase {
|
|
|
12
13
|
getGridState() {
|
|
13
14
|
return this.getAdaptableState().Grid;
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
loadGridData(dataSource) {
|
|
16
17
|
this.adaptable.setGridData(dataSource);
|
|
17
18
|
const allRowNodes = this.getAllRowNodes();
|
|
18
|
-
this.internalApi.fireGridDataChangedEvent(dataSource, allRowNodes, '
|
|
19
|
+
this.internalApi.fireGridDataChangedEvent(dataSource, allRowNodes, 'Load');
|
|
20
|
+
}
|
|
21
|
+
resetGridData(dataSource) {
|
|
22
|
+
logDeprecation(this.adaptable.logger, 'GridApi', 'resetGridData', 'loadGridData');
|
|
23
|
+
this.loadGridData(dataSource);
|
|
19
24
|
}
|
|
20
25
|
setInitialGridData(data) {
|
|
21
|
-
this.adaptable.
|
|
26
|
+
logDeprecation(this.adaptable.logger, 'GridApi', 'setInitialGridData', 'loadGridData');
|
|
27
|
+
this.loadGridData(data);
|
|
22
28
|
}
|
|
23
29
|
getGridData() {
|
|
24
30
|
return this.adaptable.getGridData();
|
|
@@ -114,9 +120,6 @@ export class GridApiImpl extends ApiBase {
|
|
|
114
120
|
// slightly round the houses but we have to call ColumnFilterAPI as it does it properly
|
|
115
121
|
this.adaptable.api.columnFilterApi.clearColumnFilters();
|
|
116
122
|
}
|
|
117
|
-
getAgGridInstance() {
|
|
118
|
-
return this.adaptable.gridOptions;
|
|
119
|
-
}
|
|
120
123
|
getColumnSorts() {
|
|
121
124
|
return this.getAdaptableState().Grid.ColumnSorts;
|
|
122
125
|
}
|
|
@@ -271,7 +274,9 @@ export class GridApiImpl extends ApiBase {
|
|
|
271
274
|
return this.adaptable.getFirstDisplayedRowNode();
|
|
272
275
|
}
|
|
273
276
|
getVisibleRowNodes(config) {
|
|
274
|
-
|
|
277
|
+
const rowNodes = [];
|
|
278
|
+
this.adaptable.forAllVisibleRowNodesDo((rowNode) => rowNodes.push(rowNode), config);
|
|
279
|
+
return rowNodes;
|
|
275
280
|
}
|
|
276
281
|
getAllRowNodes(config) {
|
|
277
282
|
return this.adaptable.getAllRowNodes(config);
|
|
@@ -330,10 +335,10 @@ export class GridApiImpl extends ApiBase {
|
|
|
330
335
|
this.adaptable.expandRowGroupsForValues(columnValues);
|
|
331
336
|
}
|
|
332
337
|
isGridPivotable() {
|
|
333
|
-
return this.
|
|
338
|
+
return !this.getAdaptableApi().internalApi.isGridInTreeMode();
|
|
334
339
|
}
|
|
335
340
|
isGridGroupable() {
|
|
336
|
-
return this.
|
|
341
|
+
return !this.getAdaptableApi().internalApi.isGridInTreeMode();
|
|
337
342
|
}
|
|
338
343
|
isGridSelectable() {
|
|
339
344
|
return this.adaptable.isGridSelectable();
|
|
@@ -349,7 +354,7 @@ export class GridApiImpl extends ApiBase {
|
|
|
349
354
|
}
|
|
350
355
|
redrawGrid() {
|
|
351
356
|
this.adaptable.redrawBody();
|
|
352
|
-
this.adaptable.
|
|
357
|
+
this.adaptable.refreshHeader();
|
|
353
358
|
}
|
|
354
359
|
getGridCellsForRawValue(columnId, rawValue) {
|
|
355
360
|
const gridCells = this.adaptable.getGridCellsForColumn(columnId);
|
|
@@ -452,7 +457,7 @@ export class GridApiImpl extends ApiBase {
|
|
|
452
457
|
}
|
|
453
458
|
refreshGroupRowNodes() {
|
|
454
459
|
// see https://www.ag-grid.com/javascript-data-grid/client-side-row-stages/#refreshing-the-client-side-model
|
|
455
|
-
this.
|
|
460
|
+
this.getAdaptableApi().agGridApi.refreshClientSideRowModel('group');
|
|
456
461
|
this.adaptable.updateRowGroupsExpandedState();
|
|
457
462
|
}
|
|
458
463
|
isCellEditable(gridCell) {
|
|
@@ -479,9 +484,6 @@ export class GridApiImpl extends ApiBase {
|
|
|
479
484
|
getRowCount() {
|
|
480
485
|
return this.adaptable.getRowCount();
|
|
481
486
|
}
|
|
482
|
-
getVisibleRowCount() {
|
|
483
|
-
return this.adaptable.getVisibleRowCount();
|
|
484
|
-
}
|
|
485
487
|
getRowsInViewport() {
|
|
486
488
|
return this.adaptable.getRowsInViewport();
|
|
487
489
|
}
|
|
@@ -509,4 +511,8 @@ export class GridApiImpl extends ApiBase {
|
|
|
509
511
|
getAgGridRowModelType() {
|
|
510
512
|
return this.adaptable.getAgGridRowModelType();
|
|
511
513
|
}
|
|
514
|
+
getVisibleRowCount() {
|
|
515
|
+
logDeprecation(this.adaptable.logger, 'GridApi', 'getVisibleRowCount', 'getRowCount');
|
|
516
|
+
return this.getRowCount();
|
|
517
|
+
}
|
|
512
518
|
}
|
|
@@ -5,6 +5,5 @@ import { StatusPanelDef } from '@ag-grid-community/core';
|
|
|
5
5
|
export declare class StatusBarApiImpl extends ApiBase implements StatusBarApi {
|
|
6
6
|
getAdaptableStatusBars(): AdaptableStatusBar[];
|
|
7
7
|
getAgGridStatusPanels(): StatusPanelDef[];
|
|
8
|
-
getAgGridStatusBar(): StatusPanelDef[];
|
|
9
8
|
setStatusBarPanels(statusPanels: AdaptableStatusBar[]): void;
|
|
10
9
|
}
|
|
@@ -7,9 +7,6 @@ export class StatusBarApiImpl extends ApiBase {
|
|
|
7
7
|
getAgGridStatusPanels() {
|
|
8
8
|
return this.adaptable.getAgGridStatusPanels();
|
|
9
9
|
}
|
|
10
|
-
getAgGridStatusBar() {
|
|
11
|
-
return this.adaptable.getAgGridStatusPanels();
|
|
12
|
-
}
|
|
13
10
|
setStatusBarPanels(statusPanels) {
|
|
14
11
|
this.dispatchAction(StatusBarSetPanels(statusPanels));
|
|
15
12
|
}
|
|
@@ -10,15 +10,15 @@ export class ToolPanelApiImpl extends ApiBase {
|
|
|
10
10
|
this.showModulePopup(ModuleConstants.ToolPanelModuleId);
|
|
11
11
|
}
|
|
12
12
|
openAdapTableToolPanel() {
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
13
|
+
const agGridApi = this.getAdaptableApi().agGridApi;
|
|
14
|
+
if (agGridApi) {
|
|
15
|
+
agGridApi.openToolPanel('adaptable');
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
closeAdapTableToolPanel() {
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
19
|
+
const agGridApi = this.getAdaptableApi().agGridApi;
|
|
20
|
+
if (agGridApi) {
|
|
21
|
+
agGridApi.closeToolPanel();
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
getCustomToolPanels() {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { IRowNode } from '@ag-grid-community/core';
|
|
1
|
+
import { ColDef, IRowNode } from '@ag-grid-community/core';
|
|
2
2
|
import { AdaptableForm } from '../../PredefinedConfig/Common/AdaptableForm';
|
|
3
3
|
import { CreateActionRowFormContext, EditActionRowFormContext } from '../../AdaptableOptions/ActionRowOptions';
|
|
4
|
+
import { AdaptableButton } from '../../PredefinedConfig/Common/AdaptableButton';
|
|
4
5
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
6
|
+
import { ActionColumnContext } from '../../AdaptableOptions/ActionColumnOptions';
|
|
5
7
|
export declare class ActionRowInternalApi extends ApiBase {
|
|
6
8
|
buildRowEditForm(rowNode: IRowNode): AdaptableForm<EditActionRowFormContext>;
|
|
7
9
|
buildRowCreateForm(clonedRowNode?: IRowNode): AdaptableForm<CreateActionRowFormContext>;
|
|
@@ -21,4 +23,6 @@ export declare class ActionRowInternalApi extends ApiBase {
|
|
|
21
23
|
private buildFormFieldLabelContext;
|
|
22
24
|
private getFieldTypeFromColumnType;
|
|
23
25
|
private getFieldValueOptions;
|
|
26
|
+
getColDefsForActionRowColumns(): ColDef[];
|
|
27
|
+
getActionRowButtonDefs(): AdaptableButton<ActionColumnContext<any>>[];
|
|
24
28
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
+
import { AB_SPECIAL_COLUMN, ADAPTABLE_ROW_ACTION_BUTTONS, } from '../../Utilities/Constants/GeneralConstants';
|
|
3
|
+
import UIHelper from '../../View/UIHelper';
|
|
4
|
+
import { ActionColumnRenderer, ReactActionColumnRenderer } from '../../agGrid/ActionColumnRenderer';
|
|
2
5
|
export class ActionRowInternalApi extends ApiBase {
|
|
3
6
|
buildRowEditForm(rowNode) {
|
|
4
7
|
return this.buildActionRow('rowEdited', rowNode);
|
|
@@ -197,4 +200,107 @@ export class ActionRowInternalApi extends ApiBase {
|
|
|
197
200
|
label: value,
|
|
198
201
|
}));
|
|
199
202
|
}
|
|
203
|
+
getColDefsForActionRowColumns() {
|
|
204
|
+
const actionButtons = this.getActionRowButtonDefs();
|
|
205
|
+
if (!actionButtons.length) {
|
|
206
|
+
return [];
|
|
207
|
+
}
|
|
208
|
+
return [
|
|
209
|
+
{
|
|
210
|
+
headerName: '',
|
|
211
|
+
colId: ADAPTABLE_ROW_ACTION_BUTTONS,
|
|
212
|
+
hide: false,
|
|
213
|
+
editable: false,
|
|
214
|
+
// 15px is the icon width + left&right padding + left&right border
|
|
215
|
+
width: Math.max(actionButtons.length * (UIHelper.getSimpleButtonPaddingWidth() * 2 + 15) + 2,
|
|
216
|
+
// If the width of the column is to small, the width will not be applied
|
|
217
|
+
// this triggers the setLayout an infinite loop because the width read from the grid is always different
|
|
218
|
+
40),
|
|
219
|
+
resizable: false,
|
|
220
|
+
lockVisible: true,
|
|
221
|
+
suppressColumnsToolPanel: true,
|
|
222
|
+
suppressFiltersToolPanel: true,
|
|
223
|
+
suppressMenu: true,
|
|
224
|
+
suppressMovable: true,
|
|
225
|
+
filter: false,
|
|
226
|
+
sortable: false,
|
|
227
|
+
enableRowGroup: false,
|
|
228
|
+
pinned: this.getActionRowOptions().actionRowButtonOptions.position === 'pinnedRight'
|
|
229
|
+
? 'right'
|
|
230
|
+
: 'left',
|
|
231
|
+
cellRenderer: this.getAdaptableVariant() === 'react' ? ReactActionColumnRenderer : ActionColumnRenderer,
|
|
232
|
+
cellClass: ADAPTABLE_ROW_ACTION_BUTTONS,
|
|
233
|
+
type: [AB_SPECIAL_COLUMN, 'abColDefObject'],
|
|
234
|
+
},
|
|
235
|
+
];
|
|
236
|
+
}
|
|
237
|
+
getActionRowButtonDefs() {
|
|
238
|
+
const actionRowButtons = this.getActionRowApi().getActionRowButtons();
|
|
239
|
+
if (!(actionRowButtons === null || actionRowButtons === void 0 ? void 0 : actionRowButtons.length)) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
const defaultActionRowButtonConfiguration = {
|
|
243
|
+
create: {
|
|
244
|
+
icon: {
|
|
245
|
+
name: 'add',
|
|
246
|
+
},
|
|
247
|
+
tooltip: 'Create',
|
|
248
|
+
onClick: () => {
|
|
249
|
+
this.getActionRowApi().displayCreateActionRow();
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
edit: {
|
|
253
|
+
icon: {
|
|
254
|
+
name: 'edit',
|
|
255
|
+
},
|
|
256
|
+
tooltip: 'Edit',
|
|
257
|
+
onClick: (button, context) => {
|
|
258
|
+
this.getActionRowApi().displayEditActionRow(context.primaryKeyValue);
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
clone: {
|
|
262
|
+
icon: {
|
|
263
|
+
name: 'clone',
|
|
264
|
+
},
|
|
265
|
+
tooltip: 'Clone',
|
|
266
|
+
onClick: (button, context) => {
|
|
267
|
+
this.getActionRowApi().displayCloneActionRow(context.primaryKeyValue);
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
delete: {
|
|
271
|
+
icon: {
|
|
272
|
+
name: 'delete',
|
|
273
|
+
},
|
|
274
|
+
tooltip: 'Delete',
|
|
275
|
+
onClick: (button, context) => {
|
|
276
|
+
var _a, _b;
|
|
277
|
+
const eventInfo = {
|
|
278
|
+
type: 'rowDeleted',
|
|
279
|
+
rowNode: context.rowNode,
|
|
280
|
+
adaptableApi: context.adaptableApi,
|
|
281
|
+
userName: context.userName,
|
|
282
|
+
adaptableId: context.adaptableId,
|
|
283
|
+
};
|
|
284
|
+
this.getEventApi().emit('ActionRowSubmitted', eventInfo);
|
|
285
|
+
(_b = (_a = this.getActionRowOptions().actionRowFormOptions).onFormSubmit) === null || _b === void 0 ? void 0 : _b.call(_a, eventInfo);
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
const actionButtons = actionRowButtons
|
|
290
|
+
.map((actionRowButtonType) => {
|
|
291
|
+
var _a, _b;
|
|
292
|
+
const defaultButtonConfig = defaultActionRowButtonConfiguration[actionRowButtonType];
|
|
293
|
+
if (!defaultButtonConfig) {
|
|
294
|
+
// should NOT happen unless the user sent some invalid button type in the predefined config
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const customButtonConfig = (_b = (_a = this.getActionRowOptions().actionRowButtonOptions).customConfiguration) === null || _b === void 0 ? void 0 : _b.call(_a, Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { actionRowButtonType }));
|
|
298
|
+
if (!customButtonConfig) {
|
|
299
|
+
return defaultButtonConfig;
|
|
300
|
+
}
|
|
301
|
+
return Object.assign(Object.assign({}, defaultButtonConfig), customButtonConfig);
|
|
302
|
+
})
|
|
303
|
+
.filter(Boolean);
|
|
304
|
+
return actionButtons;
|
|
305
|
+
}
|
|
200
306
|
}
|
|
@@ -24,9 +24,9 @@ import { AdaptableFrameworkComponent } from '../../AdaptableOptions/AdaptableFra
|
|
|
24
24
|
import { IMetamodelService } from '../../Utilities/Services/Interface/IMetamodelService';
|
|
25
25
|
import { IModuleCollection } from '../../Strategy/Interface/IModule';
|
|
26
26
|
import { AdaptableObjectTag, AdaptableObjectWithScope } from '../../PredefinedConfig/Common/AdaptableObject';
|
|
27
|
-
import { IRowEditService } from '../../Utilities/Services/Interface/IRowEditService';
|
|
28
27
|
import { Fdc3Service } from '../../Utilities/Services/Fdc3Service';
|
|
29
28
|
import { CellPopupService } from '../../Utilities/Services/CellPopupService';
|
|
29
|
+
import { RowEditService } from '../../Utilities/Services/RowEditService';
|
|
30
30
|
export declare class AdaptableInternalApi extends ApiBase {
|
|
31
31
|
getSystemState(): SystemState;
|
|
32
32
|
showPopupConfirmation(confirmation: UIConfirmation): void;
|
|
@@ -46,8 +46,7 @@ export declare class AdaptableInternalApi extends ApiBase {
|
|
|
46
46
|
setPivotModeOn(): void;
|
|
47
47
|
setPivotModeOff(): void;
|
|
48
48
|
isGridInPivotMode(): boolean;
|
|
49
|
-
|
|
50
|
-
setTreeModeOff(): void;
|
|
49
|
+
setTreeMode(mode: boolean): void;
|
|
51
50
|
isGridInTreeMode(): boolean;
|
|
52
51
|
getToolbarTitle(): string;
|
|
53
52
|
buildDataChangedInfo(config: Pick<CellDataChangedInfo, 'newValue' | 'oldValue' | 'column' | 'primaryKeyValue' | 'rowNode' | 'trigger'>): CellDataChangedInfo;
|
|
@@ -65,7 +64,7 @@ export declare class AdaptableInternalApi extends ApiBase {
|
|
|
65
64
|
getAlertService(): IAlertService;
|
|
66
65
|
getTeamSharingService(): ITeamSharingService;
|
|
67
66
|
getMetamodelService(): IMetamodelService;
|
|
68
|
-
getRowEditService():
|
|
67
|
+
getRowEditService(): RowEditService;
|
|
69
68
|
getFdc3Service(): Fdc3Service;
|
|
70
69
|
getModules(): IModuleCollection;
|
|
71
70
|
getModuleFriendlyName(adaptableModule: AdaptableModule): string;
|
|
@@ -47,11 +47,13 @@ export class AdaptableInternalApi extends ApiBase {
|
|
|
47
47
|
isGridInPivotMode() {
|
|
48
48
|
return this.getAdaptableState().Grid.IsGridInPivotMode;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
setTreeMode(mode) {
|
|
51
|
+
if (!!mode) {
|
|
52
|
+
this.dispatchAction(GridRedux.SetTreeModeOn());
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.dispatchAction(GridRedux.SetTreeModeOff());
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
isGridInTreeMode() {
|
|
57
59
|
return this.getAdaptableState().Grid.IsGridInTreeMode;
|
|
@@ -219,13 +221,13 @@ export class AdaptableInternalApi extends ApiBase {
|
|
|
219
221
|
frameworkComponent,
|
|
220
222
|
componentType,
|
|
221
223
|
});
|
|
222
|
-
if (this.adaptable.
|
|
224
|
+
if (this.adaptable.isReady) {
|
|
223
225
|
createComponentFn();
|
|
224
226
|
}
|
|
225
227
|
else {
|
|
226
228
|
// adaptable may not be initialized yet if the framework component is part of the initial render
|
|
227
229
|
// AFL 2021.10.14 - not really sure if this is necessary anymore?! (see the other changes in this commit)
|
|
228
|
-
waitForCondition(() => this.adaptable.
|
|
230
|
+
waitForCondition(() => this.adaptable.isReady).then(() => {
|
|
229
231
|
createComponentFn();
|
|
230
232
|
});
|
|
231
233
|
}
|
|
@@ -448,7 +450,7 @@ export class AdaptableInternalApi extends ApiBase {
|
|
|
448
450
|
var _a;
|
|
449
451
|
let actionColumn;
|
|
450
452
|
if (colDef.colId == ADAPTABLE_ROW_ACTION_BUTTONS) {
|
|
451
|
-
const actionButtons = this.
|
|
453
|
+
const actionButtons = this.getActionRowApi().internalApi.getActionRowButtonDefs();
|
|
452
454
|
actionColumn = {
|
|
453
455
|
columnId: ADAPTABLE_ROW_ACTION_BUTTONS,
|
|
454
456
|
actionColumnButton: actionButtons,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
2
|
import { CalculatedColumn } from '../../PredefinedConfig/CalculatedColumnState';
|
|
3
3
|
import { AdaptableColumn } from '../../types';
|
|
4
|
+
import { ColDef } from '@ag-grid-community/core';
|
|
4
5
|
export declare class CalculatedColumnInternalApi extends ApiBase {
|
|
5
6
|
/**
|
|
6
7
|
* Returns all the references in the AdaptableState of the given CalculatedColumn
|
|
@@ -27,4 +28,5 @@ export declare class CalculatedColumnInternalApi extends ApiBase {
|
|
|
27
28
|
isQuantileAggregatedExpression(input: string): boolean;
|
|
28
29
|
getExpressionFromCalculatedColumn(calculatedColumn: CalculatedColumn): string;
|
|
29
30
|
fireCalculatedColumnChangedEvent(trigger: string, calculatedColumn: CalculatedColumn): void;
|
|
31
|
+
getColDefsForCalculatedColumns(): ColDef[];
|
|
30
32
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
+
import { CreateEmptyCalculatedColumn } from '../../Utilities/ObjectFactory';
|
|
3
|
+
import { AB_SPECIAL_COLUMN } from '../../Utilities/Constants/GeneralConstants';
|
|
4
|
+
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
5
|
+
import StringExtensions from '../../Utilities/Extensions/StringExtensions';
|
|
2
6
|
export class CalculatedColumnInternalApi extends ApiBase {
|
|
3
7
|
/**
|
|
4
8
|
* Returns all the references in the AdaptableState of the given CalculatedColumn
|
|
@@ -87,4 +91,70 @@ export class CalculatedColumnInternalApi extends ApiBase {
|
|
|
87
91
|
};
|
|
88
92
|
this.adaptable.api.eventApi.emit('CalculatedColumnChanged', calculatedColumnChangedInfo);
|
|
89
93
|
}
|
|
94
|
+
getColDefsForCalculatedColumns() {
|
|
95
|
+
const defaultCalculatedColumnSettings = CreateEmptyCalculatedColumn().CalculatedColumnSettings;
|
|
96
|
+
return this.getCalculatedColumnApi()
|
|
97
|
+
.getCalculatedColumns()
|
|
98
|
+
.map((calculatedColumn) => {
|
|
99
|
+
const calculatedColumnSettings = Object.assign(Object.assign({}, defaultCalculatedColumnSettings), calculatedColumn.CalculatedColumnSettings);
|
|
100
|
+
if (!calculatedColumnSettings.DataType) {
|
|
101
|
+
calculatedColumnSettings.DataType = this.getAdaptableApi()
|
|
102
|
+
.internalApi.getAdaptableInstance()
|
|
103
|
+
.CalculatedColumnExpressionService.getCalculatedColumnDataType(calculatedColumn.Query);
|
|
104
|
+
}
|
|
105
|
+
const columnTypes = [
|
|
106
|
+
AB_SPECIAL_COLUMN,
|
|
107
|
+
this.getGridApi().internalApi.getAgGridDataType(calculatedColumnSettings.DataType),
|
|
108
|
+
];
|
|
109
|
+
if (ArrayExtensions.IsNotNullOrEmpty(calculatedColumnSettings.ColumnTypes)) {
|
|
110
|
+
columnTypes.push(...calculatedColumnSettings.ColumnTypes);
|
|
111
|
+
}
|
|
112
|
+
const isExternalEvaluation = !this.getExpressionApi().internalApi.evaluateExpressionInAdaptableQL('CalculatedColumn', calculatedColumn, this.getExpressionApi().getAdaptableQueryExpression(calculatedColumn.Query));
|
|
113
|
+
const valueGetter = (params) => {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
if (isExternalEvaluation) {
|
|
116
|
+
return (_a = params.data) === null || _a === void 0 ? void 0 : _a[calculatedColumn.ColumnId];
|
|
117
|
+
}
|
|
118
|
+
// if the grid data is NOT client side, we can aggregate only simple scalar expression (which depend on row data, not on other rows)
|
|
119
|
+
if (this.getGridApi().getAgGridRowModelType() !== 'clientSide' &&
|
|
120
|
+
StringExtensions.IsNotNullOrEmpty(calculatedColumn.Query.AggregatedScalarExpression)) {
|
|
121
|
+
return (_b = params.data) === null || _b === void 0 ? void 0 : _b[calculatedColumn.ColumnId];
|
|
122
|
+
}
|
|
123
|
+
return this.getAdaptableApi()
|
|
124
|
+
.internalApi.getAdaptableInstance()
|
|
125
|
+
.CalculatedColumnExpressionService.evaluateCalculatedColumnQuery(calculatedColumn, params.node);
|
|
126
|
+
};
|
|
127
|
+
const newColDef = {
|
|
128
|
+
headerName: calculatedColumn.FriendlyName
|
|
129
|
+
? calculatedColumn.FriendlyName
|
|
130
|
+
: calculatedColumn.ColumnId,
|
|
131
|
+
colId: calculatedColumn.ColumnId,
|
|
132
|
+
hide: true,
|
|
133
|
+
editable: false,
|
|
134
|
+
width: calculatedColumnSettings.Width,
|
|
135
|
+
enableValue: calculatedColumnSettings.Aggregatable,
|
|
136
|
+
filter: calculatedColumnSettings.Filterable,
|
|
137
|
+
floatingFilter: calculatedColumnSettings.Filterable,
|
|
138
|
+
resizable: calculatedColumnSettings.Resizable,
|
|
139
|
+
enableRowGroup: calculatedColumnSettings.Groupable,
|
|
140
|
+
sortable: calculatedColumnSettings.Sortable,
|
|
141
|
+
enablePivot: calculatedColumnSettings.Pivotable,
|
|
142
|
+
suppressMenu: calculatedColumnSettings.SuppressMenu,
|
|
143
|
+
suppressMovable: calculatedColumnSettings.SuppressMovable,
|
|
144
|
+
type: columnTypes,
|
|
145
|
+
valueGetter,
|
|
146
|
+
};
|
|
147
|
+
if (calculatedColumnSettings.ShowToolTip != null &&
|
|
148
|
+
calculatedColumnSettings.ShowToolTip == true) {
|
|
149
|
+
newColDef.tooltipValueGetter = () => {
|
|
150
|
+
return this.getAdaptableApi().internalApi.getAdaptableQueryExpressionText(calculatedColumn.Query);
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (calculatedColumnSettings.HeaderToolTip) {
|
|
154
|
+
newColDef.headerTooltip = calculatedColumnSettings.HeaderToolTip;
|
|
155
|
+
}
|
|
156
|
+
this.getAdaptableApi().logInfo('Setting up Calculated Column: ' + calculatedColumn.ColumnId);
|
|
157
|
+
return newColDef;
|
|
158
|
+
});
|
|
159
|
+
}
|
|
90
160
|
}
|
|
@@ -56,4 +56,5 @@ export declare class ColumnFilterInternalApi extends ApiBase {
|
|
|
56
56
|
*/
|
|
57
57
|
areColumnFiltersDifferent(oldFilters: ColumnFilter[], newFilters: ColumnFilter[]): boolean;
|
|
58
58
|
getPredicateDefShortcuts(predicateDef: AdaptablePredicateDef): string[];
|
|
59
|
+
getFilterValuesMaxNumberOfItems(column: AdaptableColumn): number | undefined;
|
|
59
60
|
}
|
|
@@ -171,7 +171,7 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
171
171
|
* Fires Column Filter Applied Event - typically used to enable filtering on the server
|
|
172
172
|
*/
|
|
173
173
|
fireColumnFilterAppliedEvent() {
|
|
174
|
-
if (this.adaptable.
|
|
174
|
+
if (this.adaptable.isReady) {
|
|
175
175
|
const adaptableApi = this.getAdaptableApi();
|
|
176
176
|
const columnFilterAppliedInfo = {
|
|
177
177
|
columnFilters: this.getColumnFilterApi().getColumnFilters(),
|
|
@@ -202,4 +202,14 @@ export class ColumnFilterInternalApi extends ApiBase {
|
|
|
202
202
|
}
|
|
203
203
|
return predicateShortcuts;
|
|
204
204
|
}
|
|
205
|
+
getFilterValuesMaxNumberOfItems(column) {
|
|
206
|
+
const maxFilterValues = this.getColumnFilterOptions().valuesFilterOptions.maxFilterValuesToDisplay;
|
|
207
|
+
if (typeof maxFilterValues === 'function') {
|
|
208
|
+
const columnFilterContext = Object.assign(Object.assign({}, this.getAdaptableApi().internalApi.buildBaseContext()), { column: column });
|
|
209
|
+
return maxFilterValues(columnFilterContext);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
return maxFilterValues;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
205
215
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
-
import { Column } from '@ag-grid-community/core';
|
|
2
|
+
import { Column, IRowNode } from '@ag-grid-community/core';
|
|
3
|
+
import { CustomSort } from '../../PredefinedConfig/CustomSortState';
|
|
4
|
+
import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
|
|
3
5
|
export declare class ColumnInternalApi extends ApiBase {
|
|
4
6
|
/**
|
|
5
7
|
* Retrieves 'ColumnType' property for a given Column
|
|
@@ -24,4 +26,5 @@ export declare class ColumnInternalApi extends ApiBase {
|
|
|
24
26
|
*/
|
|
25
27
|
getAgGridColumnForAdaptableColumn(columnId: string): Column;
|
|
26
28
|
isActionRowButtonColumn(columnId: string): boolean;
|
|
29
|
+
getActiveColumnComparator(columnId: string, customSort?: CustomSort, customSortComparer?: ColumnValuesComparer): (valueA: any, valueB: any, nodeA?: IRowNode, nodeB?: IRowNode, isInverted?: boolean) => number | undefined;
|
|
27
30
|
}
|
|
@@ -39,4 +39,16 @@ export class ColumnInternalApi extends ApiBase {
|
|
|
39
39
|
isActionRowButtonColumn(columnId) {
|
|
40
40
|
return columnId === ADAPTABLE_ROW_ACTION_BUTTONS;
|
|
41
41
|
}
|
|
42
|
+
getActiveColumnComparator(columnId, customSort, customSortComparer) {
|
|
43
|
+
if ((!customSort || (customSort === null || customSort === void 0 ? void 0 : customSort.IsSuspended)) && !customSortComparer) {
|
|
44
|
+
// defaults to AG-Grid column definition comparator if no CustomSort is defined&active
|
|
45
|
+
const colDefComparator = this.adaptable.agGridColumnAdapter.getUserColDefProperty(columnId, 'comparator');
|
|
46
|
+
return colDefComparator;
|
|
47
|
+
}
|
|
48
|
+
// CustomSort Comparer function takes precedence over CustomSort SortedValues
|
|
49
|
+
const comparerFunction = customSortComparer
|
|
50
|
+
? customSortComparer.comparer
|
|
51
|
+
: this.getCustomSortApi().internalApi.getDefaultCustomSortComparer(customSort.ColumnId, customSort.SortedValues);
|
|
52
|
+
return comparerFunction;
|
|
53
|
+
}
|
|
42
54
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
-
import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
|
|
3
2
|
import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
|
|
3
|
+
import { AdaptableComparerFunction } from '../../PredefinedConfig/Common/AdaptableComparerFunction';
|
|
4
4
|
export declare class CustomSortInternalApi extends ApiBase {
|
|
5
|
-
getCustomSortComparer(
|
|
5
|
+
getCustomSortComparer(columnId: string): ColumnValuesComparer | undefined;
|
|
6
|
+
getDefaultCustomSortComparer(columnId: string, columnValues: any[]): AdaptableComparerFunction;
|
|
6
7
|
}
|
|
@@ -1,7 +1,38 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
2
|
export class CustomSortInternalApi extends ApiBase {
|
|
3
|
-
getCustomSortComparer(
|
|
3
|
+
getCustomSortComparer(columnId) {
|
|
4
4
|
var _a;
|
|
5
|
+
const column = this.getColumnApi().getColumnWithColumnId(columnId);
|
|
5
6
|
return (_a = this.getCustomSortOptions().customSortComparers) === null || _a === void 0 ? void 0 : _a.find((csc) => this.adaptable.api.scopeApi.isColumnInScope(column, csc.scope));
|
|
6
7
|
}
|
|
8
|
+
getDefaultCustomSortComparer(columnId, columnValues) {
|
|
9
|
+
// have to return a function that may not have access to this
|
|
10
|
+
const adaptable = this.adaptable;
|
|
11
|
+
return function compareItemsOfCustomSort(valueA, valueB, nodeA, nodeB) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
let firstElementValueString = (_a = (nodeA && adaptable.getDisplayValueFromRowNode(nodeA, columnId))) !== null && _a !== void 0 ? _a : valueA;
|
|
14
|
+
let secondElementValueString = (_b = (nodeB && adaptable.getDisplayValueFromRowNode(nodeB, columnId))) !== null && _b !== void 0 ? _b : valueB;
|
|
15
|
+
let indexFirstElement = columnValues.indexOf(firstElementValueString);
|
|
16
|
+
let containsFirstElement = indexFirstElement >= 0;
|
|
17
|
+
let indexSecondElement = columnValues.indexOf(secondElementValueString);
|
|
18
|
+
let containsSecondElement = indexSecondElement >= 0;
|
|
19
|
+
//if none of the element are in the list we jsut return normal compare
|
|
20
|
+
if (!containsFirstElement && !containsSecondElement) {
|
|
21
|
+
if (valueA == valueB) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
return valueA < valueB ? -1 : 1;
|
|
25
|
+
}
|
|
26
|
+
//if first item not in the list make sure we put it after the second item
|
|
27
|
+
if (!containsFirstElement) {
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
//if second item not in the list make sure we put it after the first item
|
|
31
|
+
if (!containsSecondElement) {
|
|
32
|
+
return -1;
|
|
33
|
+
}
|
|
34
|
+
//return the comparison from the list if the two items are in the list
|
|
35
|
+
return indexFirstElement - indexSecondElement;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
7
38
|
}
|
|
@@ -5,7 +5,7 @@ export class DataSetInternalApi extends ApiBase {
|
|
|
5
5
|
* @param dataSet Data Set which has been selected
|
|
6
6
|
*/
|
|
7
7
|
fireDataSetSelectedEvent(dataSet) {
|
|
8
|
-
if (this.adaptable.
|
|
8
|
+
if (this.adaptable.isReady) {
|
|
9
9
|
const dataSetSelectedInfo = {
|
|
10
10
|
adaptableApi: this.adaptable.api,
|
|
11
11
|
dataSet,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
2
|
import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
|
|
3
3
|
import { FreeTextColumn } from '../../PredefinedConfig/FreeTextColumnState';
|
|
4
|
+
import { ColDef } from '@ag-grid-community/core';
|
|
4
5
|
export declare class FreeTextColumnInternalApi extends ApiBase {
|
|
5
6
|
/**
|
|
6
7
|
* Checks if a User Edit was in a Free Text Column
|
|
@@ -12,4 +13,5 @@ export declare class FreeTextColumnInternalApi extends ApiBase {
|
|
|
12
13
|
* @param freeTextColumn FreeTextColumn to be checked
|
|
13
14
|
*/
|
|
14
15
|
getFreeTextColumnModuleReferences(freeTextColumn: FreeTextColumn): string[];
|
|
16
|
+
getColDefsForFreeTextColumns(): ColDef<any, any>[];
|
|
15
17
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ApiBase } from '../Implementation/ApiBase';
|
|
2
|
+
import { CreateEmptyFreeTextColumn } from '../../Utilities/ObjectFactory';
|
|
3
|
+
import { AdaptableNumberEditor } from '../../agGrid/editors/AdaptableNumberEditor';
|
|
4
|
+
import { AdaptableDateEditor } from '../../agGrid/editors/AdaptableDateEditor';
|
|
5
|
+
import { AB_SPECIAL_COLUMN } from '../../Utilities/Constants/GeneralConstants';
|
|
6
|
+
import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
|
|
2
7
|
export class FreeTextColumnInternalApi extends ApiBase {
|
|
3
8
|
/**
|
|
4
9
|
* Checks if a User Edit was in a Free Text Column
|
|
@@ -37,4 +42,58 @@ export class FreeTextColumnInternalApi extends ApiBase {
|
|
|
37
42
|
});
|
|
38
43
|
return references;
|
|
39
44
|
}
|
|
45
|
+
getColDefsForFreeTextColumns() {
|
|
46
|
+
const defaultFreeTextColumnSettings = CreateEmptyFreeTextColumn().FreeTextColumnSettings;
|
|
47
|
+
return this.getFreeTextColumnApi()
|
|
48
|
+
.getFreeTextColumns()
|
|
49
|
+
.map((freeTextColumn) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const freeTextColumnSettings = Object.assign(Object.assign({}, defaultFreeTextColumnSettings), freeTextColumn.FreeTextColumnSettings);
|
|
52
|
+
const dataTypeEditor = freeTextColumnSettings.DataType === 'Number'
|
|
53
|
+
? AdaptableNumberEditor
|
|
54
|
+
: freeTextColumnSettings.DataType === 'Date'
|
|
55
|
+
? AdaptableDateEditor
|
|
56
|
+
: null;
|
|
57
|
+
const columnTypes = [
|
|
58
|
+
AB_SPECIAL_COLUMN,
|
|
59
|
+
this.getGridApi().internalApi.getAgGridDataType(freeTextColumnSettings.DataType),
|
|
60
|
+
];
|
|
61
|
+
if (ArrayExtensions.IsNotNullOrEmpty((_a = freeTextColumn === null || freeTextColumn === void 0 ? void 0 : freeTextColumn.FreeTextColumnSettings) === null || _a === void 0 ? void 0 : _a.ColumnTypes)) {
|
|
62
|
+
columnTypes.push(...freeTextColumn.FreeTextColumnSettings.ColumnTypes);
|
|
63
|
+
}
|
|
64
|
+
const newColDef = {
|
|
65
|
+
headerName: freeTextColumn.FriendlyName || freeTextColumn.ColumnId,
|
|
66
|
+
colId: freeTextColumn.ColumnId,
|
|
67
|
+
editable: true,
|
|
68
|
+
hide: true,
|
|
69
|
+
width: freeTextColumnSettings.Width,
|
|
70
|
+
enableValue: freeTextColumnSettings.Aggregatable,
|
|
71
|
+
filter: freeTextColumnSettings.Filterable,
|
|
72
|
+
floatingFilter: freeTextColumnSettings.Filterable,
|
|
73
|
+
resizable: freeTextColumnSettings.Resizable,
|
|
74
|
+
enableRowGroup: freeTextColumnSettings.Groupable,
|
|
75
|
+
sortable: freeTextColumnSettings.Sortable,
|
|
76
|
+
enablePivot: freeTextColumnSettings.Pivotable,
|
|
77
|
+
suppressMenu: freeTextColumnSettings.SuppressMenu,
|
|
78
|
+
suppressMovable: freeTextColumnSettings.SuppressMovable,
|
|
79
|
+
cellEditor: dataTypeEditor !== null && dataTypeEditor !== void 0 ? dataTypeEditor : (freeTextColumn.TextEditor && freeTextColumn.TextEditor == 'Large'
|
|
80
|
+
? 'agLargeTextCellEditor'
|
|
81
|
+
: 'agTextCellEditor'),
|
|
82
|
+
type: columnTypes,
|
|
83
|
+
valueSetter: (params) => {
|
|
84
|
+
return (params.data[freeTextColumn.ColumnId] = params.newValue);
|
|
85
|
+
},
|
|
86
|
+
// use a Boolean Cell Data Type if the Free Text Column is boolean
|
|
87
|
+
cellDataType: freeTextColumnSettings.DataType && freeTextColumnSettings.DataType == 'Boolean'
|
|
88
|
+
? 'boolean'
|
|
89
|
+
: undefined,
|
|
90
|
+
valueGetter: (params) => this.getFreeTextColumnApi().getFreeTextColumnValueForRowNode(freeTextColumn, params.node),
|
|
91
|
+
};
|
|
92
|
+
if (freeTextColumnSettings.HeaderToolTip) {
|
|
93
|
+
newColDef.headerTooltip = freeTextColumnSettings.HeaderToolTip;
|
|
94
|
+
}
|
|
95
|
+
this.getAdaptableApi().logInfo('Setting up FreeText Column: ' + freeTextColumn.ColumnId);
|
|
96
|
+
return newColDef;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
40
99
|
}
|