@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
@@ -1,5 +1,5 @@
|
|
1
1
|
/** @namespace */
|
2
|
-
|
2
|
+
let Util = {};
|
3
3
|
|
4
4
|
/** This is a shorthand for fetch() API by POST method and with json body <br>
|
5
5
|
* WARNING: fetch is not supported in IE (including IE11)
|
@@ -82,7 +82,7 @@ Util._logError = function(resp) {
|
|
82
82
|
* @return {!Promise<Response>}
|
83
83
|
*/
|
84
84
|
Util._post = function(url, obj, contentType) {
|
85
|
-
|
85
|
+
let options = {
|
86
86
|
method: obj ? "POST" : "GET",
|
87
87
|
headers: { "Content-Type": contentType || "application/json" }
|
88
88
|
};
|
@@ -103,7 +103,7 @@ Util._post = function(url, obj, contentType) {
|
|
103
103
|
* @param {Array.<string>=} limiters Specify property to be extended
|
104
104
|
* @return {Object}
|
105
105
|
*/
|
106
|
-
|
106
|
+
let extendObject = function (obj, extender, limiters) {
|
107
107
|
if(!obj) { // null undefined NaN empty string and 0
|
108
108
|
return null;
|
109
109
|
}
|
@@ -111,10 +111,10 @@ var extendObject = function (obj, extender, limiters) {
|
|
111
111
|
return obj;
|
112
112
|
}
|
113
113
|
|
114
|
-
|
114
|
+
let key;
|
115
115
|
if(limiters) {
|
116
|
-
|
117
|
-
for(
|
116
|
+
let len = limiters.length;
|
117
|
+
for(let i = 0; i < len; ++i) {
|
118
118
|
key = limiters[i];
|
119
119
|
if(key) {
|
120
120
|
extendProperty(obj, extender, key);
|
@@ -135,7 +135,7 @@ var extendObject = function (obj, extender, limiters) {
|
|
135
135
|
* @param {Array.<string>=} limiters
|
136
136
|
* @return {Object}
|
137
137
|
*/
|
138
|
-
|
138
|
+
let cloneObject = function (obj, limiters) {
|
139
139
|
return extendObject({}, obj, limiters);
|
140
140
|
};
|
141
141
|
|
@@ -145,8 +145,8 @@ var cloneObject = function (obj, limiters) {
|
|
145
145
|
* @param {Object} obj
|
146
146
|
* @return {boolean}=true, if the obj is empty
|
147
147
|
*/
|
148
|
-
|
149
|
-
for (
|
148
|
+
let isEmptyObject = function (obj) {
|
149
|
+
for (let key in obj) {
|
150
150
|
return false;
|
151
151
|
}
|
152
152
|
return true;
|
@@ -157,17 +157,17 @@ var isEmptyObject = function (obj) {
|
|
157
157
|
* @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
|
158
158
|
* @return {Object|null}
|
159
159
|
*/
|
160
|
-
|
160
|
+
let arrayToObject = function(data, fields) {
|
161
161
|
if(!Array.isArray(data)) {
|
162
162
|
return data;
|
163
163
|
} else if(!fields) {
|
164
164
|
return null;
|
165
165
|
}
|
166
|
-
|
166
|
+
let ary = data;
|
167
167
|
data = {};
|
168
|
-
|
169
|
-
for(
|
170
|
-
|
168
|
+
let len = ary.length;
|
169
|
+
for(let i = 0; i < len; ++i) {
|
170
|
+
let field = fields[i];
|
171
171
|
// eslint-disable-next-line no-undefined
|
172
172
|
if(field && ary[i] !== undefined) {
|
173
173
|
data[field] = ary[i];
|
@@ -187,10 +187,10 @@ var arrayToObject = function(data, fields) {
|
|
187
187
|
* extendProperty({a: [0]}, {a: 1}, "a"); // {a: [0, 1]}
|
188
188
|
* extendProperty({a: [0]}, {a: [1, 2]}, "a"); // {a: [0, 1, 2]}
|
189
189
|
*/
|
190
|
-
|
191
|
-
|
190
|
+
let extendProperty = function (obj, extender, propName) {
|
191
|
+
let val = extender[propName];
|
192
192
|
if(val != null) {
|
193
|
-
|
193
|
+
let objVal = obj[propName];
|
194
194
|
if(Array.isArray(objVal)) {
|
195
195
|
obj[propName] = objVal.concat(val);
|
196
196
|
} else if(Array.isArray(val) && objVal) {
|
@@ -208,7 +208,7 @@ var extendProperty = function (obj, extender, propName) {
|
|
208
208
|
* @param {*} obj2
|
209
209
|
* @return {boolean}
|
210
210
|
*/
|
211
|
-
|
211
|
+
let deepEqual = function (obj1, obj2) {
|
212
212
|
|
213
213
|
if(obj1 === obj2) {
|
214
214
|
return true;
|
@@ -226,7 +226,7 @@ var deepEqual = function (obj1, obj2) {
|
|
226
226
|
return false;
|
227
227
|
}
|
228
228
|
|
229
|
-
for (
|
229
|
+
for (let i = 0; i < obj1.length; i++) {
|
230
230
|
if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
|
231
231
|
return false;
|
232
232
|
}
|
@@ -238,7 +238,7 @@ var deepEqual = function (obj1, obj2) {
|
|
238
238
|
return false;
|
239
239
|
}
|
240
240
|
|
241
|
-
for (
|
241
|
+
for (let key in obj1) {
|
242
242
|
if (!deepEqual(obj1[key], obj2[key])) {
|
243
243
|
return false;
|
244
244
|
}
|
@@ -262,7 +262,7 @@ var deepEqual = function (obj1, obj2) {
|
|
262
262
|
* @return {Array} Returns the result of the extended array
|
263
263
|
* @see {@link https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki}
|
264
264
|
* @example
|
265
|
-
*
|
265
|
+
* let obj = {};
|
266
266
|
* extendArrayProperty(obj, "prop1", 1); // [1]
|
267
267
|
* extendArrayProperty(obj, "prop1", 2); // [1, 2]
|
268
268
|
* extendArrayProperty(obj, "prop1", [3, 4]); // [1, 2, 3, 4]
|
@@ -271,10 +271,10 @@ var deepEqual = function (obj1, obj2) {
|
|
271
271
|
* extendArrayProperty(obj, "prop2", [7]); // [5, 6, 7]
|
272
272
|
* extendArrayProperty(obj, "prop2", null); // null
|
273
273
|
*/
|
274
|
-
|
275
|
-
|
274
|
+
let extendArrayProperty = function (obj, propName, ary) {
|
275
|
+
let objAry = null;
|
276
276
|
if(ary) {
|
277
|
-
|
277
|
+
let objVal = obj[propName];
|
278
278
|
if(objVal) {
|
279
279
|
if(Array.isArray(objVal)) {
|
280
280
|
objAry = objVal;
|
@@ -305,14 +305,14 @@ var extendArrayProperty = function (obj, propName, ary) {
|
|
305
305
|
* @param {string|Array.<string>} item
|
306
306
|
* @return {string}
|
307
307
|
*/
|
308
|
-
|
308
|
+
let _encloseBracket = function(item) {
|
309
309
|
return Array.isArray(item) ? "{\n" + item.join("\n") + "\n}" : item;
|
310
310
|
};
|
311
311
|
/** @private
|
312
312
|
* @param {string} str
|
313
313
|
* @return {string}
|
314
314
|
*/
|
315
|
-
|
315
|
+
let _indentBracketContent = function(str){
|
316
316
|
return str.replace(/\n+/g, "\n\t").replace(/\n\t}$/, "\n}");
|
317
317
|
};
|
318
318
|
/** @public
|
@@ -328,11 +328,11 @@ var _indentBracketContent = function(str){
|
|
328
328
|
* ]
|
329
329
|
* ]);
|
330
330
|
*/
|
331
|
-
|
331
|
+
let prettifyCss = function(css) {
|
332
332
|
if(css) {
|
333
|
-
|
333
|
+
let cssStr = "";
|
334
334
|
if (Array.isArray(css)) {
|
335
|
-
|
335
|
+
let ary = css.map(_encloseBracket);
|
336
336
|
cssStr = ary.join("\n").replace(/{\s*{/g, "{").replace(/\s+{/g, " {");
|
337
337
|
} else {
|
338
338
|
cssStr = (typeof css === "string") ? css : css + "";
|
@@ -349,9 +349,9 @@ var prettifyCss = function(css) {
|
|
349
349
|
* @param {Element} elem
|
350
350
|
* @return {DocumentFragment}
|
351
351
|
*/
|
352
|
-
|
352
|
+
let getShadowRoot = function(elem) {
|
353
353
|
if(elem) {
|
354
|
-
|
354
|
+
let rootNode;
|
355
355
|
if(elem.shadowRoot) {
|
356
356
|
rootNode = elem.shadowRoot;
|
357
357
|
} else if(elem.getRootNode) {
|
@@ -373,23 +373,23 @@ var getShadowRoot = function(elem) {
|
|
373
373
|
* @param {Element=} targetContext Element that needs the CSS
|
374
374
|
* @return {Element} New style tag
|
375
375
|
*/
|
376
|
-
|
376
|
+
let injectCss = function(cssStr, targetContext) {
|
377
377
|
if(!cssStr) {
|
378
378
|
return null;
|
379
379
|
}
|
380
380
|
|
381
|
-
|
381
|
+
let styleTag = document.createElement("style");
|
382
382
|
styleTag.textContent = "\n" + cssStr + "\n";
|
383
383
|
|
384
|
-
|
385
|
-
|
384
|
+
let styleHost = getShadowRoot(targetContext);
|
385
|
+
let isInShadow = true;
|
386
386
|
if(!styleHost) {
|
387
387
|
isInShadow = false;
|
388
388
|
styleHost = document.head;
|
389
389
|
}
|
390
390
|
|
391
391
|
// Find a place to insert the style tag
|
392
|
-
|
392
|
+
let beforeElem;
|
393
393
|
if(isInShadow) {
|
394
394
|
if(styleHost.children && styleHost.children.length) {
|
395
395
|
beforeElem = styleHost.children[0];
|
@@ -407,8 +407,8 @@ var injectCss = function(cssStr, targetContext) {
|
|
407
407
|
* @public
|
408
408
|
* @return {boolean}
|
409
409
|
*/
|
410
|
-
|
411
|
-
|
410
|
+
let isIE = function () {
|
411
|
+
let ua = window.navigator.userAgent;
|
412
412
|
return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
|
413
413
|
};
|
414
414
|
|
@@ -416,7 +416,7 @@ var isIE = function () {
|
|
416
416
|
* @public
|
417
417
|
* @return {boolean}
|
418
418
|
*/
|
419
|
-
|
419
|
+
let isMac = function () {
|
420
420
|
return /Mac/.test(navigator.platform);
|
421
421
|
};
|
422
422
|
|
@@ -424,7 +424,7 @@ var isMac = function () {
|
|
424
424
|
* @public
|
425
425
|
* @return {boolean}
|
426
426
|
*/
|
427
|
-
|
427
|
+
let isTouchDevice = function () {
|
428
428
|
if ((navigator["maxTouchPoints"] && navigator["maxTouchPoints"] < 256) ||
|
429
429
|
(navigator["msMaxTouchPoints"] && navigator["msMaxTouchPoints"] < 256)) {
|
430
430
|
return true;
|
@@ -438,12 +438,12 @@ var isTouchDevice = function () {
|
|
438
438
|
* @param {Array=} ary
|
439
439
|
* @return {Array}
|
440
440
|
*/
|
441
|
-
|
441
|
+
let nestedObjectToArray = function (obj, ary) {
|
442
442
|
if (!ary) {
|
443
443
|
ary = [];
|
444
444
|
}
|
445
|
-
for (
|
446
|
-
|
445
|
+
for (let key in obj) {
|
446
|
+
let element = obj[key];
|
447
447
|
if ('object' === typeof element) {
|
448
448
|
nestedObjectToArray(element, ary);
|
449
449
|
} else {
|
@@ -467,21 +467,21 @@ var nestedObjectToArray = function (obj, ary) {
|
|
467
467
|
* rgb2Hex("invalid"); // "invalid"
|
468
468
|
* rgb2Hex(null); // ""
|
469
469
|
*/
|
470
|
-
|
470
|
+
let rgb2Hex = function (rgbCode) {
|
471
471
|
if(!rgbCode || typeof rgbCode !== "string") {
|
472
472
|
return "";
|
473
473
|
}
|
474
474
|
if(rgbCode.charAt(0) === "#") {
|
475
475
|
return rgbCode;
|
476
476
|
}
|
477
|
-
|
477
|
+
let rgb = rgbCode.match(/\d+/g);
|
478
478
|
if(!rgb || rgb.length < 3) {
|
479
479
|
return rgbCode;
|
480
480
|
}
|
481
481
|
|
482
|
-
|
483
|
-
for(
|
484
|
-
|
482
|
+
let hex = "#";
|
483
|
+
for(let i = 0; i < 3; i++) {
|
484
|
+
let num = +rgb[i];
|
485
485
|
if(!(num >= 16)) { // Handle NaN case
|
486
486
|
hex += "0";
|
487
487
|
}
|
@@ -495,12 +495,12 @@ var rgb2Hex = function (rgbCode) {
|
|
495
495
|
* @param {*} data
|
496
496
|
* @return {string}
|
497
497
|
*/
|
498
|
-
|
498
|
+
let prepareTSVContent = function (data) {
|
499
499
|
if (data == null) {
|
500
500
|
return "";
|
501
501
|
}
|
502
502
|
|
503
|
-
|
503
|
+
let content = (typeof data === 'string') ? data : data.toString();
|
504
504
|
|
505
505
|
if (!content.length) { return ""; }
|
506
506
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {ADCSubscription} from "./ADCSubscription.js";
|
2
2
|
|
3
3
|
/** @namespace */
|
4
|
-
|
4
|
+
let ADCService = {};
|
5
5
|
|
6
6
|
/** @type {Object}
|
7
7
|
* @private
|
@@ -24,7 +24,7 @@ ADCService._adcUrl = "/datacloud/rest/select";
|
|
24
24
|
* @return {Object}
|
25
25
|
*/
|
26
26
|
ADCService.create = function() {
|
27
|
-
|
27
|
+
let adcSub = ADCService._adcSubscription;
|
28
28
|
if (!adcSub) {
|
29
29
|
if (window["JET"]) { // ADC only need JET
|
30
30
|
adcSub = ADCService._adcSubscription = new ADCSubscription();
|
@@ -5,7 +5,7 @@ import {EventDispatcher} from "../EventDispatcher.js";
|
|
5
5
|
/** @constructor
|
6
6
|
* @extends {EventDispatcher}
|
7
7
|
*/
|
8
|
-
|
8
|
+
let ADCSubscription = function() {
|
9
9
|
this._adcFieldMap = {};
|
10
10
|
this._queue = {};
|
11
11
|
this._onADCUpdate = this._onADCUpdate.bind(this);
|
@@ -107,13 +107,13 @@ ADCSubscription.prototype.addSymbolToField = function (symbol, field) {
|
|
107
107
|
return;
|
108
108
|
}
|
109
109
|
|
110
|
-
|
110
|
+
let fieldMap = this._adcFieldMap[field];
|
111
111
|
if(!fieldMap) {
|
112
112
|
fieldMap = {};
|
113
113
|
this._adcFieldMap[field] = fieldMap;
|
114
114
|
}
|
115
115
|
|
116
|
-
|
116
|
+
let value = fieldMap[symbol];
|
117
117
|
if(value != null) {
|
118
118
|
return value; // eslint-disable-line
|
119
119
|
}
|
@@ -206,7 +206,7 @@ ADCSubscription.prototype._addQueue = function(fields) {
|
|
206
206
|
if(!this._queue) {
|
207
207
|
this._queue = {};
|
208
208
|
}
|
209
|
-
for(
|
209
|
+
for(let i = fields.length; --i >= 0;) {
|
210
210
|
this._queue[fields[i]] = true;
|
211
211
|
}
|
212
212
|
this._timerId = window.setTimeout(this._processQueue, 0);
|
@@ -215,8 +215,8 @@ ADCSubscription.prototype._addQueue = function(fields) {
|
|
215
215
|
* @private
|
216
216
|
*/
|
217
217
|
ADCSubscription.prototype._processQueue = function() {
|
218
|
-
|
219
|
-
for(
|
218
|
+
let fields = Object.keys(/** @type{!Object} */(this._queue));
|
219
|
+
for(let j = fields.length; --j >= 0;) {
|
220
220
|
this._requestDataCloud(fields[j]);
|
221
221
|
}
|
222
222
|
this._queue = {}; // Clear queue
|
@@ -228,8 +228,8 @@ ADCSubscription.prototype._processQueue = function() {
|
|
228
228
|
* @return {Promise}
|
229
229
|
*/
|
230
230
|
ADCSubscription.prototype._requestDataCloud = function(field) {
|
231
|
-
|
232
|
-
|
231
|
+
let RICs = Object.keys(this._adcFieldMap[field]);
|
232
|
+
let payload = "formula=" + field + "&identifiers=" + RICs;
|
233
233
|
if(this._productId) {
|
234
234
|
payload += '&productid=' + this._productId;
|
235
235
|
}
|
@@ -256,7 +256,7 @@ ADCSubscription.prototype._requestDataCloud = function(field) {
|
|
256
256
|
* @return {boolean}
|
257
257
|
*/
|
258
258
|
ADCSubscription.prototype._isValidValueType = function(value) {
|
259
|
-
|
259
|
+
let t = typeof value;
|
260
260
|
return (value === null || t == "string" || t == "number" || t == "boolean");
|
261
261
|
};
|
262
262
|
/** Function for processing the ADC response and publish the event to the listener.
|
@@ -269,13 +269,13 @@ ADCSubscription.prototype._onADCUpdate = function(json) {
|
|
269
269
|
return;
|
270
270
|
}
|
271
271
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
272
|
+
let rows = json["rows"];
|
273
|
+
let reqField = json["requestField"];
|
274
|
+
let header = rows[0];
|
275
|
+
let ricIndex = -1, fieldIndex = -1;
|
276
276
|
|
277
|
-
|
278
|
-
for(
|
277
|
+
let type, field;
|
278
|
+
for(let idx in header) {
|
279
279
|
type = header[idx]["i"];
|
280
280
|
field = header[idx]["r"];
|
281
281
|
if(type === "instrument") {
|
@@ -286,10 +286,10 @@ ADCSubscription.prototype._onADCUpdate = function(json) {
|
|
286
286
|
}
|
287
287
|
}
|
288
288
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
for(
|
289
|
+
let outputHash = {};
|
290
|
+
let rowsLen = rows.length;
|
291
|
+
let symbol, value, rowData;
|
292
|
+
for(let i = 1; i < rowsLen; i++) {
|
293
293
|
symbol = rows[i][ricIndex];
|
294
294
|
value = rows[i][fieldIndex];
|
295
295
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {AdFinSubscription} from "./AdFinSubscription.js";
|
2
2
|
|
3
3
|
/** @namespace */
|
4
|
-
|
4
|
+
let AdFinService = {};
|
5
5
|
|
6
6
|
/** @type {string}
|
7
7
|
* @private
|
@@ -24,7 +24,7 @@ AdFinService._tracsPlugInUrl = null;
|
|
24
24
|
* @return {Object}
|
25
25
|
*/
|
26
26
|
AdFinService.create = function() {
|
27
|
-
|
27
|
+
let adfinSub = AdFinService._adFinSubscription;
|
28
28
|
if (!adfinSub) {
|
29
29
|
adfinSub = new AdFinSubscription();
|
30
30
|
AdFinService._adFinSubscription = adfinSub;
|
@@ -5,7 +5,7 @@ import {EventDispatcher} from "../EventDispatcher.js";
|
|
5
5
|
/** @constructor
|
6
6
|
* @extends {EventDispatcher}
|
7
7
|
*/
|
8
|
-
|
8
|
+
let AdFinSubscription = function() {
|
9
9
|
this._cache = {};
|
10
10
|
this._queue = [];
|
11
11
|
this.onAdFinUpdate = this.onAdFinUpdate.bind(this);
|
@@ -108,16 +108,16 @@ AdFinSubscription.prototype.call = function (name, parameters) {
|
|
108
108
|
throw "Invalid parameters";
|
109
109
|
}
|
110
110
|
|
111
|
-
for(
|
111
|
+
for(let i = 0, length = parameters.length; i < length; ++i) {
|
112
112
|
if(parameters[i][1] === "...") {
|
113
113
|
return "...";
|
114
114
|
}
|
115
115
|
}
|
116
116
|
|
117
|
-
/** @type AdFinSubscription.Request */
|
117
|
+
/** @type AdFinSubscription.Request */let request = {"Function": name, "Parameters": parameters};
|
118
118
|
|
119
|
-
|
120
|
-
|
119
|
+
let signature = JSON.stringify(request);
|
120
|
+
let entry = this._cache[signature];
|
121
121
|
if(entry && (entry.pending === false)) {
|
122
122
|
return entry.value;
|
123
123
|
}
|
@@ -222,8 +222,8 @@ AdFinSubscription.prototype._addQueue = function(requests) {
|
|
222
222
|
* @private
|
223
223
|
*/
|
224
224
|
AdFinSubscription.prototype._processQueue = function() {
|
225
|
-
/** @type {Array.<AdFinSubscription.Request>} */
|
226
|
-
for(
|
225
|
+
/** @type {Array.<AdFinSubscription.Request>} */ let chunckQueue = [];
|
226
|
+
for(let i = 0, length = this._queue.length; i < length; ++i) {
|
227
227
|
chunckQueue.push(this._queue[i]);
|
228
228
|
if(chunckQueue.length === AdFinSubscription._chunckSize) {
|
229
229
|
this._requestAdFin(chunckQueue);
|
@@ -255,7 +255,7 @@ AdFinSubscription.prototype._requestAdFin = function(requests) {
|
|
255
255
|
.then(function(json) {
|
256
256
|
json["signatures"] = [];
|
257
257
|
json["functions"] = [];
|
258
|
-
for(
|
258
|
+
for(let i = 0, length = requests.length; i < length; ++i) {
|
259
259
|
json["signatures"].push(JSON.stringify(requests[i])); // Attach the signature of the requests
|
260
260
|
json["functions"].push(requests[i]["Function"]); // Attach the function of the requests
|
261
261
|
}
|
@@ -271,18 +271,18 @@ AdFinSubscription.prototype._requestAdFin = function(requests) {
|
|
271
271
|
* @param {Object} json JSON object of Adfin response
|
272
272
|
*/
|
273
273
|
AdFinSubscription.prototype.onAdFinUpdate = function(json) {
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
for(
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
274
|
+
let signatures = json["signatures"];
|
275
|
+
let functions = json["functions"];
|
276
|
+
let toDispatch = {};
|
277
|
+
for(let i = 0, length = signatures.length; i < length; ++i) {
|
278
|
+
let value;
|
279
|
+
let signature = signatures[i];
|
280
|
+
let func = functions[i];
|
281
|
+
let entry = json[i];
|
282
282
|
if(!entry) {
|
283
283
|
continue;
|
284
284
|
}
|
285
|
-
for(
|
285
|
+
for(let j = 0, length2 = entry.length; j < length2; ++j) {
|
286
286
|
if((entry[j].length >= 1) && (typeof (entry[j][0]) === "number")) {
|
287
287
|
value = entry[j][0];
|
288
288
|
break;
|
@@ -300,8 +300,8 @@ AdFinSubscription.prototype.onAdFinUpdate = function(json) {
|
|
300
300
|
toDispatch[func] = true;
|
301
301
|
}
|
302
302
|
|
303
|
-
for(
|
304
|
-
|
303
|
+
for(let functionName in toDispatch) {
|
304
|
+
let rowData = {};
|
305
305
|
// rowData[functionName] = value;
|
306
306
|
this._dispatch("dataChanged", { "function": functionName, "values": rowData, "sender": this }); // Publish data
|
307
307
|
}
|