@adaptabletools/adaptable 18.1.13 → 18.1.15-canary.0

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 (156) hide show
  1. package/package.json +2 -2
  2. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -5
  3. package/src/AdaptableOptions/AlertOptions.d.ts +2 -1
  4. package/src/AdaptableOptions/ChartingOptions.d.ts +5 -1
  5. package/src/AdaptableOptions/ColumnFilterOptions.d.ts +5 -1
  6. package/src/AdaptableOptions/DashboardOptions.d.ts +5 -1
  7. package/src/AdaptableOptions/FlashingCellOptions.d.ts +5 -1
  8. package/src/AdaptableOptions/LayoutOptions.d.ts +5 -1
  9. package/src/AdaptableOptions/NotificationsOptions.d.ts +6 -2
  10. package/src/AdaptableOptions/SettingsPanelOptions.d.ts +5 -1
  11. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +1 -1
  12. package/src/Api/ChartingApi.d.ts +2 -2
  13. package/src/Api/ColumnApi.d.ts +6 -0
  14. package/src/Api/ConfigApi.d.ts +22 -2
  15. package/src/Api/Events/LiveDataChanged.d.ts +1 -1
  16. package/src/Api/Implementation/AdaptableApiImpl.d.ts +1 -1
  17. package/src/Api/Implementation/ChartingApiImpl.d.ts +1 -1
  18. package/src/Api/Implementation/ChartingApiImpl.js +2 -2
  19. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  20. package/src/Api/Implementation/ColumnApiImpl.js +3 -0
  21. package/src/Api/Implementation/ConfigApiImpl.d.ts +4 -1
  22. package/src/Api/Implementation/ConfigApiImpl.js +16 -1
  23. package/src/Api/Implementation/EntitlementApiImpl.d.ts +4 -1
  24. package/src/Api/Implementation/EntitlementApiImpl.js +31 -6
  25. package/src/Api/Implementation/ExportApiImpl.js +5 -7
  26. package/src/Api/Implementation/GridApiImpl.js +1 -1
  27. package/src/Api/Implementation/TeamSharingApiImpl.js +2 -6
  28. package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -6
  29. package/src/Api/Internal/AdaptableInternalApi.js +5 -11
  30. package/src/Api/Internal/EntitlementInternalApi.d.ts +4 -0
  31. package/src/Api/Internal/EntitlementInternalApi.js +11 -0
  32. package/src/Api/Internal/ExportInternalApi.d.ts +33 -8
  33. package/src/Api/Internal/ExportInternalApi.js +576 -5
  34. package/src/Api/Internal/NamedQueryInternalApi.d.ts +0 -1
  35. package/src/Api/Internal/NamedQueryInternalApi.js +0 -4
  36. package/src/PredefinedConfig/AdaptableState.d.ts +0 -5
  37. package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +2 -1
  38. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  39. package/src/Redux/ActionsReducers/GridRedux.d.ts +6 -6
  40. package/src/Redux/ActionsReducers/GridRedux.js +8 -8
  41. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
  42. package/src/Redux/ActionsReducers/LayoutRedux.js +9 -9
  43. package/src/Redux/ActionsReducers/NamedQueryRedux.d.ts +1 -1
  44. package/src/Redux/ActionsReducers/NamedQueryRedux.js +1 -1
  45. package/src/Redux/ActionsReducers/PluginsRedux.d.ts +2 -2
  46. package/src/Redux/ActionsReducers/PluginsRedux.js +2 -2
  47. package/src/Redux/Store/AdaptableReduxMerger.js +3 -3
  48. package/src/Redux/Store/AdaptableStore.js +2 -4
  49. package/src/Strategy/AdaptableModuleBase.js +1 -2
  50. package/src/Strategy/ColumnFilterModule.js +1 -2
  51. package/src/Strategy/ExportModule.js +17 -44
  52. package/src/Strategy/FlashingCellModule.js +2 -10
  53. package/src/Strategy/ScheduleModule.js +4 -6
  54. package/src/Strategy/SmartEditModule.js +1 -7
  55. package/src/Strategy/TeamSharingModule.js +2 -2
  56. package/src/Strategy/Utilities/Export/getExportColumnsViewItems.js +1 -1
  57. package/src/Strategy/Utilities/Export/getExportRowsViewItems.js +1 -3
  58. package/src/Utilities/Constants/FilterConstants.d.ts +10 -0
  59. package/src/Utilities/Constants/FilterConstants.js +8 -0
  60. package/src/Utilities/Constants/GeneralConstants.d.ts +41 -4
  61. package/src/Utilities/Constants/GeneralConstants.js +42 -3
  62. package/src/Utilities/Defaults/DefaultSettingsPanel.d.ts +0 -2
  63. package/src/Utilities/Defaults/DefaultSettingsPanel.js +0 -5
  64. package/src/Utilities/Extensions/ArrayExtensions.d.ts +14 -0
  65. package/src/Utilities/Extensions/ArrayExtensions.js +65 -0
  66. package/src/Utilities/Extensions/EnumExtensions.d.ts +0 -4
  67. package/src/Utilities/Extensions/EnumExtensions.js +2 -12
  68. package/src/Utilities/Helpers/AdaptableHelper.d.ts +4 -10
  69. package/src/Utilities/Helpers/AdaptableHelper.js +7 -59
  70. package/src/Utilities/Helpers/FormatHelper.d.ts +9 -0
  71. package/src/Utilities/Helpers/FormatHelper.js +26 -14
  72. package/src/Utilities/Helpers/Helper.d.ts +0 -10
  73. package/src/Utilities/Helpers/Helper.js +0 -70
  74. package/src/Utilities/Services/ChartingService.d.ts +2 -2
  75. package/src/Utilities/Services/ChartingService.js +5 -11
  76. package/src/Utilities/Services/ModuleService.js +35 -31
  77. package/src/Utilities/Services/RowEditService.js +1 -6
  78. package/src/Utilities/Services/RowSummaryService.js +2 -2
  79. package/src/Utilities/Services/ValidationService.js +2 -16
  80. package/src/View/Alert/AlertEmptyView.js +1 -2
  81. package/src/View/Charting/ChartingStatusBarPopover.js +1 -2
  82. package/src/View/Charting/useChartingElements.js +1 -1
  83. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +2 -6
  84. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +2 -4
  85. package/src/View/Components/FilterForm/QuickFilterForm.js +2 -12
  86. package/src/View/Components/ModuleValueSelector/index.js +2 -2
  87. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +2 -5
  88. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupBody.js +1 -3
  89. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.js +2 -1
  90. package/src/View/Components/Popups/AdaptablePopupAlert.js +1 -7
  91. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +6 -12
  92. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +3 -23
  93. package/src/View/Components/ToolPanel/ToolPanelPopup.js +4 -5
  94. package/src/View/Components/ToolPanel/ToolPanelWrapper.js +1 -3
  95. package/src/View/Components/ValueSelector/index.js +2 -2
  96. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +2 -2
  97. package/src/View/Dashboard/CustomDashboardButton.js +1 -6
  98. package/src/View/Dashboard/CustomToolbar.js +2 -9
  99. package/src/View/Dashboard/Dashboard.js +2 -4
  100. package/src/View/Dashboard/DashboardPopup.js +1 -3
  101. package/src/View/Dashboard/DashboardToolbarFactory.js +1 -2
  102. package/src/View/Dashboard/PinnedToolbarsSelector.js +1 -2
  103. package/src/View/DataChangeHistory/DataChangeHistoryGrid.js +1 -3
  104. package/src/View/Export/ExportViewPanel.js +2 -4
  105. package/src/View/Export/Wizard/ReportSummaryWizard.js +2 -6
  106. package/src/View/GridFilter/GridFilterExpressionEditor.js +2 -2
  107. package/src/View/GridFilter/useGridFilterExpressionEditor.js +2 -6
  108. package/src/View/Layout/LayoutViewPanel.js +1 -1
  109. package/src/View/Layout/PivotDetailsPopoup.js +1 -7
  110. package/src/View/Layout/SaveLayoutButton.js +1 -3
  111. package/src/View/Layout/Wizard/sections/AggregationsSection.js +2 -2
  112. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -2
  113. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +2 -2
  114. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +2 -2
  115. package/src/View/Layout/Wizard/sections/RowSummarySection.js +2 -2
  116. package/src/View/Layout/Wizard/sections/SortSection.js +2 -2
  117. package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +3 -3
  118. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  119. package/src/View/SystemStatus/SystemStatusPopup.js +1 -1
  120. package/src/View/Wizard/OnePageAdaptableWizard.js +2 -2
  121. package/src/agGrid/ActionColumnRenderer.js +8 -22
  122. package/src/agGrid/AdaptableAgGrid.d.ts +5 -7
  123. package/src/agGrid/AdaptableAgGrid.js +159 -148
  124. package/src/agGrid/AgGridAdapter.d.ts +0 -1
  125. package/src/agGrid/AgGridAdapter.js +8 -11
  126. package/src/agGrid/AgGridColumnAdapter.d.ts +3 -1
  127. package/src/agGrid/AgGridColumnAdapter.js +40 -14
  128. package/src/agGrid/BadgeRenderer.js +4 -22
  129. package/src/agGrid/FloatingFilterWrapper.js +21 -0
  130. package/src/agGrid/buildSortedColumnStateForLayout.d.ts +1 -1
  131. package/src/agGrid/buildSortedColumnStateForLayout.js +2 -2
  132. package/src/agGrid/defaultAdaptableOptions.js +35 -30
  133. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +3 -15
  134. package/src/env.js +2 -2
  135. package/src/metamodel/adaptable.metamodel.d.ts +84 -8
  136. package/src/metamodel/adaptable.metamodel.js +1 -1
  137. package/src/types.d.ts +9 -9
  138. package/tsconfig.esm.tsbuildinfo +1 -1
  139. package/src/Redux/ActionsReducers/QueryRedux.d.ts +0 -10
  140. package/src/Redux/ActionsReducers/QueryRedux.js +0 -20
  141. package/src/Utilities/Helpers/FormatContentHelper.d.ts +0 -22
  142. package/src/Utilities/Helpers/FormatContentHelper.js +0 -34
  143. package/src/Utilities/Services/EntitlementService.d.ts +0 -14
  144. package/src/Utilities/Services/EntitlementService.js +0 -63
  145. package/src/Utilities/Services/Interface/IEntitlementService.d.ts +0 -10
  146. package/src/Utilities/Services/Interface/IEntitlementService.js +0 -1
  147. package/src/Utilities/Services/Interface/IReportService.d.ts +0 -27
  148. package/src/Utilities/Services/Interface/IReportService.js +0 -1
  149. package/src/Utilities/Services/ReportService.d.ts +0 -41
  150. package/src/Utilities/Services/ReportService.js +0 -603
  151. package/src/Utilities/isAdaptableObject.d.ts +0 -2
  152. package/src/Utilities/isAdaptableObject.js +0 -4
  153. package/src/Utilities/reorder.d.ts +0 -1
  154. package/src/Utilities/reorder.js +0 -13
  155. package/src/Utilities/sortWithOrder.d.ts +0 -11
  156. package/src/Utilities/sortWithOrder.js +0 -50
@@ -1,7 +1,15 @@
1
1
  import { SummaryOperation } from '../../PredefinedConfig/Common/Enums';
2
2
  import { AdaptableTheme } from '../../PredefinedConfig/ThemeState';
3
3
  import { AdaptableMessageType } from '../../PredefinedConfig/Common/AdaptableMessageType';
4
- import { AdaptableColumnType } from '../../PredefinedConfig/Common/Types';
4
+ import { AdaptableColumnType, AdaptableModule } from '../../PredefinedConfig/Common/Types';
5
+ import { AccessLevel } from '../../PredefinedConfig/Common/Entitlement';
6
+ import { DataChangeDetectionPolicy } from '../../AdaptableOptions/AlertOptions';
7
+ import { ToastPositions, ToastTransitions } from '../../AdaptableOptions/NotificationsOptions';
8
+ import { FlashTarget } from '../../AdaptableOptions/FlashingCellOptions';
9
+ import { DashboardButtonsLocation } from '../../AdaptableOptions/DashboardOptions';
10
+ import { PopupType } from '../../AdaptableOptions/SettingsPanelOptions';
11
+ import { SaveChartBehaviour } from '../../AdaptableOptions/ChartingOptions';
12
+ import { DisplayRowGroups } from '../../AdaptableOptions/LayoutOptions';
5
13
  export declare const AUTOGENERATED_PK_COLUMN: string;
6
14
  export declare const MISSING_COLUMN: string;
7
15
  export declare const DEFAULT_LAYOUT: string;
@@ -11,6 +19,8 @@ export declare const OS_THEME: string;
11
19
  export declare const USER_NAME: string;
12
20
  export declare const ADAPTABLE_ID: string;
13
21
  export declare const ADAPTABLE: string;
22
+ export declare const ADAPTABLE_CONTAINER_ID: string;
23
+ export declare const AG_GRID_CONTAINER_ID: string;
14
24
  export declare const ADAPTABLE_TOOLPANEL_ID: string;
15
25
  export declare const ADAPTABLE_TOOLPANEL_COMPONENT: string;
16
26
  export declare const AGGRID_TOOLPANEL_FILTERS: string;
@@ -18,9 +28,6 @@ export declare const AGGRID_TOOLPANEL_COLUMNS: string;
18
28
  export declare const MENU_PREFIX: string;
19
29
  export declare const READ_ONLY_STYLE: string;
20
30
  export declare const ALL_COLUMN_VALUES: string;
21
- export declare const FILTER_ALWAYS: 'Always' | 'Never' | 'Throttle';
22
- export declare const FILTER_NEVER: 'Always' | 'Never' | 'Throttle';
23
- export declare const FILTER_THROTTLE: 'Always' | 'Never' | 'Throttle';
24
31
  export declare const EMPTY_STRING: string;
25
32
  export declare const EMPTY_ARRAY: any[];
26
33
  export declare const AB_SPECIAL_COLUMN: AdaptableColumnType;
@@ -40,6 +47,36 @@ export declare const BLANK_DISTINCT_COLUMN_VALUE = "[BLANKS]";
40
47
  export declare const DEFAULT_STRING_DISPLAY_VALUE = "Hello World";
41
48
  export declare const DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
42
49
  export declare const DEFAULT_DOUBLE_DISPLAY_VALUE = 12345.6789;
50
+ export declare const RAW_VALUE_DATA_CHANGE_DETECTION_POLICY: DataChangeDetectionPolicy;
51
+ export declare const TOAST_POSITIONS_BOTTOM_RIGHT: ToastPositions;
52
+ export declare const TOAST_TRANSITIONS_SLIDE: ToastTransitions;
53
+ export declare const NOTIFICATION_DURATION = 3000;
54
+ export declare const NOTIFICATION_MAX_SYSTEM_MESSAGES = 100;
55
+ export declare const QUICK_SEARCH_PLACEHOLDER = "Search";
56
+ export declare const DASHBOARD_BUTTONS_LOCATION_LEFT: DashboardButtonsLocation;
57
+ export declare const DASHBOARD_BUTTONS_LOCATION_RIGHT: DashboardButtonsLocation;
58
+ export declare const ENGLISH_VARIANT = "GB";
59
+ export declare const LOADING_SCREEN_DELAY = 200;
60
+ export declare const LOADING_SCREEN_TITLE = "Initialising Grid";
61
+ export declare const LOADING_SCREEN_TEXT = "Retrieving your settings and setting up the grid...";
62
+ export declare const DATE_INPUT_DATE_FORMAT = "yyyy-MM-dd";
63
+ export declare const FLASHING_TARGET_CELL: FlashTarget;
64
+ export declare const FLASHING_TARGET_ROW: FlashTarget;
65
+ export declare const ICON_CONFIGURATION = "ConfigurationIcon";
66
+ export declare const POPUP_TYPE_MODAL: PopupType;
67
+ export declare const POPUP_TYPE_WINDOW: PopupType;
68
+ export declare const SAVE_CHART_BEHAVIOUR_AUTO: SaveChartBehaviour;
69
+ export declare const SAVE_CHART_BEHAVIOUR_MANUAL: SaveChartBehaviour;
70
+ export declare const SAVE_CHART_BEHAVIOUR_NONE: SaveChartBehaviour;
71
+ export declare const DISPLAY_ROW_GROUPS_DYNAMIC: DisplayRowGroups;
72
+ export declare const DISPLAY_ROW_GROUPS_EXPANDED: DisplayRowGroups;
73
+ export declare const DISPLAY_ROW_GROUPS_CLOSED: DisplayRowGroups;
74
+ export declare const FDC3_ACTION_COLUMN_DEFAULT_COLUMN_ID = "fdc3ActionColumn";
75
+ export declare const FDC3_ACTION_COLUMN_DEFAULT_HEADER_NAME = "FDC3 Actions";
76
+ export declare const ACCESS_LEVEL_READONLY: AccessLevel;
77
+ export declare const ACCESS_LEVEL_HIDDEN: AccessLevel;
78
+ export declare const ACCESS_LEVEL_FULL: AccessLevel;
79
+ export declare const STANDALONE_MODULE_POPUPS: AdaptableModule[];
43
80
  export declare const SYSTEM_STATUS_DEFAULT_MAX_MESSAGES_IN_STORE: number;
44
81
  export declare const QUICK_SEARCH_DEFAULT_BACK_COLOR: string;
45
82
  export declare const QUICK_SEARCH_DEFAULT_FORE_COLOR: string;
@@ -9,6 +9,8 @@ export const OS_THEME = 'os';
9
9
  export const USER_NAME = 'anonymous';
10
10
  export const ADAPTABLE_ID = 'adaptable_id';
11
11
  export const ADAPTABLE = 'AdapTable';
12
+ export const ADAPTABLE_CONTAINER_ID = 'adaptable';
13
+ export const AG_GRID_CONTAINER_ID = 'grid';
12
14
  export const ADAPTABLE_TOOLPANEL_ID = 'adaptable';
13
15
  export const ADAPTABLE_TOOLPANEL_COMPONENT = 'AdaptableToolPanel';
14
16
  // from https://www.ag-grid.com/javascript-data-grid/side-bar/#string-configuration
@@ -17,9 +19,6 @@ export const AGGRID_TOOLPANEL_COLUMNS = 'columns';
17
19
  export const MENU_PREFIX = 'ab_';
18
20
  export const READ_ONLY_STYLE = 'ab_readonly';
19
21
  export const ALL_COLUMN_VALUES = 'ALL_COLUMN_VALUES';
20
- export const FILTER_ALWAYS = 'Always';
21
- export const FILTER_NEVER = 'Never';
22
- export const FILTER_THROTTLE = 'Throttle';
23
22
  export const EMPTY_STRING = '';
24
23
  export const EMPTY_ARRAY = [];
25
24
  export const AB_SPECIAL_COLUMN = 'abSpecialColumn';
@@ -39,6 +38,46 @@ export const BLANK_DISTINCT_COLUMN_VALUE = '[BLANKS]';
39
38
  export const DEFAULT_STRING_DISPLAY_VALUE = 'Hello World';
40
39
  export const DEFAULT_INTEGER_DISPLAY_VALUE = 12345;
41
40
  export const DEFAULT_DOUBLE_DISPLAY_VALUE = 12345.6789;
41
+ export const RAW_VALUE_DATA_CHANGE_DETECTION_POLICY = 'rawValue';
42
+ export const TOAST_POSITIONS_BOTTOM_RIGHT = 'BottomRight';
43
+ export const TOAST_TRANSITIONS_SLIDE = 'Slide';
44
+ export const NOTIFICATION_DURATION = 3000;
45
+ export const NOTIFICATION_MAX_SYSTEM_MESSAGES = 100;
46
+ export const QUICK_SEARCH_PLACEHOLDER = 'Search';
47
+ export const DASHBOARD_BUTTONS_LOCATION_LEFT = 'left';
48
+ export const DASHBOARD_BUTTONS_LOCATION_RIGHT = 'right';
49
+ // User Interface
50
+ export const ENGLISH_VARIANT = 'GB';
51
+ export const LOADING_SCREEN_DELAY = 200;
52
+ export const LOADING_SCREEN_TITLE = 'Initialising Grid';
53
+ export const LOADING_SCREEN_TEXT = 'Retrieving your settings and setting up the grid...';
54
+ export const DATE_INPUT_DATE_FORMAT = 'yyyy-MM-dd';
55
+ // Flashing Cell
56
+ export const FLASHING_TARGET_CELL = 'cell';
57
+ export const FLASHING_TARGET_ROW = 'row';
58
+ export const ICON_CONFIGURATION = 'ConfigurationIcon';
59
+ export const POPUP_TYPE_MODAL = 'modal';
60
+ export const POPUP_TYPE_WINDOW = 'window';
61
+ export const SAVE_CHART_BEHAVIOUR_AUTO = 'auto';
62
+ export const SAVE_CHART_BEHAVIOUR_MANUAL = 'manual';
63
+ export const SAVE_CHART_BEHAVIOUR_NONE = 'none';
64
+ // Layout
65
+ export const DISPLAY_ROW_GROUPS_DYNAMIC = 'dynamic';
66
+ export const DISPLAY_ROW_GROUPS_EXPANDED = 'expanded';
67
+ export const DISPLAY_ROW_GROUPS_CLOSED = 'closed';
68
+ // FDC3 defaults
69
+ export const FDC3_ACTION_COLUMN_DEFAULT_COLUMN_ID = 'fdc3ActionColumn';
70
+ export const FDC3_ACTION_COLUMN_DEFAULT_HEADER_NAME = 'FDC3 Actions';
71
+ // Entitlement Defaults
72
+ export const ACCESS_LEVEL_READONLY = 'ReadOnly';
73
+ export const ACCESS_LEVEL_HIDDEN = 'Hidden';
74
+ export const ACCESS_LEVEL_FULL = 'Full';
75
+ // Standalone Popups
76
+ export const STANDALONE_MODULE_POPUPS = [
77
+ 'BulkUpdate',
78
+ 'SmartEdit',
79
+ 'CellSummary',
80
+ ];
42
81
  /*
43
82
  Redux / State Defaults
44
83
  Try to put all our Redux / State defaults here and ONLY reference from here - avoid magic numbers / strings.
@@ -1,6 +1,4 @@
1
1
  import { AdaptableSettingsPanel } from '../../PredefinedConfig/Common/Types';
2
- import { AdaptableModule } from '../../types';
3
- export declare const STANDALONE_MODULE_POPUPS: AdaptableModule[];
4
2
  /**
5
3
  * This constants determines the order and the items that appear in the navigation.
6
4
  */
@@ -1,8 +1,3 @@
1
- export const STANDALONE_MODULE_POPUPS = [
2
- 'BulkUpdate',
3
- 'SmartEdit',
4
- 'CellSummary',
5
- ];
6
1
  /**
7
2
  * This constants determines the order and the items that appear in the navigation.
8
3
  */
@@ -33,6 +33,18 @@ export declare function sortCellValueArrayDates(cellValues: GridCell[], sortOrde
33
33
  export declare function groupArrayBy(array: Array<any>, prop: string): Array<any>;
34
34
  export declare function createCommaSeparatedString(values: any[]): string;
35
35
  export declare function SumArray(array: (number | undefined)[]): number;
36
+ export declare function reorderArray(array: any[], startIndex: number, endIndex: number): any[];
37
+ export declare function sortArrayWithOrder<T>(array: T[], order: T[],
38
+ /**
39
+ *
40
+ * The array can contain items which are not listed in the order array.
41
+ * So sortUnorderedItems decides whether to leave these items untouched
42
+ * in the current order in which they are in the array (sortUnorderedItems: false)
43
+ * or to sort them using normal comparison rules
44
+ */
45
+ { sortUnorderedItems: sortUnorderedItems }: {
46
+ sortUnorderedItems: boolean;
47
+ }): T[];
36
48
  export declare const ArrayExtensions: {
37
49
  GetLength: typeof GetLength;
38
50
  CorrectLength: typeof CorrectLength;
@@ -67,5 +79,7 @@ export declare const ArrayExtensions: {
67
79
  sortArrayWithProperty: typeof sortArrayWithProperty;
68
80
  createCommaSeparatedString: typeof createCommaSeparatedString;
69
81
  SumArray: typeof SumArray;
82
+ reorderArray: typeof reorderArray;
83
+ sortArrayWithOrder: typeof sortArrayWithOrder;
70
84
  };
71
85
  export default ArrayExtensions;
@@ -257,6 +257,69 @@ export function createCommaSeparatedString(values) {
257
257
  export function SumArray(array) {
258
258
  return array.filter((num) => typeof num === 'number' && !isNaN(num)).reduce((a, b) => a + b, 0);
259
259
  }
260
+ export function reorderArray(array, startIndex, endIndex) {
261
+ const result = [...array];
262
+ if (startIndex > array.length - 1) {
263
+ // not much that we can do if the dragged item is out of bounds...
264
+ return result;
265
+ }
266
+ if (endIndex > array.length - 1) {
267
+ endIndex = array.length - 1;
268
+ }
269
+ const [removed] = result.splice(startIndex, 1);
270
+ result.splice(endIndex, 0, removed);
271
+ return result;
272
+ }
273
+ export function sortArrayWithOrder(array, order,
274
+ /**
275
+ *
276
+ * The array can contain items which are not listed in the order array.
277
+ * So sortUnorderedItems decides whether to leave these items untouched
278
+ * in the current order in which they are in the array (sortUnorderedItems: false)
279
+ * or to sort them using normal comparison rules
280
+ */
281
+ { sortUnorderedItems: sortUnorderedItems }) {
282
+ const itemsToIndex = array.reduce((acc, x, i) => {
283
+ acc.set(x, i);
284
+ return acc;
285
+ }, new Map());
286
+ const orderItemsToIndex = order.reduce((acc, x, i) => {
287
+ acc.set(x, i);
288
+ return acc;
289
+ }, new Map());
290
+ function compareItemsOfCustomSort(valueA, valueB) {
291
+ const orderContainsFirstElement = orderItemsToIndex.has(valueA);
292
+ const indexInOrderOfFirstElement = orderContainsFirstElement
293
+ ? orderItemsToIndex.get(valueA)
294
+ : -1;
295
+ const orderContainsSecondElement = orderItemsToIndex.has(valueB);
296
+ const indexInOrderSecondElement = orderContainsSecondElement
297
+ ? orderItemsToIndex.get(valueB)
298
+ : -1;
299
+ //if none of the element are in the order list we just return normal compare
300
+ if (!orderContainsFirstElement && !orderContainsSecondElement) {
301
+ if (!sortUnorderedItems) {
302
+ // keep the original order
303
+ return itemsToIndex.get(valueA) - itemsToIndex.get(valueB);
304
+ }
305
+ if (valueA == valueB) {
306
+ return 0;
307
+ }
308
+ return valueA < valueB ? -1 : 1;
309
+ }
310
+ //if first item not in the list make sure we put it after the second item
311
+ if (!orderContainsFirstElement) {
312
+ return 1;
313
+ }
314
+ //if second item not in the list make sure we put it after the first item
315
+ if (!orderContainsSecondElement) {
316
+ return -1;
317
+ }
318
+ //return the comparison from the list if the two items are in the list
319
+ return indexInOrderOfFirstElement - indexInOrderSecondElement;
320
+ }
321
+ return [].concat(array).sort(compareItemsOfCustomSort);
322
+ }
260
323
  export const ArrayExtensions = {
261
324
  GetLength,
262
325
  CorrectLength,
@@ -291,5 +354,7 @@ export const ArrayExtensions = {
291
354
  sortArrayWithProperty,
292
355
  createCommaSeparatedString,
293
356
  SumArray,
357
+ reorderArray,
358
+ sortArrayWithOrder
294
359
  };
295
360
  export default ArrayExtensions;
@@ -1,11 +1,7 @@
1
1
  export declare function getNames(e: any): string[];
2
- export declare function getValues<T extends number>(e: any): T[];
3
- export declare function getObjValues(e: any): (number | string)[];
4
2
  export declare function getCssFontSizeFromFontSizeEnum(fontSize: any): string;
5
3
  export declare const EnumExtensions: {
6
4
  getNames: typeof getNames;
7
- getValues: typeof getValues;
8
- getObjValues: typeof getObjValues;
9
5
  getCssFontSizeFromFontSizeEnum: typeof getCssFontSizeFromFontSizeEnum;
10
6
  };
11
7
  export default EnumExtensions;
@@ -1,15 +1,7 @@
1
1
  import { FontSize } from '../../PredefinedConfig/Common/Enums';
2
- // export function getNamesAndValues<T extends number>(e: any) {
3
- // return EnumExtensions.getNames(e).map(n => ({ name: n, value: e[n] as T }));
4
- // }
5
2
  export function getNames(e) {
6
- return EnumExtensions.getObjValues(e).filter((v) => typeof v === 'string');
7
- }
8
- export function getValues(e) {
9
- return EnumExtensions.getObjValues(e).filter((v) => typeof v === 'number');
10
- }
11
- export function getObjValues(e) {
12
- return Object.keys(e).map((k) => e[k]);
3
+ const vals = Object.keys(e).map((k) => e[k]);
4
+ return vals.filter((v) => typeof v === 'string');
13
5
  }
14
6
  export function getCssFontSizeFromFontSizeEnum(fontSize) {
15
7
  switch (fontSize) {
@@ -27,8 +19,6 @@ export function getCssFontSizeFromFontSizeEnum(fontSize) {
27
19
  }
28
20
  export const EnumExtensions = {
29
21
  getNames,
30
- getValues,
31
- getObjValues,
32
22
  getCssFontSizeFromFontSizeEnum,
33
23
  };
34
24
  export default EnumExtensions;
@@ -1,22 +1,16 @@
1
1
  import { AdaptableObject } from '../../PredefinedConfig/Common/AdaptableObject';
2
- import { IAdaptable } from '../../AdaptableInterfaces/IAdaptable';
3
- import { AdaptableComparerFunction } from '../../PredefinedConfig/Common/AdaptableComparerFunction';
4
2
  import { PredefinedConfig } from '../../PredefinedConfig/PredefinedConfig';
5
3
  import { AccessLevel } from '../../PredefinedConfig/Common/Entitlement';
6
4
  export declare function initPredefinedConfigWithUuids(predefinedConfig: PredefinedConfig): PredefinedConfig;
7
- export declare function checkValidPrimaryKey(adaptable: IAdaptable): boolean;
8
- export declare function AdaptableObjectExistsInState(array: AdaptableObject[], itemToCheck: AdaptableObject): boolean;
9
- export declare function getAppropriateAccessLevel(adaptableObject: AdaptableObject, moduleAccessLevel: AccessLevel): AccessLevel;
10
- export declare function runAdaptableComparerFunction(columnId: string, columnValues: any[], adaptable: IAdaptable): AdaptableComparerFunction;
5
+ export declare function getAccessLevelForObject(adaptableObject: AdaptableObject, moduleAccessLevel: AccessLevel): AccessLevel;
11
6
  export declare function addUuidAndSource<T extends AdaptableObject>(adaptableObject: T): T;
12
7
  export declare function removeUuidAndSource<T extends AdaptableObject>(adaptableObject: T): T;
8
+ export declare function isAdaptableObject(object: unknown): object is AdaptableObject;
13
9
  export declare const AdaptableHelper: {
14
10
  initPredefinedConfigWithUuids: typeof initPredefinedConfigWithUuids;
15
- checkValidPrimaryKey: typeof checkValidPrimaryKey;
16
- AdaptableObjectExistsInState: typeof AdaptableObjectExistsInState;
17
- runAdaptableComparerFunction: typeof runAdaptableComparerFunction;
18
- getAppropriateAccessLevel: typeof getAppropriateAccessLevel;
11
+ getAccessLevelForObject: typeof getAccessLevelForObject;
19
12
  addUuidAndSource: typeof addUuidAndSource;
20
13
  removeUuidAndSource: typeof removeUuidAndSource;
14
+ isAdaptableObject: typeof isAdaptableObject;
21
15
  };
22
16
  export default AdaptableHelper;
@@ -14,30 +14,7 @@ export function initPredefinedConfigWithUuids(predefinedConfig) {
14
14
  };
15
15
  return cloneDeepWith(predefinedConfig, customizer);
16
16
  }
17
- export function checkValidPrimaryKey(adaptable) {
18
- const pkColumn = adaptable.api.columnApi.getColumnWithColumnId(adaptable.adaptableOptions.primaryKey);
19
- if (pkColumn == undefined && !adaptable.adaptableOptions.autogeneratePrimaryKey) {
20
- const errorMessage = `The Primary Key Column '${adaptable.adaptableOptions.primaryKey}' does not exist. This will affect many functions in Adaptable.`;
21
- if (adaptable.adaptableOptions.alertOptions.showMissingPrimaryKeyAlert == true) {
22
- // show an alert if that is the option
23
- adaptable.api.alertApi.showAlertError('No Primary Key', errorMessage);
24
- }
25
- else {
26
- if (adaptable.adaptableOptions.columnOptions.showMissingColumnsWarning == true) {
27
- adaptable.logger.consoleError(errorMessage);
28
- }
29
- }
30
- return false;
31
- }
32
- return true;
33
- }
34
- export function AdaptableObjectExistsInState(array, itemToCheck) {
35
- if (array == null) {
36
- return false;
37
- }
38
- return array.findIndex((abObject) => abObject.Uuid == itemToCheck.Uuid) > -1;
39
- }
40
- export function getAppropriateAccessLevel(adaptableObject, moduleAccessLevel) {
17
+ export function getAccessLevelForObject(adaptableObject, moduleAccessLevel) {
41
18
  // we always return the Module Access Level unless the following condition is met:
42
19
  // the object prpoerty has been set and set to true and the Module entitlement is full
43
20
  if (moduleAccessLevel == 'Full' &&
@@ -48,37 +25,6 @@ export function getAppropriateAccessLevel(adaptableObject, moduleAccessLevel) {
48
25
  }
49
26
  return moduleAccessLevel;
50
27
  }
51
- export function runAdaptableComparerFunction(columnId, columnValues, adaptable) {
52
- return function compareItemsOfCustomSort(valueA, valueB, nodeA, nodeB) {
53
- let firstElementValueString = nodeA
54
- ? adaptable.getDisplayValueFromRowNode(nodeA, columnId)
55
- : valueA;
56
- let secondElementValueString = nodeB
57
- ? adaptable.getDisplayValueFromRowNode(nodeB, columnId)
58
- : valueB;
59
- let indexFirstElement = columnValues.indexOf(firstElementValueString);
60
- let containsFirstElement = indexFirstElement >= 0;
61
- let indexSecondElement = columnValues.indexOf(secondElementValueString);
62
- let containsSecondElement = indexSecondElement >= 0;
63
- //if none of the element are in the list we jsut return normal compare
64
- if (!containsFirstElement && !containsSecondElement) {
65
- if (valueA == valueB) {
66
- return 0;
67
- }
68
- return valueA < valueB ? -1 : 1;
69
- }
70
- //if first item not in the list make sure we put it after the second item
71
- if (!containsFirstElement) {
72
- return 1;
73
- }
74
- //if second item not in the list make sure we put it after the first item
75
- if (!containsSecondElement) {
76
- return -1;
77
- }
78
- //return the comparison from the list if the two items are in the list
79
- return indexFirstElement - indexSecondElement;
80
- };
81
- }
82
28
  export function addUuidAndSource(adaptableObject) {
83
29
  if (!adaptableObject.Uuid) {
84
30
  adaptableObject.Uuid = createUuid();
@@ -104,13 +50,15 @@ export function removeUuidAndSource(adaptableObject) {
104
50
  sanitiseObject(clonedObject);
105
51
  return clonedObject;
106
52
  }
53
+ // pretty primitive type guard for AdaptableObject, but currently there is no better/safer way
54
+ export function isAdaptableObject(object) {
55
+ return object != undefined && typeof object['Uuid'] === 'string';
56
+ }
107
57
  export const AdaptableHelper = {
108
58
  initPredefinedConfigWithUuids,
109
- checkValidPrimaryKey,
110
- AdaptableObjectExistsInState,
111
- runAdaptableComparerFunction,
112
- getAppropriateAccessLevel,
59
+ getAccessLevelForObject,
113
60
  addUuidAndSource,
114
61
  removeUuidAndSource,
62
+ isAdaptableObject,
115
63
  };
116
64
  export default AdaptableHelper;
@@ -1,6 +1,15 @@
1
1
  import { NumberFormatterOptions, DateFormatterOptions, StringFormatterOptions } from '../../PredefinedConfig/Common/AdaptableFormat';
2
2
  import { IRowNode } from '@ag-grid-community/core';
3
3
  import { AdaptableApi, AdaptableColumn } from '../../types';
4
+ /**
5
+ * Context used for Placeholders in Display Format
6
+ */
7
+ export interface DisplayFormatPlaceholderContext {
8
+ column: AdaptableColumn;
9
+ rowNode: IRowNode;
10
+ input: any;
11
+ api: AdaptableApi;
12
+ }
4
13
  export declare function NumberFormatter(input: number, options?: NumberFormatterOptions, rowNode?: IRowNode, column?: AdaptableColumn, api?: AdaptableApi): string;
5
14
  export declare function DateFormatter(input: number | Date | string, options: DateFormatterOptions, strictFormatting?: boolean): string | undefined;
6
15
  export declare function StringFormatter(input: string, options?: StringFormatterOptions, rowNode?: IRowNode, column?: AdaptableColumn, api?: AdaptableApi): string;
@@ -3,18 +3,7 @@
3
3
  import dateFnsFormat from 'date-fns/format';
4
4
  import { sentenceCase } from 'sentence-case';
5
5
  import { DEFAULT_DATE_FORMAT_PATTERN } from '../Constants/GeneralConstants';
6
- import FormatContentHelper from './FormatContentHelper';
7
- /*
8
- export function Format(input: any, format: AdaptableFormat) {
9
- if (format.Formatter === 'NumberFormatter') {
10
- return NumberFormatter(input, format.Options);
11
- }
12
- if (format.Formatter === 'DateFormatter') {
13
- return DateFormatter(input, format.Options);
14
- }
15
- throw new Error('Unknown formatter');
16
- }
17
- */
6
+ import Helper from './Helper';
18
7
  export function NumberFormatter(input, options = {}, rowNode, column, api) {
19
8
  var _a;
20
9
  let preparedInput;
@@ -25,7 +14,7 @@ export function NumberFormatter(input, options = {}, rowNode, column, api) {
25
14
  input,
26
15
  api,
27
16
  };
28
- preparedInput = FormatContentHelper.resolvePlaceholders(options.Content.toString(), context);
17
+ preparedInput = formatPlaceholder(options.Content.toString(), context);
29
18
  }
30
19
  else {
31
20
  preparedInput = input;
@@ -131,7 +120,7 @@ export function StringFormatter(input, options = {}, rowNode, column, api) {
131
120
  input,
132
121
  api,
133
122
  };
134
- preparedInput = FormatContentHelper.resolvePlaceholders(options.Content, context);
123
+ preparedInput = formatPlaceholder(options.Content, context);
135
124
  }
136
125
  else {
137
126
  preparedInput = input;
@@ -165,4 +154,27 @@ export function StringFormatter(input, options = {}, rowNode, column, api) {
165
154
  }
166
155
  return s;
167
156
  }
157
+ function formatPlaceholder(text, context) {
158
+ if (!text) {
159
+ return text;
160
+ }
161
+ if (!context) {
162
+ return text;
163
+ }
164
+ if (context === null || context === void 0 ? void 0 : context.input) {
165
+ text = Helper.replaceAll(text, '[value]', context.input);
166
+ }
167
+ if (context === null || context === void 0 ? void 0 : context.column) {
168
+ text = Helper.replaceAll(text, '[column]', context.api.columnApi.getFriendlyNameForColumnId(context.column.columnId));
169
+ }
170
+ if (context === null || context === void 0 ? void 0 : context.rowNode) {
171
+ const columns = Helper.extractColsFromText(text);
172
+ for (const column of columns) {
173
+ if (context.api.columnApi.getColumnWithColumnId(column)) {
174
+ text = Helper.replaceAll(text, `[rowData.${column}]`, context.api.gridApi.getRawValueFromRowNode(context.rowNode, column));
175
+ }
176
+ }
177
+ }
178
+ return text;
179
+ }
168
180
  export default { NumberFormatter, DateFormatter, StringFormatter };
@@ -12,11 +12,6 @@ export declare function isInputNullOrEmpty(itemToCheck: any): boolean;
12
12
  export declare function isInputNotNullOrEmpty(itemToCheck: any): boolean;
13
13
  export declare function roundNumber(numberToRound: any, decimalPlaces: number): number;
14
14
  export declare function roundNumberTo4dp(numberToRound: any): number;
15
- export declare function sumNumberArray(numericValues: number[]): number;
16
- export declare function standardDeviationNumberArray(numericValues: number[]): number;
17
- export declare function meanNumberArray(numericValues: number[]): number;
18
- export declare function medianNumberArray(numericValues: number[]): number;
19
- export declare function modeNumberArray(numbers: number[]): number;
20
15
  export declare function clamp(value: any, boundOne: number, boundTwo: number): number;
21
16
  export declare function extractColsFromText(text: string): string[];
22
17
  export declare function replaceAll(text: string, toReplace: string, replaceWith: string): string;
@@ -35,11 +30,6 @@ export declare const Helper: {
35
30
  isInputNotNullOrEmpty: typeof isInputNotNullOrEmpty;
36
31
  roundNumber: typeof roundNumber;
37
32
  roundNumberTo4dp: typeof roundNumberTo4dp;
38
- standardDeviationNumberArray: typeof standardDeviationNumberArray;
39
- sumNumberArray: typeof sumNumberArray;
40
- meanNumberArray: typeof meanNumberArray;
41
- medianNumberArray: typeof medianNumberArray;
42
- modeNumberArray: typeof modeNumberArray;
43
33
  clamp: typeof clamp;
44
34
  extractColsFromText: typeof extractColsFromText;
45
35
  replaceAll: typeof replaceAll;
@@ -149,71 +149,6 @@ export function roundNumber(numberToRound, decimalPlaces) {
149
149
  export function roundNumberTo4dp(numberToRound) {
150
150
  return roundNumber(numberToRound, 4);
151
151
  }
152
- export function sumNumberArray(numericValues) {
153
- return numericValues.length
154
- ? numericValues.reduce(function (a, b) {
155
- return a + b;
156
- })
157
- : 0;
158
- }
159
- export function standardDeviationNumberArray(numericValues) {
160
- if (numericValues.length) {
161
- const count = numericValues.length;
162
- const mean = sumNumberArray(numericValues) / count;
163
- return Math.sqrt(sumNumberArray(numericValues.map((val) => {
164
- return Math.pow(val - mean, 2);
165
- })) / count);
166
- }
167
- else {
168
- return 0;
169
- }
170
- }
171
- export function meanNumberArray(numericValues) {
172
- // dividing by 0 will return Infinity
173
- // arr must contain at least 1 element to use reduce
174
- if (numericValues.length) {
175
- let sum = sumNumberArray(numericValues);
176
- return sum / numericValues.length;
177
- }
178
- else {
179
- return 0;
180
- }
181
- }
182
- export function medianNumberArray(numericValues) {
183
- numericValues.sort(function (a, b) {
184
- return a - b;
185
- });
186
- const middle = Math.floor((numericValues.length - 1) / 2); // NB: operator precedence
187
- if (numericValues.length % 2) {
188
- return numericValues[middle];
189
- }
190
- else {
191
- return (numericValues[middle] + numericValues[middle + 1]) / 2.0;
192
- }
193
- }
194
- export function modeNumberArray(numbers) {
195
- if (numbers.length === 0) {
196
- return 0;
197
- }
198
- const m = numbers
199
- .reduce((items, current) => {
200
- const item = items.length === 0 ? null : items.find((x) => x.value === current);
201
- item ? item.occurrence++ : items.push({ value: current, occurrence: 1 });
202
- return items;
203
- }, [])
204
- .sort((a, b) => {
205
- if (a.occurrence < b.occurrence) {
206
- return 1;
207
- }
208
- else if (a.occurrence > b.occurrence || a.value < b.value) {
209
- return -1;
210
- }
211
- else {
212
- return a.value === b.value ? 0 : 1;
213
- }
214
- });
215
- return m[0].value;
216
- }
217
152
  // putting this here to remove lodash clamp which seems to cause an issue
218
153
  export function clamp(value, boundOne, boundTwo) {
219
154
  if (!boundTwo) {
@@ -269,11 +204,6 @@ export const Helper = {
269
204
  isInputNotNullOrEmpty,
270
205
  roundNumber,
271
206
  roundNumberTo4dp,
272
- standardDeviationNumberArray,
273
- sumNumberArray,
274
- meanNumberArray,
275
- medianNumberArray,
276
- modeNumberArray,
277
207
  clamp,
278
208
  extractColsFromText,
279
209
  replaceAll,
@@ -1,10 +1,10 @@
1
- import { ChartModel } from '@ag-grid-community/core';
1
+ import { AgEventType, ChartModel } from '@ag-grid-community/core';
2
2
  import { AdaptableApi } from '../../types';
3
3
  import { IChartingService } from './Interface/IChartingService';
4
4
  export declare class ChartingService implements IChartingService {
5
5
  private api;
6
6
  constructor(api: AdaptableApi);
7
- onChartModelChange(models: ChartModel[], eventType: string, params: any): void;
7
+ onChartModelChange(models: ChartModel[], eventType: AgEventType, params: any): void;
8
8
  /**
9
9
  * Emit events only for adaptable charting definition changes
10
10
  * - an adaptable chart opens