@adaptabletools/adaptable 18.0.0-canary.13 → 18.0.0-canary.14

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": "18.0.0-canary.13",
3
+ "version": "18.0.0-canary.14",
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",
@@ -27,11 +27,11 @@ import { IMetamodelService } from '../Utilities/Services/Interface/IMetamodelSer
27
27
  import { RenderReactRootFn } from '../renderReactRoot';
28
28
  import { AdaptableLogger } from '../agGrid/AdaptableLogger';
29
29
  import { Fdc3Service } from '../Utilities/Services/Fdc3Service';
30
- import { SummaryService } from '../Utilities/Services/SummaryService';
31
30
  import { AgGridAdapter } from '../agGrid/AgGridAdapter';
32
31
  import { AgGridColumnAdapter } from '../agGrid/AgGridColumnAdapter';
33
32
  import { AgGridMenuAdapter } from '../agGrid/AgGridMenuAdapter';
34
33
  import { RowEditService } from '../Utilities/Services/RowEditService';
34
+ import { ISummaryService } from '../Utilities/Services/Interface/ISummaryService';
35
35
  /**
36
36
  * Contains AG Grid Options and Modules - used when instantiating AdapTable vanilla
37
37
  */
@@ -91,7 +91,7 @@ export interface IAdaptable {
91
91
  RowEditService: RowEditService;
92
92
  Fdc3Service: Fdc3Service;
93
93
  CellPopupService: CellPopupService;
94
- SummaryService: SummaryService;
94
+ SummaryService: ISummaryService;
95
95
  /**
96
96
  * INTERNAL ADAPTABLE EVENTS
97
97
  * These are not called externally - for that we use eventapi
@@ -27,6 +27,7 @@ import { AdaptableObjectTag, AdaptableObjectWithScope } from '../../PredefinedCo
27
27
  import { Fdc3Service } from '../../Utilities/Services/Fdc3Service';
28
28
  import { CellPopupService } from '../../Utilities/Services/CellPopupService';
29
29
  import { RowEditService } from '../../Utilities/Services/RowEditService';
30
+ import { ISummaryService } from '../../Utilities/Services/Interface/ISummaryService';
30
31
  export declare class AdaptableInternalApi extends ApiBase {
31
32
  getSystemState(): SystemState;
32
33
  showPopupConfirmation(confirmation: UIConfirmation): void;
@@ -60,6 +61,7 @@ export declare class AdaptableInternalApi extends ApiBase {
60
61
  getReportService(): IReportService;
61
62
  getCalculatedColumnExpressionService(): ICalculatedColumnExpressionService;
62
63
  getEntitlementService(): IEntitlementService;
64
+ getSummaryService(): ISummaryService;
63
65
  getQueryLanguageService(): IQueryLanguageService;
64
66
  getAlertService(): IAlertService;
65
67
  getTeamSharingService(): ITeamSharingService;
@@ -102,6 +102,9 @@ export class AdaptableInternalApi extends ApiBase {
102
102
  getEntitlementService() {
103
103
  return this.adaptable.EntitlementService;
104
104
  }
105
+ getSummaryService() {
106
+ return this.adaptable.SummaryService;
107
+ }
105
108
  getQueryLanguageService() {
106
109
  return this.adaptable.QueryLanguageService;
107
110
  }
@@ -1,4 +1,4 @@
1
- import { SummarySupportedExpression } from '../../Utilities/Services/SummaryService';
1
+ import { SummarySupportedExpression } from "../../Utilities/Services/Interface/ISummaryService";
2
2
  export declare const ROW_SUMMARY_ROW_ID = "__ROW_SUMMARY_ROW_ID";
3
3
  /**
4
4
  * Position of Row Summary - 'Top' or 'Bottom'
@@ -8,6 +8,12 @@ export type RowSummaryPosition = 'Top' | 'Bottom';
8
8
  * Defines a Row Summary used in a Layout
9
9
  */
10
10
  export interface RowSummary {
11
+ /**
12
+ * Where Row Summary appears - 'Top' or 'Bottom'
13
+ */
11
14
  Position?: RowSummaryPosition;
15
+ /**
16
+ * Map of Columns with Summary Expressions
17
+ */
12
18
  ColumnsMap: Record<string, SummarySupportedExpression>;
13
19
  }
@@ -1,6 +1,25 @@
1
+ /**
2
+ * Config used when transposing a Grid
3
+ */
1
4
  export interface TransposeConfig {
5
+ /**
6
+ * Column to use to do transposition
7
+ * @defaultValue Primary Key Column
8
+ */
2
9
  transposedColumnId?: string;
10
+ /**
11
+ * Hide the Transposed Column
12
+ * @defaultValue true
13
+ */
3
14
  hideTransposedColumn?: boolean;
15
+ /**
16
+ * Only show curerntly visible Columns
17
+ * @defaultValue false
18
+ */
4
19
  visibleColumns?: boolean;
20
+ /**
21
+ * Only show curerntly visible Rows
22
+ * @defaultValue false
23
+ */
5
24
  visibleRows?: boolean;
6
25
  }
@@ -84,7 +84,7 @@ export interface Layout extends AdaptableObject {
84
84
  */
85
85
  SuppressAggFuncInHeader?: boolean;
86
86
  /**
87
- * Row summaries
87
+ * Row Summaries - Pinned Rows that display Aggregation Info for a whole column
88
88
  */
89
89
  RowSummaries?: RowSummary[];
90
90
  }
@@ -91,7 +91,8 @@ export class CellSummaryModule extends AdaptableModuleBase {
91
91
  const handleExpression = (functionName) => {
92
92
  const columnId = selectedCellInfo.columns[0].columnId;
93
93
  const rowNodes = selectedCellInfo.gridCells.map((gc) => gc.rowNode);
94
- return this.api.internalApi.getAdaptableInstance().SummaryService.evaluateExpressionValue({
94
+ return this.api.internalApi
95
+ .getSummaryService().evaluateExpressionValue({
95
96
  expression: {
96
97
  function: functionName,
97
98
  },
@@ -328,7 +328,7 @@ export const aggregatedScalarExpressionFunctions = {
328
328
  handler(args, context) {
329
329
  const modeColumnParameter = extractColumnParameter('mode', args);
330
330
  const modeColumnName = modeColumnParameter.value;
331
- validateColumnType(modeColumnName, ['Number'], 'mode', context.adaptableApi);
331
+ validateColumnType(modeColumnName, ['Number', 'String'], 'mode', context.adaptableApi);
332
332
  const groupByParameter = extractParameter('MODE', 'operand', ['GROUP_BY'], args, {
333
333
  isOptional: true,
334
334
  });
@@ -342,7 +342,10 @@ export const aggregatedScalarExpressionFunctions = {
342
342
  reducer: (aggregatedValue, rowValue, rowNode) => {
343
343
  var _a;
344
344
  if (typeof rowValue !== 'number' && typeof rowValue !== 'string') {
345
- return;
345
+ return aggregatedValue;
346
+ }
347
+ if (!aggregatedValue) {
348
+ return new Map();
346
349
  }
347
350
  aggregatedValue.set(rowValue, ((_a = aggregatedValue.get(rowValue)) !== null && _a !== void 0 ? _a : 0) + 1);
348
351
  return aggregatedValue;
@@ -0,0 +1,17 @@
1
+ import { IAdaptableService } from './IAdaptableService';
2
+ import { AdaptableModule } from '../../../PredefinedConfig/Common/Types';
3
+ import { IRowNode } from '@ag-grid-community/core/dist/esm/es6/interfaces/iRowNode';
4
+ import { AggregatedScalarLiveValue } from '../AggregatedScalarLiveValue';
5
+ export declare const summarySupportedExpressions: readonly ["SUM", "AVG", "MIN", "MAX", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "STD_DEVIATION"];
6
+ export type SummaryConfig = {
7
+ expression: {
8
+ function: SummarySupportedExpression;
9
+ };
10
+ columnId: string;
11
+ getRowNodes?: () => IRowNode[];
12
+ };
13
+ export type SummarySupportedExpression = (typeof summarySupportedExpressions)[number];
14
+ export interface ISummaryService extends IAdaptableService {
15
+ evaluateExpressionValue(config: SummaryConfig, moduleId: AdaptableModule): any;
16
+ evaluateScalarLiveValue(config: SummaryConfig, moduleId: AdaptableModule): AggregatedScalarLiveValue;
17
+ }
@@ -0,0 +1,12 @@
1
+ export const summarySupportedExpressions = [
2
+ 'SUM',
3
+ 'AVG',
4
+ 'MIN',
5
+ 'MAX',
6
+ 'COUNT',
7
+ 'MEDIAN',
8
+ 'MODE',
9
+ 'DISTINCT',
10
+ 'ONLY',
11
+ 'STD_DEVIATION',
12
+ ];
@@ -1,19 +1,10 @@
1
- import { IRowNode } from '@ag-grid-community/core';
2
1
  import { AdaptableApi, AdaptableModule } from '../../types';
3
2
  import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
4
- export declare const summarySupportedExpressions: readonly ["SUM", "AVG", "MIN", "MAX", "COUNT", "MEDIAN", "MODE", "DISTINCT", "ONLY", "STD_DEVIATION"];
5
- export type SummarySupportedExpression = (typeof summarySupportedExpressions)[number];
6
- export type SumaryConfig = {
7
- expression: {
8
- function: SummarySupportedExpression;
9
- };
10
- columnId: string;
11
- getRowNodes?: () => IRowNode[];
12
- };
13
- export declare class SummaryService {
3
+ import { ISummaryService, SummaryConfig } from './Interface/ISummaryService';
4
+ export declare class SummaryService implements ISummaryService {
14
5
  private adaptableApi;
15
6
  constructor(adaptableApi: AdaptableApi);
16
- evaluateExpressionValue(config: SumaryConfig, moduleId: AdaptableModule): any;
17
- evaluateScalarLiveValue(config: SumaryConfig, moduleId: AdaptableModule): AggregatedScalarLiveValue;
7
+ evaluateExpressionValue(config: SummaryConfig, moduleId: AdaptableModule): any;
8
+ evaluateScalarLiveValue(config: SummaryConfig, moduleId: AdaptableModule): AggregatedScalarLiveValue;
18
9
  destroy(): void;
19
10
  }
@@ -1,16 +1,4 @@
1
1
  import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
2
- export const summarySupportedExpressions = [
3
- 'SUM',
4
- 'AVG',
5
- 'MIN',
6
- 'MAX',
7
- 'COUNT',
8
- 'MEDIAN',
9
- 'MODE',
10
- 'DISTINCT',
11
- 'ONLY',
12
- 'STD_DEVIATION',
13
- ];
14
2
  export class SummaryService {
15
3
  constructor(adaptableApi) {
16
4
  this.adaptableApi = adaptableApi;
@@ -108,13 +108,6 @@ export const LayoutWizard = (props) => {
108
108
  render: () => (React.createElement(Box, { p: 2, style: { height: '100%' } },
109
109
  React.createElement(RowGroupingSection, { onChange: setLayout }))),
110
110
  },
111
- {
112
- title: 'Row Summaries',
113
- details: 'Configure Row Summaries',
114
- renderSummary: () => React.createElement(RowGroupingSectionSummary, null),
115
- render: () => (React.createElement(Box, { p: 2, style: { height: '100%' } },
116
- React.createElement(RowSummarySection, { onChange: setLayout }))),
117
- },
118
111
  {
119
112
  title: 'Aggregations',
120
113
  isVisible: () => layoutSupportedFeatures.AggregationColumns,
@@ -124,6 +117,13 @@ export const LayoutWizard = (props) => {
124
117
  render: () => (React.createElement(Box, { p: 2, style: { height: '100%' } },
125
118
  React.createElement(AggregationsSection, { onChange: setLayout }))),
126
119
  },
120
+ {
121
+ title: 'Row Summaries',
122
+ details: 'Configure Row Summaries',
123
+ renderSummary: () => React.createElement(RowGroupingSectionSummary, null),
124
+ render: () => (React.createElement(Box, { p: 2, style: { height: '100%' } },
125
+ React.createElement(RowSummarySection, { onChange: setLayout }))),
126
+ },
127
127
  {
128
128
  title: 'Sort',
129
129
  isVisible: () => layoutSupportedFeatures.ColumnSorts,
@@ -8,7 +8,7 @@ import { Tabs } from '../../../../components/Tabs';
8
8
  import { Tag } from '../../../../components/Tag';
9
9
  import { mapColumnDataTypeToExpressionFunctionType } from '../../../../Utilities/adaptableQlUtils';
10
10
  import { LayoutModuleId } from '../../../../Utilities/Constants/ModuleConstants';
11
- import { summarySupportedExpressions } from '../../../../Utilities/Services/SummaryService';
11
+ import { summarySupportedExpressions } from '../../../../Utilities/Services/Interface/ISummaryService';
12
12
  import { sortWithOrderArray } from '../../../../Utilities/sortWithOrder';
13
13
  import { useAdaptable } from '../../../AdaptableContext';
14
14
  import { ValueSelector } from '../../../Components/ValueSelector';
@@ -112,6 +112,7 @@ const RowSummaryEditor = ({ rowSummary, onChange, availableScalarExpressions, on
112
112
  } })))));
113
113
  };
114
114
  export const RowSummarySection = (props) => {
115
+ var _a;
115
116
  const adaptable = useAdaptable();
116
117
  const { data: layout } = useOnePageAdaptableWizardContext();
117
118
  const availableScalarExpressions = React.useMemo(() => {
@@ -125,8 +126,17 @@ export const RowSummarySection = (props) => {
125
126
  React.createElement("div", null,
126
127
  React.createElement(Flex, { mb: 1 },
127
128
  React.createElement(Flex, { flex: 1 }),
128
- React.createElement(SimpleButton, { icon: "plus" }, "Add Row Summary")),
129
- layout.RowSummaries.map((rowSummary, index) => {
129
+ React.createElement(SimpleButton, { onClick: () => {
130
+ var _a;
131
+ props.onChange(Object.assign(Object.assign({}, layout), { RowSummaries: [
132
+ ...((_a = layout.RowSummaries) !== null && _a !== void 0 ? _a : []),
133
+ {
134
+ Position: 'Top',
135
+ ColumnsMap: {},
136
+ },
137
+ ] }));
138
+ }, icon: "plus" }, "Add Row Summary")),
139
+ ((_a = layout.RowSummaries) !== null && _a !== void 0 ? _a : []).map((rowSummary, index) => {
130
140
  return (React.createElement(RowSummaryEditor, { key: index, onDelete: () => {
131
141
  const newSummaries = [...layout.RowSummaries];
132
142
  newSummaries.splice(index, 1);
@@ -26,7 +26,7 @@ import { RenderReactRootFn } from '../renderReactRoot';
26
26
  import { AgGridOptionsService } from './AgGridOptionsService';
27
27
  import { AgGridColumnAdapter } from './AgGridColumnAdapter';
28
28
  import { RowEditService } from '../Utilities/Services/RowEditService';
29
- import { SummaryService } from '../Utilities/Services/SummaryService';
29
+ import { ISummaryService } from '../Utilities/Services/Interface/ISummaryService';
30
30
  export type AdaptableVariant = 'vanilla' | 'react' | 'angular';
31
31
  export type AdaptableLifecycleState = 'initial' | 'preprocessOptions' | 'initAdaptableState' | 'setupAgGrid' | 'initAgGrid' | 'available' | 'ready' | 'preDestroyed';
32
32
  type RenderAgGridFrameworkComponentResult = false | GridApi;
@@ -82,7 +82,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
82
82
  RowEditService: RowEditService;
83
83
  Fdc3Service: Fdc3Service;
84
84
  CellPopupService: CellPopupService;
85
- SummaryService: SummaryService;
85
+ SummaryService: ISummaryService;
86
86
  private LicenseService;
87
87
  private ChartingService;
88
88
  private ThemeService;
@@ -1139,7 +1139,9 @@ export class AdaptableAgGrid {
1139
1139
  const allAgGridColDefIds = allAgGridFlattenedColDefs.map((colDef) => colDef.colId);
1140
1140
  const getColDef = (colId) => allAgGridFlattenedColDefs.find((colDef) => colDef.colId === colId);
1141
1141
  agGridState.columnVisibility = {
1142
- hiddenColIds: allAgGridColDefIds.filter((colDefId) => { var _a; return !((_a = currentLayout.Columns) === null || _a === void 0 ? void 0 : _a.includes(colDefId)); }),
1142
+ hiddenColIds: allAgGridFlattenedColDefs
1143
+ .filter((colDef) => { var _a; return !((_a = currentLayout.Columns) === null || _a === void 0 ? void 0 : _a.includes(colDef.colId)) || colDef.hide || colDef.initialHide; })
1144
+ .map((colDef) => colDef.colId),
1143
1145
  };
1144
1146
  agGridState.columnOrder = {
1145
1147
  orderedColIds: sortWithOrderArray(allAgGridColDefIds, currentLayout.Columns || [], {
@@ -213,18 +213,22 @@ export class AgGridMenuAdapter {
213
213
  };
214
214
  }
215
215
  else {
216
- return adaptableMenuItems.find((menuItem) => menuItem.module === moduleOrGroup);
216
+ return adaptableMenuItems.filter((menuItem) => menuItem.module === moduleOrGroup);
217
217
  }
218
218
  })
219
- .filter((menuItem) => {
220
- if (!menuItem) {
219
+ .filter((menuItems) => {
220
+ if (!menuItems.length) {
221
221
  return false;
222
222
  }
223
- if (menuItem.subItems && menuItem.subItems.length === 0) {
224
- return false;
223
+ if (menuItems.length === 1) {
224
+ const singleMenuItem = menuItems[0];
225
+ if (singleMenuItem.subItems && singleMenuItem.subItems.length === 0) {
226
+ return false;
227
+ }
225
228
  }
226
229
  return true;
227
- });
230
+ })
231
+ .flat();
228
232
  }
229
233
  mapAdaptableMenuItemToSystemMenuItems(adaptableMenuItems) {
230
234
  return (adaptableMenuItems !== null && adaptableMenuItems !== void 0 ? adaptableMenuItems : []).map((menuItem) => {
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1711118620968 || Date.now(),
4
- VERSION: "18.0.0-canary.13" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1711381973916 || Date.now(),
4
+ VERSION: "18.0.0-canary.14" || '--current-version--',
5
5
  };
@@ -4771,6 +4771,19 @@ export declare const ADAPTABLE_METAMODEL: {
4771
4771
  name: string;
4772
4772
  kind: string;
4773
4773
  desc: string;
4774
+ props: ({
4775
+ name: string;
4776
+ kind: string;
4777
+ desc: string;
4778
+ isOpt?: undefined;
4779
+ ref?: undefined;
4780
+ } | {
4781
+ name: string;
4782
+ kind: string;
4783
+ desc: string;
4784
+ isOpt: boolean;
4785
+ ref: string;
4786
+ })[];
4774
4787
  };
4775
4788
  RowSummaryPosition: {
4776
4789
  name: string;
@@ -5358,6 +5371,18 @@ export declare const ADAPTABLE_METAMODEL: {
5358
5371
  kind: string;
5359
5372
  desc: string;
5360
5373
  };
5374
+ TransposeConfig: {
5375
+ name: string;
5376
+ kind: string;
5377
+ desc: string;
5378
+ props: {
5379
+ name: string;
5380
+ kind: string;
5381
+ desc: string;
5382
+ isOpt: boolean;
5383
+ defVal: string;
5384
+ }[];
5385
+ };
5361
5386
  UIControlConfig: {
5362
5387
  name: string;
5363
5388
  kind: string;