@adaptabletools/adaptable-cjs 20.0.0-canary.5 → 20.0.0-canary.6

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-cjs",
3
- "version": "20.0.0-canary.5",
3
+ "version": "20.0.0-canary.6",
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,5 +1,5 @@
1
1
  import { IRowNode } from 'ag-grid-enterprise';
2
- import { AppIdentifier, Context, ContextType, DesktopAgent, Intent, IntentResolution } from '@finos/fdc3';
2
+ import { AppIdentifier, Channel, Context, ContextType, DesktopAgent, Intent, IntentResolution } from '@finos/fdc3';
3
3
  /**
4
4
  * Provides run-time access to AdapTable's FDC3 functionality
5
5
  */
@@ -59,14 +59,16 @@ export interface Fdc3Api {
59
59
  * Broadcasts the given Context from the given Row Node
60
60
  * @param rowNode - The Row Node
61
61
  * @param contextType - The FDC3 Context Type
62
+ * @param channel - (optional) Channel to broadcast to; if not provided, the Context will be broadcast to whatever User Channel the app is joined to
62
63
  */
63
- broadcastFromRow(rowNode: IRowNode, contextType: ContextType): Promise<void>;
64
+ broadcastFromRow(rowNode: IRowNode, contextType: ContextType, channel?: Channel): Promise<void>;
64
65
  /**
65
66
  * Broadcasts the given Context from the given Row Node with the given Primary Key Value
66
67
  * @param primaryKeyValue - The Primary Key Value
67
68
  * @param contextType - The FDC3 Context Type
69
+ * @param channel - (optional) Channel to broadcast to; if not provided, the Context will be broadcast to whatever User Channel the app is joined to
68
70
  */
69
- broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType): Promise<void> | undefined;
71
+ broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, channel?: Channel): Promise<void> | undefined;
70
72
  /**
71
73
  * Checks if the given Context Type is a FDC3 standard Context Type
72
74
  */
@@ -1,5 +1,5 @@
1
1
  import { IRowNode } from 'ag-grid-enterprise';
2
- import { Context, ContextType, DesktopAgent, Intent, IntentResolution, StandardContextType, StandardIntent } from '@finos/fdc3';
2
+ import { Channel, Context, ContextType, DesktopAgent, Intent, IntentResolution, StandardContextType, StandardIntent } from '@finos/fdc3';
3
3
  import { ApiBase } from './ApiBase';
4
4
  import { Fdc3Api } from '../Fdc3Api';
5
5
  import { Fdc3InternalApi } from '../Internal/Fdc3InternalApi';
@@ -15,8 +15,8 @@ export declare class Fdc3ApiImpl extends ApiBase implements Fdc3Api {
15
15
  raiseIntentFromRow(rowNode: IRowNode, intent: Intent, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
16
16
  raiseIntentForContextFromRow(rowNode: IRowNode, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution>;
17
17
  raiseIntentForContextFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, appIdentifier?: AppIdentifier): Promise<IntentResolution> | undefined;
18
- broadcastFromRow(rowNode: IRowNode, contextType: ContextType): Promise<void>;
19
- broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType): Promise<void> | undefined;
18
+ broadcastFromRow(rowNode: IRowNode, contextType: ContextType, channel?: Channel): Promise<void>;
19
+ broadcastFromPrimaryKey(primaryKeyValue: string | number, contextType: ContextType, channel?: Channel): Promise<void> | undefined;
20
20
  getContextLabel(contextType: ContextType): string;
21
21
  isStandardContextType(contextType: string): contextType is StandardContextType;
22
22
  isStandardIntentType(intentType: string): intentType is StandardIntent;
@@ -47,17 +47,17 @@ class Fdc3ApiImpl extends ApiBase_1.ApiBase {
47
47
  }
48
48
  return this.raiseIntentForContextFromRow(rowNode, contextType, appIdentifier);
49
49
  }
50
- broadcastFromRow(rowNode, contextType) {
50
+ broadcastFromRow(rowNode, contextType, channel) {
51
51
  const contextData = this.buildContextDataFromRow(contextType, rowNode);
52
- return this.getFdc3Service().broadcast(contextData);
52
+ return this.getFdc3Service().broadcast(contextData, channel);
53
53
  }
54
- broadcastFromPrimaryKey(primaryKeyValue, contextType) {
54
+ broadcastFromPrimaryKey(primaryKeyValue, contextType, channel) {
55
55
  const rowNode = this.getGridApi().getRowNodeForPrimaryKey(primaryKeyValue);
56
56
  if (!rowNode) {
57
57
  this.logWarn(`No row found for primary key value '${primaryKeyValue}'`);
58
58
  return undefined;
59
59
  }
60
- return this.broadcastFromRow(rowNode, contextType);
60
+ return this.broadcastFromRow(rowNode, contextType, channel);
61
61
  }
62
62
  getContextLabel(contextType) {
63
63
  return this.isStandardContextType(contextType)
@@ -7,6 +7,7 @@ const isPivotLayoutModel_1 = require("../../layout-manager/src/isPivotLayoutMode
7
7
  const normalizeLayoutModel_1 = require("../../layout-manager/src/normalizeLayoutModel");
8
8
  const simplifyLayoutModel_1 = require("../../layout-manager/src/simplifyLayoutModel");
9
9
  const AggregationColumns_1 = require("../../PredefinedConfig/Common/AggregationColumns");
10
+ const AdaptableHelper_1 = require("../../Utilities/Helpers/AdaptableHelper");
10
11
  const layoutStateToLayoutModel = (layout) => {
11
12
  if ((0, exports.isPivotLayout)(layout)) {
12
13
  return (0, exports.pivotLayoutToPivotLayoutModel)(layout);
@@ -24,44 +25,23 @@ exports.layoutModelToLayoutState = layoutModelToLayoutState;
24
25
  function cleanupAdaptableObjectPrimitives(layout) {
25
26
  if (layout.TableAggregationColumns) {
26
27
  layout.TableAggregationColumns.forEach((AggValue) => {
27
- // @ts-ignore
28
- delete AggValue.Source;
29
- // @ts-ignore
30
- delete AggValue.Uuid;
31
- // @ts-ignore
32
- delete AggValue.AdaptableVersion;
28
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(AggValue);
33
29
  if (typeof AggValue.AggFunc === 'object' && AggValue.AggFunc) {
34
- // @ts-ignore
35
- delete AggValue.AggFunc.Source;
36
- // @ts-ignore
37
- delete AggValue.AggFunc.Uuid;
38
- // @ts-ignore
39
- delete AggValue.AggFunc.AdaptableVersion;
30
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(AggValue.AggFunc);
40
31
  }
41
32
  });
42
33
  }
43
34
  if (layout.ColumnHeaders) {
44
- delete layout.ColumnHeaders.Source;
45
- delete layout.ColumnHeaders.Uuid;
46
- delete layout.ColumnHeaders.AdaptableVersion;
35
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.ColumnHeaders);
47
36
  }
48
37
  if (layout.ColumnVisibility) {
49
- delete layout.ColumnVisibility.Source;
50
- delete layout.ColumnVisibility.Uuid;
51
- delete layout.ColumnVisibility.AdaptableVersion;
38
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.ColumnVisibility);
52
39
  }
53
40
  if (layout.ColumnWidths) {
54
- delete layout.ColumnWidths.Source;
55
- delete layout.ColumnWidths.Uuid;
56
- delete layout.ColumnWidths.AdaptableVersion;
41
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.ColumnWidths);
57
42
  }
58
43
  if (layout.RowGroupValues) {
59
- // @ts-ignore
60
- delete layout.RowGroupValues.Source;
61
- // @ts-ignore
62
- delete layout.RowGroupValues.Uuid;
63
- // @ts-ignore
64
- delete layout.RowGroupValues.AdaptableVersion;
44
+ (0, AdaptableHelper_1.removeAdaptableObjectPrimitivesInline)(layout.RowGroupValues);
65
45
  }
66
46
  }
67
47
  /**
@@ -271,6 +251,7 @@ const tableLayoutModelToTableLayout = (layoutModel, defaults) => {
271
251
  else {
272
252
  delete tableLayout.TableAggregationColumns;
273
253
  }
254
+ cleanupAdaptableObjectPrimitives(tableLayout);
274
255
  return tableLayout;
275
256
  };
276
257
  exports.tableLayoutModelToTableLayout = tableLayoutModelToTableLayout;
@@ -4,6 +4,7 @@ import { AccessLevel } from '../../PredefinedConfig/Common/Entitlement';
4
4
  export declare function initPredefinedConfigWithUuids(predefinedConfig: PredefinedConfig): PredefinedConfig;
5
5
  export declare function getAccessLevelForObject(adaptableObject: AdaptableObject, moduleAccessLevel: AccessLevel): AccessLevel;
6
6
  export declare function addAdaptableObjectPrimitives<T extends AdaptableObject>(adaptableObject: T): T;
7
+ export declare function removeAdaptableObjectPrimitivesInline(target: any): any;
7
8
  export declare function removeAdaptableObjectPrimitives<T extends AdaptableObject>(adaptableObject: T): T;
8
9
  export declare function isAdaptableObject(object: unknown): object is AdaptableObject;
9
10
  export declare const AdaptableHelper: {
@@ -11,6 +12,7 @@ export declare const AdaptableHelper: {
11
12
  getAccessLevelForObject: typeof getAccessLevelForObject;
12
13
  addAdaptableObjectPrimitives: typeof addAdaptableObjectPrimitives;
13
14
  removeAdaptableObjectPrimitives: typeof removeAdaptableObjectPrimitives;
15
+ removeAdaptableObjectPrimitivesInline: typeof removeAdaptableObjectPrimitivesInline;
14
16
  isAdaptableObject: typeof isAdaptableObject;
15
17
  };
16
18
  export default AdaptableHelper;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableHelper = exports.isAdaptableObject = exports.removeAdaptableObjectPrimitives = exports.addAdaptableObjectPrimitives = exports.getAccessLevelForObject = exports.initPredefinedConfigWithUuids = void 0;
3
+ exports.AdaptableHelper = exports.isAdaptableObject = exports.removeAdaptableObjectPrimitives = exports.removeAdaptableObjectPrimitivesInline = exports.addAdaptableObjectPrimitives = exports.getAccessLevelForObject = exports.initPredefinedConfigWithUuids = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const cloneDeepWith_1 = tslib_1.__importDefault(require("lodash/cloneDeepWith"));
6
6
  const isPlainObject_1 = tslib_1.__importDefault(require("lodash/isPlainObject"));
@@ -50,6 +50,16 @@ function addAdaptableObjectPrimitives(adaptableObject) {
50
50
  return adaptableObject;
51
51
  }
52
52
  exports.addAdaptableObjectPrimitives = addAdaptableObjectPrimitives;
53
+ function removeAdaptableObjectPrimitivesInline(target) {
54
+ if (!target || typeof target !== 'object') {
55
+ return target;
56
+ }
57
+ delete target.Source;
58
+ delete target.Uuid;
59
+ delete target.AdaptableVersion;
60
+ return target;
61
+ }
62
+ exports.removeAdaptableObjectPrimitivesInline = removeAdaptableObjectPrimitivesInline;
53
63
  function removeAdaptableObjectPrimitives(adaptableObject) {
54
64
  const clonedObject = structuredClone(adaptableObject);
55
65
  const sanitiseObject = (object) => {
@@ -79,6 +89,7 @@ exports.AdaptableHelper = {
79
89
  getAccessLevelForObject,
80
90
  addAdaptableObjectPrimitives,
81
91
  removeAdaptableObjectPrimitives,
92
+ removeAdaptableObjectPrimitivesInline,
82
93
  isAdaptableObject,
83
94
  };
84
95
  exports.default = exports.AdaptableHelper;
@@ -1,7 +1,7 @@
1
1
  import { IAdaptableService } from './Interface/IAdaptableService';
2
2
  import { AdaptableApi } from '../../Api/AdaptableApi';
3
3
  import { Fdc3Options } from '../../AdaptableOptions/Fdc3Options';
4
- import { AppIdentifier, DesktopAgent, IntentResolution } from '@finos/fdc3';
4
+ import { AppIdentifier, Channel, DesktopAgent, IntentResolution } from '@finos/fdc3';
5
5
  import { Context } from '@finos/fdc3/dist/context/ContextTypes';
6
6
  export declare class Fdc3Service implements IAdaptableService {
7
7
  private adaptableApi;
@@ -15,7 +15,7 @@ export declare class Fdc3Service implements IAdaptableService {
15
15
  destroy(): void;
16
16
  raiseIntent(intent: string, context: Context, app?: AppIdentifier): Promise<IntentResolution>;
17
17
  raiseIntentForContext(context: Context, app?: AppIdentifier): Promise<IntentResolution>;
18
- broadcast(context: Context): Promise<void>;
18
+ broadcast(context: Context, channel?: Channel): Promise<void>;
19
19
  private logFdc3Event;
20
20
  private logFdc3Error;
21
21
  private getFdc3Api;
@@ -134,7 +134,7 @@ class Fdc3Service {
134
134
  this.logFdc3Error(error);
135
135
  }
136
136
  }
137
- broadcast(context) {
137
+ broadcast(context, channel) {
138
138
  if (!this.getDesktopAgent()) {
139
139
  return;
140
140
  }
@@ -147,7 +147,12 @@ class Fdc3Service {
147
147
  context,
148
148
  };
149
149
  this.adaptableApi.eventApi.emit('Fdc3Message', payload);
150
- return this.getDesktopAgent().broadcast(context);
150
+ if (channel) {
151
+ return channel.broadcast(context);
152
+ }
153
+ else {
154
+ return this.getDesktopAgent().broadcast(context);
155
+ }
151
156
  }
152
157
  catch (error) {
153
158
  this.logFdc3Error(error);
@@ -46,6 +46,47 @@ const ConfigurationWizard = (props) => {
46
46
  delete newColumn.caption;
47
47
  return newColumn;
48
48
  });
49
+ const columnDefs = adaptableConfig.gridOptions.columnDefs;
50
+ // handle the layout creation
51
+ let Layouts = newAdaptableOptions.predefinedConfig?.Layout?.Layouts || [];
52
+ const NewLayout = {
53
+ TableColumns: columnDefs.map((col) => col.colId ?? col.field),
54
+ Name: 'Default Layout',
55
+ };
56
+ let currentLayoutName = NewLayout.Name;
57
+ let found = false;
58
+ if (!Layouts.length) {
59
+ // no layouts, make this the only one
60
+ Layouts = [NewLayout];
61
+ }
62
+ else {
63
+ Layouts = Layouts.map((layout) => {
64
+ if (found) {
65
+ return layout;
66
+ }
67
+ if (layout.TableColumns?.length === 0) {
68
+ // when finding the first empty layout
69
+ // set its column to be those of the new layout
70
+ found = true;
71
+ // and grab the name so we can put it in the Layout.CurrentLayout state
72
+ currentLayoutName = layout.Name;
73
+ layout = { ...layout };
74
+ layout.TableColumns = NewLayout.TableColumns;
75
+ }
76
+ return layout;
77
+ });
78
+ if (!found) {
79
+ Layouts.push(NewLayout);
80
+ }
81
+ }
82
+ newAdaptableOptions.predefinedConfig = {
83
+ ...newAdaptableOptions.predefinedConfig,
84
+ Layout: {
85
+ ...newAdaptableOptions.predefinedConfig.Layout,
86
+ Layouts: Layouts,
87
+ CurrentLayout: currentLayoutName,
88
+ },
89
+ };
49
90
  newAdaptableOptions.primaryKey = columnsHandle.current.getPrimaryKey();
50
91
  }
51
92
  const newAdaptableConfig = {
@@ -2965,6 +2965,10 @@ You need to define at least one Layout!`);
2965
2965
  };
2966
2966
  this.agGridColumnAdapter.setupColumnHeader(colSetupInfo);
2967
2967
  });
2968
+ // need to refresh the header,
2969
+ // as the Layout.ColumnHeaders state property is not implemented in the LayoutManager
2970
+ // and is specific to Adaptable, therefore we need to refresh it manually
2971
+ this.refreshHeader();
2968
2972
  const layoutModel = (0, LayoutHelpers_1.layoutStateToLayoutModel)(layout);
2969
2973
  this.layoutManager?.setLayout(layoutModel, {
2970
2974
  skipApplyRowGroupsExpandedState: !shouldUpdateExpandState,
@@ -100,7 +100,7 @@ class AgGridAdapter {
100
100
  // `context`
101
101
  const passedContext = options.context;
102
102
  if (passedContext) {
103
- passedContext['__adaptable'] = self;
103
+ passedContext['__adaptable'] = self._adaptableInstance;
104
104
  passedContext['adaptableApi'] = self.adaptableApi;
105
105
  }
106
106
  // we mutated the options array, so it's OK to use the 'arguments' object
@@ -392,9 +392,6 @@ class AgGridColumnAdapter {
392
392
  if (layoutCustomHeader) {
393
393
  resultHeaderName = layoutCustomHeader;
394
394
  }
395
- // required here for the initial layout rendering
396
- // Removed by JW, 3 october 2023; i don't think we need it and it overrides stuff unnecessarily
397
- abColumn.friendlyName = resultHeaderName;
398
395
  return resultHeaderName;
399
396
  });
400
397
  const newColumnHeader = col?.getColDef()?.headerName;
package/src/env.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = {
4
4
  NEXT_PUBLIC_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" || '',
5
- PUBLISH_TIMESTAMP: 1741156652553 || Date.now(),
6
- VERSION: "20.0.0-canary.5" || '--current-version--',
5
+ PUBLISH_TIMESTAMP: 1741253368753 || Date.now(),
6
+ VERSION: "20.0.0-canary.6" || '--current-version--',
7
7
  };