@refinitiv-ui/efx-grid 6.0.92 → 6.0.94
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/filter-dialog/lib/filter-dialog.js +1 -0
- package/lib/formatters/es6/CoralButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/CoralButtonFormatter.js +9 -4
- package/lib/formatters/es6/CoralCheckboxFormatter.js +10 -5
- package/lib/formatters/es6/CoralComboBoxFormatter.js +13 -12
- package/lib/formatters/es6/CoralIconFormatter.d.ts +0 -2
- package/lib/formatters/es6/CoralIconFormatter.js +9 -4
- package/lib/formatters/es6/CoralInputFormatter.js +9 -4
- package/lib/formatters/es6/CoralRadioButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/CoralRadioButtonFormatter.js +20 -15
- package/lib/formatters/es6/CoralSelectFormatter.js +12 -7
- package/lib/formatters/es6/CoralToggleFormatter.js +4 -4
- package/lib/formatters/es6/DuplexEmeraldDateTimePickerFormatter.js +20 -20
- package/lib/formatters/es6/EFButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/EFButtonFormatter.js +9 -4
- package/lib/formatters/es6/EFCheckboxFormatter.js +10 -5
- package/lib/formatters/es6/EFComboBoxFormatter.js +17 -7
- package/lib/formatters/es6/EFDateTimePickerFormatter.js +11 -6
- package/lib/formatters/es6/EFIconFormatter.d.ts +0 -2
- package/lib/formatters/es6/EFIconFormatter.js +9 -4
- package/lib/formatters/es6/EFNumberFieldFormatter.js +9 -4
- package/lib/formatters/es6/EFRadioButtonFormatter.d.ts +0 -2
- package/lib/formatters/es6/EFRadioButtonFormatter.js +25 -15
- package/lib/formatters/es6/EFSelectFormatter.js +17 -7
- package/lib/formatters/es6/EFTextFieldFormatter.js +4 -4
- package/lib/formatters/es6/EFToggleFormatter.js +4 -4
- package/lib/formatters/es6/EmeraldDateTimePickerFormatter.js +6 -6
- package/lib/formatters/es6/FormatterBuilder.js +32 -32
- package/lib/formatters/es6/NumericInputFormatter.js +7 -7
- package/lib/formatters/es6/PercentBarFormatter.js +5 -5
- package/lib/formatters/es6/SimpleImageFormatter.js +3 -3
- package/lib/formatters/es6/SimpleInputFormatter.js +4 -4
- package/lib/formatters/es6/SimpleLinkFormatter.js +4 -4
- package/lib/formatters/es6/SimpleTickerFormatter.js +5 -5
- package/lib/formatters/es6/SimpleToggleFormatter.js +16 -16
- package/lib/formatters/es6/TextFormatter.js +4 -4
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +1 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +36 -36
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +139 -137
- package/lib/tr-grid-row-selection/es6/RowSelection.js +260 -279
- package/lib/tr-grid-util/es6/CellPainter.js +2 -13
- package/lib/tr-grid-util/es6/DateTime.js +2 -2
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +13 -2
- package/lib/tr-grid-util/es6/DragUI.js +1 -1
- package/lib/tr-grid-util/es6/FilterBuilder.js +1 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +0 -1
- package/lib/tr-grid-util/es6/MultiTableManager.js +4 -13
- package/lib/tr-grid-util/es6/NumberFormatter.js +1 -1
- package/lib/tr-grid-util/es6/TextHighlighter.js +3 -3
- package/lib/types/es6/ColumnGrouping.d.ts +1 -2
- package/lib/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +14 -14
- package/package.json +1 -1
@@ -37,10 +37,10 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
37
37
|
* @property {string=} cssClass cssClass="" Predefined color class name
|
38
38
|
* @property {string=} field Field to be used for this specific condition, overriding the field defined in ConditionalColoringOptions
|
39
39
|
* @example
|
40
|
-
*
|
40
|
+
* let conditions1 = [ // Add cssClass for any value that is greater than or equal to 10, and less than or equal to 20
|
41
41
|
* {expression: [["GTE", 10, "AND"], ["LTE", 20]], cssClass: "predefinedColors"}
|
42
42
|
* ];
|
43
|
-
*
|
43
|
+
* let conditions2 = [ // Add background color for any fieldA value that is not blank value (e.g., null, undefined, 0, false, empty string)
|
44
44
|
* {
|
45
45
|
* expression: function(rowData) {
|
46
46
|
* return rowData["fieldA"] ? true : false;
|
@@ -49,7 +49,7 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
49
49
|
* field: "fieldA"
|
50
50
|
* }
|
51
51
|
* ];
|
52
|
-
*
|
52
|
+
* let conditions3 = [ // Add text color for any fieldA value that is not equal to 10
|
53
53
|
* {expression: "[fieldA] != 10", color: "red"}
|
54
54
|
* ];
|
55
55
|
*/
|
@@ -74,30 +74,50 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
74
74
|
* @property {string=} levelClass CSS class name.
|
75
75
|
*/
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
/** @type {string}
|
78
|
+
* @private
|
79
|
+
* @constant
|
80
|
+
*/
|
81
|
+
const COLORING_TYPE = "coloring";
|
82
|
+
/** @type {string}
|
83
|
+
* @private
|
84
|
+
* @constant
|
85
|
+
*/
|
86
|
+
const BLINKING_TYPE = "blinking";
|
87
|
+
/** @type {Object}
|
88
|
+
* @private
|
89
|
+
* @constant
|
90
|
+
*/
|
91
|
+
const CLEARING_BG = {
|
80
92
|
"backgroundColor": 1
|
81
93
|
};
|
82
|
-
|
94
|
+
/** @type {Object}
|
95
|
+
* @private
|
96
|
+
* @constant
|
97
|
+
*/
|
98
|
+
const CLEARING_TEXT = {
|
83
99
|
"color": 1
|
84
100
|
};
|
85
|
-
|
101
|
+
/** @type {Object}
|
102
|
+
* @private
|
103
|
+
* @constant
|
104
|
+
*/
|
105
|
+
const CLEARING_ALL = {
|
86
106
|
"backgroundColor": 1,
|
87
107
|
"color": 1
|
88
108
|
};
|
89
109
|
|
90
|
-
|
110
|
+
let _bracketExp = /\[[^\[\]]*\]/g;
|
91
111
|
|
92
112
|
/** @private
|
93
113
|
* @param {string} exp Expression string
|
94
114
|
* @return {Array.<string>}
|
95
115
|
*/
|
96
|
-
|
97
|
-
|
116
|
+
let _getFieldsFromExpression = function(exp) {
|
117
|
+
let fields = [];
|
98
118
|
if(exp && typeof exp === "string") {
|
99
|
-
|
100
|
-
for (
|
119
|
+
let matches = exp.match(_bracketExp);
|
120
|
+
for (let i = 0; i < matches.length; i++) {
|
101
121
|
fields.push(matches[i].replace(/[\[\]]/g, ""));
|
102
122
|
}
|
103
123
|
}
|
@@ -107,7 +127,7 @@ var _getFieldsFromExpression = function(exp) {
|
|
107
127
|
/** @constructor
|
108
128
|
* @extends {GridPlugin}
|
109
129
|
*/
|
110
|
-
|
130
|
+
let ConditionalColoringPlugin = function () {
|
111
131
|
this._onSectionBinding = this._onSectionBinding.bind(this);
|
112
132
|
this._onColumnAdded = this._onColumnAdded.bind(this);
|
113
133
|
this._onColumnRemoved = this._onColumnRemoved.bind(this);
|
@@ -182,14 +202,14 @@ ConditionalColoringPlugin.prototype.hasMultiTableSupport = function() {
|
|
182
202
|
ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
183
203
|
host._prevDataRows = {};
|
184
204
|
|
185
|
-
|
205
|
+
let hosts = this._hosts;
|
186
206
|
if(hosts.indexOf(host) >= 0) { return; }
|
187
207
|
|
188
208
|
hosts.push(host);
|
189
209
|
|
190
|
-
|
210
|
+
let extOptions = options["conditionalColoring"];
|
191
211
|
if (extOptions) {
|
192
|
-
|
212
|
+
let predefinedColors = extOptions["predefinedColors"];
|
193
213
|
if (predefinedColors != null && typeof predefinedColors === "object") {
|
194
214
|
if (!this._predefinedColors) {
|
195
215
|
this._predefinedColors = predefinedColors;
|
@@ -199,11 +219,11 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
199
219
|
this._injectPredefinedColors(host);
|
200
220
|
host.enableClass(ConditionalColoringPlugin._controlClass);
|
201
221
|
}
|
202
|
-
|
222
|
+
let blinkingDuration = extOptions["blinkingDuration"];
|
203
223
|
if(blinkingDuration != null && typeof blinkingDuration === "number"){
|
204
224
|
this._blinkingDuration = blinkingDuration;
|
205
225
|
}
|
206
|
-
|
226
|
+
let insertionBlinking = extOptions["insertionBlinking"];
|
207
227
|
if(insertionBlinking != null){
|
208
228
|
this._insertionBlinking = insertionBlinking;
|
209
229
|
}
|
@@ -235,10 +255,10 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
235
255
|
* @ignore
|
236
256
|
*/
|
237
257
|
ConditionalColoringPlugin.prototype._afterInit = function () {
|
238
|
-
|
258
|
+
let pendingFields = this._pendingFields;
|
239
259
|
if(pendingFields) {
|
240
|
-
|
241
|
-
for(
|
260
|
+
let fields, colIndex, type;
|
261
|
+
for(let i = 0; i < pendingFields.length; i++) {
|
242
262
|
fields = pendingFields[i][0];
|
243
263
|
colIndex = pendingFields[i][1];
|
244
264
|
type = pendingFields[i][2];
|
@@ -252,7 +272,7 @@ ConditionalColoringPlugin.prototype._afterInit = function () {
|
|
252
272
|
* @param {Object} host core grid object
|
253
273
|
*/
|
254
274
|
ConditionalColoringPlugin.prototype.unload = function (host) {
|
255
|
-
|
275
|
+
let at = this._hosts.indexOf(host);
|
256
276
|
if(at < 0) { return; }
|
257
277
|
this._hosts.splice(at, 1);
|
258
278
|
|
@@ -283,11 +303,11 @@ ConditionalColoringPlugin.prototype.beforeProcessOption = function (optionName,
|
|
283
303
|
ConditionalColoringPlugin.prototype.config = function (options) {
|
284
304
|
if(!options) { return; }
|
285
305
|
|
286
|
-
|
306
|
+
let columns = options["columns"];
|
287
307
|
if(!columns) { return; }
|
288
308
|
|
289
|
-
|
290
|
-
for(
|
309
|
+
let len = columns.length;
|
310
|
+
for(let i = 0; i < len; ++i) {
|
291
311
|
this.setColumnColoring(i, columns[i]);
|
292
312
|
}
|
293
313
|
};
|
@@ -297,9 +317,9 @@ ConditionalColoringPlugin.prototype.config = function (options) {
|
|
297
317
|
* @return {!Object}
|
298
318
|
*/
|
299
319
|
ConditionalColoringPlugin.prototype.getConfigObject = function (gridOptions) {
|
300
|
-
|
320
|
+
let obj = gridOptions || {};
|
301
321
|
|
302
|
-
|
322
|
+
let extOptions = obj["conditionalColoring"];
|
303
323
|
if(!extOptions) {
|
304
324
|
extOptions = obj["conditionalColoring"] = {};
|
305
325
|
}
|
@@ -316,14 +336,14 @@ ConditionalColoringPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
316
336
|
extOptions["insertionBlinking"] = this._insertionBlinking;
|
317
337
|
}
|
318
338
|
|
319
|
-
|
339
|
+
let columns = obj.columns;
|
320
340
|
if (!columns) {
|
321
341
|
columns = obj.columns = [];
|
322
342
|
}
|
323
343
|
|
324
|
-
|
325
|
-
for (
|
326
|
-
|
344
|
+
let len = this.getColumnCount();
|
345
|
+
for (let i = 0; i < len; ++i) {
|
346
|
+
let column = columns[i];
|
327
347
|
if (!column) {
|
328
348
|
column = columns[i] = {};
|
329
349
|
}
|
@@ -343,25 +363,25 @@ ConditionalColoringPlugin.prototype.getColumnColoring = function(colIndex, optio
|
|
343
363
|
if(!options) {
|
344
364
|
options = {};
|
345
365
|
}
|
346
|
-
|
347
|
-
|
366
|
+
let host = this._hosts[0];
|
367
|
+
let conditions = this._getColumnOption(colIndex, "conditions", host);
|
348
368
|
if (Array.isArray(conditions) && conditions.length > 0) {
|
349
369
|
options.conditions = [];
|
350
370
|
|
351
|
-
|
371
|
+
let returnedFields = [
|
352
372
|
"expression",
|
353
373
|
"backgroundColor",
|
354
374
|
"color",
|
355
375
|
"cssClass",
|
356
376
|
"field"
|
357
377
|
];
|
358
|
-
|
359
|
-
for (
|
360
|
-
|
361
|
-
|
378
|
+
let count = conditions.length;
|
379
|
+
for (let n = 0; n < count; n++) {
|
380
|
+
let exCondition = {};
|
381
|
+
let cond = conditions[n];
|
362
382
|
extendObject(exCondition, cond, returnedFields);
|
363
383
|
if(typeof exCondition["expression"] === "function") {
|
364
|
-
|
384
|
+
let origExp = cond["origExpression"];
|
365
385
|
if(origExp) {
|
366
386
|
exCondition["expression"] = origExp;
|
367
387
|
}
|
@@ -371,23 +391,23 @@ ConditionalColoringPlugin.prototype.getColumnColoring = function(colIndex, optio
|
|
371
391
|
}
|
372
392
|
}
|
373
393
|
|
374
|
-
|
394
|
+
let colorText = this._getColumnOption(colIndex, "colorText", host);
|
375
395
|
if (colorText) {
|
376
396
|
options.colorText = colorText;
|
377
397
|
}
|
378
398
|
|
379
399
|
// alias with colorText
|
380
|
-
|
400
|
+
let tickColor = this._getColumnOption(colIndex, "tickColor", host);
|
381
401
|
if (tickColor) {
|
382
402
|
options.tickColor = tickColor;
|
383
403
|
}
|
384
404
|
|
385
|
-
|
405
|
+
let blinking = this._getColumnOption(colIndex, "blinking", host);
|
386
406
|
if (blinking) {
|
387
407
|
options.blinking = blinking;
|
388
408
|
}
|
389
409
|
|
390
|
-
|
410
|
+
let field = this._getField(colIndex);
|
391
411
|
if (field) {
|
392
412
|
options.field = field;
|
393
413
|
}
|
@@ -402,12 +422,12 @@ ConditionalColoringPlugin.prototype.getColumnColoring = function(colIndex, optio
|
|
402
422
|
ConditionalColoringPlugin.prototype._applyStyle = function(host, options) {
|
403
423
|
if(!options) { return; }
|
404
424
|
|
405
|
-
|
425
|
+
let columns = options["columns"];
|
406
426
|
if(!columns) { return; }
|
407
427
|
|
408
|
-
|
409
|
-
|
410
|
-
for(
|
428
|
+
let painter;
|
429
|
+
let len = columns.length;
|
430
|
+
for(let i = 0; i < len; ++i) {
|
411
431
|
painter = this.getColumnPainter(i);
|
412
432
|
if(this._isValidPainter(painter)) {
|
413
433
|
host.enableColumnClass(i, "conditionally-colored", true);
|
@@ -421,9 +441,9 @@ ConditionalColoringPlugin.prototype._applyStyle = function(host, options) {
|
|
421
441
|
*/
|
422
442
|
ConditionalColoringPlugin.prototype._enableColumnStyle = function(colIndex, enabled) {
|
423
443
|
enabled = enabled !== false;
|
424
|
-
|
425
|
-
|
426
|
-
for(
|
444
|
+
let hosts = this._hosts;
|
445
|
+
let grid;
|
446
|
+
for(let i = hosts.length; --i >= 0;) {
|
427
447
|
grid = hosts[i];
|
428
448
|
grid.enableColumnClass(colIndex, "conditionally-colored", enabled);
|
429
449
|
}
|
@@ -437,7 +457,7 @@ ConditionalColoringPlugin.prototype._isValidPainter = function(painter) {
|
|
437
457
|
if (!painter) {
|
438
458
|
return false;
|
439
459
|
}
|
440
|
-
|
460
|
+
let type = painter.getColoringType();
|
441
461
|
if (type !== CellPainter.ColoringTypes.HEATMAP) {
|
442
462
|
return true;
|
443
463
|
} else {
|
@@ -450,8 +470,8 @@ ConditionalColoringPlugin.prototype._isValidPainter = function(painter) {
|
|
450
470
|
* @param {Object=} styleMapping
|
451
471
|
*/
|
452
472
|
ConditionalColoringPlugin.prototype._clearCellStyles = function(colIndex, styleMapping) {
|
453
|
-
|
454
|
-
|
473
|
+
let i, grid, sect, rowCount, r, cell;
|
474
|
+
let hosts = this._hosts;
|
455
475
|
for(i = hosts.length; --i >= 0;) {
|
456
476
|
grid = hosts[i];
|
457
477
|
sect = grid.getSection("content");
|
@@ -468,10 +488,10 @@ ConditionalColoringPlugin.prototype._clearCellStyles = function(colIndex, styleM
|
|
468
488
|
/** @private
|
469
489
|
*/
|
470
490
|
ConditionalColoringPlugin.prototype._cachePreviousValue = function() {
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
491
|
+
let colCount = this.getColumnCount();
|
492
|
+
let hosts = this._hosts;
|
493
|
+
let len = hosts.length;
|
494
|
+
let i, c, host;
|
475
495
|
for (i = 0; i < len; i++) {
|
476
496
|
host = hosts[i];
|
477
497
|
for (c = 0; c < colCount; ++c) {
|
@@ -485,13 +505,13 @@ ConditionalColoringPlugin.prototype._cachePreviousValue = function() {
|
|
485
505
|
* @param {Object} host
|
486
506
|
*/
|
487
507
|
ConditionalColoringPlugin.prototype._cacheColumnPreviousValue = function(colIndex, host) {
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
508
|
+
let prevDataRows = host._prevDataRows || {};
|
509
|
+
let dv = host.getDataSource();
|
510
|
+
let rowCount = dv.getRowCount();
|
511
|
+
let colData = this._getColumnData(colIndex);
|
492
512
|
if (colData["blinking"]) {
|
493
|
-
|
494
|
-
|
513
|
+
let field = colData["blinkingField"] || this._getField(colIndex);
|
514
|
+
let r, rid, value, prevDataRow;
|
495
515
|
for (r = 0; r < rowCount; r++) {
|
496
516
|
rid = dv.getRowId(r);
|
497
517
|
value = this._getData(dv, r, field);
|
@@ -517,9 +537,9 @@ ConditionalColoringPlugin.prototype._addDataFields = function(fieldRef, colRef,
|
|
517
537
|
if(!this._realTimeGrid || !fieldRef || !type) {
|
518
538
|
return;
|
519
539
|
}
|
520
|
-
|
540
|
+
let referrer = null;
|
521
541
|
if (colRef != null) {
|
522
|
-
|
542
|
+
let colDef = typeof colRef === "object" ? colRef : this._realTimeGrid.getColumnDefinition(colRef);
|
523
543
|
referrer = colDef ? colDef.getId() + "_" + type : null;
|
524
544
|
}
|
525
545
|
|
@@ -535,9 +555,9 @@ ConditionalColoringPlugin.prototype._removeDataFields = function(fieldRef, colRe
|
|
535
555
|
if(!this._realTimeGrid || !fieldRef || !type) {
|
536
556
|
return;
|
537
557
|
}
|
538
|
-
|
558
|
+
let referrer = null;
|
539
559
|
if (colRef != null) {
|
540
|
-
|
560
|
+
let colDef = typeof colRef === "object" ? colRef : this._realTimeGrid.getColumnDefinition(colRef);
|
541
561
|
referrer = colDef ? colDef.getId() + "_" + type : null;
|
542
562
|
}
|
543
563
|
this._realTimeGrid.removeDataFields(fieldRef, referrer);
|
@@ -551,11 +571,11 @@ ConditionalColoringPlugin.prototype._removeFieldReferrer = function(colRef, type
|
|
551
571
|
if(!this._realTimeGrid || !type) {
|
552
572
|
return;
|
553
573
|
}
|
554
|
-
|
574
|
+
let referrer = null;
|
555
575
|
if (colRef != null) {
|
556
|
-
|
576
|
+
let colId = colRef;
|
557
577
|
if (typeof colRef === "number") {
|
558
|
-
|
578
|
+
let colDef = this._realTimeGrid.getColumnDefinition(colRef);
|
559
579
|
if (colDef) {
|
560
580
|
colId = colDef.getId();
|
561
581
|
}
|
@@ -577,7 +597,7 @@ ConditionalColoringPlugin.prototype._removeFieldReferrer = function(colRef, type
|
|
577
597
|
* @see {@link ConditionalColoringPlugin.setConditionalColoring}
|
578
598
|
* @see {@link ConditionalColoringPlugin.setColumnBlinking}
|
579
599
|
* @example
|
580
|
-
*
|
600
|
+
* let columnOptions1 = {
|
581
601
|
* "field": "string",
|
582
602
|
* "conditions": [{ // Array.<Object> Condition Object Properties
|
583
603
|
* "expression": "[column0] > 0", // string
|
@@ -585,14 +605,14 @@ ConditionalColoringPlugin.prototype._removeFieldReferrer = function(colRef, type
|
|
585
605
|
* "color": "" // Optional string e.g. #000000, white
|
586
606
|
* }]
|
587
607
|
* };
|
588
|
-
*
|
608
|
+
* let columnOptions2 = {
|
589
609
|
* "field": "string",
|
590
610
|
* "colorText": true, // string as Field or boolean for text coloring mode
|
591
611
|
* "blinking": true
|
592
612
|
* };
|
593
613
|
*/
|
594
614
|
ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, columnOptions) {
|
595
|
-
|
615
|
+
let blinkingOptions, field;
|
596
616
|
if(columnOptions) {
|
597
617
|
blinkingOptions = columnOptions["blinking"];
|
598
618
|
field = columnOptions["field"];
|
@@ -601,7 +621,7 @@ ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, colu
|
|
601
621
|
this.setColumnBlinking(colIndex, blinkingOptions, field);
|
602
622
|
this.setConditionalColoring(colIndex, columnOptions);
|
603
623
|
|
604
|
-
|
624
|
+
let colData = this._newColumnData(colIndex);
|
605
625
|
if (colData["painter"] && !(colData["coloringFields"] || colData["blinkingField"])) { // Clear existing painter
|
606
626
|
this._clearPainter(colData);
|
607
627
|
}
|
@@ -612,7 +632,7 @@ ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, colu
|
|
612
632
|
* @param {ConditionalColoringPlugin~ConditionalColoringOptions=} coloringOptions
|
613
633
|
*/
|
614
634
|
ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex, coloringOptions) {
|
615
|
-
|
635
|
+
let colData = this._newColumnData(colIndex);
|
616
636
|
|
617
637
|
colData["conditions"] = null; // WARNING: This clears existing user states
|
618
638
|
if(coloringOptions) {
|
@@ -624,13 +644,13 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
624
644
|
colData["colorText"] = null;
|
625
645
|
colData["tickColor"] = null;
|
626
646
|
}
|
627
|
-
|
628
|
-
|
629
|
-
|
647
|
+
let painter = colData["painter"];
|
648
|
+
let prevFields = colData["coloringFields"] ? Object.keys(colData["coloringFields"]) : null;
|
649
|
+
let colorOptions = this._prepareColorOptions(colIndex, coloringOptions);
|
630
650
|
|
631
651
|
if (this._isValidPainter(painter)) {
|
632
652
|
if (prevFields) {
|
633
|
-
|
653
|
+
let effectiveStyles = painter.getEffectiveStyles();
|
634
654
|
this._clearCellStyles(colIndex, effectiveStyles); // Need to clear the existing previous coloring styles here
|
635
655
|
}
|
636
656
|
painter.resetColoring(); // Release any used memory
|
@@ -638,14 +658,14 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
638
658
|
|
639
659
|
if(colorOptions.hasColor) { // Set new coloring
|
640
660
|
colData["conditions"] = coloringOptions["conditions"]; // WARNING: This stores user object
|
641
|
-
|
661
|
+
let newFieldsMap = colorOptions.fields;
|
642
662
|
if (!painter) {
|
643
663
|
painter = colData["painter"] = new CellPainter();
|
644
664
|
} else if (prevFields) {
|
645
665
|
// Remove unused fields
|
646
|
-
|
647
|
-
|
648
|
-
for (
|
666
|
+
let unusedFields = [];
|
667
|
+
let prevField;
|
668
|
+
for (let i = 0; i < prevFields.length; i++) {
|
649
669
|
prevField = prevFields[i];
|
650
670
|
if (!newFieldsMap[prevField]) {
|
651
671
|
unusedFields.push(prevField);
|
@@ -657,14 +677,14 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
657
677
|
}
|
658
678
|
|
659
679
|
if(colorOptions.condColoring) {
|
660
|
-
|
680
|
+
let conditions = colorOptions.condColoring.conditions;
|
661
681
|
painter.setConditions(conditions);
|
662
682
|
this._setEffectiveStyles(painter, conditions);
|
663
683
|
} else if(colorOptions.colorText) {
|
664
|
-
|
684
|
+
let options = colorOptions.colorText;
|
665
685
|
if (options.useThemeColors) {
|
666
686
|
if (!ConditionalColoringPlugin._colorTextStyles) {
|
667
|
-
|
687
|
+
let styles = {
|
668
688
|
positive: {
|
669
689
|
color: "var(--color-scheme-positive)"
|
670
690
|
},
|
@@ -685,7 +705,7 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
685
705
|
}
|
686
706
|
}
|
687
707
|
|
688
|
-
|
708
|
+
let fields = Object.keys(newFieldsMap);
|
689
709
|
if (this._initializedGrid) {
|
690
710
|
this._addDataFields(fields, colIndex, COLORING_TYPE);
|
691
711
|
} else {
|
@@ -707,9 +727,9 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
707
727
|
this._enableColumnStyle(colIndex, false);
|
708
728
|
}
|
709
729
|
if (this._initializedGrid) {
|
710
|
-
|
730
|
+
let core = this._hosts[0];
|
711
731
|
if(core){
|
712
|
-
|
732
|
+
let rowColoring = core.getPlugin('RowColoringPlugin');
|
713
733
|
if(rowColoring && rowColoring.forceUpdateRowColor){
|
714
734
|
rowColoring.forceUpdateRowColor();
|
715
735
|
}
|
@@ -724,13 +744,13 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
724
744
|
* @param {string=} field If not specified, column field will be used
|
725
745
|
*/
|
726
746
|
ConditionalColoringPlugin.prototype.setColumnBlinking = function (colIndex, blinkingOptions, field) {
|
727
|
-
|
728
|
-
|
747
|
+
let colData = this._newColumnData(colIndex);
|
748
|
+
let prevField = colData["blinkingField"];
|
729
749
|
colData["blinking"] = blinkingOptions;
|
730
|
-
|
731
|
-
|
750
|
+
let painter = colData["painter"];
|
751
|
+
let bOptions = this._prepareBlinkingOptions(colIndex, blinkingOptions, field);
|
732
752
|
if (bOptions) {
|
733
|
-
|
753
|
+
let newBlinkingField = bOptions.field;
|
734
754
|
if (!painter) {
|
735
755
|
colData["painter"] = painter = new CellPainter();
|
736
756
|
} else if(prevField) {
|
@@ -740,7 +760,7 @@ ConditionalColoringPlugin.prototype.setColumnBlinking = function (colIndex, blin
|
|
740
760
|
this._removeDataFields(prevField, colIndex, BLINKING_TYPE);
|
741
761
|
}
|
742
762
|
}
|
743
|
-
|
763
|
+
let blinkDuration = bOptions.duration || this._blinkingDuration;
|
744
764
|
painter.setBlinkingDuration(blinkDuration);
|
745
765
|
painter.disableLevelColor(bOptions.level === false);
|
746
766
|
if (bOptions.customColor) {
|
@@ -755,8 +775,8 @@ ConditionalColoringPlugin.prototype.setColumnBlinking = function (colIndex, blin
|
|
755
775
|
// Emerald Grid needs to cache in the initializing phase
|
756
776
|
// Atlas Blotter will cache in the first binding
|
757
777
|
if (this._compositeGrid || this._initializedGrid) {
|
758
|
-
|
759
|
-
for (
|
778
|
+
let host, hosts = this._hosts;
|
779
|
+
for (let i = 0; i < hosts.length; i++) {
|
760
780
|
host = hosts[i];
|
761
781
|
this._cacheColumnPreviousValue(colIndex, host);
|
762
782
|
}
|
@@ -793,20 +813,20 @@ ConditionalColoringPlugin.prototype.blinkRow = function (rowIndex, blinkSignal,
|
|
793
813
|
host = host || this._hosts[0];
|
794
814
|
if (!host) return;
|
795
815
|
|
796
|
-
|
816
|
+
let dv = host.getDataSource();
|
797
817
|
if (!dv) return;
|
798
818
|
|
799
|
-
|
819
|
+
let section = host.getSection('content');
|
800
820
|
if (!section) return;
|
801
821
|
|
802
|
-
|
822
|
+
let rowData = dv.getRowDataAt(rowIndex);
|
803
823
|
|
804
|
-
|
805
|
-
for (
|
806
|
-
|
824
|
+
let colCount = section.getColumnCount();
|
825
|
+
for (let c = 0; c < colCount; ++c) {
|
826
|
+
let painter = this.getColumnPainter(c);
|
807
827
|
if (!painter) continue;
|
808
828
|
|
809
|
-
|
829
|
+
let cell = section.getCell(c, rowIndex, false);
|
810
830
|
if (!cell) continue;
|
811
831
|
painter.blink(cell, blinkSignal, rowData);
|
812
832
|
}
|
@@ -823,9 +843,9 @@ ConditionalColoringPlugin.prototype._prepareBlinkingOptions = function (colIndex
|
|
823
843
|
return null;
|
824
844
|
}
|
825
845
|
|
826
|
-
|
827
|
-
|
828
|
-
|
846
|
+
let bOptions = {};
|
847
|
+
let field = columnField || this._getField(colIndex);
|
848
|
+
let blinkField = field;
|
829
849
|
if (typeof blinkingOptions === "string") {
|
830
850
|
blinkField = blinkingOptions;
|
831
851
|
} else if(typeof blinkingOptions === "object") {
|
@@ -851,11 +871,11 @@ ConditionalColoringPlugin.prototype._prepareBlinkingOptions = function (colIndex
|
|
851
871
|
* @param {Object} obj
|
852
872
|
* @param {Array|string} entries
|
853
873
|
*/
|
854
|
-
|
874
|
+
let _addMapEntries = function(obj, entries) {
|
855
875
|
if(entries) {
|
856
876
|
if(Array.isArray(entries)) {
|
857
|
-
|
858
|
-
for(
|
877
|
+
let len = entries.length;
|
878
|
+
for(let i = 0; i < len; ++i) {
|
859
879
|
obj[entries[i]] = true;
|
860
880
|
}
|
861
881
|
} else {
|
@@ -872,33 +892,33 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
872
892
|
if(!columnOptions) {
|
873
893
|
return {};
|
874
894
|
}
|
875
|
-
|
876
|
-
|
877
|
-
|
895
|
+
let colField = this._getField(colIndex);
|
896
|
+
let inputField = columnOptions["inputField"] || ""; // The value is from user so it can be "THIS_COLUMN" or null
|
897
|
+
let field = ConditionalColoringPlugin._convertKeyword(inputField, colField);
|
878
898
|
if(columnOptions["field"]) {
|
879
899
|
field = /** @type{string} */(columnOptions["field"]);
|
880
900
|
}
|
881
901
|
|
882
|
-
|
883
|
-
|
902
|
+
let hasColor = 0;
|
903
|
+
let fieldMap = {};
|
884
904
|
|
885
905
|
// Check if there is another type of coloring
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
906
|
+
let colorText = columnOptions["colorText"] || columnOptions["tickColor"];
|
907
|
+
let conditions = columnOptions["conditions"];
|
908
|
+
let conditionCount = conditions ? conditions.length : 0;
|
909
|
+
let colorOptions = {};
|
890
910
|
if(conditionCount) {
|
891
911
|
colorOptions.condColoring = {};
|
892
912
|
colorOptions.condColoring.conditions = conditions;
|
893
913
|
|
894
|
-
|
895
|
-
|
914
|
+
let formatter = (field == colField) ? columnOptions["textFormatter"] : null; // TODO: This text formatter is not used or defined any where
|
915
|
+
let builder = ConditionalColoringPlugin.getFilterBuilder();
|
896
916
|
|
897
|
-
for(
|
898
|
-
|
899
|
-
|
917
|
+
for(let i = conditionCount; --i >= 0;) {
|
918
|
+
let cond = conditions[i];
|
919
|
+
let exp = cond ? cond["expression"] : null;
|
900
920
|
if(Array.isArray(exp)) {
|
901
|
-
|
921
|
+
let fieldPerCon = cond["field"] || field;
|
902
922
|
cond["expression"] = builder.parse(exp, fieldPerCon, null, fieldPerCon); // WARNING: This alters user object
|
903
923
|
if(cond["expression"]) {
|
904
924
|
cond["origExpression"] = exp;
|
@@ -914,9 +934,9 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
914
934
|
} else if(field && cond["condition"]) {
|
915
935
|
hasColor = 1;
|
916
936
|
builder.setFieldDefinition(field, formatter, field); // TODO: Each condition could have different fields
|
917
|
-
|
918
|
-
|
919
|
-
|
937
|
+
let oper = cond["condition"]; // WARNING: This condition is used by Format dialog. It's undocumented
|
938
|
+
let value1 = cond["value1"];
|
939
|
+
let value2 = cond["value2"];
|
920
940
|
|
921
941
|
if(oper !== "BTW") {
|
922
942
|
builder.addCondition(oper, value1);
|
@@ -980,10 +1000,10 @@ ConditionalColoringPlugin._convertKeyword = function(userInput, fallback) {
|
|
980
1000
|
* @return {Object} mapping of inserted row id
|
981
1001
|
*/
|
982
1002
|
ConditionalColoringPlugin._mapInsertedRowId = function (events) {
|
983
|
-
|
984
|
-
|
985
|
-
for (
|
986
|
-
|
1003
|
+
let insertedDict = {};
|
1004
|
+
let eventCount = events ? events.length : 0;
|
1005
|
+
for (let i = 0; i < eventCount; ++i) {
|
1006
|
+
let event = events[i];
|
987
1007
|
|
988
1008
|
// map inserted row
|
989
1009
|
if (event.type === "inserted") {
|
@@ -999,26 +1019,26 @@ ConditionalColoringPlugin._mapInsertedRowId = function (events) {
|
|
999
1019
|
* @return {!Array.<Object>} Array of merged changes
|
1000
1020
|
*/
|
1001
1021
|
ConditionalColoringPlugin._mergeUpdates = function(e) {
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1022
|
+
let evts = e.events; // dataSource event
|
1023
|
+
let evtCount = evts ? evts.length : 0;
|
1024
|
+
let dv = e.dataSource;
|
1025
|
+
let changedRows = [];
|
1026
|
+
let evt, i;
|
1007
1027
|
for (i = 0; i < evtCount; ++i) {
|
1008
1028
|
evt = evts[i];
|
1009
1029
|
|
1010
1030
|
// merge update event
|
1011
1031
|
if (evt.type === "updated") {
|
1012
|
-
|
1032
|
+
let rowIndex = dv.getRowIndex(evt.rid);
|
1013
1033
|
if (!changedRows[rowIndex]) {
|
1014
1034
|
changedRows[rowIndex] = {
|
1015
1035
|
changed: {},
|
1016
1036
|
rid: evt.rid
|
1017
1037
|
};
|
1018
1038
|
}
|
1019
|
-
|
1020
|
-
|
1021
|
-
for (
|
1039
|
+
let mergedChanges = changedRows[rowIndex].changed;
|
1040
|
+
let changes = evt.changes;
|
1041
|
+
for (let key in changes) {
|
1022
1042
|
mergedChanges[key] = 1;
|
1023
1043
|
}
|
1024
1044
|
}
|
@@ -1030,10 +1050,10 @@ ConditionalColoringPlugin._mergeUpdates = function(e) {
|
|
1030
1050
|
* @return {string} prettified CSS string
|
1031
1051
|
*/
|
1032
1052
|
ConditionalColoringPlugin.prototype._prepareStyles = function(colors) {
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
for (
|
1053
|
+
let prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .column.conditionally-colored .cell";
|
1054
|
+
let css = [];
|
1055
|
+
let ss, styles, value;
|
1056
|
+
for (let className in colors) {
|
1037
1057
|
css.push(prefix + "." + className);
|
1038
1058
|
ss = [];
|
1039
1059
|
styles = colors[className];
|
@@ -1057,10 +1077,10 @@ ConditionalColoringPlugin.prototype._prepareStyles = function(colors) {
|
|
1057
1077
|
*/
|
1058
1078
|
ConditionalColoringPlugin.prototype._injectColorTextStyles = function() {
|
1059
1079
|
if (ConditionalColoringPlugin._colorTextStyles) {
|
1060
|
-
|
1061
|
-
|
1062
|
-
for (
|
1063
|
-
|
1080
|
+
let hosts = this._hosts;
|
1081
|
+
let len = hosts.length;
|
1082
|
+
for (let i = 0; i < len; i++) {
|
1083
|
+
let host = hosts[i];
|
1064
1084
|
host.enableClass(ConditionalColoringPlugin._controlClass);
|
1065
1085
|
if (!host._colorTextStyles) {
|
1066
1086
|
injectCss(ConditionalColoringPlugin._colorTextStyles, host.getElement());
|
@@ -1086,9 +1106,9 @@ ConditionalColoringPlugin.prototype.setPredefinedColors = function(predefinedCol
|
|
1086
1106
|
if (predefinedColors != null && typeof predefinedColors === "object") {
|
1087
1107
|
this._predefinedColors = predefinedColors;
|
1088
1108
|
this._predefinedColorsStyles = this._prepareStyles(predefinedColors);
|
1089
|
-
|
1090
|
-
|
1091
|
-
for (
|
1109
|
+
let hosts = this._hosts;
|
1110
|
+
let len = hosts.length;
|
1111
|
+
for (let i = 0; i < len; i++) {
|
1092
1112
|
this._injectPredefinedColors(hosts[i]);
|
1093
1113
|
}
|
1094
1114
|
}
|
@@ -1121,7 +1141,7 @@ ConditionalColoringPlugin.prototype._requestRowRefresh = function () {
|
|
1121
1141
|
if(!this._hasColoring()){
|
1122
1142
|
return;
|
1123
1143
|
}
|
1124
|
-
for(
|
1144
|
+
for(let i = this._hosts.length; --i >= 0;) {
|
1125
1145
|
this._hosts[i].requestRowRefresh();
|
1126
1146
|
}
|
1127
1147
|
};
|
@@ -1140,12 +1160,12 @@ ConditionalColoringPlugin.prototype.getColumnPainter = function (colIndex) {
|
|
1140
1160
|
* @param {Object=} rowData A row data which will be used to determine a color together with a colIndex
|
1141
1161
|
*/
|
1142
1162
|
ConditionalColoringPlugin.prototype.applyColor = function (colIndex, cell, rowData) {
|
1143
|
-
|
1163
|
+
let painter = this.getColumnPainter(colIndex);
|
1144
1164
|
if (!painter) { return; }
|
1145
1165
|
|
1146
1166
|
if (!rowData) rowData = {};
|
1147
|
-
|
1148
|
-
|
1167
|
+
let field = this._getField(colIndex);
|
1168
|
+
let changes = {};
|
1149
1169
|
changes[field] = 1;
|
1150
1170
|
painter.render(cell, rowData, NaN, NaN, changes); // NaN values are min and max values for heatmap calculation
|
1151
1171
|
};
|
@@ -1154,22 +1174,22 @@ ConditionalColoringPlugin.prototype.applyColor = function (colIndex, cell, rowDa
|
|
1154
1174
|
* @param {Object} e
|
1155
1175
|
*/
|
1156
1176
|
ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
1157
|
-
|
1177
|
+
let dataRows = /** @type{Array.<Object>} */(e["dataRows"]);
|
1158
1178
|
if(!dataRows) {
|
1159
1179
|
return; // dataRows could be empty in case of no column is presented
|
1160
1180
|
}
|
1161
1181
|
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1182
|
+
let c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows;
|
1183
|
+
let dataRow, insertedId, colData, cachedValues, updatePrev;
|
1184
|
+
let section = e["section"];
|
1185
|
+
let colCount = section.getColumnCount();
|
1186
|
+
let fromR = /** @type{number} */(e["fromRowIndex"]);
|
1187
|
+
let toR = /** @type{number} */(e["toRowIndex"]);
|
1188
|
+
let actualUpdate = e["actualUpdate"];
|
1189
|
+
let dv = e["dataSource"];
|
1190
|
+
let host = e["sender"];
|
1171
1191
|
|
1172
|
-
|
1192
|
+
let blinkingEnabled = actualUpdate && this._blinkingEnabled;
|
1173
1193
|
if (blinkingEnabled) {
|
1174
1194
|
insertedId = ConditionalColoringPlugin._mapInsertedRowId(e.events);
|
1175
1195
|
if (this._compositeGrid) {
|
@@ -1177,16 +1197,16 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1177
1197
|
}
|
1178
1198
|
}
|
1179
1199
|
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1200
|
+
let prevDataRow, prevDataRows = host._prevDataRows;
|
1201
|
+
let prevIds = Object.keys(prevDataRows);
|
1202
|
+
let prevRowCount = prevIds.length;
|
1183
1203
|
for (r = fromR; r < toR; ++r) {
|
1184
1204
|
dataRow = this._rowGetter(dataRows[r]);
|
1185
1205
|
if (!dataRow) continue; // prevent from null value access when using with RowGroupingExtension
|
1186
1206
|
|
1187
1207
|
changedCols = null;
|
1188
|
-
|
1189
|
-
|
1208
|
+
let allowBlinking = false;
|
1209
|
+
let insertedRow = null;
|
1190
1210
|
if (blinkingEnabled) {
|
1191
1211
|
if (this._realTimeGrid) {
|
1192
1212
|
// TODO: check rid from e.rids
|
@@ -1229,14 +1249,14 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
|
1229
1249
|
painter = this.getColumnPainter(c);
|
1230
1250
|
if (painter) {
|
1231
1251
|
colData = this._getColumnData(c);
|
1232
|
-
|
1252
|
+
let bgBlinking = false;
|
1233
1253
|
if (colData["blinking"] && actualUpdate) {
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1254
|
+
let blinking = false;
|
1255
|
+
let field = colData["blinkingField"] || this._getField(c);
|
1256
|
+
let newValue = dataRow[field];
|
1237
1257
|
if(allowBlinking){
|
1238
1258
|
if (prevDataRow) {
|
1239
|
-
|
1259
|
+
let prevValue = prevDataRow[field];
|
1240
1260
|
if (prevValue != null) {
|
1241
1261
|
if (changedCols && changedCols[field]) {
|
1242
1262
|
blinking = true;
|
@@ -1285,7 +1305,7 @@ ConditionalColoringPlugin.prototype._onColumnAdded = function(e) {
|
|
1285
1305
|
* @param {Object} e
|
1286
1306
|
*/
|
1287
1307
|
ConditionalColoringPlugin.prototype._onColumnRemoved = function(e) {
|
1288
|
-
|
1308
|
+
let colData = /** @type{Object} */(e.columnData);
|
1289
1309
|
if (!colData) {
|
1290
1310
|
return;
|
1291
1311
|
}
|
@@ -1293,7 +1313,7 @@ ConditionalColoringPlugin.prototype._onColumnRemoved = function(e) {
|
|
1293
1313
|
this._clearPainter(colData);
|
1294
1314
|
|
1295
1315
|
// Removed column
|
1296
|
-
|
1316
|
+
let colId = e["colId"];
|
1297
1317
|
if (colId) {
|
1298
1318
|
if (colData["coloringFields"]) {
|
1299
1319
|
this._removeFieldReferrer(colId, COLORING_TYPE);
|
@@ -1304,13 +1324,13 @@ ConditionalColoringPlugin.prototype._onColumnRemoved = function(e) {
|
|
1304
1324
|
}
|
1305
1325
|
|
1306
1326
|
// Another columns
|
1307
|
-
|
1327
|
+
let field = colData["field"];
|
1308
1328
|
if (field) {
|
1309
|
-
|
1310
|
-
|
1329
|
+
let colDef = colData["COL_DEF"];
|
1330
|
+
let isStaticField = colDef ? !colDef.isRealTimeField() : true;
|
1311
1331
|
if (isStaticField) {
|
1312
|
-
|
1313
|
-
for (
|
1332
|
+
let colCount = this.getColumnCount();
|
1333
|
+
for (let i = 0; i < colCount; i++) {
|
1314
1334
|
colData = this._getColumnData(i);
|
1315
1335
|
if (colData["coloringFields"] && colData["coloringFields"][field]) {
|
1316
1336
|
this.setConditionalColoring(i, null);
|
@@ -1336,7 +1356,7 @@ ConditionalColoringPlugin.prototype._onThemeLoaded = function () {
|
|
1336
1356
|
ConditionalColoringPlugin.prototype._clearPainter = function (colData) {
|
1337
1357
|
if (colData) {
|
1338
1358
|
ConditionalColoringPlugin._cleanUpPrevFields();
|
1339
|
-
|
1359
|
+
let painter = colData["painter"];
|
1340
1360
|
if (painter) {
|
1341
1361
|
if (this._isValidPainter(painter)) {
|
1342
1362
|
painter.dispose();
|
@@ -1356,12 +1376,12 @@ ConditionalColoringPlugin.prototype._clearPainter = function (colData) {
|
|
1356
1376
|
* @param {Array<ConditionalColoringPlugin~Condition>} conditions
|
1357
1377
|
*/
|
1358
1378
|
ConditionalColoringPlugin.prototype._setEffectiveStyles = function(painter, conditions) {
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
for(
|
1364
|
-
|
1379
|
+
let effectiveStyles = null;
|
1380
|
+
let hasColor = false;
|
1381
|
+
let hasBackgroundColor = false;
|
1382
|
+
let condCount = conditions ? conditions.length : 0;
|
1383
|
+
for(let i = 0; i < condCount; i++){
|
1384
|
+
let cond = conditions[i];
|
1365
1385
|
if(cond["color"]){
|
1366
1386
|
hasColor = true;
|
1367
1387
|
}
|
@@ -1384,21 +1404,21 @@ ConditionalColoringPlugin.prototype._setEffectiveStyles = function(painter, cond
|
|
1384
1404
|
*/
|
1385
1405
|
ConditionalColoringPlugin._cleanUpPrevFields = function() {
|
1386
1406
|
// Assume that all hosts are using the same columns' options
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
for (
|
1407
|
+
let colCount = this.getColumnCount();
|
1408
|
+
let colData, blinkingFields = {};
|
1409
|
+
let isBlinking = false;
|
1410
|
+
for (let c = 0; c < colCount; c++) {
|
1391
1411
|
colData = this._getColumnData(c);
|
1392
1412
|
if (colData["blinking"]) {
|
1393
1413
|
blinkingFields[colData["blinkingField"]] = isBlinking = true;
|
1394
1414
|
}
|
1395
1415
|
}
|
1396
1416
|
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1417
|
+
let hosts = this._hosts;
|
1418
|
+
let len = hosts.length;
|
1419
|
+
let host, i;
|
1400
1420
|
if (isBlinking) {
|
1401
|
-
|
1421
|
+
let prevDataRow, prevDataRows, rid, field;
|
1402
1422
|
for (i = 0; i < len; i++) {
|
1403
1423
|
host = hosts[i];
|
1404
1424
|
prevDataRows = host._prevDataRows;
|
@@ -1423,9 +1443,9 @@ ConditionalColoringPlugin._cleanUpPrevFields = function() {
|
|
1423
1443
|
/** @public
|
1424
1444
|
*/
|
1425
1445
|
ConditionalColoringPlugin.cleanUpPrevRows = function() {
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1446
|
+
let hosts = this._hosts;
|
1447
|
+
let len = hosts.length;
|
1448
|
+
let host, dv, i, n, rids, rid, prevDataRows;
|
1429
1449
|
for (i = 0; i < len; i++) {
|
1430
1450
|
host = hosts[i];
|
1431
1451
|
dv = host.getDataSource();
|
@@ -1461,11 +1481,11 @@ ConditionalColoringPlugin._stopCleanUpInterval = function() {
|
|
1461
1481
|
* @return {Boolean}
|
1462
1482
|
*/
|
1463
1483
|
ConditionalColoringPlugin.prototype._hasColoring = function() {
|
1464
|
-
|
1465
|
-
|
1484
|
+
let hosts = this._hosts;
|
1485
|
+
let grid = hosts[0];
|
1466
1486
|
|
1467
|
-
|
1468
|
-
for(
|
1487
|
+
let colCount = this.getColumnCount();
|
1488
|
+
for(let colIndex = 0; colIndex < colCount; colIndex++){
|
1469
1489
|
if(grid.hasColumnClass(colIndex, "conditionally-colored")){
|
1470
1490
|
return true;
|
1471
1491
|
}
|