@adaptabletools/adaptable 11.2.3 → 11.3.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 (89) hide show
  1. package/bundle.cjs.js +106 -106
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +2 -0
  6. package/src/AdaptableOptions/AdaptableOptions.d.ts +7 -0
  7. package/src/AdaptableOptions/EditOptions.d.ts +92 -4
  8. package/src/AdaptableOptions/FinancePluginOptions.d.ts +33 -3
  9. package/src/AdaptableOptions/FormatColumnOptions.d.ts +10 -0
  10. package/src/AdaptableOptions/{SmartEdit.js → FormatColumnOptions.js} +0 -0
  11. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -3
  12. package/src/Api/ColumnApi.d.ts +4 -1
  13. package/src/Api/EventApi.d.ts +4 -1
  14. package/src/Api/Events/RowFormSubmitted.d.ts +19 -0
  15. package/src/Api/Events/RowFormSubmitted.js +2 -0
  16. package/src/Api/FinanceApi.d.ts +3 -2
  17. package/src/Api/FormatColumnApi.d.ts +28 -1
  18. package/src/Api/GridApi.d.ts +14 -0
  19. package/src/Api/Implementation/ColumnApiImpl.js +4 -1
  20. package/src/Api/Implementation/FilterApiImpl.js +2 -7
  21. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +6 -0
  22. package/src/Api/Implementation/FormatColumnApiImpl.js +34 -0
  23. package/src/Api/Implementation/GridApiImpl.d.ts +3 -0
  24. package/src/Api/Implementation/GridApiImpl.js +40 -0
  25. package/src/Api/Implementation/InternalApiImpl.d.ts +4 -0
  26. package/src/Api/Implementation/InternalApiImpl.js +37 -7
  27. package/src/Api/Implementation/SmartEditApiImpl.d.ts +2 -1
  28. package/src/Api/Implementation/SmartEditApiImpl.js +3 -0
  29. package/src/Api/Implementation/UserInterfaceApiImpl.js +3 -21
  30. package/src/Api/InternalApi.d.ts +4 -1
  31. package/src/Api/SmartEditApi.d.ts +6 -1
  32. package/src/PredefinedConfig/CalculatedColumnState.d.ts +5 -0
  33. package/src/PredefinedConfig/Common/AdaptableForm.d.ts +3 -2
  34. package/src/PredefinedConfig/Common/AdaptableFormat.d.ts +6 -3
  35. package/src/PredefinedConfig/Common/AdaptableObject.d.ts +2 -11
  36. package/src/PredefinedConfig/Common/AdaptablePredicate.js +17 -1
  37. package/src/PredefinedConfig/Common/BaseContext.d.ts +1 -1
  38. package/src/PredefinedConfig/Common/FDC3Context.d.ts +5 -1
  39. package/src/PredefinedConfig/SystemState.d.ts +1 -2
  40. package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -1
  41. package/src/Strategy/DashboardModule.js +3 -0
  42. package/src/Strategy/FormatColumnModule.js +1 -1
  43. package/src/Strategy/LayoutModule.js +4 -4
  44. package/src/Strategy/SmartEditModule.d.ts +1 -1
  45. package/src/Strategy/SmartEditModule.js +5 -6
  46. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +9 -0
  47. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +2 -4
  48. package/src/Utilities/Helpers/AdaptableHelper.js +1 -0
  49. package/src/Utilities/Services/Interface/IRowEditService.d.ts +8 -0
  50. package/src/Utilities/Services/Interface/IRowEditService.js +2 -0
  51. package/src/Utilities/Services/RowEditService.d.ts +25 -0
  52. package/src/Utilities/Services/RowEditService.js +165 -0
  53. package/src/View/AdaptableView.js +8 -2
  54. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  55. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -2
  56. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +1 -1
  57. package/src/View/Components/FilterForm/FilterForm.d.ts +4 -1
  58. package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +4 -1
  59. package/src/View/Components/FilterForm/ListBoxFilterForm.js +7 -7
  60. package/src/View/Components/FilterForm/QuickFilterForm.js +15 -2
  61. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +2 -0
  62. package/src/View/Components/Popups/AdaptableToaster.js +1 -0
  63. package/src/View/Components/Popups/FormPopups/FormPopups.js +2 -2
  64. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +3 -2
  65. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +51 -22
  66. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +1 -1
  67. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +1 -1
  68. package/src/View/SmartEdit/SmartEditPopup.d.ts +1 -1
  69. package/src/View/SmartEdit/SmartEditPopup.js +1 -2
  70. package/src/View/SmartEdit/SmartEditViewPanel.d.ts +1 -1
  71. package/src/View/SmartEdit/SmartEditViewPanel.js +1 -2
  72. package/src/agGrid/ActionColumnRenderer.d.ts +6 -1
  73. package/src/agGrid/ActionColumnRenderer.js +6 -4
  74. package/src/agGrid/Adaptable.d.ts +3 -0
  75. package/src/agGrid/Adaptable.js +142 -39
  76. package/src/agGrid/rowEditIcons.d.ts +4 -0
  77. package/src/agGrid/rowEditIcons.js +9 -0
  78. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +6 -16
  79. package/src/components/Datepicker/index.js +19 -18
  80. package/src/components/WindowModal/WindowModal.d.ts +2 -0
  81. package/src/components/WindowModal/WindowModal.js +1 -1
  82. package/src/metamodel/adaptable.metamodel.d.ts +89 -2
  83. package/src/metamodel/adaptable.metamodel.js +208 -11
  84. package/src/types.d.ts +6 -5
  85. package/version.d.ts +1 -1
  86. package/version.js +1 -1
  87. package/src/AdaptableOptions/SmartEdit.d.ts +0 -34
  88. package/src/View/Components/Forms/AdaptableForm.d.ts +0 -6
  89. package/src/View/Components/Forms/AdaptableForm.js +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "11.2.3",
3
+ "version": "11.3.0",
4
4
  "description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1652892799172;
1
+ declare const _default: 1653559619721;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1652892799172;
3
+ exports.default = 1653559619721;
@@ -26,6 +26,7 @@ import { ITeamSharingService } from '../Utilities/Services/Interface/ITeamSharin
26
26
  import { AdaptableFrameworkComponent } from '../AdaptableOptions/AdaptableFrameworkComponent';
27
27
  import { IMetamodelService } from '../Utilities/Services/Interface/IMetamodelService';
28
28
  import { ColumnValuesComparer } from '../AdaptableOptions/GeneralOptions';
29
+ import { IRowEditService } from '../Utilities/Services/Interface/IRowEditService';
29
30
  /**
30
31
  * The only interface for Adaptable
31
32
  *
@@ -67,6 +68,7 @@ export interface IAdaptable {
67
68
  AlertService: IAlertService;
68
69
  TeamSharingService: ITeamSharingService;
69
70
  MetamodelService: IMetamodelService;
71
+ RowEditService: IRowEditService;
70
72
  /**
71
73
  * INTERNAL ADAPTABLE EVENTS
72
74
  * These are not called externally - for that we use eventapi
@@ -22,6 +22,7 @@ import { GridOptions, Module } from '@ag-grid-community/all-modules';
22
22
  import { FlashingCellOptions } from './FlashingCellOptions';
23
23
  import { AlertOptions } from './AlertOptions';
24
24
  import { AdaptableQLOptions } from './AdaptableQLOptions';
25
+ import { FormatColumnOptions } from './FormatColumnOptions';
25
26
  /**
26
27
  * Group of property options enabling developers to set up AdapTable at design time to fit precise requirements - provides AG Grid, Predefined Config and other information required to ensure a full, rich user experience
27
28
  */
@@ -141,6 +142,12 @@ export interface AdaptableOptions {
141
142
  * @gridInfoContainer
142
143
  */
143
144
  flashingCellOptions?: FlashingCellOptions;
145
+ /**
146
+ * Options for managing format columns
147
+ *
148
+ * @gridInfoContainer
149
+ */
150
+ formatColumnOptions?: FormatColumnOptions;
144
151
  /**
145
152
  * General options to manage AdapTable e.g. grouping behaviour, Primary Keys
146
153
  *
@@ -1,6 +1,8 @@
1
+ import { RowNode } from '@ag-grid-community/all-modules';
2
+ import { AdaptableButton, AdaptableColumn, AdaptableFormData, BaseContext, RowFormSubmittedInfo, RowFormType } from '../../types';
1
3
  import { CellDataChangedInfo } from '../PredefinedConfig/Common/CellDataChangedInfo';
4
+ import { MathOperation } from '../PredefinedConfig/Common/Enums';
2
5
  import { GridCell } from '../PredefinedConfig/Selection/GridCell';
3
- import { SmartEditCustomOperation } from './SmartEdit';
4
6
  /**
5
7
  * Options related to Editing in Adaptable.
6
8
  *
@@ -22,9 +24,14 @@ export interface EditOptions {
22
24
  * Function which checks if given Grid Cell is editable
23
25
  */
24
26
  isCellEditable?: (gridCell: GridCell) => boolean;
25
- smartEdit?: {
26
- customOperations?: SmartEditCustomOperation[];
27
- };
27
+ /**
28
+ * Custom Operations to use in Smart Edit
29
+ */
30
+ smartEditCustomOperations?: SmartEditCustomOperation[];
31
+ /**
32
+ * Options for editing (create/update/delete) row entries in the grid.
33
+ */
34
+ rowFormOptions?: RowFormOptions;
28
35
  }
29
36
  /**
30
37
  * Used for Server Validation ie. after an edit has been made in Adaptable which should be checked on the Server
@@ -39,3 +46,84 @@ export interface ValidationResult {
39
46
  */
40
47
  NewValue?: any;
41
48
  }
49
+ /**
50
+ * Custom Operation used in Smart Edit Module
51
+ */
52
+ export declare type SmartEditCustomOperation = {
53
+ /**
54
+ * Name of the Custom Operation (as appears in AdapTable UI)
55
+ */
56
+ Name: string;
57
+ /**
58
+ * Custom Operation function - returns a number
59
+ */
60
+ Operation: (context: SmartEditOperationContext) => number;
61
+ };
62
+ export declare type SmartEditOperation = SmartEditCustomOperation | MathOperation;
63
+ /**
64
+ * Context used in Custom Smart Edit Operations
65
+ */
66
+ export interface SmartEditOperationContext extends BaseContext {
67
+ /**
68
+ * Smart Edit value
69
+ */
70
+ smartEditValue: number;
71
+ /**
72
+ * Current selected grid cell - contains column, row and cell value information
73
+ */
74
+ currentCell: GridCell;
75
+ }
76
+ /**
77
+ * Options for editing (create/update/delete) row entries in the grid
78
+ */
79
+ export interface RowFormOptions {
80
+ /**
81
+ * Custom form title provider
82
+ *
83
+ * @defaultValue 'Create New Row'/'Edit Row'
84
+ */
85
+ formTitle?: string | ((context: FormParamContext) => string);
86
+ /**
87
+ * Custom form description provider
88
+ *
89
+ * @defaultValue undefined
90
+ */
91
+ formDescription?: string | ((context: FormParamContext) => string);
92
+ /**
93
+ * Custom form field label provider
94
+ *
95
+ * @defaultValue undefined
96
+ */
97
+ formFieldLabel?: (context: FormFieldLabelContext) => string;
98
+ /**
99
+ * Custom form buttons provider. If provided, the custom implementation is responsible for firing the 'RowFormSubmitted' and/or invoking the 'onFormSubmit' callback (if necessary).
100
+ */
101
+ formButtons?: AdaptableButton<RowFormContext>[];
102
+ /**
103
+ * Function which is invoked when a row form is submitted via a standard button (provided by AdapTable). This is not invoked when custom form buttons are provided!
104
+ *
105
+ * @param rowFormSubmittedInfo the form submitted info
106
+ * @defaultValue undefined
107
+ */
108
+ onFormSubmit?: (rowFormSubmittedInfo: RowFormSubmittedInfo) => void;
109
+ }
110
+ export declare type RowFormContext = CreateRowFormContext | EditRowFormContext;
111
+ export interface CreateRowFormContext extends BaseContext {
112
+ type: Extract<RowFormType, 'rowCreated'>;
113
+ formData: AdaptableFormData;
114
+ clonedRowNode?: RowNode;
115
+ }
116
+ export interface EditRowFormContext extends BaseContext {
117
+ type: Extract<RowFormType, 'rowEdited'>;
118
+ formData: AdaptableFormData;
119
+ rowNode: RowNode;
120
+ }
121
+ export interface FormParamContext extends BaseContext {
122
+ type: Extract<RowFormType, 'rowEdited' | 'rowCreated'>;
123
+ rowNode?: RowNode;
124
+ }
125
+ export interface FormFieldLabelContext extends BaseContext {
126
+ type: Extract<RowFormType, 'rowEdited' | 'rowCreated'>;
127
+ column: AdaptableColumn;
128
+ rowNode?: RowNode;
129
+ }
@@ -1,4 +1,5 @@
1
- import { ContextMenuContext } from '../../types';
1
+ import { ContextMenuContext, GridCell } from '../../types';
2
+ import { CustomFDC3Context } from '../PredefinedConfig/Common/FDC3Context';
2
3
  /**
3
4
  * Options required for when using the Finance plugin
4
5
  */
@@ -27,6 +28,14 @@ export interface FinancePluginOptions {
27
28
  * FDC3 Organizations
28
29
  */
29
30
  organizationColumns?: OrganizationColumn[];
31
+ /**
32
+ * Custom FDC3 Columns
33
+ */
34
+ customFDC3Columns?: CustomFDC3Column[];
35
+ /**
36
+ * Custom FDC3 Intents
37
+ */
38
+ customFDC3Intents?: CustomFDC3Intent[];
30
39
  };
31
40
  /**
32
41
  * Columns to use a Weighted Average aggregation
@@ -69,11 +78,15 @@ export interface FDC3Column {
69
78
  /**
70
79
  * FDC3 intents which the Column can raise
71
80
  */
72
- intents?: any;
81
+ intents?: any[];
73
82
  /**
74
83
  * Label to display in Intent Context Menu Item
75
84
  */
76
85
  intentContextMenuLabel?: string | ((raiseFDC3IntentContext: RaiseFDC3IntentContext) => string);
86
+ /**
87
+ * Returns the icon to display in the Raise Intent Context Menu Item
88
+ */
89
+ getIconForIntent?: (intent: FDC3Intent | CustomFDC3Intent) => any;
77
90
  }
78
91
  /**
79
92
  * A Column which will be defined as an FDC3 Instrument
@@ -222,10 +235,27 @@ export declare type CountryIntents = CountryIntent[];
222
235
  * FDC3 Intents available to a Country Column
223
236
  */
224
237
  export declare type CountryIntent = 'ViewChart';
238
+ /**
239
+ * A Column which will be defined as Custom FDC3 (can be any datatype)
240
+ */
241
+ export interface CustomFDC3Column extends FDC3Column {
242
+ /**
243
+ * Custom FDC3 Intents available to the column
244
+ */
245
+ intents: CustomFDC3Intent[];
246
+ /**
247
+ * Function which creates FDC3 context for the current column and row
248
+ */
249
+ createContext: (gridCell: GridCell) => CustomFDC3Context;
250
+ }
225
251
  /**
226
252
  * Full list of FDC3 Intents available - each FDC3 Column can use a subset
227
253
  */
228
254
  export declare type FDC3Intent = 'StartCall' | 'StartChat' | 'ViewAnalysis' | 'ViewChart' | 'ViewContact' | 'ViewInstrument' | 'ViewNews' | 'ViewQuote';
255
+ /**
256
+ * Custom FDC3 Intent - just a string value
257
+ */
258
+ export declare type CustomFDC3Intent = string;
229
259
  /**
230
260
  * Context passed into Raise FDC3 Intent functions (e.g. get label)
231
261
  */
@@ -233,5 +263,5 @@ export interface RaiseFDC3IntentContext extends ContextMenuContext {
233
263
  /**
234
264
  * FDC3 Intent that was raised
235
265
  */
236
- intent: FDC3Intent;
266
+ intent: FDC3Intent | CustomFDC3Intent;
237
267
  }
@@ -0,0 +1,10 @@
1
+ import { AdaptableScope } from '../../types';
2
+ export declare type CustomDisplayFormatter = {
3
+ id: string;
4
+ label?: string;
5
+ handler: (value: any) => any;
6
+ scope: AdaptableScope;
7
+ };
8
+ export interface FormatColumnOptions {
9
+ customDisplayFormatters?: CustomDisplayFormatter[];
10
+ }
@@ -6,7 +6,7 @@ import { AdaptableButton } from '../PredefinedConfig/Common/AdaptableButton';
6
6
  import { RowNode } from '@ag-grid-community/all-modules';
7
7
  import { AdaptableObject, AdaptableObjectTag } from '../PredefinedConfig/Common/AdaptableObject';
8
8
  import { AdaptableStyle } from '../PredefinedConfig/Common/AdaptableStyle';
9
- import { AdaptableApi, BaseContext, GridCell } from '../../types';
9
+ import { BaseContext, GridCell } from '../../types';
10
10
  /**
11
11
  * Options for managing the User Interface of AdapTable
12
12
  */
@@ -73,7 +73,7 @@ export interface UserInterfaceOptions {
73
73
  /**
74
74
  * Optional list of AdaptableObjectTags that can be associated with AdaptableObjects
75
75
  */
76
- objectTags?: AdaptableObjectTag[] | ((adaptableApi: AdaptableApi) => AdaptableObjectTag[]);
76
+ objectTags?: AdaptableObjectTag[] | ((context: ObjectTagsContext) => AdaptableObjectTag[]);
77
77
  /**
78
78
  * Optional list of Column Types - used primarily for special columns
79
79
  *
@@ -99,6 +99,18 @@ export interface UserInterfaceOptions {
99
99
  * @gridInfoItem
100
100
  */
101
101
  showAdapTableVersion?: boolean;
102
+ /**
103
+ * Action buttons to display for each row.
104
+ *
105
+ * @defaultValue undefined
106
+ */
107
+ rowActionButtons?: ('clone' | 'edit' | 'delete')[];
108
+ /**
109
+ * Position of the action buttons
110
+ *
111
+ * @defaultValue 'pinnedLeft'
112
+ */
113
+ rowActionButtonsPosition?: 'pinnedLeft' | 'pinnedRight';
102
114
  }
103
115
  export interface BasePermittedValues {
104
116
  /**
@@ -223,7 +235,7 @@ export interface EditLookUpContext extends BaseContext {
223
235
  /**
224
236
  * Cell being edited
225
237
  */
226
- gridCell: GridCell;
238
+ gridCell?: GridCell;
227
239
  }
228
240
  export interface PermittedValuesContext extends BaseContext {
229
241
  /**
@@ -253,3 +265,5 @@ export interface BulkUpdatePermittedValuesContext extends BaseContext {
253
265
  }
254
266
  export declare type GridInfoSections = GridInfoSection[];
255
267
  export declare type GridInfoSection = 'GridSummary' | 'AdaptableOptions' | 'ColumnInfo' | 'AdaptableObjectsSummary';
268
+ export interface ObjectTagsContext extends BaseContext {
269
+ }
@@ -227,7 +227,10 @@ export interface ColumnApi {
227
227
  * @param columnFilter Current applied filter
228
228
  */
229
229
  getDistinctFilterDisplayValuesForColumn(columnId: string, filter: string): Promise<{
230
- values: any[];
230
+ values: {
231
+ value: any;
232
+ label: string;
233
+ }[];
231
234
  suppressClientSideFilter: boolean;
232
235
  }>;
233
236
  /**
@@ -14,6 +14,7 @@ import { AdaptableStateChangedInfo } from './Events/AdaptableStateChanged';
14
14
  import { FlashingCellDisplayedInfo } from './Events/FlashingCellDisplayed';
15
15
  import { GridDataChangedInfo } from './Events/GridDataChanged';
16
16
  import { TeamSharingEntityChangedInfo } from './Events/TeamSharingEntityChanged';
17
+ import { RowFormSubmittedInfo } from './Events/RowFormSubmitted';
17
18
  /**
18
19
  * Responsible for publishing the many Events that AdapTable fires
19
20
  */
@@ -193,6 +194,8 @@ export interface EventApi {
193
194
  * Unsubscribe from LiveDataChanged
194
195
  */
195
196
  off(eventName: 'LiveDataChanged', callback: (liveDataChangedInfo: LiveDataChangedInfo) => void): void;
197
+ on(eventName: 'RowFormSubmitted', callback: (rowEditedFormInfo: RowFormSubmittedInfo) => void): () => void;
198
+ off(eventName: 'RowFormSubmitted', callback: (rowEditedFormInfo: RowFormSubmittedInfo) => void): void;
196
199
  /**
197
200
  * Fired when Adaptable is up and running - has no arguments.
198
201
  * @param eventName - AdaptableReady
@@ -224,6 +227,6 @@ export interface EventApi {
224
227
  emitSync(eventName: 'DashboardChanged', data?: any): any[];
225
228
  emitSync(eventName: 'FlashingCellDisplayed', data?: any): any[];
226
229
  emitSync(eventName: 'AdaptableDestroy'): any[];
227
- emit(eventName: 'AdaptableReady' | 'AlertFired' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'AdaptableStateChanged' | 'DashboardChanged' | 'CellChanged' | 'GridDataChanged' | 'LayoutChanged' | 'LiveDataChanged' | 'SearchChanged' | 'SelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'FDC3MessageSent', data?: any): Promise<any>;
230
+ emit(eventName: 'AdaptableReady' | 'AlertFired' | 'CheckboxColumnClicked' | 'CustomToolbarConfigured' | 'AdaptableStateChanged' | 'DashboardChanged' | 'CellChanged' | 'GridDataChanged' | 'LayoutChanged' | 'LiveDataChanged' | 'SearchChanged' | 'SelectionChanged' | 'SystemStatusMessageDisplayed' | 'TeamSharingEntityChanged' | 'ThemeChanged' | 'FDC3MessageSent' | 'RowFormSubmitted', data?: any): Promise<any>;
228
231
  destroy(): void;
229
232
  }
@@ -0,0 +1,19 @@
1
+ import { BaseEventInfo } from './BaseEventInfo';
2
+ import { AdaptableFormData } from '../../PredefinedConfig/Common/AdaptableForm';
3
+ import { RowNode } from '@ag-grid-community/all-modules';
4
+ export declare type RowFormSubmittedInfo = CreatedRowFormInfo | EditedRowFormInfo | DeletedRowFormInfo;
5
+ export declare type RowFormType = 'rowCreated' | 'rowEdited' | 'rowDeleted';
6
+ export interface CreatedRowFormInfo extends BaseEventInfo {
7
+ type: 'rowCreated';
8
+ formData: AdaptableFormData;
9
+ clonedRowNode?: RowNode;
10
+ }
11
+ export interface EditedRowFormInfo extends BaseEventInfo {
12
+ type: 'rowEdited';
13
+ formData: AdaptableFormData;
14
+ rowNode: RowNode;
15
+ }
16
+ export interface DeletedRowFormInfo extends BaseEventInfo {
17
+ type: 'rowDeleted';
18
+ rowNode: RowNode;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import { RowNode } from '@ag-grid-community/all-modules';
2
- import { ContactColumn, ContactIntent, CountryColumn, FDC3Intent, FinancePluginOptions, InstrumentColumn, InstrumentIntent, OrganizationColumn, PositionColumn, PositionIntent } from '../AdaptableOptions/FinancePluginOptions';
2
+ import { ContactColumn, ContactIntent, CountryColumn, CustomFDC3Column, CustomFDC3Intent, FDC3Intent, FinancePluginOptions, InstrumentColumn, InstrumentIntent, OrganizationColumn, PositionColumn, PositionIntent } from '../AdaptableOptions/FinancePluginOptions';
3
3
  import { ContactContext, ContactListContext, CountryContext, FDC3Context, InstrumentContext, InstrumentListContext, OrganizationContext, PortfolioContext, PositionContext } from '../types';
4
4
  /**
5
5
  * Provides run-time access to the Finance Plugin
@@ -82,6 +82,7 @@ export interface FinanceApi {
82
82
  * @param instrumentColumnId Column to Look
83
83
  */
84
84
  getCountryColumnById(countryColumnId: string): CountryColumn;
85
+ getCustomFDC3ColumnById(customFDC3ColumnId: string): CustomFDC3Column;
85
86
  /**
86
87
  * Publishes an FDC3 Message Event of type `Broadcast`
87
88
  * @param context context for Event
@@ -92,7 +93,7 @@ export interface FinanceApi {
92
93
  * @param context context for Event
93
94
  * @param intent FDC3 Intent to Raise
94
95
  */
95
- publishRaiseFDC3IntentEvent(context: FDC3Context, intent: FDC3Intent): void;
96
+ publishRaiseFDC3IntentEvent(context: FDC3Context, intent: FDC3Intent | CustomFDC3Intent): void;
96
97
  /**
97
98
  * Checks whether the Instrument Intent is valid for Instrument Lists
98
99
  * @param intent FDC3 Intent to check
@@ -1,5 +1,5 @@
1
1
  import { FormatColumnState, FormatColumn, ColumnStyle, ColumnComparison } from '../PredefinedConfig/FormatColumnState';
2
- import { AdaptableColumn } from '../types';
2
+ import { AdaptableColumn, AdaptableFormat } from '../types';
3
3
  import { RowNode } from '@ag-grid-community/all-modules';
4
4
  /**
5
5
  * Provides run-time access to the Format Column Module and associated state
@@ -104,6 +104,12 @@ export interface FormatColumnApi {
104
104
  * Opens Settings Panel with Format Column section selected and visible
105
105
  */
106
106
  showFormatColumnPopup(): void;
107
+ /**
108
+ * Gets an active Format Column, if any, for given Column
109
+ * @param column The Column for which to retrieve the Format Column
110
+ * @returns format column
111
+ */
112
+ getActiveFormatColumnForColumn(column: AdaptableColumn): FormatColumn | undefined;
107
113
  /**
108
114
  * Gets Format Column, if any, for given Column
109
115
  * @param column The Column for which to retrieve the Format Column
@@ -172,4 +178,25 @@ export interface FormatColumnApi {
172
178
  * Publishes the CheckboxColumnClickedEvent - when the checkbox in an Checkbox Column is clicked
173
179
  */
174
180
  fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
181
+ /**
182
+ * Format value according to format options.
183
+ *
184
+ * @param value value to format
185
+ * @param options formatter options
186
+ */
187
+ getNumberFormattedValue(value: any, options: AdaptableFormat['Options']): any;
188
+ /**
189
+ * Format value according to format options.
190
+ *
191
+ * @param value value to format
192
+ * @param options formatter options
193
+ */
194
+ getStringFormattedValue(value: any, options: AdaptableFormat['Options']): string;
195
+ /**
196
+ * Format value according to format options.
197
+ *
198
+ * @param value value to format
199
+ * @param options formatter options
200
+ */
201
+ getDateFormattedValue(value: any, options: AdaptableFormat['Options']): string;
175
202
  }
@@ -464,4 +464,18 @@ export interface GridApi {
464
464
  * Opens Settings Panel with Grid Info section selected and visible
465
465
  */
466
466
  showGridInfoPopup(): void;
467
+ /**
468
+ * Open edit dialog for row with the given primary key value
469
+ * @param primaryKey - the primary key of the edited row
470
+ */
471
+ openEditRowForm(primaryKey: any): void;
472
+ /**
473
+ * Open create dialog for a new row
474
+ */
475
+ openCreateRowForm(): void;
476
+ /**
477
+ * Open create dialog for cloning an existing row
478
+ * @param clonedRowNodePrimaryKey - the primary key of the duplicated row
479
+ */
480
+ openCloneRowForm(clonedRowNodePrimaryKey?: any): void;
467
481
  }
@@ -299,7 +299,10 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
299
299
  const { gridCells, suppressClientSideFilter } = await this.adaptable.getDistinctFilterValuesForColumn(abColumn, false, filter);
300
300
  return {
301
301
  values: this.sortDistinctValues(gridCells, abColumn).map((cv) => {
302
- return cv.displayValue;
302
+ return {
303
+ label: cv.displayValue,
304
+ value: cv.normalisedValue,
305
+ };
303
306
  }),
304
307
  suppressClientSideFilter,
305
308
  };
@@ -156,7 +156,7 @@ class FilterApiImpl extends ApiBase_1.ApiBase {
156
156
  return columnFilters.map((cf) => this.columnFilterToString(cf)).join(', ');
157
157
  }
158
158
  evaluateColumnFilter(columnFilter, node) {
159
- var _a, _b;
159
+ var _a;
160
160
  if (!columnFilter.Predicate) {
161
161
  return true;
162
162
  }
@@ -172,15 +172,10 @@ class FilterApiImpl extends ApiBase_1.ApiBase {
172
172
  return true;
173
173
  }
174
174
  let value = gridCell.normalisedValue;
175
- if (((_b = columnFilter.Predicate) === null || _b === void 0 ? void 0 : _b.PredicateId) === 'Contains' && column.dataType === 'Date') {
176
- // although 'Contains' Predicate is NOT relevant for Date columns, we have to handle the special case of QuickSearching
177
- // in that case, we have to evaluate the displayedValue of the cell, not the normalisedValue (it's a textual search after all)
178
- value = gridCell.displayValue;
179
- }
180
175
  return this.adaptable.api.predicateApi.handlePredicate(columnFilter.Predicate, {
181
176
  value: value,
182
177
  oldValue: null,
183
- displayValue: gridCell.normalisedValue,
178
+ displayValue: gridCell.displayValue,
184
179
  node,
185
180
  column,
186
181
  }, true);
@@ -4,6 +4,7 @@ import { FormatColumnApi } from '../FormatColumnApi';
4
4
  import { FormatColumnState, FormatColumn, ColumnStyle, ColumnComparison } from '../../PredefinedConfig/FormatColumnState';
5
5
  import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
6
6
  import { RowNode } from '@ag-grid-community/all-modules';
7
+ import { AdaptableFormat } from '../../types';
7
8
  export declare class FormatColumnApiImpl extends ApiBase implements FormatColumnApi {
8
9
  getFormatColumnState(): FormatColumnState;
9
10
  getAllFormatColumn(config?: {
@@ -27,6 +28,7 @@ export declare class FormatColumnApiImpl extends ApiBase implements FormatColumn
27
28
  suspendFormatColumn(formatColumn: FormatColumn): FormatColumn;
28
29
  unSuspendFormatColumn(formatColumn: FormatColumn): FormatColumn;
29
30
  applyFormatColumnDisplayFormats(): void;
31
+ getActiveFormatColumnForColumn(column: AdaptableColumn): FormatColumn | undefined;
30
32
  getFormatColumnForColumn(column: AdaptableColumn): FormatColumn | undefined;
31
33
  getFormatColumnForColumnId(columnId: string): FormatColumn | undefined;
32
34
  getFormatColumnWithStyleForColumn(column: AdaptableColumn): FormatColumn | undefined;
@@ -44,4 +46,8 @@ export declare class FormatColumnApiImpl extends ApiBase implements FormatColumn
44
46
  getCheckBoxStyleFormatColumn(column: AdaptableColumn): FormatColumn | undefined;
45
47
  isCheckBoxStyleFormatColumn(column: AdaptableColumn): boolean;
46
48
  fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
49
+ private applyCustomFormatters;
50
+ getNumberFormattedValue(value: any, options: AdaptableFormat['Options']): string;
51
+ getStringFormattedValue(value: any, options: AdaptableFormat['Options']): string;
52
+ getDateFormattedValue(value: any, options: AdaptableFormat['Options']): string;
47
53
  }
@@ -8,6 +8,7 @@ const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/
8
8
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
9
9
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
10
10
  const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
11
+ const FormatHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/FormatHelper"));
11
12
  class FormatColumnApiImpl extends ApiBase_1.ApiBase {
12
13
  getFormatColumnState() {
13
14
  return this.getAdaptableState().FormatColumn;
@@ -105,6 +106,10 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
105
106
  applyFormatColumnDisplayFormats() {
106
107
  throw 'This API method is deprecated - it is not needed anymore.';
107
108
  }
109
+ getActiveFormatColumnForColumn(column) {
110
+ const formatColumns = this.getAllActiveFormatColumn();
111
+ return this.getAppropriateFormatColumn(formatColumns, column);
112
+ }
108
113
  getFormatColumnForColumn(column) {
109
114
  const formatColumns = this.getAllFormatColumn();
110
115
  return this.getAppropriateFormatColumn(formatColumns, column);
@@ -269,5 +274,34 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
269
274
  };
270
275
  this.adaptable.api.eventApi.emit('CheckboxColumnClicked', checkboxColumnClickedInfo);
271
276
  }
277
+ applyCustomFormatters(value, options) {
278
+ var _a, _b;
279
+ const columnCustomFormatters = (_a = options === null || options === void 0 ? void 0 : options.CustomDisplayFormats) !== null && _a !== void 0 ? _a : [];
280
+ if (!(columnCustomFormatters === null || columnCustomFormatters === void 0 ? void 0 : columnCustomFormatters.length)) {
281
+ return value;
282
+ }
283
+ const adaptableOptions = this.adaptable.adaptableOptions;
284
+ const customFormattersFromOptions = (_b = adaptableOptions === null || adaptableOptions === void 0 ? void 0 : adaptableOptions.formatColumnOptions) === null || _b === void 0 ? void 0 : _b.customDisplayFormatters;
285
+ // formatters are applied in the order they are defined in the options
286
+ const customFormatters = customFormattersFromOptions.filter((customFormatterOption) => columnCustomFormatters.includes(customFormatterOption.id));
287
+ return customFormatters.reduce((acc, formatter) => {
288
+ if (formatter && formatter.handler) {
289
+ return formatter.handler(acc);
290
+ }
291
+ return acc;
292
+ }, value);
293
+ }
294
+ getNumberFormattedValue(value, options) {
295
+ let preparedValue = this.applyCustomFormatters(value, options);
296
+ return FormatHelper_1.default.NumberFormatter(preparedValue, options);
297
+ }
298
+ getStringFormattedValue(value, options) {
299
+ let preparedValue = this.applyCustomFormatters(value, options);
300
+ return FormatHelper_1.default.StringFormatter(preparedValue, options);
301
+ }
302
+ getDateFormattedValue(value, options) {
303
+ let preparedValue = this.applyCustomFormatters(value, options);
304
+ return FormatHelper_1.default.DateFormatter(preparedValue, options);
305
+ }
272
306
  }
273
307
  exports.FormatColumnApiImpl = FormatColumnApiImpl;
@@ -103,6 +103,9 @@ export declare class GridApiImpl extends ApiBase implements GridApi {
103
103
  refreshRowNode(rowNode: RowNode): void;
104
104
  refreshRowNodes(rowNodes: RowNode[]): void;
105
105
  areCellsEditable(gridCells: GridCell[]): boolean;
106
+ openEditRowForm(primaryKey: any): void;
107
+ openCreateRowForm(duplicatedRowNodePrimaryKey?: any): void;
108
+ openCloneRowForm(clonedRowNodePrimaryKey?: any): void;
106
109
  getRowCount(): number;
107
110
  getVisibleRowCount(): number;
108
111
  getRowsInViewport(): RowNode[];
@@ -7,6 +7,7 @@ const GridRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/Grid
7
7
  const SystemRedux_1 = require("../../Redux/ActionsReducers/SystemRedux");
8
8
  const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
9
9
  const LoggingHelper_1 = require("../../Utilities/Helpers/LoggingHelper");
10
+ const PopupRedux_1 = require("../../Redux/ActionsReducers/PopupRedux");
10
11
  class GridApiImpl extends ApiBase_1.ApiBase {
11
12
  getGridState() {
12
13
  return this.getAdaptableState().Grid;
@@ -372,6 +373,45 @@ class GridApiImpl extends ApiBase_1.ApiBase {
372
373
  }
373
374
  return true;
374
375
  }
376
+ openEditRowForm(primaryKey) {
377
+ const rowNode = this.adaptable.api.gridApi.getRowNodeForPrimaryKey(primaryKey);
378
+ if (!rowNode) {
379
+ LoggingHelper_1.LogAdaptableWarning(`Can NOT edit row: rowNode not found for primaryKey ${primaryKey}`);
380
+ }
381
+ const editForm = this.adaptable.api.internalApi.getRowEditService().buildRowEditForm(rowNode);
382
+ this.dispatchAction(PopupRedux_1.PopupShowForm({
383
+ Id: 'edit_row_form',
384
+ Form: editForm,
385
+ // formProps are added to the formContext
386
+ FormProps: {
387
+ rowNode,
388
+ },
389
+ }));
390
+ }
391
+ openCreateRowForm(duplicatedRowNodePrimaryKey) {
392
+ const createForm = this.adaptable.api.internalApi.getRowEditService().buildRowCreateForm();
393
+ this.dispatchAction(PopupRedux_1.PopupShowForm({
394
+ Id: 'create_row_form',
395
+ Form: createForm,
396
+ }));
397
+ }
398
+ openCloneRowForm(clonedRowNodePrimaryKey) {
399
+ const rowNode = this.adaptable.api.gridApi.getRowNodeForPrimaryKey(clonedRowNodePrimaryKey);
400
+ if (!rowNode) {
401
+ LoggingHelper_1.LogAdaptableWarning(`Can NOT clone row: rowNode not found for primaryKey ${clonedRowNodePrimaryKey}`);
402
+ }
403
+ const createForm = this.adaptable.api.internalApi
404
+ .getRowEditService()
405
+ .buildRowCreateForm(rowNode);
406
+ this.dispatchAction(PopupRedux_1.PopupShowForm({
407
+ Id: 'create_row_form',
408
+ Form: createForm,
409
+ // formProps are added to the formContext
410
+ FormProps: {
411
+ clonedRowNode: rowNode,
412
+ },
413
+ }));
414
+ }
375
415
  getRowCount() {
376
416
  return this.adaptable.getRowCount();
377
417
  }