@adaptabletools/adaptable 13.0.0-canary.14 → 13.0.0-canary.16

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 (40) hide show
  1. package/bundle.cjs.js +138 -138
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableOptions/GeneralOptions.d.ts +0 -5
  6. package/src/Api/ColumnApi.d.ts +1 -1
  7. package/src/Api/FormatColumnApi.d.ts +1 -25
  8. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -1
  9. package/src/Api/Implementation/ColumnApiImpl.js +5 -5
  10. package/src/Api/Implementation/FormatColumnApiImpl.d.ts +1 -6
  11. package/src/Api/Implementation/FormatColumnApiImpl.js +0 -52
  12. package/src/Api/Implementation/InternalApiImpl.d.ts +0 -1
  13. package/src/Api/Implementation/InternalApiImpl.js +0 -4
  14. package/src/Api/Implementation/ScopeApiImpl.d.ts +1 -1
  15. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +9 -3
  16. package/src/Api/Implementation/StyledColumnApiImpl.js +75 -16
  17. package/src/Api/InternalApi.d.ts +0 -1
  18. package/src/Api/ScopeApi.d.ts +1 -1
  19. package/src/Api/StyledColumnApi.d.ts +46 -22
  20. package/src/PredefinedConfig/FormatColumnState.d.ts +2 -87
  21. package/src/PredefinedConfig/StyledColumnState.d.ts +1 -1
  22. package/src/Strategy/ConditionalStyleModule.d.ts +0 -2
  23. package/src/Strategy/ConditionalStyleModule.js +0 -4
  24. package/src/Strategy/FormatColumnModule.d.ts +0 -2
  25. package/src/Strategy/FormatColumnModule.js +26 -207
  26. package/src/Strategy/StyledColumnModule.js +1 -1
  27. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +1 -16
  28. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -1
  29. package/src/View/Components/RangesComponent.d.ts +1 -1
  30. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -2
  31. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +4 -3
  32. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +0 -7
  33. package/src/agGrid/Adaptable.d.ts +2 -8
  34. package/src/agGrid/Adaptable.js +38 -134
  35. package/src/agGrid/CheckboxRenderer.js +1 -1
  36. package/src/agGrid/PercentBarRenderer.d.ts +1 -1
  37. package/src/agGrid/agGridHelper.d.ts +1 -1
  38. package/src/metamodel/adaptable.metamodel.js +1 -1
  39. package/version.d.ts +1 -1
  40. package/version.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "13.0.0-canary.14",
3
+ "version": "13.0.0-canary.16",
4
4
  "description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
5
5
  "keywords": [
6
6
  "web-components",
@@ -1,2 +1,2 @@
1
- declare const _default: 1663788105379;
1
+ declare const _default: 1663819851210;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1663788105379;
3
+ exports.default = 1663819851210;
@@ -65,11 +65,6 @@ export interface GeneralOptions {
65
65
  * Value to use for 'Unbalanced Groups' (string columns)
66
66
  */
67
67
  unbalancedGroupsKey?: string | ((context: UnbalancedGroupsKeyContext) => string);
68
- /**
69
- * Specifies whether Conditional Styles (deprecated in v13) will be auto-merged into Format Columns
70
- * @defaultValue false
71
- */
72
- keepDeprecatedConditionalStyles?: boolean;
73
68
  }
74
69
  /**
75
70
  * Comparer object for Column Values - used for custom sorting
@@ -140,7 +140,7 @@ export interface ColumnApi {
140
140
  * Does Column have a numeric style (e.g. Percent Bar or Gradient)
141
141
  * @param columnId Column to check
142
142
  */
143
- isFormatNumericStyleColumn(column: AdaptableColumn): boolean;
143
+ isStyledNumericColumn(column: AdaptableColumn): boolean;
144
144
  /**
145
145
  * Is Column Numeric
146
146
  * @param columnId Column to check
@@ -1,4 +1,4 @@
1
- import { FormatColumnState, FormatColumn, ColumnComparison } from '../PredefinedConfig/FormatColumnState';
1
+ import { FormatColumnState, FormatColumn } from '../PredefinedConfig/FormatColumnState';
2
2
  import { AdaptableColumn, AdaptableFormat, AdaptablePredicateDef, AdaptableScope } from '../types';
3
3
  import { RowNode } from '@ag-grid-community/core';
4
4
  /**
@@ -37,16 +37,6 @@ export interface FormatColumnApi {
37
37
  * @returns format columns
38
38
  */
39
39
  getAllFormatColumnWithStyle(): FormatColumn[];
40
- /**
41
- * Retrieves the ColumnComparison property, if there, from a Format Column (Column Style)
42
- * @param formatColumn Format Column to Add
43
- */
44
- getColumnComparisonForFormatColumn(formatColumn: FormatColumn): ColumnComparison | undefined;
45
- /**
46
- * Returns any ColumnIds referenced in a Column Comparison
47
- * @param columnComparision Column Comparison to check
48
- */
49
- getColumnIdsFromColumnComparison(columnComparision: ColumnComparison): string[];
50
40
  /**
51
41
  * Retrieves all Format Columns in Adaptable State with `DisplayFormat` property set
52
42
  * @returns format columns
@@ -155,20 +145,6 @@ export interface FormatColumnApi {
155
145
  * Returns true if Format State includes Format Columns with a Style property
156
146
  */
157
147
  hasStyleFormatColumns(): boolean;
158
- /**
159
- * Returns first Format Column that contains checkbox style
160
- * @param columnId column to check
161
- */
162
- getCheckBoxStyleFormatColumn(column: AdaptableColumn): FormatColumn | undefined;
163
- /**
164
- * Whether given column is a (boolean) checkbox column
165
- * @param columnId column to check
166
- */
167
- isCheckBoxStyleFormatColumn(column: AdaptableColumn): boolean;
168
- /**
169
- * Publishes the CheckboxColumnClickedEvent - when the checkbox in an Checkbox Column is clicked
170
- */
171
- fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
172
148
  /**
173
149
  * Format value according to format options.
174
150
  *
@@ -22,7 +22,7 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
22
22
  isCalculatedColumn(columnId: string): boolean;
23
23
  isFreeTextColumn(columnId: string): boolean;
24
24
  isActionColumn(columnId: string): boolean;
25
- isFormatNumericStyleColumn(column: AdaptableColumn): boolean;
25
+ isStyledNumericColumn(column: AdaptableColumn): boolean;
26
26
  isNumericColumn(column: AdaptableColumn): boolean;
27
27
  isBooleanColumn(column: AdaptableColumn): boolean;
28
28
  isDateColumn(column: AdaptableColumn): boolean;
@@ -79,12 +79,12 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
79
79
  return (((_a = this.adaptable.api.actionApi.getAllActionColumn()) === null || _a === void 0 ? void 0 : _a.find((cc) => cc.columnId == columnId)) !=
80
80
  null);
81
81
  }
82
- isFormatNumericStyleColumn(column) {
82
+ isStyledNumericColumn(column) {
83
83
  if (column) {
84
- return this.adaptable.api.formatColumnApi
85
- .getAllFormatColumn()
86
- .filter((fc) => { var _a, _b; return ((_a = fc.ColumnStyle) === null || _a === void 0 ? void 0 : _a.GradientStyle) || ((_b = fc.ColumnStyle) === null || _b === void 0 ? void 0 : _b.PercentBarStyle); })
87
- .some((formatColumn) => this.adaptable.api.scopeApi.isColumnInScope(column, formatColumn.Scope));
84
+ const styledColmn = this.adaptable.api.styledColumnApi
85
+ .getAllActiveStyledColumn()
86
+ .find((sc) => !sc.CheckBoxStyle && sc.ColumnId == column.columnId);
87
+ return styledColmn != null;
88
88
  }
89
89
  return false;
90
90
  }
@@ -1,7 +1,7 @@
1
1
  import { AdaptableStyle } from '../../PredefinedConfig/Common/AdaptableStyle';
2
2
  import { ApiBase, LayoutAssociatedObjectLoadConfig } from './ApiBase';
3
3
  import { FormatColumnApi } from '../FormatColumnApi';
4
- import { FormatColumnState, FormatColumn, ColumnComparison } from '../../PredefinedConfig/FormatColumnState';
4
+ import { FormatColumnState, FormatColumn } from '../../PredefinedConfig/FormatColumnState';
5
5
  import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
6
6
  import { RowNode } from '@ag-grid-community/core';
7
7
  import { AdaptableFormat } from '../../types';
@@ -13,8 +13,6 @@ export declare class FormatColumnApiImpl extends ApiBase implements FormatColumn
13
13
  getAllActiveFormatColumn(): FormatColumn[];
14
14
  getAllSuspendedFormatColumn(): FormatColumn[];
15
15
  getAllFormatColumnWithStyle(): FormatColumn[];
16
- getColumnComparisonForFormatColumn(formatColumn: FormatColumn): ColumnComparison | undefined;
17
- getColumnIdsFromColumnComparison(columnComparison: ColumnComparison): string[];
18
16
  getAllFormatColumnWithDisplayFormat(): FormatColumn[];
19
17
  getAllFormatColumnWithCellAlignment(): FormatColumn[];
20
18
  addFormatColumn(formatColumn: FormatColumn): FormatColumn;
@@ -42,9 +40,6 @@ export declare class FormatColumnApiImpl extends ApiBase implements FormatColumn
42
40
  getFormatColumnsWithAllScope(formatColumns: FormatColumn[]): FormatColumn[] | undefined;
43
41
  getFormatColumnsWithDataTypeScope(formatColumns: FormatColumn[]): FormatColumn[] | undefined;
44
42
  getFormatColumnsWithColumnScope(formatColumns: FormatColumn[]): FormatColumn[] | undefined;
45
- getCheckBoxStyleFormatColumn(column: AdaptableColumn): FormatColumn | undefined;
46
- isCheckBoxStyleFormatColumn(column: AdaptableColumn): boolean;
47
- fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
48
43
  private applyCustomFormatters;
49
44
  getNumberFormattedValue(value: any, node: RowNode, abColumn: AdaptableColumn, options: AdaptableFormat['Options']): string;
50
45
  getStringFormattedValue(value: any, node: RowNode, abColumn: AdaptableColumn, options: AdaptableFormat['Options']): string;
@@ -7,7 +7,6 @@ const ApiBase_1 = require("./ApiBase");
7
7
  const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/ModuleConstants"));
8
8
  const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
9
9
  const StringExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/StringExtensions"));
10
- const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
11
10
  const FormatHelper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/FormatHelper"));
12
11
  const ObjectFactory_1 = tslib_1.__importDefault(require("../../Utilities/ObjectFactory"));
13
12
  class FormatColumnApiImpl extends ApiBase_1.ApiBase {
@@ -30,34 +29,6 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
30
29
  getAllFormatColumnWithStyle() {
31
30
  return this.getAllFormatColumn().filter((fc) => fc.Style != null || fc.CellAlignment);
32
31
  }
33
- getColumnComparisonForFormatColumn(formatColumn) {
34
- var _a, _b;
35
- if (formatColumn.ColumnStyle) {
36
- if ((_a = formatColumn.ColumnStyle.GradientStyle) === null || _a === void 0 ? void 0 : _a.ColumnComparison) {
37
- return formatColumn.ColumnStyle.GradientStyle.ColumnComparison;
38
- }
39
- if ((_b = formatColumn.ColumnStyle.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.ColumnComparison) {
40
- return formatColumn.ColumnStyle.PercentBarStyle.ColumnComparison;
41
- }
42
- }
43
- return undefined;
44
- }
45
- getColumnIdsFromColumnComparison(columnComparison) {
46
- let returnValues = [];
47
- if (typeof columnComparison.MinValue === 'string') {
48
- let minIds = this.adaptable.api.columnApi.getColumnIdsFromId(columnComparison.MinValue, false);
49
- if (ArrayExtensions_1.default.IsNotNullOrEmpty(minIds)) {
50
- returnValues.push(...minIds);
51
- }
52
- }
53
- if (typeof columnComparison.MaxValue === 'string') {
54
- let maxIds = this.adaptable.api.columnApi.getColumnIdsFromId(columnComparison.MaxValue, false);
55
- if (ArrayExtensions_1.default.IsNotNullOrEmpty(maxIds)) {
56
- returnValues.push(...maxIds);
57
- }
58
- }
59
- return returnValues;
60
- }
61
32
  getAllFormatColumnWithDisplayFormat() {
62
33
  return this.getAllFormatColumn().filter((fc) => fc.DisplayFormat != null);
63
34
  }
@@ -185,29 +156,6 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
185
156
  getFormatColumnsWithColumnScope(formatColumns) {
186
157
  return formatColumns.filter((fc) => this.adaptable.api.scopeApi.scopeHasColumns(fc.Scope));
187
158
  }
188
- getCheckBoxStyleFormatColumn(column) {
189
- var _a;
190
- if (column.dataType != 'Boolean') {
191
- return undefined;
192
- }
193
- const checkBoxFormatColumns = (_a = this.getFormatColumnState().FormatColumns) === null || _a === void 0 ? void 0 : _a.filter((fc) => { var _a; return (_a = fc.ColumnStyle) === null || _a === void 0 ? void 0 : _a.CheckBoxStyle; });
194
- const formatColumn = checkBoxFormatColumns.find((fc) => this.getAdaptableApi().scopeApi.isColumnInScope(column, fc.Scope));
195
- return formatColumn;
196
- }
197
- isCheckBoxStyleFormatColumn(column) {
198
- const formatColumn = this.getCheckBoxStyleFormatColumn(column);
199
- return Helper_1.default.objectExists(formatColumn);
200
- }
201
- fireCheckboxColumnClickedEvent(columnId, rowData, primaryKeyValue, isChecked) {
202
- let checkboxColumnClickedInfo = {
203
- adaptableApi: this.adaptable.api,
204
- column: this.adaptable.api.columnApi.getColumnFromId(columnId),
205
- rowData: rowData,
206
- primaryKeyValue: primaryKeyValue,
207
- isChecked: isChecked,
208
- };
209
- this.adaptable.api.eventApi.emit('CheckboxColumnClicked', checkboxColumnClickedInfo);
210
- }
211
159
  applyCustomFormatters(value, node, abColumn, options) {
212
160
  var _a, _b, _c;
213
161
  const columnCustomFormatters = (_a = options === null || options === void 0 ? void 0 : options.CustomDisplayFormats) !== null && _a !== void 0 ? _a : [];
@@ -142,5 +142,4 @@ export declare class InternalApiImpl extends ApiBase implements InternalApi {
142
142
  getValueForTag(adaptableObjectTag: AdaptableObjectTag): string | number;
143
143
  getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
144
144
  getAdaptableQueryExpressionText(query: Partial<AdaptableQuery>): string;
145
- shouldKeepDeprecatedConditionalStyles(): boolean;
146
145
  }
@@ -650,9 +650,5 @@ class InternalApiImpl extends ApiBase_1.ApiBase {
650
650
  ? this.adaptable.api.queryLanguageApi.getAdaptableQueryExpressionWithColumnFriendlyNames(query)
651
651
  : this.adaptable.api.queryLanguageApi.getAdaptableQueryExpression(query);
652
652
  }
653
- shouldKeepDeprecatedConditionalStyles() {
654
- var _a, _b;
655
- return (_b = (_a = this.getOptions()) === null || _a === void 0 ? void 0 : _a.generalOptions) === null || _b === void 0 ? void 0 : _b.keepDeprecatedConditionalStyles;
656
- }
657
653
  }
658
654
  exports.InternalApiImpl = InternalApiImpl;
@@ -2,7 +2,7 @@ import { ApiBase } from './ApiBase';
2
2
  import { AdaptableColumn } from '../../PredefinedConfig/Common/AdaptableColumn';
3
3
  import { AdaptableScope, ScopeDataType } from '../../PredefinedConfig/Common/AdaptableScope';
4
4
  import { ScopeApi } from '../ScopeApi';
5
- import { CellColorRange } from '../../PredefinedConfig/FormatColumnState';
5
+ import { CellColorRange } from '../../PredefinedConfig/StyledColumnState';
6
6
  export declare class ScopeApiImpl extends ApiBase implements ScopeApi {
7
7
  isColumnInScope(column: AdaptableColumn | undefined, scope: AdaptableScope | undefined): boolean;
8
8
  getColumnsForScope(scope: AdaptableScope): AdaptableColumn[];
@@ -1,7 +1,7 @@
1
1
  import { ApiBase, LayoutAssociatedObjectLoadConfig } from './ApiBase';
2
2
  import { StyledColumnApi } from '../StyledColumnApi';
3
3
  import { StyledColumnState, StyledColumn } from '../../PredefinedConfig/StyledColumnState';
4
- import { AdaptableColumn, CellColorRange } from '../../types';
4
+ import { AdaptableColumn, CellColorRange, ColumnComparison } from '../../types';
5
5
  import { RowNode } from '@ag-grid-community/core';
6
6
  export declare class StyledColumnApiImpl extends ApiBase implements StyledColumnApi {
7
7
  getStyledColumnState(): StyledColumnState;
@@ -12,8 +12,14 @@ export declare class StyledColumnApiImpl extends ApiBase implements StyledColumn
12
12
  getAllSuspendedStyledColumn(): StyledColumn[];
13
13
  deleteStyledColumn(styledColumn: StyledColumn): void;
14
14
  addStyledColumn(styledColumn: StyledColumn): void;
15
- getNumericStyleMinValue(numericStyle: any, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
16
- getNumericStyleMaxValue(numericStyle: any, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number | undefined;
15
+ getNumericStyleMinValue(styledColumn: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
16
+ getNumericStyleMaxValue(styledColumn: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number | undefined;
17
17
  getCellColorRangeMinValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
18
18
  getCellColorRangeMaxValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
19
+ getColumnComparisonForStyledColumn(styledColumn: StyledColumn): ColumnComparison | undefined;
20
+ getColumnIdsFromColumnComparison(columnComparison: ColumnComparison): string[];
21
+ getCheckBoxStyleStyledColumn(column: AdaptableColumn): StyledColumn | undefined;
22
+ isCheckBoxStyleStyledColumn(column: AdaptableColumn): boolean;
23
+ fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
24
+ getActiveStyledColumnForColumn(column: AdaptableColumn): StyledColumn | undefined;
19
25
  }
@@ -4,6 +4,8 @@ exports.StyledColumnApiImpl = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ApiBase_1 = require("./ApiBase");
6
6
  const StyledColumnRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/StyledColumnRedux"));
7
+ const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
8
+ const Helper_1 = tslib_1.__importDefault(require("../../Utilities/Helpers/Helper"));
7
9
  class StyledColumnApiImpl extends ApiBase_1.ApiBase {
8
10
  getStyledColumnState() {
9
11
  return this.getAdaptableState().StyledColumn;
@@ -30,11 +32,11 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
30
32
  addStyledColumn(styledColumn) {
31
33
  this.dispatchAction(StyledColumnRedux.StyledColumnAdd(styledColumn));
32
34
  }
33
- getNumericStyleMinValue(numericStyle, column, rowNode, cellValue) {
35
+ getNumericStyleMinValue(styledColumn, column, rowNode, cellValue) {
34
36
  var _a, _b;
35
- const columnComparison = numericStyle.GradientStyle
36
- ? numericStyle.GradientStyle.ColumnComparison
37
- : (_a = numericStyle.PercentBarStyle) === null || _a === void 0 ? void 0 : _a.ColumnComparison;
37
+ const columnComparison = styledColumn.GradientStyle
38
+ ? styledColumn.GradientStyle.ColumnComparison
39
+ : (_a = styledColumn.PercentBarStyle) === null || _a === void 0 ? void 0 : _a.ColumnComparison;
38
40
  if (columnComparison) {
39
41
  if (!isNaN(Number(columnComparison.MinValue))) {
40
42
  return Number(columnComparison.MinValue);
@@ -50,9 +52,9 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
50
52
  }
51
53
  }
52
54
  // for Gradient Column we want just the range that contains cell value
53
- if (numericStyle.GradientStyle) {
55
+ if (styledColumn.GradientStyle) {
54
56
  let range;
55
- numericStyle.GradientStyle.CellRanges.forEach((cellRange) => {
57
+ styledColumn.GradientStyle.CellRanges.forEach((cellRange) => {
56
58
  if (!range) {
57
59
  if ((cellRange.Min == 'Col-Min' || cellValue >= cellRange.Min) &&
58
60
  (cellRange.Max == 'Col-Max' || cellValue <= cellRange.Max)) {
@@ -63,18 +65,18 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
63
65
  return this.getCellColorRangeMinValue(range, column);
64
66
  }
65
67
  // for percentbar we want to get the whole Ranges
66
- if (numericStyle.PercentBarStyle) {
67
- const ranges = (_b = numericStyle.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.CellRanges;
68
+ if (styledColumn.PercentBarStyle) {
69
+ const ranges = (_b = styledColumn.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.CellRanges;
68
70
  if (ranges) {
69
71
  return this.getCellColorRangeMinValue(ranges[0], column);
70
72
  }
71
73
  }
72
74
  }
73
- getNumericStyleMaxValue(numericStyle, column, rowNode, cellValue) {
75
+ getNumericStyleMaxValue(styledColumn, column, rowNode, cellValue) {
74
76
  var _a, _b;
75
- const columnComparison = numericStyle.GradientStyle
76
- ? numericStyle.GradientStyle.ColumnComparison
77
- : (_a = numericStyle.PercentBarStyle) === null || _a === void 0 ? void 0 : _a.ColumnComparison;
77
+ const columnComparison = styledColumn.GradientStyle
78
+ ? styledColumn.GradientStyle.ColumnComparison
79
+ : (_a = styledColumn.PercentBarStyle) === null || _a === void 0 ? void 0 : _a.ColumnComparison;
78
80
  if (columnComparison) {
79
81
  if (!isNaN(Number(columnComparison.MaxValue))) {
80
82
  return Number(columnComparison.MaxValue);
@@ -89,9 +91,9 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
89
91
  }
90
92
  }
91
93
  }
92
- if (numericStyle.GradientStyle) {
94
+ if (styledColumn.GradientStyle) {
93
95
  let range;
94
- numericStyle.GradientStyle.CellRanges.forEach((cellRange) => {
96
+ styledColumn.GradientStyle.CellRanges.forEach((cellRange) => {
95
97
  if (!range) {
96
98
  if ((cellRange.Min == 'Col-Min' || cellValue >= cellRange.Min) &&
97
99
  (cellRange.Max == 'Col-Max' || cellValue <= cellRange.Max)) {
@@ -101,8 +103,8 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
101
103
  });
102
104
  return this.getCellColorRangeMaxValue(range, column);
103
105
  }
104
- if (numericStyle.PercentBarStyle) {
105
- const ranges = (_b = numericStyle.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.CellRanges;
106
+ if (styledColumn.PercentBarStyle) {
107
+ const ranges = (_b = styledColumn.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.CellRanges;
106
108
  if (ranges) {
107
109
  return this.getCellColorRangeMaxValue(ranges[ranges.length - 1], column);
108
110
  }
@@ -130,5 +132,62 @@ class StyledColumnApiImpl extends ApiBase_1.ApiBase {
130
132
  ? this.getAdaptableApi().columnApi.getMaxValueForNumericColumn(column)
131
133
  : range.Max;
132
134
  }
135
+ getColumnComparisonForStyledColumn(styledColumn) {
136
+ var _a, _b;
137
+ if (styledColumn.GradientStyle) {
138
+ if ((_a = styledColumn.GradientStyle) === null || _a === void 0 ? void 0 : _a.ColumnComparison) {
139
+ return styledColumn.GradientStyle.ColumnComparison;
140
+ }
141
+ }
142
+ if (styledColumn.PercentBarStyle) {
143
+ if ((_b = styledColumn.PercentBarStyle) === null || _b === void 0 ? void 0 : _b.ColumnComparison) {
144
+ return styledColumn.PercentBarStyle.ColumnComparison;
145
+ }
146
+ }
147
+ return undefined;
148
+ }
149
+ getColumnIdsFromColumnComparison(columnComparison) {
150
+ let returnValues = [];
151
+ if (typeof columnComparison.MinValue === 'string') {
152
+ let minIds = this.adaptable.api.columnApi.getColumnIdsFromId(columnComparison.MinValue, false);
153
+ if (ArrayExtensions_1.default.IsNotNullOrEmpty(minIds)) {
154
+ returnValues.push(...minIds);
155
+ }
156
+ }
157
+ if (typeof columnComparison.MaxValue === 'string') {
158
+ let maxIds = this.adaptable.api.columnApi.getColumnIdsFromId(columnComparison.MaxValue, false);
159
+ if (ArrayExtensions_1.default.IsNotNullOrEmpty(maxIds)) {
160
+ returnValues.push(...maxIds);
161
+ }
162
+ }
163
+ return returnValues;
164
+ }
165
+ getCheckBoxStyleStyledColumn(column) {
166
+ var _a;
167
+ if (column.dataType != 'Boolean') {
168
+ return undefined;
169
+ }
170
+ const checkBoxFormatColumns = (_a = this.getStyledColumnState().StyledColumns) === null || _a === void 0 ? void 0 : _a.filter((sc) => sc === null || sc === void 0 ? void 0 : sc.CheckBoxStyle);
171
+ const styledColumn = checkBoxFormatColumns.find((sc) => sc.ColumnId == column.columnId);
172
+ return styledColumn;
173
+ }
174
+ isCheckBoxStyleStyledColumn(column) {
175
+ const styledColumn = this.getCheckBoxStyleStyledColumn(column);
176
+ return Helper_1.default.objectExists(styledColumn);
177
+ }
178
+ fireCheckboxColumnClickedEvent(columnId, rowData, primaryKeyValue, isChecked) {
179
+ let checkboxColumnClickedInfo = {
180
+ adaptableApi: this.adaptable.api,
181
+ column: this.adaptable.api.columnApi.getColumnFromId(columnId),
182
+ rowData: rowData,
183
+ primaryKeyValue: primaryKeyValue,
184
+ isChecked: isChecked,
185
+ };
186
+ this.adaptable.api.eventApi.emit('CheckboxColumnClicked', checkboxColumnClickedInfo);
187
+ }
188
+ getActiveStyledColumnForColumn(column) {
189
+ const styledColumns = this.getAllActiveStyledColumn();
190
+ return styledColumns.find((sc) => sc.ColumnId == column.columnId);
191
+ }
133
192
  }
134
193
  exports.StyledColumnApiImpl = StyledColumnApiImpl;
@@ -144,5 +144,4 @@ export interface InternalApi {
144
144
  getValueForTag(adaptableObjectTag: AdaptableObjectTag): string | number;
145
145
  getEditLookUpValuesForColumn(editLookUpItem: EditLookUpPermittedValues, column: AdaptableColumn, gridCell?: GridCell): any[] | undefined;
146
146
  getAdaptableQueryExpressionText(query: Partial<AdaptableQuery>): string;
147
- shouldKeepDeprecatedConditionalStyles(): boolean;
148
147
  }
@@ -1,6 +1,6 @@
1
1
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
2
2
  import { AdaptableScope, ScopeDataType } from '../PredefinedConfig/Common/AdaptableScope';
3
- import { CellColorRange } from '../PredefinedConfig/FormatColumnState';
3
+ import { CellColorRange } from '../PredefinedConfig/StyledColumnState';
4
4
  /**
5
5
  * Provides access to a suite of functions related to the `Scope` object
6
6
  */
@@ -1,9 +1,8 @@
1
1
  import { RowNode } from '@ag-grid-community/core/dist/cjs/es5/entities/rowNode';
2
2
  import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
3
- import { CellColorRange } from '../PredefinedConfig/FormatColumnState';
4
- import { StyledColumnState, StyledColumn } from '../PredefinedConfig/StyledColumnState';
3
+ import { StyledColumnState, StyledColumn, CellColorRange, ColumnComparison } from '../PredefinedConfig/StyledColumnState';
5
4
  /**
6
- * Provides run-time access to the Format Column Module and associated state
5
+ * Provides run-time access to the Styled Column Module and associated state
7
6
  */
8
7
  export interface StyledColumnApi {
9
8
  /**
@@ -17,52 +16,77 @@ export interface StyledColumnApi {
17
16
  */
18
17
  addStyledColumn(styledColumn: StyledColumn): void;
19
18
  /**
20
- * Retrieves Format Column section from Adaptable State
19
+ * Retrieves Styled Column section from Adaptable State
21
20
  */
22
21
  getStyledColumnState(): StyledColumnState;
23
22
  /**
24
- * Retrieves all Format Columns in Adaptable State
25
- * @returns format columns
23
+ * Retrieves all Styled Columns in Adaptable State
24
+ * @returns Styled Columns
26
25
  */
27
26
  getAllStyledColumn(config?: {
28
27
  includeLayoutNotAssociatedObjects?: boolean;
29
28
  }): StyledColumn[];
30
29
  /**
31
- * Retrieves Format Column by Id
32
- * @param id Format Column id
33
- * @returns format column
30
+ * Retrieves Styled Column by Id
31
+ * @param id Styled Column id
32
+ * @returns Styled Column
34
33
  */
35
34
  getStyledColumnById(id: StyledColumn['Uuid']): StyledColumn;
36
35
  /**
37
- * Retrieves Format Column by Column Id
38
- * @param columnId Format Column id
39
- * @returns format column
36
+ * Retrieves Styled Column by Column Id
37
+ * @param columnId Styled Column id
38
+ * @returns Styled Column
40
39
  */
41
40
  getStyledColumnByColumnId(columnId: StyledColumn['ColumnId']): StyledColumn;
42
41
  /**
43
- * Retrieves all active (not-suspended) Format Columns in Adaptable State
44
- * @returns format columns
42
+ * Retrieves all active (not-suspended) Styled Columns in Adaptable State
43
+ * @returns Styled Columns
45
44
  */
46
45
  getAllActiveStyledColumn(): StyledColumn[];
47
46
  /**
48
- * Retrieves all suspended Format Columns in Adaptable State
49
- * @returns format columns
47
+ * Retrieves all suspended Styled Columns in Adaptable State
48
+ * @returns Styled Columns
50
49
  */
51
50
  getAllSuspendedStyledColumn(): StyledColumn[];
52
51
  /**
53
- * Gets the Minimum Value to display for a Numeric Style
54
- * @param numericStyle Numeric Style to check
52
+ * Gets the Minimum Value to display for a Styled Column
53
+ * @param styledColumn Styled Column to check
55
54
  * @param rowNode current Row Node
56
55
  * @param cellValue current Cell Value
57
56
  */
58
- getNumericStyleMinValue(numericStyle: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
57
+ getNumericStyleMinValue(styledColumn: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
59
58
  /**
60
- * Gets the Maximum Value to display for a Numeric Style
61
- * @param numericStyle Numeric Style to check
59
+ * Gets the Maximum Value to display for a Styled Column
60
+ * @param styledColumn Styled Column to check
62
61
  * @param rowNode current Row Node
63
62
  * @param cellValue current Cell Value
64
63
  */
65
- getNumericStyleMaxValue(numericStyle: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
64
+ getNumericStyleMaxValue(styledColumn: Omit<StyledColumn, 'ColumnId'>, column: AdaptableColumn, rowNode: RowNode, cellValue: any): number;
66
65
  getCellColorRangeMinValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
67
66
  getCellColorRangeMaxValue(range: CellColorRange, column: AdaptableColumn): number | undefined;
67
+ /**
68
+ * Retrieves the ColumnComparison property, if there, from a Styled Column
69
+ * @param formatColumn Styled Column to Add
70
+ */
71
+ getColumnComparisonForStyledColumn(formatColumn: StyledColumn): ColumnComparison | undefined;
72
+ /**
73
+ * Returns any ColumnIds referenced in a Column Comparison
74
+ * @param columnComparision Column Comparison to check
75
+ */
76
+ getColumnIdsFromColumnComparison(columnComparision: ColumnComparison): string[];
77
+ /**
78
+ * Returns first Styled Column that contains checkbox style
79
+ * @param columnId column to check
80
+ */
81
+ getCheckBoxStyleStyledColumn(column: AdaptableColumn): StyledColumn | undefined;
82
+ /**
83
+ * Whether given column is a (boolean) checkbox column
84
+ * @param columnId column to check
85
+ */
86
+ isCheckBoxStyleStyledColumn(column: AdaptableColumn): boolean;
87
+ /**
88
+ * Publishes the CheckboxColumnClickedEvent - when the checkbox in an Checkbox Column is clicked
89
+ */
90
+ fireCheckboxColumnClickedEvent(columnId: string, rowData: any, primaryKeyValue: any, isChecked: boolean): void;
91
+ getActiveStyledColumnForColumn(column: AdaptableColumn): StyledColumn | undefined;
68
92
  }
@@ -5,7 +5,7 @@ import { AdaptableScope } from './Common/AdaptableScope';
5
5
  import { SuspendableObject } from './Common/SuspendableObject';
6
6
  import { XOR } from '../Utilities/Extensions/TypeExtensions';
7
7
  import { TypeHint } from './Common/Types';
8
- import { AdaptableBooleanQuery, AdaptablePredicate } from '../types';
8
+ import { AdaptableBooleanQuery, AdaptablePredicate, GradientStyle, PercentBarStyle } from '../types';
9
9
  /**
10
10
  * Predefined Configuration for Format Column Module
11
11
  */
@@ -33,7 +33,7 @@ export interface FormatColumn extends SuspendableObject {
33
33
  */
34
34
  Style?: AdaptableStyle;
35
35
  /**
36
- * Applies Gradient, Percent Bar or CheckBox style to a Column
36
+ * @deprecated now in StyledColumn Module
37
37
  */
38
38
  ColumnStyle?: ColumnStyle;
39
39
  /**
@@ -77,89 +77,4 @@ export interface ColumnStyle {
77
77
  */
78
78
  CheckBoxStyle?: boolean;
79
79
  }
80
- /**
81
- * Style used to display Percent Bars in Format Column
82
- */
83
- export interface PercentBarStyle {
84
- /**
85
- * Ranges (e.g. to allow a traffic light effect)
86
- */
87
- CellRanges?: CellColorRange[];
88
- /**
89
- * Compares cell values to another Column
90
- */
91
- ColumnComparison?: ColumnComparison;
92
- /**
93
- * Whether Cell shows Cell Value, Percent Value, both or none
94
- */
95
- CellText?: CellTextOptions;
96
- /**
97
- * Whether Tooltip shows Cell Value, Percent Value, both or none
98
- */
99
- ToolTipText?: CellTextOptions;
100
- /**
101
- * Back colour - only used for 'Percent Bar' Numeric style; leave unset if none required
102
- * @defaultValue Gray
103
- */
104
- BackColor?: string;
105
- }
106
- /**
107
- * Used to display Gradient Styles in Format Column
108
- */
109
- export interface GradientStyle {
110
- /**
111
- * Ranges (e.g. to allow a traffic light effect)
112
- */
113
- CellRanges?: CellColorRange[];
114
- /**
115
- * Compares cell values to another Column
116
- */
117
- ColumnComparison?: ColumnComparison;
118
- }
119
- /**
120
- * Defines which Colours to show in Gradient and Percent Bar Styles
121
- */
122
- export interface CellColorRange {
123
- /**
124
- * Start number of Range
125
- */
126
- Min: number | 'Col-Min';
127
- /**
128
- * End number of Range
129
- */
130
- Max: number | 'Col-Max';
131
- /**
132
- * Cell colour to use for values that fall inside Range
133
- */
134
- Color: string;
135
- /**
136
- * Reverses the Gradient so the lower the cell value the darker the colour
137
- */
138
- ReverseGradient?: boolean;
139
- }
140
- /**
141
- * Enables a Percent Bar or Gradient Style to use another column in its calculations
142
- */
143
- export interface ColumnComparison {
144
- /**
145
- * Start value - either numeric or Column name
146
- */
147
- MinValue: number | string;
148
- /**
149
- * End value - either numeric or Column name
150
- */
151
- MaxValue: number | string;
152
- /**
153
- * Colour to use for the Comparison
154
- */
155
- Color: string;
156
- }
157
- /**
158
- * Array of CellTextOption available in Format Columns
159
- */
160
- export declare type CellTextOptions = CellTextOption[];
161
- /**
162
- * Text optionally to show in a Format Column special style: 'CellValue' or 'PercentageValue'
163
- */
164
- export declare type CellTextOption = 'CellValue' | 'PercentageValue';
165
80
  export {};