@refinitiv-ui/efx-grid 6.0.24 → 6.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/lib/core/dist/core.css +1 -1
  2. package/lib/core/dist/core.js +1331 -145
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/grid/Core.d.ts +11 -0
  5. package/lib/core/es6/grid/Core.js +81 -10
  6. package/lib/core/es6/grid/util/ElementFrameWork.js +1 -1
  7. package/lib/core/es6/tr-grid-theme.js +1 -1
  8. package/lib/grid/index.js +1 -1
  9. package/lib/rt-grid/dist/rt-grid.js +768 -53
  10. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  11. package/lib/rt-grid/es6/ColumnDefinition.js +1 -1
  12. package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
  13. package/lib/rt-grid/es6/FieldDefinition.js +13 -2
  14. package/lib/rt-grid/es6/Grid.d.ts +3 -1
  15. package/lib/rt-grid/es6/Grid.js +83 -39
  16. package/lib/rt-grid/es6/RowDefinition.d.ts +14 -1
  17. package/lib/rt-grid/es6/RowDefinition.js +54 -2
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
  19. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +314 -566
  20. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +13 -11
  21. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +233 -81
  22. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -3
  23. package/lib/tr-grid-column-stack/es6/ColumnStack.js +50 -56
  24. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +21 -9
  25. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +18 -9
  26. package/lib/tr-grid-range-bar/es6/RangeBar.js +318 -139
  27. package/lib/tr-grid-util/es6/GridPlugin.d.ts +1 -1
  28. package/lib/tr-grid-util/es6/GridPlugin.js +13 -15
  29. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +58 -0
  30. package/lib/tr-grid-util/es6/GroupDefinitions.js +538 -0
  31. package/lib/tr-grid-util/es6/Popup.js +1 -1
  32. package/lib/tr-grid-util/es6/index.d.ts +2 -0
  33. package/lib/tr-grid-util/es6/index.js +3 -0
  34. package/lib/types/es6/ColumnGrouping.d.ts +3 -2
  35. package/lib/types/es6/ColumnSelection.d.ts +13 -11
  36. package/lib/types/es6/ColumnStack.d.ts +3 -3
  37. package/lib/types/es6/Core/grid/Core.d.ts +11 -0
  38. package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
  39. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
  40. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +14 -1
  41. package/lib/types/es6/index.d.ts +1 -1
  42. package/lib/versions.json +6 -6
  43. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  import { Ext } from '../../tr-grid-util/es6/Ext.js';
2
3
  import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
3
- import { RangeBar } from '../../tr-grid-util/es6/RangeBar.js';
4
- import { Dom } from '../../tr-grid-util/es6/Dom.js';
5
4
  import { ElfUtil } from '../../tr-grid-util/es6/ElfUtil.js';
5
+ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
+
6
7
  /** @typedef {Object} RangeBarPlugin~ColumnOptions
7
8
  * @description Extension column options that can be specified on each individual grid's column option:
8
9
  * @property {RangeBarPlugin~RangeDefinition=} rangeBar Range definition object
@@ -18,38 +19,91 @@ import { ElfUtil } from '../../tr-grid-util/es6/ElfUtil.js';
18
19
  * @property {string=} last="" Field used as current absolute value (white bar)
19
20
  */
20
21
 
22
+ /** @typedef {Object} RangeBarPlugin~Options
23
+ * @description RangeBarPlugin options that can be specified from `percentBar` property of the main grid's options
24
+ * @property {boolean=} tooltip=true If disabled, it will be doesn't show tooltip when mouse hover ef-led-gauge
25
+ */
26
+ // TODO: promote "valueLabel" option, that provide the user can show valueLabel in ef-led-gauge (default is false)
27
+ // @property {boolean=} valueLabel=false If disabled, it will be show text label in top of ef-led-gaguge
28
+
29
+ /** Used for tranfrom value from raw value to normalize value
30
+ * @private
31
+ * @param {number} low
32
+ * @param {number} last
33
+ * @param {number} high
34
+ * @return {number}
35
+ */
36
+ var _normalizeValue = function _normalizeValue(low, last, high) {
37
+ return (low - last) * 200 / (low - high) - 100;
38
+ };
39
+
40
+ /** Used for convert the rangeBarOption and rowData into an object that has the properties of low, last, and high.
41
+ * @private
42
+ * @param {RangeBarPlugin~RangeDefinition} rBarOpt
43
+ * @param {Object} rowData
44
+ * @return {Object}
45
+ */
46
+ var _getLowLastHighValue = function _getLowLastHighValue(rBarOpt, rowData) {
47
+ var low, high, last;
48
+ if (rBarOpt.field) {
49
+ // Doesn't defined low,last,high
50
+ low = rBarOpt.start;
51
+ last = rowData[rBarOpt.field];
52
+ high = rBarOpt.end;
53
+ } else {
54
+ // Defined low,last,high case
55
+ low = rowData[rBarOpt.low];
56
+ last = rowData[rBarOpt.last];
57
+ high = rowData[rBarOpt.high];
58
+ }
59
+ return {
60
+ low: low,
61
+ last: last,
62
+ high: high
63
+ };
64
+ };
65
+
21
66
  /** @constructor
22
67
  * @extends {GridPlugin}
23
68
  */
24
-
25
69
  var RangeBarPlugin = function RangeBarPlugin() {
70
+ this._onPostSectionBinding = this._onPostSectionBinding.bind(this);
26
71
  this._onColumnAdded = this._onColumnAdded.bind(this);
27
72
  this._onColumnRemoved = this._onColumnRemoved.bind(this);
28
73
  this._renderer = this._renderer.bind(this);
29
74
  this._onThemeLoaded = this._onThemeLoaded.bind(this);
30
75
  this._hosts = [];
31
76
  };
32
-
33
77
  Ext.inherits(RangeBarPlugin, GridPlugin);
78
+
34
79
  /** @type {boolean}
35
80
  * @private
36
81
  */
37
-
38
82
  RangeBarPlugin.prototype._themeLoading = false;
39
83
  /** @type {number}
40
84
  * @private
41
85
  */
42
-
43
86
  RangeBarPlugin.prototype._start = 0;
44
87
  /** @type {number}
45
88
  * @private
46
89
  */
47
-
48
90
  RangeBarPlugin.prototype._end = 100;
91
+ /** @type {boolean}
92
+ * @private
93
+ */
94
+ RangeBarPlugin.prototype._tooltip = true;
95
+ /** @type {boolean}
96
+ * @private
97
+ */
98
+ RangeBarPlugin.prototype.valueLabel = false;
99
+ /** @private
100
+ * @type {string}
101
+ */
102
+ RangeBarPlugin._styles = prettifyCss(["ef-led-gauge", ["padding: 0;", "height: 16px;", "--led-width: 3px;", "--led-spacing: 2px;", "overflow: visible;" // TODO: currently, we have to set this overwrite hidden from elf component, however currently show text value label didn't work with grid default row
103
+ ]]);
49
104
  /** @override
50
105
  * @return {string}
51
106
  */
52
-
53
107
  RangeBarPlugin.prototype.getName = function () {
54
108
  return "RangeBarPlugin"; // Readonly
55
109
  };
@@ -57,30 +111,26 @@ RangeBarPlugin.prototype.getName = function () {
57
111
  * @param {Object} host core grid object
58
112
  * @param {Object=} options
59
113
  */
60
-
61
-
62
114
  RangeBarPlugin.prototype.initialize = function (host, options) {
63
115
  if (this._hosts.indexOf(host) >= 0) {
64
116
  return;
65
117
  }
66
-
67
118
  this._hosts.push(host);
68
-
69
119
  this.config(options);
70
120
  host.listen("columnAdded", this._onColumnAdded);
71
121
  host.listen("columnRemoved", this._onColumnRemoved);
72
-
122
+ host.listen("postSectionDataBinding", this._onPostSectionBinding);
123
+ RangeBarPlugin._applyThemeColor(host);
73
124
  if (!this._themeLoading) {
74
125
  this._themeLoading = true;
75
126
  ElfUtil.getThemeColors().then(this._onThemeLoaded)["catch"](this._onThemeLoaded);
76
127
  }
77
128
  };
78
- /** @override */
79
-
80
-
129
+ /** @override
130
+ * @ignore
131
+ */
81
132
  RangeBarPlugin.prototype._afterInit = function () {
82
133
  var colCount = this.getColumnCount();
83
-
84
134
  for (var i = 0; i < colCount; ++i) {
85
135
  this._setColumnRenderer(i);
86
136
  }
@@ -88,104 +138,216 @@ RangeBarPlugin.prototype._afterInit = function () {
88
138
  /** @public
89
139
  * @param {Object} host core grid object
90
140
  */
91
-
92
-
93
141
  RangeBarPlugin.prototype.unload = function (host) {
94
142
  var at = this._hosts.indexOf(host);
95
-
96
143
  if (at < 0) {
97
144
  return;
98
145
  }
99
-
100
146
  this._hosts.splice(at, 1);
101
-
102
147
  host.unlisten("columnAdded", this._onColumnAdded);
103
148
  host.unlisten("columnRemoved", this._onColumnRemoved);
104
-
149
+ host.unlisten("postSectionDataBinding", this._onPostSectionBinding);
105
150
  this._dispose();
106
151
  };
107
152
  /** @public
108
153
  * @param {Object=} options
109
154
  */
110
-
111
-
112
155
  RangeBarPlugin.prototype.config = function (options) {
113
156
  if (!options) {
114
157
  return;
115
158
  }
116
-
159
+ var extOptions = options["rangeBar"];
160
+ if (_typeof(extOptions) === "object") {
161
+ var val = extOptions["tooltip"];
162
+ if (val != null) {
163
+ this._tooltip = val;
164
+ }
165
+ val = extOptions["valueLabel"];
166
+ if (val != null) {
167
+ this.valueLabel = val;
168
+ }
169
+ }
117
170
  var columns = options["columns"];
118
-
119
171
  if (!columns) {
120
172
  return;
121
173
  }
122
-
123
174
  var len = columns.length;
124
-
125
175
  for (var i = 0; i < len; ++i) {
126
176
  this._setColumnRangeBar(i, columns[i]);
127
177
  }
128
178
  };
179
+
180
+ /** @private
181
+ * @param {Object} grid core grid object
182
+ */
183
+ RangeBarPlugin._applyThemeColor = function (grid) {
184
+ if (!grid._rangeBarStyles) {
185
+ grid._rangeBarStyles = true;
186
+ injectCss(RangeBarPlugin._styles, grid.getElement());
187
+ }
188
+ };
189
+
129
190
  /** Get a current state of grid and extension config
130
191
  * @public
131
192
  * @param {Object=} out_obj
132
193
  * @returns {!Object}
133
194
  */
134
-
135
-
136
195
  RangeBarPlugin.prototype.getConfigObject = function (out_obj) {
137
196
  var obj = out_obj || {};
138
197
  var columns = obj.columns;
139
-
140
198
  if (!columns) {
141
199
  columns = obj.columns = [];
142
200
  }
143
-
144
201
  var len = this.getColumnCount();
145
-
146
202
  for (var i = 0; i < len; ++i) {
147
- var col = columns[i];
148
-
149
- if (!col) {
150
- col = columns[i] = {};
151
- }
152
-
153
- var opt = this._getColumnData(i);
154
-
155
- if (!opt || !opt.rangeBar) {
156
- continue;
157
- }
158
-
159
- var rangeBar = col.rangeBar = {};
160
- opt = opt.rangeBar;
161
-
162
- if (opt.field != null) {
163
- rangeBar.field = opt.field;
164
- }
165
-
166
- if (opt.start != null) {
167
- rangeBar.start = opt.start;
168
- }
169
-
170
- if (opt.end != null) {
171
- rangeBar.end = opt.end;
203
+ if (!columns[i]) {
204
+ columns[i] = {};
172
205
  }
206
+ this.getColumnConfigObject(i, columns[i]);
207
+ }
208
+ var extOptions = obj.rangeBar;
209
+ if (!extOptions) {
210
+ extOptions = obj.rangeBar = {};
211
+ }
212
+ var val = this._tooltip;
213
+ if (val != true) {
214
+ extOptions.tooltip = val;
215
+ }
216
+ val = this.valueLabel;
217
+ if (val != false) {
218
+ extOptions.valueLabel = val;
219
+ }
220
+ return obj;
221
+ };
173
222
 
174
- if (opt.low != null) {
175
- rangeBar.low = opt.low;
176
- }
223
+ /** Get a column percent bar options from column index
224
+ * @public
225
+ * @param {number} colIndex
226
+ * @param {Object=} out_obj
227
+ * @returns {!Object}
228
+ */
229
+ RangeBarPlugin.prototype.getColumnConfigObject = function (colIndex, out_obj) {
230
+ if (!out_obj) {
231
+ out_obj = {};
232
+ }
233
+ var opt = this._getColumnRangeBarOptions(colIndex);
234
+ if (!opt) {
235
+ return out_obj;
236
+ }
237
+ var rangeBar = out_obj.rangeBar = {};
238
+ if (opt.field != null) {
239
+ rangeBar.field = opt.field;
240
+ }
241
+ if (opt.start != null) {
242
+ rangeBar.start = opt.start;
243
+ }
244
+ if (opt.end != null) {
245
+ rangeBar.end = opt.end;
246
+ }
247
+ if (opt.low != null) {
248
+ rangeBar.low = opt.low;
249
+ }
250
+ if (opt.last != null) {
251
+ rangeBar.last = opt.last;
252
+ }
253
+ if (opt.high != null) {
254
+ rangeBar.high = opt.high;
255
+ }
256
+ return out_obj;
257
+ };
177
258
 
178
- if (opt.high != null) {
179
- rangeBar.high = opt.high;
180
- }
259
+ /** @public
260
+ * @param {number|string} colRef
261
+ * @param {number|string} rowRef
262
+ * @return {Object}
263
+ */
264
+ RangeBarPlugin.prototype.getValue = function (colRef, rowRef) {
265
+ colRef = this.getColumnIndex(colRef);
266
+ if (colRef < 0) {
267
+ return null;
268
+ }
269
+ var rBarOpt = this._getColumnRangeBarOptions(colRef);
270
+ if (!rBarOpt) {
271
+ return null;
272
+ }
273
+ var host = this._hosts[0];
274
+ var dv = host.getDataSource();
275
+ if (!dv) {
276
+ return null;
277
+ }
278
+ if (typeof rowRef === "string") {
279
+ rowRef = dv.getRowIndex(rowRef);
280
+ }
281
+ if (rowRef == null || rowRef < 0) {
282
+ return null;
283
+ }
284
+ var rowData = this._getRow(dv, rowRef);
285
+ if (!rowData) {
286
+ return null;
287
+ }
288
+ return _getLowLastHighValue(rBarOpt, rowData);
289
+ };
181
290
 
182
- if (opt.last != null) {
183
- rangeBar.last = opt.last;
184
- }
291
+ /** @public
292
+ * @param {number|string} colRef
293
+ * @param {number|string} rowRef
294
+ * @return {string} text tooltip of cell, otherwise empty string ""
295
+ */
296
+ RangeBarPlugin.prototype.getTooltipText = function (colRef, rowRef) {
297
+ colRef = this.getColumnIndex(colRef);
298
+ if (colRef < 0) {
299
+ return "";
300
+ }
301
+ var rBarOpt = this._getColumnRangeBarOptions(colRef);
302
+ if (!rBarOpt) {
303
+ return "";
304
+ }
305
+ var host = this._hosts[0];
306
+ var dv = host.getDataSource();
307
+ if (!dv) {
308
+ return "";
309
+ }
310
+ if (typeof rowRef === "string") {
311
+ rowRef = dv.getRowIndex(rowRef);
185
312
  }
313
+ if (rowRef == "" || rowRef < 0) {
314
+ return "";
315
+ }
316
+ var rowData = this._getRow(dv, rowRef);
317
+ if (!rowData) {
318
+ return "";
319
+ }
320
+ var lowLastHigh = _getLowLastHighValue(rBarOpt, rowData);
321
+ if (this._tooltip) {
322
+ var textTooltip = this._calculateTooltip(rBarOpt, lowLastHigh);
323
+ return textTooltip;
324
+ }
325
+ return "";
326
+ };
186
327
 
187
- return obj;
328
+ /** @private
329
+ * @param {RangeBarPlugin~RangeDefinition} rBarOpt range
330
+ * @param {!Object} lowLastHigh
331
+ * @return {string} tooltip string value
332
+ */
333
+ RangeBarPlugin.prototype._calculateTooltip = function (rBarOpt, lowLastHigh) {
334
+ var low = lowLastHigh.low;
335
+ var last = lowLastHigh.last;
336
+ var high = lowLastHigh.high;
337
+ var textTooltip;
338
+ if (rBarOpt["field"]) {
339
+ // doesn't provide low,last,high case
340
+ textTooltip = last != null ? last : '--';
341
+ } else {
342
+ // provide low,last,high case
343
+ var lowValue = low != null ? low : '--';
344
+ var lastValue = last != null ? last : '--';
345
+ var highValue = high != null ? high : '--';
346
+ textTooltip = 'Low: ' + lowValue + " " + 'Last: ' + lastValue + " " + 'High: ' + highValue;
347
+ }
348
+ return textTooltip;
188
349
  };
350
+
189
351
  /** @private
190
352
  * @param {number} colIndex
191
353
  * @param {RangeBarPlugin~ColumnOptions} columnOptions
@@ -210,35 +372,27 @@ RangeBarPlugin.prototype.getConfigObject = function (out_obj) {
210
372
  * "rangeBar": true
211
373
  * };
212
374
  */
213
-
214
-
215
375
  RangeBarPlugin.prototype._setColumnRangeBar = function (colIndex, columnOptions) {
216
376
  var rDef = columnOptions["rangeBar"];
217
-
218
377
  if (rDef) {
219
378
  var colData = this._newColumnData(colIndex);
220
-
221
379
  if (rDef === true || typeof rDef["field"] === "string") {
380
+ // The start and end properties were overwritten by the extension, so the value will be returned from the get configuration even if the user does not set it (minor issue).
222
381
  rDef = {
223
382
  "field": rDef["field"] || columnOptions["field"],
224
383
  "start": rDef["start"] || this._start,
225
384
  "end": typeof rDef["end"] == "number" ? rDef["end"] : this._end
226
385
  };
227
386
  }
228
-
229
387
  colData["rangeBar"] = rDef;
230
-
231
388
  this._setColumnRenderer(colIndex);
232
389
  }
233
390
  };
234
391
  /** @private
235
392
  * @param {number} colIndex
236
393
  */
237
-
238
-
239
394
  RangeBarPlugin.prototype._setColumnRenderer = function (colIndex) {
240
- var rangeBarOption = this._getColumnOption(colIndex, "rangeBar");
241
-
395
+ var rangeBarOption = this._getColumnRangeBarOptions(colIndex);
242
396
  if (rangeBarOption && this._initializedGrid) {
243
397
  if (this._realTimeGrid) {
244
398
  this._realTimeGrid.setColumnRenderer(colIndex, this._renderer);
@@ -247,73 +401,107 @@ RangeBarPlugin.prototype._setColumnRenderer = function (colIndex) {
247
401
  }
248
402
  }
249
403
  };
250
- /** @private
251
- * @param {number} colIndex
252
- * @return {RangeBarPlugin~RangeDefinition}
253
- */
254
404
 
255
-
256
- RangeBarPlugin.prototype._getColumnRangeDef = function (colIndex) {
257
- return this._getColumnOption(colIndex, "rangeBar");
258
- };
259
405
  /** @private */
260
-
261
-
262
406
  RangeBarPlugin.prototype._onThemeLoaded = function () {
263
407
  for (var i = this._hosts.length; --i >= 0;) {
264
408
  this._hosts[i].requestRowRefresh();
265
409
  }
266
410
  };
411
+
267
412
  /** @private
268
413
  * @param {Object} e
269
414
  */
270
-
271
-
272
- RangeBarPlugin.prototype._renderer = function (e) {
273
- if (!ElfUtil.isThemeLoaded()) {
274
- return;
275
- }
276
-
277
- var colIndex = e["colIndex"];
278
-
279
- var rBarOpt = this._getColumnOption(colIndex, "rangeBar");
280
-
281
- if (!rBarOpt) {
282
- return;
283
- }
284
-
285
- var cell = e["cell"];
286
- var content = cell.getContent();
287
- var rangeBar;
288
-
289
- if (content && content._rangeBar) {
290
- rangeBar = content._rangeBar;
291
- } else {
292
- content = Dom.div();
293
- rangeBar = content._rangeBar = new RangeBar(content);
294
- }
295
-
296
- var rowData = e["rowData"];
297
- var low, high, last;
298
-
299
- if (rBarOpt["field"]) {
300
- low = rBarOpt["start"];
301
- high = rBarOpt["end"];
302
- last = rowData[rBarOpt["field"]];
303
- } else {
304
- low = rowData[rBarOpt["low"]];
305
- high = rowData[rBarOpt["high"]];
306
- last = rowData[rBarOpt["last"]];
415
+ RangeBarPlugin.prototype._onPostSectionBinding = function (e) {
416
+ var section = e["section"];
417
+ var dataRows = /** @type{Array.<Object>} */e["dataRows"];
418
+ var colCount = section.getColumnCount();
419
+ var fromR = /** @type{number} */e["fromRowIndex"];
420
+ var toR = /** @type{number} */e["toRowIndex"];
421
+ for (var c = 0; c < colCount; ++c) {
422
+ var rBarOpt = this._getColumnRangeBarOptions(c);
423
+ if (!rBarOpt) {
424
+ continue;
425
+ }
426
+ for (var r = fromR; r < toR; ++r) {
427
+ var cell = section.getCell(c, r, false);
428
+ if (!cell) {
429
+ continue;
430
+ }
431
+ var rowData = this._getRowData(dataRows[r]);
432
+ var lowLastHigh = _getLowLastHighValue(rBarOpt, rowData);
433
+ var low = lowLastHigh.low;
434
+ var last = lowLastHigh.last;
435
+ var high = lowLastHigh.high;
436
+ var content = cell.getContent();
437
+ var rangeBar = content ? content._rangeBar : null;
438
+ if (!rangeBar) {
439
+ rangeBar = document.createElement("ef-led-gauge");
440
+ rangeBar.neutralColor = true; // TODO: color should be set by option
441
+ rangeBar._rangeBar = rangeBar;
442
+ content = rangeBar;
443
+ }
444
+ if (this._tooltip) {
445
+ var textTooltip = this._calculateTooltip(rBarOpt, lowLastHigh);
446
+ cell.setTooltip(textTooltip); // WARNING: this may be confuse with auto-tooltip extension
447
+ }
448
+
449
+ if (high == null || low == null || high < low) {
450
+ // Invalid cases
451
+ var span = document.createElement("span");
452
+ span.textContent = "N/A";
453
+ cell.setContent(span);
454
+ continue;
455
+ }
456
+ if (high === low && high === last) {
457
+ // all value equal, highlight all bar and value in the middle case
458
+ rangeBar.range = [-100, 100];
459
+ rangeBar.topValue = 0;
460
+ cell.setContent(rangeBar);
461
+ continue;
462
+ }
463
+ var lastNormalize = _normalizeValue(low, last, high);
464
+
465
+ // Clear the current range for apply a new one.
466
+ rangeBar.range.length = 0;
467
+
468
+ // applied range when the last value out of range, by set new low/high with last value
469
+ if (last < low) {
470
+ lastNormalize = _normalizeValue(last, last, high);
471
+ var lowNormalize = _normalizeValue(last, low, high);
472
+ rangeBar.range = [lastNormalize, lowNormalize];
473
+ } else if (last > high) {
474
+ lastNormalize = _normalizeValue(low, last, last);
475
+ var highNormalize = _normalizeValue(low, high, last);
476
+ rangeBar.range = [highNormalize, lastNormalize];
477
+ }
478
+ // else {} // It is not necessary to apply a range in the case of equal low or high values
479
+
480
+ rangeBar.topValue = lastNormalize;
481
+ if (this.valueLabel) {
482
+ rangeBar.topLabel = last;
483
+ }
484
+ cell.setContent(content);
485
+ }
307
486
  }
308
-
309
- rangeBar.setValue(low, last, high);
310
- cell.setContent(content);
311
487
  };
488
+
312
489
  /** @private
313
490
  * @param {Object} e
314
491
  */
492
+ RangeBarPlugin.prototype._renderer = function (e) {};
315
493
 
494
+ /** @private
495
+ * @param {number} colIndex
496
+ * @return {Object}
497
+ */
498
+ RangeBarPlugin.prototype._getColumnRangeBarOptions = function (colIndex) {
499
+ return this._getColumnOption(colIndex, "rangeBar");
500
+ };
316
501
 
502
+ /** @private
503
+ * @param {Object} e
504
+ */
317
505
  RangeBarPlugin.prototype._onColumnAdded = function (e) {
318
506
  if (e["context"]) {
319
507
  this._setColumnRangeBar(e["colIndex"], e["context"]);
@@ -322,25 +510,16 @@ RangeBarPlugin.prototype._onColumnAdded = function (e) {
322
510
  /** @private
323
511
  * @param {Object} e
324
512
  */
325
-
326
-
327
513
  RangeBarPlugin.prototype._onColumnRemoved = function (e) {
328
- var colData =
329
- /** @type{Object} */
330
- e.columnData;
331
-
514
+ var colData = /** @type{Object} */e.columnData;
332
515
  if (!colData) {
333
516
  return;
334
517
  }
335
-
336
518
  var rDef = colData["rangeBar"];
337
-
338
519
  if (!rDef) {
339
520
  return;
340
521
  }
341
-
342
522
  colData["rangeBar"] = null;
343
523
  };
344
-
345
524
  export default RangeBarPlugin;
346
525
  export { RangeBarPlugin, RangeBarPlugin as RangeBar, RangeBarPlugin as RangeBarExtension };
@@ -28,7 +28,7 @@ declare class GridPlugin extends EventDispatcher {
28
28
 
29
29
  public getColumnName(colRef: number|string|null): string;
30
30
 
31
- public getColumnIndex(colId: number|string|null): number;
31
+ public getColumnIndex(colRef: number|string|null): number;
32
32
 
33
33
  public getColumnIndices(colRefs: (number|string)[]|null): (number)[]|null;
34
34
 
@@ -234,29 +234,27 @@ GridPlugin.prototype.getColumnName = function (colRef) {
234
234
  return "";
235
235
  };
236
236
  /** @public
237
- * @param {number|string} colId Column index or column Id
237
+ * @param {number|string} colRef Column id, field name or column index
238
238
  * @return {number}
239
239
  */
240
- GridPlugin.prototype.getColumnIndex = function (colId) {
241
- if(typeof colId === "number") {
242
- return colId;
240
+ GridPlugin.prototype.getColumnIndex = function (colRef) {
241
+ if(typeof colRef === "number") {
242
+ return colRef;
243
243
  }
244
244
  if(this._compositeGrid) {
245
- return this._compositeGrid.getColumnIndex(colId);
246
- } else {
247
- var rtGrid = this._realTimeGrid;
248
- var colCount = rtGrid.getColumnCount();
249
- for(var i = 0; i < colCount; ++i) {
250
- var colDef = rtGrid.getColumnDefinition(i);
251
- if(colDef && colDef.getId() === colId) {
252
- return i;
253
- }
245
+ var allFields = this._compositeGrid.getColumnFields();
246
+ var colIndex = allFields.indexOf(colRef);
247
+ if(colIndex > -1) {
248
+ return colIndex;
249
+ } else {
250
+ return this._compositeGrid.getColumnIndex(colRef);
254
251
  }
252
+ } else {
253
+ return this._realTimeGrid.getColumnIndex(colRef);
255
254
  }
256
- return -1;
257
255
  };
258
256
  /** @public
259
- * @param {Array.<number|string>} colRefs column references field name or column index
257
+ * @param {Array.<number|string>} colRefs A collection of column ids, field names or column indices
260
258
  * @return {Array.<number>} column indices
261
259
  */
262
260
  GridPlugin.prototype.getColumnIndices = function (colRefs) {