@adaptabletools/adaptable 11.2.4 → 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 (67) hide show
  1. package/bundle.cjs.js +98 -98
  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/EditOptions.d.ts +92 -4
  7. package/src/AdaptableOptions/FormatColumnOptions.d.ts +2 -1
  8. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +17 -3
  9. package/src/Api/EventApi.d.ts +4 -1
  10. package/src/Api/Events/RowFormSubmitted.d.ts +19 -0
  11. package/src/{AdaptableOptions/SmartEdit.js → Api/Events/RowFormSubmitted.js} +0 -0
  12. package/src/Api/FormatColumnApi.d.ts +6 -0
  13. package/src/Api/GridApi.d.ts +14 -0
  14. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +1 -0
  15. package/src/Api/Implementation/FormatColumnApiImpl.js +6 -1
  16. package/src/Api/Implementation/GridApiImpl.d.ts +3 -0
  17. package/src/Api/Implementation/GridApiImpl.js +40 -0
  18. package/src/Api/Implementation/InternalApiImpl.d.ts +4 -0
  19. package/src/Api/Implementation/InternalApiImpl.js +37 -7
  20. package/src/Api/Implementation/SmartEditApiImpl.d.ts +2 -1
  21. package/src/Api/Implementation/SmartEditApiImpl.js +3 -0
  22. package/src/Api/Implementation/UserInterfaceApiImpl.js +3 -21
  23. package/src/Api/InternalApi.d.ts +4 -1
  24. package/src/Api/SmartEditApi.d.ts +6 -1
  25. package/src/PredefinedConfig/CalculatedColumnState.d.ts +5 -0
  26. package/src/PredefinedConfig/Common/AdaptableForm.d.ts +3 -2
  27. package/src/PredefinedConfig/Common/AdaptableFormat.d.ts +1 -3
  28. package/src/PredefinedConfig/Common/AdaptableObject.d.ts +2 -11
  29. package/src/PredefinedConfig/Common/BaseContext.d.ts +1 -1
  30. package/src/PredefinedConfig/SystemState.d.ts +1 -2
  31. package/src/Redux/ActionsReducers/SystemRedux.d.ts +1 -1
  32. package/src/Strategy/SmartEditModule.d.ts +1 -1
  33. package/src/Strategy/SmartEditModule.js +5 -6
  34. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +9 -0
  35. package/src/Utilities/Helpers/AdaptableHelper.js +1 -0
  36. package/src/Utilities/Services/Interface/IRowEditService.d.ts +8 -0
  37. package/src/Utilities/Services/Interface/IRowEditService.js +2 -0
  38. package/src/Utilities/Services/RowEditService.d.ts +25 -0
  39. package/src/Utilities/Services/RowEditService.js +165 -0
  40. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +9 -2
  41. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +1 -1
  42. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +2 -0
  43. package/src/View/Components/Popups/FormPopups/FormPopups.js +2 -2
  44. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +4 -6
  45. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +1 -1
  46. package/src/View/SmartEdit/SmartEditPopup.d.ts +1 -1
  47. package/src/View/SmartEdit/SmartEditPopup.js +1 -2
  48. package/src/View/SmartEdit/SmartEditViewPanel.d.ts +1 -1
  49. package/src/View/SmartEdit/SmartEditViewPanel.js +1 -2
  50. package/src/agGrid/ActionColumnRenderer.d.ts +6 -1
  51. package/src/agGrid/ActionColumnRenderer.js +6 -4
  52. package/src/agGrid/Adaptable.d.ts +3 -0
  53. package/src/agGrid/Adaptable.js +121 -18
  54. package/src/agGrid/rowEditIcons.d.ts +4 -0
  55. package/src/agGrid/rowEditIcons.js +9 -0
  56. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +6 -16
  57. package/src/components/Datepicker/index.js +19 -18
  58. package/src/components/WindowModal/WindowModal.d.ts +2 -0
  59. package/src/components/WindowModal/WindowModal.js +1 -1
  60. package/src/metamodel/adaptable.metamodel.d.ts +72 -0
  61. package/src/metamodel/adaptable.metamodel.js +146 -5
  62. package/src/types.d.ts +4 -3
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
  65. package/src/AdaptableOptions/SmartEdit.d.ts +0 -34
  66. package/src/View/Components/Forms/AdaptableForm.d.ts +0 -6
  67. 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.4",
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: 1653160464222;
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 = 1653160464222;
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
@@ -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,8 +1,9 @@
1
+ import { AdaptableScope } from '../../types';
1
2
  export declare type CustomDisplayFormatter = {
2
3
  id: string;
3
4
  label?: string;
4
5
  handler: (value: any) => any;
5
- type: 'Date' | 'Number' | 'String';
6
+ scope: AdaptableScope;
6
7
  };
7
8
  export interface FormatColumnOptions {
8
9
  customDisplayFormatters?: CustomDisplayFormatter[];
@@ -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
+ }
@@ -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
+ }
@@ -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
@@ -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
  }
@@ -28,6 +28,7 @@ export declare class FormatColumnApiImpl extends ApiBase implements FormatColumn
28
28
  suspendFormatColumn(formatColumn: FormatColumn): FormatColumn;
29
29
  unSuspendFormatColumn(formatColumn: FormatColumn): FormatColumn;
30
30
  applyFormatColumnDisplayFormats(): void;
31
+ getActiveFormatColumnForColumn(column: AdaptableColumn): FormatColumn | undefined;
31
32
  getFormatColumnForColumn(column: AdaptableColumn): FormatColumn | undefined;
32
33
  getFormatColumnForColumnId(columnId: string): FormatColumn | undefined;
33
34
  getFormatColumnWithStyleForColumn(column: AdaptableColumn): FormatColumn | undefined;
@@ -106,6 +106,10 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
106
106
  applyFormatColumnDisplayFormats() {
107
107
  throw 'This API method is deprecated - it is not needed anymore.';
108
108
  }
109
+ getActiveFormatColumnForColumn(column) {
110
+ const formatColumns = this.getAllActiveFormatColumn();
111
+ return this.getAppropriateFormatColumn(formatColumns, column);
112
+ }
109
113
  getFormatColumnForColumn(column) {
110
114
  const formatColumns = this.getAllFormatColumn();
111
115
  return this.getAppropriateFormatColumn(formatColumns, column);
@@ -278,7 +282,8 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
278
282
  }
279
283
  const adaptableOptions = this.adaptable.adaptableOptions;
280
284
  const customFormattersFromOptions = (_b = adaptableOptions === null || adaptableOptions === void 0 ? void 0 : adaptableOptions.formatColumnOptions) === null || _b === void 0 ? void 0 : _b.customDisplayFormatters;
281
- const customFormatters = columnCustomFormatters.map((customFormatter) => customFormattersFromOptions === null || customFormattersFromOptions === void 0 ? void 0 : customFormattersFromOptions.find((customFormatterOption) => customFormatterOption.id === customFormatter.Id));
285
+ // formatters are applied in the order they are defined in the options
286
+ const customFormatters = customFormattersFromOptions.filter((customFormatterOption) => columnCustomFormatters.includes(customFormatterOption.id));
282
287
  return customFormatters.reduce((acc, formatter) => {
283
288
  if (formatter && formatter.handler) {
284
289
  return formatter.handler(acc);
@@ -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
  }
@@ -35,6 +35,8 @@ import { AdaptableFrameworkComponent } from '../../AdaptableOptions/AdaptableFra
35
35
  import { IMetamodelService } from '../../Utilities/Services/Interface/IMetamodelService';
36
36
  import { IModuleCollection } from '../../Strategy/Interface/IModule';
37
37
  import { AdaptableObjectTag } from '../../PredefinedConfig/Common/AdaptableObject';
38
+ import { EditLookUpPermittedValues } from '../../../types';
39
+ import { IRowEditService } from '../../Utilities/Services/Interface/IRowEditService';
38
40
  export declare class InternalApiImpl extends ApiBase implements InternalApi {
39
41
  getSystemState(): SystemState;
40
42
  getAdaptableFormFromAlertForm(alertForm: string | AlertButtonForm, context: any, defaultMessageType?: AdaptableMessageType): (Omit<AdaptableForm<AlertButtonContext>, 'buttons'> & {
@@ -97,6 +99,7 @@ export declare class InternalApiImpl extends ApiBase implements InternalApi {
97
99
  getAlertService(): IAlertService;
98
100
  getTeamSharingService(): ITeamSharingService;
99
101
  getMetamodelService(): IMetamodelService;
102
+ getRowEditService(): IRowEditService;
100
103
  getModules(): IModuleCollection;
101
104
  getModuleFriendlyName(adaptableModule: AdaptableModule): string;
102
105
  runModuleInAdaptableQL(adaptableQLModule: AdaptableQLModule): boolean;
@@ -133,4 +136,5 @@ export declare class InternalApiImpl extends ApiBase implements InternalApi {
133
136
  showSettingsPanel(module: AdaptableModule, moduleParams?: ModuleParams): void;
134
137
  getLabelForTag(adaptableObjectTag: AdaptableObjectTag): string;
135
138
  getValueForTag(adaptableObjectTag: AdaptableObjectTag): string | number;
139
+ getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
136
140
  }
@@ -288,6 +288,9 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
288
288
  getMetamodelService() {
289
289
  return this.adaptable.MetamodelService;
290
290
  }
291
+ getRowEditService() {
292
+ return this.adaptable.RowEditService;
293
+ }
291
294
  getModules() {
292
295
  return this.adaptable.adaptableModules;
293
296
  }
@@ -519,10 +522,11 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
519
522
  }
520
523
  if (typeof this.adaptable.adaptableOptions.userInterfaceOptions.objectTags === 'function') {
521
524
  // sanitize the provided tags, just to be sure that the user does NOT break the UI
522
- return (this.adaptable.adaptableOptions.userInterfaceOptions
523
- .objectTags(this.adaptable.api)
524
- // jw - not sure how to check here only for when its a object and then do check
525
- .filter((tag) => typeof tag == 'string' ? tag : tag.value != undefined && (tag === null || tag === void 0 ? void 0 : tag.label) != undefined));
525
+ return this.adaptable.adaptableOptions.userInterfaceOptions
526
+ .objectTags({
527
+ adaptableApi: this.adaptable.api,
528
+ })
529
+ .filter((tag) => typeof tag === 'string');
526
530
  }
527
531
  }
528
532
  getLayoutTags() {
@@ -545,7 +549,7 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
545
549
  };
546
550
  const customGeneratedTags = this.adaptable.adaptableOptions.layoutOptions.layoutTagOptions.autoGenerateTagsForLayouts(autoGenerateTagsForLayoutsContext);
547
551
  // sanitize the provided tags, just to be sure that the user does NOT break the UI
548
- return customGeneratedTags.filter((tag) => typeof tag == 'string' ? tag : tag.value != undefined && (tag === null || tag === void 0 ? void 0 : tag.label) != undefined);
552
+ return customGeneratedTags.filter((tag) => typeof tag === 'string');
549
553
  }
550
554
  }
551
555
  // General way to get to store from inside Adaptable...
@@ -557,10 +561,36 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
557
561
  this.showModulePopup(module, moduleParams);
558
562
  }
559
563
  getLabelForTag(adaptableObjectTag) {
560
- return typeof adaptableObjectTag == 'string' ? adaptableObjectTag : adaptableObjectTag.label;
564
+ // not very interesting right now, but useful later when tag is not only a plain string
565
+ return adaptableObjectTag;
561
566
  }
562
567
  getValueForTag(adaptableObjectTag) {
563
- return typeof adaptableObjectTag == 'string' ? adaptableObjectTag : adaptableObjectTag.value;
568
+ // not very interesting right now, but useful later when tag is not only a plain string
569
+ return adaptableObjectTag;
570
+ }
571
+ getEditLookUpValuesForColumn(editLookUpItem, column, gridCell) {
572
+ if (!editLookUpItem || !column) {
573
+ return undefined;
574
+ }
575
+ let editLookUpValues = editLookUpItem.values;
576
+ // first do the function then get hardcoded items
577
+ if (editLookUpValues != null && typeof editLookUpValues === 'function') {
578
+ const editLookUpContext = {
579
+ adaptableApi: this.adaptable.api,
580
+ column: column,
581
+ gridCell,
582
+ };
583
+ return editLookUpValues(editLookUpContext);
584
+ }
585
+ else {
586
+ let arr = editLookUpValues;
587
+ if (arr && ArrayExtensions_1.default.IsNotNullOrEmpty(arr)) {
588
+ return arr;
589
+ }
590
+ }
591
+ // if no hard-coded values or function provided then just get the distinct values for the column
592
+ // this will use the columnApi method that first looks for permitted values and then distinct values
593
+ return this.adaptable.api.columnApi.getDistinctDisplayValuesForColumn(column.columnId);
564
594
  }
565
595
  }
566
596
  exports.InternalApiImpl = InternalApiImpl;
@@ -1,7 +1,7 @@
1
1
  import { ApiBase } from './ApiBase';
2
2
  import { SmartEditApi } from '../SmartEditApi';
3
3
  import { GridCell } from '../../PredefinedConfig/Selection/GridCell';
4
- import { SmartEditOperation } from '../../AdaptableOptions/SmartEdit';
4
+ import { SmartEditCustomOperation, SmartEditOperation } from '../../AdaptableOptions/EditOptions';
5
5
  export declare class SmartEditApiImpl extends ApiBase implements SmartEditApi {
6
6
  setSmartEditOperation(mathOperation: SmartEditOperation): void;
7
7
  getSmartEditOperation(): SmartEditOperation;
@@ -9,4 +9,5 @@ export declare class SmartEditApiImpl extends ApiBase implements SmartEditApi {
9
9
  getSmartEditValue(): number;
10
10
  showSmartEditPopup(): void;
11
11
  applySmartEdit(gridCells: GridCell[]): void;
12
+ getSmartEditCustomOperations(): SmartEditCustomOperation[] | undefined;
12
13
  }
@@ -25,5 +25,8 @@ class SmartEditApiImpl extends ApiBase_1.ApiBase {
25
25
  applySmartEdit(gridCells) {
26
26
  this.dispatchAction(SmartEditRedux.SmartEditApply(gridCells));
27
27
  }
28
+ getSmartEditCustomOperations() {
29
+ return this.getEditOptions().smartEditCustomOperations;
30
+ }
28
31
  }
29
32
  exports.SmartEditApiImpl = SmartEditApiImpl;
@@ -134,25 +134,7 @@ class UserInterfaceApiImpl extends ApiBase_1.ApiBase {
134
134
  if (!editLookUpItem || !gridCell || !gridCell.column) {
135
135
  return undefined;
136
136
  }
137
- let editLookUpValues = editLookUpItem.values;
138
- // first do the function then get hardcoded items
139
- if (editLookUpValues != null && typeof editLookUpValues === 'function') {
140
- const editLookUpContext = {
141
- adaptableApi: this.adaptable.api,
142
- column: gridCell.column,
143
- gridCell: gridCell,
144
- };
145
- return editLookUpValues(editLookUpContext);
146
- }
147
- else {
148
- let arr = editLookUpValues;
149
- if (arr && ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(arr)) {
150
- return arr;
151
- }
152
- }
153
- // if no hard-coded values or function provided then just get the distinct values for the column
154
- // this will use the columnapi method that first looks for permitted values and then distinct values
155
- return this.adaptable.api.columnApi.getDistinctDisplayValuesForColumn(gridCell.column.columnId);
137
+ return this.adaptable.api.internalApi.getEditLookUpValuesForColumn(editLookUpItem, gridCell.column, gridCell);
156
138
  }
157
139
  addColumnMenuItem(userMenuItem) {
158
140
  var _a;
@@ -173,9 +155,9 @@ class UserInterfaceApiImpl extends ApiBase_1.ApiBase {
173
155
  return (_a = this.getUserInterfaceOptions().actionColumns) !== null && _a !== void 0 ? _a : [];
174
156
  }
175
157
  getAdaptableObjectTags() {
176
- let objectTags = this.getUserInterfaceOptions().objectTags;
158
+ const objectTags = this.getUserInterfaceOptions().objectTags;
177
159
  if (objectTags != null && typeof objectTags === 'function') {
178
- return objectTags(this.getAdaptableApi());
160
+ return objectTags({ adaptableApi: this.adaptable.api });
179
161
  }
180
162
  else {
181
163
  let arr = objectTags;
@@ -17,7 +17,7 @@ import { AdaptableOptions } from '../AdaptableOptions/AdaptableOptions';
17
17
  import { Layout } from '../PredefinedConfig/LayoutState';
18
18
  import { AdaptableAlert, AdaptableCellChangedAlert, AdaptableRowChangedAlert } from '../PredefinedConfig/Common/AdaptableAlert';
19
19
  import { IDataService } from '../Utilities/Services/Interface/IDataService';
20
- import { AdaptableMessageType, AlertDefinition, BaseContext, CellDataChangedInfo, LayoutAssociatedObject, SystemStatusMessageInfo } from '../types';
20
+ import { AdaptableMessageType, AlertDefinition, BaseContext, CellDataChangedInfo, EditLookUpPermittedValues, LayoutAssociatedObject, SystemStatusMessageInfo } from '../types';
21
21
  import { IEntitlementService } from '../Utilities/Services/Interface/IEntitlementService';
22
22
  import { AdaptableFlashingCell } from '../PredefinedConfig/Common/AdaptableFlashingCell';
23
23
  import { IQueryLanguageService } from '../Utilities/Services/Interface/IQueryLanguageService';
@@ -34,6 +34,7 @@ import { IMetamodelService } from '../Utilities/Services/Interface/IMetamodelSer
34
34
  import { RowNode } from '@ag-grid-community/all-modules';
35
35
  import { IModuleCollection } from '../Strategy/Interface/IModule';
36
36
  import { AdaptableObjectTag } from '../PredefinedConfig/Common/AdaptableObject';
37
+ import { IRowEditService } from '../Utilities/Services/Interface/IRowEditService';
37
38
  /**
38
39
  * This set of api methods is designed for **internal use of Adaptable** only.
39
40
  *
@@ -101,6 +102,7 @@ export interface InternalApi {
101
102
  getAlertService(): IAlertService;
102
103
  getTeamSharingService(): ITeamSharingService;
103
104
  getMetamodelService(): IMetamodelService;
105
+ getRowEditService(): IRowEditService;
104
106
  getModules(): IModuleCollection;
105
107
  getModuleFriendlyName(adaptableModule: AdaptableModule): string;
106
108
  runModuleInAdaptableQL(adaptableQLModule: AdaptableQLModule): boolean;
@@ -133,4 +135,5 @@ export interface InternalApi {
133
135
  showSettingsPanel(module: AdaptableModule, moduleParams?: ModuleParams): void;
134
136
  getLabelForTag(adaptableObjectTag: AdaptableObjectTag): string;
135
137
  getValueForTag(adaptableObjectTag: AdaptableObjectTag): string | number;
138
+ getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
136
139
  }
@@ -1,5 +1,6 @@
1
- import { SmartEditOperation } from '../AdaptableOptions/SmartEdit';
1
+ import { SmartEditOperation } from '../AdaptableOptions/EditOptions';
2
2
  import { GridCell } from '../PredefinedConfig/Selection/GridCell';
3
+ import { SmartEditCustomOperation } from '../types';
3
4
  /**
4
5
  * Provides run-time access to the Smart Edit Module
5
6
  **/
@@ -31,4 +32,8 @@ export interface SmartEditApi {
31
32
  * @param gridCells Cells to apply the Smart Edit
32
33
  */
33
34
  applySmartEdit(gridCells: GridCell[]): void;
35
+ /**
36
+ * Retrieves an Smart Edit Custom Operations (provided in Edit Options)
37
+ */
38
+ getSmartEditCustomOperations(): SmartEditCustomOperation[] | undefined;
34
39
  }
@@ -46,6 +46,11 @@ export interface CalculatedColumnSettings extends SpecialColumnSettings {
46
46
  * @defaultValue false
47
47
  */
48
48
  ShowToolTip?: boolean;
49
+ /**
50
+ * If true, the Calculated Column Expression will NOT be evaluated and the value is loaded from the row data property with the same name as the ColumnId
51
+ * @defaultValue false
52
+ */
53
+ ExternallyEvaluatedExpression?: boolean;
49
54
  }
50
55
  /**
51
56
  * Calculated Column Query which may be a Scalar or an AggregatedScalar Expression
@@ -36,13 +36,13 @@ export interface AdaptableFormField {
36
36
  */
37
37
  name: string;
38
38
  /**
39
- * Label to display in in the Field
39
+ * Label to display in the Field
40
40
  */
41
41
  label: string;
42
42
  /**
43
43
  * Field Type: text, date, number, checkbox, select, textOutput
44
44
  */
45
- fieldType: 'text' | 'select' | 'date' | 'number' | 'checkbox' | 'textOutput';
45
+ fieldType: AdaptableFormFieldType;
46
46
  /**
47
47
  * Field Default Value - can be of type string, boolean, number
48
48
  */
@@ -55,4 +55,5 @@ export interface AdaptableFormField {
55
55
  label: string;
56
56
  }[];
57
57
  }
58
+ export declare type AdaptableFormFieldType = 'text' | 'select' | 'date' | 'number' | 'checkbox' | 'textOutput';
58
59
  export declare function getDefaultAdaptableFormData<T extends BaseContext = BaseContext>(formDef?: AdaptableForm<T>): Record<string, any>;
@@ -12,9 +12,7 @@ export declare type AdaptableFormat = {
12
12
  Options: StringFormatterOptions;
13
13
  };
14
14
  export interface BaseFormatterOptions {
15
- CustomDisplayFormats?: {
16
- Id: string;
17
- }[];
15
+ CustomDisplayFormats?: string[];
18
16
  }
19
17
  /**
20
18
  * Formatter Options for Numeric Columns