@refinitiv-ui/efx-grid 6.0.101 → 6.0.103
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/core/dist/core.js +289 -532
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataCache.d.ts +0 -12
- package/lib/core/es6/data/DataCache.js +11 -371
- package/lib/core/es6/data/WrappedView.d.ts +1 -0
- package/lib/core/es6/data/WrappedView.js +1 -0
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.d.ts +1 -0
- package/lib/core/es6/grid/LayoutGrid.js +25 -2
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +1 -0
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +24 -104
- package/lib/core/es6/grid/util/CellBoundPainter.d.ts +16 -0
- package/lib/core/es6/grid/util/CellBoundPainter.js +171 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +30 -21
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +1 -1
- package/lib/rt-grid/es6/FieldDefinition.js +21 -21
- package/lib/rt-grid/es6/RowDefinition.js +9 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +22 -8
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +8 -0
- package/lib/types/es6/Core/data/DataCache.d.ts +0 -12
- package/lib/types/es6/Core/data/WrappedView.d.ts +1 -0
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +1 -0
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +1 -0
- package/lib/types/es6/Core/grid/util/CellBoundPainter.d.ts +16 -0
- package/lib/versions.json +2 -2
- package/package.json +1 -1
package/lib/core/dist/core.js
CHANGED
@@ -7666,6 +7666,179 @@ HScrollbar._proto = HScrollbar.prototype;
|
|
7666
7666
|
/* harmony default export */ const components_HScrollbar = (HScrollbar);
|
7667
7667
|
|
7668
7668
|
|
7669
|
+
;// CONCATENATED MODULE: ./src/js/grid/util/CellBoundPainter.js
|
7670
|
+
/** @private
|
7671
|
+
* @function
|
7672
|
+
* @param {number} idx
|
7673
|
+
* @param {number} limit
|
7674
|
+
* @return {number}
|
7675
|
+
*/
|
7676
|
+
let _validateIndex = function(idx, limit) {
|
7677
|
+
if(idx > limit) {
|
7678
|
+
return limit;
|
7679
|
+
} else if(idx < 0) {
|
7680
|
+
return 0;
|
7681
|
+
}
|
7682
|
+
return idx;
|
7683
|
+
};
|
7684
|
+
|
7685
|
+
/** @constructor
|
7686
|
+
* @param {Object} ctx
|
7687
|
+
*/
|
7688
|
+
let CellBoundPainter = function (ctx) {
|
7689
|
+
this._boundLayer = ctx.boundLayer;
|
7690
|
+
this._layoutX = ctx.layoutX;
|
7691
|
+
this._layoutY = ctx.layoutY;
|
7692
|
+
this._hscrollbar = ctx.hscrollbar;
|
7693
|
+
this._calculateColumnBounds = ctx.calculateColumnBounds;
|
7694
|
+
};
|
7695
|
+
|
7696
|
+
/** @type {Element}
|
7697
|
+
* @private
|
7698
|
+
*/
|
7699
|
+
CellBoundPainter.prototype._boundLayer = null;
|
7700
|
+
/** @type {!TrackLayout}
|
7701
|
+
* @private
|
7702
|
+
*/
|
7703
|
+
CellBoundPainter.prototype._layoutX;
|
7704
|
+
/** @type {!TrackLayout}
|
7705
|
+
* @private
|
7706
|
+
*/
|
7707
|
+
CellBoundPainter.prototype._layoutY;
|
7708
|
+
/** @type {HScrollbar}
|
7709
|
+
* @private
|
7710
|
+
*/
|
7711
|
+
CellBoundPainter.prototype._hscrollbar;
|
7712
|
+
/** @type {Function}
|
7713
|
+
* @private
|
7714
|
+
*/
|
7715
|
+
CellBoundPainter.prototype._calculateColumnBounds;
|
7716
|
+
/** @type {Element}
|
7717
|
+
* @private
|
7718
|
+
*/
|
7719
|
+
CellBoundPainter.prototype._cellBound = null;
|
7720
|
+
/** @type {number}
|
7721
|
+
* @private
|
7722
|
+
*/
|
7723
|
+
CellBoundPainter.prototype._cbLftIdx = 0;
|
7724
|
+
/** @type {number}
|
7725
|
+
* @private
|
7726
|
+
*/
|
7727
|
+
CellBoundPainter.prototype._cbRgtIdx = 0;
|
7728
|
+
/** @type {number}
|
7729
|
+
* @private
|
7730
|
+
*/
|
7731
|
+
CellBoundPainter.prototype._cbTopIdx = 0;
|
7732
|
+
/** @type {number}
|
7733
|
+
* @private
|
7734
|
+
*/
|
7735
|
+
CellBoundPainter.prototype._cbBtmIdx = 0;
|
7736
|
+
|
7737
|
+
/** @public
|
7738
|
+
*/
|
7739
|
+
CellBoundPainter.prototype.dispose = function () {
|
7740
|
+
let cellBound = this._cellBound;
|
7741
|
+
if(cellBound) {
|
7742
|
+
let pn = cellBound.parentNode;
|
7743
|
+
if(pn) {
|
7744
|
+
pn.removeChild(cellBound);
|
7745
|
+
}
|
7746
|
+
this._cellBound = null;
|
7747
|
+
}
|
7748
|
+
this._boundLayer = null;
|
7749
|
+
this._layoutX = null;
|
7750
|
+
this._layoutY = null;
|
7751
|
+
this._hscrollbar = null;
|
7752
|
+
this._calculateColumnBounds = null;
|
7753
|
+
};
|
7754
|
+
|
7755
|
+
/** @public
|
7756
|
+
* @param {number} colIndex
|
7757
|
+
* @param {number} rowIndex
|
7758
|
+
* @param {number} width
|
7759
|
+
* @param {number} height
|
7760
|
+
* @param {number} colCount
|
7761
|
+
*/
|
7762
|
+
CellBoundPainter.prototype.setCellBounds = function (colIndex, rowIndex, width, height, colCount) {
|
7763
|
+
let cellBound = this._cellBound;
|
7764
|
+
if(!cellBound) {
|
7765
|
+
cellBound = this._cellBound = document.createElement("div");
|
7766
|
+
cellBound.className = "selection-bound";
|
7767
|
+
}
|
7768
|
+
|
7769
|
+
// Validate inputs
|
7770
|
+
let rgtIndex = colIndex + width; // Exclusive
|
7771
|
+
let btmIndex = rowIndex + height; // Exclusive
|
7772
|
+
|
7773
|
+
let rowCount = this._layoutY.getLaneCount();
|
7774
|
+
|
7775
|
+
this._cbLftIdx = _validateIndex(colIndex, colCount);
|
7776
|
+
this._cbRgtIdx = _validateIndex(rgtIndex, colCount);
|
7777
|
+
this._cbTopIdx = _validateIndex(rowIndex, rowCount);
|
7778
|
+
this._cbBtmIdx = _validateIndex(btmIndex, rowCount);
|
7779
|
+
|
7780
|
+
this.updateCellBounds();
|
7781
|
+
};
|
7782
|
+
|
7783
|
+
/** @public
|
7784
|
+
*/
|
7785
|
+
CellBoundPainter.prototype.updateCellBounds = function() {
|
7786
|
+
let cellBound = this._cellBound;
|
7787
|
+
if(!cellBound) {
|
7788
|
+
return;
|
7789
|
+
}
|
7790
|
+
|
7791
|
+
let layoutX = this._layoutX;
|
7792
|
+
let layoutY = this._layoutY;
|
7793
|
+
let lftIdx = this._cbLftIdx;
|
7794
|
+
let rgtIdx = this._cbRgtIdx; // Exclusive
|
7795
|
+
let topIdx = this._cbTopIdx;
|
7796
|
+
let btmIdx = this._cbBtmIdx; // Exclusive
|
7797
|
+
let lftPx, rgtPx, topPx, btmPx;
|
7798
|
+
lftPx = rgtPx = topPx = btmPx = 0;
|
7799
|
+
if(lftIdx < rgtIdx && topIdx < btmIdx) {
|
7800
|
+
lftPx = layoutX.getLaneStart(lftIdx);
|
7801
|
+
rgtPx = layoutX.getLaneEnd(rgtIdx - 1);
|
7802
|
+
topPx = layoutY.getLaneStart(topIdx);
|
7803
|
+
btmPx = layoutY.getLaneEnd(btmIdx - 1);
|
7804
|
+
}
|
7805
|
+
|
7806
|
+
let width = rgtPx - lftPx;
|
7807
|
+
let height = btmPx - topPx;
|
7808
|
+
let noBorders = [false, false];
|
7809
|
+
if(width > 0 && height > 0 && this._hscrollbar) {
|
7810
|
+
let positions = [0, 0];
|
7811
|
+
this._calculateColumnBounds(lftIdx, rgtIdx - 1, positions, noBorders);
|
7812
|
+
lftPx = positions[0];
|
7813
|
+
rgtPx = positions[1];
|
7814
|
+
width = rgtPx - lftPx;
|
7815
|
+
}
|
7816
|
+
|
7817
|
+
if(width > 0) {
|
7818
|
+
cellBound.style.left = lftPx + "px";
|
7819
|
+
cellBound.style.top = topPx + "px";
|
7820
|
+
cellBound.style.width = width + "px";
|
7821
|
+
cellBound.style.height = height + "px";
|
7822
|
+
|
7823
|
+
cellBound.classList.toggle("no-left-bound", noBorders[0]);
|
7824
|
+
cellBound.classList.toggle("no-right-bound", noBorders[1]);
|
7825
|
+
|
7826
|
+
if(this._boundLayer) {
|
7827
|
+
this._boundLayer.appendChild(cellBound);
|
7828
|
+
}
|
7829
|
+
} else {
|
7830
|
+
let pn = cellBound.parentNode;
|
7831
|
+
if(pn) {
|
7832
|
+
pn.removeChild(cellBound);
|
7833
|
+
}
|
7834
|
+
}
|
7835
|
+
};
|
7836
|
+
|
7837
|
+
CellBoundPainter._proto = CellBoundPainter.prototype;
|
7838
|
+
|
7839
|
+
/* harmony default export */ const util_CellBoundPainter = (CellBoundPainter);
|
7840
|
+
|
7841
|
+
|
7669
7842
|
;// CONCATENATED MODULE: ./src/js/grid/LayoutGrid.js
|
7670
7843
|
/* eslint-disable */
|
7671
7844
|
|
@@ -7681,6 +7854,7 @@ HScrollbar._proto = HScrollbar.prototype;
|
|
7681
7854
|
|
7682
7855
|
|
7683
7856
|
|
7857
|
+
|
7684
7858
|
/* eslint-enable */
|
7685
7859
|
|
7686
7860
|
//#region Events
|
@@ -7946,7 +8120,10 @@ LayoutGrid.prototype._leftColumnSeparator = null;
|
|
7946
8120
|
* @private
|
7947
8121
|
*/
|
7948
8122
|
LayoutGrid.prototype._rightColumnSeparator = null;
|
7949
|
-
|
8123
|
+
/** @type {Element}
|
8124
|
+
* @private
|
8125
|
+
*/
|
8126
|
+
LayoutGrid.prototype._cellBoundPainter = null;
|
7950
8127
|
/**
|
7951
8128
|
* {@link ElementWrapper#dispose}
|
7952
8129
|
* @override
|
@@ -7971,6 +8148,10 @@ LayoutGrid.prototype.dispose = function () {
|
|
7971
8148
|
this._ctx = null;
|
7972
8149
|
this._hscrollbar = null;
|
7973
8150
|
|
8151
|
+
if(this._cellBoundPainter) {
|
8152
|
+
this._cellBoundPainter.dispose();
|
8153
|
+
}
|
8154
|
+
|
7974
8155
|
this._dispose();
|
7975
8156
|
};
|
7976
8157
|
/**
|
@@ -9941,7 +10122,22 @@ LayoutGrid.prototype.selectCell = function (colIndex, rowIndex, selected) {
|
|
9941
10122
|
* @param {number} width
|
9942
10123
|
* @param {number} height
|
9943
10124
|
*/
|
9944
|
-
LayoutGrid.prototype.setCellBounds = function (colIndex, rowIndex, width, height) {
|
10125
|
+
LayoutGrid.prototype.setCellBounds = function (colIndex, rowIndex, width, height) {
|
10126
|
+
let boundLayer = this._initBoundLayer();
|
10127
|
+
let cellBoundPainter = this._cellBoundPainter;
|
10128
|
+
if(!cellBoundPainter) {
|
10129
|
+
cellBoundPainter = this._cellBoundPainter = new util_CellBoundPainter({
|
10130
|
+
boundLayer: boundLayer,
|
10131
|
+
layoutX: this._trackX,
|
10132
|
+
layoutY: this._trackY,
|
10133
|
+
hscrollbar: this._hscrollbar,
|
10134
|
+
calculateColumnBounds: this.calculateColumnBounds.bind(this)
|
10135
|
+
});
|
10136
|
+
}
|
10137
|
+
|
10138
|
+
let colCount = this.getColumnCount();
|
10139
|
+
cellBoundPainter.setCellBounds(colIndex, rowIndex, width, height, colCount);
|
10140
|
+
};
|
9945
10141
|
/** @public
|
9946
10142
|
* @ignore
|
9947
10143
|
* @return {!TrackLayout}
|
@@ -11811,7 +12007,7 @@ GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
|
|
11811
12007
|
* @constructor
|
11812
12008
|
* @extends {EventDispatcher}
|
11813
12009
|
*/
|
11814
|
-
let
|
12010
|
+
let DataCache = function () {
|
11815
12011
|
let _t = this;
|
11816
12012
|
|
11817
12013
|
_t._rows = {};
|
@@ -11820,9 +12016,6 @@ let DataCache_DataCache = function () {
|
|
11820
12016
|
_t._onInsert = _t._onInsert.bind(_t);
|
11821
12017
|
_t._onUpdate = _t._onUpdate.bind(_t);
|
11822
12018
|
_t._onDelete = _t._onDelete.bind(_t);
|
11823
|
-
_t._onBatchRequestADCData = _t._onBatchRequestADCData.bind(_t);
|
11824
|
-
_t._onADCUpdate = _t._onADCUpdate.bind(_t);
|
11825
|
-
_t._onADCError = _t._onADCError.bind(_t);
|
11826
12019
|
_t._onQ2DataChanged = _t._onQ2DataChanged.bind(_t);
|
11827
12020
|
_t._onQ2SubAdded = _t._onQ2SubAdded.bind(_t);
|
11828
12021
|
_t._onQ2SubRemoved = _t._onQ2SubRemoved.bind(_t);
|
@@ -11830,13 +12023,13 @@ let DataCache_DataCache = function () {
|
|
11830
12023
|
_t._addEvent("dataComposed");
|
11831
12024
|
_t._addEvent("dataChanged");
|
11832
12025
|
};
|
11833
|
-
es6_Ext.inherits(
|
12026
|
+
es6_Ext.inherits(DataCache, event_EventDispatcher);
|
11834
12027
|
|
11835
12028
|
//#region Public
|
11836
12029
|
/**
|
11837
12030
|
* @public
|
11838
12031
|
*/
|
11839
|
-
|
12032
|
+
DataCache.prototype.dispose = function () {
|
11840
12033
|
this.unlistenAll();
|
11841
12034
|
this.clearAllData(true);
|
11842
12035
|
this._quotes2 = null;
|
@@ -11847,7 +12040,7 @@ DataCache_DataCache.prototype.dispose = function () {
|
|
11847
12040
|
* @public
|
11848
12041
|
* @param {Object} subs Subscriptions object from JET.Quotes2
|
11849
12042
|
*/
|
11850
|
-
|
12043
|
+
DataCache.prototype.setSubscriptions = function (subs) {
|
11851
12044
|
if (this._quotes2) {
|
11852
12045
|
this._quotes2["removeEventListener"]("dataChanged", this._onQ2DataChanged);
|
11853
12046
|
this._quotes2["removeEventListener"]("subscriptionAdded", this._onQ2SubAdded);
|
@@ -11869,7 +12062,7 @@ DataCache_DataCache.prototype.setSubscriptions = function (subs) {
|
|
11869
12062
|
* @public
|
11870
12063
|
* @return {Object} subs Subscriptions object from JET.Quotes2
|
11871
12064
|
*/
|
11872
|
-
|
12065
|
+
DataCache.prototype.getSubscriptions = function () {
|
11873
12066
|
return this._quotes2;
|
11874
12067
|
};
|
11875
12068
|
|
@@ -11881,7 +12074,7 @@ DataCache_DataCache.prototype.getSubscriptions = function () {
|
|
11881
12074
|
* object does not provide a way to access its data
|
11882
12075
|
* @param {Object=} opt_values Initial values
|
11883
12076
|
*/
|
11884
|
-
|
12077
|
+
DataCache.prototype.addSubscription = function (sub, opt_primaryRic, opt_values) {
|
11885
12078
|
if (this.getSubscription(sub["id"])) {
|
11886
12079
|
return;
|
11887
12080
|
}
|
@@ -11912,7 +12105,7 @@ DataCache_DataCache.prototype.addSubscription = function (sub, opt_primaryRic, o
|
|
11912
12105
|
* @public
|
11913
12106
|
* @param {Object} sub Subscription object from JET.Quote
|
11914
12107
|
*/
|
11915
|
-
|
12108
|
+
DataCache.prototype.removeSubscription = function (sub) { // All RICs associated to the subscription are removed
|
11916
12109
|
let subId = sub["id"];
|
11917
12110
|
|
11918
12111
|
if (!sub || !this._subs[subId]) {
|
@@ -11936,7 +12129,7 @@ DataCache_DataCache.prototype.removeSubscription = function (sub) { // All RICs
|
|
11936
12129
|
* Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
11937
12130
|
* @public
|
11938
12131
|
*/
|
11939
|
-
|
12132
|
+
DataCache.prototype.startAllSubscriptions = function () {
|
11940
12133
|
if (this._quotes2) {
|
11941
12134
|
this._quotes2["start"]();
|
11942
12135
|
} else {
|
@@ -11950,7 +12143,7 @@ DataCache_DataCache.prototype.startAllSubscriptions = function () {
|
|
11950
12143
|
* Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
11951
12144
|
* @public
|
11952
12145
|
*/
|
11953
|
-
|
12146
|
+
DataCache.prototype.stopAllSubscriptions = function () {
|
11954
12147
|
if (this._quotes2) {
|
11955
12148
|
this._quotes2["stop"]();
|
11956
12149
|
} else {
|
@@ -11965,7 +12158,7 @@ DataCache_DataCache.prototype.stopAllSubscriptions = function () {
|
|
11965
12158
|
* @param {string} sub_id
|
11966
12159
|
* @return {Object} Subscription object from JET.Quote
|
11967
12160
|
*/
|
11968
|
-
|
12161
|
+
DataCache.prototype.getSubscription = function (sub_id) {
|
11969
12162
|
return (this._subs[sub_id]) ? this._subs[sub_id]["s"] : null;
|
11970
12163
|
};
|
11971
12164
|
|
@@ -11974,7 +12167,7 @@ DataCache_DataCache.prototype.getSubscription = function (sub_id) {
|
|
11974
12167
|
* @param {string} sub_id
|
11975
12168
|
* @return {string} ric that has been input when calling addSubscription
|
11976
12169
|
*/
|
11977
|
-
|
12170
|
+
DataCache.prototype.getPrimaryRic = function (sub_id) {
|
11978
12171
|
let subDef = this._subs[sub_id];
|
11979
12172
|
if (subDef) {
|
11980
12173
|
return subDef["primary"];
|
@@ -11987,7 +12180,7 @@ DataCache_DataCache.prototype.getPrimaryRic = function (sub_id) {
|
|
11987
12180
|
* @param {boolean=} opt_suppressEvent
|
11988
12181
|
* @fires DataCache#dataChanged
|
11989
12182
|
*/
|
11990
|
-
|
12183
|
+
DataCache.prototype.clearAllData = function (opt_suppressEvent) { // All subscriptions are also removed
|
11991
12184
|
if (this._quotes2) {
|
11992
12185
|
this._quotes2["removeAllSubscriptions"]();
|
11993
12186
|
} else {
|
@@ -11997,13 +12190,6 @@ DataCache_DataCache.prototype.clearAllData = function (opt_suppressEvent) { // A
|
|
11997
12190
|
this._subs = {};
|
11998
12191
|
this._rows = {};
|
11999
12192
|
|
12000
|
-
if (this._adcTimerId >= 0) {
|
12001
|
-
clearTimeout(this._adcTimerId);
|
12002
|
-
this._adcTimerId = -1;
|
12003
|
-
}
|
12004
|
-
|
12005
|
-
this._adcRicMap = null;
|
12006
|
-
|
12007
12193
|
if (!opt_suppressEvent) {
|
12008
12194
|
this._dispatchDataChange({"globalChange": true});
|
12009
12195
|
}
|
@@ -12015,7 +12201,7 @@ DataCache_DataCache.prototype.clearAllData = function (opt_suppressEvent) { // A
|
|
12015
12201
|
* @param {boolean=} opt_suppressEvent
|
12016
12202
|
* @fires DataCache#dataChanged
|
12017
12203
|
*/
|
12018
|
-
|
12204
|
+
DataCache.prototype.clearColumnData = function (colId, opt_suppressEvent) {
|
12019
12205
|
let cids = (typeof colId === "string") ? [/** @type {string} */(colId)] : /** @type {Array.<string>} */(colId);
|
12020
12206
|
|
12021
12207
|
for (let i = cids.length; --i >= 0;) {
|
@@ -12039,7 +12225,7 @@ DataCache_DataCache.prototype.clearColumnData = function (colId, opt_suppressEve
|
|
12039
12225
|
* @param {string} cid
|
12040
12226
|
* @return {*}
|
12041
12227
|
*/
|
12042
|
-
|
12228
|
+
DataCache.prototype.getData = function (rid, cid) {
|
12043
12229
|
let row = this.getRowData(rid);
|
12044
12230
|
|
12045
12231
|
return (row) ? row[cid] : null;
|
@@ -12050,7 +12236,7 @@ DataCache_DataCache.prototype.getData = function (rid, cid) {
|
|
12050
12236
|
* @public
|
12051
12237
|
* @return {Object.<string, Array.<string>>} Map of Array of subscription object
|
12052
12238
|
*/
|
12053
|
-
|
12239
|
+
DataCache.prototype.getAllRics = function () { // Slow
|
12054
12240
|
let ricMap = {};
|
12055
12241
|
|
12056
12242
|
for (let subId in this._subs) {
|
@@ -12072,7 +12258,7 @@ DataCache_DataCache.prototype.getAllRics = function () { // Slow
|
|
12072
12258
|
* @public
|
12073
12259
|
* @return {Array.<string>}
|
12074
12260
|
*/
|
12075
|
-
|
12261
|
+
DataCache.prototype.getAllRowIds = function () {
|
12076
12262
|
let rids = [];
|
12077
12263
|
|
12078
12264
|
for (let rid in this._rows) {
|
@@ -12087,7 +12273,7 @@ DataCache_DataCache.prototype.getAllRowIds = function () {
|
|
12087
12273
|
* @param {string} rid ID of a row to be checked for its presence.
|
12088
12274
|
* @return {boolean} `true` if row was found, `false` if row was not found.
|
12089
12275
|
*/
|
12090
|
-
|
12276
|
+
DataCache.prototype.hasRowId = function (rid) {
|
12091
12277
|
return !!this._rows[rid];
|
12092
12278
|
};
|
12093
12279
|
|
@@ -12096,7 +12282,7 @@ DataCache_DataCache.prototype.hasRowId = function (rid) {
|
|
12096
12282
|
* @param {string} cid
|
12097
12283
|
* @return {!Array.<*>}
|
12098
12284
|
*/
|
12099
|
-
|
12285
|
+
DataCache.prototype.getColumnData = function (cid) {
|
12100
12286
|
let fieldRows = [];
|
12101
12287
|
|
12102
12288
|
for (let rid in this._rows) {
|
@@ -12111,7 +12297,7 @@ DataCache_DataCache.prototype.getColumnData = function (cid) {
|
|
12111
12297
|
* @param {string} rid
|
12112
12298
|
* @return {Object.<string, *>}
|
12113
12299
|
*/
|
12114
|
-
|
12300
|
+
DataCache.prototype.getRowData = function (rid) {
|
12115
12301
|
return this._rows[rid] || null;
|
12116
12302
|
};
|
12117
12303
|
|
@@ -12122,7 +12308,7 @@ DataCache_DataCache.prototype.getRowData = function (rid) {
|
|
12122
12308
|
* @param {number=} opt_to EXCLUSIVE
|
12123
12309
|
* @return {!Array.<Object>}
|
12124
12310
|
*/
|
12125
|
-
|
12311
|
+
DataCache.prototype.getMultipleRowData = function (rids, opt_from, opt_to) {
|
12126
12312
|
let len = rids.length;
|
12127
12313
|
|
12128
12314
|
if (opt_to == null) {
|
@@ -12151,7 +12337,7 @@ DataCache_DataCache.prototype.getMultipleRowData = function (rids, opt_from, opt
|
|
12151
12337
|
* @public
|
12152
12338
|
* @return {!Array.<Object.<string, *>>}
|
12153
12339
|
*/
|
12154
|
-
|
12340
|
+
DataCache.prototype.getAllRowData = function () {
|
12155
12341
|
let rows = [];
|
12156
12342
|
let rowMap = this._rows;
|
12157
12343
|
|
@@ -12170,7 +12356,7 @@ DataCache_DataCache.prototype.getAllRowData = function () {
|
|
12170
12356
|
* @return {boolean} Return true if there is any change, and false otherwise
|
12171
12357
|
* @fires DataCache#dataChanged
|
12172
12358
|
*/
|
12173
|
-
|
12359
|
+
DataCache.prototype.setData = function (rid, cid, value) { // Data changed event is always dispatched
|
12174
12360
|
let values = {};
|
12175
12361
|
|
12176
12362
|
values[cid] = value;
|
@@ -12180,30 +12366,10 @@ DataCache_DataCache.prototype.setData = function (rid, cid, value) { // Data cha
|
|
12180
12366
|
|
12181
12367
|
/**
|
12182
12368
|
* @public
|
12369
|
+
* @ignore
|
12183
12370
|
* @param {string} rid
|
12184
|
-
* @return {boolean}
|
12185
12371
|
*/
|
12186
|
-
|
12187
|
-
if (!this._adcFields) {
|
12188
|
-
return false;
|
12189
|
-
}
|
12190
|
-
|
12191
|
-
let row = this.getRowData(rid);
|
12192
|
-
|
12193
|
-
if (!row) {
|
12194
|
-
return false;
|
12195
|
-
}
|
12196
|
-
|
12197
|
-
for (let i = this._adcFields.length; --i >= 0;) {
|
12198
|
-
let data = row[this._adcFields[i]];
|
12199
|
-
|
12200
|
-
if (data != null) {
|
12201
|
-
return true;
|
12202
|
-
}
|
12203
|
-
}
|
12204
|
-
|
12205
|
-
return false;
|
12206
|
-
};
|
12372
|
+
DataCache.prototype.hasDataCloudData = function (rid) {};
|
12207
12373
|
|
12208
12374
|
/**
|
12209
12375
|
* @public
|
@@ -12213,7 +12379,7 @@ DataCache_DataCache.prototype.hasDataCloudData = function (rid) {
|
|
12213
12379
|
* @return {boolean} Return true if there is any change, and false otherwise
|
12214
12380
|
* @fires DataCache#dataChanged
|
12215
12381
|
*/
|
12216
|
-
|
12382
|
+
DataCache.prototype.setRowData = function (rid, values, opt_eventArg) { // Data changed event is always dispatched
|
12217
12383
|
let row = this.getRowData(rid);
|
12218
12384
|
let dirty = false;
|
12219
12385
|
let changes = null;
|
@@ -12262,7 +12428,7 @@ DataCache_DataCache.prototype.setRowData = function (rid, values, opt_eventArg)
|
|
12262
12428
|
* @param {string} rid
|
12263
12429
|
* @return {Object}
|
12264
12430
|
*/
|
12265
|
-
|
12431
|
+
DataCache.prototype.cloneRowData = function (rid) {
|
12266
12432
|
let fields = this._rows[rid];
|
12267
12433
|
|
12268
12434
|
if (!fields) {
|
@@ -12288,7 +12454,7 @@ DataCache_DataCache.prototype.cloneRowData = function (rid) {
|
|
12288
12454
|
* @param {Array.<string>} fields
|
12289
12455
|
* @suppress {checkTypes}
|
12290
12456
|
*/
|
12291
|
-
|
12457
|
+
DataCache.prototype.addStaticFields = function (fields) {
|
12292
12458
|
if (!Array.isArray(fields)) {
|
12293
12459
|
return;
|
12294
12460
|
}
|
@@ -12308,7 +12474,7 @@ DataCache_DataCache.prototype.addStaticFields = function (fields) {
|
|
12308
12474
|
* @param {Array.<string>} fields
|
12309
12475
|
* @suppress {checkTypes}
|
12310
12476
|
*/
|
12311
|
-
|
12477
|
+
DataCache.prototype.removeStaticFields = function (fields) {
|
12312
12478
|
if (!Array.isArray(fields)) {
|
12313
12479
|
return;
|
12314
12480
|
}
|
@@ -12328,7 +12494,7 @@ DataCache_DataCache.prototype.removeStaticFields = function (fields) {
|
|
12328
12494
|
* Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
12329
12495
|
* @public
|
12330
12496
|
*/
|
12331
|
-
|
12497
|
+
DataCache.prototype.resetStaticFields = function () {
|
12332
12498
|
this._staticFields = {};
|
12333
12499
|
};
|
12334
12500
|
|
@@ -12337,7 +12503,7 @@ DataCache_DataCache.prototype.resetStaticFields = function () {
|
|
12337
12503
|
* @public
|
12338
12504
|
* @return {Object.<string, number>}
|
12339
12505
|
*/
|
12340
|
-
|
12506
|
+
DataCache.prototype.getStaticFields = function () {
|
12341
12507
|
return this._staticFields;
|
12342
12508
|
};
|
12343
12509
|
|
@@ -12355,8 +12521,8 @@ DataCache_DataCache.prototype.getStaticFields = function () {
|
|
12355
12521
|
* "withRowIds": boolean
|
12356
12522
|
* };
|
12357
12523
|
*/
|
12358
|
-
|
12359
|
-
return
|
12524
|
+
DataCache.prototype.dump = function (options) {
|
12525
|
+
return DataCache.constructTable(this.getAllRowData(), options, Object.keys(this._rows));
|
12360
12526
|
};
|
12361
12527
|
|
12362
12528
|
/**
|
@@ -12372,104 +12538,43 @@ DataCache_DataCache.prototype.dump = function (options) {
|
|
12372
12538
|
* "withRowIds": boolean
|
12373
12539
|
* };
|
12374
12540
|
*/
|
12375
|
-
|
12541
|
+
DataCache.prototype.log = function (opt_options) {
|
12376
12542
|
console.table(this.dump(opt_options));
|
12377
12543
|
};
|
12378
12544
|
|
12379
12545
|
//#region ADC
|
12380
12546
|
/** Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
12381
12547
|
* @public
|
12548
|
+
* @ignore
|
12382
12549
|
* @param {string} userId
|
12383
12550
|
* @param {string} productId
|
12384
12551
|
* @param {string} url
|
12385
12552
|
* @param {string=} opt_lang
|
12386
12553
|
*/
|
12387
|
-
|
12388
|
-
if (userId != null) {
|
12389
|
-
this._userId = userId;
|
12390
|
-
}
|
12391
|
-
|
12392
|
-
if (productId != null) {
|
12393
|
-
this._productId = productId;
|
12394
|
-
}
|
12395
|
-
|
12396
|
-
if (url != null) {
|
12397
|
-
this._adcUrl = url;
|
12398
|
-
}
|
12399
|
-
|
12400
|
-
if (opt_lang) {
|
12401
|
-
this._lang = opt_lang;
|
12402
|
-
}
|
12403
|
-
};
|
12554
|
+
DataCache.prototype.setDataCloudSettings = function (userId, productId, url, opt_lang) {};
|
12404
12555
|
|
12405
12556
|
/**
|
12406
12557
|
* Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
12407
12558
|
* @public
|
12408
|
-
* @
|
12559
|
+
* @ignore
|
12409
12560
|
*/
|
12410
|
-
|
12411
|
-
return this._adcFields; // Return private members
|
12412
|
-
};
|
12561
|
+
DataCache.prototype.getDataCloudFields = function () {};
|
12413
12562
|
|
12414
12563
|
/**
|
12415
12564
|
* Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
12416
12565
|
* @public
|
12566
|
+
* @ignore
|
12417
12567
|
* @param {Array.<string>|string} fields
|
12418
|
-
* @return {boolean} Return true if success, and false otherwise
|
12419
12568
|
*/
|
12420
|
-
|
12421
|
-
if (!this._adcFields) {
|
12422
|
-
this._adcFields = [];
|
12423
|
-
this._adcRefMap = {};
|
12424
|
-
}
|
12425
|
-
|
12426
|
-
let newFields = [];
|
12427
|
-
|
12428
|
-
if (fields instanceof Array) {
|
12429
|
-
for (let i = fields.length; --i >= 0;) {
|
12430
|
-
this._addDataCloudField(fields[i], newFields);
|
12431
|
-
}
|
12432
|
-
} else {
|
12433
|
-
this._addDataCloudField(/** @type {string} */(fields), newFields);
|
12434
|
-
}
|
12435
|
-
|
12436
|
-
if (newFields.length <= 0) {
|
12437
|
-
return false;
|
12438
|
-
}
|
12439
|
-
|
12440
|
-
let ricMap = this.getAllRics();
|
12441
|
-
|
12442
|
-
this._batchRequestDataCloud(ricMap, newFields);
|
12443
|
-
|
12444
|
-
return true;
|
12445
|
-
};
|
12569
|
+
DataCache.prototype.addDataCloudFields = function (fields) {};
|
12446
12570
|
|
12447
12571
|
/**
|
12448
12572
|
* Deprecated. Built-in Data Service is deprecated due to the lack of flexibility.
|
12449
12573
|
* @public
|
12574
|
+
* @ignore
|
12450
12575
|
* @param {string} field
|
12451
|
-
* @return {boolean} Return true if success, and false otherwise
|
12452
12576
|
*/
|
12453
|
-
|
12454
|
-
if (!this._adcFields) {
|
12455
|
-
return false;
|
12456
|
-
}
|
12457
|
-
|
12458
|
-
if (!this._adcRefMap[field]) {
|
12459
|
-
return false;
|
12460
|
-
}
|
12461
|
-
|
12462
|
-
--this._adcRefMap[field];
|
12463
|
-
|
12464
|
-
if (!this._adcRefMap[field]) {
|
12465
|
-
let foundAt = this._adcFields.indexOf(field);
|
12466
|
-
|
12467
|
-
this._adcFields.splice(foundAt, 1);
|
12468
|
-
this.clearColumnData(field);
|
12469
|
-
}
|
12470
|
-
|
12471
|
-
return true;
|
12472
|
-
};
|
12577
|
+
DataCache.prototype.removeDataCloudField = function (field) {};
|
12473
12578
|
//#endregion ADC
|
12474
12579
|
//#endregion Public
|
12475
12580
|
|
@@ -12480,7 +12585,7 @@ DataCache_DataCache.prototype.removeDataCloudField = function (field) {
|
|
12480
12585
|
* @fires DataTable#dataComposed
|
12481
12586
|
* @fires DataTable#dataChanged
|
12482
12587
|
*/
|
12483
|
-
|
12588
|
+
DataCache.prototype._dispatchDataChange = function (e) {
|
12484
12589
|
if (this._composing) {
|
12485
12590
|
return;
|
12486
12591
|
}
|
@@ -12498,7 +12603,7 @@ DataCache_DataCache.prototype._dispatchDataChange = function (e) {
|
|
12498
12603
|
* @param {string} colName
|
12499
12604
|
* @return {*}
|
12500
12605
|
*/
|
12501
|
-
|
12606
|
+
DataCache._defaultPropertyGetter = function (propertyName, rowData, colName) {
|
12502
12607
|
let d = rowData[colName];
|
12503
12608
|
|
12504
12609
|
return d ? d[propertyName] : null;
|
@@ -12510,7 +12615,7 @@ DataCache_DataCache._defaultPropertyGetter = function (propertyName, rowData, co
|
|
12510
12615
|
* @param {string} colName
|
12511
12616
|
* @return {*}
|
12512
12617
|
*/
|
12513
|
-
|
12618
|
+
DataCache._defaultGetter = function (rowData, colName) {
|
12514
12619
|
return rowData[colName];
|
12515
12620
|
};
|
12516
12621
|
|
@@ -12523,13 +12628,13 @@ DataCache_DataCache._defaultGetter = function (rowData, colName) {
|
|
12523
12628
|
* @param {Array.<string>=} opt_rowIds Optional row ids corresponding to the given dataset
|
12524
12629
|
* @return {!Array.<Object>} Return a JSON object that is compatible with console.table()
|
12525
12630
|
*/
|
12526
|
-
|
12631
|
+
DataCache.constructTable = function (dataset, opt_options, opt_rowIds) {
|
12527
12632
|
let startIndex = 0;
|
12528
12633
|
let rLen = dataset.length;
|
12529
12634
|
let rowLim = rLen;
|
12530
12635
|
let colMap = null;
|
12531
12636
|
let rids = opt_rowIds || null;
|
12532
|
-
let getter =
|
12637
|
+
let getter = DataCache._defaultGetter;
|
12533
12638
|
let transformation = false;
|
12534
12639
|
|
12535
12640
|
if (opt_options) {
|
@@ -12552,7 +12657,7 @@ DataCache_DataCache.constructTable = function (dataset, opt_options, opt_rowIds)
|
|
12552
12657
|
|
12553
12658
|
if (opt_options["getter"]) {
|
12554
12659
|
if (typeof opt_options["getter"] == "string") {
|
12555
|
-
getter =
|
12660
|
+
getter = DataCache._defaultPropertyGetter.bind(null, opt_options["getter"]);
|
12556
12661
|
} else { // Function
|
12557
12662
|
getter = opt_options["getter"];
|
12558
12663
|
}
|
@@ -12615,15 +12720,12 @@ DataCache_DataCache.constructTable = function (dataset, opt_options, opt_rowIds)
|
|
12615
12720
|
* @param {string} ric
|
12616
12721
|
* @param {Object.<string, *>} values
|
12617
12722
|
*/
|
12618
|
-
|
12723
|
+
DataCache.prototype._insertRic = function (subId, ric, values) {
|
12619
12724
|
// HACK: Some chain may have 0# symbol in there chain index (e.g. 0#CL:)
|
12620
12725
|
ric = ric.replace("0#", "");
|
12621
12726
|
|
12622
12727
|
let rid = subId + ric;
|
12623
12728
|
|
12624
|
-
// We cannot cache event arguments because user may want to collect all the updates
|
12625
|
-
this._onADCForNewRic(subId, ric);
|
12626
|
-
|
12627
12729
|
let rowData = this.getRowData(rid);
|
12628
12730
|
if (!rowData) { // Ensure that we have subscription id and ric from Quotes2
|
12629
12731
|
let tmp = values;
|
@@ -12650,7 +12752,7 @@ DataCache_DataCache.prototype._insertRic = function (subId, ric, values) {
|
|
12650
12752
|
* @private
|
12651
12753
|
* @param {Object} e
|
12652
12754
|
*/
|
12653
|
-
|
12755
|
+
DataCache.prototype._onQ2DataChanged = function (e) {
|
12654
12756
|
let subId = e["subId"];
|
12655
12757
|
let ric = e["ric"];
|
12656
12758
|
let values = /** @type{Object.<string, *>} */(e["values"]);
|
@@ -12668,7 +12770,7 @@ DataCache_DataCache.prototype._onQ2DataChanged = function (e) {
|
|
12668
12770
|
* @private
|
12669
12771
|
* @param {Object} e
|
12670
12772
|
*/
|
12671
|
-
|
12773
|
+
DataCache.prototype._onQ2SubAdded = function (e) {
|
12672
12774
|
let subs = e["subs"];
|
12673
12775
|
let duplicateSubIds = e["duplicateSubIds"];
|
12674
12776
|
let len = subs.length;
|
@@ -12701,7 +12803,7 @@ DataCache_DataCache.prototype._onQ2SubAdded = function (e) {
|
|
12701
12803
|
* @private
|
12702
12804
|
* @param {Object} e
|
12703
12805
|
*/
|
12704
|
-
|
12806
|
+
DataCache.prototype._onQ2SubRemoved = function (e) {
|
12705
12807
|
let subs = e["subs"];
|
12706
12808
|
let len = subs.length;
|
12707
12809
|
|
@@ -12718,42 +12820,12 @@ DataCache_DataCache.prototype._onQ2SubRemoved = function (e) {
|
|
12718
12820
|
}
|
12719
12821
|
};
|
12720
12822
|
|
12721
|
-
/**
|
12722
|
-
* @private
|
12723
|
-
* @param {string} subId Subscription id
|
12724
|
-
* @param {string} ric
|
12725
|
-
*/
|
12726
|
-
DataCache_DataCache.prototype._onADCForNewRic = function (subId, ric) {
|
12727
|
-
let sub = this._subs[subId];
|
12728
|
-
|
12729
|
-
if (!sub) {
|
12730
|
-
return;
|
12731
|
-
}
|
12732
|
-
|
12733
|
-
if (this._adcFields) {
|
12734
|
-
if (!sub["rics"][ric]) { // First time insertion
|
12735
|
-
if (this._adcTimerId < 0) {
|
12736
|
-
this._adcRicMap = {};
|
12737
|
-
this._adcTimerId = setTimeout(this._onBatchRequestADCData, 100);
|
12738
|
-
}
|
12739
|
-
|
12740
|
-
if (!this._adcRicMap[ric]) {
|
12741
|
-
this._adcRicMap[ric] = [];
|
12742
|
-
}
|
12743
|
-
|
12744
|
-
this._adcRicMap[ric].push(subId);
|
12745
|
-
}
|
12746
|
-
}
|
12747
|
-
|
12748
|
-
sub["rics"][ric] = true;
|
12749
|
-
};
|
12750
|
-
|
12751
12823
|
/**
|
12752
12824
|
* @private
|
12753
12825
|
* @param {string} subId
|
12754
12826
|
* @param {Object.<string, *>} dupData
|
12755
12827
|
*/
|
12756
|
-
|
12828
|
+
DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
12757
12829
|
let sub = this._subs[subId];
|
12758
12830
|
|
12759
12831
|
if (!sub) {
|
@@ -12781,7 +12853,7 @@ DataCache_DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
|
12781
12853
|
ric = children[i];
|
12782
12854
|
values = this._cloneRowData(dupSubId, ric, subId);
|
12783
12855
|
|
12784
|
-
this._onInsert(sub, ric, values);
|
12856
|
+
this._onInsert(sub, ric, values);
|
12785
12857
|
}
|
12786
12858
|
}
|
12787
12859
|
};
|
@@ -12792,13 +12864,12 @@ DataCache_DataCache.prototype._onDuplicateRic = function (subId, dupData) {
|
|
12792
12864
|
* @param {string} ric
|
12793
12865
|
* @param {Object.<string, *>} values
|
12794
12866
|
*/
|
12795
|
-
|
12867
|
+
DataCache.prototype._onInsert = function (sub, ric, values/*, rowN*/) {
|
12796
12868
|
let subId = sub["id"];
|
12797
12869
|
|
12798
12870
|
if (this._quotes2) {
|
12799
12871
|
this._insertRic(subId, ric, values);
|
12800
12872
|
} else {
|
12801
|
-
this._onADCForNewRic(subId, ric);
|
12802
12873
|
this.setRowData(subId + ric, values, {"subscription": sub, "ric": ric});
|
12803
12874
|
}
|
12804
12875
|
};
|
@@ -12807,7 +12878,7 @@ DataCache_DataCache.prototype._onInsert = function (sub, ric, values/*, rowN*/)
|
|
12807
12878
|
* @private
|
12808
12879
|
* @function
|
12809
12880
|
*/
|
12810
|
-
|
12881
|
+
DataCache.prototype._onUpdate = DataCache.prototype._onInsert;
|
12811
12882
|
|
12812
12883
|
/**
|
12813
12884
|
* This is a legacy code and should be deprecated
|
@@ -12816,198 +12887,13 @@ DataCache_DataCache.prototype._onUpdate = DataCache_DataCache.prototype._onInser
|
|
12816
12887
|
* @param {string} ric
|
12817
12888
|
* @param {Array.<string, *>} values
|
12818
12889
|
*/
|
12819
|
-
|
12890
|
+
DataCache.prototype._onDelete = function (sub, ric, values/*, rowN*/) {
|
12820
12891
|
delete this._subs[sub["id"]]["rics"][ric];
|
12821
12892
|
|
12822
12893
|
// We cannot cache event arguments because user may want to collect all the updates
|
12823
12894
|
this.setRowData(sub["id"] + ric, null, {"subscription": sub, "ric": ric});
|
12824
12895
|
};
|
12825
12896
|
|
12826
|
-
/**
|
12827
|
-
* @private
|
12828
|
-
* @param {string} field
|
12829
|
-
* @param {Array.<string>} ary_out
|
12830
|
-
*/
|
12831
|
-
DataCache_DataCache.prototype._addDataCloudField = function (field, ary_out) {
|
12832
|
-
if (!this._adcRefMap[field]) {
|
12833
|
-
this._adcFields.push(field);
|
12834
|
-
|
12835
|
-
ary_out.push(field);
|
12836
|
-
|
12837
|
-
this._adcRefMap[field] = 1;
|
12838
|
-
} else {
|
12839
|
-
++this._adcRefMap[field];
|
12840
|
-
}
|
12841
|
-
};
|
12842
|
-
|
12843
|
-
/**
|
12844
|
-
* @private
|
12845
|
-
* @param {Object} e
|
12846
|
-
* @suppress {missingProperties}
|
12847
|
-
*/
|
12848
|
-
DataCache_DataCache.prototype._onADCUpdate = function (e) {
|
12849
|
-
let xhr = e["currentTarget"]; // XMLHttpRequest
|
12850
|
-
let resp = null;
|
12851
|
-
|
12852
|
-
try {
|
12853
|
-
resp = JSON.parse(xhr.responseText);
|
12854
|
-
// window.console.log("Successfully parse: " + resp.rows);
|
12855
|
-
} catch (err) {
|
12856
|
-
return;
|
12857
|
-
}
|
12858
|
-
|
12859
|
-
if (resp["status"] !== "Ok") {
|
12860
|
-
return;
|
12861
|
-
}
|
12862
|
-
|
12863
|
-
let colCount = resp["cols"];
|
12864
|
-
let rows = resp["rows"];
|
12865
|
-
let colDefs = rows[0]; // The first row is always the column definition
|
12866
|
-
let ricIndex = -1;
|
12867
|
-
let fieldIndices = {};
|
12868
|
-
|
12869
|
-
for (let i = 0; i < colCount; ++i) {
|
12870
|
-
let colDef = colDefs[i];
|
12871
|
-
|
12872
|
-
if (colDef["i"] === "instrument") {
|
12873
|
-
ricIndex = i;
|
12874
|
-
} else if (colDef["r"]) {
|
12875
|
-
fieldIndices[colDef["r"]] = i;
|
12876
|
-
}
|
12877
|
-
}
|
12878
|
-
|
12879
|
-
let rowCount = rows.length;
|
12880
|
-
|
12881
|
-
for (let j = 1; j < rowCount; ++j) { // Start from 1
|
12882
|
-
let row = rows[j];
|
12883
|
-
let ric = row[ricIndex];
|
12884
|
-
let values = {};
|
12885
|
-
|
12886
|
-
for (let field in fieldIndices) {
|
12887
|
-
let value = row[fieldIndices[field]];
|
12888
|
-
|
12889
|
-
if (value != null) {
|
12890
|
-
// Data should be merged from the backend.
|
12891
|
-
// Don't override data with null value.
|
12892
|
-
// TODO: Merge all the row into one single row
|
12893
|
-
if (value !== null && value["f"] == null) {
|
12894
|
-
if (this._quotes2) {
|
12895
|
-
values[field] = value;
|
12896
|
-
values[field + "_FORMATTED"] = value;
|
12897
|
-
} else {
|
12898
|
-
values[field] = {"formatted": value + "", "raw": value};
|
12899
|
-
}
|
12900
|
-
}
|
12901
|
-
}
|
12902
|
-
}
|
12903
|
-
|
12904
|
-
let subIds = xhr.ricMap[ric];
|
12905
|
-
|
12906
|
-
if (subIds) { // Only ric within the subscription can be updated
|
12907
|
-
for (i = subIds.length; --i >= 0;) {
|
12908
|
-
let subId = subIds[i];
|
12909
|
-
|
12910
|
-
if (this._subs[subId]) { // Only update the existing subscription
|
12911
|
-
// window.console.log("ADC update " + subId + ric + " with " + JSON.stringify(values));
|
12912
|
-
this.setRowData(subId + ric, values); // Event is fired
|
12913
|
-
}
|
12914
|
-
}
|
12915
|
-
}
|
12916
|
-
}
|
12917
|
-
};
|
12918
|
-
|
12919
|
-
/**
|
12920
|
-
* @private
|
12921
|
-
* @param {Object} e
|
12922
|
-
*/
|
12923
|
-
DataCache_DataCache.prototype._onADCError = function (e) {
|
12924
|
-
window.console.log(e);
|
12925
|
-
};
|
12926
|
-
|
12927
|
-
/**
|
12928
|
-
* @private
|
12929
|
-
* @param {Object} e
|
12930
|
-
*/
|
12931
|
-
DataCache_DataCache.prototype._onBatchRequestADCData = function (e) {
|
12932
|
-
if (this._adcTimerId <= 0) {
|
12933
|
-
return;
|
12934
|
-
}
|
12935
|
-
|
12936
|
-
this._adcTimerId = -1;
|
12937
|
-
this._batchRequestDataCloud(this._adcRicMap, this._adcFields);
|
12938
|
-
this._adcRicMap = null;
|
12939
|
-
};
|
12940
|
-
|
12941
|
-
/**
|
12942
|
-
* @private
|
12943
|
-
* @param {Object.<string, Array.<string>>} ricMap of Array of subscription object
|
12944
|
-
* @param {Array.<string>} fields
|
12945
|
-
* @return {XMLHttpRequest}
|
12946
|
-
*/
|
12947
|
-
DataCache_DataCache.prototype._batchRequestDataCloud = function (ricMap, fields) {
|
12948
|
-
if (!this._adcUrl) {
|
12949
|
-
return null;
|
12950
|
-
}
|
12951
|
-
|
12952
|
-
let rics = [];
|
12953
|
-
|
12954
|
-
for (let ric in ricMap) {
|
12955
|
-
rics.push(ric);
|
12956
|
-
}
|
12957
|
-
|
12958
|
-
// Request data cloud in small multiple batches because the service cannot handle a long request
|
12959
|
-
while (rics.length > 30) {
|
12960
|
-
this._requestDataCloud(ricMap, fields, rics.splice(0, 30));
|
12961
|
-
}
|
12962
|
-
|
12963
|
-
return this._requestDataCloud(ricMap, fields, rics);
|
12964
|
-
};
|
12965
|
-
|
12966
|
-
/**
|
12967
|
-
* @private
|
12968
|
-
* @param {Object.<string, Array.<string>>} ricMap of Array of subscription object
|
12969
|
-
* @param {Array.<string>} fields
|
12970
|
-
* @param {Array.<string>} rics
|
12971
|
-
* @return {XMLHttpRequest}
|
12972
|
-
*/
|
12973
|
-
DataCache_DataCache.prototype._requestDataCloud = function (ricMap, fields, rics) { // Small batch
|
12974
|
-
if (!rics || rics.length <= 0) {
|
12975
|
-
return null;
|
12976
|
-
}
|
12977
|
-
|
12978
|
-
if (!fields || fields.length <= 0) {
|
12979
|
-
return null;
|
12980
|
-
}
|
12981
|
-
|
12982
|
-
let xhr = new XMLHttpRequest();
|
12983
|
-
|
12984
|
-
xhr.onload = this._onADCUpdate;
|
12985
|
-
xhr.onerror = this._onADCError;
|
12986
|
-
xhr.ricMap = ricMap;
|
12987
|
-
|
12988
|
-
xhr.open("POST", this._adcUrl, true);
|
12989
|
-
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
12990
|
-
|
12991
|
-
let body = 'formula=' + fields + '&identifiers=' + rics;
|
12992
|
-
|
12993
|
-
// window.console.log("ADC is requested with " + body);
|
12994
|
-
if (this._productId) {
|
12995
|
-
body += '&productid=' + this._productId;
|
12996
|
-
}
|
12997
|
-
|
12998
|
-
if (this._userId) {
|
12999
|
-
body += '&uuid=' + this._userId;
|
13000
|
-
}
|
13001
|
-
|
13002
|
-
if (this._lang) {
|
13003
|
-
body += '&lang=' + this._lang;
|
13004
|
-
}
|
13005
|
-
|
13006
|
-
xhr.send(body);
|
13007
|
-
|
13008
|
-
return xhr;
|
13009
|
-
};
|
13010
|
-
|
13011
12897
|
/**
|
13012
12898
|
* @private
|
13013
12899
|
* @param {string|Object.<string, *>} obj
|
@@ -13015,7 +12901,7 @@ DataCache_DataCache.prototype._requestDataCloud = function (ricMap, fields, rics
|
|
13015
12901
|
* @param {string} newSubId
|
13016
12902
|
* @return {Object}
|
13017
12903
|
*/
|
13018
|
-
|
12904
|
+
DataCache.prototype._cloneRowData = function (obj, ric, newSubId) {
|
13019
12905
|
let subId = (typeof obj === "string") ? obj : obj["SUB_ID"];
|
13020
12906
|
let fields = this._rows[subId + ric];
|
13021
12907
|
|
@@ -13044,87 +12930,37 @@ DataCache_DataCache.prototype._cloneRowData = function (obj, ric, newSubId) {
|
|
13044
12930
|
* @ignore
|
13045
12931
|
* @type {!Object.<string, Object>}
|
13046
12932
|
*/
|
13047
|
-
|
12933
|
+
DataCache.prototype._rows;
|
13048
12934
|
|
13049
12935
|
/**
|
13050
12936
|
* @private
|
13051
12937
|
* @type {!Object.<string, Object>}
|
13052
12938
|
*/
|
13053
|
-
|
12939
|
+
DataCache.prototype._subs;
|
13054
12940
|
|
13055
12941
|
/**
|
13056
12942
|
* @private
|
13057
12943
|
* @type {Object}
|
13058
12944
|
*/
|
13059
|
-
|
12945
|
+
DataCache.prototype._quotes2 = null;
|
13060
12946
|
|
13061
12947
|
/**
|
13062
12948
|
* @private
|
13063
12949
|
* @type {Object.<string, number>}
|
13064
12950
|
*/
|
13065
|
-
|
13066
|
-
|
13067
|
-
//#region ADC
|
13068
|
-
/**
|
13069
|
-
* @private
|
13070
|
-
* @type {Array.<string>}
|
13071
|
-
*/
|
13072
|
-
DataCache_DataCache.prototype._adcFields = null;
|
13073
|
-
|
13074
|
-
/**
|
13075
|
-
* @private
|
13076
|
-
* @type {Object.<string, number>}
|
13077
|
-
*/
|
13078
|
-
DataCache_DataCache.prototype._adcRefMap = null;
|
13079
|
-
|
13080
|
-
/**
|
13081
|
-
* @private
|
13082
|
-
* @type {number}
|
13083
|
-
*/
|
13084
|
-
DataCache_DataCache.prototype._adcTimerId = -1;
|
13085
|
-
|
13086
|
-
/**
|
13087
|
-
* @private
|
13088
|
-
* @description ricMap of Array of subscription object
|
13089
|
-
* @type {Object.<string, Array.<string>>}
|
13090
|
-
*/
|
13091
|
-
DataCache_DataCache.prototype._adcRicMap = null;
|
13092
|
-
|
13093
|
-
/**
|
13094
|
-
* @private
|
13095
|
-
* @type {string}
|
13096
|
-
*/
|
13097
|
-
DataCache_DataCache.prototype._adcUrl = "/datacloud/rest/select";
|
13098
|
-
|
13099
|
-
/**
|
13100
|
-
* @private
|
13101
|
-
* @type {string}
|
13102
|
-
*/
|
13103
|
-
DataCache_DataCache.prototype._userId = "";
|
13104
|
-
|
13105
|
-
/**
|
13106
|
-
* @private
|
13107
|
-
* @type {string}
|
13108
|
-
*/
|
13109
|
-
DataCache_DataCache.prototype._productId = "";
|
12951
|
+
DataCache.prototype._staticFields = null;
|
13110
12952
|
|
13111
12953
|
/** @protected
|
13112
12954
|
* @ignore
|
13113
12955
|
* @type {boolean}
|
13114
12956
|
*/
|
13115
|
-
|
12957
|
+
DataCache.prototype._composing = false;
|
13116
12958
|
|
13117
|
-
/** @protected
|
13118
|
-
* @ignore
|
13119
|
-
* @type {string}
|
13120
|
-
*/
|
13121
|
-
DataCache_DataCache.prototype._lang = "";
|
13122
|
-
//#endregion ADC
|
13123
12959
|
//#endregion Private
|
13124
12960
|
|
13125
|
-
|
12961
|
+
DataCache._proto = DataCache.prototype;
|
13126
12962
|
|
13127
|
-
/* harmony default export */ const data_DataCache = (
|
12963
|
+
/* harmony default export */ const data_DataCache = (DataCache);
|
13128
12964
|
|
13129
12965
|
|
13130
12966
|
;// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/EventDispatcher.js
|
@@ -17175,6 +17011,7 @@ ColumnStats.prototype._refs;
|
|
17175
17011
|
// eslint-disable-line
|
17176
17012
|
// eslint-disable-line
|
17177
17013
|
// eslint-disable-line
|
17014
|
+
// eslint-disable-line
|
17178
17015
|
|
17179
17016
|
/** @event WrappedView#dataChanged
|
17180
17017
|
* @description Trigger when data within the data view has been changed. Not only actual change in data, but also position change will trigger this event.
|
@@ -18452,7 +18289,7 @@ WrappedView.prototype.wrapView = function (wrapSize) {
|
|
18452
18289
|
* @see {@link DataCache#dump}
|
18453
18290
|
*/
|
18454
18291
|
WrappedView.prototype.dump = function(opt_options) {
|
18455
|
-
return
|
18292
|
+
return data_DataCache.constructTable(this.getMultipleRowData(this._rids), opt_options, this._rids);
|
18456
18293
|
};
|
18457
18294
|
/** Print current data and structure to console panel
|
18458
18295
|
* @public
|
@@ -24133,24 +23970,10 @@ VScrollbar._proto = VScrollbar.prototype;
|
|
24133
23970
|
|
24134
23971
|
|
24135
23972
|
|
23973
|
+
|
24136
23974
|
/* eslint-enable */
|
24137
23975
|
|
24138
23976
|
|
24139
|
-
/** @private
|
24140
|
-
* @function
|
24141
|
-
* @param {number} idx
|
24142
|
-
* @param {number} limit
|
24143
|
-
* @return {number}
|
24144
|
-
*/
|
24145
|
-
let _validateIndex = function(idx, limit) {
|
24146
|
-
if(idx > limit) {
|
24147
|
-
return limit;
|
24148
|
-
} else if(idx < 0) {
|
24149
|
-
return 0;
|
24150
|
-
}
|
24151
|
-
return idx;
|
24152
|
-
};
|
24153
|
-
|
24154
23977
|
/** @constructor
|
24155
23978
|
* @ignore
|
24156
23979
|
* @param {Object=} options
|
@@ -24235,26 +24058,10 @@ VirtualizedLayoutGrid.prototype._rowBoundCache = null;
|
|
24235
24058
|
* @private
|
24236
24059
|
*/
|
24237
24060
|
VirtualizedLayoutGrid.prototype._rowSelDirty = false;
|
24238
|
-
/** @type {
|
24239
|
-
* @private
|
24240
|
-
*/
|
24241
|
-
VirtualizedLayoutGrid.prototype._cellBound = null;
|
24242
|
-
/** @type {number}
|
24243
|
-
* @private
|
24244
|
-
*/
|
24245
|
-
VirtualizedLayoutGrid.prototype._cbLftIdx = 0;
|
24246
|
-
/** @type {number}
|
24247
|
-
* @private
|
24248
|
-
*/
|
24249
|
-
VirtualizedLayoutGrid.prototype._cbRgtIdx = 0;
|
24250
|
-
/** @type {number}
|
24251
|
-
* @private
|
24252
|
-
*/
|
24253
|
-
VirtualizedLayoutGrid.prototype._cbTopIdx = 0;
|
24254
|
-
/** @type {number}
|
24061
|
+
/** @type {Object}
|
24255
24062
|
* @private
|
24256
24063
|
*/
|
24257
|
-
VirtualizedLayoutGrid.prototype.
|
24064
|
+
VirtualizedLayoutGrid.prototype._cellBoundPainter = null;
|
24258
24065
|
/** @type {number}
|
24259
24066
|
* @private
|
24260
24067
|
*/
|
@@ -24307,6 +24114,9 @@ VirtualizedLayoutGrid.prototype.dispose = function () {
|
|
24307
24114
|
clearTimeout(this._rowBoundTimer);
|
24308
24115
|
this._rowBoundTimer = 0;
|
24309
24116
|
}
|
24117
|
+
if(this._cellBoundPainter) {
|
24118
|
+
this._cellBoundPainter.dispose();
|
24119
|
+
}
|
24310
24120
|
};
|
24311
24121
|
/** @override */
|
24312
24122
|
VirtualizedLayoutGrid.prototype.setWidth = function (px) {
|
@@ -25134,26 +24944,20 @@ VirtualizedLayoutGrid.prototype.selectCell = function (colIndex, rowIndex, selec
|
|
25134
24944
|
* @param {number} height
|
25135
24945
|
*/
|
25136
24946
|
VirtualizedLayoutGrid.prototype.setCellBounds = function (colIndex, rowIndex, width, height) {
|
25137
|
-
let
|
25138
|
-
|
25139
|
-
|
25140
|
-
|
24947
|
+
let boundLayer = this._initBoundLayer();
|
24948
|
+
let cellBoundPainter = this._cellBoundPainter;
|
24949
|
+
if(!cellBoundPainter) {
|
24950
|
+
cellBoundPainter = this._cellBoundPainter = new util_CellBoundPainter({
|
24951
|
+
boundLayer: boundLayer,
|
24952
|
+
layoutX: this.getHorizontalLayout(),
|
24953
|
+
layoutY: this._layoutY,
|
24954
|
+
hscrollbar: this._hscrollbar,
|
24955
|
+
calculateColumnBounds: this.calculateColumnBounds.bind(this)
|
24956
|
+
});
|
25141
24957
|
}
|
25142
|
-
this._initBoundLayer();
|
25143
|
-
|
25144
|
-
// Validate inputs
|
25145
|
-
let rgtIndex = colIndex + width; // Exclusive
|
25146
|
-
let btmIndex = rowIndex + height; // Exclusive
|
25147
24958
|
|
25148
24959
|
let colCount = this.getColumnCount();
|
25149
|
-
|
25150
|
-
|
25151
|
-
this._cbLftIdx = _validateIndex(colIndex, colCount);
|
25152
|
-
this._cbRgtIdx = _validateIndex(rgtIndex, colCount);
|
25153
|
-
this._cbTopIdx = _validateIndex(rowIndex, rowCount);
|
25154
|
-
this._cbBtmIdx = _validateIndex(btmIndex, rowCount);
|
25155
|
-
|
25156
|
-
this._updateCellBounds();
|
24960
|
+
cellBoundPainter.setCellBounds(colIndex, rowIndex, width, height, colCount);
|
25157
24961
|
};
|
25158
24962
|
/** @public
|
25159
24963
|
* @ignore
|
@@ -25172,59 +24976,6 @@ VirtualizedLayoutGrid.prototype.getHorizontalLayout = function () {
|
|
25172
24976
|
VirtualizedLayoutGrid.prototype.calculateColumnBounds = function (lftIdx, rgtIdx, outPositions, outNoBorders) {
|
25173
24977
|
this._grid.calculateColumnBounds(lftIdx, rgtIdx, outPositions, outNoBorders);
|
25174
24978
|
};
|
25175
|
-
/** @private
|
25176
|
-
*/
|
25177
|
-
VirtualizedLayoutGrid.prototype._updateCellBounds = function () {
|
25178
|
-
let cellBound = this._cellBound;
|
25179
|
-
if(!cellBound) {
|
25180
|
-
return;
|
25181
|
-
}
|
25182
|
-
|
25183
|
-
let layoutX = this.getHorizontalLayout();
|
25184
|
-
let layoutY = this._layoutY;
|
25185
|
-
let lftIdx = this._cbLftIdx;
|
25186
|
-
let rgtIdx = this._cbRgtIdx; // Exclusive
|
25187
|
-
let topIdx = this._cbTopIdx;
|
25188
|
-
let btmIdx = this._cbBtmIdx; // Exclusive
|
25189
|
-
let lftPx, rgtPx, topPx, btmPx;
|
25190
|
-
lftPx = rgtPx = topPx = btmPx = 0;
|
25191
|
-
if(lftIdx < rgtIdx && topIdx < btmIdx) {
|
25192
|
-
lftPx = layoutX.getLaneStart(lftIdx);
|
25193
|
-
rgtPx = layoutX.getLaneEnd(rgtIdx - 1);
|
25194
|
-
topPx = layoutY.getLaneStart(topIdx);
|
25195
|
-
btmPx = layoutY.getLaneEnd(btmIdx - 1);
|
25196
|
-
}
|
25197
|
-
|
25198
|
-
let width = rgtPx - lftPx;
|
25199
|
-
let height = btmPx - topPx;
|
25200
|
-
let noBorders = [false, false];
|
25201
|
-
if(width > 0 && height > 0 && this._hscrollbar) {
|
25202
|
-
let positions = [0, 0];
|
25203
|
-
this.calculateColumnBounds(lftIdx, rgtIdx - 1, positions, noBorders);
|
25204
|
-
lftPx = positions[0];
|
25205
|
-
rgtPx = positions[1];
|
25206
|
-
width = rgtPx - lftPx;
|
25207
|
-
}
|
25208
|
-
|
25209
|
-
if(width > 0) {
|
25210
|
-
cellBound.style.left = lftPx + "px";
|
25211
|
-
cellBound.style.top = topPx + "px";
|
25212
|
-
cellBound.style.width = width + "px";
|
25213
|
-
cellBound.style.height = height + "px";
|
25214
|
-
|
25215
|
-
cellBound.classList.toggle("no-left-bound", noBorders[0]);
|
25216
|
-
cellBound.classList.toggle("no-right-bound", noBorders[1]);
|
25217
|
-
|
25218
|
-
if(this._boundLayer) {
|
25219
|
-
this._boundLayer.appendChild(cellBound);
|
25220
|
-
}
|
25221
|
-
} else {
|
25222
|
-
let pn = cellBound.parentNode;
|
25223
|
-
if(pn) {
|
25224
|
-
pn.removeChild(cellBound);
|
25225
|
-
}
|
25226
|
-
}
|
25227
|
-
};
|
25228
24979
|
/** @public
|
25229
24980
|
* @ignore
|
25230
24981
|
* @param {!Array.<Array>} posAry Left and right bound positions in pixel
|
@@ -25242,6 +24993,7 @@ VirtualizedLayoutGrid.prototype.updateColumnSeparators = function () {
|
|
25242
24993
|
this._grid.updateColumnSeparators();
|
25243
24994
|
};
|
25244
24995
|
/** @private
|
24996
|
+
* @return {Element}
|
25245
24997
|
*/
|
25246
24998
|
VirtualizedLayoutGrid.prototype._initBoundLayer = function () {
|
25247
24999
|
let boundLayer = this._boundLayer;
|
@@ -25250,6 +25002,7 @@ VirtualizedLayoutGrid.prototype._initBoundLayer = function () {
|
|
25250
25002
|
boundLayer.className = "cover-layer";
|
25251
25003
|
this._element.appendChild(boundLayer);
|
25252
25004
|
}
|
25005
|
+
return boundLayer;
|
25253
25006
|
};
|
25254
25007
|
/** @private
|
25255
25008
|
*/
|
@@ -25262,7 +25015,11 @@ VirtualizedLayoutGrid.prototype._requestUpdatingRowBounds = function () {
|
|
25262
25015
|
*/
|
25263
25016
|
VirtualizedLayoutGrid.prototype._updateRowBounds = function () {
|
25264
25017
|
this._rowBoundTimer = 0;
|
25265
|
-
|
25018
|
+
|
25019
|
+
let cellBoundPainter = this._cellBoundPainter;
|
25020
|
+
if(cellBoundPainter) {
|
25021
|
+
cellBoundPainter.updateCellBounds();
|
25022
|
+
}
|
25266
25023
|
|
25267
25024
|
if(!this._rowSelDirty) {
|
25268
25025
|
return;
|
@@ -26028,7 +25785,7 @@ Core_Core.prototype._hasPendingRowChange = false;
|
|
26028
25785
|
* @return {string}
|
26029
25786
|
*/
|
26030
25787
|
Core_Core.getVersion = function () {
|
26031
|
-
return "5.1.
|
25788
|
+
return "5.1.105";
|
26032
25789
|
};
|
26033
25790
|
/** {@link ElementWrapper#dispose}
|
26034
25791
|
* @override
|