@refinitiv-ui/efx-grid 6.0.65 → 6.0.66
Sign up to get free protection for your applications and to get access to all the features.
- 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 +17 -26
- 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-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 +4 -4
- 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
|
|
@@ -1981,29 +1981,6 @@ ColumnStackPlugin.prototype.moveColumnById = function(srcCol, destCol) {
|
|
1981
1981
|
return this._moveColumnById(srcCol, destCol);
|
1982
1982
|
};
|
1983
1983
|
|
1984
|
-
/** @private
|
1985
|
-
* @description Set stack visibility to the specific stack
|
1986
|
-
* @param {string} stackId
|
1987
|
-
* @param {boolean} visible
|
1988
|
-
*/
|
1989
|
-
ColumnStackPlugin.prototype._setStackVisibility = function(stackId, visible) {
|
1990
|
-
var stackOption = this._groupDefs.getGroup(stackId);
|
1991
|
-
if(!stackOption){
|
1992
|
-
return;
|
1993
|
-
}
|
1994
|
-
|
1995
|
-
if(stackOption.spreading && !stackOption.collapsed){
|
1996
|
-
var children = stackOption.children;
|
1997
|
-
for(var i = 0; i < children.length; i++){
|
1998
|
-
this._setColumnVisibility(this.getColumnIndex(children[i]), visible);
|
1999
|
-
}
|
2000
|
-
} else {
|
2001
|
-
var activeColIndex = this.getColumnIndex(stackOption.activeColumn);
|
2002
|
-
this._setColumnVisibility(activeColIndex, visible);
|
2003
|
-
}
|
2004
|
-
};
|
2005
|
-
|
2006
|
-
|
2007
1984
|
/** @private
|
2008
1985
|
* @description Check for active column in a stack if it needs an update.
|
2009
1986
|
* @param {Object} stackOpt
|
@@ -2022,12 +1999,26 @@ ColumnStackPlugin.prototype._updateActiveColumn = function(stackOpt) {
|
|
2022
1999
|
/** @public
|
2023
2000
|
* @description Hide specific stack from grid
|
2024
2001
|
* @param {string} stackId
|
2002
|
+
* @param {boolean=} hidden
|
2025
2003
|
*/
|
2026
|
-
ColumnStackPlugin.prototype.hideStack = function(stackId) {
|
2004
|
+
ColumnStackPlugin.prototype.hideStack = function(stackId, hidden) {
|
2027
2005
|
if(!stackId){
|
2028
2006
|
return;
|
2029
2007
|
}
|
2030
|
-
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
|
+
}
|
2031
2022
|
};
|
2032
2023
|
|
2033
2024
|
/** @public
|
@@ -2038,7 +2029,7 @@ ColumnStackPlugin.prototype.showStack = function(stackId) {
|
|
2038
2029
|
if(!stackId){
|
2039
2030
|
return;
|
2040
2031
|
}
|
2041
|
-
this.
|
2032
|
+
this.hideStack(stackId, false);
|
2042
2033
|
};
|
2043
2034
|
|
2044
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
|
};
|
@@ -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;
|
@@ -4,14 +4,16 @@ import { ElfUtil } from "./ElfUtil.js";
|
|
4
4
|
import { ExpressionParser } from "./ExpressionParser.js";
|
5
5
|
|
6
6
|
/** @typedef {Object} CellPainter~Expression
|
7
|
+
* @ignore
|
8
|
+
* @description This form of expression is deprecated
|
7
9
|
* @property {string=} name
|
8
10
|
* @property {string} text Text describes condition e.g. [FIELD] > 10
|
9
11
|
* @property {Array=} values
|
10
12
|
*/
|
11
13
|
|
12
14
|
/** @typedef {Object} CellPainter~Condition
|
13
|
-
* @property {string}
|
14
|
-
* @property {
|
15
|
+
* @property {string|Function} expression A function, text, or an object with text property that describes the condition
|
16
|
+
* @property {string=} field Field to be used in the condition
|
15
17
|
* @property {string=} backgroundColor CSS color string
|
16
18
|
* @property {string=} color CSS color string
|
17
19
|
* @property {string=} fontSize
|
@@ -79,17 +81,16 @@ CellPainter.prototype._columnStats = null;
|
|
79
81
|
* @private
|
80
82
|
*/
|
81
83
|
CellPainter.prototype._levelColorDisabled = false;
|
82
|
-
|
83
84
|
/** @type {number}
|
84
85
|
* @private
|
85
86
|
*/
|
86
|
-
CellPainter.
|
87
|
-
|
87
|
+
CellPainter.prototype._blinkingDuration = 250;
|
88
88
|
|
89
89
|
/** @type {number}
|
90
90
|
* @private
|
91
91
|
*/
|
92
|
-
CellPainter.
|
92
|
+
CellPainter._runningBlinkId = 0;
|
93
|
+
|
93
94
|
/** @type {Array.<CellPainter>}
|
94
95
|
* @private
|
95
96
|
* @const
|
@@ -325,7 +326,7 @@ CellPainter.prototype.getColumnStats = function() {
|
|
325
326
|
return this._columnStats;
|
326
327
|
};
|
327
328
|
/** @private
|
328
|
-
* @param {CellPainter~Condition
|
329
|
+
* @param {CellPainter~Condition} condition
|
329
330
|
*/
|
330
331
|
CellPainter.prototype._addCondition = function(condition) {
|
331
332
|
var exp = condition["expression"];
|
@@ -1165,7 +1166,7 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
1165
1166
|
}
|
1166
1167
|
|
1167
1168
|
CellPainter._clearBlinkTimer(scope);
|
1168
|
-
scope["blinkTimer"] = setTimeout(scope._restorer,
|
1169
|
+
scope["blinkTimer"] = setTimeout(scope._restorer, this._blinkingDuration);
|
1169
1170
|
|
1170
1171
|
return bgBlinking;
|
1171
1172
|
};
|
@@ -1193,6 +1194,15 @@ CellPainter.prototype.verifyBlinking = function(cell, rowData) {
|
|
1193
1194
|
CellPainter.prototype.disableLevelColor = function(disabled) {
|
1194
1195
|
this._levelColorDisabled = disabled !== false;
|
1195
1196
|
};
|
1197
|
+
/**
|
1198
|
+
* @public
|
1199
|
+
* @param {number} duration
|
1200
|
+
*/
|
1201
|
+
CellPainter.prototype.setBlinkingDuration = function(duration) {
|
1202
|
+
if(typeof duration === "number"){
|
1203
|
+
this._blinkingDuration = duration;
|
1204
|
+
}
|
1205
|
+
};
|
1196
1206
|
|
1197
1207
|
export default CellPainter;
|
1198
1208
|
export {CellPainter};
|
@@ -195,6 +195,19 @@ var FilterOperators = {
|
|
195
195
|
FilterOperators.TXTEQ = FilterOperators.EQ;
|
196
196
|
FilterOperators.BLANK = FilterOperators.EQ_BLANK;
|
197
197
|
FilterOperators.NBLANK = FilterOperators.EQ_NBLANK;
|
198
|
+
FilterOperators.NEQ_BLANK = FilterOperators.EQ_NBLANK;
|
199
|
+
|
200
|
+
FilterOperators.GREATER_THAN = FilterOperators.GT;
|
201
|
+
FilterOperators.GREATER_THAN_OR_EQUAL_TO = FilterOperators.GTE;
|
202
|
+
FilterOperators.EQUAL_TO = FilterOperators.EQ;
|
203
|
+
FilterOperators.LESS_THAN = FilterOperators.LT;
|
204
|
+
FilterOperators.LESS_THAN_OR_EQUAL_TO = FilterOperators.LTE;
|
205
|
+
// FilterOperators.BETWEEN = // No equivalent operator
|
206
|
+
FilterOperators.TEXT_THAT_CONTAINS = FilterOperators.CONT;
|
207
|
+
FilterOperators.TEXT_THAT_NOT_CONTAINS = FilterOperators.NCONT;
|
208
|
+
FilterOperators.TEXT_IS = FilterOperators.EQ;
|
209
|
+
// FilterOperators.BLANK = FilterOperators.EQ_BLANK;
|
210
|
+
FilterOperators.NOT_BLANK = FilterOperators.EQ_NBLANK;
|
198
211
|
|
199
212
|
|
200
213
|
/** @type {!Object.<string, Function>}
|
@@ -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
|
|