@refinitiv-ui/efx-grid 6.0.91 → 6.0.93
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/filter-dialog/lib/filter-dialog.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
- 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-util/es6/CellPainter.js +94 -104
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +41 -41
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +14 -3
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -58
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -87
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +71 -80
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +52 -52
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +12 -12
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
@@ -37,7 +37,7 @@ import { ExpressionParser } from "./ExpressionParser.js";
|
|
37
37
|
|
38
38
|
/** @constructor */
|
39
39
|
|
40
|
-
|
40
|
+
let CellPainter = function() {
|
41
41
|
this._conditions = [];
|
42
42
|
this._scopes = [];
|
43
43
|
|
@@ -143,7 +143,7 @@ CellPainter.themeReady = null;
|
|
143
143
|
* @param {string|Function} expression
|
144
144
|
* @return {Function}
|
145
145
|
* @example
|
146
|
-
*
|
146
|
+
* let fn = CellPainter.parse("[CF_BID] >= 10 && [CF_BID] <= 100");
|
147
147
|
* window.console.log(fn(25));
|
148
148
|
*/
|
149
149
|
CellPainter.parse = ExpressionParser.parse;
|
@@ -151,7 +151,7 @@ CellPainter.parse = ExpressionParser.parse;
|
|
151
151
|
|
152
152
|
/** @public */
|
153
153
|
CellPainter.prototype.dispose = function() {
|
154
|
-
|
154
|
+
let at = CellPainter._painters.indexOf(this);
|
155
155
|
if(at >= 0) {
|
156
156
|
CellPainter._painters.splice(at, 1);
|
157
157
|
}
|
@@ -166,14 +166,14 @@ CellPainter.prototype.dispose = function() {
|
|
166
166
|
CellPainter.prototype.reset = function() {
|
167
167
|
this._setColoringType(0);
|
168
168
|
|
169
|
-
|
169
|
+
let len = this._scopes.length;
|
170
170
|
if(len) {
|
171
|
-
for(
|
172
|
-
|
171
|
+
for(let i = 0; i < len; ++i) {
|
172
|
+
let scope = this._scopes[i];
|
173
173
|
if(CellPainter._clearBlinkTimer(scope)) {
|
174
174
|
scope._restorer();
|
175
175
|
}
|
176
|
-
|
176
|
+
let cell = scope["cell"];
|
177
177
|
if(cell) {
|
178
178
|
delete cell["blinking"]; // Delete cell blinking scope
|
179
179
|
}
|
@@ -203,14 +203,14 @@ CellPainter.prototype.resetBlinking = function() {
|
|
203
203
|
/** @public */
|
204
204
|
CellPainter.prototype.clearBlinking = function() {
|
205
205
|
this._blinkCondition = null;
|
206
|
-
|
206
|
+
let len = this._scopes.length;
|
207
207
|
if(len) {
|
208
|
-
for(
|
209
|
-
|
208
|
+
for(let i = 0; i < len; ++i) {
|
209
|
+
let scope = this._scopes[i];
|
210
210
|
if(CellPainter._clearBlinkTimer(scope)) {
|
211
211
|
scope._restorer();
|
212
212
|
}
|
213
|
-
|
213
|
+
let cell = scope["cell"];
|
214
214
|
if(cell) { // cell may be removed before
|
215
215
|
delete cell["blinking"]; // Delete cell blinking scope
|
216
216
|
}
|
@@ -244,9 +244,9 @@ CellPainter.prototype.clearHeatMap = function() {
|
|
244
244
|
|
245
245
|
/** @public */
|
246
246
|
CellPainter.prototype.applyThemeColor = function() {
|
247
|
-
|
247
|
+
let colors = ElfUtil.getColors();
|
248
248
|
if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) { // Heatmap uses grid color to blend the result color
|
249
|
-
|
249
|
+
let cond = this._conditions[0]; // Heatmap, color text condition must be the first
|
250
250
|
if(cond) {
|
251
251
|
if(cond["textMode"]) {
|
252
252
|
cond["baseColor"] = colors["baseText"];
|
@@ -254,9 +254,9 @@ CellPainter.prototype.applyThemeColor = function() {
|
|
254
254
|
cond["baseColor"] = colors["baseGrid"];
|
255
255
|
}
|
256
256
|
if(cond["useThemeColor"]) {
|
257
|
-
|
258
|
-
|
259
|
-
|
257
|
+
let up = colors["up"];
|
258
|
+
let down = colors["down"];
|
259
|
+
let level = (colors["level"] === colors["baseText"]) ? "" : colors["level"];
|
260
260
|
CellPainter._setUpDownColors(cond, up, down, level);
|
261
261
|
}
|
262
262
|
}
|
@@ -308,8 +308,8 @@ CellPainter.prototype.setConditions = function(conditions) {
|
|
308
308
|
this._conditions.length = 0; // TODO: Clear existing cell styles first
|
309
309
|
this._setColoringType(CellPainter.ColoringTypes.CONDITIONAL);
|
310
310
|
|
311
|
-
|
312
|
-
for (
|
311
|
+
let len = conditions.length;
|
312
|
+
for (let i = 0; i < len; i++) {
|
313
313
|
this._addCondition(conditions[i]);
|
314
314
|
}
|
315
315
|
};
|
@@ -329,7 +329,7 @@ CellPainter.prototype.getColumnStats = function() {
|
|
329
329
|
* @param {CellPainter~Condition} condition
|
330
330
|
*/
|
331
331
|
CellPainter.prototype._addCondition = function(condition) {
|
332
|
-
|
332
|
+
let exp = condition["expression"];
|
333
333
|
if(exp) {
|
334
334
|
condition._fn = ExpressionParser.parse(exp["text"] || exp);
|
335
335
|
this._conditions.push(condition);
|
@@ -347,7 +347,7 @@ CellPainter.prototype._addCondition = function(condition) {
|
|
347
347
|
CellPainter.prototype.addHeatmap = function(field, midPoint, upColor, downColor, baseColor, opt_textMode) {
|
348
348
|
this._setColoringType(CellPainter.ColoringTypes.HEATMAP);
|
349
349
|
|
350
|
-
|
350
|
+
let condition = {};
|
351
351
|
condition["heatmap"] = true;
|
352
352
|
condition["field"] = field;
|
353
353
|
condition["expression"] = CellPainter._heatMapCondition.bind(condition);
|
@@ -369,8 +369,8 @@ CellPainter.prototype.addHeatmap = function(field, midPoint, upColor, downColor,
|
|
369
369
|
* @return {!Object}
|
370
370
|
*/
|
371
371
|
CellPainter.prototype.addHeatmapWithTheme = function(field, midPoint, opt_textMode) {
|
372
|
-
|
373
|
-
|
372
|
+
let colors = ElfUtil.themeColors;
|
373
|
+
let condition = this.addHeatmap(
|
374
374
|
field,
|
375
375
|
midPoint,
|
376
376
|
colors["up"], colors["down"], colors["baseGrid"],
|
@@ -394,7 +394,7 @@ CellPainter.prototype.addHeatmapWithTheme = function(field, midPoint, opt_textMo
|
|
394
394
|
CellPainter.prototype._addColorText = function(expression, field, upClass, downClass, levelClass) {
|
395
395
|
this._setColoringType(CellPainter.ColoringTypes.TEXT);
|
396
396
|
|
397
|
-
|
397
|
+
let condition = {};
|
398
398
|
condition["field"] = field;
|
399
399
|
condition["expression"] = expression.bind(null, field);
|
400
400
|
condition["upClass"] = upClass;
|
@@ -423,7 +423,7 @@ CellPainter.prototype.addColorText = function(field, upClass, downClass, levelCl
|
|
423
423
|
* @return {!Object}
|
424
424
|
*/
|
425
425
|
CellPainter.prototype.addColorTextWithTheme = function(field) {
|
426
|
-
|
426
|
+
let condition = this.addColorText(field, "positive", "negative", "neutral");
|
427
427
|
return condition;
|
428
428
|
};
|
429
429
|
/** @public
|
@@ -439,8 +439,8 @@ CellPainter.prototype.addTickColorText = function(upColor, downColor, levelColor
|
|
439
439
|
* @return {!Object}
|
440
440
|
*/
|
441
441
|
CellPainter.prototype.addTickColorTextWithTheme = function() {
|
442
|
-
|
443
|
-
|
442
|
+
let colors = ElfUtil.themeColors;
|
443
|
+
let condition = this.addTickColorText(colors["tickUp"], colors["tickDown"], colors["level"]);
|
444
444
|
condition["useThemeColor"] = true;
|
445
445
|
return condition;
|
446
446
|
};
|
@@ -459,8 +459,8 @@ CellPainter.prototype.addTickBlink = function(upColor, downColor, levelColor, op
|
|
459
459
|
* @return {!Object}
|
460
460
|
*/
|
461
461
|
CellPainter.prototype.addTickBlinkWithTheme = function(opt_border) {
|
462
|
-
|
463
|
-
|
462
|
+
let colors = ElfUtil.themeColors;
|
463
|
+
let condition = this.addTickBlink(colors["tickUp"], colors["tickDown"], colors["level"], opt_border);
|
464
464
|
condition["useThemeColor"] = true;
|
465
465
|
return condition;
|
466
466
|
};
|
@@ -486,8 +486,8 @@ CellPainter.prototype.addBlink = function(field, upColor, downColor, levelColor,
|
|
486
486
|
* @return {!Object}
|
487
487
|
*/
|
488
488
|
CellPainter.prototype.addBlinkWithTheme = function(field, opt_border) {
|
489
|
-
|
490
|
-
|
489
|
+
let colors = ElfUtil.themeColors;
|
490
|
+
let condition = this.addBlink(field, colors["up"], colors["down"], colors["level"], opt_border);
|
491
491
|
condition["useThemeColor"] = true;
|
492
492
|
return condition;
|
493
493
|
};
|
@@ -501,7 +501,7 @@ CellPainter.prototype.addBlinkWithTheme = function(field, opt_border) {
|
|
501
501
|
* @return {!Object}
|
502
502
|
*/
|
503
503
|
CellPainter.prototype._addBlink = function(expression, field, upColor, downColor, levelColor, blinkType) {
|
504
|
-
|
504
|
+
let condition = this._blinkCondition = {};
|
505
505
|
condition["blink"] = true;
|
506
506
|
condition["blinkId"] = CellPainter._runningBlinkId++;
|
507
507
|
condition["field"] = field;
|
@@ -524,8 +524,8 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
|
|
524
524
|
if(!cell) {
|
525
525
|
return;
|
526
526
|
}
|
527
|
-
|
528
|
-
|
527
|
+
let styles = this._getStyles(rowData, min, max);
|
528
|
+
let cssClass = styles["cssClass"]; // Can be an empty string
|
529
529
|
if (cssClass != null) { // Predefined colors mode
|
530
530
|
if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
|
531
531
|
elem.classList.remove(elem._coloringCssClass);
|
@@ -552,7 +552,7 @@ CellPainter.prototype.renderForPrinting = function(cell, rowData, min, max) {
|
|
552
552
|
* @return {string|number}
|
553
553
|
*/
|
554
554
|
CellPainter._colorTextCondition = function(field, rowData) {
|
555
|
-
|
555
|
+
let value = rowData[field];
|
556
556
|
if(value || value === 0) {
|
557
557
|
if(value > 0) {
|
558
558
|
return 1;
|
@@ -568,11 +568,7 @@ CellPainter._colorTextCondition = function(field, rowData) {
|
|
568
568
|
* @return {undefined|number}
|
569
569
|
*/
|
570
570
|
CellPainter._tickColorTextCondition = function(field, rowData) {
|
571
|
-
|
572
|
-
if(code) {
|
573
|
-
return code;
|
574
|
-
}
|
575
|
-
return; // eslint-disable-line
|
571
|
+
return TickCodes[rowData[field]];
|
576
572
|
};
|
577
573
|
/** @private
|
578
574
|
* @this {Object}
|
@@ -582,14 +578,14 @@ CellPainter._tickColorTextCondition = function(field, rowData) {
|
|
582
578
|
* @return {number}
|
583
579
|
*/
|
584
580
|
CellPainter._heatMapCondition = function(rowData, min, max) {
|
585
|
-
|
586
|
-
|
581
|
+
let value = rowData[this["field"]];
|
582
|
+
let diff = (value || value === 0) ? value - this["midPoint"] : NaN;
|
587
583
|
if (diff === 0 || diff !== diff) {
|
588
584
|
return 0;
|
589
585
|
}
|
590
586
|
|
591
|
-
|
592
|
-
|
587
|
+
let ratio;
|
588
|
+
let range = 1;
|
593
589
|
if(diff > 0) {
|
594
590
|
range = max - this["midPoint"];
|
595
591
|
if(range < 0) {
|
@@ -613,11 +609,7 @@ CellPainter._heatMapCondition = function(rowData, min, max) {
|
|
613
609
|
* @return {undefined|number}
|
614
610
|
*/
|
615
611
|
CellPainter._tickBlinkCondition = function(newValue) {
|
616
|
-
|
617
|
-
if(code) {
|
618
|
-
return code;
|
619
|
-
}
|
620
|
-
return; // eslint-disable-line
|
612
|
+
return TickCodes[newValue];
|
621
613
|
};
|
622
614
|
/** @private
|
623
615
|
* @function
|
@@ -639,8 +631,8 @@ CellPainter._fieldBlinkCondition = function(newValue, oldValue) {
|
|
639
631
|
*/
|
640
632
|
CellPainter._borderRestorer = function(scope) {
|
641
633
|
scope["blinkTimer"] = 0;
|
642
|
-
|
643
|
-
|
634
|
+
let cell = scope["cell"];
|
635
|
+
let elem = cell.getElement();
|
644
636
|
|
645
637
|
if(elem) {
|
646
638
|
elem.style.border = "";
|
@@ -651,23 +643,23 @@ CellPainter._borderRestorer = function(scope) {
|
|
651
643
|
*/
|
652
644
|
CellPainter._cellRestorer = function(scope) {
|
653
645
|
scope["blinkTimer"] = 0;
|
654
|
-
|
655
|
-
|
646
|
+
let cell = scope["cell"];
|
647
|
+
let elem = cell.getElement();
|
656
648
|
|
657
649
|
if(elem) {
|
658
|
-
|
659
|
-
|
660
|
-
|
650
|
+
let rowData = scope["rowData"];
|
651
|
+
let min = NaN;
|
652
|
+
let max = NaN;
|
661
653
|
if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) {
|
662
|
-
|
654
|
+
let columnStats = this._columnStats;
|
663
655
|
if(columnStats) {
|
664
656
|
min = columnStats.getMin();
|
665
657
|
max = columnStats.getMax();
|
666
658
|
}
|
667
659
|
}
|
668
660
|
|
669
|
-
|
670
|
-
|
661
|
+
let styles = this._getStyles(rowData, min, max);
|
662
|
+
let cssClass = styles["cssClass"]; // Can be an empty string
|
671
663
|
if (cssClass != null) { // Predefined colors mode
|
672
664
|
if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
|
673
665
|
elem.classList.remove(elem._coloringCssClass);
|
@@ -703,18 +695,19 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
|
|
703
695
|
return CellPainter._emptyObj;
|
704
696
|
}
|
705
697
|
|
706
|
-
|
707
|
-
for(
|
708
|
-
|
709
|
-
|
698
|
+
let len = this._conditions.length;
|
699
|
+
for(let i = 0; i < len; ++i) {
|
700
|
+
let curCond = this._conditions[i];
|
701
|
+
let fn = curCond._fn;
|
702
|
+
let ret;
|
710
703
|
try { // WARNING: Try/Catch is very slow. TODO: The function should be checked for validity beforehand
|
711
|
-
|
704
|
+
ret = fn && fn(rowData, min, max);
|
712
705
|
} catch (err){
|
713
706
|
// console.error(err.message); // This will produce tons of errors in the console
|
714
707
|
}
|
715
708
|
if (ret) { // Match condition with results 1, -1, true, or string
|
716
709
|
if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) {
|
717
|
-
|
710
|
+
let blendedColor;
|
718
711
|
if(ret > 0) {
|
719
712
|
blendedColor = CellPainter.blendColor(curCond["baseColor"], curCond["upColor"], ret);
|
720
713
|
} else {
|
@@ -770,11 +763,11 @@ CellPainter.blendColor = function (baseColor, maxColor, ratio) { // TODO: Optimi
|
|
770
763
|
ratio = 0;
|
771
764
|
}
|
772
765
|
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
for (
|
777
|
-
|
766
|
+
let baseColorTriplet = CellPainter.hex2Num(baseColor);
|
767
|
+
let maxColorTriplet = CellPainter.hex2Num(maxColor);
|
768
|
+
let blendResult = [];
|
769
|
+
for (let i = 0; i < 3; ++i) {
|
770
|
+
let gap = (maxColorTriplet[i] - baseColorTriplet[i]) * ratio;
|
778
771
|
blendResult.push(baseColorTriplet[i] + gap);
|
779
772
|
}
|
780
773
|
|
@@ -786,7 +779,7 @@ CellPainter.blendColor = function (baseColor, maxColor, ratio) { // TODO: Optimi
|
|
786
779
|
* @return {string} resultColor
|
787
780
|
*/
|
788
781
|
CellPainter.blackAndWhite = function (triplet) {
|
789
|
-
|
782
|
+
let brightness = Math.sqrt(triplet[0] * triplet[0] * 0.241 + triplet[1] * triplet[1] * 0.691 + triplet[2] * triplet[2] * 0.068);
|
790
783
|
|
791
784
|
if (brightness >= 135) { // Brighter color has more impact to human eye than the darker color
|
792
785
|
return '#000000';
|
@@ -807,7 +800,7 @@ CellPainter.rgb2Hex = rgb2Hex; // For backward compatability
|
|
807
800
|
* @return {string} resultColor
|
808
801
|
*/
|
809
802
|
CellPainter.num2Hex = function (triplet) {
|
810
|
-
|
803
|
+
let rgb = triplet[2] | (triplet[1] << 8) | (triplet[0] << 16);
|
811
804
|
return ('#' + (0x1000000 + rgb).toString(16).slice(1));
|
812
805
|
};
|
813
806
|
/** Note that Chrome, IE, and Firefox store color in rgb representation.
|
@@ -825,10 +818,10 @@ CellPainter.num2Rgb = function (triplet) {
|
|
825
818
|
* @return {Array.<number>} array of size 3 which contains [red, green, blue]
|
826
819
|
*/
|
827
820
|
CellPainter.hex2Num = function (hex) {
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
821
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ''), 16);
|
822
|
+
let r = (hexInt >> 16) & 255;
|
823
|
+
let g = (hexInt >> 8) & 255;
|
824
|
+
let b = hexInt & 255;
|
832
825
|
return [r, g, b];
|
833
826
|
};
|
834
827
|
/** @public
|
@@ -838,10 +831,10 @@ CellPainter.hex2Num = function (hex) {
|
|
838
831
|
*/
|
839
832
|
CellPainter.hex2Rgb = function (hex) {
|
840
833
|
if(hex) {
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
834
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ''), 16);
|
835
|
+
let r = (hexInt >> 16) & 255;
|
836
|
+
let g = (hexInt >> 8) & 255;
|
837
|
+
let b = hexInt & 255;
|
845
838
|
return 'rgb(' + r + ', ' + g + ', ' + b + ')';
|
846
839
|
}
|
847
840
|
return '';
|
@@ -862,8 +855,8 @@ CellPainter.setThemeColors = function() {};
|
|
862
855
|
*/
|
863
856
|
CellPainter._onThemeChanged = function() {
|
864
857
|
// Apply newly changed theme to all the painters
|
865
|
-
|
866
|
-
for(
|
858
|
+
let painters = CellPainter._painters;
|
859
|
+
for(let i = painters.length; --i >= 0;) {
|
867
860
|
painters[i].applyThemeColor(); // Re-apply theme color
|
868
861
|
}
|
869
862
|
};
|
@@ -900,12 +893,12 @@ CellPainter.reloadThemeColors = function () {
|
|
900
893
|
* @param {Object=} styles
|
901
894
|
*/
|
902
895
|
CellPainter.clearCellStyle = function(cell, styles) {
|
903
|
-
|
896
|
+
let elem = cell.getElement();
|
904
897
|
if(!elem) {
|
905
898
|
return; // Cell has been disposed
|
906
899
|
}
|
907
900
|
|
908
|
-
|
901
|
+
let scope = cell["blinking"];
|
909
902
|
if(scope) { // Clear blinking scope
|
910
903
|
CellPainter._clearBlinkTimer(scope);
|
911
904
|
|
@@ -923,11 +916,11 @@ CellPainter.clearCellStyle = function(cell, styles) {
|
|
923
916
|
styles = CellPainter.supportedStyles;
|
924
917
|
}
|
925
918
|
if(Array.isArray(styles)){
|
926
|
-
for(
|
919
|
+
for(let i = styles.length; --i >= 0;) {
|
927
920
|
elem.style[styles[i]] = ""; // WARNING: Very slow
|
928
921
|
}
|
929
922
|
} else {
|
930
|
-
for(
|
923
|
+
for(let key in styles) {
|
931
924
|
elem.style[key] = ""; // WARNING: Very slow
|
932
925
|
}
|
933
926
|
}
|
@@ -945,7 +938,6 @@ CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, wit
|
|
945
938
|
if(withContrast) {
|
946
939
|
scp["contrastUpColor"] = CellPainter.getOppositeColor(upColor);
|
947
940
|
}
|
948
|
-
//scp["rgbUp"] = CellPainter.hex2Rgb(upColor);
|
949
941
|
}
|
950
942
|
|
951
943
|
scp["downColor"] = downColor;
|
@@ -953,7 +945,6 @@ CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, wit
|
|
953
945
|
if(withContrast) {
|
954
946
|
scp["contrastDownColor"] = CellPainter.getOppositeColor(downColor);
|
955
947
|
}
|
956
|
-
//scp["rgbDown"] = CellPainter.hex2Rgb(downColor);
|
957
948
|
}
|
958
949
|
|
959
950
|
scp["levelColor"] = levelColor;
|
@@ -961,7 +952,6 @@ CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, wit
|
|
961
952
|
if(withContrast) {
|
962
953
|
scp["contrastLevelColor"] = CellPainter.getOppositeColor(levelColor);
|
963
954
|
}
|
964
|
-
//scp["rgbLevel"] = CellPainter.hex2Rgb(levelColor);
|
965
955
|
}
|
966
956
|
};
|
967
957
|
/** @private
|
@@ -984,7 +974,7 @@ CellPainter._clearBlinkTimer = function(scp, opt_restoreColor) {
|
|
984
974
|
CellPainter.getOppositeColor = function (hexCode) {
|
985
975
|
if(typeof hexCode === "string") {
|
986
976
|
if(hexCode.charAt(0) === "#") {
|
987
|
-
|
977
|
+
let triplet = CellPainter.hex2Num(hexCode);
|
988
978
|
return CellPainter.blackAndWhite(triplet);
|
989
979
|
}
|
990
980
|
} else if(Array.isArray(hexCode)) {
|
@@ -1038,11 +1028,11 @@ CellPainter.prototype.renderColoring = function (cell, rowData) {
|
|
1038
1028
|
*/
|
1039
1029
|
CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
|
1040
1030
|
if (!cell) return;
|
1041
|
-
|
1031
|
+
let elem = cell.getElement();
|
1042
1032
|
if (!elem) return; // Cell has been disposed
|
1043
1033
|
|
1044
|
-
|
1045
|
-
|
1034
|
+
let bc = this._blinkCondition;
|
1035
|
+
let scope;
|
1046
1036
|
if (bc) {
|
1047
1037
|
scope = cell["blinking"];
|
1048
1038
|
if (scope && scope["blinkTimer"] && !bc["border"]) { // The cell is blinking
|
@@ -1050,11 +1040,11 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
|
|
1050
1040
|
}
|
1051
1041
|
}
|
1052
1042
|
|
1053
|
-
|
1043
|
+
let styles = this._getStyles(rowData, min, max);
|
1054
1044
|
|
1055
|
-
|
1045
|
+
let elStyle = elem.style;
|
1056
1046
|
|
1057
|
-
|
1047
|
+
let cssClass = styles["cssClass"]; // Can be an empty string
|
1058
1048
|
if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
|
1059
1049
|
elem.classList.remove(elem._coloringCssClass);
|
1060
1050
|
elem._coloringCssClass = null;
|
@@ -1097,10 +1087,10 @@ CellPainter.prototype.blink = function (cell, blinkSignal, rowData) {
|
|
1097
1087
|
* @return {boolean}
|
1098
1088
|
*/
|
1099
1089
|
CellPainter.prototype.blinkCell = function(cell, newValue, oldValue, rowData) {
|
1100
|
-
|
1090
|
+
let bc = this._blinkCondition;
|
1101
1091
|
if (!bc) return false;
|
1102
1092
|
|
1103
|
-
|
1093
|
+
let blinkSignal = this._blinkCondition._fn(newValue, oldValue);
|
1104
1094
|
return this._blinkCell(cell, rowData, blinkSignal);
|
1105
1095
|
};
|
1106
1096
|
|
@@ -1119,13 +1109,13 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
1119
1109
|
}
|
1120
1110
|
}
|
1121
1111
|
|
1122
|
-
|
1112
|
+
let elem = cell.getElement();
|
1123
1113
|
if (!elem) return false; // Cell has been disposed
|
1124
1114
|
|
1125
|
-
|
1115
|
+
let bc = this._blinkCondition;
|
1126
1116
|
if (!bc) return false;
|
1127
1117
|
|
1128
|
-
|
1118
|
+
let scope = cell["blinking"];
|
1129
1119
|
if (!scope) {
|
1130
1120
|
scope = {};
|
1131
1121
|
scope["cell"] = cell;
|
@@ -1137,13 +1127,13 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
1137
1127
|
if (scope["blinkId"] !== bc["blinkId"]) {
|
1138
1128
|
scope["blinkId"] = bc["blinkId"];
|
1139
1129
|
scope["field"] = bc["field"];
|
1140
|
-
|
1130
|
+
let restorer = bc["border"] ? CellPainter._borderRestorer : CellPainter._cellRestorer;
|
1141
1131
|
scope._restorer = restorer.bind(this, scope);
|
1142
1132
|
}
|
1143
1133
|
|
1144
1134
|
scope["rowData"] = rowData;
|
1145
1135
|
|
1146
|
-
|
1136
|
+
let blinkColor, contrastColor;
|
1147
1137
|
if (blinkSignal > 0) {
|
1148
1138
|
blinkColor = bc["upColor"];
|
1149
1139
|
contrastColor = bc["contrastUpColor"];
|
@@ -1155,7 +1145,7 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
1155
1145
|
contrastColor = bc["contrastLevelColor"];
|
1156
1146
|
}
|
1157
1147
|
|
1158
|
-
|
1148
|
+
let bgBlinking = true;
|
1159
1149
|
// All conditions are met for blinking
|
1160
1150
|
if (bc["border"]) {
|
1161
1151
|
elem.style.border = "1px solid " + blinkColor;
|
@@ -1177,7 +1167,7 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
1177
1167
|
* @param {Object} rowData
|
1178
1168
|
*/
|
1179
1169
|
CellPainter.prototype.verifyBlinking = function(cell, rowData) {
|
1180
|
-
|
1170
|
+
let scope = cell["blinking"];
|
1181
1171
|
if (scope && scope["blinkTimer"]) {
|
1182
1172
|
if (scope["rowData"] !== rowData) {
|
1183
1173
|
scope["rowData"] = rowData; // Needed for style calculation by restorer
|
@@ -5,12 +5,12 @@
|
|
5
5
|
* @param {(number|Function)=} ms The delay time in millisecond before executing the function
|
6
6
|
* @param {*=} thisObj "this" object to be bound with the given function. If the function is already bound, there is no need to provide thisObj parameter
|
7
7
|
* @example
|
8
|
-
*
|
9
|
-
* for(
|
8
|
+
* let c = new Conflator(function() { console.log("Executed"); }, 1000);
|
9
|
+
* for(let i = 10; --i >= 0;) {
|
10
10
|
* c.conflate(i); // Only one "Executed" text will be logged to console after one second
|
11
11
|
* }
|
12
12
|
*/
|
13
|
-
|
13
|
+
let Conflator = function (func, ms, thisObj) {
|
14
14
|
this._onConflated = this._onConflated.bind(this);
|
15
15
|
|
16
16
|
this._data = [];
|
@@ -72,7 +72,7 @@ Conflator.prototype.reset = function () {
|
|
72
72
|
*/
|
73
73
|
Conflator.prototype.popAllData = function() {
|
74
74
|
if(this._data.length) {
|
75
|
-
|
75
|
+
let data = this._data;
|
76
76
|
this._data = [];
|
77
77
|
return data;
|
78
78
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/** @namespace */
|
2
|
-
|
2
|
+
let CoralItems = {};
|
3
3
|
|
4
4
|
/** Create new array with valid object items to be consumed by ef-select's data property from the given input
|
5
5
|
* @public
|
@@ -16,10 +16,10 @@ var CoralItems = {};
|
|
16
16
|
*/
|
17
17
|
CoralItems.create = function(userItems) {
|
18
18
|
if(Array.isArray(userItems)) {
|
19
|
-
|
20
|
-
|
21
|
-
for(
|
22
|
-
|
19
|
+
let len = userItems.length;
|
20
|
+
let ary = new Array(len);
|
21
|
+
for(let i = 0; i < len; ++i) {
|
22
|
+
let userItem = userItems[i];
|
23
23
|
if(userItem != null) {
|
24
24
|
if (typeof userItem !== "object") {
|
25
25
|
userItem = { value: userItem };
|
@@ -27,7 +27,7 @@ CoralItems.create = function(userItems) {
|
|
27
27
|
} else {
|
28
28
|
userItem = {value: ""};
|
29
29
|
}
|
30
|
-
|
30
|
+
let label = userItem.label;
|
31
31
|
if(!label && typeof label !== "string") { // 0, false, null, undefined, NaN
|
32
32
|
userItem.label = userItem.value + "";
|
33
33
|
}
|