@refinitiv-ui/efx-grid 6.0.64 → 6.0.66
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/lib/core/dist/core.js +5 -5
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +5 -5
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +176 -72
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +0 -2
- package/lib/rt-grid/es6/ColumnDefinition.js +1 -1
- package/lib/rt-grid/es6/Grid.d.ts +0 -2
- package/lib/rt-grid/es6/Grid.js +2 -2
- package/lib/tr-grid-column-formatting/es6/ColumnFormatting.js +4 -3
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +1 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +36 -39
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +8 -5
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +121 -51
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +7 -22
- package/lib/tr-grid-util/es6/CellPainter.d.ts +4 -2
- package/lib/tr-grid-util/es6/CellPainter.js +18 -8
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -0
- package/lib/types/es6/ColumnStack.d.ts +1 -1
- package/lib/types/es6/ConditionalColoring.d.ts +8 -5
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +0 -2
- package/lib/versions.json +5 -5
- package/package.json +1 -1
@@ -54,8 +54,6 @@ declare class ColumnDefinition {
|
|
54
54
|
|
55
55
|
public dispose(): void;
|
56
56
|
|
57
|
-
public _initializeTimeSeriesChild(columnOption?: ColumnDefinition.Options|string|null): void;
|
58
|
-
|
59
57
|
public initialize(columnOption?: ColumnDefinition.Options|null): void;
|
60
58
|
|
61
59
|
public getId(): string;
|
@@ -276,7 +276,7 @@ ColumnDefinition.prototype.dispose = function() {
|
|
276
276
|
// TODO: Remove any related reference from this._fnEngine
|
277
277
|
};
|
278
278
|
|
279
|
-
/** @
|
279
|
+
/** @private
|
280
280
|
* @param {ColumnDefinition~Options|string=} columnOption
|
281
281
|
*/
|
282
282
|
ColumnDefinition.prototype._initializeTimeSeriesChild = function(columnOption) {
|
@@ -179,8 +179,6 @@ declare class Grid extends EventDispatcher {
|
|
179
179
|
|
180
180
|
public setColumnSorter(colRef: Grid.ColumnReference|null, func?: ColumnDefinition.SortLogic|null): void;
|
181
181
|
|
182
|
-
public _initDuplicateRicData(rowDef: RowDefinition|null): void;
|
183
|
-
|
184
182
|
public insertRow(rowOption?: (RowDefinition.Options|string)|null, rowRef?: Grid.RowReference|null): RowDefinition|null;
|
185
183
|
|
186
184
|
public insertRows(rowOptions: (RowDefinition.Options|string)[]|null, rowRef?: Grid.RowReference|null, opt_fields?: (string)[]|null): void;
|
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -1544,7 +1544,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
|
|
1544
1544
|
colConfig["minWidth"] = value;
|
1545
1545
|
}
|
1546
1546
|
|
1547
|
-
value = core.
|
1547
|
+
value = core.getColumnVisibility(colIndex, 0); // flag 0 means get only core api hidden state
|
1548
1548
|
if(!value) {
|
1549
1549
|
colConfig["hidden"] = true;
|
1550
1550
|
}
|
@@ -2284,7 +2284,7 @@ Grid.prototype.setColumnSorter = function(colRef, func) {
|
|
2284
2284
|
|
2285
2285
|
|
2286
2286
|
/** Initialize data for the given rowDef from another rowDef with the same RIC
|
2287
|
-
* @
|
2287
|
+
* @private
|
2288
2288
|
* @param {RowDefinition} rowDef
|
2289
2289
|
*/
|
2290
2290
|
Grid.prototype._initDuplicateRicData = function(rowDef) {
|
@@ -557,7 +557,7 @@ ColumnFormattingPlugin.prototype.getColumnAlignment = function(colIndex) {
|
|
557
557
|
}
|
558
558
|
return "default";
|
559
559
|
};
|
560
|
-
/** Return true if at lease one column is hidden
|
560
|
+
/** Return true if at lease one column is hidden. If grid contains only columns hidden by stacking this will return false
|
561
561
|
* @public
|
562
562
|
* @return {boolean}
|
563
563
|
*/
|
@@ -570,7 +570,7 @@ ColumnFormattingPlugin.prototype.hasHiddenColumn = function() {
|
|
570
570
|
}
|
571
571
|
return false;
|
572
572
|
};
|
573
|
-
/** Check if the specified column is hidden
|
573
|
+
/** Check if the specified column is hidden. Column hidden by stacking is not considered as hidden column.
|
574
574
|
* @public
|
575
575
|
* @param {number} colIndex
|
576
576
|
* @return {boolean}
|
@@ -578,7 +578,8 @@ ColumnFormattingPlugin.prototype.hasHiddenColumn = function() {
|
|
578
578
|
ColumnFormattingPlugin.prototype.isColumnHidden = function(colIndex) {
|
579
579
|
var grid = this._hosts[0];
|
580
580
|
if(grid) {
|
581
|
-
|
581
|
+
var visible = grid.getColumnVisibility(colIndex, 0);
|
582
|
+
return !visible;
|
582
583
|
}
|
583
584
|
return false;
|
584
585
|
};
|
@@ -142,7 +142,7 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
142
142
|
|
143
143
|
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
144
144
|
|
145
|
-
public hideStack(stackId: string): void;
|
145
|
+
public hideStack(stackId: string, hidden?: boolean|null): void;
|
146
146
|
|
147
147
|
public showStack(stackId: string): void;
|
148
148
|
|
@@ -129,10 +129,12 @@ var ColumnStackPlugin = function () {
|
|
129
129
|
this._onStackButtonClicked = this._onStackButtonClicked.bind(this);
|
130
130
|
this._updateUI = this._updateUI.bind(this);
|
131
131
|
this._toColumnId = this._toColumnId.bind(this);
|
132
|
+
this._requestFilterRefresh = this._requestFilterRefresh.bind(this);
|
132
133
|
|
133
134
|
this._hosts = [];
|
134
135
|
this._groupDefs = new GroupDefinitions();
|
135
136
|
|
137
|
+
this._filterConflator = new Conflator(50, this._requestFilterRefresh);
|
136
138
|
this._conflator = new Conflator(50, this._updateUI);
|
137
139
|
};
|
138
140
|
|
@@ -275,6 +277,7 @@ ColumnStackPlugin.prototype.unload = function (host) {
|
|
275
277
|
|
276
278
|
if(this._hosts.length <= 0) {
|
277
279
|
this._conflator.reset();
|
280
|
+
this._filterConflator.reset();
|
278
281
|
this._groupDefs.removeAllGroups();
|
279
282
|
}
|
280
283
|
this._dispose();
|
@@ -537,11 +540,26 @@ ColumnStackPlugin.prototype._hideStackedColumns = function(stack, colRefs, activ
|
|
537
540
|
*/
|
538
541
|
ColumnStackPlugin.prototype._setColumnVisibility = function(colIndex, shown) {
|
539
542
|
if(colIndex >= 0) {
|
543
|
+
var dirty = false;
|
540
544
|
for(var g = this._hosts.length; --g >= 0;) {
|
541
|
-
this._hosts[g].setColumnVisibility(colIndex, shown, 2);
|
545
|
+
dirty |= this._hosts[g].setColumnVisibility(colIndex, shown, 2);
|
546
|
+
}
|
547
|
+
|
548
|
+
if(dirty){
|
549
|
+
this._requestFilterRefresh();
|
542
550
|
}
|
543
551
|
}
|
544
552
|
};
|
553
|
+
/** @private */
|
554
|
+
ColumnStackPlugin.prototype._requestFilterRefresh = function() {
|
555
|
+
if(this._filterConflator.conflate()) {
|
556
|
+
return;
|
557
|
+
}
|
558
|
+
var rfp = this._getPlugin("RowFilteringPlugin");
|
559
|
+
if(rfp && rfp["refresh"]) {
|
560
|
+
rfp["refresh"]();
|
561
|
+
}
|
562
|
+
};
|
545
563
|
/** @private
|
546
564
|
* @param {Array} colRefs Array of column index, id, or field
|
547
565
|
*/
|
@@ -1042,10 +1060,6 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
|
|
1042
1060
|
|
1043
1061
|
this._groupDefs.setGroup(sid, stack);
|
1044
1062
|
|
1045
|
-
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1046
|
-
if(cfp) {
|
1047
|
-
cfp["refresh"]();
|
1048
|
-
}
|
1049
1063
|
this._updateUI(); // asyncronuos
|
1050
1064
|
return true;
|
1051
1065
|
};
|
@@ -1205,10 +1219,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1205
1219
|
}
|
1206
1220
|
}
|
1207
1221
|
if(dirty) {
|
1208
|
-
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1209
|
-
if(cfp) {
|
1210
|
-
cfp["refresh"]();
|
1211
|
-
}
|
1212
1222
|
this._updateUI(); // asyncronuos
|
1213
1223
|
}
|
1214
1224
|
|
@@ -1345,10 +1355,6 @@ ColumnStackPlugin.prototype._setActiveColumn = function(stack, newActiveColumn)
|
|
1345
1355
|
csp.dispatchSelectionChanged();
|
1346
1356
|
}
|
1347
1357
|
}
|
1348
|
-
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1349
|
-
if(cfp) {
|
1350
|
-
cfp["refresh"]();
|
1351
|
-
}
|
1352
1358
|
return true;
|
1353
1359
|
};
|
1354
1360
|
|
@@ -1975,29 +1981,6 @@ ColumnStackPlugin.prototype.moveColumnById = function(srcCol, destCol) {
|
|
1975
1981
|
return this._moveColumnById(srcCol, destCol);
|
1976
1982
|
};
|
1977
1983
|
|
1978
|
-
/** @private
|
1979
|
-
* @description Set stack visibility to the specific stack
|
1980
|
-
* @param {string} stackId
|
1981
|
-
* @param {boolean} visible
|
1982
|
-
*/
|
1983
|
-
ColumnStackPlugin.prototype._setStackVisibility = function(stackId, visible) {
|
1984
|
-
var stackOption = this._groupDefs.getGroup(stackId);
|
1985
|
-
if(!stackOption){
|
1986
|
-
return;
|
1987
|
-
}
|
1988
|
-
|
1989
|
-
if(stackOption.spreading && !stackOption.collapsed){
|
1990
|
-
var children = stackOption.children;
|
1991
|
-
for(var i = 0; i < children.length; i++){
|
1992
|
-
this._setColumnVisibility(this.getColumnIndex(children[i]), visible);
|
1993
|
-
}
|
1994
|
-
} else {
|
1995
|
-
var activeColIndex = this.getColumnIndex(stackOption.activeColumn);
|
1996
|
-
this._setColumnVisibility(activeColIndex, visible);
|
1997
|
-
}
|
1998
|
-
};
|
1999
|
-
|
2000
|
-
|
2001
1984
|
/** @private
|
2002
1985
|
* @description Check for active column in a stack if it needs an update.
|
2003
1986
|
* @param {Object} stackOpt
|
@@ -2016,12 +1999,26 @@ ColumnStackPlugin.prototype._updateActiveColumn = function(stackOpt) {
|
|
2016
1999
|
/** @public
|
2017
2000
|
* @description Hide specific stack from grid
|
2018
2001
|
* @param {string} stackId
|
2002
|
+
* @param {boolean=} hidden
|
2019
2003
|
*/
|
2020
|
-
ColumnStackPlugin.prototype.hideStack = function(stackId) {
|
2004
|
+
ColumnStackPlugin.prototype.hideStack = function(stackId, hidden) {
|
2021
2005
|
if(!stackId){
|
2022
2006
|
return;
|
2023
2007
|
}
|
2024
|
-
this.
|
2008
|
+
var stackOption = this._groupDefs.getGroup(stackId);
|
2009
|
+
if(!stackOption){
|
2010
|
+
return;
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
if(hidden == null){
|
2014
|
+
hidden = true;
|
2015
|
+
}
|
2016
|
+
var children = stackOption.children;
|
2017
|
+
for(var i = 0; i < children.length; i++){
|
2018
|
+
for(var g = this._hosts.length; --g >= 0;) {
|
2019
|
+
this._hosts[g].hideColumn(this.getColumnIndex(children[i]), hidden);
|
2020
|
+
}
|
2021
|
+
}
|
2025
2022
|
};
|
2026
2023
|
|
2027
2024
|
/** @public
|
@@ -2032,7 +2029,7 @@ ColumnStackPlugin.prototype.showStack = function(stackId) {
|
|
2032
2029
|
if(!stackId){
|
2033
2030
|
return;
|
2034
2031
|
}
|
2035
|
-
this.
|
2032
|
+
this.hideStack(stackId, false);
|
2036
2033
|
};
|
2037
2034
|
|
2038
2035
|
/** @public
|
@@ -8,7 +8,8 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
8
8
|
declare namespace ConditionalColoringPlugin {
|
9
9
|
|
10
10
|
type Options = {
|
11
|
-
predefinedColors?: any
|
11
|
+
predefinedColors?: any,
|
12
|
+
blinkingDuration?: number|null
|
12
13
|
};
|
13
14
|
|
14
15
|
type ColumnOptions = {
|
@@ -27,10 +28,11 @@ declare namespace ConditionalColoringPlugin {
|
|
27
28
|
};
|
28
29
|
|
29
30
|
type Condition = {
|
30
|
-
expression?: (string|((...params: any[]) => any))|null,
|
31
|
+
expression?: (string|((...params: any[]) => any)|any[])|null,
|
31
32
|
backgroundColor?: string|null,
|
32
33
|
color?: string|null,
|
33
|
-
cssClass?: string|null
|
34
|
+
cssClass?: string|null,
|
35
|
+
field?: string|null
|
34
36
|
};
|
35
37
|
|
36
38
|
type Blinking = {
|
@@ -38,7 +40,8 @@ declare namespace ConditionalColoringPlugin {
|
|
38
40
|
field?: string|null,
|
39
41
|
up?: string|null,
|
40
42
|
down?: string|null,
|
41
|
-
level?: (string|boolean)|null
|
43
|
+
level?: (string|boolean)|null,
|
44
|
+
duration?: number|null
|
42
45
|
};
|
43
46
|
|
44
47
|
type ColorText = {
|
@@ -70,7 +73,7 @@ declare class ConditionalColoringPlugin extends GridPlugin {
|
|
70
73
|
|
71
74
|
public setColumnColoring(colIndex: number, columnOptions?: (ConditionalColoringPlugin.ColumnOptions|null)|null): void;
|
72
75
|
|
73
|
-
public setConditionalColoring(colIndex: number, coloringOptions?:
|
76
|
+
public setConditionalColoring(colIndex: number, coloringOptions?: ConditionalColoringPlugin.ConditionalColoringOptions|null): void;
|
74
77
|
|
75
78
|
public setColumnBlinking(colIndex: number, blinkingOptions?: (boolean|ConditionalColoringPlugin.Blinking)|null, field?: string|null): void;
|
76
79
|
|
@@ -8,31 +8,49 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
8
8
|
/** @typedef {Object} ConditionalColoringPlugin~Options
|
9
9
|
* @description The options can be specified by `conditionalColoring` property of the main grid's options
|
10
10
|
* @property {Object=} predefinedColors Predefined color object map for conditional coloring
|
11
|
+
* @property {number=} blinkingDuration=250 Blinking duration in milliseconds
|
11
12
|
*/
|
12
13
|
|
13
14
|
/** @typedef {Object} ConditionalColoringPlugin~ColumnOptions
|
14
|
-
* @description Extension column options that can be specified on each
|
15
|
+
* @description Extension column options that can be specified on each Grid column configuration object
|
15
16
|
* @property {Array.<ConditionalColoringPlugin~Condition>=} conditions=null List of condition options
|
16
17
|
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} colorText=null A shorthand for specifying default condition based on the field.
|
17
18
|
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText.
|
18
19
|
* @property {(string|boolean|ConditionalColoringPlugin~Blinking)=} blinking=null Blink Options. If specified, the cell will be blinked on data change.
|
19
|
-
* @property {string=} field
|
20
|
+
* @property {string=} field Field for Grid column configuration object
|
20
21
|
*/
|
21
22
|
|
22
23
|
/** @typedef {Object} ConditionalColoringPlugin~ConditionalColoringOptions
|
23
|
-
* @description
|
24
|
+
* @description Available options for changing conditional coloring at runtime
|
24
25
|
* @property {Array.<ConditionalColoringPlugin~Condition>=} conditions=null List of condition options
|
25
26
|
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} colorText=null A shorthand for specifying default condition based on the field.
|
26
|
-
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText
|
27
|
-
* @property {string=} field
|
27
|
+
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText
|
28
|
+
* @property {string=} field Field to be used for all conditions, overriding the field defined in ColumnOptions
|
28
29
|
*/
|
29
30
|
|
30
31
|
/** @typedef {Object} ConditionalColoringPlugin~Condition
|
31
|
-
* @description
|
32
|
-
* @property {(string|Function)=} expression
|
32
|
+
* @description Properties defining colors and conditioning
|
33
|
+
* @property {(string|Function|Array)=} expression The expression can be in the following forms: text, function, and 2 dimentional array
|
33
34
|
* @property {string=} backgroundColor="" CSS color (e.g. #ffffff, black)
|
34
35
|
* @property {string=} color CSS="" color (e.g. #000000, white)
|
35
36
|
* @property {string=} cssClass cssClass="" Predefined color class name
|
37
|
+
* @property {string=} field Field to be used for this specific condition, overriding the field defined in ConditionalColoringOptions
|
38
|
+
* @example
|
39
|
+
* var conditions1 = [ // Add cssClass for any value that is greater than or equal to 10, and less than or equal to 20
|
40
|
+
* {expression: [["GTE", 10, "AND"], ["LTE", 20]], cssClass: "predefinedColors"}
|
41
|
+
* ];
|
42
|
+
* var conditions2 = [ // Add background color for any fieldA value that is not blank value (e.g., null, undefined, 0, false, empty string)
|
43
|
+
* {
|
44
|
+
* expression: function(rowData) {
|
45
|
+
* return rowData["fieldA"] ? true : false;
|
46
|
+
* },
|
47
|
+
* backgroundColor: "blue",
|
48
|
+
* field: "fieldA"
|
49
|
+
* }
|
50
|
+
* ];
|
51
|
+
* var conditions3 = [ // Add text color for any fieldA value that is not equal to 10
|
52
|
+
* {expression: "[fieldA] != 10", color: "red"}
|
53
|
+
* ];
|
36
54
|
*/
|
37
55
|
|
38
56
|
/** @typedef {(string|boolean|Object)} ConditionalColoringPlugin~Blinking
|
@@ -43,6 +61,7 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
43
61
|
* @property {string=} up CSS color (e.g. #00ff00, green)
|
44
62
|
* @property {string=} down CSS color (e.g. #ff0000, red)
|
45
63
|
* @property {(string|boolean)=} level CSS color (e.g. #33333, grey). If false value is specified, blinking for level color is disabled.
|
64
|
+
* @property {number=} duration If specified, this will override blinking duration from extension option. Blinking duration in milliseconds
|
46
65
|
*/
|
47
66
|
|
48
67
|
/** @typedef {(string|boolean|Object)} ConditionalColoringPlugin~ColorText
|
@@ -126,6 +145,10 @@ ConditionalColoringPlugin.prototype._pendingFields;
|
|
126
145
|
* @private
|
127
146
|
*/
|
128
147
|
ConditionalColoringPlugin.prototype._predefinedColors = null;
|
148
|
+
/** @type {number}
|
149
|
+
* @private
|
150
|
+
*/
|
151
|
+
ConditionalColoringPlugin.prototype._blinkingDuration = 250;
|
129
152
|
/** @type {string}
|
130
153
|
* @private
|
131
154
|
*/
|
@@ -171,6 +194,10 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
171
194
|
this._injectPredefinedColors(host);
|
172
195
|
host.enableClass(ConditionalColoringPlugin._controlClass);
|
173
196
|
}
|
197
|
+
var blinkingDuration = extOptions["blinkingDuration"];
|
198
|
+
if(blinkingDuration != null && typeof blinkingDuration === "number"){
|
199
|
+
this._blinkingDuration = blinkingDuration;
|
200
|
+
}
|
174
201
|
}
|
175
202
|
|
176
203
|
if(hosts.length === 1) {
|
@@ -303,15 +330,24 @@ ConditionalColoringPlugin.prototype.getColumnColoring = function(colIndex, optio
|
|
303
330
|
if (Array.isArray(conditions) && conditions.length > 0) {
|
304
331
|
options.conditions = [];
|
305
332
|
|
333
|
+
var returnedFields = [
|
334
|
+
"expression",
|
335
|
+
"backgroundColor",
|
336
|
+
"color",
|
337
|
+
"cssClass",
|
338
|
+
"field"
|
339
|
+
];
|
306
340
|
var count = conditions.length;
|
307
341
|
for (var n = 0; n < count; n++) {
|
308
342
|
var exCondition = {};
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
"
|
313
|
-
|
314
|
-
|
343
|
+
var cond = conditions[n];
|
344
|
+
extendObject(exCondition, cond, returnedFields);
|
345
|
+
if(typeof exCondition["expression"] === "function") {
|
346
|
+
var origExp = cond["origExpression"];
|
347
|
+
if(origExp) {
|
348
|
+
exCondition["expression"] = origExp;
|
349
|
+
}
|
350
|
+
}
|
315
351
|
|
316
352
|
options.conditions.push(exCondition);
|
317
353
|
}
|
@@ -555,18 +591,18 @@ ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, colu
|
|
555
591
|
|
556
592
|
/** @public
|
557
593
|
* @param {number} colIndex
|
558
|
-
* @param {
|
594
|
+
* @param {ConditionalColoringPlugin~ConditionalColoringOptions=} coloringOptions
|
559
595
|
*/
|
560
596
|
ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex, coloringOptions) {
|
561
597
|
var colData = this._newColumnData(colIndex);
|
598
|
+
|
599
|
+
colData["conditions"] = null; // WARNING: This clears existing user states
|
562
600
|
if(coloringOptions) {
|
563
601
|
// Save column config state
|
564
|
-
colData["conditions"] = coloringOptions["conditions"];
|
565
602
|
colData["colorText"] = coloringOptions["colorText"];
|
566
603
|
colData["tickColor"] = coloringOptions["tickColor"];
|
567
604
|
colData["field"] = coloringOptions["field"];
|
568
605
|
} else {
|
569
|
-
colData["conditions"] = null;
|
570
606
|
colData["colorText"] = null;
|
571
607
|
colData["tickColor"] = null;
|
572
608
|
}
|
@@ -583,6 +619,7 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
583
619
|
}
|
584
620
|
|
585
621
|
if(colorOptions.hasColor) { // Set new coloring
|
622
|
+
colData["conditions"] = coloringOptions["conditions"]; // WARNING: This stores user object
|
586
623
|
var newFieldsMap = colorOptions.fields;
|
587
624
|
if (!painter) {
|
588
625
|
painter = colData["painter"] = new CellPainter();
|
@@ -685,6 +722,8 @@ ConditionalColoringPlugin.prototype.setColumnBlinking = function (colIndex, blin
|
|
685
722
|
this._removeDataFields(prevField, colIndex, BLINKING_TYPE);
|
686
723
|
}
|
687
724
|
}
|
725
|
+
var blinkDuration = bOptions.duration || this._blinkingDuration;
|
726
|
+
painter.setBlinkingDuration(blinkDuration);
|
688
727
|
painter.disableLevelColor(bOptions.level === false);
|
689
728
|
if (bOptions.customColor) {
|
690
729
|
painter.addBlink(newBlinkingField, bOptions.up, bOptions.down, bOptions.level, bOptions.border);
|
@@ -774,6 +813,7 @@ ConditionalColoringPlugin.prototype._prepareBlinkingOptions = function (colIndex
|
|
774
813
|
} else if(typeof blinkingOptions === "object") {
|
775
814
|
blinkField = /** @type{string} */(blinkingOptions["field"]) || field;
|
776
815
|
bOptions.border = blinkingOptions["border"];
|
816
|
+
bOptions.duration = blinkingOptions["duration"];
|
777
817
|
if (blinkingOptions["up"] || blinkingOptions["down"] || blinkingOptions["level"]) {
|
778
818
|
bOptions.customColor = true;
|
779
819
|
bOptions.up = blinkingOptions["up"];
|
@@ -784,52 +824,81 @@ ConditionalColoringPlugin.prototype._prepareBlinkingOptions = function (colIndex
|
|
784
824
|
bOptions.level = false;
|
785
825
|
}
|
786
826
|
}
|
787
|
-
|
788
827
|
bOptions.field = ConditionalColoringPlugin._convertKeyword(blinkField, field);
|
789
828
|
bOptions.inputField = blinkField;
|
790
829
|
return bOptions;
|
791
830
|
};
|
792
831
|
|
832
|
+
/** @private
|
833
|
+
* @param {Object} obj
|
834
|
+
* @param {Array|string} entries
|
835
|
+
*/
|
836
|
+
var _addMapEntries = function(obj, entries) {
|
837
|
+
if(entries) {
|
838
|
+
if(Array.isArray(entries)) {
|
839
|
+
var len = entries.length;
|
840
|
+
for(var i = 0; i < len; ++i) {
|
841
|
+
obj[entries[i]] = true;
|
842
|
+
}
|
843
|
+
} else {
|
844
|
+
obj[entries] = true;
|
845
|
+
}
|
846
|
+
}
|
847
|
+
};
|
793
848
|
/** @private
|
794
849
|
* @param {number} colIndex
|
795
850
|
* @param {ConditionalColoringPlugin~ColumnOptions} columnOptions
|
796
851
|
* @return {!Object}
|
797
852
|
*/
|
798
853
|
ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, columnOptions) {
|
799
|
-
var colorOptions = {};
|
800
854
|
if(!columnOptions) {
|
801
|
-
return
|
855
|
+
return {};
|
802
856
|
}
|
803
857
|
var colField = this._getField(colIndex);
|
804
|
-
var field = /** @type{string} */(columnOptions["field"]) || colField;
|
805
858
|
var inputField = columnOptions["inputField"] || ""; // The value is from user so it can be "THIS_COLUMN" or null
|
806
|
-
|
807
|
-
|
859
|
+
var field = ConditionalColoringPlugin._convertKeyword(inputField, colField);
|
860
|
+
if(columnOptions["field"]) {
|
861
|
+
field = /** @type{string} */(columnOptions["field"]);
|
862
|
+
}
|
863
|
+
|
864
|
+
var hasColor = 0;
|
865
|
+
var fieldMap = {};
|
808
866
|
|
809
867
|
// Check if there is another type of coloring
|
810
|
-
// "colorText" option has more priority than "tickColor"
|
811
868
|
var colorText = columnOptions["colorText"] || columnOptions["tickColor"];
|
812
869
|
var conditions = columnOptions["conditions"];
|
813
870
|
var conditionCount = conditions ? conditions.length : 0;
|
871
|
+
var colorOptions = {};
|
814
872
|
if(conditionCount) {
|
815
|
-
colorOptions.hasColor = 1;
|
816
|
-
colorOptions.fields = {};
|
817
873
|
colorOptions.condColoring = {};
|
818
874
|
colorOptions.condColoring.conditions = conditions;
|
819
875
|
|
820
|
-
var formatter = (field == colField) ? columnOptions["textFormatter"] : null;
|
876
|
+
var formatter = (field == colField) ? columnOptions["textFormatter"] : null; // TODO: This text formatter is not used or defined any where
|
821
877
|
var builder = ConditionalColoringPlugin.getFilterBuilder();
|
822
878
|
|
823
|
-
// WARNING: Builder has to have field first
|
824
|
-
builder.setFieldDefinition(field, formatter, field);
|
825
|
-
|
826
879
|
for(var i = conditionCount; --i >= 0;) {
|
827
880
|
var cond = conditions[i];
|
828
|
-
var exp = cond["expression"];
|
829
|
-
if(
|
830
|
-
var
|
881
|
+
var exp = cond ? cond["expression"] : null;
|
882
|
+
if(Array.isArray(exp)) {
|
883
|
+
var fieldPerCon = cond["field"] || field;
|
884
|
+
cond["expression"] = builder.parse(exp, fieldPerCon, null, fieldPerCon); // WARNING: This alters user object
|
885
|
+
if(cond["expression"]) {
|
886
|
+
cond["origExpression"] = exp;
|
887
|
+
hasColor = 1;
|
888
|
+
fieldMap[fieldPerCon] = true;
|
889
|
+
}
|
890
|
+
} else if(typeof exp === "function") {
|
891
|
+
hasColor = 1;
|
892
|
+
_addMapEntries(fieldMap, cond["fields"] || cond["field"]);
|
893
|
+
} else if(typeof exp === "string") {
|
894
|
+
hasColor = 1;
|
895
|
+
_addMapEntries(fieldMap, _getFieldsFromExpression(exp));
|
896
|
+
} else if(field && cond["condition"]) {
|
897
|
+
hasColor = 1;
|
898
|
+
builder.setFieldDefinition(field, formatter, field); // TODO: Each condition could have different fields
|
899
|
+
var oper = cond["condition"]; // WARNING: This condition is used by Format dialog. It's undocumented
|
831
900
|
var value1 = cond["value1"];
|
832
|
-
var value2 = cond["
|
901
|
+
var value2 = cond["value2"];
|
833
902
|
|
834
903
|
if(oper !== "BTW") {
|
835
904
|
builder.addCondition(oper, value1);
|
@@ -837,26 +906,16 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
837
906
|
builder.addCondition("GTE", value1);
|
838
907
|
builder.addCondition("LTE", value2);
|
839
908
|
}
|
840
|
-
|
841
|
-
|
842
|
-
colorOptions.fields[field] = true;
|
843
|
-
} else {
|
844
|
-
// Get fields from expression string
|
845
|
-
var expFields = _getFieldsFromExpression(exp);
|
846
|
-
for(var n = 0; n < expFields.length; n++) {
|
847
|
-
colorOptions.fields[expFields[n]] = true;
|
848
|
-
}
|
909
|
+
cond["expression"] = builder.buildFilter();
|
910
|
+
fieldMap[field] = true;
|
849
911
|
}
|
850
912
|
}
|
851
913
|
} else if(colorText) {
|
852
|
-
colorOptions.hasColor = 1;
|
853
|
-
colorOptions.fields = {};
|
854
914
|
colorOptions.colorText = {};
|
855
915
|
colorOptions.colorText.useThemeColors = true;
|
856
|
-
|
857
|
-
if(type === "string") {
|
916
|
+
if(typeof colorText === "string") {
|
858
917
|
field = colorText;
|
859
|
-
} else if(
|
918
|
+
} else if(typeof colorText === "object") {
|
860
919
|
field = /** @type{string} */(colorText["field"]) || field;
|
861
920
|
|
862
921
|
if (colorText["upClass"] || colorText["downClass"] || colorText["levelClass"]) {
|
@@ -866,11 +925,22 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
866
925
|
colorOptions.colorText.levelClass = colorText["levelClass"];
|
867
926
|
}
|
868
927
|
}
|
869
|
-
|
870
|
-
|
928
|
+
|
929
|
+
if(field) {
|
930
|
+
colorOptions.colorText.field = field;
|
931
|
+
hasColor = 1;
|
932
|
+
fieldMap[field] = true;
|
933
|
+
}
|
934
|
+
}
|
935
|
+
|
936
|
+
if(hasColor) {
|
937
|
+
colorOptions.hasColor = 1;
|
938
|
+
colorOptions.fields = fieldMap;
|
939
|
+
colorOptions["inputField"] = inputField; // Used to retain state on Column Format Dialog
|
940
|
+
return colorOptions;
|
871
941
|
}
|
872
942
|
|
873
|
-
return
|
943
|
+
return {};
|
874
944
|
};
|
875
945
|
/** @private
|
876
946
|
* @function
|
@@ -881,7 +951,7 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
881
951
|
ConditionalColoringPlugin._convertKeyword = function(userInput, fallback) {
|
882
952
|
if(userInput) {
|
883
953
|
// Note that THIS_COLUMN is a special keyword that needs to be converted before usage
|
884
|
-
return userInput.indexOf("THIS_COLUMN")
|
954
|
+
return userInput.indexOf("THIS_COLUMN") < 0 ? userInput : fallback;
|
885
955
|
}
|
886
956
|
return fallback;
|
887
957
|
};
|
@@ -1301,38 +1301,23 @@ RowFilteringPlugin.prototype._setTimerForUpdatingIcons = function () {
|
|
1301
1301
|
|
1302
1302
|
RowFilteringPlugin.prototype.refresh = function () {
|
1303
1303
|
this._dvTimerId = 0;
|
1304
|
+
this._activeColFilters = this._columnFilters; //check cstp
|
1304
1305
|
|
1305
|
-
var cstkp = this._getPlugin("
|
1306
|
+
var cstkp = this._getPlugin("ColumnStackPlugin");
|
1306
1307
|
|
1307
|
-
|
1308
|
-
|
1309
|
-
if (cstkp && this._activeColFilters.length) {
|
1308
|
+
if (cstkp) {
|
1310
1309
|
var colIndex, cfo;
|
1310
|
+
var host = this._hosts[0];
|
1311
1311
|
|
1312
1312
|
var colCount = this._getColumnCount();
|
1313
1313
|
|
1314
|
-
|
1314
|
+
this._activeColFilters = [];
|
1315
1315
|
|
1316
1316
|
for (colIndex = 0; colIndex < colCount; ++colIndex) {
|
1317
1317
|
cfo = this._getColumnFilterOption(colIndex);
|
1318
1318
|
|
1319
|
-
if (cfo) {
|
1320
|
-
|
1321
|
-
hasInactiveColumn = true;
|
1322
|
-
break;
|
1323
|
-
}
|
1324
|
-
}
|
1325
|
-
}
|
1326
|
-
|
1327
|
-
if (hasInactiveColumn) {
|
1328
|
-
this._activeColFilters = [];
|
1329
|
-
|
1330
|
-
for (colIndex = 0; colIndex < colCount; ++colIndex) {
|
1331
|
-
cfo = this._getColumnFilterOption(colIndex);
|
1332
|
-
|
1333
|
-
if (cfo && !cstkp.isInactiveStackedColumn(colIndex)) {
|
1334
|
-
this._activeColFilters.push(cfo);
|
1335
|
-
}
|
1319
|
+
if (cfo && host.getColumnVisibility(colIndex, 2)) {
|
1320
|
+
this._activeColFilters.push(cfo);
|
1336
1321
|
}
|
1337
1322
|
}
|
1338
1323
|
}
|
@@ -12,8 +12,8 @@ declare namespace CellPainter {
|
|
12
12
|
};
|
13
13
|
|
14
14
|
type Condition = {
|
15
|
-
|
16
|
-
|
15
|
+
expression: string|((...params: any[]) => any)|null,
|
16
|
+
field?: string|null,
|
17
17
|
backgroundColor?: string|null,
|
18
18
|
color?: string|null,
|
19
19
|
fontSize?: string|null,
|
@@ -136,6 +136,8 @@ declare class CellPainter {
|
|
136
136
|
|
137
137
|
public disableLevelColor(disabled?: boolean|null): void;
|
138
138
|
|
139
|
+
public setBlinkingDuration(duration: number): void;
|
140
|
+
|
139
141
|
}
|
140
142
|
|
141
143
|
export default CellPainter;
|