@adaptabletools/adaptable 13.0.0-canary.10 → 13.0.0-canary.11
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.
- package/bundle.cjs.js +125 -125
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/AdaptableQLOptions.d.ts +12 -5
- package/src/Api/Implementation/ColumnApiImpl.js +2 -4
- package/src/Api/Implementation/FormatColumnApiImpl.js +1 -1
- package/src/Api/Implementation/QueryLanguageApiImpl.d.ts +2 -1
- package/src/Api/Implementation/QueryLanguageApiImpl.js +9 -15
- package/src/Api/QueryLanguageApi.d.ts +3 -2
- package/src/Utilities/Defaults/DefaultAdaptableOptions.js +0 -1
- package/src/View/Alert/Wizard/BaseAlertRulesWizardSection.js +3 -3
- package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +3 -3
- package/src/View/Components/NewScopeComponent.js +2 -2
- package/src/View/Components/RangesComponent.d.ts +6 -0
- package/src/View/Components/RangesComponent.js +54 -18
- package/src/View/Components/ScopeComponent.js +2 -2
- package/src/View/ConditionalStyle/Wizard/ConditionalStyleRuleWizardSection.js +3 -3
- package/src/View/FlashingCell/Wizard/FlashingCellRulesWizardSection.js +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +3 -3
- package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +16 -2
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +3 -3
- package/src/View/PlusMinus/Wizard/PlusMinusRuleWizardSection.js +1 -1
- package/src/agGrid/Adaptable.d.ts +3 -0
- package/src/agGrid/Adaptable.js +25 -0
- package/src/agGrid/agGridHelper.js +12 -13
- package/src/metamodel/adaptable.metamodel.d.ts +12 -0
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/types.d.ts +1 -1
- package/version.d.ts +1 -1
- 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.
|
|
3
|
+
"version": "13.0.0-canary.11",
|
|
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",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1663671135839;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -258,4 +258,5 @@ export interface IAdaptable {
|
|
|
258
258
|
}): void;
|
|
259
259
|
getAgGridColumnForColumnId(columnId: string): Column;
|
|
260
260
|
isAgGridModulePresent(moduleName: ModuleNames): boolean;
|
|
261
|
+
getMinMaxCachedValueForColumn(column: AdaptableColumn, minMax: 'min' | 'max'): number | undefined;
|
|
261
262
|
}
|
|
@@ -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
|
-
*
|
|
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
|
+
}
|
|
@@ -424,15 +424,13 @@ class ColumnApiImpl extends ApiBase_1.ApiBase {
|
|
|
424
424
|
if (column.dataType !== 'Number') {
|
|
425
425
|
return undefined;
|
|
426
426
|
}
|
|
427
|
-
|
|
428
|
-
return Math.min(...this.getDistinctRawValuesForColumn(column.columnId));
|
|
427
|
+
return this.adaptable.getMinMaxCachedValueForColumn(column, 'min');
|
|
429
428
|
}
|
|
430
429
|
getMaxValueForNumericColumn(column) {
|
|
431
430
|
if (column.dataType !== 'Number') {
|
|
432
431
|
return undefined;
|
|
433
432
|
}
|
|
434
|
-
|
|
435
|
-
return Math.max(...this.getDistinctRawValuesForColumn(column.columnId));
|
|
433
|
+
return this.adaptable.getMinMaxCachedValueForColumn(column, 'max');
|
|
436
434
|
}
|
|
437
435
|
getTypesForColumn(columnId) {
|
|
438
436
|
var _a;
|
|
@@ -291,7 +291,7 @@ class FormatColumnApiImpl extends ApiBase_1.ApiBase {
|
|
|
291
291
|
return undefined;
|
|
292
292
|
}
|
|
293
293
|
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.
|
|
294
|
+
const formatColumn = checkBoxFormatColumns.find((fc) => this.getAdaptableApi().scopeApi.isColumnInScope(column, fc.Scope));
|
|
295
295
|
return formatColumn;
|
|
296
296
|
}
|
|
297
297
|
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
|
-
|
|
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
|
-
|
|
71
|
-
let
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return
|
|
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
|
|
42
|
+
* Returns whether a Column is Queryable
|
|
42
43
|
*/
|
|
43
|
-
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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
|
|
15
|
-
columnScope: 'Changes in selected
|
|
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
|
|
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 }, "
|
|
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(
|
|
58
|
-
React.createElement(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
React.createElement(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
_a.map((range, index, list) => (React.createElement(React.Fragment, null,
|
|
58
|
+
React.createElement(rebass_1.Flex, { mb: 1 },
|
|
59
|
+
index === 0 && (React.createElement(CheckBox_1.CheckBox, { onClick: () => this.setRangeColMin(range), margin: 0, checked: range.Min === 'Col-Min', mr: 3 }, "Col Min")),
|
|
60
|
+
React.createElement(rebass_1.Box, null),
|
|
61
|
+
index === list.length - 1 && (React.createElement(CheckBox_1.CheckBox, { onClick: () => this.setRangeColMax(range), margin: 0, checked: range.Max === 'Col-Max' }, "Col Max"))),
|
|
62
|
+
React.createElement(rebass_1.Flex, { key: index, mb: 2, "data-name": "percent-bar-range" },
|
|
63
|
+
React.createElement(Input_1.default, { type: typeof range.Min == 'number' ? 'number' : 'text', disabled: range.Min === 'Col-Min', value: range.Min, onChange: (event) => {
|
|
64
|
+
const { value } = event.target;
|
|
65
|
+
this.changeRangeMin(index, value);
|
|
66
|
+
}, mr: 2 }),
|
|
67
|
+
React.createElement(Input_1.default, { value: range.Max, type: typeof range.Max == 'number' ? 'number' : 'text', disabled: range.Max === 'Col-Max', onChange: (event) => {
|
|
68
|
+
const { value } = event.target;
|
|
69
|
+
this.changeRangeMax(index, value);
|
|
70
|
+
}, mr: 2 }),
|
|
71
|
+
React.createElement(ColorPicker_1.ColorPicker, { api: this.props.api, value: range.Color, onChange: (color) => {
|
|
72
|
+
this.changeRangeColor(index, color);
|
|
73
|
+
}, mr: 2, height: "100%" }),
|
|
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, 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
|
-
|
|
150
|
-
|
|
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
|
-
|
|
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) }, "
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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
|
|
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 '
|
|
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 '
|
|
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 '
|
|
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: '
|
|
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: '
|
|
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
|
|
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
|
|
131
|
+
details: 'Create a Style for the Format Column',
|
|
132
132
|
isValid: FormatColumnStyleWizardSection_1.isFormatColumnStyleValid,
|
|
133
133
|
renderSummary: FormatColumnStyleWizardSection_1.renderFormatColumnStyleWizardSummary,
|
|
134
134
|
render: () => {
|
|
@@ -36,7 +36,7 @@ function PlusMinusRuleWizardSection(props) {
|
|
|
36
36
|
useBooleanQuery: (React.createElement(React.Fragment, null,
|
|
37
37
|
"Use an BooleanQuery if ",
|
|
38
38
|
React.createElement("i", null, "Scope"),
|
|
39
|
-
" is '
|
|
39
|
+
" is 'All Columns' - so any data change may be evaluated in a complex BooleanExpression")),
|
|
40
40
|
useObservableQuery: null,
|
|
41
41
|
useAggregationQuery: null,
|
|
42
42
|
} }));
|
|
@@ -67,6 +67,7 @@ export declare class Adaptable implements IAdaptable {
|
|
|
67
67
|
private gridContainerElement;
|
|
68
68
|
private colDefPropertyCache;
|
|
69
69
|
private gridOptionsPropertyCache;
|
|
70
|
+
private columnMinMaxValuesCache;
|
|
70
71
|
private throttleFilterOnEditDataChange;
|
|
71
72
|
private throttleFilterOnTickingDataChange;
|
|
72
73
|
private agGridHelper;
|
|
@@ -388,6 +389,8 @@ export declare class Adaptable implements IAdaptable {
|
|
|
388
389
|
* When reading the state from the grid, we have to make sure 'avg' is not overriden with the 'avg' string.
|
|
389
390
|
*/
|
|
390
391
|
private handleUpdateWeightedAvgFromGrid;
|
|
392
|
+
resetMinMaxCachedValueForColumn(column: AdaptableColumn): void;
|
|
393
|
+
getMinMaxCachedValueForColumn(column: AdaptableColumn, minMax: 'min' | 'max'): number;
|
|
391
394
|
}
|
|
392
395
|
export declare class AdaptableNoCodeWizard implements IAdaptableNoCodeWizard {
|
|
393
396
|
private init;
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -142,6 +142,7 @@ class Adaptable {
|
|
|
142
142
|
constructor() {
|
|
143
143
|
this.colDefPropertyCache = new Map();
|
|
144
144
|
this.gridOptionsPropertyCache = new Map();
|
|
145
|
+
this.columnMinMaxValuesCache = {};
|
|
145
146
|
this.isCheckedColumnDataType = false;
|
|
146
147
|
// only for our private / internal events used within Adaptable
|
|
147
148
|
// public events are emitted through the EventApi
|
|
@@ -3697,6 +3698,7 @@ class Adaptable {
|
|
|
3697
3698
|
this.api.freeTextColumnApi.checkFreeTextColumnForDataChange(cellDataChangedInfo);
|
|
3698
3699
|
}
|
|
3699
3700
|
this.DataService.CreateDataChangedEvent(cellDataChangedInfo);
|
|
3701
|
+
this.resetMinMaxCachedValueForColumn(cellDataChangedInfo.column);
|
|
3700
3702
|
});
|
|
3701
3703
|
// if node is visible then check if need to refresh other columns / whole row if the updating column is:
|
|
3702
3704
|
// 1. referenced in Conditional Styles that have Expressions (refreshing whole row if Scope is All)
|
|
@@ -4773,6 +4775,29 @@ import "@adaptabletools/adaptable/themes/${themeName}.css"`);
|
|
|
4773
4775
|
return acc;
|
|
4774
4776
|
}, {});
|
|
4775
4777
|
}
|
|
4778
|
+
resetMinMaxCachedValueForColumn(column) {
|
|
4779
|
+
if (!column) {
|
|
4780
|
+
this.columnMinMaxValuesCache[column.columnId] = {};
|
|
4781
|
+
}
|
|
4782
|
+
if (this.columnMinMaxValuesCache[column.columnId]) {
|
|
4783
|
+
this.columnMinMaxValuesCache[column.columnId] = undefined;
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
getMinMaxCachedValueForColumn(column, minMax) {
|
|
4787
|
+
var _a;
|
|
4788
|
+
const { columnId, dataType } = column;
|
|
4789
|
+
if (dataType !== 'Number') {
|
|
4790
|
+
return undefined;
|
|
4791
|
+
}
|
|
4792
|
+
let value = (_a = this.columnMinMaxValuesCache[columnId]) === null || _a === void 0 ? void 0 : _a[minMax];
|
|
4793
|
+
if (value !== undefined) {
|
|
4794
|
+
return value;
|
|
4795
|
+
}
|
|
4796
|
+
const distinctRawValues = this.api.columnApi.getDistinctRawValuesForColumn(columnId);
|
|
4797
|
+
value = minMax === 'min' ? Math.min(...distinctRawValues) : Math.max(...distinctRawValues);
|
|
4798
|
+
this.columnMinMaxValuesCache[columnId] = Object.assign(Object.assign({}, this.columnMinMaxValuesCache[columnId]), { [minMax]: value });
|
|
4799
|
+
return value;
|
|
4800
|
+
}
|
|
4776
4801
|
}
|
|
4777
4802
|
exports.Adaptable = Adaptable;
|
|
4778
4803
|
class AdaptableNoCodeWizard {
|