@adaptabletools/adaptable 16.0.0-canary.7 → 16.0.0-canary.9

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 (62) hide show
  1. package/base.css +24 -0
  2. package/base.css.map +1 -1
  3. package/bundle.cjs.js +204 -177
  4. package/index.css +32 -0
  5. package/index.css.map +1 -1
  6. package/package.json +1 -1
  7. package/publishTimestamp.d.ts +1 -1
  8. package/publishTimestamp.js +1 -1
  9. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
  10. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -0
  11. package/src/Api/AdaptableApi.d.ts +5 -0
  12. package/src/Api/CommentsApi.d.ts +50 -0
  13. package/src/Api/CommentsApi.js +2 -0
  14. package/src/Api/EntitlementApi.d.ts +1 -1
  15. package/src/Api/Fdc3Api.d.ts +1 -1
  16. package/src/Api/GridApi.d.ts +0 -7
  17. package/src/Api/Implementation/AdaptableApiImpl.d.ts +2 -0
  18. package/src/Api/Implementation/AdaptableApiImpl.js +2 -0
  19. package/src/Api/Implementation/CommentsApiImpl.d.ts +20 -0
  20. package/src/Api/Implementation/CommentsApiImpl.js +59 -0
  21. package/src/Api/Implementation/GridApiImpl.d.ts +0 -3
  22. package/src/Api/Implementation/GridApiImpl.js +0 -3
  23. package/src/PredefinedConfig/AdaptableState.d.ts +2 -2
  24. package/src/PredefinedConfig/CommentsState.d.ts +29 -0
  25. package/src/PredefinedConfig/CommentsState.js +2 -0
  26. package/src/PredefinedConfig/Common/AdaptableObject.d.ts +2 -2
  27. package/src/PredefinedConfig/Common/FDC3Context_DEPR.d.ts +3 -3
  28. package/src/PredefinedConfig/Common/Types.d.ts +2 -2
  29. package/src/PredefinedConfig/Common/Types.js +1 -0
  30. package/src/PredefinedConfig/PredefinedConfig.d.ts +2 -0
  31. package/src/PredefinedConfig/SystemState.d.ts +5 -0
  32. package/src/Redux/ActionsReducers/CommentsRedux.d.ts +31 -0
  33. package/src/Redux/ActionsReducers/CommentsRedux.js +83 -0
  34. package/src/Redux/ActionsReducers/SystemRedux.d.ts +13 -1
  35. package/src/Redux/ActionsReducers/SystemRedux.js +37 -2
  36. package/src/Redux/Store/AdaptableStore.js +20 -6
  37. package/src/Strategy/CommentsModule.d.ts +23 -0
  38. package/src/Strategy/CommentsModule.js +141 -0
  39. package/src/Strategy/FormatColumnModule.d.ts +0 -1
  40. package/src/Strategy/FormatColumnModule.js +4 -28
  41. package/src/Utilities/Constants/ModuleConstants.d.ts +3 -0
  42. package/src/Utilities/Constants/ModuleConstants.js +5 -2
  43. package/src/Utilities/Defaults/DefaultSettingsPanel.js +1 -0
  44. package/src/Utilities/Helpers/AdaptableHelper.d.ts +2 -2
  45. package/src/Utilities/Helpers/AdaptableHelper.js +4 -4
  46. package/src/View/AdaptableView.js +2 -0
  47. package/src/View/AdaptableViewFactory.js +2 -0
  48. package/src/View/Comments/CommentListing.d.ts +2 -0
  49. package/src/View/Comments/CommentListing.js +89 -0
  50. package/src/View/Comments/CommentPopup.d.ts +2 -0
  51. package/src/View/Comments/CommentPopup.js +65 -0
  52. package/src/View/Components/CellPopup/index.d.ts +12 -0
  53. package/src/View/Components/CellPopup/index.js +69 -0
  54. package/src/agGrid/Adaptable.d.ts +4 -1
  55. package/src/agGrid/Adaptable.js +57 -17
  56. package/src/agGrid/agGridHelper.js +2 -0
  57. package/src/components/OverlayTrigger/utils.d.ts +1 -1
  58. package/src/metamodel/adaptable.metamodel.d.ts +27 -0
  59. package/src/metamodel/adaptable.metamodel.js +1 -1
  60. package/src/types.d.ts +4 -1
  61. package/version.d.ts +1 -1
  62. package/version.js +1 -1
@@ -44,7 +44,6 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
44
44
  return this.api.queryApi.internalApi.getReferencedNamedQueryNames(queryExpression);
45
45
  }
46
46
  updateOldConfig() {
47
- this.updateConditionalStylesColumnsOldConfig();
48
47
  this.updateFormatColumnSingleToMultiplePredicates();
49
48
  // update ConditionalStyle StatusBarPanel
50
49
  const oldStatusBars = this.api.internalApi.getState().StatusBar.StatusBars;
@@ -89,31 +88,6 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
89
88
  }
90
89
  });
91
90
  }
92
- updateConditionalStylesColumnsOldConfig() {
93
- var _a;
94
- const oldConditionalStyles = (_a = this.api.internalApi.getState().ConditionalStyle) === null || _a === void 0 ? void 0 : _a.ConditionalStyles;
95
- if (!(oldConditionalStyles === null || oldConditionalStyles === void 0 ? void 0 : oldConditionalStyles.length)) {
96
- return;
97
- }
98
- this.api.logWarn(`DEPRECATED: Conditional Styles have been merged into 'Format Columns'`);
99
- // remove conditional styles
100
- this.api.internalApi.deleteConditionalStyles(oldConditionalStyles);
101
- const transformedFormatColumns = oldConditionalStyles.map((conditionalStyle) => {
102
- const formatColumn = {
103
- Scope: conditionalStyle.Scope,
104
- Style: conditionalStyle.Style,
105
- IncludeGroupedRows: conditionalStyle.IncludeGroupedRows,
106
- };
107
- if ('Rule' in conditionalStyle && conditionalStyle.Rule.Predicate) {
108
- formatColumn.Rule = {
109
- Predicates: [conditionalStyle.Rule.Predicate],
110
- };
111
- }
112
- return formatColumn;
113
- });
114
- // add as format column
115
- this.api.formatColumnApi.addFormatColumns(transformedFormatColumns);
116
- }
117
91
  addColumnMenuItems(column) {
118
92
  let returnColumnMenuItems = [];
119
93
  if (column && this.isModuleEditable() && !column.isSparkline) {
@@ -146,11 +120,13 @@ class FormatColumnModule extends AdaptableModuleBase_1.AdaptableModuleBase {
146
120
  subItems: [createFormatColumnMenuItem, editFormatColumnMenuItem],
147
121
  });
148
122
  // if more than one then display a Create and a Show
149
- // we should probably do the Show better - perhaps use Column Info in some way?
123
+ // we should probably do the Show better - perhaps use Column Info in some way?
150
124
  // or to filter the format columns ?
151
125
  }
152
126
  else {
153
- const moduleInfo = this.api.internalApi.getModuleService().getModuleInfoByModule('FormatColumn');
127
+ const moduleInfo = this.api.internalApi
128
+ .getModuleService()
129
+ .getModuleInfoByModule('FormatColumn');
154
130
  const editFormatColumnMenuItem = this.createColumnMenuItemReduxAction('Show Current', this.moduleInfo.Glyph, PopupRedux.PopupShowScreen('FormatColumn', moduleInfo.Popup));
155
131
  returnColumnMenuItems.push({
156
132
  label: 'Format Column',
@@ -33,6 +33,8 @@ export declare const Glue42ModuleId: ModuleConstants;
33
33
  export declare const Glue42FriendlyName = "Glue42";
34
34
  export declare const GridInfoModuleId: ModuleConstants;
35
35
  export declare const GridInfoFriendlyName = "Grid Info";
36
+ export declare const CommentsModuleId: ModuleConstants;
37
+ export declare const CommentsFriendlyName = "Comments";
36
38
  export declare const IPushPullModuleId: ModuleConstants;
37
39
  export declare const IPushPullFriendlyName = "IPushPull";
38
40
  export declare const LayoutModuleId: ModuleConstants;
@@ -102,4 +104,5 @@ export declare const ADAPTABLE_MODULE_MAP: {
102
104
  ToolPanel: string;
103
105
  SettingsPanel: string;
104
106
  StatusBar: string;
107
+ Comments: string;
105
108
  };
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShortcutFriendlyName = exports.ShortcutModuleId = exports.ScheduleFriendlyName = exports.ScheduleModuleId = exports.QuickSearchFriendlyName = exports.QuickSearchModuleId = exports.QueryFriendlyName = exports.QueryModuleId = exports.PlusMinusFriendlyName = exports.PlusMinusModuleId = exports.OpenFinFriendlyName = exports.OpenFinModuleId = exports.LayoutFriendlyName = exports.LayoutModuleId = exports.IPushPullFriendlyName = exports.IPushPullModuleId = exports.GridInfoFriendlyName = exports.GridInfoModuleId = exports.Glue42FriendlyName = exports.Glue42ModuleId = exports.FreeTextColumnFriendlyName = exports.FreeTextColumnModuleId = exports.FormatColumnFriendlyName = exports.FormatColumnModuleId = exports.FilterFriendlyName = exports.FilterModuleId = exports.Fdc3FriendlyName = exports.Fdc3ModuleId = exports.ExportFriendlyName = exports.ExportModuleId = exports.DataSetFriendlyName = exports.DataSetModuleId = exports.DataChangeHistoryFriendlyName = exports.DataChangeHistoryModuleId = exports.DashboardFriendlyName = exports.DashboardModuleId = exports.CustomSortFriendlyName = exports.CustomSortModuleId = exports.ChartingFriendlyName = exports.ChartingModuleId = exports.CellSummaryFriendlyName = exports.CellSummaryModuleId = exports.CalculatedColumnFriendlyName = exports.CalculatedColumnModuleId = exports.BulkUpdateFriendlyName = exports.BulkUpdateModuleId = exports.FlashingCellFriendlyName = exports.FlashingCellModuleId = exports.AlertModuleFriendlyName = exports.AlertModuleId = void 0;
4
- exports.ADAPTABLE_MODULE_MAP = exports.StatusBarFriendlyName = exports.StatusBarModuleId = exports.SettingsPanelFriendlyName = exports.SettingsPanelModuleId = exports.ToolPanelFriendlyName = exports.ToolPanelModuleId = exports.ThemeFriendlyName = exports.ThemeModuleId = exports.TeamSharingFriendlyName = exports.TeamSharingModuleId = exports.SystemStatusFriendlyName = exports.SystemStatusModuleId = exports.StateManagementFriendlyName = exports.StateManagementModuleId = exports.StyledColumnFriendlyName = exports.StyledColumnModuleId = exports.SmartEditFriendlyName = exports.SmartEditModuleId = void 0;
3
+ exports.ScheduleFriendlyName = exports.ScheduleModuleId = exports.QuickSearchFriendlyName = exports.QuickSearchModuleId = exports.QueryFriendlyName = exports.QueryModuleId = exports.PlusMinusFriendlyName = exports.PlusMinusModuleId = exports.OpenFinFriendlyName = exports.OpenFinModuleId = exports.LayoutFriendlyName = exports.LayoutModuleId = exports.IPushPullFriendlyName = exports.IPushPullModuleId = exports.CommentsFriendlyName = exports.CommentsModuleId = exports.GridInfoFriendlyName = exports.GridInfoModuleId = exports.Glue42FriendlyName = exports.Glue42ModuleId = exports.FreeTextColumnFriendlyName = exports.FreeTextColumnModuleId = exports.FormatColumnFriendlyName = exports.FormatColumnModuleId = exports.FilterFriendlyName = exports.FilterModuleId = exports.Fdc3FriendlyName = exports.Fdc3ModuleId = exports.ExportFriendlyName = exports.ExportModuleId = exports.DataSetFriendlyName = exports.DataSetModuleId = exports.DataChangeHistoryFriendlyName = exports.DataChangeHistoryModuleId = exports.DashboardFriendlyName = exports.DashboardModuleId = exports.CustomSortFriendlyName = exports.CustomSortModuleId = exports.ChartingFriendlyName = exports.ChartingModuleId = exports.CellSummaryFriendlyName = exports.CellSummaryModuleId = exports.CalculatedColumnFriendlyName = exports.CalculatedColumnModuleId = exports.BulkUpdateFriendlyName = exports.BulkUpdateModuleId = exports.FlashingCellFriendlyName = exports.FlashingCellModuleId = exports.AlertModuleFriendlyName = exports.AlertModuleId = void 0;
4
+ exports.ADAPTABLE_MODULE_MAP = exports.StatusBarFriendlyName = exports.StatusBarModuleId = exports.SettingsPanelFriendlyName = exports.SettingsPanelModuleId = exports.ToolPanelFriendlyName = exports.ToolPanelModuleId = exports.ThemeFriendlyName = exports.ThemeModuleId = exports.TeamSharingFriendlyName = exports.TeamSharingModuleId = exports.SystemStatusFriendlyName = exports.SystemStatusModuleId = exports.StateManagementFriendlyName = exports.StateManagementModuleId = exports.StyledColumnFriendlyName = exports.StyledColumnModuleId = exports.SmartEditFriendlyName = exports.SmartEditModuleId = exports.ShortcutFriendlyName = exports.ShortcutModuleId = void 0;
5
5
  exports.AlertModuleId = 'Alert';
6
6
  exports.AlertModuleFriendlyName = 'Alert';
7
7
  exports.FlashingCellModuleId = 'FlashingCell';
@@ -36,6 +36,8 @@ exports.Glue42ModuleId = 'Glue42';
36
36
  exports.Glue42FriendlyName = 'Glue42';
37
37
  exports.GridInfoModuleId = 'GridInfo';
38
38
  exports.GridInfoFriendlyName = 'Grid Info';
39
+ exports.CommentsModuleId = 'Comments';
40
+ exports.CommentsFriendlyName = 'Comments';
39
41
  exports.IPushPullModuleId = 'IPushPull';
40
42
  exports.IPushPullFriendlyName = 'IPushPull';
41
43
  exports.LayoutModuleId = 'Layout';
@@ -105,4 +107,5 @@ exports.ADAPTABLE_MODULE_MAP = {
105
107
  [exports.ToolPanelModuleId]: exports.ToolPanelFriendlyName,
106
108
  [exports.SettingsPanelModuleId]: exports.SettingsPanelFriendlyName,
107
109
  [exports.StatusBarModuleId]: exports.StatusBarFriendlyName,
110
+ [exports.CommentsModuleId]: exports.CommentsFriendlyName,
108
111
  };
@@ -41,4 +41,5 @@ exports.DEFAULT_NAVIGATION_ITEMS = [
41
41
  'Schedule',
42
42
  'StateManagement',
43
43
  'TeamSharing',
44
+ 'Comments',
44
45
  ];
@@ -10,7 +10,7 @@ export declare function checkValidPrimaryKey(adaptable: IAdaptable): boolean;
10
10
  export declare function AdaptableObjectExistsInState(array: AdaptableObject[], itemToCheck: AdaptableObject): boolean;
11
11
  export declare function getAppropriateAccessLevel(adaptableObject: AdaptableObject, moduleAccessLevel: AccessLevel): AccessLevel;
12
12
  export declare function runAdaptableComparerFunction(columnId: string, columnValues: any[], adaptable: IAdaptable): AdaptableComparerFunction;
13
- export declare function addAdaptableObjectUuidAndSource(adaptableObject: AdaptableObject): AdaptableObject;
13
+ export declare function addUuidAndSource(adaptableObject: AdaptableObject): AdaptableObject;
14
14
  export declare const AdaptableHelper: {
15
15
  assignAdaptableOptions: typeof assignAdaptableOptions;
16
16
  initPredefinedConfigWithUuids: typeof initPredefinedConfigWithUuids;
@@ -18,6 +18,6 @@ export declare const AdaptableHelper: {
18
18
  AdaptableObjectExistsInState: typeof AdaptableObjectExistsInState;
19
19
  runAdaptableComparerFunction: typeof runAdaptableComparerFunction;
20
20
  getAppropriateAccessLevel: typeof getAppropriateAccessLevel;
21
- addUuidAndSource: typeof addAdaptableObjectUuidAndSource;
21
+ addUuidAndSource: typeof addUuidAndSource;
22
22
  };
23
23
  export default AdaptableHelper;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdaptableHelper = exports.addAdaptableObjectUuidAndSource = exports.runAdaptableComparerFunction = exports.getAppropriateAccessLevel = exports.AdaptableObjectExistsInState = exports.checkValidPrimaryKey = exports.initPredefinedConfigWithUuids = exports.assignAdaptableOptions = void 0;
3
+ exports.AdaptableHelper = exports.addUuidAndSource = exports.runAdaptableComparerFunction = exports.getAppropriateAccessLevel = exports.AdaptableObjectExistsInState = exports.checkValidPrimaryKey = exports.initPredefinedConfigWithUuids = exports.assignAdaptableOptions = 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"));
@@ -140,14 +140,14 @@ function runAdaptableComparerFunction(columnId, columnValues, adaptable) {
140
140
  };
141
141
  }
142
142
  exports.runAdaptableComparerFunction = runAdaptableComparerFunction;
143
- function addAdaptableObjectUuidAndSource(adaptableObject) {
143
+ function addUuidAndSource(adaptableObject) {
144
144
  if (!adaptableObject.Uuid) {
145
145
  adaptableObject.Uuid = (0, Uuid_1.createUuid)();
146
146
  }
147
147
  adaptableObject.Source = 'User';
148
148
  return adaptableObject;
149
149
  }
150
- exports.addAdaptableObjectUuidAndSource = addAdaptableObjectUuidAndSource;
150
+ exports.addUuidAndSource = addUuidAndSource;
151
151
  exports.AdaptableHelper = {
152
152
  assignAdaptableOptions,
153
153
  initPredefinedConfigWithUuids,
@@ -155,6 +155,6 @@ exports.AdaptableHelper = {
155
155
  AdaptableObjectExistsInState,
156
156
  runAdaptableComparerFunction,
157
157
  getAppropriateAccessLevel,
158
- addUuidAndSource: addAdaptableObjectUuidAndSource,
158
+ addUuidAndSource,
159
159
  };
160
160
  exports.default = exports.AdaptableHelper;
@@ -7,6 +7,7 @@ const react_redux_1 = require("react-redux");
7
7
  const ProgressIndicator_1 = require("../components/ProgressIndicator/ProgressIndicator");
8
8
  const Toastify_1 = require("../components/Toastify");
9
9
  const PopupRedux = tslib_1.__importStar(require("../Redux/ActionsReducers/PopupRedux"));
10
+ const CommentPopup_1 = require("./Comments/CommentPopup");
10
11
  const AdaptableLoadingScreen_1 = require("./Components/Popups/AdaptableLoadingScreen");
11
12
  const AdaptablePopup_1 = require("./Components/Popups/AdaptablePopup");
12
13
  const AdaptablePopupConfirmation_1 = require("./Components/Popups/AdaptablePopupConfirmation");
@@ -23,6 +24,7 @@ class AdaptableView extends React.Component {
23
24
  const watermark = (_d = (_c = (_b = (_a = this.props.AdaptableApi) === null || _a === void 0 ? void 0 : _a.internalApi) === null || _b === void 0 ? void 0 : _b.getSystemState()) === null || _c === void 0 ? void 0 : _c.License) === null || _d === void 0 ? void 0 : _d.watermark;
24
25
  const adaptableOptions = this.props.AdaptableApi.optionsApi.getAdaptableOptions();
25
26
  return (React.createElement("div", null,
27
+ React.createElement(CommentPopup_1.CommentPopup, null),
26
28
  React.createElement(FloatingQuickSearch_1.QuickSearchDrawer, null),
27
29
  this.props.AdaptableApi.internalApi.getModuleService().isModuleAvailable('Dashboard') && (React.createElement(Dashboard_1.Dashboard, { api: this.props.AdaptableApi })),
28
30
  React.createElement(AdaptableLoadingScreen_1.AdaptableLoadingScreen, { onClose: this.props.onCloseLoadingPopup, showLoadingScreen: this.props.PopupState.LoadingPopup.ShowLoadingPopup }),
@@ -31,6 +31,7 @@ const DataChangeHistoryViewPanel_1 = require("./DataChangeHistory/DataChangeHist
31
31
  const StateManagementViewPanel_1 = require("./StateManagement/StateManagementViewPanel");
32
32
  const StatusBarPopup_1 = require("./StatusBar/StatusBarPopup");
33
33
  const ChartingViewPanel_1 = require("./Charting/ChartingViewPanel");
34
+ const CommentListing_1 = require("./Comments/CommentListing");
34
35
  exports.AdaptableViewFactory = {
35
36
  BulkUpdatePopup: BulkUpdatePopup_1.BulkUpdatePopup,
36
37
  DashboardPopup: DashboardPopup_1.DashboardPopup,
@@ -44,6 +45,7 @@ exports.AdaptableViewFactory = {
44
45
  ToolPanelPopup: ToolPanelPopup_1.ToolPanelPopup,
45
46
  SystemStatusPopup: SystemStatusPopup_1.SystemStatusPopup,
46
47
  DataChangeHistoryPopup: DataChangeHistoryPopup_1.DataChangeHistoryPopup,
48
+ CommentsPopup: CommentListing_1.CommentsListing,
47
49
  };
48
50
  exports.AdaptableViewPanelFactory = new Map([
49
51
  [ModuleConstants.AlertModuleId, AlertViewPanel_1.AlertViewPanelControl],
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const CommentsListing: React.FunctionComponent;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentsListing = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const react_redux_1 = require("react-redux");
7
+ const rebass_1 = require("rebass");
8
+ const InfiniteTable_1 = require("../../components/InfiniteTable");
9
+ const CommentsRedux_1 = require("../../Redux/ActionsReducers/CommentsRedux");
10
+ const AdaptableContext_1 = require("../AdaptableContext");
11
+ const AdaptableButton_1 = require("../Components/AdaptableButton");
12
+ const tableDOMProps = {
13
+ style: {
14
+ height: '100%',
15
+ minWidth: '10rem',
16
+ minHeight: 600,
17
+ },
18
+ };
19
+ const CommentsListing = () => {
20
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
21
+ const primaryKeyHeader = adaptable.api.columnApi.getFriendlyNameForColumnId(adaptable.api.columnApi.getPrimaryKeyColumn().columnId);
22
+ const columnHeader = adaptable.api.columnApi.getFriendlyNameForColumnId(adaptable.api.columnApi.getPrimaryKeyColumn().columnId);
23
+ const allComments = (0, react_redux_1.useSelector)((state) => (0, CommentsRedux_1.GetCommentsSelector)(state.Comments));
24
+ const columnsMap = React.useMemo(() => {
25
+ const columns = {
26
+ primaryKey: {
27
+ field: 'PrimaryKeyValue',
28
+ header: primaryKeyHeader,
29
+ },
30
+ column: {
31
+ field: 'ColumnId',
32
+ valueGetter: (params) => {
33
+ return adaptable.api.columnApi.getFriendlyNameForColumnId(params.data.ColumnId);
34
+ },
35
+ },
36
+ comment: {
37
+ field: 'Value',
38
+ header: 'Comment',
39
+ defaultEditable: true,
40
+ defaultFlex: 3,
41
+ },
42
+ timestamp: {
43
+ field: 'Timestamp',
44
+ valueGetter: (params) => {
45
+ return new Date(params.data.Timestamp).toDateString();
46
+ },
47
+ },
48
+ author: {
49
+ header: 'Author',
50
+ valueGetter: (params) => params.data.Author.UserName,
51
+ },
52
+ delete: {
53
+ defaultWidth: 50,
54
+ render: (params) => {
55
+ return (React.createElement(AdaptableButton_1.AdaptableButtonComponent, { variant: "text", icon: "delete", onClick: () => {
56
+ const comment = adaptable.api.commentsApi.getCommentByUuid(params.data.Uuid);
57
+ adaptable.api.commentsApi.deleteComment(comment);
58
+ } }));
59
+ },
60
+ },
61
+ };
62
+ return columns;
63
+ }, []);
64
+ return (React.createElement(rebass_1.Box, { p: 2, style: { height: '100%', width: '100%' } },
65
+ React.createElement(InfiniteTable_1.DataSource, { data: allComments, primaryKey: "Uuid", onDataMutations: (params) => {
66
+ for (const mutation of params.mutations) {
67
+ const [uuid, changes] = mutation;
68
+ for (const change of changes) {
69
+ if (change.type === 'update') {
70
+ const data = change.data;
71
+ const prevComment = allComments.find((x) => x.Uuid === uuid);
72
+ if (prevComment.Value !== data.Value) {
73
+ adaptable.api.commentsApi.updateCommentText(data.Value, prevComment);
74
+ }
75
+ }
76
+ }
77
+ }
78
+ } },
79
+ React.createElement(InfiniteTable_1.InfiniteTable, { columnTypes: {
80
+ default: {
81
+ align: 'start',
82
+ defaultFlex: 1,
83
+ sortable: false,
84
+ },
85
+ }, headerOptions: {
86
+ alwaysReserveSpaceForSortIcon: false,
87
+ }, rowHeight: 40, columnHeaderHeight: 65, domProps: tableDOMProps, columns: columnsMap }))));
88
+ };
89
+ exports.CommentsListing = CommentsListing;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const CommentPopup: () => JSX.Element;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentPopup = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const lodash_1 = require("lodash");
6
+ const React = tslib_1.__importStar(require("react"));
7
+ const react_redux_1 = require("react-redux");
8
+ const rebass_1 = require("rebass");
9
+ const Textarea_1 = tslib_1.__importDefault(require("../../components/Textarea"));
10
+ const CommentsRedux_1 = require("../../Redux/ActionsReducers/CommentsRedux");
11
+ const SystemRedux_1 = require("../../Redux/ActionsReducers/SystemRedux");
12
+ const AdaptableContext_1 = require("../AdaptableContext");
13
+ const CellPopup_1 = require("../Components/CellPopup");
14
+ const CommentEditor = ({ comment, onCommentChange, onClose, editMode, isReadonly }) => {
15
+ const textAreaRef = React.useRef(null);
16
+ const [liveValue, setLiveValue] = React.useState(comment || '');
17
+ const throttledOnChange = React.useMemo(() => {
18
+ const throttled = (0, lodash_1.throttle)((value) => onCommentChange(value), 300);
19
+ return (value) => {
20
+ setLiveValue(value);
21
+ throttled(value);
22
+ };
23
+ }, []);
24
+ React.useEffect(() => {
25
+ var _a;
26
+ if (editMode) {
27
+ (_a = textAreaRef.current) === null || _a === void 0 ? void 0 : _a.focus();
28
+ }
29
+ }, [editMode]);
30
+ return (React.createElement(Textarea_1.default, { readOnly: isReadonly, ref: textAreaRef, width: "100%", minWidth: 180, minHeight: 120, value: liveValue, onBlur: () => onClose(), onKeyDown: (event) => {
31
+ if (event.key === 'Escape') {
32
+ onClose();
33
+ }
34
+ }, onChange: (event) => throttledOnChange(event.target.value) }));
35
+ };
36
+ const CommentPopup = () => {
37
+ var _a;
38
+ const { api } = (0, AdaptableContext_1.useAdaptable)();
39
+ const cellPopupRef = React.useRef(null);
40
+ const editMode = (0, react_redux_1.useSelector)((state) => (0, SystemRedux_1.SystemCommentsEditModeSelector)(state.System));
41
+ const commentPosition = (0, react_redux_1.useSelector)((state) => (0, SystemRedux_1.SystemCommentsSelector)(state.System));
42
+ const [
43
+ // Only handle first comment for now
44
+ // Later we can handle multiple comments
45
+ comment,] = (0, react_redux_1.useSelector)((state) => {
46
+ return commentPosition ? (0, CommentsRedux_1.GetCommentsSelector)(state.Comments, commentPosition) : [];
47
+ });
48
+ const handleCommentChange = (value) => {
49
+ api.commentsApi.updateCommentText(value, comment);
50
+ };
51
+ const isReadonly = api.entitlementApi.isModuleReadOnlyEntitlement('Comments');
52
+ const enableEditMode = () => {
53
+ if (!editMode) {
54
+ api.commentsApi.showComment(commentPosition, true);
55
+ cellPopupRef === null || cellPopupRef === void 0 ? void 0 : cellPopupRef.current.refreshContent();
56
+ }
57
+ };
58
+ if (!commentPosition) {
59
+ return React.createElement(React.Fragment, null);
60
+ }
61
+ return (React.createElement(CellPopup_1.CellPopup, { ref: cellPopupRef, key: `${commentPosition.PrimaryKeyValue}-${commentPosition.ColumnId}`, isOpen: true, primaryKeyValue: commentPosition.PrimaryKeyValue, columnId: commentPosition.ColumnId },
62
+ React.createElement(rebass_1.Flex, { onClick: () => enableEditMode(), flexDirection: "column", className: "ab-CommentPopup" },
63
+ React.createElement(CommentEditor, { isReadonly: isReadonly, editMode: editMode, key: comment === null || comment === void 0 ? void 0 : comment.Uuid, onClose: () => api.commentsApi.hideComment(), comment: (_a = comment === null || comment === void 0 ? void 0 : comment.Value) !== null && _a !== void 0 ? _a : '', onCommentChange: (value) => handleCommentChange(value) }))));
64
+ };
65
+ exports.CommentPopup = CommentPopup;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ export interface CellPopupProps {
3
+ isOpen: boolean;
4
+ columnId: string;
5
+ primaryKeyValue: number | string;
6
+ }
7
+ export declare type CellPopupHandle = {
8
+ refreshContent: () => void;
9
+ };
10
+ export declare const CellPopup: React.ForwardRefExoticComponent<CellPopupProps & {
11
+ children?: React.ReactNode;
12
+ } & React.RefAttributes<CellPopupHandle>>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CellPopup = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const InfiniteTable_1 = require("../../../components/InfiniteTable");
7
+ const utils_1 = require("../../../components/OverlayTrigger/utils");
8
+ const AdaptableContext_1 = require("../../AdaptableContext");
9
+ const UIHelper_1 = require("../../UIHelper");
10
+ let portalElement;
11
+ const ensurePortalElement = () => {
12
+ if (!(0, UIHelper_1.isBrowserDocumentAvailable)()) {
13
+ return;
14
+ }
15
+ if (portalElement) {
16
+ return;
17
+ }
18
+ portalElement = document.createElement('div');
19
+ portalElement.style.position = 'absolute';
20
+ portalElement.style.zIndex = '999999';
21
+ portalElement.style.top = '0px';
22
+ portalElement.style.left = '0px';
23
+ document.body.appendChild(portalElement);
24
+ };
25
+ exports.CellPopup = React.forwardRef((props, ref) => {
26
+ ensurePortalElement();
27
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
28
+ const { showOverlay, clearAll: clearAllOverlays, hideOverlay, portal, } = (0, InfiniteTable_1.useOverlay)({
29
+ portalContainer: portalElement,
30
+ });
31
+ const OVERLAY_ID = 'cell-overlay';
32
+ const showCellPopupContent = () => {
33
+ var _a;
34
+ const cellSelector = `[row-id="${props.primaryKeyValue}"] [col-id="${props.columnId}"]`;
35
+ const alignTo = document.querySelector(cellSelector);
36
+ if (!alignTo) {
37
+ adaptable.logger.consoleError(`Could not find cell with selector ${cellSelector} to show popup`);
38
+ return;
39
+ }
40
+ const showOverlayOptions = {
41
+ id: OVERLAY_ID,
42
+ alignPosition: [
43
+ // overlay - target
44
+ ['TopLeft', 'TopRight'],
45
+ ['TopRight', 'TopLeft'],
46
+ ['TopCenter', 'BottomCenter'],
47
+ ['BottomCenter', 'TopCenter'],
48
+ ],
49
+ constrainTo: (_a = adaptable.getAgGridContainerElement()) !== null && _a !== void 0 ? _a : true,
50
+ alignTo: (0, utils_1.getRect)(alignTo),
51
+ };
52
+ showOverlay(() => props.children, showOverlayOptions);
53
+ };
54
+ React.useEffect(() => {
55
+ if (props.isOpen) {
56
+ showCellPopupContent();
57
+ }
58
+ else {
59
+ clearAllOverlays();
60
+ hideOverlay(OVERLAY_ID);
61
+ }
62
+ }, [props.isOpen]);
63
+ React.useImperativeHandle(ref, () => {
64
+ return {
65
+ refreshContent: () => showCellPopupContent(),
66
+ };
67
+ });
68
+ return React.createElement(React.Fragment, null, portal);
69
+ });
@@ -99,6 +99,8 @@ export declare class Adaptable implements IAdaptable {
99
99
  private _adaptableReady;
100
100
  isDestroyed: boolean;
101
101
  private listenerKeydown;
102
+ private listenerMouseEnter;
103
+ private listenerMouseLeave;
102
104
  supressReact18RenderWarning: boolean;
103
105
  renderReactRoot: RenderReactRootFn;
104
106
  private listenerFirstDataRendered;
@@ -181,6 +183,7 @@ export declare class Adaptable implements IAdaptable {
181
183
  private getAlertRowClass;
182
184
  private getAlertRowStyle;
183
185
  private getFlashingCellStyle;
186
+ private getCommentCellClassName;
184
187
  private getFlashingCellClass;
185
188
  private getCellHighlightStyle;
186
189
  private getRowHighlightStyle;
@@ -290,7 +293,7 @@ export declare class Adaptable implements IAdaptable {
290
293
  getColDefs(): ColDef[];
291
294
  getGroupedColDefs(): ColDef[];
292
295
  getColumnDefsWithCorrectVisibility: () => ColDef[];
293
- getFirstRowNode(): IRowNode;
296
+ getFirstRowNode(): IRowNode | undefined;
294
297
  getFirstDisplayedRowNode(): IRowNode;
295
298
  destroy(config?: {
296
299
  unmount: boolean;
@@ -320,14 +320,21 @@ class Adaptable {
320
320
  // }
321
321
  // because this await for of introduces too much delay
322
322
  }
323
- const doInit = (ab) => ab.init(adaptableOptions, runtimeConfig, true).then((api) => {
324
- if (Array.isArray(adaptableOptions.plugins)) {
325
- adaptableOptions.plugins.forEach((plugin) => {
326
- plugin.afterInit(ab);
327
- });
328
- }
329
- return api;
330
- });
323
+ const doInit = (ab) => {
324
+ // required for NoCode
325
+ // it should go away with https://github.com/AdaptableTools/adaptable/issues/2278
326
+ if (adaptableOptions._gridOptions) {
327
+ runtimeConfig.gridOptions = adaptableOptions._gridOptions;
328
+ }
329
+ return ab.init(adaptableOptions, runtimeConfig, true).then((api) => {
330
+ if (Array.isArray(adaptableOptions.plugins)) {
331
+ adaptableOptions.plugins.forEach((plugin) => {
332
+ plugin.afterInit(ab);
333
+ });
334
+ }
335
+ return api;
336
+ });
337
+ };
331
338
  if (promise && promise.then) {
332
339
  return promise.then(() => {
333
340
  const ab = new Adaptable();
@@ -1148,6 +1155,20 @@ class Adaptable {
1148
1155
  ? flashingCell.flashingCellDefinition.DownChangeStyle
1149
1156
  : flashingCell.flashingCellDefinition.NeutralChangeStyle)) !== null && _a !== void 0 ? _a : {});
1150
1157
  }
1158
+ getCommentCellClassName(col, params) {
1159
+ if (!this.api.internalApi.getModuleService().isModuleAvailable('Comments')) {
1160
+ return;
1161
+ }
1162
+ const cellPosition = {
1163
+ PrimaryKeyValue: this.getPrimaryKeyValueFromRowNode(params.node),
1164
+ ColumnId: col.columnId,
1165
+ };
1166
+ const cellComments = this.api.commentsApi.getCellComments(cellPosition);
1167
+ if (!(cellComments === null || cellComments === void 0 ? void 0 : cellComments.length)) {
1168
+ return undefined;
1169
+ }
1170
+ return 'ab-Cell-Comment';
1171
+ }
1151
1172
  getFlashingCellClass(col, params) {
1152
1173
  var _a, _b, _c;
1153
1174
  const primaryKey = params.node.aggData
@@ -1709,7 +1730,7 @@ class Adaptable {
1709
1730
  if (
1710
1731
  // check first row node for presence of data without iterating over whole grid
1711
1732
  this.api.layoutApi.internalApi.areExpandedRowGroupsSavedInLayouts() &&
1712
- this.api.gridApi.getFirstRowNode()) {
1733
+ this.api.gridApi.getFirstDisplayedRowNode()) {
1713
1734
  layout.ExpandedRowGroupValues = this.getExpandRowGroupsKeys();
1714
1735
  }
1715
1736
  this.persistLayout(layout);
@@ -2679,7 +2700,16 @@ class Adaptable {
2679
2700
  return justGroupColDefs;
2680
2701
  }
2681
2702
  getFirstRowNode() {
2682
- return this.gridOptions.api.getDisplayedRowAtIndex(0);
2703
+ let startIndex = 0;
2704
+ let firstRowNode = this.gridOptions.api.getDisplayedRowAtIndex(startIndex);
2705
+ while (firstRowNode && firstRowNode.group) {
2706
+ startIndex++;
2707
+ firstRowNode = this.gridOptions.api.getDisplayedRowAtIndex(startIndex);
2708
+ }
2709
+ if (!firstRowNode) {
2710
+ firstRowNode = this.gridOptions.api.getDisplayedRowAtIndex(0);
2711
+ }
2712
+ return firstRowNode;
2683
2713
  }
2684
2714
  getFirstDisplayedRowNode() {
2685
2715
  const firstDisplayedRowIndex = this.gridOptions.api.getFirstDisplayedRow();
@@ -2744,7 +2774,11 @@ class Adaptable {
2744
2774
  const gridContainerElement = this.getAgGridContainerElement();
2745
2775
  if (gridContainerElement) {
2746
2776
  gridContainerElement.removeEventListener('keydown', this.listenerKeydown);
2777
+ gridContainerElement.removeEventListener('mouseenter', this.listenerMouseEnter);
2778
+ gridContainerElement.removeEventListener('mouseleave', this.listenerMouseLeave);
2747
2779
  this.listenerKeydown = null;
2780
+ this.listenerMouseEnter = null;
2781
+ this.listenerMouseLeave = null;
2748
2782
  }
2749
2783
  this.api.internalDestroySelf();
2750
2784
  this.colDefPropertyCache = null;
@@ -2893,6 +2927,10 @@ class Adaptable {
2893
2927
  // This is needed to be able to prevent the editor to be opened
2894
2928
  // in bubling phase the opening is not prevented with ag-grid v30
2895
2929
  true);
2930
+ gridContainerElement.addEventListener('mouseenter', (this.listenerMouseEnter = (event) => {
2931
+ this._emit('MouseEnter', event);
2932
+ }), true);
2933
+ gridContainerElement.addEventListener('mouseleave', (this.listenerMouseLeave = (event) => this._emit('MouseLeave', event)));
2896
2934
  }
2897
2935
  /*********************
2898
2936
  * AG Grid EVENTS
@@ -3055,6 +3093,7 @@ class Adaptable {
3055
3093
  this.gridOptions.api.addEventListener(core_1.Events.EVENT_SORT_CHANGED, (this.listenerSortChanged = () => {
3056
3094
  this.onSortChanged();
3057
3095
  this.debouncedSetSelectedCells();
3096
+ this._emit('SortChanged');
3058
3097
  }));
3059
3098
  const showGroupingTotalsAsHeader = this.adaptableOptions.groupingOptions.showGroupingTotalsAsHeader;
3060
3099
  /**
@@ -3395,6 +3434,7 @@ class Adaptable {
3395
3434
  const flashingClassName = this.getFlashingCellClass(abColumn, params);
3396
3435
  const styledColumn = this.api.styledColumnApi.getStyledColumnForColumnId(colId);
3397
3436
  const hasStyledColumn = !!styledColumn && !styledColumn.IsSuspended;
3437
+ const commentClassName = this.getCommentCellClassName(abColumn, params);
3398
3438
  const returnValue = [
3399
3439
  typeof userCellClass === 'function' ? userCellClass(params) : userCellClass,
3400
3440
  !hasStyledColumn && formatColumns.length
@@ -3405,6 +3445,7 @@ class Adaptable {
3405
3445
  readonlyClassName,
3406
3446
  highlightAlertClassName,
3407
3447
  flashingClassName,
3448
+ commentClassName,
3408
3449
  ]
3409
3450
  // we flatten the array because some rules ('userCellClass' etc) might return a string[]
3410
3451
  .flat()
@@ -3486,12 +3527,14 @@ class Adaptable {
3486
3527
  });
3487
3528
  }
3488
3529
  setupColumnTooltipValueGetter({ col, colId, abColumn }) {
3530
+ let hasTooptip = false;
3489
3531
  this.setColDefProperty(col, 'tooltipValueGetter', () => {
3490
3532
  const styledColumn = this.api.styledColumnApi.getStyledColumnForColumnId(colId);
3491
3533
  if (styledColumn &&
3492
3534
  !styledColumn.IsSuspended &&
3493
3535
  styledColumn.PercentBarStyle &&
3494
3536
  styledColumn.PercentBarStyle.ToolTipText) {
3537
+ hasTooptip = true;
3495
3538
  if (styledColumn === null || styledColumn === void 0 ? void 0 : styledColumn.PercentBarStyle) {
3496
3539
  return (params) => {
3497
3540
  const min = this.api.styledColumnApi.internalApi.getNumericStyleMinValue(styledColumn, abColumn, params.node, params.value);
@@ -4643,7 +4686,6 @@ class Adaptable {
4643
4686
  return this.isAgGridModulePresent(core_1.ModuleNames.ExcelExportModule);
4644
4687
  }
4645
4688
  exportToExcel(reportData, fileName) {
4646
- var _a;
4647
4689
  const columnDefs = reportData.columns.map((column) => ({
4648
4690
  field: column.columnId,
4649
4691
  headerName: column.friendlyName,
@@ -4680,10 +4722,7 @@ class Adaptable {
4680
4722
  columnDefs,
4681
4723
  rowData: reportData.rows,
4682
4724
  };
4683
- let gridParams;
4684
- if ((_a = this.runtimeConfig.agGridModules) === null || _a === void 0 ? void 0 : _a.length) {
4685
- gridParams = { modules: this.runtimeConfig.agGridModules };
4686
- }
4725
+ let gridParams = { modules: this.getAgGridRegisteredModules() };
4687
4726
  const grid = new core_1.Grid(document.createElement('div'), gridOptions, gridParams);
4688
4727
  gridOptions.api.exportDataAsExcel({
4689
4728
  sheetName: 'Sheet 1',
@@ -5208,12 +5247,13 @@ class AdaptableNoCodeWizard {
5208
5247
  // this allows people to customize the wizard dimensions & styling
5209
5248
  // when it's visible
5210
5249
  container.classList.add('adaptable--in-wizard');
5211
- const unmount = (0, renderReactRoot_1.renderReactRoot)(React.createElement(AdaptableWizardView_1.default, Object.assign(Object.assign({ adaptableOptions: this.adaptableOptions }, this.extraOptions), { onInit: (adaptableOptions) => {
5250
+ const unmount = (0, renderReactRoot_1.renderReactRoot)(React.createElement(AdaptableWizardView_1.default, Object.assign(Object.assign({ adaptableOptions: this.adaptableOptions }, this.extraOptions), { onInit: (adaptableOptions, gridOptions) => {
5212
5251
  container.classList.remove('adaptable--in-wizard');
5213
5252
  unmount();
5253
+ adaptableOptions._gridOptions = gridOptions;
5214
5254
  this.init({
5215
5255
  adaptableOptions,
5216
- gridOptions: adaptableOptions._gridOptions,
5256
+ gridOptions: gridOptions,
5217
5257
  agGridModules: [...this.agGridModules],
5218
5258
  });
5219
5259
  } })), container, true);