@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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/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-column-grouping/es6/ColumnGrouping.d.ts +3 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +29 -1
- package/lib/tr-grid-util/es6/CellPainter.js +94 -93
- 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 +39 -39
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.js +1 -1
- 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 -57
- 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 -86
- 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 +68 -68
- package/lib/tr-grid-util/es6/NumberFormatter.js +22 -22
- 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 +49 -49
- 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/versions.json +4 -4
- 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,7 +568,7 @@ CellPainter._colorTextCondition = function(field, rowData) {
|
|
|
568
568
|
* @return {undefined|number}
|
|
569
569
|
*/
|
|
570
570
|
CellPainter._tickColorTextCondition = function(field, rowData) {
|
|
571
|
-
|
|
571
|
+
let code = TickCodes[rowData[field]];
|
|
572
572
|
if(code) {
|
|
573
573
|
return code;
|
|
574
574
|
}
|
|
@@ -582,14 +582,14 @@ CellPainter._tickColorTextCondition = function(field, rowData) {
|
|
|
582
582
|
* @return {number}
|
|
583
583
|
*/
|
|
584
584
|
CellPainter._heatMapCondition = function(rowData, min, max) {
|
|
585
|
-
|
|
586
|
-
|
|
585
|
+
let value = rowData[this["field"]];
|
|
586
|
+
let diff = (value || value === 0) ? value - this["midPoint"] : NaN;
|
|
587
587
|
if (diff === 0 || diff !== diff) {
|
|
588
588
|
return 0;
|
|
589
589
|
}
|
|
590
590
|
|
|
591
|
-
|
|
592
|
-
|
|
591
|
+
let ratio;
|
|
592
|
+
let range = 1;
|
|
593
593
|
if(diff > 0) {
|
|
594
594
|
range = max - this["midPoint"];
|
|
595
595
|
if(range < 0) {
|
|
@@ -613,7 +613,7 @@ CellPainter._heatMapCondition = function(rowData, min, max) {
|
|
|
613
613
|
* @return {undefined|number}
|
|
614
614
|
*/
|
|
615
615
|
CellPainter._tickBlinkCondition = function(newValue) {
|
|
616
|
-
|
|
616
|
+
let code = TickCodes[newValue];
|
|
617
617
|
if(code) {
|
|
618
618
|
return code;
|
|
619
619
|
}
|
|
@@ -639,8 +639,8 @@ CellPainter._fieldBlinkCondition = function(newValue, oldValue) {
|
|
|
639
639
|
*/
|
|
640
640
|
CellPainter._borderRestorer = function(scope) {
|
|
641
641
|
scope["blinkTimer"] = 0;
|
|
642
|
-
|
|
643
|
-
|
|
642
|
+
let cell = scope["cell"];
|
|
643
|
+
let elem = cell.getElement();
|
|
644
644
|
|
|
645
645
|
if(elem) {
|
|
646
646
|
elem.style.border = "";
|
|
@@ -651,23 +651,23 @@ CellPainter._borderRestorer = function(scope) {
|
|
|
651
651
|
*/
|
|
652
652
|
CellPainter._cellRestorer = function(scope) {
|
|
653
653
|
scope["blinkTimer"] = 0;
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
let cell = scope["cell"];
|
|
655
|
+
let elem = cell.getElement();
|
|
656
656
|
|
|
657
657
|
if(elem) {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
658
|
+
let rowData = scope["rowData"];
|
|
659
|
+
let min = NaN;
|
|
660
|
+
let max = NaN;
|
|
661
661
|
if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) {
|
|
662
|
-
|
|
662
|
+
let columnStats = this._columnStats;
|
|
663
663
|
if(columnStats) {
|
|
664
664
|
min = columnStats.getMin();
|
|
665
665
|
max = columnStats.getMax();
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
|
|
669
|
-
|
|
670
|
-
|
|
669
|
+
let styles = this._getStyles(rowData, min, max);
|
|
670
|
+
let cssClass = styles["cssClass"]; // Can be an empty string
|
|
671
671
|
if (cssClass != null) { // Predefined colors mode
|
|
672
672
|
if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
|
|
673
673
|
elem.classList.remove(elem._coloringCssClass);
|
|
@@ -703,18 +703,19 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
|
|
|
703
703
|
return CellPainter._emptyObj;
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
|
|
707
|
-
for(
|
|
708
|
-
|
|
709
|
-
|
|
706
|
+
let len = this._conditions.length;
|
|
707
|
+
for(let i = 0; i < len; ++i) {
|
|
708
|
+
let curCond = this._conditions[i];
|
|
709
|
+
let fn = curCond._fn;
|
|
710
|
+
let ret;
|
|
710
711
|
try { // WARNING: Try/Catch is very slow. TODO: The function should be checked for validity beforehand
|
|
711
|
-
|
|
712
|
+
ret = fn && fn(rowData, min, max);
|
|
712
713
|
} catch (err){
|
|
713
714
|
// console.error(err.message); // This will produce tons of errors in the console
|
|
714
715
|
}
|
|
715
716
|
if (ret) { // Match condition with results 1, -1, true, or string
|
|
716
717
|
if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) {
|
|
717
|
-
|
|
718
|
+
let blendedColor;
|
|
718
719
|
if(ret > 0) {
|
|
719
720
|
blendedColor = CellPainter.blendColor(curCond["baseColor"], curCond["upColor"], ret);
|
|
720
721
|
} else {
|
|
@@ -770,11 +771,11 @@ CellPainter.blendColor = function (baseColor, maxColor, ratio) { // TODO: Optimi
|
|
|
770
771
|
ratio = 0;
|
|
771
772
|
}
|
|
772
773
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
for (
|
|
777
|
-
|
|
774
|
+
let baseColorTriplet = CellPainter.hex2Num(baseColor);
|
|
775
|
+
let maxColorTriplet = CellPainter.hex2Num(maxColor);
|
|
776
|
+
let blendResult = [];
|
|
777
|
+
for (let i = 0; i < 3; ++i) {
|
|
778
|
+
let gap = (maxColorTriplet[i] - baseColorTriplet[i]) * ratio;
|
|
778
779
|
blendResult.push(baseColorTriplet[i] + gap);
|
|
779
780
|
}
|
|
780
781
|
|
|
@@ -786,7 +787,7 @@ CellPainter.blendColor = function (baseColor, maxColor, ratio) { // TODO: Optimi
|
|
|
786
787
|
* @return {string} resultColor
|
|
787
788
|
*/
|
|
788
789
|
CellPainter.blackAndWhite = function (triplet) {
|
|
789
|
-
|
|
790
|
+
let brightness = Math.sqrt(triplet[0] * triplet[0] * 0.241 + triplet[1] * triplet[1] * 0.691 + triplet[2] * triplet[2] * 0.068);
|
|
790
791
|
|
|
791
792
|
if (brightness >= 135) { // Brighter color has more impact to human eye than the darker color
|
|
792
793
|
return '#000000';
|
|
@@ -807,7 +808,7 @@ CellPainter.rgb2Hex = rgb2Hex; // For backward compatability
|
|
|
807
808
|
* @return {string} resultColor
|
|
808
809
|
*/
|
|
809
810
|
CellPainter.num2Hex = function (triplet) {
|
|
810
|
-
|
|
811
|
+
let rgb = triplet[2] | (triplet[1] << 8) | (triplet[0] << 16);
|
|
811
812
|
return ('#' + (0x1000000 + rgb).toString(16).slice(1));
|
|
812
813
|
};
|
|
813
814
|
/** Note that Chrome, IE, and Firefox store color in rgb representation.
|
|
@@ -825,10 +826,10 @@ CellPainter.num2Rgb = function (triplet) {
|
|
|
825
826
|
* @return {Array.<number>} array of size 3 which contains [red, green, blue]
|
|
826
827
|
*/
|
|
827
828
|
CellPainter.hex2Num = function (hex) {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
829
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ''), 16);
|
|
830
|
+
let r = (hexInt >> 16) & 255;
|
|
831
|
+
let g = (hexInt >> 8) & 255;
|
|
832
|
+
let b = hexInt & 255;
|
|
832
833
|
return [r, g, b];
|
|
833
834
|
};
|
|
834
835
|
/** @public
|
|
@@ -838,10 +839,10 @@ CellPainter.hex2Num = function (hex) {
|
|
|
838
839
|
*/
|
|
839
840
|
CellPainter.hex2Rgb = function (hex) {
|
|
840
841
|
if(hex) {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
842
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ''), 16);
|
|
843
|
+
let r = (hexInt >> 16) & 255;
|
|
844
|
+
let g = (hexInt >> 8) & 255;
|
|
845
|
+
let b = hexInt & 255;
|
|
845
846
|
return 'rgb(' + r + ', ' + g + ', ' + b + ')';
|
|
846
847
|
}
|
|
847
848
|
return '';
|
|
@@ -862,8 +863,8 @@ CellPainter.setThemeColors = function() {};
|
|
|
862
863
|
*/
|
|
863
864
|
CellPainter._onThemeChanged = function() {
|
|
864
865
|
// Apply newly changed theme to all the painters
|
|
865
|
-
|
|
866
|
-
for(
|
|
866
|
+
let painters = CellPainter._painters;
|
|
867
|
+
for(let i = painters.length; --i >= 0;) {
|
|
867
868
|
painters[i].applyThemeColor(); // Re-apply theme color
|
|
868
869
|
}
|
|
869
870
|
};
|
|
@@ -900,12 +901,12 @@ CellPainter.reloadThemeColors = function () {
|
|
|
900
901
|
* @param {Object=} styles
|
|
901
902
|
*/
|
|
902
903
|
CellPainter.clearCellStyle = function(cell, styles) {
|
|
903
|
-
|
|
904
|
+
let elem = cell.getElement();
|
|
904
905
|
if(!elem) {
|
|
905
906
|
return; // Cell has been disposed
|
|
906
907
|
}
|
|
907
908
|
|
|
908
|
-
|
|
909
|
+
let scope = cell["blinking"];
|
|
909
910
|
if(scope) { // Clear blinking scope
|
|
910
911
|
CellPainter._clearBlinkTimer(scope);
|
|
911
912
|
|
|
@@ -923,11 +924,11 @@ CellPainter.clearCellStyle = function(cell, styles) {
|
|
|
923
924
|
styles = CellPainter.supportedStyles;
|
|
924
925
|
}
|
|
925
926
|
if(Array.isArray(styles)){
|
|
926
|
-
for(
|
|
927
|
+
for(let i = styles.length; --i >= 0;) {
|
|
927
928
|
elem.style[styles[i]] = ""; // WARNING: Very slow
|
|
928
929
|
}
|
|
929
930
|
} else {
|
|
930
|
-
for(
|
|
931
|
+
for(let key in styles) {
|
|
931
932
|
elem.style[key] = ""; // WARNING: Very slow
|
|
932
933
|
}
|
|
933
934
|
}
|
|
@@ -984,7 +985,7 @@ CellPainter._clearBlinkTimer = function(scp, opt_restoreColor) {
|
|
|
984
985
|
CellPainter.getOppositeColor = function (hexCode) {
|
|
985
986
|
if(typeof hexCode === "string") {
|
|
986
987
|
if(hexCode.charAt(0) === "#") {
|
|
987
|
-
|
|
988
|
+
let triplet = CellPainter.hex2Num(hexCode);
|
|
988
989
|
return CellPainter.blackAndWhite(triplet);
|
|
989
990
|
}
|
|
990
991
|
} else if(Array.isArray(hexCode)) {
|
|
@@ -1038,11 +1039,11 @@ CellPainter.prototype.renderColoring = function (cell, rowData) {
|
|
|
1038
1039
|
*/
|
|
1039
1040
|
CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
|
|
1040
1041
|
if (!cell) return;
|
|
1041
|
-
|
|
1042
|
+
let elem = cell.getElement();
|
|
1042
1043
|
if (!elem) return; // Cell has been disposed
|
|
1043
1044
|
|
|
1044
|
-
|
|
1045
|
-
|
|
1045
|
+
let bc = this._blinkCondition;
|
|
1046
|
+
let scope;
|
|
1046
1047
|
if (bc) {
|
|
1047
1048
|
scope = cell["blinking"];
|
|
1048
1049
|
if (scope && scope["blinkTimer"] && !bc["border"]) { // The cell is blinking
|
|
@@ -1050,11 +1051,11 @@ CellPainter.prototype._paintCell = function(cell, rowData, min, max) {
|
|
|
1050
1051
|
}
|
|
1051
1052
|
}
|
|
1052
1053
|
|
|
1053
|
-
|
|
1054
|
+
let styles = this._getStyles(rowData, min, max);
|
|
1054
1055
|
|
|
1055
|
-
|
|
1056
|
+
let elStyle = elem.style;
|
|
1056
1057
|
|
|
1057
|
-
|
|
1058
|
+
let cssClass = styles["cssClass"]; // Can be an empty string
|
|
1058
1059
|
if (elem._coloringCssClass && elem._coloringCssClass !== cssClass) {
|
|
1059
1060
|
elem.classList.remove(elem._coloringCssClass);
|
|
1060
1061
|
elem._coloringCssClass = null;
|
|
@@ -1097,10 +1098,10 @@ CellPainter.prototype.blink = function (cell, blinkSignal, rowData) {
|
|
|
1097
1098
|
* @return {boolean}
|
|
1098
1099
|
*/
|
|
1099
1100
|
CellPainter.prototype.blinkCell = function(cell, newValue, oldValue, rowData) {
|
|
1100
|
-
|
|
1101
|
+
let bc = this._blinkCondition;
|
|
1101
1102
|
if (!bc) return false;
|
|
1102
1103
|
|
|
1103
|
-
|
|
1104
|
+
let blinkSignal = this._blinkCondition._fn(newValue, oldValue);
|
|
1104
1105
|
return this._blinkCell(cell, rowData, blinkSignal);
|
|
1105
1106
|
};
|
|
1106
1107
|
|
|
@@ -1119,13 +1120,13 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
|
1119
1120
|
}
|
|
1120
1121
|
}
|
|
1121
1122
|
|
|
1122
|
-
|
|
1123
|
+
let elem = cell.getElement();
|
|
1123
1124
|
if (!elem) return false; // Cell has been disposed
|
|
1124
1125
|
|
|
1125
|
-
|
|
1126
|
+
let bc = this._blinkCondition;
|
|
1126
1127
|
if (!bc) return false;
|
|
1127
1128
|
|
|
1128
|
-
|
|
1129
|
+
let scope = cell["blinking"];
|
|
1129
1130
|
if (!scope) {
|
|
1130
1131
|
scope = {};
|
|
1131
1132
|
scope["cell"] = cell;
|
|
@@ -1137,13 +1138,13 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
|
1137
1138
|
if (scope["blinkId"] !== bc["blinkId"]) {
|
|
1138
1139
|
scope["blinkId"] = bc["blinkId"];
|
|
1139
1140
|
scope["field"] = bc["field"];
|
|
1140
|
-
|
|
1141
|
+
let restorer = bc["border"] ? CellPainter._borderRestorer : CellPainter._cellRestorer;
|
|
1141
1142
|
scope._restorer = restorer.bind(this, scope);
|
|
1142
1143
|
}
|
|
1143
1144
|
|
|
1144
1145
|
scope["rowData"] = rowData;
|
|
1145
1146
|
|
|
1146
|
-
|
|
1147
|
+
let blinkColor, contrastColor;
|
|
1147
1148
|
if (blinkSignal > 0) {
|
|
1148
1149
|
blinkColor = bc["upColor"];
|
|
1149
1150
|
contrastColor = bc["contrastUpColor"];
|
|
@@ -1155,7 +1156,7 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
|
1155
1156
|
contrastColor = bc["contrastLevelColor"];
|
|
1156
1157
|
}
|
|
1157
1158
|
|
|
1158
|
-
|
|
1159
|
+
let bgBlinking = true;
|
|
1159
1160
|
// All conditions are met for blinking
|
|
1160
1161
|
if (bc["border"]) {
|
|
1161
1162
|
elem.style.border = "1px solid " + blinkColor;
|
|
@@ -1177,7 +1178,7 @@ CellPainter.prototype._blinkCell = function(cell, rowData, blinkSignal) {
|
|
|
1177
1178
|
* @param {Object} rowData
|
|
1178
1179
|
*/
|
|
1179
1180
|
CellPainter.prototype.verifyBlinking = function(cell, rowData) {
|
|
1180
|
-
|
|
1181
|
+
let scope = cell["blinking"];
|
|
1181
1182
|
if (scope && scope["blinkTimer"]) {
|
|
1182
1183
|
if (scope["rowData"] !== rowData) {
|
|
1183
1184
|
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
|
}
|