@adaptabletools/adaptable 11.1.3 → 11.1.4

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 (51) hide show
  1. package/bundle.cjs.js +116 -116
  2. package/package.json +3 -3
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -1
  6. package/src/AdaptableOptions/AdaptableOptions.d.ts +49 -49
  7. package/src/AdaptableOptions/DashboardOptions.d.ts +1 -1
  8. package/src/AdaptableOptions/EditOptions.d.ts +4 -0
  9. package/src/AdaptableOptions/SmartEdit.d.ts +34 -0
  10. package/src/AdaptableOptions/SmartEdit.js +2 -0
  11. package/src/Api/Implementation/ColumnApiImpl.js +1 -1
  12. package/src/Api/Implementation/FilterApiImpl.js +8 -2
  13. package/src/Api/Implementation/GridApiImpl.d.ts +3 -3
  14. package/src/Api/Implementation/GridApiImpl.js +6 -8
  15. package/src/Api/Implementation/SmartEditApiImpl.d.ts +3 -2
  16. package/src/Api/SmartEditApi.d.ts +3 -2
  17. package/src/PredefinedConfig/ExportState.d.ts +0 -5
  18. package/src/PredefinedConfig/PopupState.d.ts +2 -1
  19. package/src/PredefinedConfig/SystemState.d.ts +2 -5
  20. package/src/Redux/ActionsReducers/PopupRedux.d.ts +22 -3
  21. package/src/Redux/ActionsReducers/PopupRedux.js +42 -8
  22. package/src/Redux/ActionsReducers/SystemRedux.d.ts +5 -23
  23. package/src/Redux/ActionsReducers/SystemRedux.js +3 -32
  24. package/src/Strategy/AlertModule.js +4 -1
  25. package/src/Strategy/ExportModule.js +14 -4
  26. package/src/Strategy/SmartEditModule.d.ts +2 -2
  27. package/src/Strategy/SmartEditModule.js +24 -13
  28. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +4 -2
  29. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +0 -3
  30. package/src/Utilities/Interface/MessagePopups.d.ts +12 -0
  31. package/src/View/AdaptableView.js +2 -2
  32. package/src/View/Components/Popups/FormPopups/FormPopups.d.ts +10 -0
  33. package/src/View/Components/Popups/FormPopups/FormPopups.js +37 -0
  34. package/src/View/Components/Popups/WindowPopups/WindowPopups.js +1 -1
  35. package/src/View/DataSource/DataSourceViewPanel.d.ts +3 -3
  36. package/src/View/DataSource/DataSourceViewPanel.js +15 -13
  37. package/src/View/Export/ExportViewPanel.d.ts +1 -3
  38. package/src/View/Export/ExportViewPanel.js +1 -17
  39. package/src/View/SmartEdit/SmartEditPopup.d.ts +3 -3
  40. package/src/View/SmartEdit/SmartEditPopup.js +15 -3
  41. package/src/View/SmartEdit/SmartEditViewPanel.d.ts +3 -4
  42. package/src/View/SmartEdit/SmartEditViewPanel.js +15 -6
  43. package/src/agGrid/Adaptable.d.ts +4 -4
  44. package/src/agGrid/Adaptable.js +25 -15
  45. package/src/metamodel/adaptable.metamodel.js +1 -1
  46. package/version.d.ts +1 -1
  47. package/version.js +1 -1
  48. package/src/View/Export/ExportCustomDestinationDialog.d.ts +0 -11
  49. package/src/View/Export/ExportCustomDestinationDialog.js +0 -47
  50. package/src/View/Export/ExportCustomDestinationFormPopups.d.ts +0 -5
  51. package/src/View/Export/ExportCustomDestinationFormPopups.js +0 -15
@@ -27,6 +27,7 @@ class SmartEditPopupComponent extends React.Component {
27
27
  this.props.onSmartEditCheckSelectedCells();
28
28
  }
29
29
  render() {
30
+ var _a, _b, _c;
30
31
  let col;
31
32
  if (this.props.PreviewInfo) {
32
33
  col = this.props.PreviewInfo.column;
@@ -34,7 +35,7 @@ class SmartEditPopupComponent extends React.Component {
34
35
  let globalValidationMessage = PreviewHelper_1.PreviewHelper.GetValidationMessage(this.props.PreviewInfo, `${this.props.SmartEditValue}`);
35
36
  let showPanel = this.props.PreviewInfo && StringExtensions_1.StringExtensions.IsNotNullOrEmpty(`${this.props.SmartEditValue}`);
36
37
  let previewPanel = showPanel ? (React.createElement(PreviewResultsPanel_1.PreviewResultsPanel, { style: { flex: '1 1 100%', overflow: 'initial', height: '100%' }, previewInfo: this.props.PreviewInfo, api: this.props.api, selectedColumn: col, showPanel: showPanel, showHeader: true })) : null;
37
- let operationMenuItems = EnumExtensions_1.EnumExtensions.getNames(Enums_1.MathOperation).map((mathOperation, index) => {
38
+ const operationMenuItems = EnumExtensions_1.EnumExtensions.getNames(Enums_1.MathOperation).map((mathOperation, index) => {
38
39
  return {
39
40
  label: mathOperation,
40
41
  onClick: () => {
@@ -42,6 +43,15 @@ class SmartEditPopupComponent extends React.Component {
42
43
  },
43
44
  };
44
45
  });
46
+ const customOperations = (_c = (_b = (_a = this.props.api.internalApi.getAdaptableOptions()) === null || _a === void 0 ? void 0 : _a.editOptions) === null || _b === void 0 ? void 0 : _b.smartEdit) === null || _c === void 0 ? void 0 : _c.customOperations;
47
+ if (customOperations === null || customOperations === void 0 ? void 0 : customOperations.length) {
48
+ operationMenuItems.push(...customOperations.map((operation) => {
49
+ return {
50
+ onClick: () => this.props.onSmartEditOperationChange(operation),
51
+ label: operation.Name,
52
+ };
53
+ }));
54
+ }
45
55
  return (React.createElement(PanelWithImage_1.PanelWithImage, { flex: 1, style: { height: '100%' }, variant: "primary", bodyProps: {
46
56
  style: { display: 'flex', flexFlow: 'column' },
47
57
  }, bodyScroll: true, glyphicon: this.props.moduleInfo.Glyph, header: this.props.moduleInfo.FriendlyName, infoLink: this.props.moduleInfo.HelpPage, infoLinkDisabled: !this.props.api.internalApi.isDocumentationLinksDisplayed(), onKeyDown: (e) => {
@@ -50,7 +60,9 @@ class SmartEditPopupComponent extends React.Component {
50
60
  }
51
61
  } },
52
62
  React.createElement(rebass_1.Flex, { flexDirection: "row", padding: 2, "data-name": "smart-edit-operation" },
53
- React.createElement(DropdownButton_1.default, { items: operationMenuItems, columns: ['label'], onMouseDown: preventDefault }, Enums_1.MathOperation[this.props.MathOperation]),
63
+ React.createElement(DropdownButton_1.default, { items: operationMenuItems, columns: ['label'], onMouseDown: preventDefault }, typeof this.props.SmartEditOperation === 'object'
64
+ ? this.props.SmartEditOperation.Name
65
+ : this.props.SmartEditOperation),
54
66
  React.createElement(Input_1.default, { value: this.props.SmartEditValue.toString(), marginLeft: 2, marginRight: 2, type: "number", placeholder: "Enter a Number", onChange: (e) => this.onSmartEditValueChange(e) }),
55
67
  React.createElement(SimpleButton_1.default, { tone: this.getButtonStyle(), variant: "raised", disabled: StringExtensions_1.StringExtensions.IsNullOrEmpty(`${this.props.SmartEditValue}`) ||
56
68
  (this.props.PreviewInfo &&
@@ -87,7 +99,7 @@ class SmartEditPopupComponent extends React.Component {
87
99
  function mapStateToProps(state, ownProps) {
88
100
  return {
89
101
  SmartEditValue: state.System.SmartEditValue,
90
- MathOperation: state.System.SmartEditOperation,
102
+ SmartEditOperation: state.System.SmartEditOperation,
91
103
  PreviewInfo: state.System.SmartEditPreviewInfo,
92
104
  };
93
105
  }
@@ -2,16 +2,16 @@ import { ViewPanelProps } from '../Components/SharedProps/ViewPanelProps';
2
2
  import * as SystemRedux from '../../Redux/ActionsReducers/SystemRedux';
3
3
  import * as SmartEditRedux from '../../Redux/ActionsReducers/SmartEditRedux';
4
4
  import { PreviewInfo } from '../../Utilities/Interface/Preview';
5
- import { MathOperation } from '../../PredefinedConfig/Common/Enums';
6
5
  import * as React from 'react';
6
+ import { SmartEditOperation } from '../../AdaptableOptions/SmartEdit';
7
7
  export interface SmartEditViewPanelComponentProps extends ViewPanelProps {
8
8
  SmartEditValue: number | undefined;
9
- MathOperation: 'Add' | 'Subtract' | 'Multiply' | 'Divide' | undefined;
9
+ SmartEditOperation: SmartEditOperation | undefined;
10
10
  IsValidSelection: boolean;
11
11
  PreviewInfo: PreviewInfo;
12
12
  InPivotMode: Boolean;
13
13
  onSmartEditValueChange: (value: number) => SystemRedux.SmartEditChangeValueAction;
14
- onSmartEditOperationChange: (MathOperation: MathOperation) => SystemRedux.SmartEditChangeOperationAction;
14
+ onSmartEditOperationChange: (MathOperation: SmartEditOperation) => SystemRedux.SmartEditChangeOperationAction;
15
15
  onSmartEditCheckSelectedCells: () => SystemRedux.SmartEditCheckCellSelectionAction;
16
16
  onRunSmartEdit: () => SmartEditRedux.SmartEditRunAction;
17
17
  }
@@ -28,7 +28,6 @@ declare class SmartEditViewPanelComponent extends React.Component<SmartEditViewP
28
28
  private onSmartEditValueChange;
29
29
  private getStatusColour;
30
30
  private onApplyClick;
31
- private onchangeMathOperation;
32
31
  onApplySmartEdit(): any;
33
32
  }
34
33
  export declare let SmartEditViewPanelControl: import("react-redux").ConnectedComponent<typeof SmartEditViewPanelComponent, any>;
@@ -39,17 +39,27 @@ class SmartEditViewPanelComponent extends React.Component {
39
39
  (_a = this.cleanupEvent) === null || _a === void 0 ? void 0 : _a.call(this);
40
40
  }
41
41
  render() {
42
+ var _a, _b, _c;
42
43
  let statusColour = this.getStatusColour();
43
44
  let selectedColumn = StringExtensions_1.StringExtensions.IsNotNullOrEmpty(this.state.SelectedColumnId)
44
45
  ? this.props.api.columnApi.getColumnFromId(this.state.SelectedColumnId)
45
46
  : null;
46
47
  let previewPanel = (React.createElement(PreviewResultsPanel_1.PreviewResultsPanel, { previewInfo: this.props.PreviewInfo, api: this.props.api, selectedColumn: selectedColumn, showPanel: true, showHeader: false }));
47
- let operationMenuItems = EnumExtensions_1.EnumExtensions.getNames(Enums_1.MathOperation).map((mathOperation, index) => {
48
+ const operationMenuItems = EnumExtensions_1.EnumExtensions.getNames(Enums_1.MathOperation).map((mathOperation, index) => {
48
49
  return {
49
50
  onClick: () => this.props.onSmartEditOperationChange(mathOperation),
50
51
  label: mathOperation,
51
52
  };
52
53
  });
54
+ const customOperations = (_c = (_b = (_a = this.props.api.internalApi.getAdaptableOptions()) === null || _a === void 0 ? void 0 : _a.editOptions) === null || _b === void 0 ? void 0 : _b.smartEdit) === null || _c === void 0 ? void 0 : _c.customOperations;
55
+ if (customOperations === null || customOperations === void 0 ? void 0 : customOperations.length) {
56
+ operationMenuItems.push(...customOperations.map((operation) => {
57
+ return {
58
+ onClick: () => this.props.onSmartEditOperationChange(operation),
59
+ label: operation.Name,
60
+ };
61
+ }));
62
+ }
53
63
  const applyButtonStyle = {
54
64
  color: statusColour,
55
65
  fill: 'currentColor',
@@ -60,7 +70,9 @@ class SmartEditViewPanelComponent extends React.Component {
60
70
  const elementType = this.props.viewType === 'Toolbar' ? 'DashboardToolbar' : 'ToolPanel';
61
71
  return (React.createElement(rebass_1.Flex, { flexDirection: "row", className: `ab-${elementType}__SmartEdit__wrap`, flexWrap: this.props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
62
72
  React.createElement(rebass_1.Flex, null,
63
- React.createElement(DropdownButton_1.default, { className: `ab-${elementType}__SmartEdit__select`, marginRight: 2, items: operationMenuItems, style: { fontSize: 'small' }, columns: ['label'], disabled: shouldDisable, variant: "outlined" }, this.props.MathOperation),
73
+ React.createElement(DropdownButton_1.default, { className: `ab-${elementType}__SmartEdit__select`, marginRight: 2, items: operationMenuItems, style: { fontSize: 'small' }, columns: ['label'], disabled: shouldDisable, variant: "outlined" }, typeof this.props.SmartEditOperation === 'object'
74
+ ? this.props.SmartEditOperation.Name
75
+ : this.props.SmartEditOperation),
64
76
  React.createElement(Input_1.default, { style: {
65
77
  width: '5rem',
66
78
  }, className: `ab-${elementType}__SmartEdit__select-value`, value: this.props.SmartEditValue.toString(), type: "number", placeholder: "Enter a Number", step: "any", onChange: (e) => this.onSmartEditValueChange(e), disabled: shouldDisable, marginRight: 2 })),
@@ -94,9 +106,6 @@ class SmartEditViewPanelComponent extends React.Component {
94
106
  onApplyClick() {
95
107
  this.onApplySmartEdit();
96
108
  }
97
- onchangeMathOperation(mathOperation) {
98
- this.props.onSmartEditOperationChange(mathOperation);
99
- }
100
109
  onApplySmartEdit() {
101
110
  this.props.onRunSmartEdit();
102
111
  }
@@ -104,7 +113,7 @@ class SmartEditViewPanelComponent extends React.Component {
104
113
  function mapStateToProps(state, ownProps) {
105
114
  return {
106
115
  SmartEditValue: state.System.SmartEditValue,
107
- MathOperation: state.System.SmartEditOperation,
116
+ SmartEditOperation: state.System.SmartEditOperation,
108
117
  IsValidSelection: state.System.IsValidSmartEditSelection,
109
118
  PreviewInfo: state.System.SmartEditPreviewInfo,
110
119
  InPivotMode: state.Grid.IsGridInPivotMode,
@@ -166,8 +166,8 @@ export declare class Adaptable implements IAdaptable {
166
166
  [key: string]: boolean;
167
167
  }): GridCell[];
168
168
  private addDistinctColumnValue;
169
- private isInternallyRenderedColumn;
170
- getDisplayValue(id: any, columnId: string): string | undefined;
169
+ private isCustomRenderedColumn;
170
+ getDisplayValue(primaryKey: any, columnId: string): string | undefined;
171
171
  getGridCellFromRowNode(rowNode: RowNode, columnId: string): GridCell | undefined;
172
172
  getDisplayValueFromRowNode(rowNode: RowNode, columnId: string): string | undefined;
173
173
  getDisplayValueFromRawValue(columnId: string, rawValue: any): string | undefined;
@@ -314,7 +314,7 @@ export declare class Adaptable implements IAdaptable {
314
314
  getGridData(): any[];
315
315
  getFilteredData(): any[];
316
316
  loadDataSource(dataSource: any[]): void;
317
- updateRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<RowNode[] | null | undefined>;
317
+ updateRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<RowNode[]>;
318
318
  addRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<RowNode[]>;
319
319
  deleteRows(dataRows: any[], dataUpdateConfig?: DataUpdateConfig): Promise<RowNode[]>;
320
320
  getFirstGroupedColumn(): AdaptableColumn | undefined;
@@ -330,7 +330,7 @@ export declare class Adaptable implements IAdaptable {
330
330
  showQuickFilter(): void;
331
331
  hideQuickFilter(): void;
332
332
  getAgGridColumnType(columnId: string): string | string[];
333
- getActiveColumnComparator(columnId: string, customSort?: CustomSort, customSortComparer?: ColumnValuesComparer): ((valueA: any, valueB: any, nodeA?: RowNode, nodeB?: RowNode, isInverted?: boolean) => number) | undefined;
333
+ getActiveColumnComparator(columnId: string, customSort?: CustomSort, customSortComparer?: ColumnValuesComparer): (valueA: any, valueB: any, nodeA?: RowNode, nodeB?: RowNode, isInverted?: boolean) => number | undefined;
334
334
  getAgGridLightThemeName(): string;
335
335
  getAgGridCurrentThemeName(): string;
336
336
  applyAdaptableTheme(theme: AdaptableTheme | string): void;
@@ -57,6 +57,7 @@ const MetamodelService_1 = require("../Utilities/Services/MetamodelService");
57
57
  const DocumentationLinkConstants_1 = require("../Utilities/Constants/DocumentationLinkConstants");
58
58
  const ModuleConstants_1 = require("../Utilities/Constants/ModuleConstants");
59
59
  const CheckboxRenderer_1 = require("./CheckboxRenderer");
60
+ const DateHelper_1 = require("../Utilities/Helpers/DateHelper");
60
61
  const tinycolor = require('tinycolor2');
61
62
  all_modules_1.ModuleRegistry.registerModules(all_modules_1.AllCommunityModules);
62
63
  const GROUP_PATH_SEPARATOR = '/';
@@ -1691,27 +1692,27 @@ class Adaptable {
1691
1692
  return undefined;
1692
1693
  }
1693
1694
  }
1694
- isInternallyRenderedColumn(column) {
1695
+ isCustomRenderedColumn(column) {
1695
1696
  if (!column || column.isGrouped) {
1696
- return true;
1697
+ return false;
1697
1698
  }
1698
- // we need to return false if the column has a cell rendeerer i think...
1699
+ // we need to return false if the column has a cell renderer i think...
1699
1700
  const colDef = this.gridOptions.api.getColumnDef(column.columnId);
1700
1701
  if (colDef && colDef.cellRenderer != null) {
1701
- return false;
1702
+ return true;
1702
1703
  }
1703
1704
  if (this.api.columnApi.isFormatNumericStyleColumn(column)) {
1704
- return false;
1705
+ return true;
1705
1706
  }
1706
1707
  if (this.api.columnApi.isBooleanColumn(column)) {
1707
- return false;
1708
+ return true;
1708
1709
  }
1709
- return true;
1710
+ return false;
1710
1711
  }
1711
- getDisplayValue(id, columnId) {
1712
+ getDisplayValue(primaryKey, columnId) {
1712
1713
  let returnValue;
1713
1714
  if (this.useRowNodeLookUp) {
1714
- const rowNode = this.gridOptions.api.getRowNode(id);
1715
+ const rowNode = this.getRowNodeForPrimaryKey(primaryKey);
1715
1716
  return this.getDisplayValueFromRowNode(rowNode, columnId);
1716
1717
  }
1717
1718
  else {
@@ -1719,7 +1720,7 @@ class Adaptable {
1719
1720
  this.gridOptions.api.getModel().forEachNode((rowNode) => {
1720
1721
  if (!foundRow) {
1721
1722
  const primaryKeyValue = this.getPrimaryKeyValueFromRowNode(rowNode);
1722
- if (id == primaryKeyValue) {
1723
+ if (primaryKey == primaryKeyValue) {
1723
1724
  returnValue = this.getDisplayValueFromRowNode(rowNode, columnId);
1724
1725
  }
1725
1726
  foundRow = true;
@@ -1802,10 +1803,17 @@ class Adaptable {
1802
1803
  return formatterFn(params);
1803
1804
  }
1804
1805
  getNormalisedValueFromRowValue(rawValue, displayValue, column) {
1806
+ // not sure if the current implementation is correct:
1807
+ // the returned "normalised value" is actually the displayed value in almost all cases?!
1808
+ // ex. how to read the following: if 'rawValue' is NOT a number, return normalised version of rawValue, but if rawValue IS a number, return displayedValue of it (which will almost certainly will NOT be a number)
1809
+ // if (dataType === 'Number') {
1810
+ // return typeof rawValue !== 'number' ? Number(rawValue) : returnValue;
1811
+ // }
1812
+ // anyway, it seems to work so far (as of v11.1.3), so I'm leaving it for now :)
1805
1813
  if (!column) {
1806
1814
  return rawValue;
1807
1815
  }
1808
- const returnValue = this.isInternallyRenderedColumn(column) ? displayValue : rawValue;
1816
+ const returnValue = this.isCustomRenderedColumn(column) ? rawValue : displayValue;
1809
1817
  if (returnValue === undefined || returnValue === null) {
1810
1818
  return rawValue;
1811
1819
  }
@@ -1819,13 +1827,15 @@ class Adaptable {
1819
1827
  if (dataType === 'Boolean') {
1820
1828
  return typeof rawValue !== 'boolean' ? Boolean(rawValue) : returnValue;
1821
1829
  }
1822
- // Do not normalize dates to Date type
1823
- // - breaks when rendering in filter-form
1824
- // - breaks quick-search; the Date is transformed to string;
1825
- // -- an incorrect comparison is made (new Date().toString).incudes('query)
1830
+ if (dataType === 'Date') {
1831
+ return rawValue instanceof Date ? rawValue : DateHelper_1.parseDateValue(rawValue);
1832
+ }
1826
1833
  return returnValue;
1827
1834
  }
1828
1835
  getRawValueFromRowNode(rowNode, columnId) {
1836
+ if (rowNode == null) {
1837
+ return undefined;
1838
+ }
1829
1839
  return this.gridOptions.api.getValue(columnId, rowNode);
1830
1840
  }
1831
1841
  getDataRowFromRowNode(rowNode) {
@@ -4287,7 +4287,7 @@ exports.ADAPTABLE_METAMODEL = {
4287
4287
  {
4288
4288
  "name": "buttonsLocation",
4289
4289
  "kind": "unknown",
4290
- "description": "Position in the Dashboard to show the Module and Custom Buttons",
4290
+ "description": "Where in Dashboard to display Module and Custom Buttons",
4291
4291
  "uiLabel": "Buttons Location",
4292
4292
  "isOptional": true,
4293
4293
  "defaultValue": "&#39;right&#39;"
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "11.1.3";
1
+ declare const _default: "11.1.4";
2
2
  export default _default;
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '11.1.3'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
3
+ exports.default = '11.1.4'; // PLEASE DONT UPDATE THIS!!! - will be updated at build time with the correct version
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { CustomDestination } from '../../AdaptableOptions/ExportOptions';
3
- import { Report } from '../../PredefinedConfig/ExportState';
4
- interface ExportCustomDestinationDialogProps {
5
- report: Report;
6
- customDestination: CustomDestination;
7
- isOpen: boolean;
8
- onDismiss: () => void;
9
- }
10
- export declare function ExportCustomDestinationDialog({ report, customDestination, isOpen, onDismiss, }: ExportCustomDestinationDialogProps): JSX.Element;
11
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportCustomDestinationDialog = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const rebass_1 = require("rebass");
7
- const AdaptableForm_1 = require("../../PredefinedConfig/Common/AdaptableForm");
8
- const Dialog_1 = tslib_1.__importDefault(require("../../components/Dialog"));
9
- const AdaptableFormComponent_1 = require("../../components/AdaptableFormComponent");
10
- const AdaptableContext_1 = require("../AdaptableContext");
11
- function ExportCustomDestinationDialog({ report, customDestination,
12
- //onSubmit,
13
- isOpen, onDismiss, }) {
14
- const [data, setData] = React.useState({});
15
- const adaptable = AdaptableContext_1.useAdaptable();
16
- const context = React.useMemo(() => {
17
- return {
18
- adaptableApi: adaptable.api,
19
- report,
20
- reportData: undefined,
21
- customDestination,
22
- formData: data,
23
- };
24
- }, [data]);
25
- const formDef = customDestination === null || customDestination === void 0 ? void 0 : customDestination.form;
26
- React.useEffect(() => {
27
- if (formDef) {
28
- setData(Object.assign(Object.assign({}, AdaptableForm_1.getDefaultAdaptableFormData(formDef)), data));
29
- }
30
- }, [formDef]);
31
- return (React.createElement(Dialog_1.default, { isOpen: isOpen, showCloseButton: false, style: { minHeight: 'auto', minWidth: 400 }, onDismiss: () => {
32
- onDismiss();
33
- } }, isOpen && (React.createElement(rebass_1.Box, { padding: 4 },
34
- React.createElement(AdaptableFormComponent_1.AdaptableFormComponent, { formDef: formDef, data: data, context: context, onChange: setData, api: adaptable.api, displayTitle: true, onButtonClick: (button) => {
35
- onDismiss();
36
- // we want to give the current popup time to close
37
- // and we reopen with a delay in case this button action causes another popup
38
- setTimeout(() => {
39
- var _a;
40
- context.reportData = adaptable.api.internalApi
41
- .getReportService()
42
- .getReportData(report);
43
- (_a = button.onClick) === null || _a === void 0 ? void 0 : _a.call(button, button, context);
44
- }, 20);
45
- } })))));
46
- }
47
- exports.ExportCustomDestinationDialog = ExportCustomDestinationDialog;
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- import { AdaptableApi } from '../../types';
3
- export declare const ExportCustomDestinationFormPopups: React.FunctionComponent<{
4
- api: AdaptableApi;
5
- }>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportCustomDestinationFormPopups = void 0;
4
- const tslib_1 = require("tslib");
5
- const React = tslib_1.__importStar(require("react"));
6
- const react_redux_1 = require("react-redux");
7
- const SystemRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/SystemRedux"));
8
- const ExportCustomDestinationDialog_1 = require("./ExportCustomDestinationDialog");
9
- exports.ExportCustomDestinationFormPopups = (props) => {
10
- var _a;
11
- const dispatch = react_redux_1.useDispatch();
12
- const customDestinationPopups = react_redux_1.useSelector(SystemRedux.getSystemExportCustomDestinationPopups);
13
- const handleDismiss = React.useCallback((config) => dispatch(SystemRedux.SystemExportCustomDestinationPopupHide(config)), []);
14
- return (React.createElement(React.Fragment, null, (_a = (customDestinationPopups || [])) === null || _a === void 0 ? void 0 : _a.map((customDestinationPopup) => customDestinationPopup && (React.createElement(ExportCustomDestinationDialog_1.ExportCustomDestinationDialog, { isOpen: true, key: `${customDestinationPopup.ReportName}-${customDestinationPopup.ExportDestination.name}`, report: props.api.exportApi.getReportByName(customDestinationPopup.ReportName), customDestination: customDestinationPopup.ExportDestination, onDismiss: () => handleDismiss(customDestinationPopup) })))));
15
- };