@refinitiv-ui/efx-grid 6.0.47 → 6.0.49
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +186 -204
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +0 -2
- package/lib/core/es6/data/DataView.js +81 -170
- package/lib/core/es6/data/Segment.d.ts +0 -2
- package/lib/core/es6/data/Segment.js +0 -6
- package/lib/core/es6/grid/Core.d.ts +4 -0
- package/lib/core/es6/grid/Core.js +105 -28
- package/lib/grid/index.js +1 -1
- package/lib/types/es6/Core/data/DataView.d.ts +0 -2
- package/lib/types/es6/Core/data/Segment.d.ts +0 -2
- package/lib/types/es6/Core/grid/Core.d.ts +4 -0
- package/package.json +1 -1
package/lib/core/dist/core.js
CHANGED
@@ -13778,12 +13778,6 @@ Segment.prototype.getChildIds = function() {
|
|
13778
13778
|
return this._childCount ? Object.keys(this._children) : [];
|
13779
13779
|
};
|
13780
13780
|
/** @public
|
13781
|
-
* @return {!Object}
|
13782
|
-
*/
|
13783
|
-
Segment.prototype.getChildren = function() {
|
13784
|
-
return this._children;
|
13785
|
-
};
|
13786
|
-
/** @public
|
13787
13781
|
* @return {number}
|
13788
13782
|
*/
|
13789
13783
|
Segment.prototype.getChildCount = function() {
|
@@ -18899,8 +18893,6 @@ var DataView = function(source) {
|
|
18899
18893
|
t._onRefreshTimeout = t._onRefreshTimeout.bind(t);
|
18900
18894
|
t._updateWrapCount = t._updateWrapCount.bind(t);
|
18901
18895
|
|
18902
|
-
t._byRemovalMap = t._byRemovalMap.bind(t);
|
18903
|
-
|
18904
18896
|
t._rids = [];
|
18905
18897
|
t._sortingDefs = [];
|
18906
18898
|
t._columnStats = {};
|
@@ -18954,15 +18946,6 @@ DataView.prototype._hiddenRids = null;
|
|
18954
18946
|
* @type {Object.<string, boolean>}
|
18955
18947
|
*/
|
18956
18948
|
DataView.prototype._collapsedRids = null; // for segmentation
|
18957
|
-
/** @private
|
18958
|
-
* @type {Object.<string, number>}
|
18959
|
-
*/
|
18960
|
-
DataView.prototype._excludedRids = null;
|
18961
|
-
/** @private
|
18962
|
-
* @type {boolean}
|
18963
|
-
*/
|
18964
|
-
DataView.prototype._emptySegmentFiltering = false;
|
18965
|
-
|
18966
18949
|
/** @private
|
18967
18950
|
* @type {Object.<string, number>}
|
18968
18951
|
*/
|
@@ -19659,6 +19642,8 @@ DataView.prototype.hideRow = function(rId, hidden) {
|
|
19659
19642
|
*/
|
19660
19643
|
DataView.prototype.hideRows = function(rowRefs, hidden) {
|
19661
19644
|
hidden = hidden !== false;
|
19645
|
+
var dirty = false;
|
19646
|
+
var rids = this._toRowIds(rowRefs);
|
19662
19647
|
var hiddenRids = this._hiddenRids;
|
19663
19648
|
|
19664
19649
|
if(hidden){
|
@@ -19669,19 +19654,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
19669
19654
|
return; // All rows are visible
|
19670
19655
|
}
|
19671
19656
|
|
19672
|
-
var rids = this._toRowIds(rowRefs);
|
19673
|
-
var dirty = false;
|
19674
|
-
|
19675
19657
|
for(var i = rids.length; --i >= 0;) {
|
19676
19658
|
var rid = rids[i];
|
19677
19659
|
if(rid) { // undefined, null, and an empty string value are not a valid row id
|
19678
|
-
if(hidden) {
|
19679
|
-
|
19680
|
-
hiddenRids[rid] = true;
|
19681
|
-
dirty = true;
|
19682
|
-
}
|
19683
|
-
} else if(hiddenRids[rid]) {
|
19684
|
-
delete hiddenRids[rid];
|
19660
|
+
if(!!hiddenRids[rid] !== hidden) {
|
19661
|
+
hiddenRids[rid] = hidden;
|
19685
19662
|
dirty = true;
|
19686
19663
|
}
|
19687
19664
|
}
|
@@ -19690,9 +19667,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
19690
19667
|
if(dirty) {
|
19691
19668
|
if(!hidden) {
|
19692
19669
|
var hasHiddenRow = false;
|
19693
|
-
for(var key in hiddenRids) {
|
19694
|
-
|
19695
|
-
|
19670
|
+
for(var key in hiddenRids) {
|
19671
|
+
if(hiddenRids[key]) {
|
19672
|
+
hasHiddenRow = true;
|
19673
|
+
break;
|
19674
|
+
}
|
19696
19675
|
}
|
19697
19676
|
if(!hasHiddenRow) {
|
19698
19677
|
hiddenRids = this._hiddenRids = null;
|
@@ -19781,14 +19760,23 @@ DataView.prototype.filterOut = function(cid, value) {
|
|
19781
19760
|
*/
|
19782
19761
|
DataView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
|
19783
19762
|
var checker = this._getFilterLogic(cid, value);
|
19763
|
+
if(!checker) { return; }
|
19764
|
+
|
19765
|
+
var filteringOut = (opt_filteringOut === true);
|
19766
|
+
var rids = this._rids;
|
19767
|
+
var dt = this._dt;
|
19784
19768
|
var removalMap = {};
|
19785
|
-
|
19786
|
-
|
19787
|
-
|
19788
|
-
|
19789
|
-
|
19790
|
-
|
19769
|
+
var totalRem = 0;
|
19770
|
+
var len = rids.length;
|
19771
|
+
for(var i = len; --i >= 0;) {
|
19772
|
+
var rid = rids[i];
|
19773
|
+
var values = dt.getRowData(rid);
|
19774
|
+
if (!values || checker(rid, values) === filteringOut) {
|
19775
|
+
removalMap[rid] = true;
|
19776
|
+
++totalRem;
|
19777
|
+
}
|
19791
19778
|
}
|
19779
|
+
if(totalRem <= 0) { return; }
|
19792
19780
|
|
19793
19781
|
var firstChange = this._removeRowIds(removalMap);
|
19794
19782
|
|
@@ -19811,13 +19799,13 @@ DataView.prototype.filterOutOnce = function(cid, value) {
|
|
19811
19799
|
this.filterInOnce(cid, value, true);
|
19812
19800
|
};
|
19813
19801
|
/** @private
|
19814
|
-
* @param {!Object} removalMap
|
19802
|
+
* @param {!Object.<string, *>} removalMap
|
19815
19803
|
* @return {number}
|
19816
19804
|
*/
|
19817
19805
|
DataView.prototype._removeRowIds = function(removalMap) {
|
19818
|
-
var firstChange =
|
19806
|
+
var firstChange = this._removeArrayItems(this._rids, removalMap);
|
19819
19807
|
if(this._groupView) {
|
19820
|
-
firstChange =
|
19808
|
+
firstChange = this._removeArrayItems(this._groupView, removalMap);
|
19821
19809
|
}
|
19822
19810
|
|
19823
19811
|
if(this._groupMembers) {
|
@@ -21395,19 +21383,6 @@ DataView.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
|
|
21395
21383
|
DataView.prototype.sortSegments = function (compare) {
|
21396
21384
|
this._dt.sortSegments(compare);
|
21397
21385
|
};
|
21398
|
-
/** Automatically hide empty segment when all of its member are filtered out. An empty segment will not be hidden, if there is no active filter. Collapsed segment does not count as filtering.
|
21399
|
-
* @public
|
21400
|
-
* @param {boolean=} enabled
|
21401
|
-
*/
|
21402
|
-
DataView.prototype.enableEmptySegmentFiltering = function (enabled) {
|
21403
|
-
enabled = enabled !== false;
|
21404
|
-
if(this._emptySegmentFiltering !== enabled) {
|
21405
|
-
this._emptySegmentFiltering = enabled;
|
21406
|
-
if(this._userFilter) {
|
21407
|
-
this._refreshAndNotify();
|
21408
|
-
}
|
21409
|
-
}
|
21410
|
-
};
|
21411
21386
|
|
21412
21387
|
/**
|
21413
21388
|
* @public
|
@@ -21568,35 +21543,26 @@ DataView.prototype._updateRowIds = function(opt_rowIds) {
|
|
21568
21543
|
// Perform the following sequences: parent view cloning >> row hiding >> row filtering >> row grouping >> sorting >> paging
|
21569
21544
|
this._rids = opt_rowIds || this._parent.getAllRowIds(); // Get all data ids
|
21570
21545
|
|
21571
|
-
this.
|
21572
|
-
|
21573
|
-
|
21574
|
-
var exclusionCount = 0;
|
21575
|
-
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._hiddenRids);
|
21576
|
-
|
21577
|
-
// Segment separators should not be filtered out (hidden)
|
21546
|
+
if(this._hiddenRids) {
|
21547
|
+
this._removeArrayItems(this._rids, this._hiddenRids);
|
21548
|
+
}
|
21578
21549
|
var segments = this._dt._getSegmentSeparators();
|
21579
|
-
var filterExceptions = segments ? segments.getSegments() : null;
|
21580
|
-
var userRemoval = this._getRemovalMap(this._excludedRids, this._userFilter, this._filteringOut, filterExceptions);
|
21581
|
-
exclusionCount += userRemoval;
|
21582
|
-
|
21583
21550
|
this._collapsedRids = null;
|
21551
|
+
var filterExceptions = null;
|
21584
21552
|
if(segments) {
|
21585
|
-
|
21586
|
-
|
21553
|
+
filterExceptions = segments.getSegments(); // Segment separators should not be filtered out (hidden)
|
21554
|
+
var collapsedRows = this._collapsedRids = segments.getCollapsedRows(); // Children of collapsed segments must be filtered out (hidden)
|
21555
|
+
if(collapsedRows) {
|
21556
|
+
this._removeArrayItems(this._rids, collapsedRows);
|
21587
21557
|
}
|
21588
|
-
this._collapsedRids = segments.getCollapsedRows();
|
21589
|
-
// Children of collapsed segments must be filtered out (hidden)
|
21590
|
-
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._collapsedRids);
|
21591
21558
|
}
|
21592
21559
|
|
21593
|
-
|
21594
|
-
|
21595
|
-
|
21596
|
-
if(
|
21597
|
-
this.
|
21560
|
+
this._dispatch("beforeFiltering", {});
|
21561
|
+
this._quickFilter(this._userFilter, this._filteringOut, filterExceptions);
|
21562
|
+
|
21563
|
+
if(this._groupLevel > 0 && !opt_rowIds) {
|
21564
|
+
this._quickFilter(this._groupFilterLogic, false); // Filter In
|
21598
21565
|
}
|
21599
|
-
this._excludedRids = null;
|
21600
21566
|
|
21601
21567
|
if(this._groupMembers) { // Has grouping
|
21602
21568
|
this._populateGroups(); // View will be properly re-populate inside _populateGroups()
|
@@ -21868,9 +21834,9 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
21868
21834
|
|
21869
21835
|
if(this._groupLevel > 0) {
|
21870
21836
|
if(processingFlag === 1) { // The row is moved to the other group
|
21871
|
-
if(
|
21837
|
+
if(this._removeArrayItem(this._rids, rid) >= 0) {
|
21872
21838
|
if(this._groupView) {
|
21873
|
-
|
21839
|
+
this._removeArrayItem(this._groupView, rid);
|
21874
21840
|
}
|
21875
21841
|
}
|
21876
21842
|
if(this._shared.multiGroupRow) {
|
@@ -22070,31 +22036,34 @@ DataView.prototype._getRowIndex = function(rids, opt_nextRid, opt_fallback) {
|
|
22070
22036
|
* @returns {number}
|
22071
22037
|
*/
|
22072
22038
|
DataView.prototype._removeDataRow = function(rid) {
|
22073
|
-
var at =
|
22039
|
+
var at = this._removeArrayItem(this._rids, rid);
|
22074
22040
|
if(this._groupView && at >= 0) {
|
22075
|
-
at =
|
22041
|
+
at = this._removeArrayItem(this._groupView, rid);
|
22076
22042
|
}
|
22077
22043
|
return at;
|
22078
22044
|
};
|
22079
22045
|
/** @private
|
22080
|
-
* @param {
|
22046
|
+
* @param {Array} ary
|
22081
22047
|
* @param {*} item
|
22082
22048
|
* @return {number} Index of the removed item
|
22083
22049
|
*/
|
22084
|
-
DataView._removeArrayItem = function(ary, item) {
|
22085
|
-
var
|
22086
|
-
|
22087
|
-
ary
|
22050
|
+
DataView.prototype._removeArrayItem = function(ary, item) {
|
22051
|
+
var len = ary.length;
|
22052
|
+
for(var i = 0; i < len; ++i) {
|
22053
|
+
if(ary[i] === item) {
|
22054
|
+
ary.splice(i, 1);
|
22055
|
+
return i;
|
22056
|
+
}
|
22088
22057
|
}
|
22089
|
-
return
|
22058
|
+
return -1;
|
22090
22059
|
};
|
22091
22060
|
/** Remove multiple array items
|
22092
22061
|
* @private
|
22093
22062
|
* @param {Array.<string>} ary
|
22094
|
-
* @param {Object} items
|
22063
|
+
* @param {Object.<string, *>} items
|
22095
22064
|
* @return {number} First item index that is being removed. NaN if no item is removed
|
22096
22065
|
*/
|
22097
|
-
DataView._removeArrayItems = function(ary, items) {
|
22066
|
+
DataView.prototype._removeArrayItems = function(ary, items) {
|
22098
22067
|
var f = NaN;
|
22099
22068
|
var c = 0;
|
22100
22069
|
for(var i = ary.length; --i >= 0;) {
|
@@ -22113,23 +22082,6 @@ DataView._removeArrayItems = function(ary, items) {
|
|
22113
22082
|
return f;
|
22114
22083
|
};
|
22115
22084
|
/** @private
|
22116
|
-
* @param {Object} baseObj
|
22117
|
-
* @param {Object} masterObj
|
22118
|
-
* @returns {number}
|
22119
|
-
*/
|
22120
|
-
DataView._copyObjectKeys = function(baseObj, masterObj) {
|
22121
|
-
if(masterObj) {
|
22122
|
-
var count = 0;
|
22123
|
-
|
22124
|
-
for(var key in masterObj) {
|
22125
|
-
baseObj[key] = 1;
|
22126
|
-
++count; // WARNING: duplicated key can be counted more than once
|
22127
|
-
}
|
22128
|
-
return count;
|
22129
|
-
}
|
22130
|
-
return 0;
|
22131
|
-
};
|
22132
|
-
/** @private
|
22133
22085
|
* @param {string|null} rid
|
22134
22086
|
* @param {Object} rowData
|
22135
22087
|
* @return {boolean}
|
@@ -22163,6 +22115,9 @@ DataView.prototype.isRowFiltered = function(rid, rowData) {
|
|
22163
22115
|
return true;
|
22164
22116
|
}
|
22165
22117
|
}
|
22118
|
+
if(this.isSegmentSeparator(rid)) {
|
22119
|
+
return false; // Segment separator cannot be filtered
|
22120
|
+
}
|
22166
22121
|
if(this._collapsedRids) {
|
22167
22122
|
if(this._collapsedRids[rid]) {
|
22168
22123
|
return true;
|
@@ -22204,90 +22159,40 @@ DataView.prototype._sort = function() {
|
|
22204
22159
|
};
|
22205
22160
|
|
22206
22161
|
/** @private
|
22207
|
-
* @param {string} rid
|
22208
|
-
* @returns {boolean}
|
22209
|
-
*/
|
22210
|
-
DataView.prototype._byRemovalMap = function(rid) {
|
22211
|
-
return !this._excludedRids[rid];
|
22212
|
-
};
|
22213
|
-
/** @private
|
22214
|
-
* @param {Object} removalMap
|
22215
22162
|
* @param {Function} checker
|
22216
22163
|
* @param {boolean} filteringOut
|
22217
22164
|
* @param {Object=} exceptions
|
22218
|
-
* @returns {number} Number of rids that would be filtered out
|
22219
22165
|
*/
|
22220
|
-
DataView.prototype.
|
22166
|
+
DataView.prototype._quickFilter = function(checker, filteringOut, exceptions) {
|
22221
22167
|
if(!checker) {
|
22222
|
-
return
|
22168
|
+
return;
|
22223
22169
|
}
|
22224
22170
|
|
22225
22171
|
var rids = this._rids; // Make local variable to speed up the process
|
22226
|
-
var dt = this._dt;
|
22227
|
-
var count = 0;
|
22228
|
-
var rid, i, values;
|
22229
22172
|
var len = rids.length;
|
22230
|
-
|
22231
|
-
|
22232
|
-
|
22233
|
-
|
22234
|
-
|
22235
|
-
|
22236
|
-
|
22237
|
-
if(checker(rid, values) === filteringOut) {
|
22238
|
-
removalMap[rid] = 1;
|
22239
|
-
++count;
|
22240
|
-
}
|
22241
|
-
} else {
|
22242
|
-
removalMap[rid] = 1;
|
22243
|
-
++count;
|
22244
|
-
}
|
22245
|
-
}
|
22246
|
-
}
|
22247
|
-
} else {
|
22248
|
-
for(i = len; --i >= 0;) {
|
22249
|
-
rid = rids[i];
|
22250
|
-
values = dt.getRowData(rid);
|
22173
|
+
var dt = this._dt;
|
22174
|
+
var spliceCount = 0;
|
22175
|
+
for(var i = len; --i >= 0;) {
|
22176
|
+
var rid = rids[i];
|
22177
|
+
var removed = false;
|
22178
|
+
if(!exceptions || !exceptions[rid]) {
|
22179
|
+
var values = dt.getRowData(rid);
|
22251
22180
|
if (values) {
|
22252
|
-
|
22253
|
-
removalMap[rid] = 1;
|
22254
|
-
++count;
|
22255
|
-
}
|
22181
|
+
removed = checker(rid, values) === filteringOut;
|
22256
22182
|
} else {
|
22257
|
-
|
22258
|
-
++count;
|
22183
|
+
removed = true;
|
22259
22184
|
}
|
22260
22185
|
}
|
22261
|
-
|
22262
|
-
|
22263
|
-
}
|
22264
|
-
|
22265
|
-
|
22266
|
-
* @param {Object} segmentRids
|
22267
|
-
* @returns {number} Number of rids that would be filtered out
|
22268
|
-
*/
|
22269
|
-
DataView.prototype._getEmptySegments = function(removalMap, segmentRids) {
|
22270
|
-
var segments = this._dt._getSegmentSeparators();
|
22271
|
-
var count = 0;
|
22272
|
-
for(var segmentId in segmentRids) {
|
22273
|
-
var segment = segments.getSegment(segmentId);
|
22274
|
-
if(segment) {
|
22275
|
-
var chdr = segment.getChildren();
|
22276
|
-
var emptySegment = true;
|
22277
|
-
for(var childId in chdr) {
|
22278
|
-
if(!removalMap[childId]) {
|
22279
|
-
emptySegment = false;
|
22280
|
-
break;
|
22281
|
-
}
|
22282
|
-
}
|
22283
|
-
if(emptySegment) {
|
22284
|
-
removalMap[segmentId] = 1;
|
22285
|
-
++count;
|
22286
|
-
}
|
22186
|
+
if(removed) {
|
22187
|
+
++spliceCount;
|
22188
|
+
} else if(spliceCount > 0) {
|
22189
|
+
rids.splice(i + 1, spliceCount);
|
22190
|
+
spliceCount = 0;
|
22287
22191
|
}
|
22288
22192
|
}
|
22289
|
-
|
22290
|
-
|
22193
|
+
if(spliceCount > 0) {
|
22194
|
+
rids.splice(0, spliceCount);
|
22195
|
+
}
|
22291
22196
|
};
|
22292
22197
|
/** @private
|
22293
22198
|
* @param {string|Function|undefined} cid
|
@@ -22567,13 +22472,13 @@ DataView.prototype._removeGroupMember = function (groupIndex, groupId) {
|
|
22567
22472
|
};
|
22568
22473
|
/** @private
|
22569
22474
|
* @param {string} cid
|
22570
|
-
* @param {Object} values
|
22475
|
+
* @param {Object.<string, *>} values
|
22571
22476
|
* @return {Array.<string>}
|
22572
22477
|
*/
|
22573
22478
|
DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
22574
22479
|
var val = values[cid];
|
22575
22480
|
if(Array.isArray(val)) {
|
22576
|
-
return val.map(function(data) {
|
22481
|
+
return val.map(function(data) {
|
22577
22482
|
return data + "";
|
22578
22483
|
});
|
22579
22484
|
} else {
|
@@ -22582,11 +22487,11 @@ DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
|
22582
22487
|
};
|
22583
22488
|
/** @private
|
22584
22489
|
* @param {string|null} rid
|
22585
|
-
* @param {Object} values
|
22490
|
+
* @param {Object.<string, *>} values
|
22586
22491
|
* @return {boolean}
|
22587
22492
|
*/
|
22588
22493
|
DataView.prototype._groupFilterLogic = function(rid, values) {
|
22589
|
-
var gids = this._groupCriteria[this._groupLevel - 1](values);
|
22494
|
+
var gids = this._groupCriteria[this._groupLevel - 1](values);
|
22590
22495
|
return gids.indexOf(this._groupId) >= 0;
|
22591
22496
|
};
|
22592
22497
|
|
@@ -25495,6 +25400,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
|
|
25495
25400
|
* @property {string} rowId
|
25496
25401
|
* @property {number} rowIndex
|
25497
25402
|
*/
|
25403
|
+
/** @event Core#beforeContentBinding */
|
25498
25404
|
/** @event Core#postSectionDataBinding */
|
25499
25405
|
/** @event Core#rowHighlighted */
|
25500
25406
|
|
@@ -25545,6 +25451,7 @@ var Core_Core = function (opt_initializer) {
|
|
25545
25451
|
|
25546
25452
|
_t._onMouseMove = _t._onMouseMove.bind(_t);
|
25547
25453
|
_t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
|
25454
|
+
_t._onGridClicked = _t._onGridClicked.bind(_t);
|
25548
25455
|
|
25549
25456
|
_t._onWindowResize = _t._onWindowResize.bind(_t);
|
25550
25457
|
_t._onSectionDataChanged = _t._onSectionDataChanged.bind(_t);
|
@@ -25630,11 +25537,16 @@ var Core_Core = function (opt_initializer) {
|
|
25630
25537
|
_t._hscrollbar.setOtherScrollbar(_t._vscrollbar);
|
25631
25538
|
_t._vscrollbar.setOtherScrollbar(_t._hscrollbar);
|
25632
25539
|
|
25633
|
-
if (util.isMobile) {
|
25540
|
+
if (util.isMobile || util.isTouchDevice) {
|
25634
25541
|
_t._element.addEventListener("touchmove", this._onMouseMove, false);
|
25635
25542
|
} else {
|
25636
25543
|
_t._element.addEventListener("mousemove", this._onMouseMove, false);
|
25637
25544
|
}
|
25545
|
+
|
25546
|
+
if(util.isSafari){
|
25547
|
+
_t._element.addEventListener("click", this._onGridClicked);
|
25548
|
+
}
|
25549
|
+
|
25638
25550
|
window.addEventListener("resize", _t._onWindowResize, false); // Should be unlistened after destroyed
|
25639
25551
|
_t._rowVirtualizer.listen("indexChanged", _t._onRowInViewChanged);
|
25640
25552
|
_t._colVirtualizer.listen("indexChanged", _t._onColInViewChanged);
|
@@ -25657,6 +25569,7 @@ var Core_Core = function (opt_initializer) {
|
|
25657
25569
|
"postDataSourceChanged",
|
25658
25570
|
"preSectionRender",
|
25659
25571
|
"postSectionRender",
|
25572
|
+
"beforeContentBinding",
|
25660
25573
|
"preSectionDataBinding",
|
25661
25574
|
"postSectionDataBinding",
|
25662
25575
|
"rowExpansionBinding",
|
@@ -26018,7 +25931,7 @@ Core_Core.prototype._batches = null;
|
|
26018
25931
|
* @return {string}
|
26019
25932
|
*/
|
26020
25933
|
Core_Core.getVersion = function () {
|
26021
|
-
return "5.1.
|
25934
|
+
return "5.1.67";
|
26022
25935
|
};
|
26023
25936
|
/** {@link ElementWrapper#dispose}
|
26024
25937
|
* @override
|
@@ -26820,6 +26733,7 @@ Core_Core.prototype.getColumnCount = function () {
|
|
26820
26733
|
* @fires Core#columnAdded
|
26821
26734
|
* @fires Core#preSectionRender
|
26822
26735
|
* @fires Core#columnRender
|
26736
|
+
* @fires Core#beforeContentBinding
|
26823
26737
|
* @fires Core#preSectionDataBinding
|
26824
26738
|
* @fires Core#columnDataBinding
|
26825
26739
|
* @fires Core#postSectionDataBinding
|
@@ -26847,6 +26761,7 @@ Core_Core.prototype.setColumnCount = function(num) {
|
|
26847
26761
|
* @fires Core#columnAdded
|
26848
26762
|
* @fires Core#preSectionRender
|
26849
26763
|
* @fires Core#columnRender
|
26764
|
+
* @fires Core#beforeContentBinding
|
26850
26765
|
* @fires Core#preSectionDataBinding
|
26851
26766
|
* @fires Core#columnDataBinding
|
26852
26767
|
* @fires Core#postSectionDataBinding
|
@@ -26963,16 +26878,12 @@ Core_Core.prototype.removeColumnAt = function (index) {
|
|
26963
26878
|
|
26964
26879
|
if (this._hasListener("columnRemoved")) {
|
26965
26880
|
var e = {};
|
26966
|
-
var batches = this._batches;
|
26967
|
-
if(batches){
|
26968
|
-
e["batches"] = batches;
|
26969
|
-
}
|
26970
26881
|
e["atTheMiddle"] = true;
|
26971
26882
|
e["colIndex"] = index;
|
26972
26883
|
e["columns"] = "deprecated";
|
26973
26884
|
e["columnData"] = colDef["columnData"];
|
26974
26885
|
e["colId"] = colDef["id"] || "";
|
26975
|
-
this.
|
26886
|
+
this._dispatchColumnEvent("columnRemoved", e);
|
26976
26887
|
}
|
26977
26888
|
|
26978
26889
|
// Last index in view here might be different from before moving column if columns have different width.
|
@@ -27225,7 +27136,7 @@ Core_Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
27225
27136
|
e["fromColIndex"] = fromCol;
|
27226
27137
|
e["toColIndex"] = destCol;
|
27227
27138
|
e["colId"] = colId; // TODO: Id may not needed
|
27228
|
-
this.
|
27139
|
+
this._dispatchColumnEvent("columnMoved", e); // add remove move
|
27229
27140
|
}
|
27230
27141
|
|
27231
27142
|
// Last index in view here might be different from before moving column if columns have different width.
|
@@ -27295,6 +27206,9 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
27295
27206
|
destId = destCol;
|
27296
27207
|
}
|
27297
27208
|
|
27209
|
+
this.startBatch("move");
|
27210
|
+
|
27211
|
+
var dirty = 0;
|
27298
27212
|
if(Array.isArray(colRefs)) {
|
27299
27213
|
var srcLen = colRefs.length;
|
27300
27214
|
if(srcLen > 1) {
|
@@ -27337,7 +27251,6 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
27337
27251
|
}
|
27338
27252
|
}
|
27339
27253
|
|
27340
|
-
var dirty = 0;
|
27341
27254
|
for(i = srcLen; --i >= 0;) {
|
27342
27255
|
srcId = srcIds[i]; // Only valid source columns are left at this point
|
27343
27256
|
srcIdx = this.getColumnIndex(srcId);
|
@@ -27348,17 +27261,15 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
27348
27261
|
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
27349
27262
|
destId = srcId;
|
27350
27263
|
}
|
27351
|
-
return dirty ? true : false;
|
27352
27264
|
} else {
|
27353
|
-
|
27265
|
+
dirty = this.moveColumnById(colRefs[0], destId);
|
27354
27266
|
}
|
27355
|
-
}
|
27356
|
-
|
27357
|
-
if(colRefs != null) {
|
27267
|
+
} else if(colRefs != null) {
|
27358
27268
|
// colRefs will be a number or string
|
27359
|
-
|
27269
|
+
dirty = this.moveColumnById(colRefs, destId);
|
27360
27270
|
}
|
27361
|
-
|
27271
|
+
this.stopBatch("move");
|
27272
|
+
return dirty ? true : false;
|
27362
27273
|
};
|
27363
27274
|
|
27364
27275
|
/** @public
|
@@ -27465,6 +27376,7 @@ Core_Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
27465
27376
|
* @param {number=} opt_num Default is one row
|
27466
27377
|
* @fires Core#preSectionRender
|
27467
27378
|
* @fires Core#columnRender
|
27379
|
+
* @fires Core#beforeContentBinding
|
27468
27380
|
* @fires Core#preSectionDataBinding
|
27469
27381
|
* @fires Core#columnDataBinding
|
27470
27382
|
* @fires Core#postSectionDataBinding
|
@@ -29268,6 +29180,7 @@ Core_Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
|
29268
29180
|
* @param {number=} fromRowIndex INCLUSIVE If the value is undefined, the first row index will be used
|
29269
29181
|
* @param {number=} lastRowIndex INCLUSIVE If the value is undefined, the last row index will be used
|
29270
29182
|
* @param {Object=} userParam Addtional parameters to be fired with the event
|
29183
|
+
* @fires Core#beforeContentBinding
|
29271
29184
|
* @fires Core#preSectionDataBinding
|
29272
29185
|
* @fires Core#columnDataBinding
|
29273
29186
|
* @fires Core#postSectionDataBinding
|
@@ -29873,6 +29786,53 @@ Core_Core.prototype.getColumnGroupChildIds = function (groupId) {
|
|
29873
29786
|
return null;
|
29874
29787
|
};
|
29875
29788
|
|
29789
|
+
/** @public
|
29790
|
+
* @description Get a list of objects with column id and column index in sorted order
|
29791
|
+
* @param {Array.<string>} colIds
|
29792
|
+
* @param {Object=} columnMap
|
29793
|
+
* @return {!Array.<string>} Return column array with corresponding order to UI
|
29794
|
+
* @example
|
29795
|
+
* core.getValidColumnList(["c1","c2","c5"]); // Get list of valid columns
|
29796
|
+
* core.getValidColumnList(["c1","c2","c5"],{ "c2":true, "c5":true }); // Get list of valid columns from specific mapping
|
29797
|
+
*/
|
29798
|
+
Core_Core.prototype.getValidColumnList = function (colIds, columnMap) {
|
29799
|
+
var colList = [];
|
29800
|
+
if(!colIds){
|
29801
|
+
return colList;
|
29802
|
+
}
|
29803
|
+
if(!columnMap){
|
29804
|
+
columnMap = this.createColumnMap(colIds);
|
29805
|
+
}
|
29806
|
+
var colCount = this.getColumnCount();
|
29807
|
+
for(var c = 0; c < colCount; ++c) {
|
29808
|
+
var id = this._getColumnDef(c)["id"];
|
29809
|
+
if(columnMap[id] != null){
|
29810
|
+
colList.push({"index": c, "id": id});
|
29811
|
+
}
|
29812
|
+
}
|
29813
|
+
return colList;
|
29814
|
+
};
|
29815
|
+
|
29816
|
+
/** @public
|
29817
|
+
* @description Create mapping object from an array of strings
|
29818
|
+
* @param {Array.<string>=} colIds
|
29819
|
+
* @return {!Object} Column mapping object
|
29820
|
+
*/
|
29821
|
+
Core_Core.prototype.createColumnMap = function (colIds) {
|
29822
|
+
if(!colIds){
|
29823
|
+
colIds = this.getColumnIds();
|
29824
|
+
}
|
29825
|
+
var mappingObj = {};
|
29826
|
+
var count = colIds.length;
|
29827
|
+
for(var i = 0; i < count; i++){
|
29828
|
+
var colId = colIds[i];
|
29829
|
+
if(colId){
|
29830
|
+
mappingObj[colId] = true;
|
29831
|
+
}
|
29832
|
+
}
|
29833
|
+
return mappingObj;
|
29834
|
+
};
|
29835
|
+
|
29876
29836
|
/** @public
|
29877
29837
|
* @param {string} batchType
|
29878
29838
|
* @return {boolean}
|
@@ -29910,6 +29870,17 @@ Core_Core.prototype.stopBatch = function (batchType) {
|
|
29910
29870
|
|
29911
29871
|
//#region Private Methods
|
29912
29872
|
/** @private
|
29873
|
+
* @param {string} type
|
29874
|
+
* @param {!Object} eventArg
|
29875
|
+
*/
|
29876
|
+
Core_Core.prototype._dispatchColumnEvent = function (type, eventArg) {
|
29877
|
+
var batches = this._batches;
|
29878
|
+
if(batches){
|
29879
|
+
eventArg["batches"] = batches;
|
29880
|
+
}
|
29881
|
+
this._dispatch(type, eventArg);
|
29882
|
+
};
|
29883
|
+
/** @private
|
29913
29884
|
*/
|
29914
29885
|
Core_Core.prototype._dispatchColumnPositionChanged = function () {
|
29915
29886
|
if(this._columnPositionConflator.conflate()) {
|
@@ -30149,20 +30120,16 @@ Core_Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle
|
|
30149
30120
|
if (this._hasListener("columnAdded")) {
|
30150
30121
|
var e = {};
|
30151
30122
|
e["atTheMiddle"] = atTheMiddle;
|
30152
|
-
var batches = this._batches;
|
30153
|
-
if(batches){
|
30154
|
-
e["batches"] = batches;
|
30155
|
-
}
|
30156
30123
|
if(count === 1) {
|
30157
30124
|
e["colIndex"] = at;
|
30158
30125
|
e["context"] = ctx;
|
30159
|
-
this.
|
30126
|
+
this._dispatchColumnEvent("columnAdded", e);
|
30160
30127
|
} else {
|
30161
30128
|
var ary = Array.isArray(ctx) ? ctx : [];
|
30162
30129
|
for (var i = 0; i < count; ++i) {
|
30163
30130
|
e["colIndex"] = at + i;
|
30164
30131
|
e["context"] = ary[i];
|
30165
|
-
this.
|
30132
|
+
this._dispatchColumnEvent("columnAdded", e);
|
30166
30133
|
}
|
30167
30134
|
}
|
30168
30135
|
}
|
@@ -30304,15 +30271,11 @@ Core_Core.prototype._removeColumn = function (num) { // TODO: change the logic
|
|
30304
30271
|
|
30305
30272
|
if (this._hasListener("columnRemoved")) {
|
30306
30273
|
var e = {};
|
30307
|
-
var batches = this._batches;
|
30308
|
-
if(batches){
|
30309
|
-
e["batches"] = batches;
|
30310
|
-
}
|
30311
30274
|
for (var c = colCount; --c >= newCount; ) {
|
30312
30275
|
var colDef = removedCols[c - newCount];
|
30313
30276
|
e["colIndex"] = c;
|
30314
30277
|
e["columnData"] = colDef ? colDef["columnData"] : null;
|
30315
|
-
this.
|
30278
|
+
this._dispatchColumnEvent("columnRemoved", e);
|
30316
30279
|
}
|
30317
30280
|
}
|
30318
30281
|
};
|
@@ -30345,6 +30308,9 @@ Core_Core.prototype._onSectionDataChanged = function (e) {
|
|
30345
30308
|
rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
|
30346
30309
|
e["dataRows"] = rowDataCollection;
|
30347
30310
|
}
|
30311
|
+
if(e["sectionType"] === "content"){
|
30312
|
+
this._dispatch("beforeContentBinding", e);
|
30313
|
+
}
|
30348
30314
|
this._dispatch("preSectionDataBinding", e);
|
30349
30315
|
|
30350
30316
|
var dataMap = this.getDataColumnMap();
|
@@ -30359,9 +30325,13 @@ Core_Core.prototype._onSectionDataChanged = function (e) {
|
|
30359
30325
|
for (var r = fromR; r < toR; ++r) {
|
30360
30326
|
if(hasDataView) {
|
30361
30327
|
var rowData = rowDataCollection[r];
|
30328
|
+
if(!rowData) { // This is a header row
|
30329
|
+
continue;
|
30330
|
+
}
|
30331
|
+
|
30362
30332
|
e["rowData"] = rowData;
|
30363
30333
|
e["rowId"] = rids[r];
|
30364
|
-
e["dataValue"] = rowData
|
30334
|
+
e["dataValue"] = rowData[cid];
|
30365
30335
|
}
|
30366
30336
|
e["rowIndex"] = r;
|
30367
30337
|
e["cell"] = section["getCell"](c, r, false); // Accessing cell by using bracket allows extenal object to mock Section
|
@@ -30702,6 +30672,18 @@ Core_Core.prototype._onMouseMove = function () {
|
|
30702
30672
|
this._vscrollbar.flash();
|
30703
30673
|
this._hscrollbar.flash();
|
30704
30674
|
};
|
30675
|
+
/** @private */
|
30676
|
+
Core_Core.prototype._onGridClicked = function () {
|
30677
|
+
// research for dragging
|
30678
|
+
var selection = window.getSelection();
|
30679
|
+
if(selection.toString()){
|
30680
|
+
return;
|
30681
|
+
}
|
30682
|
+
var activeElem = document.activeElement;
|
30683
|
+
if(!this._element.contains(activeElem)){
|
30684
|
+
this.focus();
|
30685
|
+
}
|
30686
|
+
};
|
30705
30687
|
|
30706
30688
|
/** @private
|
30707
30689
|
* @param {Object} e
|