@adaptabletools/adaptable 15.2.0-canary.2 → 15.2.0-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "15.2.0-canary.2",
3
+ "version": "15.2.0-canary.3",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1680846291184;
1
+ declare const _default: 1680872029172;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1680846291184;
3
+ exports.default = 1680872029172;
@@ -1,4 +1,4 @@
1
- import { ChartModel, ChartRef, Column, GridOptions, ModuleNames, IRowNode, StatusPanelDef } from '@ag-grid-community/core';
1
+ import { ChartModel, ChartRef, Column, IRowNode, ModuleNames, RowModelType, StatusPanelDef } from '@ag-grid-community/core';
2
2
  import { AdaptableApi } from '../Api/AdaptableApi';
3
3
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
4
4
  import { ColumnSort } from '../PredefinedConfig/Common/ColumnSort';
@@ -235,7 +235,7 @@ export interface IAdaptable {
235
235
  showChart(chart: ChartDefinition, container?: HTMLElement): ChartRef;
236
236
  getChartRef(chardId: string): ChartRef;
237
237
  getChartModels(): ChartModel[];
238
- getRowModel(): GridOptions['rowModelType'];
238
+ getRowModelType(): RowModelType;
239
239
  getCurrentIPPStyle(): IPPStyle;
240
240
  getDefaultIPPStyle(): IPPStyle;
241
241
  getRowCount(): number;
@@ -1,7 +1,7 @@
1
1
  import { AdaptableForm } from '../PredefinedConfig/Common/AdaptableForm';
2
2
  import { FormContext } from '../PredefinedConfig/Common/FormContext';
3
3
  import { Report, ReportData, SystemReportNames } from '../PredefinedConfig/ExportState';
4
- import { AdaptableColumnBase, BaseContext } from '../types';
4
+ import { AdaptableColumnDataType, BaseContext } from '../types';
5
5
  /**
6
6
  * Options regarding Exporting data from AdapTable
7
7
  */
@@ -29,6 +29,8 @@ export interface ExportOptions {
29
29
  customDestinations?: CustomDestination[];
30
30
  /**
31
31
  * Reports generated entirely by users (and not AdapTable)
32
+ *
33
+ * @deprecated It will be renamed to `externalReports` in version 16
32
34
  */
33
35
  serverReports?: ServerReport[];
34
36
  /**
@@ -77,13 +79,34 @@ export interface PreProcessExportContext extends BaseContext {
77
79
  * Returns the columns which would be included in the report based on the `Report.ReportColumnScope`
78
80
  * @param includePrimaryKey - whether to include the primary key column (defaults to `false`)
79
81
  */
80
- getReportColumns: (includePrimaryKey?: boolean) => AdaptableColumnBase[];
82
+ getReportColumns: (includePrimaryKey?: boolean) => AdaptableReportColumn[];
81
83
  /**
82
84
  * Returns the row data which would be included in the report based on the `Report.ReportRowScope`
83
85
  * @param reportColumns - the columns to include in the report
84
86
  * @param includePrimaryKey - whether to include the primary key column (defaults to `false`)
85
87
  */
86
- getReportRowData: (reportColumns: AdaptableColumnBase[], includePrimaryKey?: boolean) => Record<string, any>[];
88
+ getReportRowData: (reportColumns: AdaptableReportColumn[], includePrimaryKey?: boolean) => Record<string, any>[];
89
+ }
90
+ /**
91
+ * Column which is included in a Report
92
+ */
93
+ export interface AdaptableReportColumn {
94
+ /**
95
+ * ColumnID
96
+ */
97
+ columnId: string;
98
+ /**
99
+ * Column Header
100
+ */
101
+ friendlyName: string;
102
+ /**
103
+ * Field name to get the value from the row data (defaults to `columnId`)
104
+ */
105
+ field?: string;
106
+ /**
107
+ * DataType of the Column
108
+ */
109
+ dataType: AdaptableColumnDataType;
87
110
  }
88
111
  /**
89
112
  * Format of exported Data - 'rawValue' or 'formattedValue'
@@ -164,5 +187,5 @@ export interface ExportableColumnContext extends BaseContext {
164
187
  /**
165
188
  * Column to be exported
166
189
  */
167
- adaptableColumn: AdaptableColumnBase;
190
+ adaptableColumn: AdaptableReportColumn;
168
191
  }
@@ -9,7 +9,7 @@ import { CellHighlightInfo } from '../PredefinedConfig/Common/CellHighlightInfo'
9
9
  import { RowHighlightInfo } from '../PredefinedConfig/Common/RowHighlightInfo';
10
10
  import { AdaptableModule } from '../PredefinedConfig/Common/Types';
11
11
  import { AccessLevel } from '../PredefinedConfig/Common/Entitlement';
12
- import { GridOptions, IRowNode } from '@ag-grid-community/core';
12
+ import { GridOptions, IRowNode, RowModelType } from '@ag-grid-community/core';
13
13
  import { GridCellRange } from '../PredefinedConfig/Selection/GridCellRange';
14
14
  import { RowsHighlightInfo } from '../PredefinedConfig/Common/RowsHighlightInfo';
15
15
  /**
@@ -485,6 +485,10 @@ export interface GridApi {
485
485
  * Opens Settings Panel with Grid Info section selected and visible
486
486
  */
487
487
  openGridInfoSettingsPanel(): void;
488
+ /**
489
+ * Returns the current AG Grid Row Model Type
490
+ */
491
+ getRowModelType(): RowModelType;
488
492
  /**
489
493
  * TO BE REMOVED
490
494
  */
@@ -3,11 +3,10 @@ import { ExportState, Report, ReportData, ReportSchedule, SystemReportNames } fr
3
3
  import { ApiBase } from './ApiBase';
4
4
  import { AdaptableForm } from '../../PredefinedConfig/Common/AdaptableForm';
5
5
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
6
- import { CustomDestination, ExportFormContext, ServerReport } from '../../AdaptableOptions/ExportOptions';
6
+ import { AdaptableReportColumn, CustomDestination, ExportFormContext, ServerReport } from '../../AdaptableOptions/ExportOptions';
7
7
  import { ExportDestination } from '../../PredefinedConfig/Common/Enums';
8
8
  import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
9
9
  import { ExportInternalApi } from '../Internal/ExportInternalApi';
10
- import { AdaptableColumnBase } from '../../types';
11
10
  export declare class ExportApiImpl extends ApiBase implements ExportApi {
12
11
  internalApi: ExportInternalApi;
13
12
  constructor(adaptable: IAdaptable);
@@ -43,5 +42,5 @@ export declare class ExportApiImpl extends ApiBase implements ExportApi {
43
42
  isServerReport(report: Report): boolean;
44
43
  runServerReport(serverReportName: string): ReportData | undefined;
45
44
  getReportDataForReport(reportName: string): ReportData | undefined;
46
- isColumnExportable(adaptableColumn: AdaptableColumnBase): boolean;
45
+ isColumnExportable(adaptableColumn: AdaptableReportColumn): boolean;
47
46
  }
@@ -8,7 +8,7 @@ import { ColumnSort } from '../../PredefinedConfig/Common/ColumnSort';
8
8
  import { DataUpdateConfig } from '../../PredefinedConfig/Common/DataUpdateConfig';
9
9
  import { CellHighlightInfo } from '../../PredefinedConfig/Common/CellHighlightInfo';
10
10
  import { RowHighlightInfo } from '../../PredefinedConfig/Common/RowHighlightInfo';
11
- import { GridOptions, IRowNode } from '@ag-grid-community/core';
11
+ import { GridOptions, IRowNode, RowModelType } from '@ag-grid-community/core';
12
12
  import { GridCellRange } from '../../PredefinedConfig/Selection/GridCellRange';
13
13
  import { CellDataChangedInfo } from '../../PredefinedConfig/Common/CellDataChangedInfo';
14
14
  import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
@@ -139,4 +139,5 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
139
139
  getGridContainerElement(): HTMLElement | null;
140
140
  showGridInfoPopup(): void;
141
141
  openGridInfoSettingsPanel(): void;
142
+ getRowModelType(): RowModelType;
142
143
  }
@@ -515,5 +515,8 @@ class GridApiImpl extends ApiBase_1.ApiBase {
515
515
  openGridInfoSettingsPanel() {
516
516
  this.showModulePopup(ModuleConstants.GridInfoModuleId);
517
517
  }
518
+ getRowModelType() {
519
+ return this.adaptable.getRowModelType();
520
+ }
518
521
  }
519
522
  exports.GridApiImpl = GridApiImpl;
@@ -258,7 +258,7 @@ class LayoutApiImpl extends ApiBase_1.ApiBase {
258
258
  ColumnFilters: true,
259
259
  ColumnSorts: true,
260
260
  };
261
- if (this.adaptable.getRowModel() === 'viewport') {
261
+ if (this.getGridApi().getRowModelType() === 'viewport') {
262
262
  layoutSupportedFeatures.RowGroupedColumns = false;
263
263
  layoutSupportedFeatures.AggregationColumns = false;
264
264
  layoutSupportedFeatures.PivotColumns = false;
@@ -117,7 +117,7 @@ class LayoutInternalApi extends ApiBase_1.ApiBase {
117
117
  ColumnFilters: true,
118
118
  ColumnSorts: true,
119
119
  };
120
- if (this.adaptable.getRowModel() === 'viewport') {
120
+ if (this.getGridApi().getRowModelType() === 'viewport') {
121
121
  layoutSupportedFeatures.RowGroupedColumns = false;
122
122
  layoutSupportedFeatures.AggregationColumns = false;
123
123
  layoutSupportedFeatures.PivotColumns = false;
@@ -65,7 +65,7 @@ class LayoutModule extends AdaptableModuleBase_1.AdaptableModuleBase {
65
65
  * logic where layout is applied, it is easier and
66
66
  * less error prone to just remove it.
67
67
  */
68
- if (this.api.internalApi.getAdaptableInstance().getRowModel() === 'viewport') {
68
+ if (this.api.gridApi.getRowModelType() === 'viewport') {
69
69
  this.api.layoutApi.getLayouts().forEach(this.clearUnsuportedFeaturesFromLayout);
70
70
  }
71
71
  }
@@ -1,8 +1,8 @@
1
- import { AdaptableColumn, AdaptableColumnBase } from '../../PredefinedConfig/Common/AdaptableColumn';
1
+ import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
2
2
  import { Report, ReportData, SystemReportName } from '../../PredefinedConfig/ExportState';
3
3
  import { IReportService } from './Interface/IReportService';
4
4
  import { ExcelStyle, IRowNode } from '@ag-grid-community/core';
5
- import { SystemExportDestination } from '../../AdaptableOptions/ExportOptions';
5
+ import { AdaptableReportColumn, SystemExportDestination } from '../../AdaptableOptions/ExportOptions';
6
6
  import { AdaptableApi } from '../../../types';
7
7
  export declare class ReportService implements IReportService {
8
8
  private adaptableApi;
@@ -23,8 +23,8 @@ export declare class ReportService implements IReportService {
23
23
  GetReportColumnScopeShortDescription(report: Report): string[];
24
24
  GetReportColumnScopeLongDescription(report: Report): string;
25
25
  GetReportExpressionDescription(report: Report, cols: AdaptableColumn[]): string;
26
- getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableColumnBase[];
27
- getReportDataRows(report: Report, columns: AdaptableColumnBase[], includePrimaryKey?: boolean): Record<string, any>[];
26
+ getReportDataColumns(report: Report, includePrimaryKey?: boolean): AdaptableReportColumn[];
27
+ getReportDataRows(report: Report, columns: AdaptableReportColumn[], includePrimaryKey?: boolean): Record<string, any>[];
28
28
  getReportData(report: Report, includePrimaryKey?: boolean): ReportData;
29
29
  getReportDataAsArray(report: Report, includePrimaryKey?: boolean): any[][];
30
30
  convertReportDataToArray(reportData: ReportData): any[][];
@@ -224,11 +224,15 @@ class ReportService {
224
224
  reportColumns.push(this.adaptableApi.columnApi.getPrimaryKeyColumn());
225
225
  }
226
226
  }
227
- return reportColumns.map((column) => ({
228
- columnId: column.columnId,
229
- friendlyName: column.friendlyName,
230
- dataType: column.dataType,
231
- }));
227
+ return reportColumns.map((column) => {
228
+ var _a;
229
+ return ({
230
+ columnId: column.columnId,
231
+ friendlyName: column.friendlyName,
232
+ dataType: column.dataType,
233
+ field: (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId,
234
+ });
235
+ });
232
236
  }
233
237
  getReportDataRows(report, columns, includePrimaryKey) {
234
238
  var _a, _b;
@@ -219,7 +219,7 @@ export declare class Adaptable implements IAdaptable {
219
219
  getRowNodeForPrimaryKey(primaryKeyValue: any): any;
220
220
  getRowNodeByIndex(index: number): IRowNode;
221
221
  getRowNodesForPrimaryKeys(primaryKeyValues: any[]): any[];
222
- forAllRowNodesDo(func: (rowNode: IRowNode) => void, config?: {
222
+ forAllRowNodesDo(func: (rowNode: IRowNode, rowIndex: number) => void, config?: {
223
223
  includeGroupRows?: boolean;
224
224
  filterFn?: (rowNode: IRowNode) => boolean;
225
225
  }): void;
@@ -398,7 +398,7 @@ export declare class Adaptable implements IAdaptable {
398
398
  showChart(chartDefinition: ChartDefinition, container?: HTMLElement): ChartRef;
399
399
  getChartRef(chartId: string): ChartRef;
400
400
  getChartModels(): import("@ag-grid-community/core").ChartModel[];
401
- getRowModel(): import("@ag-grid-community/core").RowModelType;
401
+ getRowModelType(): import("@ag-grid-community/core").RowModelType;
402
402
  private getActiveAdaptableAggFuncForCol;
403
403
  private registerAdaptableAggFuncs;
404
404
  /**
@@ -2104,15 +2104,21 @@ class Adaptable {
2104
2104
  return rowNodes;
2105
2105
  }
2106
2106
  forAllRowNodesDo(func, config) {
2107
- this.gridOptions.api.forEachNode((rowNode) => {
2107
+ this.gridOptions.api.forEachNode((rowNode, rowIndex) => {
2108
2108
  const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
2109
2109
  const filterFnFulfilled = !(config === null || config === void 0 ? void 0 : config.filterFn) || (config === null || config === void 0 ? void 0 : config.filterFn(rowNode));
2110
2110
  if (includeGroupRows && filterFnFulfilled) {
2111
- func(rowNode);
2111
+ func(rowNode, rowIndex);
2112
2112
  }
2113
2113
  });
2114
2114
  }
2115
2115
  forAllVisibleRowNodesDo(func, config) {
2116
+ if (this.getRowModelType() !== 'clientSide') {
2117
+ // only in client-side row model can we loop through filtered&sorted rows
2118
+ // see https://www.ag-grid.com/javascript-data-grid/accessing-data/#iterating-rows
2119
+ this.logger.warn('`forAllVisibleRowNodesDo()` is only supported in client-side row model. `forAllRowNodesDo` will be used instead.');
2120
+ return this.forAllRowNodesDo(func, config);
2121
+ }
2116
2122
  this.gridOptions.api.forEachNodeAfterFilterAndSort((rowNode, rowIndex) => {
2117
2123
  const includeGroupRows = (config === null || config === void 0 ? void 0 : config.includeGroupRows) || !this.isGroupRowNode(rowNode);
2118
2124
  const filterFnFulfilled = !(config === null || config === void 0 ? void 0 : config.filterFn) || (config === null || config === void 0 ? void 0 : config.filterFn(rowNode));
@@ -4884,7 +4890,7 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4884
4890
  }
4885
4891
  return this.gridOptions.api.getChartModels();
4886
4892
  }
4887
- getRowModel() {
4893
+ getRowModelType() {
4888
4894
  return this.gridOptions.rowModelType;
4889
4895
  }
4890
4896
  getActiveAdaptableAggFuncForCol(columnId) {
@@ -790,6 +790,30 @@ export declare const ADAPTABLE_METAMODEL: {
790
790
  kind: string;
791
791
  desc: string;
792
792
  };
793
+ AdaptableReportColumn: {
794
+ name: string;
795
+ kind: string;
796
+ desc: string;
797
+ props: ({
798
+ name: string;
799
+ kind: string;
800
+ desc: string;
801
+ ref?: undefined;
802
+ isOpt?: undefined;
803
+ } | {
804
+ name: string;
805
+ kind: string;
806
+ desc: string;
807
+ ref: string;
808
+ isOpt?: undefined;
809
+ } | {
810
+ name: string;
811
+ kind: string;
812
+ desc: string;
813
+ isOpt: boolean;
814
+ ref?: undefined;
815
+ })[];
816
+ };
793
817
  AdaptableRowChangedAlert: {
794
818
  name: string;
795
819
  kind: string;