@refinitiv-ui/efx-grid 6.0.14 → 6.0.16

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.
Files changed (35) hide show
  1. package/lib/column-format-dialog/index.d.ts +2 -1
  2. package/lib/column-format-dialog/index.js +2 -1
  3. package/lib/column-selection-dialog/index.d.ts +2 -1
  4. package/lib/column-selection-dialog/index.js +2 -1
  5. package/lib/core/dist/core.js +19 -9
  6. package/lib/core/dist/core.min.js +1 -1
  7. package/lib/core/es6/data/DataTable.js +1 -1
  8. package/lib/core/es6/data/Segment.d.ts +3 -3
  9. package/lib/core/es6/data/Segment.js +14 -6
  10. package/lib/core/es6/data/SegmentCollection.d.ts +1 -1
  11. package/lib/core/es6/data/SegmentCollection.js +3 -1
  12. package/lib/core/es6/grid/Core.js +1 -1
  13. package/lib/filter-dialog/index.d.ts +2 -1
  14. package/lib/filter-dialog/index.js +2 -1
  15. package/lib/grid/index.d.ts +2 -1
  16. package/lib/grid/index.js +3 -2
  17. package/lib/rt-grid/dist/rt-grid.js +740 -84
  18. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  19. package/lib/rt-grid/es6/ColumnDefinition.d.ts +10 -0
  20. package/lib/rt-grid/es6/ColumnDefinition.js +110 -1
  21. package/lib/rt-grid/es6/FieldDefinition.d.ts +6 -0
  22. package/lib/rt-grid/es6/FieldDefinition.js +43 -0
  23. package/lib/rt-grid/es6/Grid.d.ts +2 -0
  24. package/lib/rt-grid/es6/Grid.js +206 -8
  25. package/lib/rt-grid/es6/RowDefinition.d.ts +4 -0
  26. package/lib/rt-grid/es6/RowDefinition.js +57 -0
  27. package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
  28. package/lib/rt-grid/es6/SnapshotFiller.js +125 -17
  29. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +2 -2
  30. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +30 -29
  31. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +176 -98
  32. package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +17 -15
  33. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +89 -159
  34. package/lib/versions.json +4 -4
  35. package/package.json +15 -2
@@ -1,6 +1,7 @@
1
1
  import { Ext } from '../../tr-grid-util/es6/Ext.js';
2
2
  import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
3
3
  import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
4
+
4
5
  /** @typedef {Object} RowColoringPlugin~Options
5
6
  * @description The options can be specified by `rowColoring` property of the main grid's options:
6
7
  * @property {boolean=} bgColoring=true If disabled, background color will not be applied to the row
@@ -8,6 +9,8 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
8
9
  * @property {string=} bgColorField="BG_COLOR" Apply background color based on the given field
9
10
  * @property {string=} textColorField="TEXT_COLOR" Apply text color based on the given field
10
11
  * @property {string=} cssField="CSS_CLASS" Apply CSS class based on the given field
12
+ * @property {string=} cssRangeField="" Apply CSS class only on the given range field, which range will be array 2 element, the first element is start column used colour and the second one is the length of column applied
13
+ * @property {string=} altCssField="" Apply alternative CSS class based on the given field which not in range field
11
14
  * @property {Object=} predefinedColors Predefined color object map
12
15
  * @property {boolean=} predefinedColoring=false If enabled, predefined colors will be used instead of inline styling. The bgColoring and textColoring will be turned off.
13
16
  */
@@ -16,79 +19,74 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
16
19
  * @extends {GridPlugin}
17
20
  * @param {RowColoringPlugin~Options=} options
18
21
  */
19
-
20
22
  var RowColoringPlugin = function RowColoringPlugin(options) {
21
23
  this._onSectionBinding = this._onSectionBinding.bind(this);
22
24
  this._updateRowColor = this._updateRowColor.bind(this);
23
25
  this._hosts = [];
24
-
25
26
  if (options) {
26
27
  this.config({
27
28
  "rowColoring": options
28
29
  });
29
30
  }
30
31
  };
31
-
32
32
  Ext.inherits(RowColoringPlugin, GridPlugin);
33
+
33
34
  /** @type {string}
34
35
  * @private
35
36
  */
36
-
37
37
  RowColoringPlugin._controlClass = "predefined-color";
38
38
  /** @type {boolean}
39
39
  * @private
40
40
  */
41
-
42
41
  RowColoringPlugin.prototype._disabled = false;
43
42
  /** @type {string}
44
43
  * @private
45
44
  */
46
-
47
45
  RowColoringPlugin.prototype._bgField = "BG_COLOR";
48
46
  /** @type {string}
49
47
  * @private
50
48
  */
51
-
52
49
  RowColoringPlugin.prototype._txtColorField = "TEXT_COLOR";
53
50
  /** @type {string}
54
51
  * @private
55
52
  */
56
-
57
53
  RowColoringPlugin.prototype._cssField = "CSS_CLASS";
54
+ /** @type {string}
55
+ * @private
56
+ */
57
+ RowColoringPlugin.prototype._cssRangeField = "";
58
+ /** @type {string}
59
+ * @private
60
+ */
61
+ RowColoringPlugin.prototype._altCssField = "";
58
62
  /** @type {boolean}
59
63
  * @private
60
64
  */
61
-
62
65
  RowColoringPlugin.prototype._txtEnabled = true;
63
66
  /** @type {boolean}
64
67
  * @private
65
68
  */
66
-
67
69
  RowColoringPlugin.prototype._bgEnabled = true;
68
70
  /** @type {boolean}
69
71
  * @private
70
72
  */
71
-
72
73
  RowColoringPlugin.prototype._predefinedColoring = false;
73
74
  /** @type {Object}
74
75
  * @private
75
76
  */
76
-
77
77
  RowColoringPlugin.prototype._predefinedColors = null;
78
78
  /** @type {Object}
79
79
  * @private
80
80
  */
81
-
82
81
  RowColoringPlugin.prototype._styleTag = null;
83
82
  /** @type {number}
84
83
  * @private
85
84
  */
86
-
87
85
  RowColoringPlugin.prototype._updateTimer = 0;
86
+
88
87
  /** @public
89
88
  * @return {string}
90
89
  */
91
-
92
90
  RowColoringPlugin.prototype.getName = function () {
93
91
  return "RowColoringPlugin"; // Read Only
94
92
  };
@@ -96,15 +94,11 @@ RowColoringPlugin.prototype.getName = function () {
96
94
  * @param {Object} host core grid instance
97
95
  * @param {Object=} options
98
96
  */
99
-
100
-
101
97
  RowColoringPlugin.prototype.initialize = function (host, options) {
102
98
  if (this._hosts.indexOf(host) >= 0) {
103
99
  return;
104
100
  }
105
-
106
101
  this._hosts.push(host);
107
-
108
102
  host.listen("preSectionDataBinding", this._onSectionBinding);
109
103
  this.config(options);
110
104
  this._updateTimer = setTimeout(this._updateRowColor, 100); // For lazy loading
@@ -112,83 +106,67 @@ RowColoringPlugin.prototype.initialize = function (host, options) {
112
106
  /** @public
113
107
  * @param {Object} host core grid instance
114
108
  */
115
-
116
-
117
109
  RowColoringPlugin.prototype.unload = function (host) {
118
110
  var at = this._hosts.indexOf(host);
119
-
120
111
  if (at < 0) {
121
112
  return;
122
113
  }
123
-
124
114
  host.unlisten("preSectionDataBinding", this._onSectionBinding);
125
-
126
115
  this._hosts.splice(at, 1);
127
-
128
116
  if (!this._hosts.length) {
129
117
  if (this._updateTimer) {
130
118
  clearTimeout(this._updateTimer);
131
119
  this._updateTimer = 0;
132
120
  }
133
121
  }
134
-
135
122
  this._dispose();
136
123
  };
137
124
  /** @public
138
125
  * @param {Object=} options
139
126
  */
140
-
141
-
142
127
  RowColoringPlugin.prototype.config = function (options) {
143
128
  if (!options) {
144
129
  return;
145
130
  }
146
-
147
131
  var pluginOption = options["rowColoring"];
148
-
149
132
  if (pluginOption) {
150
133
  var bool = pluginOption["bgColoring"];
151
-
152
134
  if (bool != null) {
153
135
  this._bgEnabled = bool ? true : false;
154
136
  }
155
-
156
137
  bool = pluginOption["textColoring"];
157
-
158
138
  if (bool != null) {
159
139
  this._txtEnabled = bool ? true : false;
160
140
  }
161
-
162
141
  bool = pluginOption["predefinedColoring"];
163
-
164
142
  if (bool != null) {
165
143
  this._predefinedColoring = bool ? true : false;
166
-
167
144
  if (bool) {
168
145
  this._hosts[0].enableClass("predefined-color");
169
146
  }
170
147
  }
171
-
172
148
  if (pluginOption["bgColorField"] || pluginOption["textColorField"] || pluginOption["cssField"]) {
173
149
  var field = pluginOption["bgColorField"];
174
-
175
150
  if (field) {
176
151
  this._bgField = field;
177
152
  }
178
-
179
153
  field = pluginOption["textColorField"];
180
-
181
154
  if (field) {
182
155
  this._txtColorField = field;
183
156
  }
184
-
185
157
  field = pluginOption["cssField"];
186
-
187
158
  if (field) {
188
159
  this._cssField = field;
189
160
  }
161
+ field = pluginOption["cssRangeField"];
162
+ if (field) {
163
+ this._cssRangeField = field;
164
+ }
165
+ field = pluginOption["altCssField"];
166
+ if (field) {
167
+ this._altCssField = field;
168
+ }
190
169
  }
191
-
192
170
  if (pluginOption["predefinedColors"]) {
193
171
  this._injectStyles(pluginOption["predefinedColors"]);
194
172
  }
@@ -198,95 +176,78 @@ RowColoringPlugin.prototype.config = function (options) {
198
176
  * @param {Object=} gridOptions
199
177
  * @return {!Object}
200
178
  */
201
-
202
-
203
179
  RowColoringPlugin.prototype.getConfigObject = function (gridOptions) {
204
180
  var obj = gridOptions || {};
205
181
  var extOptions = obj.rowColoring;
206
-
207
182
  if (!extOptions) {
208
183
  extOptions = obj.rowColoring = {};
209
184
  }
210
-
211
185
  extOptions.bgColoring = this._bgEnabled;
212
186
  extOptions.textColoring = this._txtEnabled;
213
187
  extOptions.predefinedColoring = this._predefinedColoring;
214
-
215
188
  if (this._bgField !== "BG_COLOR") {
216
189
  extOptions.bgColorField = this._bgField;
217
190
  }
218
-
219
191
  if (this._txtColorField !== "TEXT_COLOR") {
220
192
  extOptions.textColorField = this._txtColorField;
221
193
  }
222
-
223
194
  if (this._cssField !== "CSS_CLASS") {
224
195
  extOptions.cssField = this._cssField;
225
196
  }
226
-
197
+ if (this._cssRangeField) {
198
+ extOptions.cssRangeField = this._cssRangeField;
199
+ }
200
+ if (this._altCssField) {
201
+ extOptions.altCssField = this._altCssField;
202
+ }
227
203
  if (this._predefinedColors) {
228
204
  extOptions.predefinedColors = this._predefinedColors;
229
205
  }
230
-
231
206
  return obj;
232
207
  };
208
+
233
209
  /** @public
234
210
  * @param {string|number} rowRef Row id in the data table or row index
235
211
  * @param {(string|null)=} bgColor
236
212
  * @param {(string|null)=} txtColor
237
213
  */
238
-
239
-
240
214
  RowColoringPlugin.prototype.setRowColor = function (rowRef, bgColor, txtColor) {
241
215
  var dv = this._getDataView();
242
-
243
216
  if (!dv) {
244
217
  return;
245
218
  }
246
-
247
219
  if (typeof rowRef === "string") {
248
220
  rowRef = dv.getRowIndex(rowRef);
249
221
  }
250
-
251
222
  if (rowRef == null || rowRef < 0) {
252
223
  return;
253
224
  }
254
-
255
- var values = {}; // TODO: Allow customization of the default colors
256
-
225
+ var values = {};
226
+ // TODO: Allow customization of the default colors
257
227
  values[this._bgField] = bgColor || "";
258
228
  values[this._txtColorField] = txtColor || "";
259
-
260
229
  this._setRowData(dv, rowRef, values);
261
230
  };
262
231
  /** @public
263
232
  * @param {string|number} rowRef Row id in the data table or row index
264
233
  * @return {string} bgColor
265
234
  */
266
-
267
-
268
235
  RowColoringPlugin.prototype.getRowColor = function (rowRef) {
269
236
  var dv = this._getDataView();
270
-
271
237
  if (!dv) {
272
238
  return "";
273
239
  }
274
-
275
240
  if (typeof rowRef === "string") {
276
241
  rowRef = dv.getRowIndex(rowRef);
277
242
  }
278
-
279
243
  if (rowRef == null || rowRef < 0) {
280
244
  return "";
281
245
  }
282
-
283
246
  return this._getData(dv, rowRef, this._bgField) || "";
284
247
  };
285
248
  /** @public
286
249
  * @param {string|number} rowRef Row id in the data table or row index
287
250
  */
288
-
289
-
290
251
  RowColoringPlugin.prototype.removeRowColor = function (rowRef) {
291
252
  this.setRowColor(rowRef, "", "");
292
253
  };
@@ -297,57 +258,59 @@ RowColoringPlugin.prototype.removeRowColor = function (rowRef) {
297
258
  * @param {boolean=} state Specify this flag to force the color state
298
259
  * @return {boolean} Return current color state (after execution)
299
260
  */
300
-
301
-
302
261
  RowColoringPlugin.prototype.toggleRowColor = function (rowRef, bgColor, txtColor, state) {
303
262
  if (state == null) {
304
263
  state = this.getRowColor(rowRef) ? true : false;
305
264
  }
306
-
307
265
  if (state) {
308
266
  this.removeRowColor(rowRef);
309
267
  } else {
310
268
  this.setRowColor(rowRef, bgColor, txtColor);
311
269
  }
312
-
313
270
  return !state;
314
271
  };
315
272
  /** @public
273
+ * @description Set predefined color into row reference
316
274
  * @param {string|number} rowRef Row id in the data table or row index
317
275
  * @param {(string|null)=} color Predefined color being applied to row
318
- */
319
-
320
-
321
- RowColoringPlugin.prototype.setRowPredefinedColor = function (rowRef, color) {
276
+ * @param {Array<number>=} range Range of column applied colour which array 2 element, the first element is start column used colour and the second one is the length of column applied, it doesn't provide a range, the columns will apply the colour all columns in row reference
277
+ * @param {(string|null)=} altColor Alternative predefined color being applied to row if the column doesn't in the rage
278
+ * @example
279
+ * rowColoringExt.setRowPredefinedColor(2, "c-red") // set predefined color into row index 2 all row.
280
+ * rowColoringExt.setRowPredefinedColor(2, "c-red", [2, 5]) // set predefined color into row index 2 and applied since column 2 and next 5 columns
281
+ * rowColoringExt.setRowPredefinedColor(2, "c-red", [2]) // if pass only 1 element into rage parameter, the row will be applied since 2 to last column
282
+ * rowColoringExt.setRowPredefinedColor(2, "c-red", [2, 5], "c-yellow") // set predefined color into row index 2 and applied since column 2 and next 5 columns and another column will be set color c-yellow
283
+ */
284
+ RowColoringPlugin.prototype.setRowPredefinedColor = function (rowRef, color, range, altColor) {
322
285
  var dv = this._getDataView();
323
-
324
286
  if (!dv) {
325
287
  return;
326
288
  }
327
-
328
289
  if (typeof rowRef === "string") {
329
290
  rowRef = dv.getRowIndex(rowRef);
330
291
  }
331
-
332
292
  if (rowRef == null || rowRef < 0) {
333
293
  return;
334
294
  }
335
-
336
295
  this._setStaticData(dv, rowRef, this._cssField, color || "");
296
+ // eslint-disable-next-line no-undefined
297
+ if (this._cssRangeField && range !== undefined) {
298
+ this._setStaticData(dv, rowRef, this._cssRangeField, range);
299
+ }
300
+ // eslint-disable-next-line no-undefined
301
+ if (this._altCssField && altColor !== undefined) {
302
+ this._setStaticData(dv, rowRef, this._altCssField, altColor);
303
+ }
337
304
  };
338
305
  /** @public
339
306
  * @return {Object} Return predefined color object map
340
307
  */
341
-
342
-
343
308
  RowColoringPlugin.prototype.getPredefinedColors = function () {
344
309
  return this._predefinedColors;
345
310
  };
346
311
  /** @public
347
312
  * @param {Object} predefinedColors Predefined color object map
348
313
  */
349
-
350
-
351
314
  RowColoringPlugin.prototype.setPredefinedColors = function (predefinedColors) {
352
315
  if (predefinedColors != null) {
353
316
  this._injectStyles(predefinedColors);
@@ -356,40 +319,29 @@ RowColoringPlugin.prototype.setPredefinedColors = function (predefinedColors) {
356
319
  /** @private
357
320
  * @param {Object} predefinedColors Predefined color object map
358
321
  */
359
-
360
-
361
322
  RowColoringPlugin.prototype._injectStyles = function (predefinedColors) {
362
323
  var prefix = ".tr-grid." + RowColoringPlugin._controlClass + " .tr-lg .cell";
363
324
  var css = [];
364
325
  var ss, styles, value;
365
-
366
326
  for (var className in predefinedColors) {
367
327
  css.push(prefix + "." + className);
368
328
  ss = [];
369
329
  styles = predefinedColors[className];
370
330
  value = styles["backgroundColor"];
371
-
372
331
  if (value) {
373
332
  ss.push("background-color: " + value + ";");
374
333
  }
375
-
376
334
  value = styles["color"];
377
-
378
335
  if (value) {
379
336
  ss.push("color: " + value + ";");
380
337
  }
381
-
382
338
  css.push(ss);
383
339
  }
384
-
385
340
  var host = this._hosts[0];
386
-
387
341
  if (this._styleTag) {
388
342
  this._styleTag.parentNode.removeChild(this._styleTag);
389
-
390
343
  this._styleTag = null;
391
344
  }
392
-
393
345
  this._styleTag = injectCss(prettifyCss(css), host.getElement());
394
346
  this._predefinedColors = predefinedColors;
395
347
  };
@@ -398,73 +350,59 @@ RowColoringPlugin.prototype._injectStyles = function (predefinedColors) {
398
350
  * @param {Object} dv DataView
399
351
  * @return {string}
400
352
  */
401
-
402
-
403
353
  RowColoringPlugin.prototype._getRowId = function (rowRef, dv) {
404
354
  if (typeof rowRef === "number") {
405
355
  return dv ? dv.getRowId(rowRef) : "";
406
356
  } else if (typeof rowRef === "string") {
407
357
  return rowRef;
408
358
  }
409
-
410
359
  return "";
411
360
  };
412
361
  /** @private
413
362
  * @return {Object} DataView
414
363
  */
415
-
416
-
417
364
  RowColoringPlugin.prototype._getDataView = function () {
418
365
  var host = this._hosts[0];
419
366
  return host ? host.getDataSource() : null;
420
367
  };
368
+
421
369
  /** @public
422
370
  * @param {boolean=} opt_bool
423
371
  */
424
-
425
-
426
372
  RowColoringPlugin.prototype.disableTextColoring = function (opt_bool) {
427
373
  this._txtEnabled = opt_bool !== false;
428
374
  };
429
375
  /** @public
430
376
  * @param {boolean=} opt_bool
431
377
  */
432
-
433
-
434
378
  RowColoringPlugin.prototype.disableBgColoring = function (opt_bool) {
435
379
  this._bgEnabled = opt_bool !== false;
436
380
  };
437
381
  /** @public
438
382
  * @param {boolean=} disabled
439
383
  */
440
-
441
-
442
384
  RowColoringPlugin.prototype.disableRowColoring = function (disabled) {
443
385
  this._disabled = disabled !== false;
444
386
  };
387
+
445
388
  /** @public
446
389
  * @function
447
390
  * @param {string} hexColor
448
391
  * @return {string} color in CSS hex format (e.g. #FF00FF)
449
392
  */
450
-
451
-
452
393
  RowColoringPlugin.getContrastColor = function (hexColor) {
453
394
  if (!hexColor) {
454
395
  return '';
455
396
  }
456
-
457
397
  var hexInt = parseInt(hexColor.replace(/[^0-9A-F]/gi, ''), 16);
458
398
  var r = hexInt >> 16 & 255;
459
399
  var g = hexInt >> 8 & 255;
460
400
  var b = hexInt & 255;
461
401
  var brightness = Math.sqrt(r * r * 0.241 + g * g * 0.691 + b * b * 0.068);
462
-
463
402
  if (brightness >= 135) {
464
403
  // Brighter color has more impact to human eye than the darker color
465
404
  return '#000000';
466
405
  }
467
-
468
406
  return '#FFFFFF';
469
407
  };
470
408
  /** @public
@@ -472,89 +410,89 @@ RowColoringPlugin.getContrastColor = function (hexColor) {
472
410
  * @param {string} hexColor
473
411
  * @return {string} color in CSS hex format (e.g. #FF00FF)
474
412
  */
475
-
476
-
477
413
  RowColoringPlugin.prototype.getContrastColor = RowColoringPlugin.getContrastColor;
414
+
478
415
  /** @private
479
416
  * @param {Object} e
480
417
  */
481
-
482
418
  RowColoringPlugin.prototype._onSectionBinding = function (e) {
483
419
  if (e["sectionType"] === "content") {
484
420
  this._updateRowColor(e["fromRowIndex"], e["toRowIndex"]);
485
421
  }
486
422
  };
423
+
487
424
  /** @private
488
425
  * @param {number=} fromR from row index
489
426
  * @param {number=} toR to row index
490
427
  */
491
-
492
-
493
428
  RowColoringPlugin.prototype._updateRowColor = function (fromR, toR) {
494
429
  this._updateTimer = 0;
495
-
496
430
  if (this._disabled) {
497
431
  return;
498
432
  }
499
-
500
433
  var dv = this._getDataView();
501
-
502
434
  if (!dv) {
503
435
  return;
504
436
  }
505
-
506
437
  var host = this._hosts ? this._hosts[0] : null;
507
438
  var section = host ? host.getSection("content") : null;
508
-
509
439
  if (!section) {
510
440
  return;
511
441
  }
512
-
513
442
  if (!fromR) {
514
443
  fromR = section.getFirstIndexInView();
515
444
  }
516
-
517
445
  if (toR == null) {
518
446
  toR = section.getLastIndexInView() + 1;
519
- } // TODO: consolidate the 2 separated flows
520
-
521
-
447
+ }
448
+ // TODO: consolidate the 2 separated flows
522
449
  var colCount = section.getColumnCount();
523
450
  var r, c, rowData, cell;
524
-
525
451
  if (this._predefinedColoring) {
526
452
  var cssField = this._cssField;
527
- var className, el;
528
-
453
+ var altCssField = this._altCssField;
454
+ var rangeField = this._cssRangeField;
455
+ var className, el, start, end, altCssClass, range, colorSelected;
529
456
  for (r = fromR; r < toR; ++r) {
530
- className = "";
457
+ className = altCssClass = "";
458
+ start = end = range = null;
531
459
  rowData = this._getRow(dv, r);
532
-
533
460
  if (rowData) {
534
461
  className = rowData[cssField] || "";
462
+ altCssClass = rowData[altCssField] || "";
463
+ range = rowData[rangeField];
464
+ if (Array.isArray(range)) {
465
+ start = range[0];
466
+ end = range[1] ? range[0] + range[1] : colCount; // handled case user provide only the start field (not provide the length of columns)
467
+ }
535
468
  }
536
469
 
537
470
  for (c = 0; c < colCount; ++c) {
538
471
  cell = section.getCell(c, r, false);
539
-
540
- if (cell) {
541
- el = cell.getElement();
542
-
543
- if (el) {
544
- if (el._coloringClass === className) {
545
- continue;
546
- }
547
-
548
- if (el._coloringClass) {
549
- el.classList.remove(el._coloringClass);
550
- el._coloringClass = null;
551
- }
552
-
553
- if (className) {
554
- el.classList.add(className);
555
- el._coloringClass = className;
556
- }
557
- }
472
+ if (!cell) {
473
+ continue;
474
+ }
475
+ el = cell.getElement();
476
+ if (!el) {
477
+ continue;
478
+ }
479
+ if (className && range && (c < start || c > end)) {
480
+ // use alternative color
481
+ colorSelected = altCssClass;
482
+ } else {
483
+ // use normal color
484
+ colorSelected = className;
485
+ }
486
+ if (el._coloringClass === colorSelected) {
487
+ continue;
488
+ }
489
+ if (el._coloringClass) {
490
+ el.classList.remove(el._coloringClass);
491
+ el._coloringClass = "";
492
+ }
493
+ if (colorSelected) {
494
+ el.classList.add(colorSelected);
495
+ el._coloringClass = colorSelected;
558
496
  }
559
497
  }
560
498
  }
@@ -562,27 +500,21 @@ RowColoringPlugin.prototype._updateRowColor = function (fromR, toR) {
562
500
  var textColor, bgColor;
563
501
  var txtEnabled = this._txtEnabled;
564
502
  var bgEnabled = this._bgEnabled;
565
-
566
503
  for (r = fromR; r < toR; ++r) {
567
504
  textColor = bgColor = "";
568
505
  rowData = this._getRow(dv, r);
569
-
570
506
  if (rowData) {
571
507
  if (txtEnabled) {
572
508
  textColor = rowData[this._txtColorField] || "";
573
509
  }
574
-
575
510
  if (bgEnabled) {
576
511
  bgColor = rowData[this._bgField] || "";
577
512
  }
578
513
  }
579
-
580
514
  for (c = 0; c < colCount; ++c) {
581
515
  cell = section.getCell(c, r, false);
582
-
583
516
  if (cell) {
584
517
  el = cell.getElement();
585
-
586
518
  if (el) {
587
519
  if (textColor || el._textColor) {
588
520
  if (el._textColor !== textColor) {
@@ -590,7 +522,6 @@ RowColoringPlugin.prototype._updateRowColor = function (fromR, toR) {
590
522
  el._textColor = textColor;
591
523
  }
592
524
  }
593
-
594
525
  if (bgColor || el._bgColor) {
595
526
  if (el._bgColor !== bgColor) {
596
527
  cell.setStyle("backgroundColor", bgColor);
@@ -603,6 +534,5 @@ RowColoringPlugin.prototype._updateRowColor = function (fromR, toR) {
603
534
  }
604
535
  }
605
536
  };
606
-
607
537
  export default RowColoringPlugin;
608
538
  export { RowColoringPlugin, RowColoringPlugin as RowColoring, RowColoringPlugin as RowColoringExtension };
package/lib/versions.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "tr-grid-checkbox": "1.0.59",
10
10
  "tr-grid-column-fitter": "1.0.39",
11
11
  "tr-grid-column-formatting": "0.9.34",
12
- "tr-grid-column-grouping": "1.0.28",
12
+ "tr-grid-column-grouping": "1.0.29",
13
13
  "tr-grid-column-resizing": "1.0.26",
14
14
  "tr-grid-column-selection": "1.0.25",
15
15
  "tr-grid-column-stack": "1.0.43",
@@ -24,14 +24,14 @@
24
24
  "tr-grid-printer": "1.0.16",
25
25
  "tr-grid-range-bar": "1.0.9",
26
26
  "tr-grid-row-dragging": "1.0.23",
27
- "tr-grid-row-filtering": "1.0.54",
27
+ "tr-grid-row-filtering": "1.0.55",
28
28
  "tr-grid-row-grouping": "1.0.78",
29
29
  "tr-grid-row-selection": "1.0.21",
30
- "tr-grid-rowcoloring": "1.0.20",
30
+ "tr-grid-rowcoloring": "1.0.21",
31
31
  "tr-grid-textformatting": "1.0.44",
32
32
  "tr-grid-titlewrap": "1.0.19",
33
33
  "@grid/formatters": "1.0.49",
34
34
  "@grid/column-selection-dialog": "4.0.45",
35
- "@grid/filter-dialog": "4.0.53",
35
+ "@grid/filter-dialog": "4.0.54",
36
36
  "@grid/column-format-dialog": "4.0.43"
37
37
  }