@adaptabletools/adaptable-cjs 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 +22 -7
  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 +8 -1
  19. package/src/Redux/ActionsReducers/CommentsRedux.d.ts +0 -4
  20. package/src/Redux/ActionsReducers/CommentsRedux.js +1 -39
  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 +3 -2
  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 +124 -0
  42. package/src/agGrid/defaultAdaptableOptions.js +0 -1
  43. package/src/agGrid/sortColumnStateForVisibleColumns.d.ts +12 -0
  44. package/src/agGrid/sortColumnStateForVisibleColumns.js +50 -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.cjs.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
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColumnApiImpl = void 0;
3
+ exports.ColumnApiImpl = exports.isAutoPivotColumn = exports.isAutoRowGroupColumn = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ApiBase_1 = require("./ApiBase");
6
6
  const GeneralConstants = tslib_1.__importStar(require("../../Utilities/Constants/GeneralConstants"));
@@ -8,6 +8,18 @@ const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/
8
8
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
9
9
  const ColumnInternalApi_1 = require("../Internal/ColumnInternalApi");
10
10
  const ObjectFactory_1 = require("../../Utilities/ObjectFactory");
11
+ function isAutoRowGroupColumn(columnId) {
12
+ // put this here as there might be other indicators we are not aware of
13
+ // perhaps with non auto groups ?
14
+ //https://www.ag-grid.com/javascript-grid-grouping/
15
+ return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
16
+ }
17
+ exports.isAutoRowGroupColumn = isAutoRowGroupColumn;
18
+ function isAutoPivotColumn(columnId) {
19
+ // put this here as there might be other indicators we are not aware of?
20
+ return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
21
+ }
22
+ exports.isAutoPivotColumn = isAutoPivotColumn;
11
23
  class ColumnApiImpl extends ApiBase_1.ApiBase {
12
24
  constructor(adaptable) {
13
25
  super(adaptable);
@@ -56,14 +68,10 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
56
68
  this.adaptable.showColumn(columnId);
57
69
  }
58
70
  isAutoRowGroupColumn(columnId) {
59
- // put this here as there might be other indicators we are not aware of
60
- // perhaps with non auto groups ?
61
- //https://www.ag-grid.com/javascript-grid-grouping/
62
- return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_GROUPED_COLUMN);
71
+ return isAutoRowGroupColumn(columnId);
63
72
  }
64
73
  isAutoPivotColumn(columnId) {
65
- // put this here as there might be other indicators we are not aware of?
66
- return columnId === null || columnId === void 0 ? void 0 : columnId.startsWith(GeneralConstants.AG_GRID_PIVOT_COLUMN);
74
+ return isAutoPivotColumn(columnId);
67
75
  }
68
76
  isCalculatedColumn(columnId) {
69
77
  return (this.adaptable.api.calculatedColumnApi
@@ -347,5 +355,12 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
347
355
  return columnTypes;
348
356
  }
349
357
  }
358
+ getColumnsByColumnType(columnType) {
359
+ const abColumns = this.getColumns();
360
+ return abColumns.filter((c) => {
361
+ var _a;
362
+ return ((_a = c.columnTypes) !== null && _a !== void 0 ? _a : []).includes(columnType);
363
+ });
364
+ }
350
365
  }
351
366
  exports.ColumnApiImpl = ColumnApiImpl;
@@ -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
  }
@@ -12,13 +12,10 @@ class CommentsApiImpl extends ApiBase_1.ApiBase {
12
12
  super(adaptable);
13
13
  this.internalApi = new CommentsInternalApi_1.CommentsInternalApi(adaptable);
14
14
  }
15
- getComments(address) {
16
- return CommentRedux.GetCommentsSelector(this.getAdaptableState().Comment, address);
17
- }
18
15
  getCommentThread(address) {
19
16
  return CommentRedux.GetCellCommentSelector(this.getAdaptableState().Comment, address);
20
17
  }
21
- getCommentThreads() {
18
+ getGridComments() {
22
19
  var _a;
23
20
  return (_a = this.getAdaptableState().Comment.CommentThreads) !== null && _a !== void 0 ? _a : [];
24
21
  }
@@ -45,8 +42,11 @@ class CommentsApiImpl extends ApiBase_1.ApiBase {
45
42
  deleteCommentThread(cellAddress) {
46
43
  this.dispatchAction(CommentRedux.CommentsCellDelete({ cellAddress }));
47
44
  }
48
- loadCommentThreads(cellComments) {
45
+ setGridComments(cellComments) {
49
46
  this.dispatchAction(CommentRedux.CommentsSet({ commentThread: cellComments }));
50
47
  }
48
+ clearGridComments() {
49
+ this.setGridComments([]);
50
+ }
51
51
  }
52
52
  exports.CommentsApiImpl = CommentsApiImpl;
@@ -47,7 +47,9 @@ class ScopeApiImpl extends ApiBase_1.ApiBase {
47
47
  return 'Columns: All';
48
48
  }
49
49
  if ('ColumnTypes' in scope) {
50
- return ((scope.ColumnTypes.length > 0 ? 'ColumnTypes' : 'ColumnType') + ': ' + scope.ColumnTypes.join(', '));
50
+ return ((scope.ColumnTypes.length > 0 ? 'ColumnTypes' : 'ColumnType') +
51
+ ': ' +
52
+ scope.ColumnTypes.join(', '));
51
53
  }
52
54
  if ('DataTypes' in scope) {
53
55
  return ((scope.DataTypes.length > 0 ? 'DataTypes' : 'DataType') + ': ' + scope.DataTypes.join(', '));
@@ -164,6 +166,7 @@ class ScopeApiImpl extends ApiBase_1.ApiBase {
164
166
  return undefined;
165
167
  }
166
168
  isColumnInNumericScope(column, scope) {
169
+ var _a, _b;
167
170
  // if column is not even numeric then return false
168
171
  if (column == null || column == undefined || column.dataType !== 'Number') {
169
172
  return false;
@@ -180,9 +183,14 @@ class ScopeApiImpl extends ApiBase_1.ApiBase {
180
183
  if ('DataTypes' in scope && scope.DataTypes.includes('Number')) {
181
184
  return true;
182
185
  }
186
+ if ('ColumnTypes' in scope &&
187
+ ((_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); }))) {
188
+ return true;
189
+ }
183
190
  return false;
184
191
  }
185
192
  isColumnInStringsScope(column, scope) {
193
+ var _a, _b;
186
194
  // if column is not even string then return false
187
195
  if (column == null || column == undefined || column.dataType !== 'String') {
188
196
  return false;
@@ -199,9 +207,14 @@ class ScopeApiImpl extends ApiBase_1.ApiBase {
199
207
  if ('DataTypes' in scope && scope.DataTypes.includes('String')) {
200
208
  return true;
201
209
  }
210
+ if ('ColumnTypes' in scope &&
211
+ ((_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); }))) {
212
+ return true;
213
+ }
202
214
  return false;
203
215
  }
204
216
  isColumnInDateScope(column, scope) {
217
+ var _a, _b;
205
218
  // if column is not even numeric then return false
206
219
  if (column == null || column == undefined || column.dataType !== 'Date') {
207
220
  return false;
@@ -218,6 +231,10 @@ class ScopeApiImpl extends ApiBase_1.ApiBase {
218
231
  if ('DataTypes' in scope && scope.DataTypes.includes('Date')) {
219
232
  return true;
220
233
  }
234
+ if ('ColumnTypes' in scope &&
235
+ ((_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); }))) {
236
+ return true;
237
+ }
221
238
  return false;
222
239
  }
223
240
  isScopeInScope(a, b) {
@@ -244,6 +261,22 @@ class ScopeApiImpl extends ApiBase_1.ApiBase {
244
261
  })) {
245
262
  return true;
246
263
  }
264
+ if ('ColumnTypes' in a &&
265
+ 'ColumnTypes' in b &&
266
+ a.ColumnTypes.every((columnType) => b.ColumnTypes.includes(columnType))) {
267
+ return true;
268
+ }
269
+ // check if each colum in a has column types in b
270
+ if ('ColumnIds' in a && 'ColumnTypes' in b) {
271
+ const inScope = a.ColumnIds.every((columnId) => {
272
+ const column = this.adaptable.api.columnApi.getColumnWithColumnId(columnId);
273
+ // check if at least one column-type is in scope
274
+ return column.columnTypes.some((columnColumnType) => b.ColumnTypes.includes(columnColumnType));
275
+ });
276
+ if (inScope) {
277
+ return true;
278
+ }
279
+ }
247
280
  return false;
248
281
  }
249
282
  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,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColumnInternalApi = void 0;
3
+ exports.ColumnInternalApi = exports.getAutoRowGroupColumnIdFor = void 0;
4
4
  const ApiBase_1 = require("../Implementation/ApiBase");
5
5
  const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
6
+ function getAutoRowGroupColumnIdFor(columnId) {
7
+ return `${GeneralConstants_1.AG_GRID_GROUPED_COLUMN}-${columnId}`;
8
+ }
9
+ exports.getAutoRowGroupColumnIdFor = getAutoRowGroupColumnIdFor;
6
10
  class ColumnInternalApi extends ApiBase_1.ApiBase {
7
11
  /**
8
12
  * Retrieves 'ColumnType' property for a given Column
@@ -24,6 +28,9 @@ class ColumnInternalApi extends ApiBase_1.ApiBase {
24
28
  return c.friendlyName;
25
29
  });
26
30
  }
31
+ getAutoRowGroupColumnIdFor(columnId) {
32
+ return getAutoRowGroupColumnIdFor(columnId);
33
+ }
27
34
  /**
28
35
  * Retrieves AG Grid's field property for the column
29
36
  * @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>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommentsReducer = exports.GetCellCommentSelector = exports.GetGetCommentsByUuidSelector = exports.GetCommentsSelector = exports.GetGridCellCommentsSelector = exports.CommentsReady = exports.CommentsDelete = exports.CommentsEdit = exports.CommentsCellDelete = exports.CommentsCellAdd = exports.CommentsAdd = exports.CommentsSet = exports.COMMENTS_LOAD = exports.COMMENTS_READY = exports.COMMENTS_DELETE = exports.COMMENTS_EDIT = exports.COMMENTS_CELL_DELETE = exports.COMMENTS_CELL_ADD = exports.COMMENTS_ADD = void 0;
3
+ exports.CommentsReducer = exports.GetCellCommentSelector = exports.CommentsDelete = exports.CommentsEdit = exports.CommentsCellDelete = exports.CommentsCellAdd = exports.CommentsAdd = exports.CommentsSet = exports.COMMENTS_LOAD = exports.COMMENTS_READY = exports.COMMENTS_DELETE = exports.COMMENTS_EDIT = exports.COMMENTS_CELL_DELETE = exports.COMMENTS_CELL_ADD = exports.COMMENTS_ADD = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
6
6
  const ObjectFactory_1 = tslib_1.__importDefault(require("../../Utilities/ObjectFactory"));
@@ -63,44 +63,6 @@ const CommentsDelete = ({ commentUuid, cellAddress, }) => ({
63
63
  commentUuid,
64
64
  });
65
65
  exports.CommentsDelete = CommentsDelete;
66
- const CommentsReady = (commentstate) => ({
67
- type: exports.COMMENTS_READY,
68
- commentState: commentstate,
69
- });
70
- exports.CommentsReady = CommentsReady;
71
- const GetGridCellCommentsSelector = (state, address) => {
72
- var _a;
73
- if (!address) {
74
- return null;
75
- }
76
- return ((_a = state === null || state === void 0 ? void 0 : state.CommentThreads) !== null && _a !== void 0 ? _a : []).find((cellComments) => {
77
- return CellPopupService_1.CellPopupService.isSameAddress(cellComments, address);
78
- });
79
- };
80
- exports.GetGridCellCommentsSelector = GetGridCellCommentsSelector;
81
- const GetCommentsSelector = (state, address) => {
82
- var _a, _b;
83
- if (!address) {
84
- return [];
85
- }
86
- const comments = (_b = ((_a = state === null || state === void 0 ? void 0 : state.CommentThreads) !== null && _a !== void 0 ? _a : []).find((cellComments) => {
87
- return CellPopupService_1.CellPopupService.isSameAddress(cellComments, address);
88
- })) === null || _b === void 0 ? void 0 : _b.Comments;
89
- return comments;
90
- };
91
- exports.GetCommentsSelector = GetCommentsSelector;
92
- const GetGetCommentsByUuidSelector = (state, uuid) => {
93
- var _a;
94
- for (const commentThread of (_a = state.CommentThreads) !== null && _a !== void 0 ? _a : []) {
95
- for (const comment of commentThread.Comments) {
96
- if (comment.Uuid === uuid) {
97
- return comment;
98
- }
99
- }
100
- }
101
- return undefined;
102
- };
103
- exports.GetGetCommentsByUuidSelector = GetGetCommentsByUuidSelector;
104
66
  const GetCellCommentSelector = (state, address) => {
105
67
  var _a;
106
68
  if (!address) {
@@ -913,8 +913,8 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
913
913
  adaptable.refreshCells([node], [columnId], true);
914
914
  requestAnimationFrame(() => {
915
915
  var _a, _b;
916
- const commentThreads = adaptable.api.commentApi.getCommentThreads();
917
- adaptable.api.eventApi.emit('CommentChanged', adaptable.api.commentApi.getCommentThreads());
916
+ const commentThreads = adaptable.api.commentApi.getGridComments();
917
+ adaptable.api.eventApi.emit('CommentChanged', adaptable.api.commentApi.getGridComments());
918
918
  (_b = (_a = adaptable.api.optionsApi
919
919
  .getCommentOptions()) === null || _a === void 0 ? void 0 : _a.persistCommentThreads) === null || _b === void 0 ? void 0 : _b.call(_a, commentThreads);
920
920
  });
@@ -922,9 +922,9 @@ const adaptableMiddleware = (adaptable) => (function(middlewareAPI) {
922
922
  return returnAction;
923
923
  }
924
924
  case CommentsRedux.COMMENTS_LOAD: {
925
- const previousCommentThreads = adaptable.api.commentApi.getCommentThreads();
925
+ const previousCommentThreads = adaptable.api.commentApi.getGridComments();
926
926
  let returnAction = next(action);
927
- const newCommentThreads = (_j = adaptable.api.commentApi.getCommentThreads()) !== null && _j !== void 0 ? _j : [];
927
+ const newCommentThreads = (_j = adaptable.api.commentApi.getGridComments()) !== null && _j !== void 0 ? _j : [];
928
928
  requestAnimationFrame(() => {
929
929
  let addedCommentThreads = [];
930
930
  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;
@@ -26,7 +26,7 @@ class CommentModule extends AdaptableModuleBase_1.AdaptableModuleBase {
26
26
  var _a, _b;
27
27
  const commentThreads = await ((_b = (_a = this.api.optionsApi
28
28
  .getCommentOptions()) === null || _a === void 0 ? void 0 : _a.loadCommentThreads) === null || _b === void 0 ? void 0 : _b.call(_a, (0, ObjectFactory_1.createBaseContext)(this.api)));
29
- this.api.commentApi.loadCommentThreads(commentThreads);
29
+ this.api.commentApi.setGridComments(commentThreads);
30
30
  }
31
31
  addContextMenuItems(menuContext) {
32
32
  var _a, _b;
@@ -42,17 +42,17 @@ class CommentModule extends AdaptableModuleBase_1.AdaptableModuleBase {
42
42
  return items;
43
43
  }
44
44
  getAddRemoveCommentsMenuItems(menuContext) {
45
+ var _a;
45
46
  const items = [];
46
- // does not have note
47
+ if (!this.api.commentApi.internalApi.areCommentsAvailable()) {
48
+ return items;
49
+ }
47
50
  const cellAddress = {
48
51
  PrimaryKeyValue: menuContext.primaryKeyValue,
49
52
  ColumnId: menuContext.adaptableColumn.columnId,
50
53
  };
51
- const comments = this.api.commentApi.getComments(cellAddress);
52
- if (!this.api.commentApi.internalApi.areCommentsAvailable()) {
53
- return items;
54
- }
55
- if (comments) {
54
+ const cellComments = (_a = this.api.commentApi.getCommentThread(cellAddress)) === null || _a === void 0 ? void 0 : _a.Comments;
55
+ if (cellComments) {
56
56
  items.push(this.createMenuItemClickFunction('comment-remove', 'Remove Comment', this.moduleInfo.Glyph, () => {
57
57
  this.api.commentApi.deleteCommentThread(cellAddress);
58
58
  }));
@@ -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;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALERT_DEFAULT_SHOW_POPUP = exports.ALERT_DEFAULT_MESSAGE_TYPE = exports.PLUS_MINUS_DEFAULT_NUDGE_VALUE = exports.SERVER_VALIDATION_MESSAGE_TYPE = exports.SERVER_VALIDATION_HEADER = exports.DEFAULT_LIVE_REPORT_THROTTLE_TIME = exports.THEME_DEFAULT_CURRENT_THEME = exports.SYSTEM_DEFAULT_SYSTEM_STATUS_TYPE = exports.CELL_SUMMARY_DEFAULT_OPERATION = exports.QUICK_SEARCH_DEBOUNCE_TIME = exports.QUICK_SEARCH_DEFAULT_FORE_COLOR = exports.QUICK_SEARCH_DEFAULT_BACK_COLOR = exports.SYSTEM_STATUS_DEFAULT_MAX_MESSAGES_IN_STORE = exports.DEFAULT_DOUBLE_DISPLAY_VALUE = exports.DEFAULT_INTEGER_DISPLAY_VALUE = exports.DEFAULT_STRING_DISPLAY_VALUE = exports.BLANK_DISTINCT_COLUMN_VALUE = exports.DEFAULT_DATE_FORMAT_PATTERN = exports.ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = exports.ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = exports.ADAPTABLE_ROW_ACTION_BUTTONS = exports.AG_GRID_CHART_WINDOW = exports.AG_GRID_PIVOT_COLUMN = exports.AG_GRID_GROUPED_COLUMN = exports.GROUP_PATH_SEPARATOR = exports.HALF_SECOND = exports.AB_FDC3_COLUMN = exports.AB_ROW_ACTIONS_COLUMN = exports.AB_SPECIAL_COLUMN = exports.EMPTY_ARRAY = exports.EMPTY_STRING = exports.FILTER_THROTTLE = exports.FILTER_NEVER = exports.FILTER_ALWAYS = exports.ALL_COLUMN_VALUES = exports.READ_ONLY_STYLE = exports.MENU_PREFIX = exports.AGGRID_TOOLPANEL_COLUMNS = exports.AGGRID_TOOLPANEL_FILTERS = exports.ADAPTABLE_TOOLPANEL_COMPONENT = exports.ADAPTABLE_TOOLPANEL_ID = exports.ADAPTABLE = exports.ADAPTABLE_ID = exports.USER_NAME = exports.OS_THEME = exports.DARK_THEME = exports.LIGHT_THEME = exports.DEFAULT_LAYOUT = exports.MISSING_COLUMN = exports.AUTOGENERATED_PK_COLUMN = void 0;
4
- exports.THEME_STYLE = exports.SELECTED_ROWS_REPORT = exports.SELECTED_CELLS_REPORT = exports.CURRENT_DATA_REPORT = exports.ALL_DATA_REPORT = exports.VISUAL_DATA_REPORT = exports.SYSTEM_THEMES = exports.SMART_EDIT_MATH_OPERATION_STATE_PROPERTY = exports.SMART_EDIT_VALUE_STATE_PROPERTY = exports.QUICK_SEARCH_STYLE_STATE_PROPERTY = exports.QUICK_SEARCH_TEXT_STATE_PROPERTY = exports.CURRENT_THEME_STATE_PROPERTY = exports.FLASHING_CELL_DEFAULT_DURATION_STATE_PROPERTY = exports.FLASHING_CELL_DEFAULT_DOWN_COLOR_STATE_PROPERTY = exports.FLASHING_CELL_DEFAULT_UP_COLOR_STATE_PROPERTY = exports.CURRENT_REPORT_STATE_PROPERTY = exports.CURRENT_LAYOUT_STATE_PROPERTY = exports.SUMMARY_OPERATION_STATE_PROPERTY = void 0;
3
+ exports.ALERT_DEFAULT_MESSAGE_TYPE = exports.PLUS_MINUS_DEFAULT_NUDGE_VALUE = exports.SERVER_VALIDATION_MESSAGE_TYPE = exports.SERVER_VALIDATION_HEADER = exports.DEFAULT_LIVE_REPORT_THROTTLE_TIME = exports.THEME_DEFAULT_CURRENT_THEME = exports.SYSTEM_DEFAULT_SYSTEM_STATUS_TYPE = exports.CELL_SUMMARY_DEFAULT_OPERATION = exports.QUICK_SEARCH_DEBOUNCE_TIME = exports.QUICK_SEARCH_DEFAULT_FORE_COLOR = exports.QUICK_SEARCH_DEFAULT_BACK_COLOR = exports.SYSTEM_STATUS_DEFAULT_MAX_MESSAGES_IN_STORE = exports.DEFAULT_DOUBLE_DISPLAY_VALUE = exports.DEFAULT_INTEGER_DISPLAY_VALUE = exports.DEFAULT_STRING_DISPLAY_VALUE = exports.BLANK_DISTINCT_COLUMN_VALUE = exports.DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = exports.DEFAULT_DATE_FORMAT_PATTERN = exports.ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = exports.ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = exports.ADAPTABLE_ROW_ACTION_BUTTONS = exports.AG_GRID_CHART_WINDOW = exports.AG_GRID_PIVOT_COLUMN = exports.AG_GRID_GROUPED_COLUMN = exports.GROUP_PATH_SEPARATOR = exports.HALF_SECOND = exports.AB_FDC3_COLUMN = exports.AB_ROW_ACTIONS_COLUMN = exports.AB_SPECIAL_COLUMN = exports.EMPTY_ARRAY = exports.EMPTY_STRING = exports.FILTER_THROTTLE = exports.FILTER_NEVER = exports.FILTER_ALWAYS = exports.ALL_COLUMN_VALUES = exports.READ_ONLY_STYLE = exports.MENU_PREFIX = exports.AGGRID_TOOLPANEL_COLUMNS = exports.AGGRID_TOOLPANEL_FILTERS = exports.ADAPTABLE_TOOLPANEL_COMPONENT = exports.ADAPTABLE_TOOLPANEL_ID = exports.ADAPTABLE = exports.ADAPTABLE_ID = exports.USER_NAME = exports.OS_THEME = exports.DARK_THEME = exports.LIGHT_THEME = exports.DEFAULT_LAYOUT = exports.MISSING_COLUMN = exports.AUTOGENERATED_PK_COLUMN = void 0;
4
+ exports.THEME_STYLE = exports.SELECTED_ROWS_REPORT = exports.SELECTED_CELLS_REPORT = exports.CURRENT_DATA_REPORT = exports.ALL_DATA_REPORT = exports.VISUAL_DATA_REPORT = exports.SYSTEM_THEMES = exports.SMART_EDIT_MATH_OPERATION_STATE_PROPERTY = exports.SMART_EDIT_VALUE_STATE_PROPERTY = exports.QUICK_SEARCH_STYLE_STATE_PROPERTY = exports.QUICK_SEARCH_TEXT_STATE_PROPERTY = exports.CURRENT_THEME_STATE_PROPERTY = exports.FLASHING_CELL_DEFAULT_DURATION_STATE_PROPERTY = exports.FLASHING_CELL_DEFAULT_DOWN_COLOR_STATE_PROPERTY = exports.FLASHING_CELL_DEFAULT_UP_COLOR_STATE_PROPERTY = exports.CURRENT_REPORT_STATE_PROPERTY = exports.CURRENT_LAYOUT_STATE_PROPERTY = exports.SUMMARY_OPERATION_STATE_PROPERTY = exports.ALERT_DEFAULT_SHOW_POPUP = void 0;
5
5
  const Enums_1 = require("../../PredefinedConfig/Common/Enums");
6
6
  const UIHelper_1 = require("../../View/UIHelper");
7
7
  exports.AUTOGENERATED_PK_COLUMN = '__ADAPTABLE_PK__';
@@ -38,6 +38,7 @@ exports.ADAPTABLE_ROW_ACTION_BUTTONS = 'adaptableRowActionButtons';
38
38
  exports.ADAPTABLE_ROW_ACTION_BUTTONS_FRIENDLY_NAME = '(ActionRowButtons)';
39
39
  exports.ADAPTABLE_FDC3_ACTION_COLUMN_FRIENDLY_NAME = '(FDC3ActionColumn)';
40
40
  exports.DEFAULT_DATE_FORMAT_PATTERN = 'dd-MM-yyyy';
41
+ exports.DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME = 'dd-MM-yyyy HH:mm:ss';
41
42
  exports.BLANK_DISTINCT_COLUMN_VALUE = '[BLANKS]';
42
43
  exports.DEFAULT_STRING_DISPLAY_VALUE = 'Hello World';
43
44
  exports.DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
@@ -66,13 +66,11 @@ const CommentsEditor = (props) => {
66
66
  const isOwnComment = ((_a = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _a === void 0 ? void 0 : _a.UserName)
67
67
  ? ((_b = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _b === void 0 ? void 0 : _b.UserName) === userId
68
68
  : true; // no owner means it's the current user
69
- return (React.createElement(rebass_1.Box, { p: 2, key: (_c = comment.Uuid) !== null && _c !== void 0 ? _c : index, style: {
70
- borderBottom: '1px solid var(--ab-color-primarydark)',
71
- } },
69
+ return (React.createElement(rebass_1.Box, { p: 2, key: (_c = comment.Uuid) !== null && _c !== void 0 ? _c : index, className: "ab-Comment" },
72
70
  React.createElement(rebass_1.Flex, { mb: 2, alignItems: "center" },
73
71
  React.createElement(rebass_1.Box, null,
74
- React.createElement(rebass_1.Box, { fontSize: 3, fontWeight: "bold" }, (_d = comment === null || comment === void 0 ? void 0 : comment.Author) === null || _d === void 0 ? void 0 : _d.UserName),
75
- comment.Timestamp && (React.createElement(rebass_1.Box, { fontSize: 2 }, (0, dateUtils_1.formatDate)(comment.Timestamp, 'MM.DD.YYYY HH:mm')))),
72
+ React.createElement(rebass_1.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),
73
+ comment.Timestamp && (React.createElement(rebass_1.Box, { "data-name": "comment-timestamp", fontSize: 2 }, (0, dateUtils_1.formatDate)(comment.Timestamp, 'MM.DD.YYYY HH:mm')))),
76
74
  React.createElement(rebass_1.Box, { flex: 1 }),
77
75
  React.createElement(SimpleButton_1.default, { variant: "text", icon: "edit", disabled: !isOwnComment || isReadOnlyModule, onClick: () => setActiveEditingComment(comment.Uuid) }),
78
76
  React.createElement(SimpleButton_1.default, { variant: "text", icon: "delete", disabled: !isOwnComment || isReadOnlyModule, onClick: () => {
@@ -87,7 +85,7 @@ const CommentsEditor = (props) => {
87
85
  }
88
86
  }, onChange: (event) => {
89
87
  adaptable.api.commentApi.editComment(Object.assign(Object.assign({}, comment), { Value: event.target.value }), cellAddress);
90
- } })) : (React.createElement(rebass_1.Text, null, comment.Value)))));
88
+ } })) : (React.createElement(rebass_1.Text, { "data-name": "comment-text" }, comment.Value)))));
91
89
  })),
92
90
  React.createElement(AdaptableInput_1.default, { autoFocus: !comments || comments.length === 0, value: newCommentText, disabled: isReadOnlyModule, onChange: (event) => {
93
91
  setNewCommentText(event.target.value);
@@ -7,10 +7,11 @@ const react_redux_1 = require("react-redux");
7
7
  const InfiniteTable_1 = require("../../components/InfiniteTable");
8
8
  const Panel_1 = tslib_1.__importDefault(require("../../components/Panel"));
9
9
  const rebass_1 = require("rebass");
10
- const dateUtils_1 = require("../../Utilities/ExpressionFunctions/dateUtils");
10
+ const format_1 = tslib_1.__importDefault(require("date-fns/format"));
11
11
  const AdaptableContext_1 = require("../AdaptableContext");
12
12
  const PopupPanel_1 = require("../Components/Popups/AdaptablePopup/PopupPanel");
13
13
  const AdaptableButton_1 = require("../Components/AdaptableButton");
14
+ const GeneralConstants_1 = require("../../Utilities/Constants/GeneralConstants");
14
15
  const tableDOMProps = {
15
16
  style: {
16
17
  minHeight: 160,
@@ -18,7 +19,9 @@ const tableDOMProps = {
18
19
  },
19
20
  };
20
21
  const CellComments = (props) => {
22
+ var _a;
21
23
  const adaptable = (0, AdaptableContext_1.useAdaptable)();
24
+ const dateFormat = (_a = adaptable.api.optionsApi.getCommentOptions().dateFormat) !== null && _a !== void 0 ? _a : GeneralConstants_1.DEFAULT_DATE_FORMAT_PATTERN_WITH_TIME;
22
25
  const isReadOnlyModule = adaptable.api.entitlementApi.getEntitlementAccessLevelForModule('Comment') === 'ReadOnly';
23
26
  const columnsMap = React.useMemo(() => {
24
27
  const columns = {
@@ -31,7 +34,7 @@ const CellComments = (props) => {
31
34
  field: 'Timestamp',
32
35
  maxWidth: 150,
33
36
  valueGetter: (params) => {
34
- return (0, dateUtils_1.formatDate)(params.data.Timestamp, 'MM.DD.YYYY HH:mm');
37
+ return (0, format_1.default)(params.data.Timestamp, dateFormat);
35
38
  },
36
39
  },
37
40
  text: {
@@ -17,7 +17,7 @@ const ensurePortalElement = (className) => {
17
17
  }
18
18
  portalElement = document.createElement('div');
19
19
  portalElement.style.position = 'absolute';
20
- portalElement.style.zIndex = '999';
20
+ portalElement.style.zIndex = '4'; // under the context menu
21
21
  portalElement.style.top = '0px';
22
22
  portalElement.style.left = '0px';
23
23
  if (className) {
@@ -24,7 +24,7 @@ const useMenuItems = () => {
24
24
  item.module !== 'CustomSettingsPanel' &&
25
25
  !DefaultSettingsPanel_1.STANDALONE_MODULE_POPUPS.includes(item.module) &&
26
26
  item.isVisible);
27
- return navigationItems
27
+ let navItems = navigationItems
28
28
  .map((moduleName) => {
29
29
  var _a, _b;
30
30
  if (moduleName === '-') {
@@ -44,6 +44,14 @@ const useMenuItems = () => {
44
44
  return customPanelMenuItem || visibleItems.find((item) => item.module === moduleName);
45
45
  })
46
46
  .filter(Boolean);
47
+ // remove sequential '-' items
48
+ navItems = navItems.filter((item, index) => {
49
+ if (item === '-' && navItems[index - 1] === '-') {
50
+ return false;
51
+ }
52
+ return true;
53
+ });
54
+ return navItems;
47
55
  }, [allMenuItems]);
48
56
  };
49
57
  exports.useMenuItems = useMenuItems;