@adaptabletools/adaptable 18.0.0-canary.21 → 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.
Files changed (49) hide show
  1. package/base.css +2 -0
  2. package/base.css.map +1 -1
  3. package/index.css +4 -0
  4. package/index.css.map +1 -1
  5. package/package.json +1 -1
  6. package/src/AdaptableOptions/CommentOptions.d.ts +9 -3
  7. package/src/AdaptableOptions/DataImportOptions.d.ts +2 -2
  8. package/src/AdaptableOptions/GroupingOptions.d.ts +0 -19
  9. package/src/AdaptableOptions/NoteOptions.d.ts +8 -2
  10. package/src/Api/ColumnApi.d.ts +5 -0
  11. package/src/Api/CommentApi.d.ts +12 -13
  12. package/src/Api/Implementation/ColumnApiImpl.d.ts +3 -0
  13. package/src/Api/Implementation/ColumnApiImpl.js +19 -6
  14. package/src/Api/Implementation/CommentsApiImpl.d.ts +3 -3
  15. package/src/Api/Implementation/CommentsApiImpl.js +5 -5
  16. package/src/Api/Implementation/ScopeApiImpl.js +34 -1
  17. package/src/Api/Internal/ColumnInternalApi.d.ts +2 -0
  18. package/src/Api/Internal/ColumnInternalApi.js +7 -1
  19. package/src/Redux/ActionsReducers/CommentsRedux.d.ts +0 -4
  20. package/src/Redux/ActionsReducers/CommentsRedux.js +0 -34
  21. package/src/Redux/Store/AdaptableStore.js +4 -4
  22. package/src/Strategy/CommentModule.d.ts +0 -1
  23. package/src/Strategy/CommentModule.js +7 -7
  24. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  25. package/src/Utilities/Constants/GeneralConstants.js +1 -0
  26. package/src/View/Comments/CommentsEditor.js +4 -6
  27. package/src/View/Comments/CommentsPopup.js +5 -2
  28. package/src/View/Components/CellPopup/index.js +1 -1
  29. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +9 -1
  30. package/src/View/DataImport/DataImportWizard/DataImportWizard.js +1 -1
  31. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +19 -6
  32. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +0 -5
  33. package/src/View/Note/NotePopup.js +5 -2
  34. package/src/agGrid/AdaptableAgGrid.d.ts +1 -10
  35. package/src/agGrid/AdaptableAgGrid.js +28 -99
  36. package/src/agGrid/AgGridAdapter.d.ts +1 -0
  37. package/src/agGrid/AgGridAdapter.js +4 -0
  38. package/src/agGrid/AgGridColumnAdapter.d.ts +0 -2
  39. package/src/agGrid/AgGridColumnAdapter.js +0 -43
  40. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +7 -0
  41. package/src/agGrid/buildSortedColumnStateForLayout.js +120 -0
  42. package/src/agGrid/defaultAdaptableOptions.js +0 -1
  43. package/src/agGrid/sortColumnStateForVisibleColumns.d.ts +12 -0
  44. package/src/agGrid/sortColumnStateForVisibleColumns.js +46 -0
  45. package/src/env.js +2 -2
  46. package/src/metamodel/adaptable.metamodel.d.ts +18 -22
  47. package/src/metamodel/adaptable.metamodel.js +1 -1
  48. package/src/types.d.ts +1 -1
  49. package/tsconfig.esm.tsbuildinfo +1 -1
@@ -5,7 +5,7 @@ import { IRowNode } from '@ag-grid-community/core';
5
5
  */
6
6
  export interface DataImportOptions<T = Record<string, any>> {
7
7
  /**
8
- * File extensions that the Data Import function accepts
8
+ * Custom File Handlers to use for Data Import
9
9
  */
10
10
  fileHandlers?: DataImportFileHandler<T>[];
11
11
  /**
@@ -60,7 +60,7 @@ export interface DataImportFileHandler<T = Record<string, any>> {
60
60
  */
61
61
  fileExtension?: string;
62
62
  /**
63
- * Function which handles the File
63
+ * Async function which handles the import returning a Data Record
64
64
  */
65
65
  handleFile: (file: File) => Promise<T[]>;
66
66
  }
@@ -1,13 +1,7 @@
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
  */
6
4
  export interface GroupingOptions<TData = any> {
7
- /**
8
- * Value to use for 'Balanced Groups' (string columns only)
9
- */
10
- balancedGroupsKey?: string | ((context: BalancedGroupsKeyContext<TData>) => string);
11
5
  /**
12
6
  * Places ungrouped columns at pre-grouping indexed position
13
7
  * @defaultValue false
@@ -23,16 +17,3 @@ export interface GroupingOptions<TData = any> {
23
17
  */
24
18
  autoOrderGroupedColumns?: boolean;
25
19
  }
26
- /**
27
- * Context used when setting a value for Balanced Row Groups
28
- */
29
- export interface BalancedGroupsKeyContext<TData = any> extends BaseContext {
30
- /**
31
- * AdapTable Column being grouped
32
- */
33
- adaptableColumn: AdaptableColumn<TData>;
34
- /**
35
- * AG Grid's Key Creator Params
36
- */
37
- params: KeyCreatorParams<TData>;
38
- }
@@ -7,13 +7,19 @@ export interface NoteOptions<TData = any> {
7
7
  * Whether a cell can contain Notes
8
8
  */
9
9
  isCellNotable?: (context: NotableCellContext) => boolean;
10
+ /**
11
+ * Format string for formatting in the Notes Popup
12
+ *
13
+ * @defaultValue 'dd-MM-yyyy HH:mm:ss'
14
+ */
15
+ dateFormat?: string;
10
16
  }
11
17
  /**
12
18
  * Context used when determining if a Note can be added to a Cell
13
19
  */
14
20
  export interface NotableCellContext extends BaseContext {
15
21
  /**
16
- * Grid Cell in AdapTable which has been clicked
17
- */
22
+ * Grid Cell in AdapTable which has been clicked
23
+ */
18
24
  gridCell: GridCell;
19
25
  }
@@ -266,4 +266,9 @@ export interface ColumnApi {
266
266
  * Returns available columns types defined under columnOptions.columnTypes
267
267
  */
268
268
  getColumnTypes(): string[];
269
+ /**
270
+ * Returns all columns of a given columnType
271
+ * @param columnType the columnType to filter by
272
+ */
273
+ getColumnsByColumnType(columnType: string): AdaptableColumn[];
269
274
  }
@@ -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
  }
@@ -3,6 +3,8 @@ import { AdaptableColumn, AdaptableColumnDataType } from '../../PredefinedConfig
3
3
  import { ColumnApi } from '../ColumnApi';
4
4
  import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
5
5
  import { ColumnInternalApi } from '../Internal/ColumnInternalApi';
6
+ export declare function isAutoRowGroupColumn(columnId: string): boolean;
7
+ export declare function isAutoPivotColumn(columnId: string): boolean;
6
8
  export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
7
9
  internalApi: ColumnInternalApi;
8
10
  constructor(adaptable: IAdaptable);
@@ -64,4 +66,5 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
64
66
  isSpecialColumn(columnId: string): boolean;
65
67
  openColumnInfoSettingsPanel(): void;
66
68
  getColumnTypes(): string[];
69
+ getColumnsByColumnType(columnType: string): AdaptableColumn[];
67
70
  }
@@ -4,6 +4,16 @@ import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
4
4
  import ArrayExtensions from '../../Utilities/Extensions/ArrayExtensions';
5
5
  import { ColumnInternalApi } from '../Internal/ColumnInternalApi';
6
6
  import { createBaseContext } from '../../Utilities/ObjectFactory';
7
+ export function isAutoRowGroupColumn(columnId) {
8
+ // put this here as there might be other indicators we are not aware of
9
+ // perhaps with non auto groups ?
10
+ //https://www.ag-grid.com/javascript-grid-grouping/
11
+ return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
12
+ }
13
+ export function isAutoPivotColumn(columnId) {
14
+ // put this here as there might be other indicators we are not aware of?
15
+ return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
16
+ }
7
17
  export class ColumnApiImpl extends ApiBase {
8
18
  constructor(adaptable) {
9
19
  super(adaptable);
@@ -52,14 +62,10 @@ export class ColumnApiImpl extends ApiBase {
52
62
  this.adaptable.showColumn(columnId);
53
63
  }
54
64
  isAutoRowGroupColumn(columnId) {
55
- // put this here as there might be other indicators we are not aware of
56
- // perhaps with non auto groups ?
57
- //https://www.ag-grid.com/javascript-grid-grouping/
58
- return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
65
+ return isAutoRowGroupColumn(columnId);
59
66
  }
60
67
  isAutoPivotColumn(columnId) {
61
- // put this here as there might be other indicators we are not aware of?
62
- return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
68
+ return isAutoPivotColumn(columnId);
63
69
  }
64
70
  isCalculatedColumn(columnId) {
65
71
  return (this.adaptable.api.calculatedColumnApi
@@ -343,4 +349,11 @@ export class ColumnApiImpl extends ApiBase {
343
349
  return columnTypes;
344
350
  }
345
351
  }
352
+ getColumnsByColumnType(columnType) {
353
+ const abColumns = this.getColumns();
354
+ return abColumns.filter((c) => {
355
+ var _a;
356
+ return ((_a = c.columnTypes) !== null && _a !== void 0 ? _a : []).includes(columnType);
357
+ });
358
+ }
346
359
  }
@@ -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
  }
@@ -43,7 +43,9 @@ export class ScopeApiImpl extends ApiBase {
43
43
  return 'Columns: All';
44
44
  }
45
45
  if ('ColumnTypes' in scope) {
46
- return ((scope.ColumnTypes.length > 0 ? 'ColumnTypes' : 'ColumnType') + ': ' + scope.ColumnTypes.join(', '));
46
+ return ((scope.ColumnTypes.length > 0 ? 'ColumnTypes' : 'ColumnType') +
47
+ ': ' +
48
+ scope.ColumnTypes.join(', '));
47
49
  }
48
50
  if ('DataTypes' in scope) {
49
51
  return ((scope.DataTypes.length > 0 ? 'DataTypes' : 'DataType') + ': ' + scope.DataTypes.join(', '));
@@ -160,6 +162,7 @@ export class ScopeApiImpl extends ApiBase {
160
162
  return undefined;
161
163
  }
162
164
  isColumnInNumericScope(column, scope) {
165
+ var _a, _b;
163
166
  // if column is not even numeric then return false
164
167
  if (column == null || column == undefined || column.dataType !== 'Number') {
165
168
  return false;
@@ -176,9 +179,14 @@ export class ScopeApiImpl extends ApiBase {
176
179
  if ('DataTypes' in scope && scope.DataTypes.includes('Number')) {
177
180
  return true;
178
181
  }
182
+ if ('ColumnTypes' in scope &&
183
+ ((_b = (_a = scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.some) === null || _b === void 0 ? void 0 : _b.call(_a, (scopeColumnType) => { var _a, _b; return (_b = (_a = column.columnTypes) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, scopeColumnType); }))) {
184
+ return true;
185
+ }
179
186
  return false;
180
187
  }
181
188
  isColumnInStringsScope(column, scope) {
189
+ var _a, _b;
182
190
  // if column is not even string then return false
183
191
  if (column == null || column == undefined || column.dataType !== 'String') {
184
192
  return false;
@@ -195,9 +203,14 @@ export class ScopeApiImpl extends ApiBase {
195
203
  if ('DataTypes' in scope && scope.DataTypes.includes('String')) {
196
204
  return true;
197
205
  }
206
+ if ('ColumnTypes' in scope &&
207
+ ((_b = (_a = scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.some) === null || _b === void 0 ? void 0 : _b.call(_a, (scopeColumnType) => { var _a, _b; return (_b = (_a = column.columnTypes) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, scopeColumnType); }))) {
208
+ return true;
209
+ }
198
210
  return false;
199
211
  }
200
212
  isColumnInDateScope(column, scope) {
213
+ var _a, _b;
201
214
  // if column is not even numeric then return false
202
215
  if (column == null || column == undefined || column.dataType !== 'Date') {
203
216
  return false;
@@ -214,6 +227,10 @@ export class ScopeApiImpl extends ApiBase {
214
227
  if ('DataTypes' in scope && scope.DataTypes.includes('Date')) {
215
228
  return true;
216
229
  }
230
+ if ('ColumnTypes' in scope &&
231
+ ((_b = (_a = scope.ColumnTypes) === null || _a === void 0 ? void 0 : _a.some) === null || _b === void 0 ? void 0 : _b.call(_a, (scopeColumnType) => { var _a, _b; return (_b = (_a = column.columnTypes) === null || _a === void 0 ? void 0 : _a.includes) === null || _b === void 0 ? void 0 : _b.call(_a, scopeColumnType); }))) {
232
+ return true;
233
+ }
217
234
  return false;
218
235
  }
219
236
  isScopeInScope(a, b) {
@@ -240,6 +257,22 @@ export class ScopeApiImpl extends ApiBase {
240
257
  })) {
241
258
  return true;
242
259
  }
260
+ if ('ColumnTypes' in a &&
261
+ 'ColumnTypes' in b &&
262
+ a.ColumnTypes.every((columnType) => b.ColumnTypes.includes(columnType))) {
263
+ return true;
264
+ }
265
+ // check if each colum in a has column types in b
266
+ if ('ColumnIds' in a && 'ColumnTypes' in b) {
267
+ const inScope = a.ColumnIds.every((columnId) => {
268
+ const column = this.adaptable.api.columnApi.getColumnWithColumnId(columnId);
269
+ // check if at least one column-type is in scope
270
+ return column.columnTypes.some((columnColumnType) => b.ColumnTypes.includes(columnColumnType));
271
+ });
272
+ if (inScope) {
273
+ return true;
274
+ }
275
+ }
243
276
  return false;
244
277
  }
245
278
  createCellColorRangesForScope(scope) {
@@ -2,6 +2,7 @@ import { ApiBase } from '../Implementation/ApiBase';
2
2
  import { Column, IRowNode } from '@ag-grid-community/core';
3
3
  import { CustomSort } from '../../PredefinedConfig/CustomSortState';
4
4
  import { ColumnValuesComparer } from '../../AdaptableOptions/CustomSortOptions';
5
+ export declare function getAutoRowGroupColumnIdFor(columnId: string): string;
5
6
  export declare class ColumnInternalApi extends ApiBase {
6
7
  /**
7
8
  * Retrieves 'ColumnType' property for a given Column
@@ -15,6 +16,7 @@ export declare class ColumnInternalApi extends ApiBase {
15
16
  * Retrieves a list providing the Friendly Name / Caption for all columns
16
17
  */
17
18
  getAllColumnFriendlyNames(): string[];
19
+ getAutoRowGroupColumnIdFor(columnId: string): string;
18
20
  /**
19
21
  * Retrieves AG Grid's field property for the column
20
22
  * @param columnId columnId to look up
@@ -1,5 +1,8 @@
1
1
  import { ApiBase } from '../Implementation/ApiBase';
2
- import { ADAPTABLE_ROW_ACTION_BUTTONS } from '../../Utilities/Constants/GeneralConstants';
2
+ import { ADAPTABLE_ROW_ACTION_BUTTONS, AG_GRID_GROUPED_COLUMN, } from '../../Utilities/Constants/GeneralConstants';
3
+ export function getAutoRowGroupColumnIdFor(columnId) {
4
+ return `${AG_GRID_GROUPED_COLUMN}-${columnId}`;
5
+ }
3
6
  export class ColumnInternalApi extends ApiBase {
4
7
  /**
5
8
  * Retrieves 'ColumnType' property for a given Column
@@ -21,6 +24,9 @@ export class ColumnInternalApi extends ApiBase {
21
24
  return c.friendlyName;
22
25
  });
23
26
  }
27
+ getAutoRowGroupColumnIdFor(columnId) {
28
+ return getAutoRowGroupColumnIdFor(columnId);
29
+ }
24
30
  /**
25
31
  * Retrieves AG Grid's field property for the column
26
32
  * @param columnId columnId to look up
@@ -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
  }));
@@ -35,6 +35,7 @@ export declare const ADAPTABLE_ROW_ACTION_BUTTONS = "adaptableRowActionButtons";
35
35
  export declare const ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = "(ActionRowButtons)";
36
36
  export declare const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = "(FDC3ActionColumn)";
37
37
  export declare const DEFAULT_DATE_FORMAT_PATTERN = "dd-MM-yyyy";
38
+ export declare const DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = "dd-MM-yyyy HH:mm:ss";
38
39
  export declare const BLANK_DISTINCT_COLUMN_VALUE = "[BLANKS]";
39
40
  export declare const DEFAULT_STRING_DISPLAY_VALUE = "Hello World";
40
41
  export declare const DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
@@ -34,6 +34,7 @@ export const ADAPTABLE_ROW_ACTION_BUTTONS = 'adaptableRowActionButtons';
34
34
  export const ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = '(ActionRowButtons)';
35
35
  export const ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = '(FDC3ActionColumn)';
36
36
  export const DEFAULT_DATE_FORMAT_PATTERN = 'dd-MM-yyyy';
37
+ export const DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = 'dd-MM-yyyy HH:mm:ss';
37
38
  export const BLANK_DISTINCT_COLUMN_VALUE = '[BLANKS]';
38
39
  export const DEFAULT_STRING_DISPLAY_VALUE = 'Hello World';
39
40
  export const DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
@@ -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);
@@ -3,10 +3,11 @@ import { useSelector } from 'react-redux';
3
3
  import { DataSource, InfiniteTable } from '../../components/InfiniteTable';
4
4
  import Panel from '../../components/Panel';
5
5
  import { Box, Flex } from 'rebass';
6
- import { formatDate } from '../../Utilities/ExpressionFunctions/dateUtils';
6
+ import dateFnsFormat from 'date-fns/format';
7
7
  import { useAdaptable } from '../AdaptableContext';
8
8
  import { PopupPanel } from '../Components/Popups/AdaptablePopup/PopupPanel';
9
9
  import { AdaptableButtonComponent } from '../Components/AdaptableButton';
10
+ import { DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME } from '../../Utilities/Constants/GeneralConstants';
10
11
  const tableDOMProps = {
11
12
  style: {
12
13
  minHeight: 160,
@@ -14,7 +15,9 @@ const tableDOMProps = {
14
15
  },
15
16
  };
16
17
  const CellComments = (props) => {
18
+ var _a;
17
19
  const adaptable = useAdaptable();
20
+ const dateFormat = (_a = adaptable.api.optionsApi.getCommentOptions().dateFormat) !== null && _a !== void 0 ? _a : DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME;
18
21
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Comment') === 'ReadOnly';
19
22
  const columnsMap = React.useMemo(() => {
20
23
  const columns = {
@@ -27,7 +30,7 @@ const CellComments = (props) => {
27
30
  field: 'Timestamp',
28
31
  maxWidth: 150,
29
32
  valueGetter: (params) => {
30
- return formatDate(params.data.Timestamp, 'MM.DD.YYYY HH:mm');
33
+ return dateFnsFormat(params.data.Timestamp, dateFormat);
31
34
  },
32
35
  },
33
36
  text: {
@@ -13,7 +13,7 @@ const ensurePortalElement = (className) => {
13
13
  }
14
14
  portalElement = document.createElement('div');
15
15
  portalElement.style.position = 'absolute';
16
- portalElement.style.zIndex = '999';
16
+ portalElement.style.zIndex = '4'; // under the context menu
17
17
  portalElement.style.top = '0px';
18
18
  portalElement.style.left = '0px';
19
19
  if (className) {
@@ -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
  };
@@ -132,7 +132,7 @@ export const DataImportWizard = (props) => {
132
132
  return [...userDefinedHandlers, ...systemFileHandlers];
133
133
  }, []);
134
134
  const supportedFileFormats = React.useMemo(() => {
135
- return fileHandlers.map((h) => h.fileExtension).join(', ');
135
+ return [...new Set(fileHandlers.map((h) => h.fileExtension)).values()].join(', ');
136
136
  }, [fileHandlers]);
137
137
  const readFile = React.useCallback(async (file) => {
138
138
  var _a, _b;