@adaptabletools/adaptable 13.0.0-canary.2 → 13.0.0-canary.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 (80) hide show
  1. package/agGrid.d.ts +23 -1
  2. package/agGrid.js +23 -1
  3. package/base.css +1 -0
  4. package/bundle.cjs.js +159 -159
  5. package/index.css +1 -0
  6. package/package.json +1 -1
  7. package/publishTimestamp.d.ts +1 -1
  8. package/publishTimestamp.js +1 -1
  9. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +42 -14
  10. package/src/AdaptableOptions/GeneralOptions.d.ts +6 -0
  11. package/src/Api/ConditionalStyleApi.d.ts +20 -0
  12. package/src/Api/FormatColumnApi.d.ts +42 -3
  13. package/src/Api/Implementation/ColumnApiImpl.js +3 -3
  14. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +17 -1
  15. package/src/Api/Implementation/FormatColumnApiImpl.js +94 -14
  16. package/src/Api/Implementation/InternalApiImpl.d.ts +1 -0
  17. package/src/Api/Implementation/InternalApiImpl.js +4 -0
  18. package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +0 -2
  19. package/src/Api/Implementation/QueryLanguageApiImpl.js +0 -3
  20. package/src/Api/Implementation/ToolPanelApiImpl.d.ts +3 -1
  21. package/src/Api/Implementation/ToolPanelApiImpl.js +8 -0
  22. package/src/Api/InternalApi.d.ts +1 -0
  23. package/src/Api/QueryLanguageApi.d.ts +0 -5
  24. package/src/Api/ToolPanelApi.d.ts +10 -1
  25. package/src/PredefinedConfig/Common/AdaptablePredicate.d.ts +1 -1
  26. package/src/PredefinedConfig/Common/AdaptablePredicate.js +37 -37
  27. package/src/PredefinedConfig/FormatColumnState.d.ts +19 -0
  28. package/src/PredefinedConfig/PredefinedConfig.d.ts +1 -0
  29. package/src/Redux/ActionsReducers/FormatColumnRedux.d.ts +14 -0
  30. package/src/Redux/ActionsReducers/FormatColumnRedux.js +43 -1
  31. package/src/Redux/Store/AdaptableStore.js +2 -0
  32. package/src/Strategy/ConditionalStyleModule.d.ts +2 -0
  33. package/src/Strategy/ConditionalStyleModule.js +6 -0
  34. package/src/Strategy/FormatColumnModule.d.ts +4 -9
  35. package/src/Strategy/FormatColumnModule.js +51 -1
  36. package/src/Strategy/Interface/IModule.d.ts +1 -0
  37. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +6 -5
  38. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.d.ts +3 -2
  39. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +4 -1
  40. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.d.ts +1 -0
  41. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +4 -1
  42. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.d.ts +1 -0
  43. package/src/Utilities/ExpressionFunctions/booleanExpressionFunctions.js +4 -1
  44. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.d.ts +1 -0
  45. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +4 -1
  46. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.d.ts +1 -0
  47. package/src/Utilities/ExpressionFunctions/scalarExpressionFunctions.js +4 -1
  48. package/src/Utilities/Extensions/TypeExtensions.d.ts +1 -0
  49. package/src/Utilities/Extensions/TypeExtensions.js +5 -0
  50. package/src/Utilities/Services/Interface/IQueryLanguageService.d.ts +14 -4
  51. package/src/Utilities/Services/LicenseService.js +1 -1
  52. package/src/Utilities/Services/QueryLanguageService.d.ts +5 -3
  53. package/src/Utilities/Services/QueryLanguageService.js +92 -39
  54. package/src/Utilities/license/LicenseDetails.d.ts +1 -1
  55. package/src/Utilities/license/decode.d.ts +1 -0
  56. package/src/Utilities/license/decode.js +1 -1
  57. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +1 -0
  58. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.d.ts +2 -0
  59. package/src/View/ConditionalStyle/ConditionalStylePopupHeader.js +18 -0
  60. package/src/View/FormatColumn/MoveFormatColumn.d.ts +7 -0
  61. package/src/View/FormatColumn/MoveFormatColumn.js +27 -0
  62. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  63. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.d.ts +9 -0
  64. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +66 -0
  65. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +20 -2
  66. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +2 -1
  67. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +14 -0
  68. package/src/View/FormatColumn/Wizard/constants.d.ts +1 -0
  69. package/src/View/FormatColumn/Wizard/constants.js +4 -0
  70. package/src/agGrid/Adaptable.d.ts +5 -0
  71. package/src/agGrid/Adaptable.js +103 -45
  72. package/src/components/ExpressionEditor/BaseEditorInput.d.ts +1 -1
  73. package/src/components/ExpressionEditor/EditorInput.js +1 -1
  74. package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +1 -1
  75. package/src/metamodel/adaptable.metamodel.d.ts +47 -29
  76. package/src/metamodel/adaptable.metamodel.js +1 -1
  77. package/src/parser/src/types.d.ts +6 -3
  78. package/src/types.d.ts +2 -2
  79. package/version.d.ts +1 -1
  80. package/version.js +1 -1
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConditionalStylePopupHeader = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const HelpBlock_1 = tslib_1.__importDefault(require("../../components/HelpBlock"));
7
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
8
+ const AdaptableContext_1 = require("../AdaptableContext");
9
+ const ConditionalStylePopupHeader = () => {
10
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
11
+ return (React.createElement(HelpBlock_1.default, null,
12
+ "Conditional Styles are deprecated, use",
13
+ ' ',
14
+ React.createElement(SimpleButton_1.default, { onClick: () => adaptable.api.settingsPanelApi.showSettingsPanel('FormatColumn'), variant: "outlined" }, "Format Columns"),
15
+ ' ',
16
+ "instead."));
17
+ };
18
+ exports.ConditionalStylePopupHeader = ConditionalStylePopupHeader;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { AccessLevel, FormatColumn } from '../../types';
3
+ export declare const MoveFormatColumn: React.FunctionComponent<{
4
+ data: FormatColumn;
5
+ id?: string;
6
+ accessLevel: AccessLevel;
7
+ }>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MoveFormatColumn = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const SimpleButton_1 = tslib_1.__importDefault(require("../../components/SimpleButton"));
7
+ const FormatColumnRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/FormatColumnRedux"));
8
+ const react_redux_1 = require("react-redux");
9
+ const AdaptableContext_1 = require("../AdaptableContext");
10
+ const MoveFormatColumn = (props) => {
11
+ const dispatch = (0, react_redux_1.useDispatch)();
12
+ const adaptable = (0, AdaptableContext_1.useAdaptable)();
13
+ const formatColumn = adaptable.api.formatColumnApi.getAllFormatColumn();
14
+ const handleMoveUp = React.useCallback(() => {
15
+ dispatch(FormatColumnRedux.FormatColumnMoveUp(props.data));
16
+ }, []);
17
+ const handleMoveDown = React.useCallback(() => {
18
+ dispatch(FormatColumnRedux.FormatColumnMoveDown(props.data));
19
+ }, []);
20
+ if ((formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.length) <= 1) {
21
+ return React.createElement(React.Fragment, null);
22
+ }
23
+ return (React.createElement(React.Fragment, null,
24
+ React.createElement(SimpleButton_1.default, { "data-id": "move-up", title: "move up", onClick: handleMoveUp, variant: "text", icon: "arrow-up" }),
25
+ React.createElement(SimpleButton_1.default, { "data-name": "move-down", title: "move down", onClick: handleMoveDown, variant: "text", icon: "arrow-down" })));
26
+ };
27
+ exports.MoveFormatColumn = MoveFormatColumn;
@@ -125,7 +125,7 @@ const getFormatDisplayTypeForScope = (scope, api) => {
125
125
  }
126
126
  // need to see if all columns are numeric or date
127
127
  if ('ColumnIds' in scope) {
128
- const columns = scope.ColumnIds.map((c) => api.columnApi.getColumnFromId(c));
128
+ const columns = scope.ColumnIds.map((c) => api.columnApi.getColumnFromId(c)).filter(Boolean);
129
129
  const columnDataTypes = (0, uniq_1.default)(columns.map((c) => c.dataType));
130
130
  if (columnDataTypes.length == 1 && columnDataTypes[0] == 'Number') {
131
131
  return 'Number';
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FormatColumn } from '../../../../types';
3
+ declare type FormatColumnRuleWizardSectionProps = {
4
+ onChange: (data: FormatColumn) => void;
5
+ defaultPredicateId: string;
6
+ };
7
+ export declare function renderFormatColumnRuleSummary(data: FormatColumn): JSX.Element;
8
+ export declare function FormatColumnRuleWizardSection(props: FormatColumnRuleWizardSectionProps): JSX.Element;
9
+ export {};
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FormatColumnRuleWizardSection = exports.renderFormatColumnRuleSummary = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const React = tslib_1.__importStar(require("react"));
6
+ const rebass_1 = require("rebass");
7
+ const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
8
+ const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
9
+ const CodeBlock_1 = require("../../../components/CodeBlock");
10
+ const CheckBox_1 = require("../../../components/CheckBox");
11
+ const constants_1 = require("./constants");
12
+ function renderFormatColumnRuleSummary(data) {
13
+ return (React.createElement(EntityRulesEditor_1.EntityRulesSummary, { data: data, renderPredicate: (contents) => {
14
+ return (React.createElement(React.Fragment, null,
15
+ "Apply Format Column on ",
16
+ React.createElement(CodeBlock_1.CodeBlock, null, contents)));
17
+ }, renderQueryExpression: (contents) => {
18
+ return (React.createElement(React.Fragment, null,
19
+ "Apply Format Column when",
20
+ ' ',
21
+ React.createElement("b", null,
22
+ React.createElement(CodeBlock_1.CodeBlock, null, contents))));
23
+ } }));
24
+ }
25
+ exports.renderFormatColumnRuleSummary = renderFormatColumnRuleSummary;
26
+ function FormatColumnRuleWizardSection(props) {
27
+ const { data, api, moduleInfo } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
28
+ const hasRule = Boolean(data.Rule);
29
+ const handleRuleToggle = React.useCallback(() => {
30
+ const newFormatColumn = Object.assign({}, data);
31
+ if (hasRule) {
32
+ delete newFormatColumn.Rule;
33
+ }
34
+ else {
35
+ newFormatColumn.Rule = {
36
+ Predicate: {
37
+ PredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN,
38
+ },
39
+ };
40
+ }
41
+ props.onChange(newFormatColumn);
42
+ }, [data.Rule]);
43
+ const hasIncompatibleStyle = Boolean(data.ColumnStyle);
44
+ return (React.createElement(rebass_1.Box, null,
45
+ React.createElement(rebass_1.Box, { p: 2, mb: 1 },
46
+ React.createElement(CheckBox_1.CheckBox, { disabled: hasIncompatibleStyle, checked: hasRule, onClick: handleRuleToggle }, "Enable Condition"),
47
+ hasIncompatibleStyle && (React.createElement(rebass_1.Text, { ml: 1 }, "Condition is only available for Standard Style."))),
48
+ hasRule && (React.createElement(EntityRulesEditor_1.EntityRulesEditor, { module: moduleInfo.ModuleName, defaultPredicateId: props.defaultPredicateId,
49
+ // TODO see what is this
50
+ predicateDefs: api.formatColumnApi.getFormatColumnDefsForScope(data.Scope), showAggregation: false, showObservable: false, showPredicate: !api.scopeApi.scopeIsAll(data.Scope), data: data, onChange: (formatColumn) => props.onChange(formatColumn), descriptions: {
51
+ selectPredicate: 'Select a Format Column Rule - to be applied when data changes',
52
+ useBooleanQuery: (React.createElement(React.Fragment, null,
53
+ "Use an BooleanQuery if ",
54
+ React.createElement("i", null, "Scope"),
55
+ " is 'Whole Row' - so any data change may be evaluated in a complex BooleanExpression")),
56
+ useObservableQuery: (React.createElement(React.Fragment, null,
57
+ "Use an ObservableQuery if ",
58
+ React.createElement("i", null, "Scope"),
59
+ " is 'Whole Row' - so any data change may be evaluated in a complex ObservableExpression")),
60
+ useAggregationQuery: (React.createElement(React.Fragment, null,
61
+ "Use an AggregatedBooleanQuery if ",
62
+ React.createElement("i", null, "Scope"),
63
+ " is 'Whole Row' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
64
+ } }))));
65
+ }
66
+ exports.FormatColumnRuleWizardSection = FormatColumnRuleWizardSection;
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const React = tslib_1.__importStar(require("react"));
6
6
  const NewScopeComponent_1 = require("../../Components/NewScopeComponent");
7
7
  const OnePageAdaptableWizard_1 = require("../../Wizard/OnePageAdaptableWizard");
8
+ const constants_1 = require("./constants");
8
9
  const renderFormatColumnScopeSummary = (data) => {
9
10
  return (0, NewScopeComponent_1.renderScopeSummary)(data.Scope, {
10
11
  scopeWholeRow: 'Matching rows will be formatted',
@@ -14,12 +15,29 @@ const renderFormatColumnScopeSummary = (data) => {
14
15
  };
15
16
  exports.renderFormatColumnScopeSummary = renderFormatColumnScopeSummary;
16
17
  const FormatColumnScopeWizardSection = (props) => {
17
- const { data } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
18
+ const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
18
19
  return (React.createElement(NewScopeComponent_1.NewScopeComponent, { descriptions: {
19
20
  rowScope: 'Apply a style to an entire row',
20
21
  columnScope: 'Select columns to format',
21
22
  }, scope: data.Scope, updateScope: (Scope) => {
22
- props.onChange(Object.assign(Object.assign({}, data), { Scope }));
23
+ var _a;
24
+ const newData = Object.assign(Object.assign({}, data), { Scope });
25
+ const wholeRow = api.scopeApi.scopeIsAll(Scope);
26
+ if ((_a = newData.Rule) === null || _a === void 0 ? void 0 : _a.Predicate) {
27
+ if (wholeRow) {
28
+ // if scope is whole row, a predicate cannot be present, so we set the rule
29
+ // to be a boolean expression
30
+ delete newData.Rule.Predicate;
31
+ newData.Rule.BooleanExpression = '';
32
+ }
33
+ else {
34
+ // if scope is not whole row, if you have a predicate, reset it
35
+ newData.Rule.Predicate = {
36
+ PredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN,
37
+ };
38
+ }
39
+ }
40
+ props.onChange(newData);
23
41
  } }));
24
42
  };
25
43
  exports.FormatColumnScopeWizardSection = FormatColumnScopeWizardSection;
@@ -278,6 +278,7 @@ function FormatColumnStyleWizardSection(props) {
278
278
  props.onChange(newData);
279
279
  }
280
280
  };
281
+ const onlyStandardStyleAvailable = Boolean(data.Rule);
281
282
  return (React.createElement(React.Fragment, null,
282
283
  onlyBooleanColumnsInScope && (React.createElement(Tabs_1.Tabs, null,
283
284
  React.createElement(Tabs_1.Tabs.Tab, null, "CheckBox Column"),
@@ -293,7 +294,7 @@ function FormatColumnStyleWizardSection(props) {
293
294
  }
294
295
  props.onChange(formatColumn);
295
296
  } }, "Display Column As CheckBox")))),
296
- singleNumericColumn ? (React.createElement(React.Fragment, null,
297
+ singleNumericColumn && !onlyStandardStyleAvailable ? (React.createElement(React.Fragment, null,
297
298
  React.createElement(Tabs_1.Tabs, null,
298
299
  React.createElement(Tabs_1.Tabs.Tab, null, "Create a Format Column Style"),
299
300
  React.createElement(Tabs_1.Tabs.Content, null,
@@ -17,6 +17,9 @@ const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/Obje
17
17
  const react_redux_1 = require("react-redux");
18
18
  const FormatColumnRedux = tslib_1.__importStar(require("../../../Redux/ActionsReducers/FormatColumnRedux"));
19
19
  const ObjectTagsWizardSection_1 = require("../../Wizard/ObjectTagsWizardSection");
20
+ const EntityRulesEditor_1 = require("../../Components/EntityRulesEditor");
21
+ const FormatColumnRuleWizardSection_1 = require("./FormatColumnRuleWizardSection");
22
+ const constants_1 = require("./constants");
20
23
  const adjustDisplayFormat = (formatColumn, api) => {
21
24
  formatColumn = Object.assign({}, formatColumn);
22
25
  const formatDataType = (0, FormatColumnFormatWizardSection_1.getFormatDisplayTypeForScope)(formatColumn.Scope, api);
@@ -113,6 +116,17 @@ function FormatColumnWizard(props) {
113
116
  React.createElement(FormatColumnScopeWizardSection_1.FormatColumnScopeWizardSection, { onChange: setFormatColumn })));
114
117
  },
115
118
  },
119
+ {
120
+ isValid: (abObject, api, context) => {
121
+ return abObject.Rule ? (0, EntityRulesEditor_1.isRuleValid)(abObject, api, context) : true;
122
+ },
123
+ title: 'Condition',
124
+ details: 'Build the rules when Format column should be applied',
125
+ render: () => {
126
+ return (React.createElement(rebass_1.Box, { p: 2 },
127
+ React.createElement(FormatColumnRuleWizardSection_1.FormatColumnRuleWizardSection, { onChange: setFormatColumn, defaultPredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN })));
128
+ },
129
+ },
116
130
  {
117
131
  title: 'Style',
118
132
  details: 'Format Column Style',
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN = "NonBlanks";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN = void 0;
4
+ exports.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN = 'NonBlanks';
@@ -154,7 +154,11 @@ export declare class Adaptable implements IAdaptable {
154
154
  updateColumnsIntoStore(): void;
155
155
  private createAdaptableColumn;
156
156
  private safeSetColDefs;
157
+ private getFormatColumnSpecialColumnStyle;
158
+ private getFormatColumnColumnStyle;
157
159
  private getFormatColumnCellStyle;
160
+ private getFormatColumnCellClass;
161
+ private getFormatColumnRowClass;
158
162
  private getActiveAlertWithHighlightCell;
159
163
  private getActiveAlertWithHighlightRow;
160
164
  private getAlertCellStyle;
@@ -358,6 +362,7 @@ export declare class Adaptable implements IAdaptable {
358
362
  private setupColumnHeaderAggregations;
359
363
  private getConditionalStyleRowClass;
360
364
  private getConditionalStyleRowStyle;
365
+ private getFormatColumnRowStyle;
361
366
  private getGridOptionsApi;
362
367
  canGenerateCharts(): boolean;
363
368
  canHaveSparklines(): boolean;
@@ -898,51 +898,68 @@ class Adaptable {
898
898
  this.gridOptions.api.setColumnDefs(colDefs);
899
899
  this.updateColumnsIntoStore(); // todo remove this from here!!!
900
900
  }
901
- getFormatColumnCellStyle(abColumn, formatColumn, params) {
902
- if (!formatColumn.IncludeGroupedRows && this.isGroupRowNode(params.node)) {
903
- return;
901
+ getFormatColumnSpecialColumnStyle(formatColumn, abColumn, params) {
902
+ const columnStyle = formatColumn.ColumnStyle;
903
+ let style = {};
904
+ const gradientStyle = columnStyle === null || columnStyle === void 0 ? void 0 : columnStyle.GradientStyle;
905
+ if (gradientStyle) {
906
+ const min = this.api.formatColumnApi.getNumericStyleMinValue(columnStyle, abColumn, params.node, params.value);
907
+ const max = this.api.formatColumnApi.getNumericStyleMaxValue(columnStyle, abColumn, params.node, params.value);
908
+ const clampedValue = (0, clamp_1.default)(params.value, min, max);
909
+ let cellBackColor;
910
+ let reverseGradient = false;
911
+ if (gradientStyle.ColumnComparison) {
912
+ cellBackColor = gradientStyle.ColumnComparison.Color;
913
+ }
914
+ else {
915
+ const matchingRange = gradientStyle.CellRanges.find((r) => (r.Min == 'Col-Min' || r.Min <= clampedValue) &&
916
+ (r.Max == 'Col-Max' || r.Max >= clampedValue));
917
+ if (matchingRange) {
918
+ cellBackColor = matchingRange.Color;
919
+ reverseGradient = matchingRange.ReverseGradient;
920
+ }
921
+ }
922
+ const increase = Math.abs(max - min);
923
+ const percentage = ((params.value - min) / increase) * 100;
924
+ let alpha = Number((percentage / 100).toPrecision(2));
925
+ if (reverseGradient) {
926
+ alpha = 1 - alpha;
927
+ }
928
+ const preparedColor = (0, StyleHelper_1.getVariableColor)(cellBackColor);
929
+ style.backgroundColor = tinycolor(preparedColor).setAlpha(alpha).toRgbString();
904
930
  }
905
- if (formatColumn === null || formatColumn === void 0 ? void 0 : formatColumn.IsSuspended) {
906
- return;
931
+ if (columnStyle.PercentBarStyle && columnStyle.PercentBarStyle.CellText) {
932
+ style.paddingTop = 0;
933
+ style.paddingBottom = 0;
907
934
  }
935
+ return style;
936
+ }
937
+ getFormatColumnColumnStyle(formatColumns) {
938
+ // first has more precedence, then they need to be applied in reverse order
939
+ return formatColumns.reduceRight((style, formatColumn) => {
940
+ const formatColumnStyle = this.convertAdaptableStyleToCSS(formatColumn.Style);
941
+ return Object.assign(Object.assign({}, style), formatColumnStyle);
942
+ }, {});
943
+ }
944
+ getFormatColumnCellStyle(abColumn, formatColumn, formatColumnsWithStyle, params) {
908
945
  let style = {};
909
946
  // percent bar && do we show text
910
947
  const columnStyle = formatColumn.ColumnStyle;
911
948
  if (columnStyle) {
912
- const gradientStyle = columnStyle === null || columnStyle === void 0 ? void 0 : columnStyle.GradientStyle;
913
- if (gradientStyle) {
914
- const min = this.api.formatColumnApi.getNumericStyleMinValue(columnStyle, abColumn, params.node, params.value);
915
- const max = this.api.formatColumnApi.getNumericStyleMaxValue(columnStyle, abColumn, params.node, params.value);
916
- const clampedValue = (0, clamp_1.default)(params.value, min, max);
917
- let cellBackColor;
918
- let reverseGradient = false;
919
- if (gradientStyle.ColumnComparison) {
920
- cellBackColor = gradientStyle.ColumnComparison.Color;
921
- }
922
- else {
923
- const matchingRange = gradientStyle.CellRanges.find((r) => (r.Min == 'Col-Min' || r.Min <= clampedValue) &&
924
- (r.Max == 'Col-Max' || r.Max >= clampedValue));
925
- if (matchingRange) {
926
- cellBackColor = matchingRange.Color;
927
- reverseGradient = matchingRange.ReverseGradient;
928
- }
929
- }
930
- const increase = Math.abs(max - min);
931
- const percentage = ((params.value - min) / increase) * 100;
932
- let alpha = Number((percentage / 100).toPrecision(2));
933
- if (reverseGradient) {
934
- alpha = 1 - alpha;
935
- }
936
- const preparedColor = (0, StyleHelper_1.getVariableColor)(cellBackColor);
937
- style.backgroundColor = tinycolor(preparedColor).setAlpha(alpha).toRgbString();
938
- }
939
- if (columnStyle.PercentBarStyle && columnStyle.PercentBarStyle.CellText) {
940
- style.paddingTop = 0;
941
- style.paddingBottom = 0;
949
+ if (columnStyle &&
950
+ !this.api.formatColumnApi.isFormatColumnActiveForColumn(formatColumn, abColumn, params)) {
951
+ return style;
942
952
  }
953
+ style = Object.assign(Object.assign({}, style), this.getFormatColumnSpecialColumnStyle(formatColumn, abColumn, params));
943
954
  }
944
955
  else if (formatColumn.Style) {
945
- style = this.convertAdaptableStyleToCSS(formatColumn.Style);
956
+ const activeFormatColumnsWithStyle = formatColumnsWithStyle.filter((formatColumn) => {
957
+ return this.api.formatColumnApi.isFormatColumnActiveForColumn(formatColumn, abColumn, params);
958
+ });
959
+ if (!activeFormatColumnsWithStyle.length) {
960
+ return style;
961
+ }
962
+ style = Object.assign(Object.assign({}, style), this.getFormatColumnColumnStyle(activeFormatColumnsWithStyle));
946
963
  }
947
964
  if (formatColumn.CellAlignment) {
948
965
  switch (formatColumn.CellAlignment) {
@@ -959,6 +976,30 @@ class Adaptable {
959
976
  }
960
977
  return style;
961
978
  }
979
+ getFormatColumnCellClass(formatColumns, abColumn, params) {
980
+ const classNames = formatColumns
981
+ .map((formatColumn) => {
982
+ var _a, _b;
983
+ if (((_a = formatColumn.Style) === null || _a === void 0 ? void 0 : _a.ClassName) &&
984
+ this.api.formatColumnApi.isFormatColumnActiveForColumn(formatColumn, abColumn, params)) {
985
+ return (_b = formatColumn.Style) === null || _b === void 0 ? void 0 : _b.ClassName;
986
+ }
987
+ })
988
+ .filter((x) => !!x);
989
+ return classNames;
990
+ }
991
+ getFormatColumnRowClass(formatColumns, params) {
992
+ const classNames = formatColumns
993
+ .map((formatColumn) => {
994
+ var _a, _b;
995
+ if (((_a = formatColumn.Style) === null || _a === void 0 ? void 0 : _a.ClassName) &&
996
+ this.api.formatColumnApi.isFormatColumnActiveForRow(formatColumn, params)) {
997
+ return (_b = formatColumn.Style) === null || _b === void 0 ? void 0 : _b.ClassName;
998
+ }
999
+ })
1000
+ .filter((x) => !!x);
1001
+ return classNames;
1002
+ }
962
1003
  getActiveAlertWithHighlightCell(col, params) {
963
1004
  return this.api.internalApi.getAdaptableAlertWithHighlightCell(col.columnId, params.node);
964
1005
  }
@@ -3150,15 +3191,17 @@ class Adaptable {
3150
3191
  borderColor: null,
3151
3192
  };
3152
3193
  const formatColumn = this.api.formatColumnApi.getActiveFormatColumnForColumn(abColumn);
3194
+ const formatColumnsWithStyle = this.api.formatColumnApi.getColumnFormatColumnsWithStyle(abColumn);
3153
3195
  const conditionalStyles = this.api.conditionalStyleApi.getConditionalStylesForColumn(abColumn);
3154
3196
  const quickSearchStyle = this.getQuickSearchCellStyle();
3155
3197
  const hasQuickSearchStyle = quickSearchStyle != undefined;
3156
3198
  const cellStyle = (params) => {
3157
3199
  const formatColumnCellStyle = formatColumn
3158
- ? this.getFormatColumnCellStyle(abColumn, formatColumn, params)
3200
+ ? this.getFormatColumnCellStyle(abColumn, formatColumn, formatColumnsWithStyle, params)
3159
3201
  : undefined;
3160
3202
  const isQuickSearchActive = hasQuickSearchStyle && this.isQuickSearchActive(abColumn, params);
3161
- const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultCellStyle), this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), formatColumnCellStyle), this.getConditionalStyleCellStyle(conditionalStyles, abColumn, params)), (isQuickSearchActive ? quickSearchStyle : undefined)), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
3203
+ const conditionalStyleObj = this.getConditionalStyleCellStyle(conditionalStyles, abColumn, params);
3204
+ const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, defaultCellStyle), this.getReadOnlyCellStyle(abColumn, params)), this.getEditableCellStyle(abColumn, params)), (typeof userCellStyle === 'function' ? userCellStyle(params) : userCellStyle)), formatColumnCellStyle), conditionalStyleObj), (isQuickSearchActive ? quickSearchStyle : undefined)), this.getAlertCellStyle(abColumn, params)), this.getFlashingCellStyle(abColumn, params)), this.getCellHighlightStyle(abColumn, params));
3162
3205
  return result;
3163
3206
  };
3164
3207
  return cellStyle;
@@ -3166,9 +3209,7 @@ class Adaptable {
3166
3209
  }
3167
3210
  setupColumnCellClass({ col, colId, abColumn }) {
3168
3211
  this.setColDefProperty(col, 'cellClass', (userCellClass) => {
3169
- var _a;
3170
- const formatColumn = this.api.formatColumnApi.getFormatColumnWithStyleClassNameForColumn(abColumn);
3171
- const formatColumnStyleClassName = formatColumn && !formatColumn.IsSuspended ? (_a = formatColumn.Style) === null || _a === void 0 ? void 0 : _a.ClassName : null;
3212
+ const formatColumns = this.api.formatColumnApi.getFormatColumnWithStyleClassNameForColumn(abColumn);
3172
3213
  const conditionalStyles = this.api.conditionalStyleApi
3173
3214
  .getConditionalStylesForColumn(abColumn)
3174
3215
  .filter((cs) => StringExtensions_1.StringExtensions.IsNotNullOrEmpty(cs.Style.ClassName));
@@ -3185,7 +3226,9 @@ class Adaptable {
3185
3226
  const returnValue = [
3186
3227
  this.getExcelClassNameForCell(colId, primaryKeyValue),
3187
3228
  typeof userCellClass === 'function' ? userCellClass(params) : userCellClass,
3188
- formatColumnStyleClassName,
3229
+ formatColumns.length
3230
+ ? this.getFormatColumnCellClass(formatColumns, abColumn, params)
3231
+ : null,
3189
3232
  hasConditionalStylesWithClassNames
3190
3233
  ? this.getConditionalStyleCellClass(conditionalStyles, abColumn, params)
3191
3234
  : null,
@@ -3407,7 +3450,7 @@ class Adaptable {
3407
3450
  });
3408
3451
  }
3409
3452
  setupColumnValueFormatter({ col, abColumn }) {
3410
- this.setColDefProperty(col, 'valueFormatter', () => {
3453
+ this.setColDefProperty(col, 'valueFormatter', (params) => {
3411
3454
  const formatColumn = this.api.formatColumnApi.getFormatColumnWithDisplayFormatForColumn(abColumn);
3412
3455
  if (!formatColumn) {
3413
3456
  return;
@@ -3442,7 +3485,12 @@ class Adaptable {
3442
3485
  };
3443
3486
  }
3444
3487
  }
3445
- return valueFormatter;
3488
+ if (valueFormatter) {
3489
+ return (params) => {
3490
+ const rulePasses = this.api.formatColumnApi.isFormatColumnActiveForColumn(formatColumn, abColumn, params);
3491
+ return rulePasses ? valueFormatter(params) : params.value;
3492
+ };
3493
+ }
3446
3494
  }
3447
3495
  });
3448
3496
  }
@@ -4327,10 +4375,11 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4327
4375
  setupRowStyling() {
4328
4376
  // first get the conditional style state
4329
4377
  const conditionalStyles = this.api.conditionalStyleApi.getRowConditionalStyles();
4378
+ const formatColumnsStyles = this.api.formatColumnApi.getRowFormatColumnsWithStyle();
4330
4379
  // Set any Row Styles (i.e. items without a classname)
4331
4380
  this.setGridOptionsProperty('getRowStyle', (userGetRowStyle) => {
4332
4381
  return (params) => {
4333
- const result = Object.assign(Object.assign(Object.assign(Object.assign({}, userGetRowStyle === null || userGetRowStyle === void 0 ? void 0 : userGetRowStyle(params)), this.getRowHighlightStyle(params)), this.getAlertRowStyle(params)), this.getConditionalStyleRowStyle(conditionalStyles, params));
4382
+ const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, userGetRowStyle === null || userGetRowStyle === void 0 ? void 0 : userGetRowStyle(params)), this.getRowHighlightStyle(params)), this.getAlertRowStyle(params)), this.getConditionalStyleRowStyle(conditionalStyles, params)), this.getFormatColumnRowStyle(formatColumnsStyles, params));
4334
4383
  return result;
4335
4384
  };
4336
4385
  });
@@ -4344,6 +4393,7 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4344
4393
  highlightClassName,
4345
4394
  alertHighlightClassName,
4346
4395
  this.getConditionalStyleRowClass(conditionalStyles.filter((cs) => StringExtensions_1.StringExtensions.IsNotNullOrEmpty(cs.Style.ClassName)), params),
4396
+ this.getFormatColumnRowClass(formatColumnsStyles, params),
4347
4397
  ]
4348
4398
  // we flatten it because 'userGetRowClass' might return a string[]
4349
4399
  .flat()
@@ -4386,6 +4436,14 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
4386
4436
  }
4387
4437
  }
4388
4438
  }
4439
+ getFormatColumnRowStyle(formatColumns, params) {
4440
+ if (ArrayExtensions_1.ArrayExtensions.IsNotNullOrEmpty(formatColumns)) {
4441
+ const formatColumnWithRowStyle = formatColumns.find((formatColumn) => this.api.formatColumnApi.isFormatColumnActiveForRow(formatColumn, params));
4442
+ if (formatColumnWithRowStyle) {
4443
+ return this.convertAdaptableStyleToCSS(formatColumnWithRowStyle.Style);
4444
+ }
4445
+ }
4446
+ }
4389
4447
  getGridOptionsApi() {
4390
4448
  if (!this.gridOptions.api) {
4391
4449
  (0, LoggingHelper_1.ConsoleLogError)('There is a problem with your instance of AG Grid - it has no gridApi object. Please contact Support.');
@@ -7,7 +7,7 @@ interface BaseEditorInputProps {
7
7
  onChange: (value: string) => void;
8
8
  disabled?: boolean;
9
9
  onSelectedFunctionChange: (expressionFunction: ExpressionFunction | null) => void;
10
- expressionFunctions: ExpressionFunctionMap;
10
+ expressionFunctions: ExpressionFunctionMap<string>;
11
11
  editorButtons: OperatorEditorButton[];
12
12
  testData: any;
13
13
  placeholder?: string;
@@ -13,7 +13,7 @@ const editorButtonsCumulativeAggregatedScalar_1 = require("./editorButtonsCumula
13
13
  function EditorInput(props) {
14
14
  const moduleExpressionFunctions = props.api.internalApi
15
15
  .getQueryLanguageService()
16
- .getModuleExpressionFunctions(props.module);
16
+ .getModuleExpressionFunctionsMap(props.module);
17
17
  const getFilteredAggregatedExpressionFunctions = (availableAggregatedExpressionFunctions, type) => {
18
18
  const sourceExpressionFunctions = type === 'aggregatedScalar'
19
19
  ? aggregatedScalarExpressionFunctions_1.aggregatedExpressionFunctions
@@ -15,7 +15,7 @@ const editorButtonsAggregatedBoolean_1 = require("./editorButtonsAggregatedBoole
15
15
  function EditorInputWithWhereClause(props) {
16
16
  const moduleExpressionFunctions = props.api.internalApi
17
17
  .getQueryLanguageService()
18
- .getModuleExpressionFunctions(props.module);
18
+ .getModuleExpressionFunctionsMap(props.module);
19
19
  const reactiveExpressionFns = props.type === 'observable'
20
20
  ? moduleExpressionFunctions.observableFunctions
21
21
  : moduleExpressionFunctions.aggregatedBooleanFunctions;