@adaptabletools/adaptable 11.2.2 → 11.2.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 (98) hide show
  1. package/base.css +24 -1
  2. package/bundle.cjs.js +103 -103
  3. package/index.css +28 -1
  4. package/package.json +1 -1
  5. package/publishTimestamp.d.ts +1 -1
  6. package/publishTimestamp.js +1 -1
  7. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
  8. package/src/AdaptableOptions/AdaptableOptions.d.ts +7 -0
  9. package/src/AdaptableOptions/FinancePluginOptions.d.ts +33 -3
  10. package/src/AdaptableOptions/FormatColumnOptions.d.ts +9 -0
  11. package/src/AdaptableOptions/FormatColumnOptions.js +2 -0
  12. package/src/AdaptableOptions/LayoutOptions.d.ts +36 -11
  13. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +0 -1
  14. package/src/Api/ColumnApi.d.ts +4 -1
  15. package/src/Api/FinanceApi.d.ts +3 -2
  16. package/src/Api/FormatColumnApi.d.ts +22 -1
  17. package/src/Api/GridApi.d.ts +8 -1
  18. package/src/Api/Implementation/ColumnApiImpl.js +6 -2
  19. package/src/Api/Implementation/FilterApiImpl.js +2 -7
  20. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +5 -0
  21. package/src/Api/Implementation/FormatColumnApiImpl.js +29 -0
  22. package/src/Api/Implementation/FreeTextColumnApiImpl.js +3 -3
  23. package/src/Api/Implementation/GridApiImpl.d.ts +3 -0
  24. package/src/Api/Implementation/GridApiImpl.js +3 -0
  25. package/src/Api/Implementation/InternalApiImpl.d.ts +2 -0
  26. package/src/Api/Implementation/InternalApiImpl.js +49 -28
  27. package/src/Api/Implementation/LayoutApiImpl.d.ts +2 -0
  28. package/src/Api/Implementation/LayoutApiImpl.js +6 -0
  29. package/src/Api/Implementation/SystemStatusApiImpl.js +1 -1
  30. package/src/Api/Implementation/TeamSharingApiImpl.d.ts +2 -1
  31. package/src/Api/Implementation/TeamSharingApiImpl.js +11 -2
  32. package/src/Api/Implementation/ThemeApiImpl.js +1 -1
  33. package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +2 -1
  34. package/src/Api/Implementation/UserInterfaceApiImpl.js +16 -4
  35. package/src/Api/InternalApi.d.ts +2 -0
  36. package/src/Api/LayoutApi.d.ts +6 -1
  37. package/src/Api/TeamSharingApi.d.ts +10 -1
  38. package/src/Api/UserInterfaceApi.d.ts +6 -1
  39. package/src/PredefinedConfig/Common/AdaptableColumn.d.ts +4 -0
  40. package/src/PredefinedConfig/Common/AdaptableFormat.d.ts +8 -3
  41. package/src/PredefinedConfig/Common/AdaptableObject.d.ts +5 -5
  42. package/src/PredefinedConfig/Common/AdaptablePredicate.js +17 -1
  43. package/src/PredefinedConfig/Common/FDC3Context.d.ts +5 -1
  44. package/src/Redux/ActionsReducers/TeamSharingRedux.d.ts +1 -1
  45. package/src/Redux/ActionsReducers/TeamSharingRedux.js +4 -4
  46. package/src/Strategy/DashboardModule.js +3 -0
  47. package/src/Strategy/FilterModule.d.ts +7 -0
  48. package/src/Strategy/FilterModule.js +11 -2
  49. package/src/Strategy/FormatColumnModule.js +1 -1
  50. package/src/Strategy/Interface/IModule.d.ts +5 -0
  51. package/src/Strategy/LayoutModule.js +7 -7
  52. package/src/Strategy/Utilities/getObjectTagsViewItems.js +1 -1
  53. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +4 -1
  54. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +4 -3
  55. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +16 -36
  56. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +2 -4
  57. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +24 -14
  58. package/src/Utilities/Services/CalculatedColumnExpressionService.js +32 -9
  59. package/src/View/AdaptablePopover/index.d.ts +1 -0
  60. package/src/View/AdaptablePopover/index.js +2 -2
  61. package/src/View/AdaptableView.js +8 -2
  62. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
  63. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +1 -1
  64. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.d.ts +13 -0
  65. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +41 -0
  66. package/src/View/Components/EntityRulesEditor/index.js +2 -1
  67. package/src/View/Components/ExpressionWizard.js +2 -1
  68. package/src/View/Components/FilterForm/FilterForm.d.ts +4 -1
  69. package/src/View/Components/FilterForm/ListBoxFilterForm.d.ts +4 -1
  70. package/src/View/Components/FilterForm/ListBoxFilterForm.js +7 -7
  71. package/src/View/Components/FilterForm/QuickFilterForm.js +15 -2
  72. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -1
  73. package/src/View/Components/Popups/AdaptableToaster.js +1 -0
  74. package/src/View/Components/TagValueSelector/index.js +4 -3
  75. package/src/View/ConditionalStyle/Wizard/ConditionalStyleWizard.js +2 -2
  76. package/src/View/Export/ReportExportDropdown.js +1 -1
  77. package/src/View/Filter/ActiveFiltersPanel.d.ts +1 -13
  78. package/src/View/Filter/ActiveFiltersPanel.js +8 -31
  79. package/src/View/Filter/FilterStatusBarSubPanelPopover.js +1 -10
  80. package/src/View/Filter/FilterViewPanel.js +2 -2
  81. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +3 -2
  82. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +53 -22
  83. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -3
  84. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.d.ts +1 -1
  85. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +1 -1
  86. package/src/View/Layout/Wizard/LayoutEditorWizard.d.ts +1 -1
  87. package/src/View/Schedule/Wizard/ScheduleWizard.js +4 -4
  88. package/src/agGrid/Adaptable.d.ts +3 -0
  89. package/src/agGrid/Adaptable.js +31 -22
  90. package/src/agGrid/agGridHelper.js +1 -0
  91. package/src/components/ExpressionEditor/BaseEditorInput.js +8 -1
  92. package/src/components/ExpressionEditor/index.js +54 -5
  93. package/src/metamodel/adaptable.metamodel.d.ts +49 -20
  94. package/src/metamodel/adaptable.metamodel.js +158 -31
  95. package/src/parser/src/types.d.ts +1 -1
  96. package/src/types.d.ts +5 -5
  97. package/version.d.ts +1 -1
  98. package/version.js +1 -1
@@ -3,6 +3,7 @@ import { FormatColumn } from '../../../PredefinedConfig/FormatColumnState';
3
3
  import { AdaptableFormat } from '../../../PredefinedConfig/Common/AdaptableFormat';
4
4
  import { AdaptableScope } from '../../../PredefinedConfig/Common/AdaptableScope';
5
5
  import { AdaptableApi } from '../../../Api/AdaptableApi';
6
+ import { FormatColumnApi } from '../../../types';
6
7
  export declare type FormatColumnFormatWizardSectionProps = {
7
8
  onChange: (data: FormatColumn) => void;
8
9
  };
@@ -10,7 +11,7 @@ export interface FormatColumnFormatWizardState {
10
11
  DisplayFormat: AdaptableFormat;
11
12
  NumericFormat?: 'Percent' | 'Thousand' | 'Million' | 'Dollar' | 'Sterling' | undefined;
12
13
  }
13
- export declare const getFormatColumnFormatSummaryValue: (data: FormatColumn) => string;
14
- export declare const renderFormatColumnFormatSummary: (data: FormatColumn) => JSX.Element;
14
+ export declare const getFormatColumnFormatSummaryValue: (data: FormatColumn, formattedColumnApi: FormatColumnApi) => string;
15
+ export declare const renderFormatColumnFormatSummary: (data: FormatColumn, api: AdaptableApi) => JSX.Element;
15
16
  export declare const getFormatDisplayTypeForScope: (scope: AdaptableScope, api: AdaptableApi) => 'Number' | 'Date' | 'String' | undefined;
16
17
  export declare const FormatColumnFormatWizardSection: (props: FormatColumnFormatWizardSectionProps) => JSX.Element;
@@ -10,7 +10,6 @@ const HelpBlock_1 = tslib_1.__importDefault(require("../../../components/HelpBlo
10
10
  const Input_1 = tslib_1.__importDefault(require("../../../components/Input"));
11
11
  const SimpleButton_1 = tslib_1.__importDefault(require("../../../components/SimpleButton"));
12
12
  const CheckBox_1 = require("../../../components/CheckBox");
13
- const FormatHelper_1 = tslib_1.__importDefault(require("../../../Utilities/Helpers/FormatHelper"));
14
13
  const FormLayout_1 = tslib_1.__importStar(require("../../../components/FormLayout"));
15
14
  const AdaptableObjectRow_1 = require("../../Components/AdaptableObjectRow");
16
15
  const Radio_1 = tslib_1.__importDefault(require("../../../components/Radio"));
@@ -18,6 +17,7 @@ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
18
17
  const Tabs_1 = require("../../../components/Tabs");
19
18
  const StringExtensions_1 = tslib_1.__importDefault(require("../../../Utilities/Extensions/StringExtensions"));
20
19
  const Tag_1 = require("../../../components/Tag");
20
+ const AdaptableContext_1 = require("../../AdaptableContext");
21
21
  const DOLLAR_OPTIONS = {
22
22
  FractionDigits: 2,
23
23
  FractionSeparator: '.',
@@ -77,26 +77,45 @@ const DateFormatPresets = [
77
77
  'yyyyMMdd',
78
78
  'HH:mm:ss',
79
79
  ];
80
- exports.getFormatColumnFormatSummaryValue = (data) => {
80
+ exports.getFormatColumnFormatSummaryValue = (data, formattedColumnApi) => {
81
81
  let content = 'N/A';
82
82
  if (!data.DisplayFormat) {
83
83
  content = 'N/A';
84
84
  }
85
85
  else {
86
86
  if (data.DisplayFormat.Formatter === 'NumberFormatter') {
87
- content = FormatHelper_1.default.NumberFormatter(12345.6789, data.DisplayFormat.Options);
87
+ content = formattedColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options);
88
88
  }
89
89
  if (data.DisplayFormat.Formatter === 'DateFormatter') {
90
- content = FormatHelper_1.default.DateFormatter(new Date(), data.DisplayFormat.Options);
90
+ content = formattedColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options);
91
91
  }
92
92
  if (data.DisplayFormat.Formatter === 'StringFormatter') {
93
- content = FormatHelper_1.default.StringFormatter('Hello World ', data.DisplayFormat.Options);
93
+ content = formattedColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options);
94
94
  }
95
95
  }
96
96
  return content;
97
97
  };
98
- exports.renderFormatColumnFormatSummary = (data) => {
99
- return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data));
98
+ function splitArrayInTwo(arr) {
99
+ const half = Math.floor(arr.length - 1 / 2);
100
+ return [arr.slice(0, half), arr.slice(half)];
101
+ }
102
+ const renderCustomFormatter = (data, customFormatter, setFormatOption) => {
103
+ var _a, _b, _c;
104
+ return (React.createElement(FormLayout_1.FormRow, { key: customFormatter.id, label: (_a = customFormatter.label) !== null && _a !== void 0 ? _a : customFormatter.id },
105
+ React.createElement(CheckBox_1.CheckBox, { checked: (_c = (_b = data.DisplayFormat.Options.CustomDisplayFormats) === null || _b === void 0 ? void 0 : _b.some) === null || _c === void 0 ? void 0 : _c.call(_b, (item) => item.Id === customFormatter.id), onChange: (checked) => {
106
+ var _a, _b, _c;
107
+ let newCustomFormats = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.DisplayFormat) === null || _a === void 0 ? void 0 : _a.Options) === null || _b === void 0 ? void 0 : _b.CustomDisplayFormats) !== null && _c !== void 0 ? _c : [];
108
+ if (checked) {
109
+ newCustomFormats = [...newCustomFormats, { Id: customFormatter.id }];
110
+ }
111
+ else {
112
+ newCustomFormats = newCustomFormats.filter((item) => item.Id !== customFormatter.id);
113
+ }
114
+ setFormatOption('CustomDisplayFormats', newCustomFormats);
115
+ } })));
116
+ };
117
+ exports.renderFormatColumnFormatSummary = (data, api) => {
118
+ return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data, api.formatColumnApi));
100
119
  };
101
120
  exports.getFormatDisplayTypeForScope = (scope, api) => {
102
121
  if (scope == undefined) {
@@ -131,7 +150,7 @@ exports.getFormatDisplayTypeForScope = (scope, api) => {
131
150
  }
132
151
  return undefined;
133
152
  };
134
- const renderDateFormat = (data, _onChange, setFormatOption) => {
153
+ const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
135
154
  if (data.DisplayFormat.Formatter !== 'DateFormatter') {
136
155
  return null;
137
156
  }
@@ -147,7 +166,8 @@ const renderDateFormat = (data, _onChange, setFormatOption) => {
147
166
  React.createElement(FormLayout_1.default, null,
148
167
  React.createElement(FormLayout_1.FormRow, { label: "Pattern" },
149
168
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Pattern, onChange: (e) => setFormatOption('Pattern', e.currentTarget.value), mr: 2 }),
150
- React.createElement("span", null, FormatHelper_1.default.DateFormatter(new Date(), data.DisplayFormat.Options)))))),
169
+ React.createElement("span", null, formatColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options))),
170
+ customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))))),
151
171
  React.createElement(Tabs_1.Tabs, { marginTop: 2 },
152
172
  React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
153
173
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -159,7 +179,7 @@ const renderDateFormat = (data, _onChange, setFormatOption) => {
159
179
  DateFormatPresets.map((Pattern, index) => (React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { key: index, colItems: [
160
180
  { Content: Pattern, Size: 1 },
161
181
  {
162
- Content: FormatHelper_1.default.DateFormatter(new Date(), { Pattern }),
182
+ Content: formatColumnApi.getDateFormattedValue(new Date(), { Pattern }),
163
183
  Size: 1,
164
184
  },
165
185
  {
@@ -168,7 +188,7 @@ const renderDateFormat = (data, _onChange, setFormatOption) => {
168
188
  },
169
189
  ] })))))));
170
190
  };
171
- const renderNumberFormat = (data, onChange, setFormatOption) => {
191
+ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, formatColumnApi) => {
172
192
  if (data.DisplayFormat.Formatter !== 'NumberFormatter') {
173
193
  return null;
174
194
  }
@@ -220,6 +240,7 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
220
240
  data.DisplayFormat.Options.Multiplier === MILLION_OPTIONS.Multiplier; //isEqual(data.DisplayFormat.Options, MILLION_OPTIONS);
221
241
  const IS_DOLLAR = data.DisplayFormat.Options.Prefix === '$'; //isEqual(data.DisplayFormat.Options, DOLLAR_OPTIONS);
222
242
  const IS_STERLING = data.DisplayFormat.Options.Prefix === '£'; //isEqual(data.DisplayFormat, STERLING_OPTIONS);
243
+ const [leftCustomFormatters, rightCustomFormatters] = splitArrayInTwo(customFormatters);
223
244
  return (React.createElement(rebass_1.Box, { "data-name": 'format-column-display-format', padding: 2 },
224
245
  React.createElement(Tabs_1.Tabs, null,
225
246
  React.createElement(Tabs_1.Tabs.Tab, null, "Format"),
@@ -233,7 +254,8 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
233
254
  React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
234
255
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
235
256
  React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
236
- React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) }))),
257
+ React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
258
+ leftCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))),
237
259
  React.createElement(FormLayout_1.default, null,
238
260
  React.createElement(FormLayout_1.FormRow, { label: "Fraction Digits" },
239
261
  React.createElement(Input_1.default, { type: "number", min: "0",
@@ -250,7 +272,8 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
250
272
  React.createElement(FormLayout_1.FormRow, { label: "Parentheses" },
251
273
  React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Parentheses, onChange: (checked) => setFormatOption('Parentheses', checked) })),
252
274
  React.createElement(FormLayout_1.FormRow, { label: "Truncate" },
253
- React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })))))),
275
+ React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })),
276
+ rightCustomFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
254
277
  React.createElement(Tabs_1.Tabs, { marginTop: 2, autoFocus: false, keyboardNavigation: false },
255
278
  React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
256
279
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -273,26 +296,26 @@ const renderNumberFormat = (data, onChange, setFormatOption) => {
273
296
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
274
297
  { Content: '12345.6789', Size: 1 },
275
298
  {
276
- Content: FormatHelper_1.default.NumberFormatter(12345.6789, data.DisplayFormat.Options),
299
+ Content: formatColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options),
277
300
  Size: 1,
278
301
  },
279
302
  ] }),
280
303
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
281
304
  { Content: '-12345.6789', Size: 1 },
282
305
  {
283
- Content: FormatHelper_1.default.NumberFormatter(-12345.6789, data.DisplayFormat.Options),
306
+ Content: formatColumnApi.getNumberFormattedValue(-12345.6789, data.DisplayFormat.Options),
284
307
  Size: 1,
285
308
  },
286
309
  ] }),
287
310
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { colItems: [
288
311
  { Content: '0.123', Size: 1 },
289
312
  {
290
- Content: FormatHelper_1.default.NumberFormatter(0.123, data.DisplayFormat.Options),
313
+ Content: formatColumnApi.getNumberFormattedValue(0.123, data.DisplayFormat.Options),
291
314
  Size: 1,
292
315
  },
293
316
  ] })))));
294
317
  };
295
- const renderStringFormat = (data, _onChange, setFormatOption) => {
318
+ const renderStringFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
296
319
  if (data.DisplayFormat.Formatter !== 'StringFormatter') {
297
320
  return null;
298
321
  }
@@ -311,7 +334,8 @@ const renderStringFormat = (data, _onChange, setFormatOption) => {
311
334
  React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
312
335
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
313
336
  React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
314
- React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })))))),
337
+ React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
338
+ customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption)))))),
315
339
  React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
316
340
  React.createElement(Tabs_1.Tabs.Tab, null, "Example"),
317
341
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -323,14 +347,18 @@ const renderStringFormat = (data, _onChange, setFormatOption) => {
323
347
  { Content: '"Hello World "', Size: 1 },
324
348
  {
325
349
  Content: '"' +
326
- FormatHelper_1.default.StringFormatter('Hello World ', data.DisplayFormat.Options) +
350
+ formatColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options) +
327
351
  '"',
328
352
  Size: 1,
329
353
  },
330
354
  ] })))));
331
355
  };
332
356
  exports.FormatColumnFormatWizardSection = (props) => {
357
+ var _a, _b, _c;
333
358
  const { data } = OnePageAdaptableWizard_1.useOnePageWizardContext();
359
+ const adaptable = AdaptableContext_1.useAdaptable();
360
+ const formatColumnApi = adaptable.api.formatColumnApi;
361
+ const customDisplayFormatters = (_c = (_b = (_a = adaptable.adaptableOptions) === null || _a === void 0 ? void 0 : _a.formatColumnOptions) === null || _b === void 0 ? void 0 : _b.customDisplayFormatters) !== null && _c !== void 0 ? _c : [];
334
362
  const update = (updated) => {
335
363
  props.onChange(Object.assign(Object.assign({}, data), updated));
336
364
  };
@@ -342,13 +370,16 @@ exports.FormatColumnFormatWizardSection = (props) => {
342
370
  };
343
371
  const Type = data.DisplayFormat && data.DisplayFormat.Formatter;
344
372
  if (Type === 'NumberFormatter') {
345
- return renderNumberFormat(data, update, setFormatOption);
373
+ const customNumberFormatters = customDisplayFormatters.filter((displayFormatter) => displayFormatter.type === 'Number');
374
+ return renderNumberFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
346
375
  }
347
376
  if (Type === 'DateFormatter') {
348
- return renderDateFormat(data, update, setFormatOption);
377
+ const customNumberFormatters = customDisplayFormatters.filter((displayFormatter) => displayFormatter.type === 'Date');
378
+ return renderDateFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
349
379
  }
350
380
  if (Type === 'StringFormatter') {
351
- return renderStringFormat(data, update, setFormatOption);
381
+ const customNumberFormatters = customDisplayFormatters.filter((displayFormatter) => displayFormatter.type === 'String');
382
+ return renderStringFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
352
383
  }
353
384
  return (React.createElement(HelpBlock_1.default, { margin: 3 },
354
385
  "Setting a Display Format is only available if ",
@@ -72,9 +72,9 @@ const adjustFormatColumn = (formatColumn, api) => {
72
72
  return formatColumn;
73
73
  };
74
74
  function FormatColumnWizard(props) {
75
- var _a;
75
+ var _a, _b;
76
76
  const { api } = AdaptableContext_1.useAdaptable();
77
- const data = (_a = props.data) !== null && _a !== void 0 ? _a : props.popupParams.value;
77
+ const data = (_a = props.data) !== null && _a !== void 0 ? _a : (_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.value;
78
78
  const [formatColumn, doSetFormatColumn] = react_1.useState(() => {
79
79
  var _a, _b, _c, _d;
80
80
  let formatColumn = data ? Helper_1.cloneObject(data) : ObjectFactory_1.default.CreateEmptyFormatColumn();
@@ -125,7 +125,7 @@ function FormatColumnWizard(props) {
125
125
  },
126
126
  {
127
127
  title: 'Display Format',
128
- renderSummary: FormatColumnFormatWizardSection_1.renderFormatColumnFormatSummary,
128
+ renderSummary: (data) => FormatColumnFormatWizardSection_1.renderFormatColumnFormatSummary(data, api),
129
129
  render: () => {
130
130
  return React.createElement(FormatColumnFormatWizardSection_1.FormatColumnFormatWizardSection, { onChange: setFormatColumn });
131
131
  },
@@ -2,7 +2,7 @@
2
2
  import { FreeTextColumn } from '../../../PredefinedConfig/FreeTextColumnState';
3
3
  import { AdaptableApi } from '../../../Api/AdaptableApi';
4
4
  export declare const renderFreeTextColumnSummary: (data: FreeTextColumn) => JSX.Element;
5
- export declare const isValidFreeTextColumn: (data: FreeTextColumn, api: AdaptableApi) => true | "Column id cannot be empty" | "No data type specified for column" | "A Column already exists with that id";
5
+ export declare const isValidFreeTextColumn: (data: FreeTextColumn, api: AdaptableApi) => true | "Column Id cannot be empty" | "No data type specified for column" | "A Column already exists with that id";
6
6
  export declare type FreeTextColumnSettingsWizardSectionProps = {
7
7
  onChange: (data: FreeTextColumn) => void;
8
8
  isEdit: boolean;
@@ -46,7 +46,7 @@ exports.renderFreeTextColumnSummary = (data) => {
46
46
  exports.isValidFreeTextColumn = (data, api) => {
47
47
  const columns = api.columnApi.getColumns();
48
48
  if (!data.ColumnId) {
49
- return 'Column id cannot be empty';
49
+ return 'Column Id cannot be empty';
50
50
  }
51
51
  const columnsWithSameIdCount = columns.filter((c) => c.columnId === data.ColumnId).length;
52
52
  const hasAlreadyExistingId = data.Uuid ? columnsWithSameIdCount > 1 : columnsWithSameIdCount > 0;
@@ -43,7 +43,7 @@ export declare class LayoutEditorWizard extends React.Component<LayoutEditorWiza
43
43
  Uuid?: string;
44
44
  Source?: "Config" | "User";
45
45
  IsReadOnly?: boolean;
46
- Tags?: import("../../../PredefinedConfig/Common/AdaptableObject").AdaptableObjectTag[];
46
+ Tags?: import("../../../types").AdaptableObjectTag[];
47
47
  };
48
48
  canNext(): boolean;
49
49
  canBack(): boolean;
@@ -14,10 +14,10 @@ const react_redux_1 = require("react-redux");
14
14
  const ScheduleRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/ScheduleRedux"));
15
15
  const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
16
16
  exports.ScheduleWizard = (props) => {
17
- var _a, _b, _c;
18
- const data = (_a = props.data) !== null && _a !== void 0 ? _a : props.popupParams.value;
19
- const isNew = ((_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.action) ? props.popupParams.action === 'New' : !props.data;
20
- const scheduleType = data ? data.ScheduleType : (_c = props === null || props === void 0 ? void 0 : props.abObjectType) === null || _c === void 0 ? void 0 : _c.name;
17
+ var _a, _b, _c, _d;
18
+ const data = (_a = props.data) !== null && _a !== void 0 ? _a : (_b = props.popupParams) === null || _b === void 0 ? void 0 : _b.value;
19
+ const isNew = ((_c = props.popupParams) === null || _c === void 0 ? void 0 : _c.action) ? props.popupParams.action === 'New' : !props.data;
20
+ const scheduleType = data ? data.ScheduleType : (_d = props === null || props === void 0 ? void 0 : props.abObjectType) === null || _d === void 0 ? void 0 : _d.name;
21
21
  const [schedule, setSchedule] = React.useState(() => {
22
22
  if (data) {
23
23
  return data;
@@ -195,6 +195,9 @@ export declare class Adaptable implements IAdaptable {
195
195
  forAllRowNodesDo(func: (rowNode: RowNode) => void): void;
196
196
  forAllVisibleRowNodesDo(func: (rowNode: RowNode, rowIndex: number) => void): void;
197
197
  getVisibleRowNodes(): RowNode[];
198
+ getAllRowNodes(config?: {
199
+ includeGroupRows?: boolean;
200
+ }): RowNode[];
198
201
  getRowsInViewport(): RowNode[];
199
202
  selectNodes(rowNodes: RowNode[], clearSelection: boolean): void;
200
203
  deSelectNodes(rowNodes: RowNode[], clearSelection: boolean): void;
@@ -26,7 +26,7 @@ const AdaptableHelper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/
26
26
  const FormatHelper_1 = tslib_1.__importDefault(require("../Utilities/Helpers/FormatHelper"));
27
27
  const Helper_1 = require("../Utilities/Helpers/Helper");
28
28
  const LoggingHelper_1 = require("../Utilities/Helpers/LoggingHelper");
29
- const ObjectFactory_1 = tslib_1.__importStar(require("../Utilities/ObjectFactory"));
29
+ const ObjectFactory_1 = require("../Utilities/ObjectFactory");
30
30
  // services
31
31
  const CalculatedColumnExpressionService_1 = require("../Utilities/Services/CalculatedColumnExpressionService");
32
32
  const DataService_1 = require("../Utilities/Services/DataService");
@@ -1106,6 +1106,7 @@ class Adaptable {
1106
1106
  return isCellReadonly ? readonlyCellStyle.ClassName : null;
1107
1107
  }
1108
1108
  isQuickSearchActive(abColumn, params) {
1109
+ var _a;
1109
1110
  if (abColumn.isExcludedFromQuickSearch) {
1110
1111
  return false;
1111
1112
  }
@@ -1116,8 +1117,11 @@ class Adaptable {
1116
1117
  if (StringExtensions_1.StringExtensions.IsNullOrEmpty(quickSearchValue)) {
1117
1118
  return false;
1118
1119
  }
1119
- const columnFilter = ObjectFactory_1.default.CreateColumnFilter(abColumn.columnId, 'Contains', [quickSearchValue]);
1120
- return this.api.filterApi.evaluateColumnFilter(columnFilter, params.node);
1120
+ const displayValue = (_a = this.api.gridApi.getDisplayValueFromRowNode(params.node, abColumn.columnId)) !== null && _a !== void 0 ? _a : '';
1121
+ const ignoreCase = !this.api.internalApi.isTextComparisonCaseSensitive();
1122
+ const v = ignoreCase ? String(displayValue).toLocaleLowerCase() : String(displayValue);
1123
+ const i = ignoreCase ? String(quickSearchValue).toLocaleLowerCase() : String(quickSearchValue);
1124
+ return v.indexOf(i) !== -1;
1121
1125
  }
1122
1126
  getPrimaryKeyValueFromRowNode(rowNode) {
1123
1127
  var _a;
@@ -1807,7 +1811,7 @@ class Adaptable {
1807
1811
  const pkValue = this.getPrimaryKeyValueFromRowNode(rowNode);
1808
1812
  const rawValue = this.getRawValueFromRowNode(rowNode, columnId);
1809
1813
  const displayValue = this.getDisplayValueFromRawValue(columnId, rawValue);
1810
- const normalisedvalue = this.getNormalisedValueFromRowValue(rawValue, displayValue, abColumn);
1814
+ const normalisedvalue = this.getNormalisedValueFromRowValue(rawValue, abColumn);
1811
1815
  return {
1812
1816
  rawValue: rawValue,
1813
1817
  displayValue: displayValue,
@@ -1872,35 +1876,28 @@ class Adaptable {
1872
1876
  };
1873
1877
  return formatterFn(params);
1874
1878
  }
1875
- getNormalisedValueFromRowValue(rawValue, displayValue, column) {
1876
- // not sure if the current implementation is correct:
1877
- // the returned "normalised value" is actually the displayed value in almost all cases?!
1878
- // 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)
1879
- // if (dataType === 'Number') {
1880
- // return typeof rawValue !== 'number' ? Number(rawValue) : returnValue;
1881
- // }
1882
- // anyway, it seems to work so far (as of v11.1.3), so I'm leaving it for now :)
1879
+ getNormalisedValueFromRowValue(rawValue, column) {
1883
1880
  if (!column) {
1884
1881
  return rawValue;
1885
1882
  }
1886
- const returnValue = this.isCustomRenderedColumn(column) ? rawValue : displayValue;
1887
- if (returnValue === undefined || returnValue === null) {
1883
+ // prevents from null
1884
+ if (rawValue === undefined || rawValue === null) {
1888
1885
  return rawValue;
1889
1886
  }
1890
1887
  const dataType = column.dataType;
1891
1888
  if (dataType === 'String') {
1892
- return typeof rawValue !== 'string' ? String(rawValue) : returnValue;
1889
+ return typeof rawValue !== 'string' ? String(rawValue) : rawValue;
1893
1890
  }
1894
1891
  if (dataType === 'Number') {
1895
- return typeof rawValue !== 'number' ? Number(rawValue) : returnValue;
1892
+ return typeof rawValue !== 'number' ? Number(rawValue) : rawValue;
1896
1893
  }
1897
1894
  if (dataType === 'Boolean') {
1898
- return typeof rawValue !== 'boolean' ? Boolean(rawValue) : returnValue;
1895
+ return typeof rawValue !== 'boolean' ? Boolean(rawValue) : rawValue;
1899
1896
  }
1900
1897
  if (dataType === 'Date') {
1901
1898
  return rawValue instanceof Date ? rawValue : DateHelper_1.parseDateValue(rawValue);
1902
1899
  }
1903
- return returnValue;
1900
+ return rawValue;
1904
1901
  }
1905
1902
  getRawValueFromRowNode(rowNode, columnId) {
1906
1903
  if (rowNode == null) {
@@ -1950,7 +1947,7 @@ class Adaptable {
1950
1947
  return rowNodes;
1951
1948
  }
1952
1949
  forAllRowNodesDo(func) {
1953
- this.gridOptions.api.getModel().forEachNode((rowNode) => {
1950
+ this.gridOptions.api.forEachNode((rowNode) => {
1954
1951
  func(rowNode);
1955
1952
  });
1956
1953
  }
@@ -1966,6 +1963,15 @@ class Adaptable {
1966
1963
  });
1967
1964
  return rowNodes;
1968
1965
  }
1966
+ getAllRowNodes(config) {
1967
+ let rowNodes = [];
1968
+ this.gridOptions.api.forEachNode((rowNode, rowIndex) => {
1969
+ if (!this.isGroupRowNode(rowNode) || (config === null || config === void 0 ? void 0 : config.includeGroupRows)) {
1970
+ rowNodes.push(rowNode);
1971
+ }
1972
+ });
1973
+ return rowNodes;
1974
+ }
1969
1975
  getRowsInViewport() {
1970
1976
  return this.gridOptions.api.getRenderedNodes();
1971
1977
  }
@@ -3159,21 +3165,24 @@ class Adaptable {
3159
3165
  // change the Number format - if the scope allows it
3160
3166
  if (this.api.scopeApi.isColumnInNumericScope(abColumn, formatColumn.Scope)) {
3161
3167
  const options = formatColumn.DisplayFormat.Options;
3162
- valueFormatter = (params) => FormatHelper_1.default.NumberFormatter(params.value, options);
3168
+ valueFormatter = (params) => {
3169
+ let value = params.value;
3170
+ return this.api.formatColumnApi.getNumberFormattedValue(value, options);
3171
+ };
3163
3172
  }
3164
3173
  }
3165
3174
  if (formatColumn.DisplayFormat.Formatter === 'DateFormatter') {
3166
3175
  // change the Date format - if the scope allows it
3167
3176
  if (this.api.scopeApi.isColumnInDateScope(abColumn, formatColumn.Scope)) {
3168
3177
  const options = formatColumn.DisplayFormat.Options;
3169
- valueFormatter = (params) => FormatHelper_1.default.DateFormatter(params.value, options);
3178
+ valueFormatter = (params) => this.api.formatColumnApi.getDateFormattedValue(params.value, options);
3170
3179
  }
3171
3180
  }
3172
3181
  if (formatColumn.DisplayFormat.Formatter === 'StringFormatter') {
3173
3182
  // change the Date format - if the scope allows it
3174
3183
  if (this.api.scopeApi.isColumnInStringsScope(abColumn, formatColumn.Scope)) {
3175
3184
  const options = formatColumn.DisplayFormat.Options;
3176
- valueFormatter = (params) => FormatHelper_1.default.StringFormatter(params.value, options);
3185
+ valueFormatter = (params) => this.api.formatColumnApi.getStringFormattedValue(params.value, options);
3177
3186
  }
3178
3187
  }
3179
3188
  return valueFormatter;
@@ -165,6 +165,7 @@ class agGridHelper {
165
165
  const abColumn = {
166
166
  Uuid: Uuid_1.createUuid(),
167
167
  columnId: ColumnId,
168
+ field: colDef.field,
168
169
  friendlyName: FriendlyName,
169
170
  isPrimaryKey: ColumnId === pkColumn,
170
171
  dataType: this.getColumnDataType(agGridColumn, false),
@@ -38,12 +38,19 @@ function BaseEditorInput(props) {
38
38
  React.createElement("i", null, " (click for more details)")),
39
39
  React.createElement(rebass_1.Text, { marginLeft: 3, style: { fontStyle: 'italic' } }, parserExceptionDetails)));
40
40
  };
41
+ const testRowNode = react_1.useMemo(() => {
42
+ const firstRowNode = props.api.gridApi.getFirstRowNode();
43
+ // clone the class instance to still keep the prototype methods
44
+ return Object.assign(Object.create(Object.getPrototypeOf(firstRowNode)), firstRowNode);
45
+ }, []);
41
46
  try {
42
47
  // explicitly parsing & evaluating the expression because we need full control of the resulted AST
43
48
  const expr = parser.parse(props.value || '');
44
49
  try {
50
+ testRowNode.data = testData;
45
51
  result = expr.evaluate({
46
- node: { data: testData },
52
+ // we need a fully-fledged rowNode as Adaptable accesses internal methods of it
53
+ node: testRowNode,
47
54
  api: props.api,
48
55
  functions: expressionFunctions,
49
56
  });
@@ -48,6 +48,57 @@ function ExpressionEditor(props) {
48
48
  const queryableColumns = type === 'scalar' || type === 'boolean'
49
49
  ? props.columns
50
50
  : props.columns.filter((c) => !props.api.columnApi.isCalculatedColumn(c.columnId));
51
+ // borrowed from https://github.com/ag-grid/ag-grid/blob/v27.2.1/community-modules/core/src/ts/utils/object.ts#L205
52
+ const getColValue = (column) => {
53
+ var _a, _b;
54
+ const columnValueKey = (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId;
55
+ const isColumnValueContainsDots = (_b = column.field) === null || _b === void 0 ? void 0 : _b.includes('.');
56
+ // if no '.', then it's not a deep value
57
+ if (!isColumnValueContainsDots) {
58
+ return data[columnValueKey];
59
+ }
60
+ // otherwise it is a deep value, so need to dig for it
61
+ const fields = columnValueKey.split('.');
62
+ let currentObject = data;
63
+ for (let i = 0; i < fields.length; i++) {
64
+ if (currentObject == null) {
65
+ return undefined;
66
+ }
67
+ currentObject = currentObject[fields[i]];
68
+ }
69
+ return currentObject;
70
+ };
71
+ // borrowed from https://github.com/ag-grid/ag-grid/blob/v27.2.1/community-modules/core/src/ts/valueService/valueService.ts#L217
72
+ const updateColValue = (rowData, column, newValue) => {
73
+ var _a, _b;
74
+ const columnValueKey = (_a = column.field) !== null && _a !== void 0 ? _a : column.columnId;
75
+ const isColumnValueContainsDots = (_b = column.field) === null || _b === void 0 ? void 0 : _b.includes('.');
76
+ // if no '.', then it's not a deep value
77
+ if (!isColumnValueContainsDots) {
78
+ rowData[columnValueKey] = newValue;
79
+ }
80
+ else {
81
+ // otherwise it is a deep value, so need to dig for it
82
+ const fieldPieces = columnValueKey.split('.');
83
+ let currentObject = rowData;
84
+ while (fieldPieces.length > 0 && currentObject) {
85
+ const fieldPiece = fieldPieces.shift();
86
+ if (fieldPieces.length === 0) {
87
+ currentObject[fieldPiece] = newValue;
88
+ }
89
+ else {
90
+ currentObject = currentObject[fieldPiece];
91
+ }
92
+ }
93
+ }
94
+ return Object.assign({}, rowData);
95
+ };
96
+ const getColDateValue = (column) => {
97
+ const colValue = getColValue(column);
98
+ return colValue && DateHelper_1.isValueValidDate(colValue)
99
+ ? new Date(colValue).toISOString().substr(0, 10)
100
+ : '';
101
+ };
51
102
  const dataTableEditor = (React.createElement(React.Fragment, null,
52
103
  React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start", style: { marginTop: 2 } },
53
104
  React.createElement(CheckBox_1.CheckBox, { checked: showColumnIds, onChange: (checked) => setShowColumnIds(checked), style: {
@@ -61,11 +112,9 @@ function ExpressionEditor(props) {
61
112
  cursor: 'grab',
62
113
  marginRight: 'var(--ab-space-1)',
63
114
  }, data: `[${column.columnId}]`, "data-name": "column", icon: "drag" },
64
- React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start" }, showColumnIds ? `[${column.columnId}]` : column.friendlyName)) }, column.dataType === 'Number' ? (React.createElement(Input_1.default, { type: "number", "data-name": "column-input", value: data[column.columnId], onChange: (e) => setData(Object.assign(Object.assign({}, data), { [column.columnId]: Number(e.target.value) })), width: "100%", disabled: column.readOnly })) : column.dataType === 'String' ? (React.createElement(Input_1.default, { type: "text", "data-name": "column-input", value: data[column.columnId], onChange: (e) => setData(Object.assign(Object.assign({}, data), { [column.columnId]: e.target.value })), width: "100%", disabled: column.readOnly })) : column.dataType === 'Date' ? (React.createElement(AdaptableInput_1.default, { type: "date", "data-name": "column-input", value: data[column.columnId] && DateHelper_1.isValueValidDate(data[column.columnId])
65
- ? new Date(data[column.columnId]).toISOString().substr(0, 10)
66
- : '', onChange: (e) => {
67
- setData(Object.assign(Object.assign({}, data), { [column.columnId]: new Date(e.target.value) }));
68
- }, style: { width: '100%' }, disabled: column.readOnly })) : column.dataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": "column-input", checked: data[column.columnId], onChange: (checked) => setData(Object.assign(Object.assign({}, data), { [column.columnId]: checked })), disabled: column.readOnly })) : null))))));
115
+ React.createElement(rebass_1.Flex, { flexDirection: "column", alignItems: "start" }, showColumnIds ? `[${column.columnId}]` : column.friendlyName)) }, column.dataType === 'Number' ? (React.createElement(Input_1.default, { type: "number", "data-name": "column-input", value: getColValue(column), onChange: (e) => setData(updateColValue(data, column, Number(e.target.value))), width: "100%", disabled: column.readOnly })) : column.dataType === 'String' ? (React.createElement(Input_1.default, { type: "text", "data-name": "column-input", value: getColValue(column), onChange: (e) => setData(updateColValue(data, column, e.target.value)), width: "100%", disabled: column.readOnly })) : column.dataType === 'Date' ? (React.createElement(AdaptableInput_1.default, { type: "date", "data-name": "column-input", value: getColDateValue(column), onChange: (e) => {
116
+ setData(updateColValue(data, column, new Date(e.target.value)));
117
+ }, style: { width: '100%' }, disabled: column.readOnly })) : column.dataType === 'Boolean' ? (React.createElement(CheckBox_1.CheckBox, { "data-name": "column-input", checked: getColValue(column), onChange: (checked) => setData(updateColValue(data, column, checked)), disabled: column.readOnly })) : null))))));
69
118
  const namedQueries = (React.createElement("div", null, props.namedQueries.map((namedQuery) => (React.createElement(rebass_1.Flex, { key: namedQuery.Uuid, flexDirection: "column", alignItems: "start", style: {
70
119
  padding: 3,
71
120
  marginTop: 'var(--ab-space-2)',