@adaptabletools/adaptable 13.0.0-canary.10 → 13.0.0-canary.12

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 (48) hide show
  1. package/bundle.cjs.js +157 -157
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +3 -0
  6. package/src/AdaptableOptions/AdaptableQLOptions.d.ts +12 -5
  7. package/src/Api/ColumnApi.d.ts +7 -1
  8. package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -0
  9. package/src/Api/Implementation/ColumnApiImpl.js +10 -6
  10. package/src/Api/Implementation/FormatColumnApiImpl.js +3 -5
  11. package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -1
  12. package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -15
  13. package/src/Api/QueryLanguageApi.d.ts +3 -2
  14. package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -1
  15. package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +3 -3
  16. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +3 -3
  17. package/src/View/Components/NewScopeComponent.js +2 -2
  18. package/src/View/Components/RangesComponent.d.ts +6 -0
  19. package/src/View/Components/RangesComponent.js +54 -18
  20. package/src/View/Components/ScopeComponent.js +2 -2
  21. package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +3 -3
  22. package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
  23. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
  24. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +3 -3
  25. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
  26. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +16 -2
  27. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -3
  28. package/src/View/Layout/Wizard/sections/AggregationsSection.js +1 -1
  29. package/src/View/Layout/Wizard/sections/ColumnsSection.js +2 -1
  30. package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
  31. package/src/agGrid/Adaptable.d.ts +6 -1
  32. package/src/agGrid/Adaptable.js +50 -7
  33. package/src/agGrid/FilterWrapper.js +4 -0
  34. package/src/agGrid/FloatingFilterWrapper.d.ts +2 -2
  35. package/src/agGrid/FloatingFilterWrapper.js +73 -32
  36. package/src/agGrid/agGridHelper.js +12 -13
  37. package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +4 -1
  38. package/src/agGrid/editors/AdaptableDateEditor/index.js +84 -17
  39. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -1
  40. package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +2 -3
  41. package/src/agGrid/editors/AdaptableNumberEditor/index.js +78 -27
  42. package/src/metamodel/adaptable.metamodel.d.ts +12 -0
  43. package/src/metamodel/adaptable.metamodel.js +1 -1
  44. package/src/renderReactRoot.d.ts +2 -0
  45. package/src/renderReactRoot.js +11 -9
  46. package/src/types.d.ts +1 -1
  47. package/version.d.ts +1 -1
  48. 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.10",
3
+ "version": "13.0.0-canary.12",
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: 1663591315752;
1
+ declare const _default: 1663690672189;
2
2
  export default _default;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = 1663591315752;
3
+ exports.default = 1663690672189;
@@ -28,6 +28,7 @@ import { IMetamodelService } from '../Utilities/Services/Interface/IMetamodelSer
28
28
  import { ColumnValuesComparer } from '../AdaptableOptions/GeneralOptions';
29
29
  import { IRowEditService } from '../Utilities/Services/Interface/IRowEditService';
30
30
  import { RenderReactRootFn } from '../renderReactRoot';
31
+ export declare type AdaptableVariant = 'vanilla' | 'react' | 'angular';
31
32
  /**
32
33
  * The only interface for Adaptable
33
34
  *
@@ -36,6 +37,7 @@ import { RenderReactRootFn } from '../renderReactRoot';
36
37
  * Should only be used internally as all external access is via the Api
37
38
  */
38
39
  export interface IAdaptable {
40
+ variant: AdaptableVariant;
39
41
  supressReact18RenderWarning: boolean;
40
42
  renderReactRoot: RenderReactRootFn;
41
43
  api: AdaptableApi;
@@ -258,4 +260,5 @@ export interface IAdaptable {
258
260
  }): void;
259
261
  getAgGridColumnForColumnId(columnId: string): Column;
260
262
  isAgGridModulePresent(moduleName: ModuleNames): boolean;
263
+ getMinMaxCachedValueForColumn(column: AdaptableColumn, minMax: 'min' | 'max'): number | undefined;
261
264
  }
@@ -2,7 +2,7 @@ import { ExpressionFunction } from '../parser/src/types';
2
2
  import { AdaptablePredicateDef } from '../PredefinedConfig/Common/AdaptablePredicate';
3
3
  import { AdaptableModule, AdaptableQLModule, AdaptableQLModules } from '../PredefinedConfig/Common/Types';
4
4
  import { BaseContext } from '../PredefinedConfig/Common/BaseContext';
5
- import { AdaptableColumn } from '../PredefinedConfig/Common/AdaptableColumn';
5
+ import { AdaptableColumn, AdaptableColumnBase } from '../PredefinedConfig/Common/AdaptableColumn';
6
6
  import { BooleanFunctionName } from '../Utilities/ExpressionFunctions/booleanExpressionFunctions';
7
7
  import { ScalarFunctionName } from '../Utilities/ExpressionFunctions/scalarExpressionFunctions';
8
8
  import { ObservableFunctionName } from '../Utilities/ExpressionFunctions/observableExpressionFunctions';
@@ -108,12 +108,10 @@ export interface ExpressionOptions {
108
108
  */
109
109
  moduleExpressionFunctions?: ModuleExpressionFunctionsMap | ((context: ModuleExpressionFunctionsContext) => ModuleExpressionFunctions | undefined);
110
110
  /**
111
- * Columns that can be included in AdaptableQL Expressions; leave unset to include **ALL**, provide empty array to set **NONE**
112
- *
113
- * @defaultValue undefined
114
- * @gridInfoItem
111
+ * Deprecated use `isColumnQueryable` instead
115
112
  */
116
113
  queryableColumns?: string[] | (() => string[]);
114
+ isColumnQueryable?: (queryableColumnContext: QueryableColumnContext) => boolean;
117
115
  /**
118
116
  * Validate Expressions before they can be run or saved
119
117
  *
@@ -237,3 +235,12 @@ export interface EvaluateExpressionExternallyContext extends BaseContext {
237
235
  */
238
236
  referencedColumns?: AdaptableColumn[];
239
237
  }
238
+ /**
239
+ * Context passed when evaluating Queryable Columns
240
+ */
241
+ export interface QueryableColumnContext extends BaseContext {
242
+ /**
243
+ * Column - just Id, DataType and FriendlyName
244
+ */
245
+ adaptableColumn: AdaptableColumnBase;
246
+ }
@@ -253,11 +253,17 @@ export interface ColumnApi {
253
253
  */
254
254
  getDistinctVisibleDisplayValuesForColumn(columnId: string): any[];
255
255
  /**
256
- * Gets all distinct raw values in Column
256
+ * Gets all distinct raw values in Column. Values are sorted.
257
257
  * @param columnId Column to check
258
258
  * @param skipRowNode optional RowNode which should be skipped when collecting the distinct rawValues
259
259
  */
260
260
  getDistinctRawValuesForColumn(columnId: string, skipRowNode?: RowNode): any[];
261
+ /**
262
+ * Gets all distinct raw values in Column. Values are un-sorted.
263
+ * @param columnId Column to check
264
+ * @param skipRowNode optional RowNode which should be skipped when collecting the distinct rawValues
265
+ */
266
+ getUnsortedDistinctRawValuesForColumn(columnId: string, skipRowNode?: RowNode): any[];
261
267
  /**
262
268
  * Gets all distinct visible raw values in the Column
263
269
  * @param columnId Column to check
@@ -61,6 +61,7 @@ export declare class ColumnApiImpl extends ApiBase implements ColumnApi {
61
61
  getDistinctBulkUpdateDisplayValuesForColumn(columnId: string, selectedGridCells: GridCell[]): Promise<any[]>;
62
62
  getDistinctVisibleDisplayValuesForColumn(columnId: string): any[];
63
63
  getDistinctRawValuesForColumn(columnId: string, skipRowNode?: RowNode): any[];
64
+ getUnsortedDistinctRawValuesForColumn(columnId: string, skipRowNode?: RowNode): any[];
64
65
  getDistinctVisibleRawValuesForColumn(columnId: string): any[];
65
66
  private sortDistinctValues;
66
67
  getPrimaryKeyColumn(): AdaptableColumn;
@@ -343,11 +343,17 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
343
343
  if (abColumn == undefined) {
344
344
  return [];
345
345
  }
346
- const returnValues = this.adaptable.getDistinctValuesForColumn(abColumn, false, skipRowNode);
347
- return this.sortDistinctValues(returnValues, abColumn).map((cv) => {
346
+ return this.sortDistinctValues(this.getUnsortedDistinctRawValuesForColumn(columnId, skipRowNode), abColumn).map((cv) => {
348
347
  return cv.rawValue;
349
348
  });
350
349
  }
350
+ getUnsortedDistinctRawValuesForColumn(columnId, skipRowNode) {
351
+ const abColumn = this.getColumnFromId(columnId);
352
+ if (abColumn == undefined) {
353
+ return [];
354
+ }
355
+ return this.adaptable.getDistinctValuesForColumn(abColumn, false, skipRowNode);
356
+ }
351
357
  getDistinctVisibleRawValuesForColumn(columnId) {
352
358
  const abColumn = this.getColumnFromId(columnId);
353
359
  if (abColumn == undefined) {
@@ -424,15 +430,13 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
424
430
  if (column.dataType !== 'Number') {
425
431
  return undefined;
426
432
  }
427
- // can we cache this in some way?
428
- return Math.min(...this.getDistinctRawValuesForColumn(column.columnId));
433
+ return this.adaptable.getMinMaxCachedValueForColumn(column, 'min');
429
434
  }
430
435
  getMaxValueForNumericColumn(column) {
431
436
  if (column.dataType !== 'Number') {
432
437
  return undefined;
433
438
  }
434
- // can we cache this in some way?
435
- return Math.max(...this.getDistinctRawValuesForColumn(column.columnId));
439
+ return this.adaptable.getMinMaxCachedValueForColumn(column, 'max');
436
440
  }
437
441
  getTypesForColumn(columnId) {
438
442
  var _a;
@@ -113,8 +113,7 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
113
113
  getColumnFormatColumnsWithStyle(column) {
114
114
  const formatColumns = this.getAllFormatColumnWithStyle();
115
115
  return this.getFormatColumnInColumnScope(formatColumns, column).filter((scopedFormatColumn) => {
116
- return (!this.adaptable.api.scopeApi.scopeIsAll(scopedFormatColumn.Scope) &&
117
- this.adaptable.api.scopeApi.isColumnInScope(column, scopedFormatColumn.Scope));
116
+ return this.adaptable.api.scopeApi.isColumnInScope(column, scopedFormatColumn.Scope);
118
117
  });
119
118
  }
120
119
  getRowFormatColumnsWithStyle() {
@@ -167,8 +166,7 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
167
166
  .concat(this.getFormatColumnsWithAllScope(formatColumns));
168
167
  }
169
168
  getAppropriateFormatColumn(formatColumns, column) {
170
- return this.getFormatColumnInColumnScope(formatColumns, column).find((scopedFormatColumn) => !this.adaptable.api.scopeApi.scopeIsAll(scopedFormatColumn.Scope) &&
171
- this.adaptable.api.scopeApi.isColumnInScope(column, scopedFormatColumn.Scope));
169
+ return this.getFormatColumnInColumnScope(formatColumns, column).find((scopedFormatColumn) => this.adaptable.api.scopeApi.isColumnInScope(column, scopedFormatColumn.Scope));
172
170
  }
173
171
  hasStyleFormatColumns() {
174
172
  return ArrayExtensions_1.default.IsNotNullOrEmpty(this.getAllFormatColumnWithStyle());
@@ -291,7 +289,7 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
291
289
  return undefined;
292
290
  }
293
291
  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; });
294
- const formatColumn = checkBoxFormatColumns.find((fc) => this.adaptable.api.scopeApi.isColumnInScope(column, fc.Scope));
292
+ const formatColumn = checkBoxFormatColumns.find((fc) => this.getAdaptableApi().scopeApi.isColumnInScope(column, fc.Scope));
295
293
  return formatColumn;
296
294
  }
297
295
  isCheckBoxStyleFormatColumn(column) {
@@ -2,6 +2,7 @@ import { ApiBase } from './ApiBase';
2
2
  import { AdaptableModule } from '../../PredefinedConfig/Common/Types';
3
3
  import { QueryLanguageApi } from '../QueryLanguageApi';
4
4
  import { AdaptableQuery } from '../../PredefinedConfig/Common/AdaptableQuery';
5
+ import { AdaptableColumnBase } from '../../PredefinedConfig/Common/AdaptableColumn';
5
6
  export declare class QueryLanguageApiImpl extends ApiBase implements QueryLanguageApi {
6
7
  isValidBooleanExpression(query: string, module: AdaptableModule, validationErrorMessage?: string): boolean;
7
8
  isValidObservableExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;
@@ -9,7 +10,7 @@ export declare class QueryLanguageApiImpl extends ApiBase implements QueryLangua
9
10
  isValidAggregatedScalarExpression(expression: string, module: AdaptableModule, validationErrorMessage?: string): boolean;
10
11
  getASTForExpression(query: string): any;
11
12
  getColumnsFromExpression(expression: string): string[];
12
- getQueryableColumnIds(): string[] | undefined;
13
+ isColumnQueryable(adaptableColumnBase: AdaptableColumnBase): boolean;
13
14
  getAdaptableQueryExpression(query: Partial<AdaptableQuery>): string | undefined;
14
15
  getAdaptableQueryExpressionWithColumnFriendlyNames(query: Partial<AdaptableQuery>): string | undefined;
15
16
  }
@@ -4,7 +4,6 @@ exports.QueryLanguageApiImpl = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const ApiBase_1 = require("./ApiBase");
6
6
  const parser = tslib_1.__importStar(require("../../parser/src"));
7
- const ArrayExtensions_1 = tslib_1.__importDefault(require("../../Utilities/Extensions/ArrayExtensions"));
8
7
  const LoggingHelper_1 = require("../../Utilities/Helpers/LoggingHelper");
9
8
  class QueryLanguageApiImpl extends ApiBase_1.ApiBase {
10
9
  isValidBooleanExpression(query, module, validationErrorMessage) {
@@ -67,21 +66,16 @@ class QueryLanguageApiImpl extends ApiBase_1.ApiBase {
67
66
  return [];
68
67
  }
69
68
  }
70
- getQueryableColumnIds() {
71
- let queryableColumns = this.getExpressionOptions().queryableColumns;
72
- if (!queryableColumns) {
73
- return undefined;
74
- }
75
- // first do the function then get hardcoded items
76
- if (typeof queryableColumns === 'function') {
77
- return queryableColumns();
78
- }
79
- else {
80
- let arr = queryableColumns;
81
- if (arr && ArrayExtensions_1.default.IsNotNullOrEmpty(arr)) {
82
- return arr;
83
- }
69
+ isColumnQueryable(adaptableColumnBase) {
70
+ let queryableColumnFn = this.getExpressionOptions().isColumnQueryable;
71
+ if (queryableColumnFn) {
72
+ const queryableColumnContext = {
73
+ adaptableColumn: adaptableColumnBase,
74
+ adaptableApi: this.getAdaptableApi(),
75
+ };
76
+ return queryableColumnFn(queryableColumnContext);
84
77
  }
78
+ return true;
85
79
  }
86
80
  getAdaptableQueryExpression(query) {
87
81
  var _a, _b, _c, _d;
@@ -1,5 +1,6 @@
1
1
  import { AdaptableModule } from '../PredefinedConfig/Common/Types';
2
2
  import { AdaptableQuery } from '../PredefinedConfig/Common/AdaptableQuery';
3
+ import { AdaptableColumnBase } from '../PredefinedConfig/Common/AdaptableColumn';
3
4
  /**
4
5
  * Functions related to AdapTableQL (the Adaptable Query Language)
5
6
  */
@@ -38,9 +39,9 @@ export interface QueryLanguageApi {
38
39
  */
39
40
  getColumnsFromExpression(expression: string): string[];
40
41
  /**
41
- * Returns all columns that can be used in an Expression
42
+ * Returns whether a Column is Queryable
42
43
  */
43
- getQueryableColumnIds(): string[];
44
+ isColumnQueryable(adaptableColumnBase: AdaptableColumnBase): boolean;
44
45
  /**
45
46
  * Runs the AST that AdapTableQL creates for an Expression - useful when evaluating remotely
46
47
  * @param expression expression to be run
@@ -65,7 +65,6 @@ exports.DefaultAdaptableOptions = {
65
65
  systemAggregatedBooleanFunctions: undefined,
66
66
  systemAggregatedScalarFunctions: undefined,
67
67
  moduleExpressionFunctions: undefined,
68
- queryableColumns: undefined,
69
68
  performExpressionValidation: true,
70
69
  maxTimeframeSize: 28800000, // 8 hours
71
70
  },
@@ -14,15 +14,15 @@ const BaseAlertRulesWizardSection = (props) => {
14
14
  useBooleanQuery: (React.createElement(React.Fragment, null,
15
15
  "Use an BooleanQuery if ",
16
16
  React.createElement("i", null, "Scope"),
17
- " is 'Whole Row' - so any data change may be evaluated in a complex BooleanExpression")),
17
+ " is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
18
18
  useObservableQuery: (React.createElement(React.Fragment, null,
19
19
  "Use an ObservableQuery if ",
20
20
  React.createElement("i", null, "Scope"),
21
- " is 'Whole Row' - so any data change may be evaluated in a complex ObservableExpression")),
21
+ " is 'All Columns' - so any data change may be evaluated in a complex ObservableExpression")),
22
22
  useAggregationQuery: (React.createElement(React.Fragment, null,
23
23
  "Use an AggregatedBooleanQuery if ",
24
24
  React.createElement("i", null, "Scope"),
25
- " is 'Whole Row' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
25
+ " is 'All Columns' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
26
26
  } }));
27
27
  };
28
28
  exports.BaseAlertRulesWizardSection = BaseAlertRulesWizardSection;
@@ -11,8 +11,8 @@ const BaseAlertScopeWizardSection = (props) => {
11
11
  const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
12
12
  return (React.createElement(rebass_1.Flex, { flexDirection: "column", style: { height: '100%' }, padding: 2 },
13
13
  React.createElement(NewScopeComponent_1.NewScopeComponent, { descriptions: {
14
- rowScope: 'Changes anywhere in the row will trigger an alert',
15
- columnScope: 'Changes in selected columns will trigger an alert',
14
+ rowScope: 'Changes in any Column in the row will trigger an Alert',
15
+ columnScope: 'Changes in selected Columns will trigger an Alert',
16
16
  }, scope: data.Scope, updateScope: (Scope) => {
17
17
  const newData = Object.assign(Object.assign({}, data), { Scope });
18
18
  if (newData.Rule.Predicate) {
@@ -47,7 +47,7 @@ const renderBaseAlertScopeSummary = (data) => {
47
47
  return (React.createElement(React.Fragment, null,
48
48
  React.createElement(rebass_1.Box, null,
49
49
  React.createElement(rebass_1.Text, { fontSize: 2 }, scopeApi.scopeIsAll(data.Scope)
50
- ? 'Changes anywhere in the row will trigger an alert'
50
+ ? 'Changes to any Column in the row will trigger an Alert'
51
51
  : null)),
52
52
  React.createElement(rebass_1.Box, { style: { overflow: 'hidden' } }, 'ColumnIds' in data.Scope ? (React.createElement(React.Fragment, null,
53
53
  React.createElement(rebass_1.Text, { fontSize: 2, mb: columnsInScope.length ? 2 : 0 }, "Changes in selected columns will trigger an alert"),
@@ -130,9 +130,9 @@ const NewScopeComponent = (props) => {
130
130
  }
131
131
  return (React.createElement(Tabs_1.Tabs, { "data-name": 'scope-component', className: "ab-ScopeComponent", value: scopeChoice, style: Object.assign({ height: '100%' }, props.style), onValueChange: onScopeSelectChanged },
132
132
  props.hideWholeRow ? null : (React.createElement(Tabs_1.Tabs.Tab, { value: "Row" },
133
- React.createElement(Radio_1.default, { margin: 0, checked: scopeChoice == 'All', tabIndex: -1 }, "Whole Row"))),
133
+ React.createElement(Radio_1.default, { margin: 0, checked: scopeChoice == 'All', tabIndex: -1 }, "All Columns"))),
134
134
  React.createElement(Tabs_1.Tabs.Tab, { value: "Column" },
135
- React.createElement(Radio_1.default, { margin: 0, value: "Column", checked: scopeChoice == 'Column', tabIndex: -1 }, "Columns")),
135
+ React.createElement(Radio_1.default, { margin: 0, value: "Column", checked: scopeChoice == 'Column', tabIndex: -1 }, "Selected Columns")),
136
136
  React.createElement(Tabs_1.Tabs.Tab, { value: "DataType" },
137
137
  React.createElement(Radio_1.default, { margin: 0, value: "DataType", checked: scopeChoice == 'DataType', tabIndex: -1 }, "Data Types")),
138
138
  props.hideWholeRow ? null : (React.createElement(Tabs_1.Tabs.Content, { value: "Row", style: { flex: 'none' }, "data-name": "row-scope" },
@@ -10,6 +10,10 @@ export interface RangesComponentProps extends React.ClassAttributes<RangesCompon
10
10
  showRangeDirection: boolean;
11
11
  updateRanges: (ranges: CellColorRange[]) => void;
12
12
  updateColumnComparison: (columnComparison?: ColumnComparison) => void;
13
+ minMaxRangeValues: {
14
+ min: number;
15
+ max: number;
16
+ };
13
17
  }
14
18
  export interface RangesComponentState {
15
19
  ranges: CellColorRange[];
@@ -25,6 +29,8 @@ export declare class RangesComponent extends React.Component<RangesComponentProp
25
29
  changeRangeColor(index: number, value: string): void;
26
30
  changeRangeDirectionUp(index: number, checked: boolean): void;
27
31
  removeRange(index: number): void;
32
+ setRangeColMin(range: CellColorRange): void;
33
+ setRangeColMax(range: CellColorRange): void;
28
34
  addRange(): void;
29
35
  changeColumnComparisonMinValue(event: React.FormEvent<any>): void;
30
36
  private onMinColumnSelectedChanged;
@@ -54,20 +54,25 @@ class RangesComponent extends React.Component {
54
54
  this.state.rangesType == 'Standard' && (React.createElement(Tabs_1.Tabs, { autoFocus: false, marginTop: 2 },
55
55
  React.createElement(Tabs_1.Tabs.Tab, null, "Ranges"),
56
56
  React.createElement(Tabs_1.Tabs.Content, null, (_a = this.state.ranges) === null || _a === void 0 ? void 0 :
57
- _a.map((range, index) => (React.createElement(rebass_1.Flex, { key: index, mb: 2, "data-name": "percent-bar-range" },
58
- React.createElement(Input_1.default, { type: "number", value: range.Min, onChange: (event) => {
59
- const { value } = event.target;
60
- this.changeRangeMin(index, value);
61
- }, mr: 2 }),
62
- React.createElement(Input_1.default, { type: "number", value: range.Max, onChange: (event) => {
63
- const { value } = event.target;
64
- this.changeRangeMax(index, value);
65
- }, mr: 2 }),
66
- React.createElement(ColorPicker_1.ColorPicker, { api: this.props.api, value: range.Color, onChange: (color) => {
67
- this.changeRangeColor(index, color);
68
- }, mr: 2, height: "100%" }),
69
- this.props.showRangeDirection && (React.createElement(CheckBox_1.CheckBox, { marginLeft: 2, marginRight: 2, checked: range.ReverseGradient && range.ReverseGradient == true, onChange: (checked) => this.changeRangeDirectionUp(index, checked) }, "Reverse Gradient")),
70
- React.createElement(SimpleButton_1.default, { icon: "delete", disabled: this.state.ranges && this.state.ranges.length == 1, onClick: () => this.removeRange(index) })))),
57
+ _a.map((range, index, list) => (React.createElement(rebass_1.Flex, { key: index, alignItems: "end", mb: 2, "data-name": "percent-bar-range" },
58
+ React.createElement(rebass_1.Flex, { flexDirection: "column" },
59
+ index === 0 && (React.createElement(CheckBox_1.CheckBox, { onClick: () => this.setRangeColMin(range), checked: range.Min === 'Col-Min', mt: 0, mb: 1, fontSize: 3 }, "Col Min")),
60
+ React.createElement(Input_1.default, { type: typeof range.Min == 'number' ? 'number' : 'text', disabled: range.Min === 'Col-Min', value: range.Min, onChange: (event) => {
61
+ const { value } = event.target;
62
+ this.changeRangeMin(index, value);
63
+ }, mr: 2 })),
64
+ React.createElement(rebass_1.Flex, { flexDirection: "column" },
65
+ index === list.length - 1 && (React.createElement(CheckBox_1.CheckBox, { mt: 0, mb: 1, onClick: () => this.setRangeColMax(range), checked: range.Max === 'Col-Max', fontSize: 3 }, "Col Max")),
66
+ React.createElement(Input_1.default, { value: range.Max, type: typeof range.Max == 'number' ? 'number' : 'text', disabled: range.Max === 'Col-Max', onChange: (event) => {
67
+ const { value } = event.target;
68
+ this.changeRangeMax(index, value);
69
+ }, mr: 2 })),
70
+ React.createElement(rebass_1.Flex, { alignItems: "center", height: "100%" },
71
+ React.createElement(ColorPicker_1.ColorPicker, { api: this.props.api, value: range.Color, onChange: (color) => {
72
+ this.changeRangeColor(index, color);
73
+ }, mr: 2, height: 33 })),
74
+ this.props.showRangeDirection && (React.createElement(CheckBox_1.CheckBox, { checked: range.ReverseGradient && range.ReverseGradient == true, onChange: (checked) => this.changeRangeDirectionUp(index, checked) }, "Reverse Gradient")),
75
+ React.createElement(SimpleButton_1.default, { ml: 2, mb: 1, icon: "delete", disabled: this.state.ranges && this.state.ranges.length == 1, onClick: () => this.removeRange(index) })))),
71
76
  React.createElement("div", null,
72
77
  React.createElement(SimpleButton_1.default, { variant: "raised", "data-name": "add", onClick: () => this.addRange() }, "Add New Range"))))),
73
78
  this.state.rangesType == 'ColumnComparison' && (React.createElement(Tabs_1.Tabs, { autoFocus: false, marginTop: 2 },
@@ -144,14 +149,45 @@ class RangesComponent extends React.Component {
144
149
  ranges.splice(index, 1);
145
150
  this.props.updateRanges(ranges);
146
151
  }
152
+ setRangeColMin(range) {
153
+ const newRanges = this.state.ranges.map((rangeItem) => {
154
+ if (rangeItem === range) {
155
+ let newMin = rangeItem.Min === 'Col-Min' ? this.props.minMaxRangeValues.min : 'Col-Min';
156
+ return Object.assign(Object.assign({}, rangeItem), { Min: newMin });
157
+ }
158
+ return rangeItem;
159
+ });
160
+ this.setState({ ranges: newRanges }, () => this.props.updateRanges(this.state.ranges));
161
+ }
162
+ setRangeColMax(range) {
163
+ const newRanges = this.state.ranges.map((rangeItem) => {
164
+ if (rangeItem === range) {
165
+ let newMax = rangeItem.Max === 'Col-Max' ? this.props.minMaxRangeValues.max : 'Col-Max';
166
+ return Object.assign(Object.assign({}, rangeItem), { Max: newMax });
167
+ }
168
+ return rangeItem;
169
+ });
170
+ this.setState({ ranges: newRanges }, () => this.props.updateRanges(this.state.ranges));
171
+ }
147
172
  addRange() {
148
173
  const lastRange = this.state.ranges[this.state.ranges.length - 1];
149
- this.state.ranges.push({
150
- Min: lastRange.Max == 'Col-Max' ? 0 : lastRange.Max,
174
+ let previousRange = lastRange;
175
+ let Min = null;
176
+ if (lastRange.Max === 'Col-Max') {
177
+ Min = this.props.minMaxRangeValues.max;
178
+ previousRange = Object.assign(Object.assign({}, previousRange), { Max: this.props.minMaxRangeValues.max });
179
+ }
180
+ else {
181
+ Min = lastRange.Max;
182
+ }
183
+ const newRange = {
184
+ Min,
151
185
  Max: lastRange.Max,
152
186
  Color: (0, UIHelper_1.getHexForName)(UIHelper_1.GRAY),
153
- }),
154
- this.props.updateRanges(this.state.ranges);
187
+ };
188
+ const newRanges = [...this.state.ranges.slice(0, -1), previousRange, newRange];
189
+ // this.state.ranges.push(newRange);
190
+ this.setState({ ranges: newRanges }, () => this.props.updateRanges(this.state.ranges));
155
191
  }
156
192
  changeColumnComparisonMinValue(event) {
157
193
  let e = event.target;
@@ -32,9 +32,9 @@ class ScopeComponent extends React.Component {
32
32
  React.createElement(HelpBlock_1.default, { marginBottom: 1 }, displayMessage),
33
33
  ' ',
34
34
  React.createElement(rebass_1.Flex, { flexDirection: "row", alignItems: "center", padding: 2 },
35
- React.createElement(Radio_1.default, { value: "Row", checked: this.state.ScopeChoice == 'All', onChange: (checked, e) => this.onScopeSelectChanged(e) }, "Whole Row"),
35
+ React.createElement(Radio_1.default, { value: "Row", checked: this.state.ScopeChoice == 'All', onChange: (checked, e) => this.onScopeSelectChanged(e) }, "All Columns"),
36
36
  ' ',
37
- React.createElement(Radio_1.default, { marginLeft: 3, value: "Column", checked: this.state.ScopeChoice == 'Column', onChange: (checked, e) => this.onScopeSelectChanged(e) }, "Column(s)"),
37
+ React.createElement(Radio_1.default, { marginLeft: 3, value: "Column", checked: this.state.ScopeChoice == 'Column', onChange: (checked, e) => this.onScopeSelectChanged(e) }, "Selected Column(s)"),
38
38
  ' ',
39
39
  React.createElement(Radio_1.default, { marginLeft: 3, value: "DataType", checked: this.state.ScopeChoice == 'DataType', onChange: (checked, e) => this.onScopeSelectChanged(e) }, "DataType(s)")),
40
40
  this.state.ScopeChoice == 'Column' && (React.createElement(rebass_1.Box, { marginBottom: 2, "data-name": "column-scope" },
@@ -28,15 +28,15 @@ function ConditionalStyleRuleWizardSection(props) {
28
28
  useBooleanQuery: (React.createElement(React.Fragment, null,
29
29
  "Use an BooleanQuery if ",
30
30
  React.createElement("i", null, "Scope"),
31
- " is 'Whole Row' - so any data change may be evaluated in a complex BooleanExpression")),
31
+ " is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
32
32
  useObservableQuery: (React.createElement(React.Fragment, null,
33
33
  "Use an ObservableQuery if ",
34
34
  React.createElement("i", null, "Scope"),
35
- " is 'Whole Row' - so any data change may be evaluated in a complex ObservableExpression")),
35
+ " is 'All Columns' - so any data change may be evaluated in a complex ObservableExpression")),
36
36
  useAggregationQuery: (React.createElement(React.Fragment, null,
37
37
  "Use an AggregatedBooleanQuery if ",
38
38
  React.createElement("i", null, "Scope"),
39
- " is 'Whole Row' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
39
+ " is 'All Columns' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
40
40
  } })));
41
41
  }
42
42
  exports.ConditionalStyleRuleWizardSection = ConditionalStyleRuleWizardSection;
@@ -36,15 +36,15 @@ const FlashingAlertRulesWizardSection = (props) => {
36
36
  useBooleanQuery: (React.createElement(React.Fragment, null,
37
37
  "Use an BooleanQuery if ",
38
38
  React.createElement("i", null, "Scope"),
39
- " is 'Whole Row' - so any data change may be evaluated in a complex BooleanExpression")),
39
+ " is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
40
40
  useObservableQuery: (React.createElement(React.Fragment, null,
41
41
  "Use an ObservableQuery if ",
42
42
  React.createElement("i", null, "Scope"),
43
- " is 'Whole Row' - so any data change may be evaluated in a complex ObservableExpression")),
43
+ " is 'All Columns' - so any data change may be evaluated in a complex ObservableExpression")),
44
44
  useAggregationQuery: (React.createElement(React.Fragment, null,
45
45
  "Use an AggregatedBooleanQuery if ",
46
46
  React.createElement("i", null, "Scope"),
47
- " is 'Whole Row' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
47
+ " is 'All Columns' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
48
48
  } }));
49
49
  };
50
50
  exports.FlashingAlertRulesWizardSection = FlashingAlertRulesWizardSection;
@@ -389,7 +389,7 @@ const FormatColumnFormatWizardSection = (props) => {
389
389
  return renderStringFormat(data, update, setFormatOption, customScopedFormatters, formatColumnApi);
390
390
  }
391
391
  return (React.createElement(HelpBlock_1.default, { margin: 3 },
392
- "Setting a Display Format is only available if ",
392
+ "Setting a Display Format is only possible if ",
393
393
  React.createElement("b", null, "all"),
394
394
  " the columns in Scope are Numeric, String or Date."));
395
395
  };
@@ -15,15 +15,15 @@ function FormatColumnRuleWizardSection(props) {
15
15
  useBooleanQuery: (React.createElement(React.Fragment, null,
16
16
  "Use an BooleanQuery if ",
17
17
  React.createElement("i", null, "Scope"),
18
- " is 'Whole Row' - so any data change may be evaluated in a complex BooleanExpression")),
18
+ " is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
19
19
  useObservableQuery: (React.createElement(React.Fragment, null,
20
20
  "Use an ObservableQuery if ",
21
21
  React.createElement("i", null, "Scope"),
22
- " is 'Whole Row' - so any data change may be evaluated in a complex ObservableExpression")),
22
+ " is 'All Columns' - so any data change may be evaluated in a complex ObservableExpression")),
23
23
  useAggregationQuery: (React.createElement(React.Fragment, null,
24
24
  "Use an AggregatedBooleanQuery if ",
25
25
  React.createElement("i", null, "Scope"),
26
- " is 'Whole Row' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
26
+ " is 'All Columns' - so any data change may be evaluated in a complex AggregatedBooleanExpression")),
27
27
  } }));
28
28
  }
29
29
  exports.FormatColumnRuleWizardSection = FormatColumnRuleWizardSection;
@@ -17,7 +17,7 @@ exports.renderFormatColumnScopeSummary = renderFormatColumnScopeSummary;
17
17
  const FormatColumnScopeWizardSection = (props) => {
18
18
  const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
19
19
  return (React.createElement(NewScopeComponent_1.NewScopeComponent, { descriptions: {
20
- rowScope: 'Apply a style to an entire row',
20
+ rowScope: 'Format all columns in the row',
21
21
  columnScope: 'Select columns to format',
22
22
  }, scope: data.Scope, updateScope: (Scope) => {
23
23
  var _a;
@@ -113,6 +113,20 @@ function FormatColumnStyleWizardSection(props) {
113
113
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
114
114
  const { data, api } = (0, OnePageAdaptableWizard_1.useOnePageAdaptableWizardContext)();
115
115
  const singleNumericColumn = api.scopeApi.isSingleNumericColumnScope(data.Scope);
116
+ const minMaxRangeValues = React.useMemo(() => {
117
+ if (!singleNumericColumn) {
118
+ return null;
119
+ }
120
+ if (!('ColumnIds' in data.Scope)) {
121
+ return null;
122
+ }
123
+ const [columnId] = data.Scope.ColumnIds;
124
+ const column = api.columnApi.getColumnFromId(columnId);
125
+ return {
126
+ min: api.columnApi.getMinValueForNumericColumn(column),
127
+ max: api.columnApi.getMaxValueForNumericColumn(column),
128
+ };
129
+ }, [singleNumericColumn]);
116
130
  const onlyBooleanColumnsInScope = api.scopeApi.areAllBooleanColumnsInScope(data.Scope) ||
117
131
  api.scopeApi.scopeHasOnlyBooleanDataType(data.Scope);
118
132
  const onPercentBarCellTextCellValueChanged = (checked) => {
@@ -306,9 +320,9 @@ function FormatColumnStyleWizardSection(props) {
306
320
  "Percent Bar",
307
321
  ' '),
308
322
  ' '))),
309
- ((_d = data.ColumnStyle) === null || _d === void 0 ? void 0 : _d.GradientStyle) && (React.createElement(RangesComponent_1.RangesComponent, { api: api, scope: data === null || data === void 0 ? void 0 : data.Scope, showRangeDirection: true, ranges: (_f = (_e = data.ColumnStyle) === null || _e === void 0 ? void 0 : _e.GradientStyle) === null || _f === void 0 ? void 0 : _f.CellRanges, columnComparison: (_h = (_g = data === null || data === void 0 ? void 0 : data.ColumnStyle) === null || _g === void 0 ? void 0 : _g.GradientStyle) === null || _h === void 0 ? void 0 : _h.ColumnComparison, updateRanges: (ranges) => onUpdateGradientStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdateGradientStyleColumnComparison(columnComparison) })),
323
+ ((_d = data.ColumnStyle) === null || _d === void 0 ? void 0 : _d.GradientStyle) && (React.createElement(RangesComponent_1.RangesComponent, { minMaxRangeValues: minMaxRangeValues, api: api, scope: data === null || data === void 0 ? void 0 : data.Scope, showRangeDirection: true, ranges: (_f = (_e = data.ColumnStyle) === null || _e === void 0 ? void 0 : _e.GradientStyle) === null || _f === void 0 ? void 0 : _f.CellRanges, columnComparison: (_h = (_g = data === null || data === void 0 ? void 0 : data.ColumnStyle) === null || _g === void 0 ? void 0 : _g.GradientStyle) === null || _h === void 0 ? void 0 : _h.ColumnComparison, updateRanges: (ranges) => onUpdateGradientStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdateGradientStyleColumnComparison(columnComparison) })),
310
324
  ((_j = data.ColumnStyle) === null || _j === void 0 ? void 0 : _j.PercentBarStyle) && (React.createElement(React.Fragment, null,
311
- React.createElement(RangesComponent_1.RangesComponent, { api: api, scope: data === null || data === void 0 ? void 0 : data.Scope, showRangeDirection: false, ranges: (_l = (_k = data.ColumnStyle) === null || _k === void 0 ? void 0 : _k.PercentBarStyle) === null || _l === void 0 ? void 0 : _l.CellRanges, columnComparison: (_o = (_m = data === null || data === void 0 ? void 0 : data.ColumnStyle) === null || _m === void 0 ? void 0 : _m.PercentBarStyle) === null || _o === void 0 ? void 0 : _o.ColumnComparison, updateRanges: (ranges) => onUpdatePercentBarStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdatePercentBarStyleColumnComparison(columnComparison) }),
325
+ React.createElement(RangesComponent_1.RangesComponent, { minMaxRangeValues: minMaxRangeValues, api: api, scope: data === null || data === void 0 ? void 0 : data.Scope, showRangeDirection: false, ranges: (_l = (_k = data.ColumnStyle) === null || _k === void 0 ? void 0 : _k.PercentBarStyle) === null || _l === void 0 ? void 0 : _l.CellRanges, columnComparison: (_o = (_m = data === null || data === void 0 ? void 0 : data.ColumnStyle) === null || _m === void 0 ? void 0 : _m.PercentBarStyle) === null || _o === void 0 ? void 0 : _o.ColumnComparison, updateRanges: (ranges) => onUpdatePercentBarStyleRanges(ranges), updateColumnComparison: (columnComparison) => onUpdatePercentBarStyleColumnComparison(columnComparison) }),
312
326
  React.createElement(FormLayout_1.default, { marginLeft: 2, marginTop: 2 },
313
327
  React.createElement(FormLayout_1.FormRow, { label: "Cell Display:" },
314
328
  React.createElement(CheckBox_1.CheckBox, { marginLeft: 2, checked: (_r = (_q = (_p = data.ColumnStyle) === null || _p === void 0 ? void 0 : _p.PercentBarStyle) === null || _q === void 0 ? void 0 : _q.CellText) === null || _r === void 0 ? void 0 : _r.includes('CellValue'), onChange: (checked) => onPercentBarCellTextCellValueChanged(checked) }, "Cell Value"),
@@ -108,7 +108,7 @@ function FormatColumnWizard(props) {
108
108
  return (React.createElement(OnePageAdaptableWizard_1.OnePageAdaptableWizard, { defaultCurrentSectionName: props.defaultCurrentSectionName, moduleInfo: props.moduleInfo, data: formatColumn, onHide: props.onCloseWizard, onFinish: handleFinish, sections: [
109
109
  {
110
110
  title: 'Scope',
111
- details: 'Apply formatting to: one or more Columns or Data Types or the whole row',
111
+ details: 'Select which Columns will be formatted',
112
112
  isValid: NewScopeComponent_1.isScopeValid,
113
113
  renderSummary: FormatColumnScopeWizardSection_1.renderFormatColumnScopeSummary,
114
114
  render: () => {
@@ -121,14 +121,14 @@ function FormatColumnWizard(props) {
121
121
  return abObject.Rule ? (0, EntityRulesEditor_1.isRuleValid)(abObject, api, context) : true;
122
122
  },
123
123
  title: 'Condition',
124
- details: 'Build the rules when Format column should be applied',
124
+ details: 'Build a Rule when the Format Column should be applied',
125
125
  render: () => {
126
126
  return (React.createElement(FormatColumnRuleWizardSection_1.FormatColumnRuleWizardSection, { onChange: setFormatColumn, defaultPredicateId: constants_1.DEFAULT_PREDICATE_ID_FOR_FORMAT_COLUMN }));
127
127
  },
128
128
  },
129
129
  {
130
130
  title: 'Style',
131
- details: 'Format Column Style',
131
+ details: 'Create a Style for the Format Column',
132
132
  isValid: FormatColumnStyleWizardSection_1.isFormatColumnStyleValid,
133
133
  renderSummary: FormatColumnStyleWizardSection_1.renderFormatColumnStyleWizardSummary,
134
134
  render: () => {
@@ -33,7 +33,7 @@ const AggregationsSectionSummary = () => {
33
33
  let content = null;
34
34
  if (entires.length) {
35
35
  content = (React.createElement(FormLayout_1.default, null, entires.map(([columnId, aggregation]) => (React.createElement(FormLayout_1.FormRow, { key: columnId, label: adaptable.api.columnApi.getFriendlyNameFromColumnId(columnId) },
36
- React.createElement(Tag_1.Tag, null, aggregation /* TODO fix for Bogdan */))))));
36
+ React.createElement(Tag_1.Tag, null, typeof aggregation === 'object' ? aggregation.type : aggregation))))));
37
37
  }
38
38
  else {
39
39
  content = React.createElement(Tag_1.Tag, null, "No Aggregations");