@refinitiv-ui/efx-grid 6.0.65 → 6.0.67
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 +31 -9
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +2 -0
- package/lib/core/es6/data/DataView.js +26 -4
- 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 +11 -5
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +153 -55
- package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +2 -1
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +8 -8
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +3 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +23 -2
- 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 +11 -5
- package/lib/types/es6/ContextMenu.d.ts +2 -1
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +0 -2
- package/lib/types/es6/RowFiltering.d.ts +3 -0
- package/lib/versions.json +6 -6
- 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,9 @@ 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,
|
13
|
+
insertionBlinking?: boolean|null
|
12
14
|
};
|
13
15
|
|
14
16
|
type ColumnOptions = {
|
@@ -27,10 +29,11 @@ declare namespace ConditionalColoringPlugin {
|
|
27
29
|
};
|
28
30
|
|
29
31
|
type Condition = {
|
30
|
-
expression?: (string|((...params: any[]) => any))|null,
|
32
|
+
expression?: (string|((...params: any[]) => any)|any[])|null,
|
31
33
|
backgroundColor?: string|null,
|
32
34
|
color?: string|null,
|
33
|
-
cssClass?: string|null
|
35
|
+
cssClass?: string|null,
|
36
|
+
field?: string|null
|
34
37
|
};
|
35
38
|
|
36
39
|
type Blinking = {
|
@@ -38,7 +41,8 @@ declare namespace ConditionalColoringPlugin {
|
|
38
41
|
field?: string|null,
|
39
42
|
up?: string|null,
|
40
43
|
down?: string|null,
|
41
|
-
level?: (string|boolean)|null
|
44
|
+
level?: (string|boolean)|null,
|
45
|
+
duration?: number|null
|
42
46
|
};
|
43
47
|
|
44
48
|
type ColorText = {
|
@@ -70,7 +74,7 @@ declare class ConditionalColoringPlugin extends GridPlugin {
|
|
70
74
|
|
71
75
|
public setColumnColoring(colIndex: number, columnOptions?: (ConditionalColoringPlugin.ColumnOptions|null)|null): void;
|
72
76
|
|
73
|
-
public setConditionalColoring(colIndex: number, coloringOptions?:
|
77
|
+
public setConditionalColoring(colIndex: number, coloringOptions?: ConditionalColoringPlugin.ConditionalColoringOptions|null): void;
|
74
78
|
|
75
79
|
public setColumnBlinking(colIndex: number, blinkingOptions?: (boolean|ConditionalColoringPlugin.Blinking)|null, field?: string|null): void;
|
76
80
|
|
@@ -78,6 +82,8 @@ declare class ConditionalColoringPlugin extends GridPlugin {
|
|
78
82
|
|
79
83
|
public setPredefinedColors(predefinedColors: any): void;
|
80
84
|
|
85
|
+
public setInsertionBlinking(blinking: boolean): void;
|
86
|
+
|
81
87
|
public getColumnPainter(colIndex: number): CellPainter|null;
|
82
88
|
|
83
89
|
public applyColor(colIndex: number, cell: any, rowData?: any): void;
|
@@ -8,31 +8,50 @@ 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
|
12
|
+
* @property {boolean=} insertionBlinking=false Blinking when a row is added to a grid
|
11
13
|
*/
|
12
14
|
|
13
15
|
/** @typedef {Object} ConditionalColoringPlugin~ColumnOptions
|
14
|
-
* @description Extension column options that can be specified on each
|
16
|
+
* @description Extension column options that can be specified on each Grid column configuration object
|
15
17
|
* @property {Array.<ConditionalColoringPlugin~Condition>=} conditions=null List of condition options
|
16
18
|
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} colorText=null A shorthand for specifying default condition based on the field.
|
17
19
|
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText.
|
18
20
|
* @property {(string|boolean|ConditionalColoringPlugin~Blinking)=} blinking=null Blink Options. If specified, the cell will be blinked on data change.
|
19
|
-
* @property {string=} field
|
21
|
+
* @property {string=} field Field for Grid column configuration object
|
20
22
|
*/
|
21
23
|
|
22
24
|
/** @typedef {Object} ConditionalColoringPlugin~ConditionalColoringOptions
|
23
|
-
* @description
|
25
|
+
* @description Available options for changing conditional coloring at runtime
|
24
26
|
* @property {Array.<ConditionalColoringPlugin~Condition>=} conditions=null List of condition options
|
25
27
|
* @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
|
28
|
+
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText
|
29
|
+
* @property {string=} field Field to be used for all conditions, overriding the field defined in ColumnOptions
|
28
30
|
*/
|
29
31
|
|
30
32
|
/** @typedef {Object} ConditionalColoringPlugin~Condition
|
31
|
-
* @description
|
32
|
-
* @property {(string|Function)=} expression
|
33
|
+
* @description Properties defining colors and conditioning
|
34
|
+
* @property {(string|Function|Array)=} expression The expression can be in the following forms: text, function, and 2 dimentional array
|
33
35
|
* @property {string=} backgroundColor="" CSS color (e.g. #ffffff, black)
|
34
36
|
* @property {string=} color CSS="" color (e.g. #000000, white)
|
35
37
|
* @property {string=} cssClass cssClass="" Predefined color class name
|
38
|
+
* @property {string=} field Field to be used for this specific condition, overriding the field defined in ConditionalColoringOptions
|
39
|
+
* @example
|
40
|
+
* var conditions1 = [ // Add cssClass for any value that is greater than or equal to 10, and less than or equal to 20
|
41
|
+
* {expression: [["GTE", 10, "AND"], ["LTE", 20]], cssClass: "predefinedColors"}
|
42
|
+
* ];
|
43
|
+
* var conditions2 = [ // Add background color for any fieldA value that is not blank value (e.g., null, undefined, 0, false, empty string)
|
44
|
+
* {
|
45
|
+
* expression: function(rowData) {
|
46
|
+
* return rowData["fieldA"] ? true : false;
|
47
|
+
* },
|
48
|
+
* backgroundColor: "blue",
|
49
|
+
* field: "fieldA"
|
50
|
+
* }
|
51
|
+
* ];
|
52
|
+
* var conditions3 = [ // Add text color for any fieldA value that is not equal to 10
|
53
|
+
* {expression: "[fieldA] != 10", color: "red"}
|
54
|
+
* ];
|
36
55
|
*/
|
37
56
|
|
38
57
|
/** @typedef {(string|boolean|Object)} ConditionalColoringPlugin~Blinking
|
@@ -43,6 +62,7 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
43
62
|
* @property {string=} up CSS color (e.g. #00ff00, green)
|
44
63
|
* @property {string=} down CSS color (e.g. #ff0000, red)
|
45
64
|
* @property {(string|boolean)=} level CSS color (e.g. #33333, grey). If false value is specified, blinking for level color is disabled.
|
65
|
+
* @property {number=} duration If specified, this will override blinking duration from extension option. Blinking duration in milliseconds
|
46
66
|
*/
|
47
67
|
|
48
68
|
/** @typedef {(string|boolean|Object)} ConditionalColoringPlugin~ColorText
|
@@ -126,6 +146,14 @@ ConditionalColoringPlugin.prototype._pendingFields;
|
|
126
146
|
* @private
|
127
147
|
*/
|
128
148
|
ConditionalColoringPlugin.prototype._predefinedColors = null;
|
149
|
+
/** @type {number}
|
150
|
+
* @private
|
151
|
+
*/
|
152
|
+
ConditionalColoringPlugin.prototype._blinkingDuration = 250;
|
153
|
+
/** @type {boolean}
|
154
|
+
* @private
|
155
|
+
*/
|
156
|
+
ConditionalColoringPlugin.prototype._insertionBlinking = false;
|
129
157
|
/** @type {string}
|
130
158
|
* @private
|
131
159
|
*/
|
@@ -171,6 +199,14 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
171
199
|
this._injectPredefinedColors(host);
|
172
200
|
host.enableClass(ConditionalColoringPlugin._controlClass);
|
173
201
|
}
|
202
|
+
var blinkingDuration = extOptions["blinkingDuration"];
|
203
|
+
if(blinkingDuration != null && typeof blinkingDuration === "number"){
|
204
|
+
this._blinkingDuration = blinkingDuration;
|
205
|
+
}
|
206
|
+
var insertionBlinking = extOptions["insertionBlinking"];
|
207
|
+
if(insertionBlinking != null){
|
208
|
+
this._insertionBlinking = insertionBlinking;
|
209
|
+
}
|
174
210
|
}
|
175
211
|
|
176
212
|
if(hosts.length === 1) {
|
@@ -303,15 +339,24 @@ ConditionalColoringPlugin.prototype.getColumnColoring = function(colIndex, optio
|
|
303
339
|
if (Array.isArray(conditions) && conditions.length > 0) {
|
304
340
|
options.conditions = [];
|
305
341
|
|
342
|
+
var returnedFields = [
|
343
|
+
"expression",
|
344
|
+
"backgroundColor",
|
345
|
+
"color",
|
346
|
+
"cssClass",
|
347
|
+
"field"
|
348
|
+
];
|
306
349
|
var count = conditions.length;
|
307
350
|
for (var n = 0; n < count; n++) {
|
308
351
|
var exCondition = {};
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
"
|
313
|
-
|
314
|
-
|
352
|
+
var cond = conditions[n];
|
353
|
+
extendObject(exCondition, cond, returnedFields);
|
354
|
+
if(typeof exCondition["expression"] === "function") {
|
355
|
+
var origExp = cond["origExpression"];
|
356
|
+
if(origExp) {
|
357
|
+
exCondition["expression"] = origExp;
|
358
|
+
}
|
359
|
+
}
|
315
360
|
|
316
361
|
options.conditions.push(exCondition);
|
317
362
|
}
|
@@ -555,18 +600,18 @@ ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, colu
|
|
555
600
|
|
556
601
|
/** @public
|
557
602
|
* @param {number} colIndex
|
558
|
-
* @param {
|
603
|
+
* @param {ConditionalColoringPlugin~ConditionalColoringOptions=} coloringOptions
|
559
604
|
*/
|
560
605
|
ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex, coloringOptions) {
|
561
606
|
var colData = this._newColumnData(colIndex);
|
607
|
+
|
608
|
+
colData["conditions"] = null; // WARNING: This clears existing user states
|
562
609
|
if(coloringOptions) {
|
563
610
|
// Save column config state
|
564
|
-
colData["conditions"] = coloringOptions["conditions"];
|
565
611
|
colData["colorText"] = coloringOptions["colorText"];
|
566
612
|
colData["tickColor"] = coloringOptions["tickColor"];
|
567
613
|
colData["field"] = coloringOptions["field"];
|
568
614
|
} else {
|
569
|
-
colData["conditions"] = null;
|
570
615
|
colData["colorText"] = null;
|
571
616
|
colData["tickColor"] = null;
|
572
617
|
}
|
@@ -583,6 +628,7 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
583
628
|
}
|
584
629
|
|
585
630
|
if(colorOptions.hasColor) { // Set new coloring
|
631
|
+
colData["conditions"] = coloringOptions["conditions"]; // WARNING: This stores user object
|
586
632
|
var newFieldsMap = colorOptions.fields;
|
587
633
|
if (!painter) {
|
588
634
|
painter = colData["painter"] = new CellPainter();
|
@@ -685,6 +731,8 @@ ConditionalColoringPlugin.prototype.setColumnBlinking = function (colIndex, blin
|
|
685
731
|
this._removeDataFields(prevField, colIndex, BLINKING_TYPE);
|
686
732
|
}
|
687
733
|
}
|
734
|
+
var blinkDuration = bOptions.duration || this._blinkingDuration;
|
735
|
+
painter.setBlinkingDuration(blinkDuration);
|
688
736
|
painter.disableLevelColor(bOptions.level === false);
|
689
737
|
if (bOptions.customColor) {
|
690
738
|
painter.addBlink(newBlinkingField, bOptions.up, bOptions.down, bOptions.level, bOptions.border);
|
@@ -774,6 +822,7 @@ ConditionalColoringPlugin.prototype._prepareBlinkingOptions = function (colIndex
|
|
774
822
|
} else if(typeof blinkingOptions === "object") {
|
775
823
|
blinkField = /** @type{string} */(blinkingOptions["field"]) || field;
|
776
824
|
bOptions.border = blinkingOptions["border"];
|
825
|
+
bOptions.duration = blinkingOptions["duration"];
|
777
826
|
if (blinkingOptions["up"] || blinkingOptions["down"] || blinkingOptions["level"]) {
|
778
827
|
bOptions.customColor = true;
|
779
828
|
bOptions.up = blinkingOptions["up"];
|
@@ -784,52 +833,81 @@ ConditionalColoringPlugin.prototype._prepareBlinkingOptions = function (colIndex
|
|
784
833
|
bOptions.level = false;
|
785
834
|
}
|
786
835
|
}
|
787
|
-
|
788
836
|
bOptions.field = ConditionalColoringPlugin._convertKeyword(blinkField, field);
|
789
837
|
bOptions.inputField = blinkField;
|
790
838
|
return bOptions;
|
791
839
|
};
|
792
840
|
|
841
|
+
/** @private
|
842
|
+
* @param {Object} obj
|
843
|
+
* @param {Array|string} entries
|
844
|
+
*/
|
845
|
+
var _addMapEntries = function(obj, entries) {
|
846
|
+
if(entries) {
|
847
|
+
if(Array.isArray(entries)) {
|
848
|
+
var len = entries.length;
|
849
|
+
for(var i = 0; i < len; ++i) {
|
850
|
+
obj[entries[i]] = true;
|
851
|
+
}
|
852
|
+
} else {
|
853
|
+
obj[entries] = true;
|
854
|
+
}
|
855
|
+
}
|
856
|
+
};
|
793
857
|
/** @private
|
794
858
|
* @param {number} colIndex
|
795
859
|
* @param {ConditionalColoringPlugin~ColumnOptions} columnOptions
|
796
860
|
* @return {!Object}
|
797
861
|
*/
|
798
862
|
ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, columnOptions) {
|
799
|
-
var colorOptions = {};
|
800
863
|
if(!columnOptions) {
|
801
|
-
return
|
864
|
+
return {};
|
802
865
|
}
|
803
866
|
var colField = this._getField(colIndex);
|
804
|
-
var field = /** @type{string} */(columnOptions["field"]) || colField;
|
805
867
|
var inputField = columnOptions["inputField"] || ""; // The value is from user so it can be "THIS_COLUMN" or null
|
806
|
-
|
807
|
-
|
868
|
+
var field = ConditionalColoringPlugin._convertKeyword(inputField, colField);
|
869
|
+
if(columnOptions["field"]) {
|
870
|
+
field = /** @type{string} */(columnOptions["field"]);
|
871
|
+
}
|
872
|
+
|
873
|
+
var hasColor = 0;
|
874
|
+
var fieldMap = {};
|
808
875
|
|
809
876
|
// Check if there is another type of coloring
|
810
|
-
// "colorText" option has more priority than "tickColor"
|
811
877
|
var colorText = columnOptions["colorText"] || columnOptions["tickColor"];
|
812
878
|
var conditions = columnOptions["conditions"];
|
813
879
|
var conditionCount = conditions ? conditions.length : 0;
|
880
|
+
var colorOptions = {};
|
814
881
|
if(conditionCount) {
|
815
|
-
colorOptions.hasColor = 1;
|
816
|
-
colorOptions.fields = {};
|
817
882
|
colorOptions.condColoring = {};
|
818
883
|
colorOptions.condColoring.conditions = conditions;
|
819
884
|
|
820
|
-
var formatter = (field == colField) ? columnOptions["textFormatter"] : null;
|
885
|
+
var formatter = (field == colField) ? columnOptions["textFormatter"] : null; // TODO: This text formatter is not used or defined any where
|
821
886
|
var builder = ConditionalColoringPlugin.getFilterBuilder();
|
822
887
|
|
823
|
-
// WARNING: Builder has to have field first
|
824
|
-
builder.setFieldDefinition(field, formatter, field);
|
825
|
-
|
826
888
|
for(var i = conditionCount; --i >= 0;) {
|
827
889
|
var cond = conditions[i];
|
828
|
-
var exp = cond["expression"];
|
829
|
-
if(
|
830
|
-
var
|
890
|
+
var exp = cond ? cond["expression"] : null;
|
891
|
+
if(Array.isArray(exp)) {
|
892
|
+
var fieldPerCon = cond["field"] || field;
|
893
|
+
cond["expression"] = builder.parse(exp, fieldPerCon, null, fieldPerCon); // WARNING: This alters user object
|
894
|
+
if(cond["expression"]) {
|
895
|
+
cond["origExpression"] = exp;
|
896
|
+
hasColor = 1;
|
897
|
+
fieldMap[fieldPerCon] = true;
|
898
|
+
}
|
899
|
+
} else if(typeof exp === "function") {
|
900
|
+
hasColor = 1;
|
901
|
+
_addMapEntries(fieldMap, cond["fields"] || cond["field"]);
|
902
|
+
} else if(typeof exp === "string") {
|
903
|
+
hasColor = 1;
|
904
|
+
_addMapEntries(fieldMap, _getFieldsFromExpression(exp));
|
905
|
+
} else if(field && cond["condition"]) {
|
906
|
+
hasColor = 1;
|
907
|
+
builder.setFieldDefinition(field, formatter, field); // TODO: Each condition could have different fields
|
908
|
+
var oper = cond["condition"]; // WARNING: This condition is used by Format dialog. It's undocumented
|
831
909
|
var value1 = cond["value1"];
|
832
|
-
var value2 = cond["
|
910
|
+
var value2 = cond["value2"];
|
833
911
|
|
834
912
|
if(oper !== "BTW") {
|
835
913
|
builder.addCondition(oper, value1);
|
@@ -837,26 +915,16 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
837
915
|
builder.addCondition("GTE", value1);
|
838
916
|
builder.addCondition("LTE", value2);
|
839
917
|
}
|
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
|
-
}
|
918
|
+
cond["expression"] = builder.buildFilter();
|
919
|
+
fieldMap[field] = true;
|
849
920
|
}
|
850
921
|
}
|
851
922
|
} else if(colorText) {
|
852
|
-
colorOptions.hasColor = 1;
|
853
|
-
colorOptions.fields = {};
|
854
923
|
colorOptions.colorText = {};
|
855
924
|
colorOptions.colorText.useThemeColors = true;
|
856
|
-
|
857
|
-
if(type === "string") {
|
925
|
+
if(typeof colorText === "string") {
|
858
926
|
field = colorText;
|
859
|
-
} else if(
|
927
|
+
} else if(typeof colorText === "object") {
|
860
928
|
field = /** @type{string} */(colorText["field"]) || field;
|
861
929
|
|
862
930
|
if (colorText["upClass"] || colorText["downClass"] || colorText["levelClass"]) {
|
@@ -866,11 +934,22 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
866
934
|
colorOptions.colorText.levelClass = colorText["levelClass"];
|
867
935
|
}
|
868
936
|
}
|
869
|
-
|
870
|
-
|
937
|
+
|
938
|
+
if(field) {
|
939
|
+
colorOptions.colorText.field = field;
|
940
|
+
hasColor = 1;
|
941
|
+
fieldMap[field] = true;
|
942
|
+
}
|
943
|
+
}
|
944
|
+
|
945
|
+
if(hasColor) {
|
946
|
+
colorOptions.hasColor = 1;
|
947
|
+
colorOptions.fields = fieldMap;
|
948
|
+
colorOptions["inputField"] = inputField; // Used to retain state on Column Format Dialog
|
949
|
+
return colorOptions;
|
871
950
|
}
|
872
951
|
|
873
|
-
return
|
952
|
+
return {};
|
874
953
|
};
|
875
954
|
/** @private
|
876
955
|
* @function
|
@@ -881,7 +960,7 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
881
960
|
ConditionalColoringPlugin._convertKeyword = function(userInput, fallback) {
|
882
961
|
if(userInput) {
|
883
962
|
// Note that THIS_COLUMN is a special keyword that needs to be converted before usage
|
884
|
-
return userInput.indexOf("THIS_COLUMN")
|
963
|
+
return userInput.indexOf("THIS_COLUMN") < 0 ? userInput : fallback;
|
885
964
|
}
|
886
965
|
return fallback;
|
887
966
|
};
|
@@ -1005,6 +1084,14 @@ ConditionalColoringPlugin.prototype.setPredefinedColors = function(predefinedCol
|
|
1005
1084
|
}
|
1006
1085
|
}
|
1007
1086
|
};
|
1087
|
+
/** @public
|
1088
|
+
* @param {boolean} blinking enable blinking on row insertion
|
1089
|
+
*/
|
1090
|
+
ConditionalColoringPlugin.prototype.setInsertionBlinking = function(blinking) {
|
1091
|
+
if (blinking != null) {
|
1092
|
+
this._insertionBlinking = blinking;
|
1093
|
+
}
|
1094
|
+
};
|
1008
1095
|
/** @private
|
1009
1096
|
* @function
|
1010
1097
|
* @return {!FilterBuilder}
|
@@ -1060,7 +1147,7 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1060
1147
|
return; // dataRows could be empty in case of no column is presented
|
1061
1148
|
}
|
1062
1149
|
|
1063
|
-
var c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows;
|
1150
|
+
var c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows, allowBlinking, insertedRow;
|
1064
1151
|
var dataRow, insertedId, colData, blinking, bgBlinking, cachedValues, updatePrev;
|
1065
1152
|
var section = e["section"];
|
1066
1153
|
var colCount = section.getColumnCount();
|
@@ -1079,6 +1166,8 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1079
1166
|
}
|
1080
1167
|
|
1081
1168
|
var prevDataRow, prevDataRows = host._prevDataRows;
|
1169
|
+
var prevIds = Object.keys(prevDataRows);
|
1170
|
+
var prevRowCount = prevIds.length;
|
1082
1171
|
for (r = fromR; r < toR; ++r) {
|
1083
1172
|
dataRow = this._rowGetter(dataRows[r]);
|
1084
1173
|
if (!dataRow) continue; // prevent from null value access when using with RowGroupingExtension
|
@@ -1089,14 +1178,18 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1089
1178
|
// TODO: check rid from e.rids
|
1090
1179
|
rowDef = /** @type{RowDefinition} */(dataRow["ROW_DEF"]);
|
1091
1180
|
rid = rowDef ? rowDef.getRowId() : "";
|
1092
|
-
|
1181
|
+
insertedRow = insertedId[rid];
|
1182
|
+
allowBlinking = !insertedRow || this._insertionBlinking;
|
1183
|
+
if (rid && allowBlinking) {
|
1093
1184
|
changedCols = rowDef.getUpdates();
|
1094
1185
|
}
|
1095
1186
|
} else { // composite grid
|
1096
1187
|
changedRow = changedRows[r];
|
1097
1188
|
if (changedRow) {
|
1098
1189
|
rid = changedRow.rid;
|
1099
|
-
|
1190
|
+
insertedRow = insertedId[rid];
|
1191
|
+
allowBlinking = !insertedRow || this._insertionBlinking;
|
1192
|
+
if (allowBlinking) {
|
1100
1193
|
changedCols = changedRow.changed;
|
1101
1194
|
}
|
1102
1195
|
}
|
@@ -1125,7 +1218,7 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1125
1218
|
colData = this._getColumnData(c);
|
1126
1219
|
bgBlinking = false;
|
1127
1220
|
blinking = false;
|
1128
|
-
if (colData["blinking"] && actualUpdate) { // blinking
|
1221
|
+
if (colData["blinking"] && actualUpdate && allowBlinking) { // blinking
|
1129
1222
|
var field = colData["blinkingField"] || this._getField(c);
|
1130
1223
|
var newValue = dataRow[field];
|
1131
1224
|
if (prevDataRow) {
|
@@ -1136,6 +1229,11 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1136
1229
|
bgBlinking = painter.blinkCell(cell, newValue, prevValue, dataRow, dataRow);
|
1137
1230
|
}
|
1138
1231
|
}
|
1232
|
+
} else {
|
1233
|
+
if(prevRowCount && insertedRow){
|
1234
|
+
blinking = true;
|
1235
|
+
bgBlinking = painter.blinkCell(cell, newValue, newValue, dataRow, dataRow);
|
1236
|
+
}
|
1139
1237
|
}
|
1140
1238
|
|
1141
1239
|
if (!blinking) {
|
@@ -53,7 +53,8 @@ import CellPainter from "../../tr-grid-util/es6/CellPainter.js";
|
|
53
53
|
/** @typedef {Object} ContextMenuPlugin~OnMenuEvent
|
54
54
|
* @property {Object} cell Grid cell object at the mouse clicked position
|
55
55
|
* @property {number} colIndex Index number of the column that the mouse clicked on
|
56
|
-
* @property {
|
56
|
+
* @property {string} field Field of the column that the mouse clicked on
|
57
|
+
* @property {string} colId Column ID of the column that the mouse clicked on
|
57
58
|
* @property {ContextMenuPlugin~Context} context Area of the grid that the mouse clicked on
|
58
59
|
* @property {object} items Object reference to the menu items under items option
|
59
60
|
* @property {MenuEventAPI} menu API for adding menu items to be rendered
|
@@ -128,10 +129,6 @@ ContextMenuPlugin.prototype._rsp = null;
|
|
128
129
|
* @private
|
129
130
|
*/
|
130
131
|
ContextMenuPlugin.prototype._contextMenu = null;
|
131
|
-
/** @type {Array}
|
132
|
-
* @private
|
133
|
-
*/
|
134
|
-
ContextMenuPlugin.prototype._userColumns = null;
|
135
132
|
|
136
133
|
/** @public
|
137
134
|
* @return {string}
|
@@ -191,7 +188,6 @@ ContextMenuPlugin.prototype.config = function (options) {
|
|
191
188
|
|
192
189
|
var t = this;
|
193
190
|
|
194
|
-
t._userColumns = options["columns"];
|
195
191
|
var contextMenu = options["contextMenu"];
|
196
192
|
|
197
193
|
if (contextMenu == null) { return; }
|
@@ -237,11 +233,15 @@ ContextMenuPlugin.prototype.getMenuModel = function () {
|
|
237
233
|
* @return {!Object} Mouse related information
|
238
234
|
*/
|
239
235
|
ContextMenuPlugin.prototype._configureMouseInfo = function (e) {
|
240
|
-
var
|
236
|
+
var host = this._hosts[0];
|
237
|
+
var mouseInfo = host.getRelativePosition(e);
|
241
238
|
|
242
239
|
// Supply possibly needed arguments for the event handler
|
243
240
|
mouseInfo.context = this._contextMap[mouseInfo.sectionType] || "";
|
244
|
-
|
241
|
+
var colIndex = mouseInfo.colIndex;
|
242
|
+
var columnDef = mouseInfo.columnDef = {};
|
243
|
+
mouseInfo.field = columnDef.field = this.getColumnField(colIndex);
|
244
|
+
mouseInfo.colId = columnDef.id = this.getColumnId(colIndex);
|
245
245
|
|
246
246
|
if (!this._csp) {
|
247
247
|
this._csp = this._getPlugin("ColumnSelectionPlugin");
|