@adaptabletools/adaptable 18.0.0-canary.22 → 18.0.0-canary.23

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.
@@ -1,5 +1,3 @@
1
- import { AdaptableColumn, BaseContext } from '../../types';
2
- import { KeyCreatorParams } from '@ag-grid-community/core';
3
1
  /**
4
2
  * Options for managing Row and Column Groups in AdapTable
5
3
  */
@@ -19,16 +17,3 @@ export interface GroupingOptions<TData = any> {
19
17
  */
20
18
  autoOrderGroupedColumns?: boolean;
21
19
  }
22
- /**
23
- * Context used when setting a value for Balanced Row Groups
24
- */
25
- export interface BalancedGroupsKeyContext<TData = any> extends BaseContext {
26
- /**
27
- * AdapTable Column being grouped
28
- */
29
- adaptableColumn: AdaptableColumn<TData>;
30
- /**
31
- * AG Grid's Key Creator Params
32
- */
33
- params: KeyCreatorParams<TData>;
34
- }
@@ -24,34 +24,33 @@ export interface CommentApi {
24
24
  */
25
25
  deleteComment(comment: AdaptableComment, cellAddress: CellAddress): void;
26
26
  /**
27
- * Get Comments for a particular cell
28
- * @param CellAddress
27
+ * Create a new Comment Thread
28
+ *
29
+ * @param commentThread
29
30
  */
30
- getComments(cellAddress: CellAddress): AdaptableComment[];
31
+ addCommentThread(commentThread: CommentThread): void;
31
32
  /**
32
33
  * Delete all Comments for a particular cell
33
34
  * @param cellAddress
34
35
  */
35
36
  deleteCommentThread(cellAddress: CellAddress): void;
36
37
  /**
37
- * Return all Comments for a particular cell
38
+ * Return the Comment Thread for a particular cell
38
39
  * @param cellAddress
39
40
  */
40
41
  getCommentThread(cellAddress: CellAddress): CommentThread | undefined;
41
42
  /**
42
- * Return all Comment Threads
43
+ * Return all Comment Threads in the grid
43
44
  */
44
- getCommentThreads(): CommentThread[];
45
+ getGridComments(): CommentThread[];
45
46
  /**
46
- * Create a new Comment Thread
47
+ * Sets the Comment Threads in the grid
47
48
  *
48
- * @param commentThread
49
+ * @param commentThreads new cell comments
49
50
  */
50
- addCommentThread(commentThread: CommentThread): void;
51
+ setGridComments(commentThreads: CommentThread[]): void;
51
52
  /**
52
- * Load all Comment Threads
53
- *
54
- * @param commentThreads new cell comments
53
+ * Clear all Comment Threads in the grid
55
54
  */
56
- loadCommentThreads(commentThreads: CommentThread[]): void;
55
+ clearGridComments(): void;
57
56
  }
@@ -6,13 +6,13 @@ import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
6
6
  export declare class CommentsApiImpl extends ApiBase implements CommentApi {
7
7
  internalApi: CommentsInternalApi;
8
8
  constructor(adaptable: IAdaptable);
9
- getComments(address: CellAddress): AdaptableComment[];
10
9
  getCommentThread(address: CellAddress): CommentThread | undefined;
11
- getCommentThreads(): CommentThread[];
10
+ getGridComments(): CommentThread[];
12
11
  editComment(comment: AdaptableComment, address: CellAddress): void;
13
12
  deleteComment(comment: AdaptableComment, address: CellAddress): void;
14
13
  addComment(commentText: AdaptableComment['Value'], address: CellAddress): void;
15
14
  addCommentThread(commentThread: CommentThread): void;
16
15
  deleteCommentThread(cellAddress: CellAddress): void;
17
- loadCommentThreads(cellComments: CommentThread[]): void;
16
+ setGridComments(cellComments: CommentThread[]): void;
17
+ clearGridComments(): void;
18
18
  }
@@ -8,13 +8,10 @@ export class CommentsApiImpl extends ApiBase {
8
8
  super(adaptable);
9
9
  this.internalApi = new CommentsInternalApi(adaptable);
10
10
  }
11
- getComments(address) {
12
- return CommentRedux.GetCommentsSelector(this.getAdaptableState().Comment, address);
13
- }
14
11
  getCommentThread(address) {
15
12
  return CommentRedux.GetCellCommentSelector(this.getAdaptableState().Comment, address);
16
13
  }
17
- getCommentThreads() {
14
+ getGridComments() {
18
15
  var _a;
19
16
  return (_a = this.getAdaptableState().Comment.CommentThreads) !== null && _a !== void 0 ? _a : [];
20
17
  }
@@ -41,7 +38,10 @@ export class CommentsApiImpl extends ApiBase {
41
38
  deleteCommentThread(cellAddress) {
42
39
  this.dispatchAction(CommentRedux.CommentsCellDelete({ cellAddress }));
43
40
  }
44
- loadCommentThreads(cellComments) {
41
+ setGridComments(cellComments) {
45
42
  this.dispatchAction(CommentRedux.CommentsSet({ commentThread: cellComments }));
46
43
  }
44
+ clearGridComments() {
45
+ this.setGridComments([]);
46
+ }
47
47
  }
@@ -71,9 +71,5 @@ export declare const CommentsDelete: ({ commentUuid, cellAddress, }: {
71
71
  commentUuid: AdaptableComment['Uuid'];
72
72
  cellAddress: CellAddress;
73
73
  }) => AdaptableCommentsDeleteAction;
74
- export declare const CommentsReady: (commentstate: CommentState) => NoteReadyAction;
75
- export declare const GetGridCellCommentsSelector: (state: CommentState, address: CellAddress) => CommentThread;
76
- export declare const GetCommentsSelector: (state: CommentState, address: CellAddress) => AdaptableComment[] | undefined;
77
- export declare const GetGetCommentsByUuidSelector: (state: CommentState, uuid: string) => AdaptableComment | undefined;
78
74
  export declare const GetCellCommentSelector: (state: CommentState, address: CellAddress) => CommentThread | undefined;
79
75
  export declare const CommentsReducer: Redux.Reducer<CommentState>;
@@ -53,40 +53,6 @@ export const CommentsDelete = ({ commentUuid, cellAddress, }) => ({
53
53
  cellAddress,
54
54
  commentUuid,
55
55
  });
56
- export const CommentsReady = (commentstate) => ({
57
- type: COMMENTS_READY,
58
- commentState: commentstate,
59
- });
60
- export const GetGridCellCommentsSelector = (state, address) => {
61
- var _a;
62
- if (!address) {
63
- return null;
64
- }
65
- return ((_a = state === null || state === void 0 ? void 0 : state.CommentThreads) !== null && _a !== void 0 ? _a : []).find((cellComments) => {
66
- return CellPopupService.isSameAddress(cellComments, address);
67
- });
68
- };
69
- export const GetCommentsSelector = (state, address) => {
70
- var _a, _b;
71
- if (!address) {
72
- return [];
73
- }
74
- const comments = (_b = ((_a = state === null || state === void 0 ? void 0 : state.CommentThreads) !== null && _a !== void 0 ? _a : []).find((cellComments) => {
75
- return CellPopupService.isSameAddress(cellComments, address);
76
- })) === null || _b === void 0 ? void 0 : _b.Comments;
77
- return comments;
78
- };
79
- export const GetGetCommentsByUuidSelector = (state, uuid) => {
80
- var _a;
81
- for (const commentThread of (_a = state.CommentThreads) !== null && _a !== void 0 ? _a : []) {
82
- for (const comment of commentThread.Comments) {
83
- if (comment.Uuid === uuid) {
84
- return comment;
85
- }
86
- }
87
- }
88
- return undefined;
89
- };
90
56
  export const GetCellCommentSelector = (state, address) => {
91
57
  var _a;
92
58
  if (!address) {
@@ -906,8 +906,8 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
906
906
  adaptable.refreshCells([node], [columnId], true);
907
907
  requestAnimationFrame(() => {
908
908
  var _a, _b;
909
- const commentThreads = adaptable.api.commentApi.getCommentThreads();
910
- adaptable.api.eventApi.emit('CommentChanged', adaptable.api.commentApi.getCommentThreads());
909
+ const commentThreads = adaptable.api.commentApi.getGridComments();
910
+ adaptable.api.eventApi.emit('CommentChanged', adaptable.api.commentApi.getGridComments());
911
911
  (_b = (_a = adaptable.api.optionsApi
912
912
  .getCommentOptions()) === null || _a === void 0 ? void 0 : _a.persistCommentThreads) === null || _b === void 0 ? void 0 : _b.call(_a, commentThreads);
913
913
  });
@@ -915,9 +915,9 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
915
915
  return returnAction;
916
916
  }
917
917
  case CommentsRedux.COMMENTS_LOAD: {
918
- const previousCommentThreads = adaptable.api.commentApi.getCommentThreads();
918
+ const previousCommentThreads = adaptable.api.commentApi.getGridComments();
919
919
  let returnAction = next(action);
920
- const newCommentThreads = (_j = adaptable.api.commentApi.getCommentThreads()) !== null && _j !== void 0 ? _j : [];
920
+ const newCommentThreads = (_j = adaptable.api.commentApi.getGridComments()) !== null && _j !== void 0 ? _j : [];
921
921
  requestAnimationFrame(() => {
922
922
  let addedCommentThreads = [];
923
923
  let deletedCommentThreads = [];
@@ -3,7 +3,6 @@ import { AdaptableMenuItem, ContextMenuContext } from '../PredefinedConfig/Commo
3
3
  import { AdaptableModuleBase } from './AdaptableModuleBase';
4
4
  import { IModule } from './Interface/IModule';
5
5
  export declare class CommentModule extends AdaptableModuleBase implements IModule {
6
- private adaptable;
7
6
  constructor(api: AdaptableApi);
8
7
  onAdaptableReady(): void;
9
8
  isModuleAvailable(): boolean;
@@ -22,7 +22,7 @@ export class CommentModule extends AdaptableModuleBase {
22
22
  var _a, _b;
23
23
  const commentThreads = await ((_b = (_a = this.api.optionsApi
24
24
  .getCommentOptions()) === null || _a === void 0 ? void 0 : _a.loadCommentThreads) === null || _b === void 0 ? void 0 : _b.call(_a, createBaseContext(this.api)));
25
- this.api.commentApi.loadCommentThreads(commentThreads);
25
+ this.api.commentApi.setGridComments(commentThreads);
26
26
  }
27
27
  addContextMenuItems(menuContext) {
28
28
  var _a, _b;
@@ -38,17 +38,17 @@ export class CommentModule extends AdaptableModuleBase {
38
38
  return items;
39
39
  }
40
40
  getAddRemoveCommentsMenuItems(menuContext) {
41
+ var _a;
41
42
  const items = [];
42
- // does not have note
43
+ if (!this.api.commentApi.internalApi.areCommentsAvailable()) {
44
+ return items;
45
+ }
43
46
  const cellAddress = {
44
47
  PrimaryKeyValue: menuContext.primaryKeyValue,
45
48
  ColumnId: menuContext.adaptableColumn.columnId,
46
49
  };
47
- const comments = this.api.commentApi.getComments(cellAddress);
48
- if (!this.api.commentApi.internalApi.areCommentsAvailable()) {
49
- return items;
50
- }
51
- if (comments) {
50
+ const cellComments = (_a = this.api.commentApi.getCommentThread(cellAddress)) === null || _a === void 0 ? void 0 : _a.Comments;
51
+ if (cellComments) {
52
52
  items.push(this.createMenuItemClickFunction('comment-remove', 'Remove Comment', this.moduleInfo.Glyph, () => {
53
53
  this.api.commentApi.deleteCommentThread(cellAddress);
54
54
  }));
@@ -62,13 +62,11 @@ export const CommentsEditor = (props) => {
62
62
  const isOwnComment = ((_a = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _a === void 0 ? void 0 : _a.UserName)
63
63
  ? ((_b = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _b === void 0 ? void 0 : _b.UserName) === userId
64
64
  : true; // no owner means it's the current user
65
- return (React.createElement(Box, { p: 2, key: (_c = comment.Uuid) !== null && _c !== void 0 ? _c : index, style: {
66
- borderBottom: '1px solid var(--ab-color-primarydark)',
67
- } },
65
+ return (React.createElement(Box, { p: 2, key: (_c = comment.Uuid) !== null && _c !== void 0 ? _c : index, className: "ab-Comment" },
68
66
  React.createElement(Flex, { mb: 2, alignItems: "center" },
69
67
  React.createElement(Box, null,
70
- React.createElement(Box, { fontSize: 3, fontWeight: "bold" }, (_d = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _d === void 0 ? void 0 : _d.UserName),
71
- comment.Timestamp && (React.createElement(Box, { fontSize: 2 }, formatDate(comment.Timestamp, 'MM.DD.YYYY HH:mm')))),
68
+ React.createElement(Box, { "data-name": "comment-username", fontSize: 3, fontWeight: "bold" }, (_d = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _d === void 0 ? void 0 : _d.UserName),
69
+ comment.Timestamp && (React.createElement(Box, { "data-name": "comment-timestamp", fontSize: 2 }, formatDate(comment.Timestamp, 'MM.DD.YYYY HH:mm')))),
72
70
  React.createElement(Box, { flex: 1 }),
73
71
  React.createElement(SimpleButton, { variant: "text", icon: "edit", disabled: !isOwnComment || isReadOnlyModule, onClick: () => setActiveEditingComment(comment.Uuid) }),
74
72
  React.createElement(SimpleButton, { variant: "text", icon: "delete", disabled: !isOwnComment || isReadOnlyModule, onClick: () => {
@@ -83,7 +81,7 @@ export const CommentsEditor = (props) => {
83
81
  }
84
82
  }, onChange: (event) => {
85
83
  adaptable.api.commentApi.editComment(Object.assign(Object.assign({}, comment), { Value: event.target.value }), cellAddress);
86
- } })) : (React.createElement(Text, null, comment.Value)))));
84
+ } })) : (React.createElement(Text, { "data-name": "comment-text" }, comment.Value)))));
87
85
  })),
88
86
  React.createElement(AdaptableInput, { autoFocus: !comments || comments.length === 0, value: newCommentText, disabled: isReadOnlyModule, onChange: (event) => {
89
87
  setNewCommentText(event.target.value);
@@ -20,7 +20,7 @@ export const useMenuItems = () => {
20
20
  item.module !== 'CustomSettingsPanel' &&
21
21
  !STANDALONE_MODULE_POPUPS.includes(item.module) &&
22
22
  item.isVisible);
23
- return navigationItems
23
+ let navItems = navigationItems
24
24
  .map((moduleName) => {
25
25
  var _a, _b;
26
26
  if (moduleName === '-') {
@@ -40,5 +40,13 @@ export const useMenuItems = () => {
40
40
  return customPanelMenuItem || visibleItems.find((item) => item.module === moduleName);
41
41
  })
42
42
  .filter(Boolean);
43
+ // remove sequential '-' items
44
+ navItems = navItems.filter((item, index) => {
45
+ if (item === '-' && navItems[index - 1] === '-') {
46
+ return false;
47
+ }
48
+ return true;
49
+ });
50
+ return navItems;
43
51
  }, [allMenuItems]);
44
52
  };
@@ -58,7 +58,7 @@ export declare class AdaptableAgGrid implements IAdaptable {
58
58
  * once layouts are properly handled with the new aggrid methods & events
59
59
  * we can remove this hack
60
60
  */
61
- private previousAgGridColumnState;
61
+ private previousAgGridLayoutState;
62
62
  _rawAdaptableOptions: AdaptableOptions;
63
63
  adaptableOptions: AdaptableOptions;
64
64
  _isDetailGrid: boolean;
@@ -310,15 +310,6 @@ export declare class AdaptableAgGrid implements IAdaptable {
310
310
  getChartRef(chartId: string): ChartRef;
311
311
  setLayout(layout?: Layout): void;
312
312
  private getActiveAdaptableAggFuncForCol;
313
- /**
314
- * Setting layout works by modifing the column state.
315
- * The column state is based on the current existing columns.
316
- * At this point the column groups do not exist, and the widths from layout are not applied.
317
- *
318
- * After the col sate is applied and the column groups are created we need
319
- * to apply the state again to update the widths of the group columns.
320
- */
321
- private applyGroupColumnWidth;
322
313
  private onRowDataChanged;
323
314
  private onCellDataChanged;
324
315
  private isUndoChange;
@@ -144,7 +144,7 @@ export class AdaptableAgGrid {
144
144
  * once layouts are properly handled with the new aggrid methods & events
145
145
  * we can remove this hack
146
146
  */
147
- this.previousAgGridColumnState = '';
147
+ this.previousAgGridLayoutState = '';
148
148
  this.columnMinMaxValuesCache = {};
149
149
  this.renderReactRoot = (node, container) => defaultRenderReactRoot(node, container);
150
150
  /**
@@ -2925,7 +2925,7 @@ export class AdaptableAgGrid {
2925
2925
  else {
2926
2926
  (_b = this.agGridAdapter.getAgGridApi()) === null || _b === void 0 ? void 0 : _b.destroy();
2927
2927
  }
2928
- this.previousAgGridColumnState = '';
2928
+ this.previousAgGridLayoutState = '';
2929
2929
  const gridContainerElement = this.getAgGridContainerElement();
2930
2930
  if (gridContainerElement) {
2931
2931
  gridContainerElement.removeEventListener('keydown', this.agGridListenerKeydown);
@@ -3315,14 +3315,13 @@ export class AdaptableAgGrid {
3315
3315
  // as otherwise column order is not preserved properly when
3316
3316
  // going from pivoted to unpivoted layout
3317
3317
  if (shouldUpdatePivoted) {
3318
- this.agGridAdapter.getAgGridApi().setPivotMode(pivoted);
3318
+ this.agGridAdapter.setGridOption('pivotMode', pivoted);
3319
3319
  }
3320
3320
  const perfApplyColumnState = this.logger.beginPerf('applyColumnState (layout.isChanged)');
3321
3321
  this.agGridAdapter.getAgGridApi().applyColumnState({
3322
3322
  state: newColumnsState,
3323
3323
  applyOrder: true,
3324
3324
  });
3325
- this.applyGroupColumnWidth(layout);
3326
3325
  perfApplyColumnState.end();
3327
3326
  this.api.gridApi.setColumnSorts(layout.ColumnSorts);
3328
3327
  this.agGridAdapter.getAgGridApi().setPivotColumns(layout.PivotColumns || []);
@@ -3379,38 +3378,6 @@ export class AdaptableAgGrid {
3379
3378
  }
3380
3379
  return null;
3381
3380
  }
3382
- /**
3383
- * Setting layout works by modifing the column state.
3384
- * The column state is based on the current existing columns.
3385
- * At this point the column groups do not exist, and the widths from layout are not applied.
3386
- *
3387
- * After the col sate is applied and the column groups are created we need
3388
- * to apply the state again to update the widths of the group columns.
3389
- */
3390
- applyGroupColumnWidth(layout) {
3391
- if (!layout.RowGroupedColumns || !layout.RowGroupedColumns.length) {
3392
- return;
3393
- }
3394
- const groupColumnWithDifferentWidths = this.agGridAdapter
3395
- .getAgGridApi()
3396
- .getColumnState()
3397
- .reduce((acc, col) => {
3398
- var _a;
3399
- if (this.api.columnApi.isAutoRowGroupColumn(col.colId)) {
3400
- const widthInLayout = (_a = layout.ColumnWidthMap) === null || _a === void 0 ? void 0 : _a[col.colId];
3401
- if (widthInLayout && widthInLayout !== col.width) {
3402
- acc.push(Object.assign(Object.assign({}, col), { width: widthInLayout }));
3403
- }
3404
- }
3405
- return acc;
3406
- }, []);
3407
- if (groupColumnWithDifferentWidths.length === 0) {
3408
- return;
3409
- }
3410
- this.agGridAdapter.getAgGridApi().applyColumnState({
3411
- state: groupColumnWithDifferentWidths,
3412
- });
3413
- }
3414
3381
  onRowDataChanged({ rowNode, oldData, newData, }) {
3415
3382
  if (oldData == null || oldData == undefined) {
3416
3383
  return;
@@ -3707,15 +3674,18 @@ export class AdaptableAgGrid {
3707
3674
  var _a, _b;
3708
3675
  const agGridApi = this.agGridAdapter.getAgGridApi();
3709
3676
  const columnState = agGridApi.getColumnState();
3677
+ const expandedState = agGridApi.getState().rowGroupExpansion || { expandedRowGroupIds: [] };
3678
+ const currentLayoutState = { columnState, expandedState };
3710
3679
  try {
3711
- const stringifiedState = JSON.stringify(columnState);
3712
- if (stringifiedState === this.previousAgGridColumnState) {
3680
+ // TODO
3681
+ const stringifiedLayoutState = JSON.stringify(currentLayoutState);
3682
+ if (stringifiedLayoutState === this.previousAgGridLayoutState) {
3713
3683
  // same grid column state as a previous,
3714
3684
  // so no need to update, as the layout has already been updated
3715
3685
  // for this grid column state
3716
3686
  return;
3717
3687
  }
3718
- this.previousAgGridColumnState = stringifiedState;
3688
+ this.previousAgGridLayoutState = stringifiedLayoutState;
3719
3689
  }
3720
3690
  catch (ex) {
3721
3691
  this.logger.consoleError('Error stringifying column state', ex);
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: 1712232524555 || Date.now(),
4
- VERSION: "18.0.0-canary.22" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1712304058670 || Date.now(),
4
+ VERSION: "18.0.0-canary.23" || '--current-version--',
5
5
  };
@@ -1358,16 +1358,6 @@ export declare const ADAPTABLE_METAMODEL: {
1358
1358
  kind: string;
1359
1359
  desc: string;
1360
1360
  };
1361
- BalancedGroupsKeyContext: {
1362
- name: string;
1363
- kind: string;
1364
- desc: string;
1365
- props: {
1366
- name: string;
1367
- kind: string;
1368
- desc: string;
1369
- }[];
1370
- };
1371
1361
  BaseContext: {
1372
1362
  name: string;
1373
1363
  kind: string;