@adaptabletools/adaptable 12.0.1 → 12.0.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 (91) hide show
  1. package/bundle.cjs.js +96 -96
  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 +4 -2
  6. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +1 -1
  7. package/src/AdaptableOptions/EditOptions.d.ts +6 -9
  8. package/src/AdaptableOptions/ExportOptions.d.ts +15 -0
  9. package/src/AdaptableOptions/Glue42PluginOptions.d.ts +1 -1
  10. package/src/AdaptableOptions/IPushPullPluginOptions.d.ts +1 -3
  11. package/src/AdaptableOptions/StateOptions.d.ts +9 -23
  12. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +34 -1
  13. package/src/Api/ChartingApi.d.ts +19 -2
  14. package/src/Api/Events/SearchChanged.d.ts +1 -1
  15. package/src/Api/FinanceApi.d.ts +8 -8
  16. package/src/Api/FormatColumnApi.d.ts +11 -6
  17. package/src/Api/GridApi.d.ts +1 -1
  18. package/src/Api/Implementation/ChartingApiImpl.d.ts +6 -0
  19. package/src/Api/Implementation/ChartingApiImpl.js +17 -0
  20. package/src/Api/Implementation/ConfigApiImpl.d.ts +2 -0
  21. package/src/Api/Implementation/ConfigApiImpl.js +11 -0
  22. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +4 -3
  23. package/src/Api/Implementation/FormatColumnApiImpl.js +36 -12
  24. package/src/Api/Implementation/GridApiImpl.d.ts +1 -1
  25. package/src/Api/Implementation/GridApiImpl.js +2 -2
  26. package/src/Api/Implementation/InternalApiImpl.js +1 -2
  27. package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -0
  28. package/src/Api/Implementation/LayoutApiImpl.js +7 -1
  29. package/src/Api/LayoutApi.d.ts +5 -0
  30. package/src/Api/StatusBarApi.d.ts +3 -0
  31. package/src/PredefinedConfig/AdaptableState.d.ts +2 -0
  32. package/src/PredefinedConfig/CalculatedColumnState.d.ts +0 -5
  33. package/src/PredefinedConfig/ChartingState.d.ts +20 -0
  34. package/src/PredefinedConfig/ChartingState.js +2 -0
  35. package/src/PredefinedConfig/Common/CellSummary.d.ts +3 -0
  36. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +9 -0
  37. package/src/PredefinedConfig/Common/FDC3Context.d.ts +12 -3
  38. package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +1 -2
  39. package/src/PredefinedConfig/Common/FilterActionOnDataChange.js +1 -2
  40. package/src/PredefinedConfig/Common/Types.d.ts +1 -1
  41. package/src/PredefinedConfig/ExportState.d.ts +6 -0
  42. package/src/PredefinedConfig/FormatColumnState.d.ts +4 -1
  43. package/src/PredefinedConfig/IPushPullState.d.ts +16 -5
  44. package/src/PredefinedConfig/LayoutState.d.ts +1 -1
  45. package/src/PredefinedConfig/PredefinedConfig.d.ts +5 -0
  46. package/src/PredefinedConfig/ScheduleState.d.ts +1 -1
  47. package/src/PredefinedConfig/ShortcutState.d.ts +1 -1
  48. package/src/PredefinedConfig/TeamSharingState.d.ts +6 -0
  49. package/src/Redux/ActionsReducers/ChartingRedux.d.ts +23 -0
  50. package/src/Redux/ActionsReducers/ChartingRedux.js +38 -0
  51. package/src/Redux/ActionsReducers/GridRedux.d.ts +30 -1
  52. package/src/Redux/ActionsReducers/GridRedux.js +105 -2
  53. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +10 -11
  54. package/src/Redux/ActionsReducers/LayoutRedux.js +10 -10
  55. package/src/Redux/Store/AdaptableStore.js +45 -8
  56. package/src/Strategy/AlertModule.js +3 -3
  57. package/src/Strategy/ChartingModule.js +1 -1
  58. package/src/Strategy/FlashingCellModule.js +3 -3
  59. package/src/Strategy/FormatColumnModule.js +1 -1
  60. package/src/Strategy/LayoutModule.js +2 -1
  61. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  62. package/src/Utilities/Constants/GeneralConstants.js +3 -2
  63. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +3 -0
  64. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -0
  65. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +3 -0
  66. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +23 -1
  67. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +3 -0
  68. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +3 -0
  69. package/src/Utilities/Helpers/FormatHelper.d.ts +1 -1
  70. package/src/Utilities/Helpers/FormatHelper.js +9 -4
  71. package/src/Utilities/Helpers/Helper.js +1 -1
  72. package/src/Utilities/ObjectFactory.d.ts +5 -1
  73. package/src/Utilities/ObjectFactory.js +12 -2
  74. package/src/Utilities/Services/Interface/IReportService.d.ts +1 -1
  75. package/src/Utilities/Services/ReportService.d.ts +1 -1
  76. package/src/Utilities/Services/ReportService.js +5 -5
  77. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +2 -9
  78. package/src/View/Filter/FilterSummary.d.ts +1 -1
  79. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +1 -2
  80. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +38 -31
  81. package/src/View/Layout/LayoutViewPanel.d.ts +2 -2
  82. package/src/View/Layout/LayoutViewPanel.js +5 -5
  83. package/src/View/Layout/SaveLayoutButton.d.ts +2 -0
  84. package/src/View/Layout/SaveLayoutButton.js +30 -0
  85. package/src/agGrid/Adaptable.d.ts +4 -2
  86. package/src/agGrid/Adaptable.js +36 -20
  87. package/src/metamodel/adaptable.metamodel.d.ts +219 -2
  88. package/src/metamodel/adaptable.metamodel.js +1 -1
  89. package/src/types.d.ts +4 -2
  90. package/version.d.ts +1 -1
  91. package/version.js +1 -1
@@ -18,6 +18,7 @@ const Tabs_1 = require("../../../components/Tabs");
18
18
  const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
19
19
  const Tag_1 = require("../../../components/Tag");
20
20
  const AdaptableContext_1 = require("../../AdaptableContext");
21
+ const FormatHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/FormatHelper"));
21
22
  const DOLLAR_OPTIONS = {
22
23
  FractionDigits: 2,
23
24
  FractionSeparator: '.',
@@ -77,29 +78,25 @@ const DateFormatPresets = [
77
78
  'yyyyMMdd',
78
79
  'HH:mm:ss',
79
80
  ];
80
- const getFormatColumnFormatSummaryValue = (data, formattedColumnApi) => {
81
+ const getFormatColumnFormatSummaryValue = (data, api) => {
81
82
  let content = 'N/A';
82
83
  if (!data.DisplayFormat) {
83
84
  content = 'N/A';
84
85
  }
85
86
  else {
86
87
  if (data.DisplayFormat.Formatter === 'NumberFormatter') {
87
- content = formattedColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options);
88
+ content = FormatHelper_1.default.NumberFormatter(12345.6789, data.DisplayFormat.Options);
88
89
  }
89
90
  if (data.DisplayFormat.Formatter === 'DateFormatter') {
90
- content = formattedColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options);
91
+ content = FormatHelper_1.default.DateFormatter(new Date(2022, 0, 1), data.DisplayFormat.Options);
91
92
  }
92
93
  if (data.DisplayFormat.Formatter === 'StringFormatter') {
93
- content = formattedColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options);
94
+ content = FormatHelper_1.default.StringFormatter('Hello World ', data.DisplayFormat.Options);
94
95
  }
95
96
  }
96
97
  return content;
97
98
  };
98
99
  exports.getFormatColumnFormatSummaryValue = getFormatColumnFormatSummaryValue;
99
- function splitArrayInTwo(arr) {
100
- const half = Math.floor(arr.length - 1 / 2);
101
- return [arr.slice(0, half), arr.slice(half)];
102
- }
103
100
  const renderCustomFormatter = (data, customFormatter, setFormatOption) => {
104
101
  var _a, _b, _c;
105
102
  return (React.createElement(FormLayout_1.FormRow, { key: customFormatter.id, label: (_a = customFormatter.label) !== null && _a !== void 0 ? _a : customFormatter.id },
@@ -116,7 +113,7 @@ const renderCustomFormatter = (data, customFormatter, setFormatOption) => {
116
113
  } })));
117
114
  };
118
115
  const renderFormatColumnFormatSummary = (data, api) => {
119
- return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data, api.formatColumnApi));
116
+ return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data, api));
120
117
  };
121
118
  exports.renderFormatColumnFormatSummary = renderFormatColumnFormatSummary;
122
119
  const getFormatDisplayTypeForScope = (scope, api) => {
@@ -153,7 +150,7 @@ const getFormatDisplayTypeForScope = (scope, api) => {
153
150
  return undefined;
154
151
  };
155
152
  exports.getFormatDisplayTypeForScope = getFormatDisplayTypeForScope;
156
- const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
153
+ const renderDateFormat = (data, _onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
157
154
  if (data.DisplayFormat.Formatter !== 'DateFormatter') {
158
155
  return null;
159
156
  }
@@ -169,9 +166,12 @@ const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, fo
169
166
  React.createElement(FormLayout_1.default, null,
170
167
  React.createElement(FormLayout_1.FormRow, { label: "Pattern" },
171
168
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Pattern, onChange: (e) => setFormatOption('Pattern', e.currentTarget.value), mr: 2 }),
172
- React.createElement("span", null, formatColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options))),
173
- customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))))),
174
- React.createElement(Tabs_1.Tabs, { marginTop: 2 },
169
+ React.createElement("span", null, FormatHelper_1.default.DateFormatter(new Date(), data.DisplayFormat.Options)))))),
170
+ scopedCustomFormatters.length > 0 && (React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
171
+ React.createElement(Tabs_1.Tabs.Tab, null, "Custom Formats"),
172
+ React.createElement(Tabs_1.Tabs.Content, null,
173
+ React.createElement(FormLayout_1.default, null, scopedCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
174
+ React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
175
175
  React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
176
176
  React.createElement(Tabs_1.Tabs.Content, null,
177
177
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { style: { fontWeight: 'bold' }, colItems: [
@@ -182,7 +182,7 @@ const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, fo
182
182
  DateFormatPresets.map((Pattern, index) => (React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: index, colItems: [
183
183
  { Content: Pattern, Size: 1 },
184
184
  {
185
- Content: formatColumnApi.getDateFormattedValue(new Date(), { Pattern }),
185
+ Content: FormatHelper_1.default.DateFormatter(new Date(), { Pattern }),
186
186
  Size: 1,
187
187
  },
188
188
  {
@@ -191,7 +191,7 @@ const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, fo
191
191
  },
192
192
  ] })))))));
193
193
  };
194
- const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, formatColumnApi) => {
194
+ const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
195
195
  if (data.DisplayFormat.Formatter !== 'NumberFormatter') {
196
196
  return null;
197
197
  }
@@ -243,7 +243,6 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
243
243
  data.DisplayFormat.Options.Multiplier === MILLION_OPTIONS.Multiplier; //isEqual(data.DisplayFormat.Options, MILLION_OPTIONS);
244
244
  const IS_DOLLAR = data.DisplayFormat.Options.Prefix === '$'; //isEqual(data.DisplayFormat.Options, DOLLAR_OPTIONS);
245
245
  const IS_STERLING = data.DisplayFormat.Options.Prefix === '£'; //isEqual(data.DisplayFormat, STERLING_OPTIONS);
246
- const [leftCustomFormatters, rightCustomFormatters] = splitArrayInTwo(customFormatters);
247
246
  return (React.createElement(rebass_1.Box, { "data-name": 'format-column-display-format', padding: 2 },
248
247
  React.createElement(Tabs_1.Tabs, null,
249
248
  React.createElement(Tabs_1.Tabs.Tab, null, "Format"),
@@ -257,8 +256,7 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
257
256
  React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
258
257
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
259
258
  React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
260
- React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
261
- leftCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))),
259
+ React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) }))),
262
260
  React.createElement(FormLayout_1.default, null,
263
261
  React.createElement(FormLayout_1.FormRow, { label: "Fraction Digits" },
264
262
  React.createElement(Input_1.default, { type: "number", min: "0",
@@ -275,8 +273,12 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
275
273
  React.createElement(FormLayout_1.FormRow, { label: "Parentheses" },
276
274
  React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Parentheses, onChange: (checked) => setFormatOption('Parentheses', checked) })),
277
275
  React.createElement(FormLayout_1.FormRow, { label: "Truncate" },
278
- React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })),
279
- rightCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
276
+ React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })))))),
277
+ scopedCustomFormatters.length > 0 && (React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
278
+ React.createElement(Tabs_1.Tabs.Tab, null, "Custom Formats"),
279
+ React.createElement(Tabs_1.Tabs.Content, null,
280
+ React.createElement(rebass_1.Flex, { flexDirection: "row" },
281
+ React.createElement(FormLayout_1.default, null, scopedCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))))))),
280
282
  React.createElement(Tabs_1.Tabs, { marginTop: 2, autoFocus: false, keyboardNavigation: false },
281
283
  React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
282
284
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -299,29 +301,30 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
299
301
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
300
302
  { Content: '12345.6789', Size: 1 },
301
303
  {
302
- Content: formatColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options),
304
+ Content: FormatHelper_1.default.NumberFormatter(12345.6789, data.DisplayFormat.Options),
303
305
  Size: 1,
304
306
  },
305
307
  ] }),
306
308
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
307
309
  { Content: '-12345.6789', Size: 1 },
308
310
  {
309
- Content: formatColumnApi.getNumberFormattedValue(-12345.6789, data.DisplayFormat.Options),
311
+ Content: FormatHelper_1.default.NumberFormatter(-12345.6789, data.DisplayFormat.Options),
310
312
  Size: 1,
311
313
  },
312
314
  ] }),
313
315
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
314
316
  { Content: '0.123', Size: 1 },
315
317
  {
316
- Content: formatColumnApi.getNumberFormattedValue(0.123, data.DisplayFormat.Options),
318
+ Content: FormatHelper_1.default.NumberFormatter(0.123, data.DisplayFormat.Options),
317
319
  Size: 1,
318
320
  },
319
321
  ] })))));
320
322
  };
321
- const renderStringFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
323
+ const renderStringFormat = (data, _onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
322
324
  if (data.DisplayFormat.Formatter !== 'StringFormatter') {
323
325
  return null;
324
326
  }
327
+ console.log('formatters', scopedCustomFormatters);
325
328
  return (React.createElement(rebass_1.Box, { "data-name": 'format-column-display-format', padding: 2 },
326
329
  React.createElement(Tabs_1.Tabs, null,
327
330
  React.createElement(Tabs_1.Tabs.Tab, null, "Format"),
@@ -337,8 +340,12 @@ const renderStringFormat = (data, _onChange, setFormatOption, customFormatters,
337
340
  React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
338
341
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
339
342
  React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
340
- React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
341
- customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
343
+ React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })))))),
344
+ scopedCustomFormatters.length > 0 && (React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
345
+ React.createElement(Tabs_1.Tabs.Tab, null, "Custom Formats"),
346
+ React.createElement(Tabs_1.Tabs.Content, null,
347
+ React.createElement(rebass_1.Flex, { flexDirection: "column" },
348
+ React.createElement(FormLayout_1.default, { mr: 3 }, scopedCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))))))),
342
349
  React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
343
350
  React.createElement(Tabs_1.Tabs.Tab, null, "Example"),
344
351
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -350,7 +357,7 @@ const renderStringFormat = (data, _onChange, setFormatOption, customFormatters,
350
357
  { Content: '"Hello World "', Size: 1 },
351
358
  {
352
359
  Content: '"' +
353
- formatColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options) +
360
+ FormatHelper_1.default.StringFormatter('Hello World ', data.DisplayFormat.Options) +
354
361
  '"',
355
362
  Size: 1,
356
363
  },
@@ -372,15 +379,15 @@ const FormatColumnFormatWizardSection = (props) => {
372
379
  update({ DisplayFormat });
373
380
  };
374
381
  const Type = data.DisplayFormat && data.DisplayFormat.Formatter;
375
- const customNumberFormatters = customDisplayFormatters.filter((displayFormatter) => adaptable.api.scopeApi.isScopeInScope(displayFormatter.scope, data.Scope));
382
+ const customScopedFormatters = customDisplayFormatters.filter((displayFormatter) => adaptable.api.scopeApi.isScopeInScope(displayFormatter.scope, data.Scope));
376
383
  if (Type === 'NumberFormatter') {
377
- return renderNumberFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
384
+ return renderNumberFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
378
385
  }
379
386
  if (Type === 'DateFormatter') {
380
- return renderDateFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
387
+ return renderDateFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
381
388
  }
382
389
  if (Type === 'StringFormatter') {
383
- return renderStringFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
390
+ return renderStringFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
384
391
  }
385
392
  return (React.createElement(HelpBlock_1.default, { margin: 3 },
386
393
  "Setting a Display Format is only available if ",
@@ -1,7 +1,7 @@
1
+ import * as React from 'react';
1
2
  import { ViewPanelProps } from '../Components/SharedProps/ViewPanelProps';
2
- import * as LayoutRedux from '../../Redux/ActionsReducers/LayoutRedux';
3
3
  import { Layout } from '../../PredefinedConfig/LayoutState';
4
- import * as React from 'react';
4
+ import * as LayoutRedux from '../../Redux/ActionsReducers/LayoutRedux';
5
5
  export declare const COMPONENT_LAYOUT_POPUP_NAME = "LayoutEditorStandalonePopup";
6
6
  export interface LayoutViewPanelComponentProps extends ViewPanelProps {
7
7
  onSelectLayout: (layoutName: string) => LayoutRedux.LayoutSelectAction;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LayoutViewPanelControl = exports.COMPONENT_LAYOUT_POPUP_NAME = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const LayoutRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/LayoutRedux"));
6
5
  const React = tslib_1.__importStar(require("react"));
6
+ const react_redux_1 = require("react-redux");
7
7
  const AdaptableHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/AdaptableHelper"));
8
8
  const rebass_1 = require("rebass");
9
9
  const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
@@ -13,8 +13,9 @@ const ButtonSave_1 = require("../Components/Buttons/ButtonSave");
13
13
  const ButtonEdit_1 = require("../Components/Buttons/ButtonEdit");
14
14
  const ButtonNew_1 = require("../Components/Buttons/ButtonNew");
15
15
  const ButtonDelete_1 = require("../Components/Buttons/ButtonDelete");
16
- const react_redux_1 = require("react-redux");
17
16
  const ButtonClone_1 = require("../Components/Buttons/ButtonClone");
17
+ const GridRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/GridRedux"));
18
+ const LayoutRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/LayoutRedux"));
18
19
  exports.COMPONENT_LAYOUT_POPUP_NAME = 'LayoutEditorStandalonePopup';
19
20
  class LayoutViewPanelComponent extends React.Component {
20
21
  render() {
@@ -54,8 +55,7 @@ function mapStateToProps(state, ownProps) {
54
55
  CurrentLayoutName,
55
56
  CurrentDraftLayout: state.Grid.CurrentLayout || selectedLayout,
56
57
  Layouts,
57
- CanSave: state.Grid.CurrentLayout &&
58
- !api.layoutApi.areLayoutsEqual(selectedLayout, state.Grid.CurrentLayout),
58
+ CanSave: state.Grid.CurrentLayout && !api.layoutApi.areDraftAndCurrentLayoutEqual(),
59
59
  };
60
60
  }
61
61
  function mapDispatchToProps(dispatch) {
@@ -63,7 +63,7 @@ function mapDispatchToProps(dispatch) {
63
63
  onSelectLayout: (layoutName) => dispatch(LayoutRedux.LayoutSelect(layoutName)),
64
64
  onSaveLayout: (layout) => {
65
65
  dispatch(LayoutRedux.LayoutSave(layout));
66
- dispatch(LayoutRedux.LayoutUpdateCurrentDraft(null));
66
+ dispatch(GridRedux.LayoutUpdateCurrentDraft(null));
67
67
  },
68
68
  };
69
69
  }
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const SaveLayoutButton: React.FunctionComponent;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SaveLayoutButton = 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 AdaptableContext_1 = require("../AdaptableContext");
8
+ const ButtonSave_1 = require("../Components/Buttons/ButtonSave");
9
+ const GridRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/GridRedux"));
10
+ const LayoutRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/LayoutRedux"));
11
+ const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
12
+ const SaveLayoutButton = () => {
13
+ const adaptable = AdaptableContext_1.useAdaptable();
14
+ const accessLevel = adaptable.api.internalApi
15
+ .getEntitlementService()
16
+ .getEntitlementAccessLevelForModule(ModuleConstants.LayoutModuleId);
17
+ const dispatch = react_redux_1.useDispatch();
18
+ const currentDraftLayout = react_redux_1.useSelector((state) => state.Grid.CurrentLayout);
19
+ const isManualSaveLayout = !adaptable.api.layoutApi.shouldAutoSaveLayout(currentDraftLayout);
20
+ const handleSave = React.useCallback((layout) => {
21
+ dispatch(LayoutRedux.LayoutSave(layout));
22
+ dispatch(GridRedux.LayoutUpdateCurrentDraft(null));
23
+ }, []);
24
+ const isSaveEnabled = currentDraftLayout && !adaptable.api.layoutApi.areDraftAndCurrentLayoutEqual();
25
+ if (!isManualSaveLayout) {
26
+ return React.createElement(React.Fragment, null);
27
+ }
28
+ return (React.createElement(ButtonSave_1.ButtonSave, { ml: 1, variant: "text", iconSize: 15, onClick: () => handleSave(currentDraftLayout), tooltip: "Save Changes to Current Layout", disabled: !isSaveEnabled, accessLevel: accessLevel }));
29
+ };
30
+ exports.SaveLayoutButton = SaveLayoutButton;
@@ -1,4 +1,4 @@
1
- import { ColDef, ColGroupDef, Column, ExcelStyle, GridOptions, Module, RowNode } from '@ag-grid-community/all-modules';
1
+ import { ChartModel, ChartRef, ColDef, ColGroupDef, Column, ExcelStyle, GridOptions, Module, RowNode } from '@ag-grid-community/all-modules';
2
2
  import { AdaptableNoCodeWizardOptions, IAdaptableNoCodeWizard } from '../AdaptableInterfaces/AdaptableNoCodeWizard';
3
3
  import { IAdaptable } from '../AdaptableInterfaces/IAdaptable';
4
4
  import { AdaptableOptions } from '../AdaptableOptions/AdaptableOptions';
@@ -186,7 +186,7 @@ export declare class Adaptable implements IAdaptable {
186
186
  getDisplayValue(primaryKey: any, columnId: string): string | undefined;
187
187
  getGridCellFromRowNode(rowNode: RowNode, columnId: string): GridCell | undefined;
188
188
  getDisplayValueFromRowNode(rowNode: RowNode, columnId: string): string | undefined;
189
- getDisplayValueFromRawValue(columnId: string, rawValue: any): string | undefined;
189
+ getDisplayValueFromRawValue(rowNode: RowNode, columnId: string, rawValue: any): string | undefined;
190
190
  private getFormattedValue;
191
191
  private getNormalisedValueFromRowValue;
192
192
  getRawValueFromRowNode(rowNode: RowNode, columnId: string): any;
@@ -354,6 +354,8 @@ export declare class Adaptable implements IAdaptable {
354
354
  private addSyntheticPrimaryKey;
355
355
  private addSyntheticPrimaryKeyIfMissing;
356
356
  initLicenseService(): LicenseService;
357
+ showCharts(charts: ChartModel[]): ChartRef[];
358
+ getChartModels(): ChartModel[];
357
359
  }
358
360
  export declare class AdaptableNoCodeWizard implements IAdaptableNoCodeWizard {
359
361
  private init;
@@ -1860,7 +1860,7 @@ class Adaptable {
1860
1860
  const abColumn = this.api.columnApi.getColumnFromId(columnId);
1861
1861
  const pkValue = this.getPrimaryKeyValueFromRowNode(rowNode);
1862
1862
  const rawValue = this.getRawValueFromRowNode(rowNode, columnId);
1863
- const displayValue = this.getDisplayValueFromRawValue(columnId, rawValue);
1863
+ const displayValue = this.getDisplayValueFromRawValue(rowNode, columnId, rawValue);
1864
1864
  const normalisedvalue = this.getNormalisedValueFromRowValue(rawValue, abColumn);
1865
1865
  return {
1866
1866
  rawValue: rawValue,
@@ -1876,15 +1876,15 @@ class Adaptable {
1876
1876
  return undefined;
1877
1877
  }
1878
1878
  const rawValue = this.getRawValueFromRowNode(rowNode, columnId);
1879
- return this.getDisplayValueFromRawValue(columnId, rawValue);
1879
+ return this.getDisplayValueFromRawValue(rowNode, columnId, rawValue);
1880
1880
  }
1881
- getDisplayValueFromRawValue(columnId, rawValue) {
1881
+ getDisplayValueFromRawValue(rowNode, columnId, rawValue) {
1882
1882
  const abColumn = this.api.columnApi.getColumnFromId(columnId);
1883
1883
  const isRenderedColumn = this.api.columnApi.isFormatNumericStyleColumn(abColumn);
1884
1884
  if (isRenderedColumn) {
1885
1885
  const colDef = this.gridOptions.api.getColumnDef(columnId);
1886
1886
  if (typeof colDef.valueFormatter == 'function') {
1887
- return this.getFormattedValue(rawValue, columnId, colDef, colDef.valueFormatter);
1887
+ return this.getFormattedValue(rowNode, rawValue, columnId, colDef, colDef.valueFormatter);
1888
1888
  }
1889
1889
  return this.agGridHelper.getCleanValue(rawValue);
1890
1890
  }
@@ -1895,7 +1895,7 @@ class Adaptable {
1895
1895
  const colDef = this.gridOptions.api.getColumnDef(columnId);
1896
1896
  if (colDef) {
1897
1897
  if (typeof colDef.valueFormatter == 'function') {
1898
- const formattedValue = this.getFormattedValue(rawValue, columnId, colDef, colDef.valueFormatter);
1898
+ const formattedValue = this.getFormattedValue(rowNode, rawValue, columnId, colDef, colDef.valueFormatter);
1899
1899
  // Never use cellRenderer:
1900
1900
  // - when a string, you never know if it is HTML or a normal string
1901
1901
  // - when an object, cannot be used
@@ -1910,14 +1910,14 @@ class Adaptable {
1910
1910
  }
1911
1911
  return this.agGridHelper.getCleanValue(rawValue);
1912
1912
  }
1913
- getFormattedValue(rawValue, columnId, colDef, formatterFn) {
1913
+ getFormattedValue(rowNode, rawValue, columnId, colDef, formatterFn) {
1914
1914
  const column = this.gridOptions.columnApi
1915
1915
  .getAllColumns()
1916
1916
  .find((c) => c.getColId() == columnId);
1917
1917
  const params = {
1918
1918
  value: rawValue,
1919
- node: null,
1920
- data: null,
1919
+ node: rowNode,
1920
+ data: rowNode.data,
1921
1921
  colDef,
1922
1922
  column,
1923
1923
  api: this.gridOptions.api,
@@ -2402,6 +2402,7 @@ class Adaptable {
2402
2402
  ? this.adaptableOptions.filterOptions.enableFilterOnSpecialColumns
2403
2403
  : true;
2404
2404
  const defaultCalculatedColumnSettings = ObjectFactory_1.CreateEmptyCalculatedColumn(specialColumnsAreFilterable).CalculatedColumnSettings;
2405
+ const isExternalEvaluation = !this.api.internalApi.runModuleInAdaptableQL('CalculatedColumn');
2405
2406
  return this.api.calculatedColumnApi.getAllCalculatedColumn().map((calculatedColumn) => {
2406
2407
  const calculatedColumnSettings = Object.assign(Object.assign({}, defaultCalculatedColumnSettings), calculatedColumn.CalculatedColumnSettings);
2407
2408
  if (!calculatedColumnSettings.DataType) {
@@ -2434,9 +2435,9 @@ class Adaptable {
2434
2435
  suppressMovable: calculatedColumnSettings.SuppressMovable,
2435
2436
  type: columnTypes,
2436
2437
  valueGetter: (params) => {
2437
- var _a, _b;
2438
- if ((_a = calculatedColumn.CalculatedColumnSettings) === null || _a === void 0 ? void 0 : _a.ExternallyEvaluatedExpression) {
2439
- return (_b = params.data) === null || _b === void 0 ? void 0 : _b[calculatedColumn.ColumnId];
2438
+ var _a;
2439
+ if (isExternalEvaluation) {
2440
+ return (_a = params.data) === null || _a === void 0 ? void 0 : _a[calculatedColumn.ColumnId];
2440
2441
  }
2441
2442
  return this.CalculatedColumnExpressionService.evaluateCalculatedColumnQuery(calculatedColumn, params.node);
2442
2443
  },
@@ -3309,28 +3310,29 @@ class Adaptable {
3309
3310
  }
3310
3311
  if (formatColumn.DisplayFormat) {
3311
3312
  let valueFormatter;
3313
+ const options = formatColumn.DisplayFormat.Options;
3312
3314
  if (formatColumn.DisplayFormat.Formatter === 'NumberFormatter') {
3313
3315
  // change the Number format - if the scope allows it
3314
3316
  if (this.api.scopeApi.isColumnInNumericScope(abColumn, formatColumn.Scope)) {
3315
- const options = formatColumn.DisplayFormat.Options;
3316
3317
  valueFormatter = (params) => {
3317
- let value = params.value;
3318
- return this.api.formatColumnApi.getNumberFormattedValue(value, options);
3318
+ return this.api.formatColumnApi.getNumberFormattedValue(params.value, params.node, abColumn, options);
3319
3319
  };
3320
3320
  }
3321
3321
  }
3322
3322
  if (formatColumn.DisplayFormat.Formatter === 'DateFormatter') {
3323
3323
  // change the Date format - if the scope allows it
3324
3324
  if (this.api.scopeApi.isColumnInDateScope(abColumn, formatColumn.Scope)) {
3325
- const options = formatColumn.DisplayFormat.Options;
3326
- valueFormatter = (params) => this.api.formatColumnApi.getDateFormattedValue(params.value, options);
3325
+ valueFormatter = (params) => {
3326
+ return this.api.formatColumnApi.getDateFormattedValue(params.value, params.node, abColumn, options);
3327
+ };
3327
3328
  }
3328
3329
  }
3329
3330
  if (formatColumn.DisplayFormat.Formatter === 'StringFormatter') {
3330
- // change the Date format - if the scope allows it
3331
+ // change the String format - if the scope allows it
3331
3332
  if (this.api.scopeApi.isColumnInStringsScope(abColumn, formatColumn.Scope)) {
3332
- const options = formatColumn.DisplayFormat.Options;
3333
- valueFormatter = (params) => this.api.formatColumnApi.getStringFormattedValue(params.value, options);
3333
+ valueFormatter = (params) => {
3334
+ return this.api.formatColumnApi.getStringFormattedValue(params.value, params.node, abColumn, options);
3335
+ };
3334
3336
  }
3335
3337
  }
3336
3338
  return valueFormatter;
@@ -4533,7 +4535,7 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4533
4535
  rawValue = numericRawValue;
4534
4536
  }
4535
4537
  }
4536
- return this.ReportService.getCellExportValueFromRawValue(rawValue, columnId);
4538
+ return this.ReportService.getCellExportValueFromRawValue(rowNode, rawValue, columnId);
4537
4539
  }
4538
4540
  hasAutogeneratedPrimaryKey() {
4539
4541
  return this.adaptableOptions.autogeneratePrimaryKey;
@@ -4560,6 +4562,20 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4560
4562
  publishedAt: publishTimestamp_1.default,
4561
4563
  });
4562
4564
  }
4565
+ showCharts(charts) {
4566
+ if (!this.gridOptions.api) {
4567
+ LoggingHelper_1.ConsoleLogError('Adaptable must be instantiated before calling showCharts');
4568
+ return [];
4569
+ }
4570
+ return charts.map((chart) => this.gridOptions.api.restoreChart(chart));
4571
+ }
4572
+ getChartModels() {
4573
+ if (!this.gridOptions.api) {
4574
+ LoggingHelper_1.ConsoleLogError('Adaptable must be instantiated before calling getChartModels');
4575
+ return [];
4576
+ }
4577
+ return this.gridOptions.api.getChartModels();
4578
+ }
4563
4579
  }
4564
4580
  exports.Adaptable = Adaptable;
4565
4581
  class AdaptableNoCodeWizard {