@adaptabletools/adaptable 12.0.2 → 12.0.5

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 (69) hide show
  1. package/bundle.cjs.js +100 -100
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableOptions/EditOptions.d.ts +6 -9
  6. package/src/AdaptableOptions/ExportOptions.d.ts +18 -3
  7. package/src/AdaptableOptions/Glue42PluginOptions.d.ts +1 -1
  8. package/src/AdaptableOptions/IPushPullPluginOptions.d.ts +1 -3
  9. package/src/Api/Events/SearchChanged.d.ts +1 -1
  10. package/src/Api/FinanceApi.d.ts +8 -8
  11. package/src/Api/FormatColumnApi.d.ts +5 -0
  12. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +1 -0
  13. package/src/Api/Implementation/FormatColumnApiImpl.js +23 -1
  14. package/src/Api/Implementation/InternalApiImpl.js +1 -2
  15. package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -0
  16. package/src/Api/Implementation/LayoutApiImpl.js +7 -1
  17. package/src/Api/LayoutApi.d.ts +5 -0
  18. package/src/Api/StatusBarApi.d.ts +3 -0
  19. package/src/PredefinedConfig/ChartingState.d.ts +1 -1
  20. package/src/PredefinedConfig/Common/CellSummary.d.ts +3 -0
  21. package/src/PredefinedConfig/Common/ColumnFilter.d.ts +9 -0
  22. package/src/PredefinedConfig/Common/FDC3Context.d.ts +12 -3
  23. package/src/PredefinedConfig/Common/FilterActionOnDataChange.d.ts +1 -2
  24. package/src/PredefinedConfig/Common/FilterActionOnDataChange.js +1 -2
  25. package/src/PredefinedConfig/ExportState.d.ts +6 -0
  26. package/src/PredefinedConfig/FormatColumnState.d.ts +4 -1
  27. package/src/PredefinedConfig/IPushPullState.d.ts +16 -5
  28. package/src/PredefinedConfig/LayoutState.d.ts +1 -1
  29. package/src/PredefinedConfig/ScheduleState.d.ts +1 -1
  30. package/src/PredefinedConfig/ShortcutState.d.ts +1 -1
  31. package/src/PredefinedConfig/TeamSharingState.d.ts +6 -0
  32. package/src/Redux/ActionsReducers/GridRedux.d.ts +30 -1
  33. package/src/Redux/ActionsReducers/GridRedux.js +105 -2
  34. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +10 -11
  35. package/src/Redux/ActionsReducers/LayoutRedux.js +10 -10
  36. package/src/Redux/Store/AdaptableStore.js +43 -8
  37. package/src/Strategy/FormatColumnModule.js +1 -1
  38. package/src/Strategy/LayoutModule.js +2 -1
  39. package/src/Utilities/Constants/GeneralConstants.d.ts +1 -0
  40. package/src/Utilities/Constants/GeneralConstants.js +3 -2
  41. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +3 -0
  42. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +4 -4
  43. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +3 -0
  44. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +7 -7
  45. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +3 -0
  46. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +26 -4
  47. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +5 -5
  48. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +3 -0
  49. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +11 -11
  50. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +3 -0
  51. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +2 -2
  52. package/src/Utilities/Helpers/FormatHelper.js +3 -2
  53. package/src/Utilities/Helpers/Helper.js +1 -1
  54. package/src/Utilities/ObjectFactory.js +1 -1
  55. package/src/Utilities/Services/QueryLanguageService.js +4 -4
  56. package/src/View/Filter/FilterSummary.d.ts +1 -1
  57. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +1 -2
  58. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +30 -27
  59. package/src/View/Layout/LayoutViewPanel.d.ts +2 -2
  60. package/src/View/Layout/LayoutViewPanel.js +5 -5
  61. package/src/View/Layout/SaveLayoutButton.d.ts +2 -0
  62. package/src/View/Layout/SaveLayoutButton.js +30 -0
  63. package/src/components/ExpressionEditor/BaseEditorInput.js +1 -1
  64. package/src/metamodel/adaptable.metamodel.d.ts +149 -6
  65. package/src/metamodel/adaptable.metamodel.js +1 -1
  66. package/src/parser/src/types.d.ts +2 -6
  67. package/src/types.d.ts +1 -1
  68. package/version.d.ts +1 -1
  69. package/version.js +1 -1
@@ -19,12 +19,12 @@ const getStringValue = (context, stringArgument) => {
19
19
  return exports.isTextSearchCaseInsensitive(context) ? stringArgument.toLowerCase() : stringArgument;
20
20
  };
21
21
  exports.getStringValue = getStringValue;
22
- const isTextSearchCaseInsensitive = (context) => !context.api.internalApi.isTextComparisonCaseSensitive();
22
+ const isTextSearchCaseInsensitive = (context) => !context.adaptableApi.internalApi.isTextComparisonCaseSensitive();
23
23
  exports.isTextSearchCaseInsensitive = isTextSearchCaseInsensitive;
24
24
  // returns an observable which filters the source$ emissions and emits only if the CellDataChangedInfo relates to the given column
25
25
  // optionally, if a filter function (where clause) is provided, it is also evaluated
26
26
  const getDataChangeLog$ = (context, columnNameFilter) => {
27
- let dataChangeLog$ = context.api.internalApi.getDataService().dataChangeLog$;
27
+ let dataChangeLog$ = context.adaptableApi.internalApi.getDataService().dataChangeLog$;
28
28
  // filter only the given column changes
29
29
  dataChangeLog$ = dataChangeLog$.pipe(operators_1.filter((dataChangeLog) => dataChangeLog.column.columnId === columnNameFilter));
30
30
  // filter based on the WHERE clause
@@ -41,14 +41,14 @@ const handleWhereFunction = (args, context) => {
41
41
  // whereClauseResult
42
42
  return evaluator_1.evaluateNode(whereClauseExpressionNode, {
43
43
  node: rowNode,
44
- api: context.api,
44
+ adaptableApi: context.adaptableApi,
45
45
  functions: context.whereClauseFunctions,
46
46
  });
47
47
  };
48
48
  // observableExpressionResult
49
49
  return evaluator_1.evaluateNode(reactiveExpressionNode, {
50
50
  node: context.node,
51
- api: context.api,
51
+ adaptableApi: context.adaptableApi,
52
52
  functions: context.functions,
53
53
  filterFn,
54
54
  });
@@ -76,7 +76,7 @@ const handleColumnFunction = (args, context) => {
76
76
  if (StringExtensions_1.default.IsNullOrEmpty(args[0])) {
77
77
  throw new ExpressionEvaluationError_1.ExpressionEvaluationError('COL', `no column name is provided`);
78
78
  }
79
- validateColumnId(args[0], context.api);
79
+ validateColumnId(args[0], context.adaptableApi);
80
80
  const result = {
81
81
  type: 'config',
82
82
  name: 'COL',
@@ -1,4 +1,7 @@
1
1
  import { ExpressionFunction } from '../../parser/src/types';
2
+ /**
3
+ * List of all the Observable Functions available in AdaptableQL
4
+ */
2
5
  export declare type ObservableFunctionName = 'WHERE' | 'COL' | 'TIMEFRAME' | ObservableFunction | ChangeFunction;
3
6
  declare type ObservableFunction = 'ROW_CHANGE' | 'GRID_CHANGE';
4
7
  declare type ChangeFunction = 'MAX' | 'MIN' | 'NONE' | 'COUNT';
@@ -32,12 +32,12 @@ exports.observableExpressionFunctions = {
32
32
  return getDataChangeCount$(dataChangeLog$, timeframeChange$, operandParameter.value);
33
33
  }
34
34
  case 'MIN': {
35
- expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MIN', context.api);
35
+ expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MIN', context.adaptableApi);
36
36
  const timeframeChange$ = getTrailingRowValueChange$(dataChangeLog$, timeframeParameter.value);
37
37
  return getDataChangeMin$(dataChangeLog$, timeframeChange$);
38
38
  }
39
39
  case 'MAX': {
40
- expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MAX', context.api);
40
+ expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MAX', context.adaptableApi);
41
41
  const timeframeChange$ = getTrailingRowValueChange$(dataChangeLog$, timeframeParameter.value);
42
42
  return getDataChangeMax$(dataChangeLog$, timeframeChange$);
43
43
  }
@@ -71,12 +71,12 @@ exports.observableExpressionFunctions = {
71
71
  return getDataChangeCount$(dataChangeLog$, timeframeChange$, operandParameter.value);
72
72
  }
73
73
  case 'MIN': {
74
- expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MIN', context.api);
74
+ expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MIN', context.adaptableApi);
75
75
  const timeframeChange$ = getTrailingGridValueChange$(dataChangeLog$, timeframeParameter.value);
76
76
  return getDataChangeMin$(dataChangeLog$, timeframeChange$);
77
77
  }
78
78
  case 'MAX': {
79
- expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MAX', context.api);
79
+ expressionFunctionUtils_1.validateColumnType(operandParameter.column, ['Number'], 'MAX', context.adaptableApi);
80
80
  const timeframeChange$ = getTrailingGridValueChange$(dataChangeLog$, timeframeParameter.value);
81
81
  return getDataChangeMax$(dataChangeLog$, timeframeChange$);
82
82
  }
@@ -229,11 +229,11 @@ const getDataChangedInfoStub = (context) => {
229
229
  var _a;
230
230
  let rowNodeStub;
231
231
  if (!context.filterFn) {
232
- rowNodeStub = context.api.gridApi.getFirstRowNode();
232
+ rowNodeStub = context.adaptableApi.gridApi.getFirstRowNode();
233
233
  }
234
234
  else {
235
235
  // if there is a WHERE clause defined, find the first rowNode which satisfies the condition
236
- context.api.internalApi.forAllRowNodesDo((rowNode) => {
236
+ context.adaptableApi.internalApi.forAllRowNodesDo((rowNode) => {
237
237
  if (!rowNodeStub) {
238
238
  if (context.filterFn(rowNode)) {
239
239
  rowNodeStub = rowNode;
@@ -243,10 +243,10 @@ const getDataChangedInfoStub = (context) => {
243
243
  }
244
244
  const rowNode = rowNodeStub;
245
245
  if (rowNode) {
246
- const primaryKeyValue = context.api.gridApi.getPrimaryKeyValueForRowNode(rowNode);
247
- const columnId = (_a = context.api.columnApi.getQueryableColumns()[0]) === null || _a === void 0 ? void 0 : _a.columnId;
248
- const oldValue = context.api.gridApi.getCellRawValue(primaryKeyValue, columnId);
249
- const column = context.api.columnApi.getColumnFromId(columnId);
246
+ const primaryKeyValue = context.adaptableApi.gridApi.getPrimaryKeyValueForRowNode(rowNode);
247
+ const columnId = (_a = context.adaptableApi.columnApi.getQueryableColumns()[0]) === null || _a === void 0 ? void 0 : _a.columnId;
248
+ const oldValue = context.adaptableApi.gridApi.getCellRawValue(primaryKeyValue, columnId);
249
+ const column = context.adaptableApi.columnApi.getColumnFromId(columnId);
250
250
  const newValue = oldValue;
251
251
  return {
252
252
  changedAt: Date.now(),
@@ -417,7 +417,7 @@ const getSlidingTimeframe$ = (source$, timeframeDuration, onTimeframeEnter, onTi
417
417
  }));
418
418
  };
419
419
  const getMaxTimeframeSize = (expressionValue, context) => {
420
- let maxTimeframeSize = context.api.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
420
+ let maxTimeframeSize = context.adaptableApi.internalApi.getAdaptableOptions().adaptableQLOptions.expressionOptions
421
421
  .maxTimeframeSize;
422
422
  if (maxTimeframeSize > SYSTEM_MAX_TIMEFRAME_SIZE) {
423
423
  maxTimeframeSize = SYSTEM_MAX_TIMEFRAME_SIZE;
@@ -1,3 +1,6 @@
1
1
  import { ExpressionFunction } from '../../parser/src/types';
2
+ /**
3
+ * List of all the Scalar Functions available in AdaptableQL
4
+ */
2
5
  export declare type ScalarFunctionName = 'ADD' | 'SUB' | 'MUL' | 'DIV' | 'MOD' | 'POW' | 'MIN' | 'MAX' | 'AVG' | 'DATE' | 'NOW' | 'TODAY' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR' | 'ADD_DAYS' | 'ADD_WEEKS' | 'ADD_MONTHS' | 'ADD_YEARS' | 'DIFF_DAYS' | 'DIFF_WEEKS' | 'DIFF_MONTHS' | 'DIFF_YEARS' | 'SUB_STRING' | 'REPLACE' | 'COALESCE' | 'LEN' | 'UPPER' | 'LOWER' | 'CONCAT' | 'IF' | 'COL';
3
6
  export declare const scalarExpressionFunctions: Record<ScalarFunctionName, ExpressionFunction>;
@@ -95,14 +95,14 @@ exports.scalarExpressionFunctions = {
95
95
  handler(args, context) {
96
96
  var _a, _b;
97
97
  const columnId = args[0];
98
- const column = (_a = context.api) === null || _a === void 0 ? void 0 : _a.columnApi.getColumnFromId(columnId);
98
+ const column = (_a = context.adaptableApi) === null || _a === void 0 ? void 0 : _a.columnApi.getColumnFromId(columnId);
99
99
  if (!column) {
100
100
  throw new ExpressionEvaluationError_1.ExpressionEvaluationError('COL', `Column name "${columnId}" is not found`);
101
101
  }
102
102
  if (!column.queryable) {
103
103
  throw new ExpressionEvaluationError_1.ExpressionEvaluationError('COL', `Column name "${columnId}" is not queryable`);
104
104
  }
105
- return (_b = context.api) === null || _b === void 0 ? void 0 : _b.gridApi.getRawValueFromRowNode(context.node, columnId);
105
+ return (_b = context.adaptableApi) === null || _b === void 0 ? void 0 : _b.gridApi.getRawValueFromRowNode(context.node, columnId);
106
106
  },
107
107
  description: 'Returns the value of a column',
108
108
  signatures: ['[colName]', 'COL(name: string)'],
@@ -6,6 +6,7 @@ const tslib_1 = require("tslib");
6
6
  // import dateFnsFormat from 'date-fns/format';
7
7
  const format_1 = tslib_1.__importDefault(require("date-fns/format"));
8
8
  const sentence_case_1 = require("sentence-case");
9
+ const GeneralConstants_1 = require("../Constants/GeneralConstants");
9
10
  function Format(input, format) {
10
11
  if (format.Formatter === 'NumberFormatter') {
11
12
  return NumberFormatter(input, format.Options);
@@ -71,7 +72,7 @@ function NumberFormatter(input, options = {}) {
71
72
  }
72
73
  exports.NumberFormatter = NumberFormatter;
73
74
  function DateFormatter(input, options) {
74
- if (input == null || input == undefined) {
75
+ if (input == null || input == undefined || input == 'Invalid Date') {
75
76
  return undefined;
76
77
  }
77
78
  try {
@@ -79,7 +80,7 @@ function DateFormatter(input, options) {
79
80
  if (typeof input === 'string') {
80
81
  input = new Date(input);
81
82
  }
82
- return format_1.default(input, options.Pattern || '');
83
+ return format_1.default(input, (options === null || options === void 0 ? void 0 : options.Pattern) || GeneralConstants_1.DEFAULT_DATE_FORMAT_PATTERN);
83
84
  }
84
85
  catch (error) {
85
86
  return input;
@@ -128,7 +128,7 @@ function ReturnItemCount(items, itemName) {
128
128
  }
129
129
  exports.ReturnItemCount = ReturnItemCount;
130
130
  function IsInputNullOrEmpty(itemToCheck) {
131
- if (itemToCheck == 'Invalid Date') {
131
+ if (itemToCheck == 'Invalid Date ') {
132
132
  return true;
133
133
  }
134
134
  if (typeof itemToCheck === 'string') {
@@ -304,7 +304,7 @@ function CreateEmptyFreeTextColumn(isFilterable) {
304
304
  }
305
305
  exports.CreateEmptyFreeTextColumn = CreateEmptyFreeTextColumn;
306
306
  function CreateEmptyLayout(layout, adaptableColumns) {
307
- return Object.assign(Object.assign({}, layout), { Uuid: Uuid_1.createUuid(), Columns: layout.Columns || [], ColumnSorts: layout.ColumnSorts || [],
307
+ return Object.assign(Object.assign({}, layout), { Uuid: Uuid_1.createUuid(), Columns: layout.Columns || [], ColumnSorts: layout.ColumnSorts || [], ColumnFilters: layout.ColumnFilters || [],
308
308
  // ColumnFlexMap: layout.ColumnFlexMap || {},
309
309
  ColumnWidthMap: layout.ColumnWidthMap || {}, RowGroupedColumns: layout.RowGroupedColumns ||
310
310
  (adaptableColumns ? adaptableColumns.filter((c) => c.isGrouped).map((c) => c.columnId) : []) });
@@ -19,7 +19,7 @@ class QueryLanguageService {
19
19
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
20
20
  return parser.evaluate(expression, {
21
21
  node: rowNode,
22
- api: this.adaptableApi,
22
+ adaptableApi: this.adaptableApi,
23
23
  functions: booleanAndScalarFunctions,
24
24
  });
25
25
  }
@@ -31,7 +31,7 @@ class QueryLanguageService {
31
31
  const aggregatedScalarFunctions = this.getModuleExpressionFunctions(module).aggregatedScalarFunctions;
32
32
  return parser.evaluate(expression, {
33
33
  node: null,
34
- api: this.adaptableApi,
34
+ adaptableApi: this.adaptableApi,
35
35
  functions: aggregatedScalarFunctions,
36
36
  });
37
37
  }
@@ -40,7 +40,7 @@ class QueryLanguageService {
40
40
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
41
41
  const reactiveExpression$ = parser.evaluate(reactiveExpression, {
42
42
  node: reactiveExpression,
43
- api: this.adaptableApi,
43
+ adaptableApi: this.adaptableApi,
44
44
  functions: moduleExpressionFunctions.observableFunctions,
45
45
  whereClauseFunctions: booleanAndScalarFunctions,
46
46
  });
@@ -51,7 +51,7 @@ class QueryLanguageService {
51
51
  const booleanAndScalarFunctions = this.getBooleanAndScalarFunctions(moduleExpressionFunctions);
52
52
  const aggregationExpression$ = parser.evaluate(aggregationExpression, {
53
53
  node: aggregationExpression,
54
- api: this.adaptableApi,
54
+ adaptableApi: this.adaptableApi,
55
55
  functions: moduleExpressionFunctions.aggregatedBooleanFunctions,
56
56
  whereClauseFunctions: booleanAndScalarFunctions,
57
57
  });
@@ -5,7 +5,7 @@ import * as LayoutRedux from '../../Redux/ActionsReducers/LayoutRedux';
5
5
  import { ColumnFilter } from '../../types';
6
6
  export interface FilterSummaryProps extends Omit<ModuleSummaryProps<FilterSummaryComponent>, 'onClosePopup' | 'modalContainer'> {
7
7
  ColumnFilters: ColumnFilter[];
8
- onClearFilter: (columnFilter: ColumnFilter) => LayoutRedux.LayoutFilterClearAction;
8
+ onClearFilter: (columnFilter: ColumnFilter) => LayoutRedux.LayoutColumnFilterClearAction;
9
9
  }
10
10
  export declare class FilterSummaryComponent extends React.Component<FilterSummaryProps, EditableConfigEntityState> {
11
11
  constructor(props: FilterSummaryProps);
@@ -3,7 +3,6 @@ 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';
7
6
  export declare type FormatColumnFormatWizardSectionProps = {
8
7
  onChange: (data: FormatColumn) => void;
9
8
  };
@@ -11,7 +10,7 @@ export interface FormatColumnFormatWizardState {
11
10
  DisplayFormat: AdaptableFormat;
12
11
  NumericFormat?: 'Percent' | 'Thousand' | 'Million' | 'Dollar' | 'Sterling' | undefined;
13
12
  }
14
- export declare const getFormatColumnFormatSummaryValue: (data: FormatColumn, formattedColumnApi: FormatColumnApi) => string;
13
+ export declare const getFormatColumnFormatSummaryValue: (data: FormatColumn, api: AdaptableApi) => string;
15
14
  export declare const renderFormatColumnFormatSummary: (data: FormatColumn, api: AdaptableApi) => JSX.Element;
16
15
  export declare const getFormatDisplayTypeForScope: (scope: AdaptableScope, api: AdaptableApi) => 'Number' | 'Date' | 'String' | undefined;
17
16
  export declare const FormatColumnFormatWizardSection: (props: FormatColumnFormatWizardSectionProps) => JSX.Element;
@@ -78,7 +78,7 @@ const DateFormatPresets = [
78
78
  'yyyyMMdd',
79
79
  'HH:mm:ss',
80
80
  ];
81
- const getFormatColumnFormatSummaryValue = (data, formattedColumnApi) => {
81
+ const getFormatColumnFormatSummaryValue = (data, api) => {
82
82
  let content = 'N/A';
83
83
  if (!data.DisplayFormat) {
84
84
  content = 'N/A';
@@ -86,24 +86,17 @@ const getFormatColumnFormatSummaryValue = (data, formattedColumnApi) => {
86
86
  else {
87
87
  if (data.DisplayFormat.Formatter === 'NumberFormatter') {
88
88
  content = FormatHelper_1.default.NumberFormatter(12345.6789, data.DisplayFormat.Options);
89
- //formattedColumnApi.getNumberFormattedValue(12345.6789, data.DisplayFormat.Options);
90
89
  }
91
90
  if (data.DisplayFormat.Formatter === 'DateFormatter') {
92
- content = FormatHelper_1.default.DateFormatter(new Date(), data.DisplayFormat.Options);
93
- //formattedColumnApi.getDateFormattedValue(new Date(), data.DisplayFormat.Options);
91
+ content = FormatHelper_1.default.DateFormatter(new Date(2022, 0, 1), data.DisplayFormat.Options);
94
92
  }
95
93
  if (data.DisplayFormat.Formatter === 'StringFormatter') {
96
94
  content = FormatHelper_1.default.StringFormatter('Hello World ', data.DisplayFormat.Options);
97
- //formattedColumnApi.getStringFormattedValue('Hello World ', data.DisplayFormat.Options);
98
95
  }
99
96
  }
100
97
  return content;
101
98
  };
102
99
  exports.getFormatColumnFormatSummaryValue = getFormatColumnFormatSummaryValue;
103
- function splitArrayInTwo(arr) {
104
- const half = Math.floor(arr.length - 1 / 2);
105
- return [arr.slice(0, half), arr.slice(half)];
106
- }
107
100
  const renderCustomFormatter = (data, customFormatter, setFormatOption) => {
108
101
  var _a, _b, _c;
109
102
  return (React.createElement(FormLayout_1.FormRow, { key: customFormatter.id, label: (_a = customFormatter.label) !== null && _a !== void 0 ? _a : customFormatter.id },
@@ -120,7 +113,7 @@ const renderCustomFormatter = (data, customFormatter, setFormatOption) => {
120
113
  } })));
121
114
  };
122
115
  const renderFormatColumnFormatSummary = (data, api) => {
123
- return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data, api.formatColumnApi));
116
+ return React.createElement(Tag_1.Tag, null, exports.getFormatColumnFormatSummaryValue(data, api));
124
117
  };
125
118
  exports.renderFormatColumnFormatSummary = renderFormatColumnFormatSummary;
126
119
  const getFormatDisplayTypeForScope = (scope, api) => {
@@ -157,7 +150,7 @@ const getFormatDisplayTypeForScope = (scope, api) => {
157
150
  return undefined;
158
151
  };
159
152
  exports.getFormatDisplayTypeForScope = getFormatDisplayTypeForScope;
160
- const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
153
+ const renderDateFormat = (data, _onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
161
154
  if (data.DisplayFormat.Formatter !== 'DateFormatter') {
162
155
  return null;
163
156
  }
@@ -173,9 +166,12 @@ const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, fo
173
166
  React.createElement(FormLayout_1.default, null,
174
167
  React.createElement(FormLayout_1.FormRow, { label: "Pattern" },
175
168
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Pattern, onChange: (e) => setFormatOption('Pattern', e.currentTarget.value), mr: 2 }),
176
- React.createElement("span", null, FormatHelper_1.default.DateFormatter(new Date(), data.DisplayFormat.Options))),
177
- customFormatters.map((formatter) => renderCustomFormatter(data, formatter, setFormatOption))))),
178
- 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 },
179
175
  React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
180
176
  React.createElement(Tabs_1.Tabs.Content, null,
181
177
  React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { style: { fontWeight: 'bold' }, colItems: [
@@ -195,7 +191,7 @@ const renderDateFormat = (data, _onChange, setFormatOption, customFormatters, fo
195
191
  },
196
192
  ] })))))));
197
193
  };
198
- const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, formatColumnApi) => {
194
+ const renderNumberFormat = (data, onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
199
195
  if (data.DisplayFormat.Formatter !== 'NumberFormatter') {
200
196
  return null;
201
197
  }
@@ -247,7 +243,6 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
247
243
  data.DisplayFormat.Options.Multiplier === MILLION_OPTIONS.Multiplier; //isEqual(data.DisplayFormat.Options, MILLION_OPTIONS);
248
244
  const IS_DOLLAR = data.DisplayFormat.Options.Prefix === '$'; //isEqual(data.DisplayFormat.Options, DOLLAR_OPTIONS);
249
245
  const IS_STERLING = data.DisplayFormat.Options.Prefix === '£'; //isEqual(data.DisplayFormat, STERLING_OPTIONS);
250
- const [leftCustomFormatters, rightCustomFormatters] = splitArrayInTwo(customFormatters);
251
246
  return (React.createElement(rebass_1.Box, { "data-name": 'format-column-display-format', padding: 2 },
252
247
  React.createElement(Tabs_1.Tabs, null,
253
248
  React.createElement(Tabs_1.Tabs.Tab, null, "Format"),
@@ -261,8 +256,7 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
261
256
  React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
262
257
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
263
258
  React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
264
- React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
265
- 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) }))),
266
260
  React.createElement(FormLayout_1.default, null,
267
261
  React.createElement(FormLayout_1.FormRow, { label: "Fraction Digits" },
268
262
  React.createElement(Input_1.default, { type: "number", min: "0",
@@ -279,8 +273,12 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
279
273
  React.createElement(FormLayout_1.FormRow, { label: "Parentheses" },
280
274
  React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Parentheses, onChange: (checked) => setFormatOption('Parentheses', checked) })),
281
275
  React.createElement(FormLayout_1.FormRow, { label: "Truncate" },
282
- React.createElement(CheckBox_1.CheckBox, { checked: data.DisplayFormat.Options.Truncate, onChange: (checked) => setFormatOption('Truncate', checked) })),
283
- 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))))))),
284
282
  React.createElement(Tabs_1.Tabs, { marginTop: 2, autoFocus: false, keyboardNavigation: false },
285
283
  React.createElement(Tabs_1.Tabs.Tab, null, "Presets"),
286
284
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -322,10 +320,11 @@ const renderNumberFormat = (data, onChange, setFormatOption, customFormatters, f
322
320
  },
323
321
  ] })))));
324
322
  };
325
- const renderStringFormat = (data, _onChange, setFormatOption, customFormatters, formatColumnApi) => {
323
+ const renderStringFormat = (data, _onChange, setFormatOption, scopedCustomFormatters, formatColumnApi) => {
326
324
  if (data.DisplayFormat.Formatter !== 'StringFormatter') {
327
325
  return null;
328
326
  }
327
+ console.log('formatters', scopedCustomFormatters);
329
328
  return (React.createElement(rebass_1.Box, { "data-name": 'format-column-display-format', padding: 2 },
330
329
  React.createElement(Tabs_1.Tabs, null,
331
330
  React.createElement(Tabs_1.Tabs.Tab, null, "Format"),
@@ -341,8 +340,12 @@ const renderStringFormat = (data, _onChange, setFormatOption, customFormatters,
341
340
  React.createElement(FormLayout_1.FormRow, { label: "Prefix" },
342
341
  React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Prefix, onChange: (e) => setFormatOption('Prefix', e.currentTarget.value) })),
343
342
  React.createElement(FormLayout_1.FormRow, { label: "Suffix" },
344
- React.createElement(Input_1.default, { value: data.DisplayFormat.Options.Suffix, onChange: (e) => setFormatOption('Suffix', e.currentTarget.value) })),
345
- 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))))))),
346
349
  React.createElement(Tabs_1.Tabs, { marginTop: 2, keyboardNavigation: false },
347
350
  React.createElement(Tabs_1.Tabs.Tab, null, "Example"),
348
351
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -376,15 +379,15 @@ const FormatColumnFormatWizardSection = (props) => {
376
379
  update({ DisplayFormat });
377
380
  };
378
381
  const Type = data.DisplayFormat && data.DisplayFormat.Formatter;
379
- 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));
380
383
  if (Type === 'NumberFormatter') {
381
- return renderNumberFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
384
+ return renderNumberFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
382
385
  }
383
386
  if (Type === 'DateFormatter') {
384
- return renderDateFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
387
+ return renderDateFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
385
388
  }
386
389
  if (Type === 'StringFormatter') {
387
- return renderStringFormat(data, update, setFormatOption, customNumberFormatters, formatColumnApi);
390
+ return renderStringFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
388
391
  }
389
392
  return (React.createElement(HelpBlock_1.default, { margin: 3 },
390
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;
@@ -51,7 +51,7 @@ function BaseEditorInput(props) {
51
51
  result = expr.evaluate({
52
52
  // we need a fully-fledged rowNode as Adaptable accesses internal methods of it
53
53
  node: testRowNode,
54
- api: props.api,
54
+ adaptableApi: props.api,
55
55
  functions: expressionFunctions,
56
56
  });
57
57
  }