@refinitiv-ui/efx-grid 6.0.46 → 6.0.48
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +314 -205
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +2 -0
- package/lib/core/es6/data/DataTable.js +97 -1
- package/lib/core/es6/data/DataView.d.ts +2 -2
- package/lib/core/es6/data/DataView.js +90 -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/core/es6/grid/plugins/SortableTitlePlugin.d.ts +2 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +22 -0
- package/lib/grid/index.js +1 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +2 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +2 -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() {
|
@@ -14948,6 +14942,14 @@ DataTable.prototype._removedRows = null;
|
|
14948
14942
|
*/
|
14949
14943
|
DataTable.prototype._userSegmentComparer = null;
|
14950
14944
|
/** @private
|
14945
|
+
* @type {number}
|
14946
|
+
*/
|
14947
|
+
DataTable.prototype._segmentSortOrder = 0;
|
14948
|
+
/** @private
|
14949
|
+
* @type {*}
|
14950
|
+
*/
|
14951
|
+
DataTable.prototype._segmentSortContext = null;
|
14952
|
+
/** @private
|
14951
14953
|
* @type {Object.<string, Object>}
|
14952
14954
|
*/
|
14953
14955
|
DataTable.prototype._clsSource = null;
|
@@ -16120,6 +16122,51 @@ DataTable.prototype.getSegmentChildIds = function(segmentId) {
|
|
16120
16122
|
}
|
16121
16123
|
return null;
|
16122
16124
|
};
|
16125
|
+
/** Sort all of existing segments by multiple sort logics
|
16126
|
+
* @public
|
16127
|
+
* @param {Function|Array.<Function>} sortLogics
|
16128
|
+
* @param {Array.<number>} sortOrders
|
16129
|
+
* @param {Array.<string>} cids
|
16130
|
+
* @return {boolean}
|
16131
|
+
*/
|
16132
|
+
DataTable.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
|
16133
|
+
var dirty = false;
|
16134
|
+
if(!this._segments){
|
16135
|
+
return false;
|
16136
|
+
}
|
16137
|
+
if(typeof sortLogics === "function"){
|
16138
|
+
return this.sortSegments(sortLogics);
|
16139
|
+
}
|
16140
|
+
var sortingDefs = DataTable._buildSortContext(
|
16141
|
+
[],
|
16142
|
+
cids,
|
16143
|
+
sortOrders,
|
16144
|
+
sortLogics
|
16145
|
+
);
|
16146
|
+
var defCount = sortingDefs ? sortingDefs.length : 0;
|
16147
|
+
if(!defCount){
|
16148
|
+
return dirty;
|
16149
|
+
}
|
16150
|
+
|
16151
|
+
var sortOrder = 0;
|
16152
|
+
var sortLogic, sortContext;
|
16153
|
+
if(defCount > 1) {
|
16154
|
+
sortLogic = DataTable._multiColumnSeparatorCompareLogic;
|
16155
|
+
sortContext = sortingDefs;
|
16156
|
+
sortOrder = 1; // sortOrder is not used by _multiColumnSeparatorCompareLogic
|
16157
|
+
} else { // Single level sorting
|
16158
|
+
sortLogic = DataTable._singleColumnSeparatorCompareLogic;
|
16159
|
+
sortContext = sortingDefs[0];
|
16160
|
+
sortOrder = /** @type{number} */(sortContext[3]);
|
16161
|
+
}
|
16162
|
+
this._segmentSortOrder = sortOrder;
|
16163
|
+
this._segmentSortContext = sortContext;
|
16164
|
+
dirty = this.sortSegments(sortLogic);
|
16165
|
+
this._segmentSortOrder = 0;
|
16166
|
+
this._segmentSortContext = null;
|
16167
|
+
|
16168
|
+
return dirty;
|
16169
|
+
};
|
16123
16170
|
/** Sort all of existing segments by given compare function
|
16124
16171
|
* @public
|
16125
16172
|
* @param {Function} compare
|
@@ -16188,7 +16235,9 @@ DataTable.prototype.sortSegments = function (compare) {
|
|
16188
16235
|
DataTable.prototype._bySegmentSeparator = function (segmentA, segmentB) {
|
16189
16236
|
return /** @type{number} */(this._userSegmentComparer(
|
16190
16237
|
this.getRowData(segmentA.getId()),
|
16191
|
-
this.getRowData(segmentB.getId())
|
16238
|
+
this.getRowData(segmentB.getId()),
|
16239
|
+
this._segmentSortOrder,
|
16240
|
+
this._segmentSortContext
|
16192
16241
|
));
|
16193
16242
|
};
|
16194
16243
|
|
@@ -16529,6 +16578,47 @@ DataTable._singleColumnCompareLogic = function(a, b, order, sortingDef) {
|
|
16529
16578
|
sortingDef[4] // Context object
|
16530
16579
|
));
|
16531
16580
|
};
|
16581
|
+
/** Performance is extremely vital in this method
|
16582
|
+
* @public
|
16583
|
+
* @ignore
|
16584
|
+
* @function
|
16585
|
+
* @param {*} a
|
16586
|
+
* @param {*} b
|
16587
|
+
* @param {number} order Not used by in this method
|
16588
|
+
* @param {Array.<Array>} sortingDefs
|
16589
|
+
* @return {number}
|
16590
|
+
*/
|
16591
|
+
DataTable._multiColumnSeparatorCompareLogic = function(a, b, order, sortingDefs) {
|
16592
|
+
var count = sortingDefs.length;
|
16593
|
+
var result = 0;
|
16594
|
+
for(var c = 0; c < count; ++c) {
|
16595
|
+
var sortingDef = sortingDefs[c];
|
16596
|
+
result = DataTable._singleColumnSeparatorCompareLogic(a, b, sortingDef[3], sortingDef);
|
16597
|
+
if(result) {
|
16598
|
+
return result;
|
16599
|
+
}
|
16600
|
+
}
|
16601
|
+
return result;
|
16602
|
+
};
|
16603
|
+
/** Performance is extremely vital in this method
|
16604
|
+
* @public
|
16605
|
+
* @ignore
|
16606
|
+
* @function
|
16607
|
+
* @param {*} a
|
16608
|
+
* @param {*} b
|
16609
|
+
* @param {number} order
|
16610
|
+
* @param {Array} sortingDef
|
16611
|
+
* @return {number}
|
16612
|
+
*/
|
16613
|
+
DataTable._singleColumnSeparatorCompareLogic = function(a, b, order, sortingDef) {
|
16614
|
+
var key = /** @type{string} */(sortingDef[0]);
|
16615
|
+
return /** @type{number} */(sortingDef[2](
|
16616
|
+
a[key], // Value1
|
16617
|
+
b[key], // Value2
|
16618
|
+
order, // Sort order (3)
|
16619
|
+
sortingDef[4] // Context object
|
16620
|
+
));
|
16621
|
+
};
|
16532
16622
|
/** @public
|
16533
16623
|
* @function
|
16534
16624
|
* @ignore
|
@@ -18803,8 +18893,6 @@ var DataView = function(source) {
|
|
18803
18893
|
t._onRefreshTimeout = t._onRefreshTimeout.bind(t);
|
18804
18894
|
t._updateWrapCount = t._updateWrapCount.bind(t);
|
18805
18895
|
|
18806
|
-
t._byRemovalMap = t._byRemovalMap.bind(t);
|
18807
|
-
|
18808
18896
|
t._rids = [];
|
18809
18897
|
t._sortingDefs = [];
|
18810
18898
|
t._columnStats = {};
|
@@ -18858,15 +18946,6 @@ DataView.prototype._hiddenRids = null;
|
|
18858
18946
|
* @type {Object.<string, boolean>}
|
18859
18947
|
*/
|
18860
18948
|
DataView.prototype._collapsedRids = null; // for segmentation
|
18861
|
-
/** @private
|
18862
|
-
* @type {Object.<string, number>}
|
18863
|
-
*/
|
18864
|
-
DataView.prototype._excludedRids = null;
|
18865
|
-
/** @private
|
18866
|
-
* @type {boolean}
|
18867
|
-
*/
|
18868
|
-
DataView.prototype._emptySegmentFiltering = false;
|
18869
|
-
|
18870
18949
|
/** @private
|
18871
18950
|
* @type {Object.<string, number>}
|
18872
18951
|
*/
|
@@ -19563,6 +19642,8 @@ DataView.prototype.hideRow = function(rId, hidden) {
|
|
19563
19642
|
*/
|
19564
19643
|
DataView.prototype.hideRows = function(rowRefs, hidden) {
|
19565
19644
|
hidden = hidden !== false;
|
19645
|
+
var dirty = false;
|
19646
|
+
var rids = this._toRowIds(rowRefs);
|
19566
19647
|
var hiddenRids = this._hiddenRids;
|
19567
19648
|
|
19568
19649
|
if(hidden){
|
@@ -19573,19 +19654,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
19573
19654
|
return; // All rows are visible
|
19574
19655
|
}
|
19575
19656
|
|
19576
|
-
var rids = this._toRowIds(rowRefs);
|
19577
|
-
var dirty = false;
|
19578
|
-
|
19579
19657
|
for(var i = rids.length; --i >= 0;) {
|
19580
19658
|
var rid = rids[i];
|
19581
19659
|
if(rid) { // undefined, null, and an empty string value are not a valid row id
|
19582
|
-
if(hidden) {
|
19583
|
-
|
19584
|
-
hiddenRids[rid] = true;
|
19585
|
-
dirty = true;
|
19586
|
-
}
|
19587
|
-
} else if(hiddenRids[rid]) {
|
19588
|
-
delete hiddenRids[rid];
|
19660
|
+
if(!!hiddenRids[rid] !== hidden) {
|
19661
|
+
hiddenRids[rid] = hidden;
|
19589
19662
|
dirty = true;
|
19590
19663
|
}
|
19591
19664
|
}
|
@@ -19594,9 +19667,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
19594
19667
|
if(dirty) {
|
19595
19668
|
if(!hidden) {
|
19596
19669
|
var hasHiddenRow = false;
|
19597
|
-
for(var key in hiddenRids) {
|
19598
|
-
|
19599
|
-
|
19670
|
+
for(var key in hiddenRids) {
|
19671
|
+
if(hiddenRids[key]) {
|
19672
|
+
hasHiddenRow = true;
|
19673
|
+
break;
|
19674
|
+
}
|
19600
19675
|
}
|
19601
19676
|
if(!hasHiddenRow) {
|
19602
19677
|
hiddenRids = this._hiddenRids = null;
|
@@ -19685,14 +19760,23 @@ DataView.prototype.filterOut = function(cid, value) {
|
|
19685
19760
|
*/
|
19686
19761
|
DataView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
|
19687
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;
|
19688
19768
|
var removalMap = {};
|
19689
|
-
|
19690
|
-
|
19691
|
-
|
19692
|
-
|
19693
|
-
|
19694
|
-
|
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
|
+
}
|
19695
19778
|
}
|
19779
|
+
if(totalRem <= 0) { return; }
|
19696
19780
|
|
19697
19781
|
var firstChange = this._removeRowIds(removalMap);
|
19698
19782
|
|
@@ -19715,13 +19799,13 @@ DataView.prototype.filterOutOnce = function(cid, value) {
|
|
19715
19799
|
this.filterInOnce(cid, value, true);
|
19716
19800
|
};
|
19717
19801
|
/** @private
|
19718
|
-
* @param {!Object} removalMap
|
19802
|
+
* @param {!Object.<string, *>} removalMap
|
19719
19803
|
* @return {number}
|
19720
19804
|
*/
|
19721
19805
|
DataView.prototype._removeRowIds = function(removalMap) {
|
19722
|
-
var firstChange =
|
19806
|
+
var firstChange = this._removeArrayItems(this._rids, removalMap);
|
19723
19807
|
if(this._groupView) {
|
19724
|
-
firstChange =
|
19808
|
+
firstChange = this._removeArrayItems(this._groupView, removalMap);
|
19725
19809
|
}
|
19726
19810
|
|
19727
19811
|
if(this._groupMembers) {
|
@@ -21283,6 +21367,15 @@ DataView.prototype.getSegmentIds = function() {
|
|
21283
21367
|
DataView.prototype.getSegmentChildIds = function(segmentRef) {
|
21284
21368
|
return this._dt.getSegmentChildIds(this._toRowId(segmentRef));
|
21285
21369
|
};
|
21370
|
+
/** Sort all of existing segments by multiple sort logics
|
21371
|
+
* @public
|
21372
|
+
* @param {Array.<Function>} sortLogics
|
21373
|
+
* @param {Array.<number>} sortOrders
|
21374
|
+
* @param {Array.<string>} cids
|
21375
|
+
*/
|
21376
|
+
DataView.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
|
21377
|
+
this._dt.sortSeparators(sortLogics, sortOrders, cids);
|
21378
|
+
};
|
21286
21379
|
/** Sort all of existing segments by given compare function
|
21287
21380
|
* @public
|
21288
21381
|
* @param {Function} compare
|
@@ -21290,19 +21383,6 @@ DataView.prototype.getSegmentChildIds = function(segmentRef) {
|
|
21290
21383
|
DataView.prototype.sortSegments = function (compare) {
|
21291
21384
|
this._dt.sortSegments(compare);
|
21292
21385
|
};
|
21293
|
-
/** 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.
|
21294
|
-
* @public
|
21295
|
-
* @param {boolean=} enabled
|
21296
|
-
*/
|
21297
|
-
DataView.prototype.enableEmptySegmentFiltering = function (enabled) {
|
21298
|
-
enabled = enabled !== false;
|
21299
|
-
if(this._emptySegmentFiltering !== enabled) {
|
21300
|
-
this._emptySegmentFiltering = enabled;
|
21301
|
-
if(this._userFilter) {
|
21302
|
-
this._refreshAndNotify();
|
21303
|
-
}
|
21304
|
-
}
|
21305
|
-
};
|
21306
21386
|
|
21307
21387
|
/**
|
21308
21388
|
* @public
|
@@ -21463,35 +21543,26 @@ DataView.prototype._updateRowIds = function(opt_rowIds) {
|
|
21463
21543
|
// Perform the following sequences: parent view cloning >> row hiding >> row filtering >> row grouping >> sorting >> paging
|
21464
21544
|
this._rids = opt_rowIds || this._parent.getAllRowIds(); // Get all data ids
|
21465
21545
|
|
21466
|
-
this.
|
21467
|
-
|
21468
|
-
|
21469
|
-
var exclusionCount = 0;
|
21470
|
-
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._hiddenRids);
|
21471
|
-
|
21472
|
-
// Segment separators should not be filtered out (hidden)
|
21546
|
+
if(this._hiddenRids) {
|
21547
|
+
this._removeArrayItems(this._rids, this._hiddenRids);
|
21548
|
+
}
|
21473
21549
|
var segments = this._dt._getSegmentSeparators();
|
21474
|
-
var filterExceptions = segments ? segments.getSegments() : null;
|
21475
|
-
var userRemoval = this._getRemovalMap(this._excludedRids, this._userFilter, this._filteringOut, filterExceptions);
|
21476
|
-
exclusionCount += userRemoval;
|
21477
|
-
|
21478
21550
|
this._collapsedRids = null;
|
21551
|
+
var filterExceptions = null;
|
21479
21552
|
if(segments) {
|
21480
|
-
|
21481
|
-
|
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);
|
21482
21557
|
}
|
21483
|
-
this._collapsedRids = segments.getCollapsedRows();
|
21484
|
-
// Children of collapsed segments must be filtered out (hidden)
|
21485
|
-
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._collapsedRids);
|
21486
21558
|
}
|
21487
21559
|
|
21488
|
-
|
21489
|
-
|
21490
|
-
|
21491
|
-
if(
|
21492
|
-
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
|
21493
21565
|
}
|
21494
|
-
this._excludedRids = null;
|
21495
21566
|
|
21496
21567
|
if(this._groupMembers) { // Has grouping
|
21497
21568
|
this._populateGroups(); // View will be properly re-populate inside _populateGroups()
|
@@ -21763,9 +21834,9 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
21763
21834
|
|
21764
21835
|
if(this._groupLevel > 0) {
|
21765
21836
|
if(processingFlag === 1) { // The row is moved to the other group
|
21766
|
-
if(
|
21837
|
+
if(this._removeArrayItem(this._rids, rid) >= 0) {
|
21767
21838
|
if(this._groupView) {
|
21768
|
-
|
21839
|
+
this._removeArrayItem(this._groupView, rid);
|
21769
21840
|
}
|
21770
21841
|
}
|
21771
21842
|
if(this._shared.multiGroupRow) {
|
@@ -21965,31 +22036,34 @@ DataView.prototype._getRowIndex = function(rids, opt_nextRid, opt_fallback) {
|
|
21965
22036
|
* @returns {number}
|
21966
22037
|
*/
|
21967
22038
|
DataView.prototype._removeDataRow = function(rid) {
|
21968
|
-
var at =
|
22039
|
+
var at = this._removeArrayItem(this._rids, rid);
|
21969
22040
|
if(this._groupView && at >= 0) {
|
21970
|
-
at =
|
22041
|
+
at = this._removeArrayItem(this._groupView, rid);
|
21971
22042
|
}
|
21972
22043
|
return at;
|
21973
22044
|
};
|
21974
22045
|
/** @private
|
21975
|
-
* @param {
|
22046
|
+
* @param {Array} ary
|
21976
22047
|
* @param {*} item
|
21977
22048
|
* @return {number} Index of the removed item
|
21978
22049
|
*/
|
21979
|
-
DataView._removeArrayItem = function(ary, item) {
|
21980
|
-
var
|
21981
|
-
|
21982
|
-
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
|
+
}
|
21983
22057
|
}
|
21984
|
-
return
|
22058
|
+
return -1;
|
21985
22059
|
};
|
21986
22060
|
/** Remove multiple array items
|
21987
22061
|
* @private
|
21988
22062
|
* @param {Array.<string>} ary
|
21989
|
-
* @param {Object} items
|
22063
|
+
* @param {Object.<string, *>} items
|
21990
22064
|
* @return {number} First item index that is being removed. NaN if no item is removed
|
21991
22065
|
*/
|
21992
|
-
DataView._removeArrayItems = function(ary, items) {
|
22066
|
+
DataView.prototype._removeArrayItems = function(ary, items) {
|
21993
22067
|
var f = NaN;
|
21994
22068
|
var c = 0;
|
21995
22069
|
for(var i = ary.length; --i >= 0;) {
|
@@ -22008,23 +22082,6 @@ DataView._removeArrayItems = function(ary, items) {
|
|
22008
22082
|
return f;
|
22009
22083
|
};
|
22010
22084
|
/** @private
|
22011
|
-
* @param {Object} baseObj
|
22012
|
-
* @param {Object} masterObj
|
22013
|
-
* @returns {number}
|
22014
|
-
*/
|
22015
|
-
DataView._copyObjectKeys = function(baseObj, masterObj) {
|
22016
|
-
if(masterObj) {
|
22017
|
-
var count = 0;
|
22018
|
-
|
22019
|
-
for(var key in masterObj) {
|
22020
|
-
baseObj[key] = 1;
|
22021
|
-
++count; // WARNING: duplicated key can be counted more than once
|
22022
|
-
}
|
22023
|
-
return count;
|
22024
|
-
}
|
22025
|
-
return 0;
|
22026
|
-
};
|
22027
|
-
/** @private
|
22028
22085
|
* @param {string|null} rid
|
22029
22086
|
* @param {Object} rowData
|
22030
22087
|
* @return {boolean}
|
@@ -22058,6 +22115,9 @@ DataView.prototype.isRowFiltered = function(rid, rowData) {
|
|
22058
22115
|
return true;
|
22059
22116
|
}
|
22060
22117
|
}
|
22118
|
+
if(this.isSegmentSeparator(rid)) {
|
22119
|
+
return false; // Segment separator cannot be filtered
|
22120
|
+
}
|
22061
22121
|
if(this._collapsedRids) {
|
22062
22122
|
if(this._collapsedRids[rid]) {
|
22063
22123
|
return true;
|
@@ -22099,90 +22159,40 @@ DataView.prototype._sort = function() {
|
|
22099
22159
|
};
|
22100
22160
|
|
22101
22161
|
/** @private
|
22102
|
-
* @param {string} rid
|
22103
|
-
* @returns {boolean}
|
22104
|
-
*/
|
22105
|
-
DataView.prototype._byRemovalMap = function(rid) {
|
22106
|
-
return !this._excludedRids[rid];
|
22107
|
-
};
|
22108
|
-
/** @private
|
22109
|
-
* @param {Object} removalMap
|
22110
22162
|
* @param {Function} checker
|
22111
22163
|
* @param {boolean} filteringOut
|
22112
22164
|
* @param {Object=} exceptions
|
22113
|
-
* @returns {number} Number of rids that would be filtered out
|
22114
22165
|
*/
|
22115
|
-
DataView.prototype.
|
22166
|
+
DataView.prototype._quickFilter = function(checker, filteringOut, exceptions) {
|
22116
22167
|
if(!checker) {
|
22117
|
-
return
|
22168
|
+
return;
|
22118
22169
|
}
|
22119
22170
|
|
22120
22171
|
var rids = this._rids; // Make local variable to speed up the process
|
22121
|
-
var dt = this._dt;
|
22122
|
-
var count = 0;
|
22123
|
-
var rid, i, values;
|
22124
22172
|
var len = rids.length;
|
22125
|
-
|
22126
|
-
|
22127
|
-
|
22128
|
-
|
22129
|
-
|
22130
|
-
|
22131
|
-
|
22132
|
-
if(checker(rid, values) === filteringOut) {
|
22133
|
-
removalMap[rid] = 1;
|
22134
|
-
++count;
|
22135
|
-
}
|
22136
|
-
} else {
|
22137
|
-
removalMap[rid] = 1;
|
22138
|
-
++count;
|
22139
|
-
}
|
22140
|
-
}
|
22141
|
-
}
|
22142
|
-
} else {
|
22143
|
-
for(i = len; --i >= 0;) {
|
22144
|
-
rid = rids[i];
|
22145
|
-
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);
|
22146
22180
|
if (values) {
|
22147
|
-
|
22148
|
-
removalMap[rid] = 1;
|
22149
|
-
++count;
|
22150
|
-
}
|
22181
|
+
removed = checker(rid, values) === filteringOut;
|
22151
22182
|
} else {
|
22152
|
-
|
22153
|
-
++count;
|
22183
|
+
removed = true;
|
22154
22184
|
}
|
22155
22185
|
}
|
22156
|
-
|
22157
|
-
|
22158
|
-
}
|
22159
|
-
|
22160
|
-
|
22161
|
-
* @param {Object} segmentRids
|
22162
|
-
* @returns {number} Number of rids that would be filtered out
|
22163
|
-
*/
|
22164
|
-
DataView.prototype._getEmptySegments = function(removalMap, segmentRids) {
|
22165
|
-
var segments = this._dt._getSegmentSeparators();
|
22166
|
-
var count = 0;
|
22167
|
-
for(var segmentId in segmentRids) {
|
22168
|
-
var segment = segments.getSegment(segmentId);
|
22169
|
-
if(segment) {
|
22170
|
-
var chdr = segment.getChildren();
|
22171
|
-
var emptySegment = true;
|
22172
|
-
for(var childId in chdr) {
|
22173
|
-
if(!removalMap[childId]) {
|
22174
|
-
emptySegment = false;
|
22175
|
-
break;
|
22176
|
-
}
|
22177
|
-
}
|
22178
|
-
if(emptySegment) {
|
22179
|
-
removalMap[segmentId] = 1;
|
22180
|
-
++count;
|
22181
|
-
}
|
22186
|
+
if(removed) {
|
22187
|
+
++spliceCount;
|
22188
|
+
} else if(spliceCount > 0) {
|
22189
|
+
rids.splice(i + 1, spliceCount);
|
22190
|
+
spliceCount = 0;
|
22182
22191
|
}
|
22183
22192
|
}
|
22184
|
-
|
22185
|
-
|
22193
|
+
if(spliceCount > 0) {
|
22194
|
+
rids.splice(0, spliceCount);
|
22195
|
+
}
|
22186
22196
|
};
|
22187
22197
|
/** @private
|
22188
22198
|
* @param {string|Function|undefined} cid
|
@@ -22462,13 +22472,13 @@ DataView.prototype._removeGroupMember = function (groupIndex, groupId) {
|
|
22462
22472
|
};
|
22463
22473
|
/** @private
|
22464
22474
|
* @param {string} cid
|
22465
|
-
* @param {Object} values
|
22475
|
+
* @param {Object.<string, *>} values
|
22466
22476
|
* @return {Array.<string>}
|
22467
22477
|
*/
|
22468
22478
|
DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
22469
22479
|
var val = values[cid];
|
22470
22480
|
if(Array.isArray(val)) {
|
22471
|
-
return val.map(function(data) {
|
22481
|
+
return val.map(function(data) {
|
22472
22482
|
return data + "";
|
22473
22483
|
});
|
22474
22484
|
} else {
|
@@ -22477,11 +22487,11 @@ DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
|
22477
22487
|
};
|
22478
22488
|
/** @private
|
22479
22489
|
* @param {string|null} rid
|
22480
|
-
* @param {Object} values
|
22490
|
+
* @param {Object.<string, *>} values
|
22481
22491
|
* @return {boolean}
|
22482
22492
|
*/
|
22483
22493
|
DataView.prototype._groupFilterLogic = function(rid, values) {
|
22484
|
-
var gids = this._groupCriteria[this._groupLevel - 1](values);
|
22494
|
+
var gids = this._groupCriteria[this._groupLevel - 1](values);
|
22485
22495
|
return gids.indexOf(this._groupId) >= 0;
|
22486
22496
|
};
|
22487
22497
|
|
@@ -25390,6 +25400,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
|
|
25390
25400
|
* @property {string} rowId
|
25391
25401
|
* @property {number} rowIndex
|
25392
25402
|
*/
|
25403
|
+
/** @event Core#beforeContentBinding */
|
25393
25404
|
/** @event Core#postSectionDataBinding */
|
25394
25405
|
/** @event Core#rowHighlighted */
|
25395
25406
|
|
@@ -25440,6 +25451,7 @@ var Core_Core = function (opt_initializer) {
|
|
25440
25451
|
|
25441
25452
|
_t._onMouseMove = _t._onMouseMove.bind(_t);
|
25442
25453
|
_t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
|
25454
|
+
_t._onGridClicked = _t._onGridClicked.bind(_t);
|
25443
25455
|
|
25444
25456
|
_t._onWindowResize = _t._onWindowResize.bind(_t);
|
25445
25457
|
_t._onSectionDataChanged = _t._onSectionDataChanged.bind(_t);
|
@@ -25525,11 +25537,16 @@ var Core_Core = function (opt_initializer) {
|
|
25525
25537
|
_t._hscrollbar.setOtherScrollbar(_t._vscrollbar);
|
25526
25538
|
_t._vscrollbar.setOtherScrollbar(_t._hscrollbar);
|
25527
25539
|
|
25528
|
-
if (util.isMobile) {
|
25540
|
+
if (util.isMobile || util.isTouchDevice) {
|
25529
25541
|
_t._element.addEventListener("touchmove", this._onMouseMove, false);
|
25530
25542
|
} else {
|
25531
25543
|
_t._element.addEventListener("mousemove", this._onMouseMove, false);
|
25532
25544
|
}
|
25545
|
+
|
25546
|
+
if(util.isSafari){
|
25547
|
+
_t._element.addEventListener("click", this._onGridClicked);
|
25548
|
+
}
|
25549
|
+
|
25533
25550
|
window.addEventListener("resize", _t._onWindowResize, false); // Should be unlistened after destroyed
|
25534
25551
|
_t._rowVirtualizer.listen("indexChanged", _t._onRowInViewChanged);
|
25535
25552
|
_t._colVirtualizer.listen("indexChanged", _t._onColInViewChanged);
|
@@ -25552,6 +25569,7 @@ var Core_Core = function (opt_initializer) {
|
|
25552
25569
|
"postDataSourceChanged",
|
25553
25570
|
"preSectionRender",
|
25554
25571
|
"postSectionRender",
|
25572
|
+
"beforeContentBinding",
|
25555
25573
|
"preSectionDataBinding",
|
25556
25574
|
"postSectionDataBinding",
|
25557
25575
|
"rowExpansionBinding",
|
@@ -25913,7 +25931,7 @@ Core_Core.prototype._batches = null;
|
|
25913
25931
|
* @return {string}
|
25914
25932
|
*/
|
25915
25933
|
Core_Core.getVersion = function () {
|
25916
|
-
return "5.1.
|
25934
|
+
return "5.1.67";
|
25917
25935
|
};
|
25918
25936
|
/** {@link ElementWrapper#dispose}
|
25919
25937
|
* @override
|
@@ -26715,6 +26733,7 @@ Core_Core.prototype.getColumnCount = function () {
|
|
26715
26733
|
* @fires Core#columnAdded
|
26716
26734
|
* @fires Core#preSectionRender
|
26717
26735
|
* @fires Core#columnRender
|
26736
|
+
* @fires Core#beforeContentBinding
|
26718
26737
|
* @fires Core#preSectionDataBinding
|
26719
26738
|
* @fires Core#columnDataBinding
|
26720
26739
|
* @fires Core#postSectionDataBinding
|
@@ -26742,6 +26761,7 @@ Core_Core.prototype.setColumnCount = function(num) {
|
|
26742
26761
|
* @fires Core#columnAdded
|
26743
26762
|
* @fires Core#preSectionRender
|
26744
26763
|
* @fires Core#columnRender
|
26764
|
+
* @fires Core#beforeContentBinding
|
26745
26765
|
* @fires Core#preSectionDataBinding
|
26746
26766
|
* @fires Core#columnDataBinding
|
26747
26767
|
* @fires Core#postSectionDataBinding
|
@@ -26858,16 +26878,12 @@ Core_Core.prototype.removeColumnAt = function (index) {
|
|
26858
26878
|
|
26859
26879
|
if (this._hasListener("columnRemoved")) {
|
26860
26880
|
var e = {};
|
26861
|
-
var batches = this._batches;
|
26862
|
-
if(batches){
|
26863
|
-
e["batches"] = batches;
|
26864
|
-
}
|
26865
26881
|
e["atTheMiddle"] = true;
|
26866
26882
|
e["colIndex"] = index;
|
26867
26883
|
e["columns"] = "deprecated";
|
26868
26884
|
e["columnData"] = colDef["columnData"];
|
26869
26885
|
e["colId"] = colDef["id"] || "";
|
26870
|
-
this.
|
26886
|
+
this._dispatchColumnEvent("columnRemoved", e);
|
26871
26887
|
}
|
26872
26888
|
|
26873
26889
|
// Last index in view here might be different from before moving column if columns have different width.
|
@@ -27120,7 +27136,7 @@ Core_Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
27120
27136
|
e["fromColIndex"] = fromCol;
|
27121
27137
|
e["toColIndex"] = destCol;
|
27122
27138
|
e["colId"] = colId; // TODO: Id may not needed
|
27123
|
-
this.
|
27139
|
+
this._dispatchColumnEvent("columnMoved", e); // add remove move
|
27124
27140
|
}
|
27125
27141
|
|
27126
27142
|
// Last index in view here might be different from before moving column if columns have different width.
|
@@ -27190,6 +27206,9 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
27190
27206
|
destId = destCol;
|
27191
27207
|
}
|
27192
27208
|
|
27209
|
+
this.startBatch("move");
|
27210
|
+
|
27211
|
+
var dirty = 0;
|
27193
27212
|
if(Array.isArray(colRefs)) {
|
27194
27213
|
var srcLen = colRefs.length;
|
27195
27214
|
if(srcLen > 1) {
|
@@ -27232,7 +27251,6 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
27232
27251
|
}
|
27233
27252
|
}
|
27234
27253
|
|
27235
|
-
var dirty = 0;
|
27236
27254
|
for(i = srcLen; --i >= 0;) {
|
27237
27255
|
srcId = srcIds[i]; // Only valid source columns are left at this point
|
27238
27256
|
srcIdx = this.getColumnIndex(srcId);
|
@@ -27243,17 +27261,15 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
27243
27261
|
dirty |= this._moveColumnByIndex(srcIdx, destIdx);
|
27244
27262
|
destId = srcId;
|
27245
27263
|
}
|
27246
|
-
return dirty ? true : false;
|
27247
27264
|
} else {
|
27248
|
-
|
27265
|
+
dirty = this.moveColumnById(colRefs[0], destId);
|
27249
27266
|
}
|
27250
|
-
}
|
27251
|
-
|
27252
|
-
if(colRefs != null) {
|
27267
|
+
} else if(colRefs != null) {
|
27253
27268
|
// colRefs will be a number or string
|
27254
|
-
|
27269
|
+
dirty = this.moveColumnById(colRefs, destId);
|
27255
27270
|
}
|
27256
|
-
|
27271
|
+
this.stopBatch("move");
|
27272
|
+
return dirty ? true : false;
|
27257
27273
|
};
|
27258
27274
|
|
27259
27275
|
/** @public
|
@@ -27360,6 +27376,7 @@ Core_Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
27360
27376
|
* @param {number=} opt_num Default is one row
|
27361
27377
|
* @fires Core#preSectionRender
|
27362
27378
|
* @fires Core#columnRender
|
27379
|
+
* @fires Core#beforeContentBinding
|
27363
27380
|
* @fires Core#preSectionDataBinding
|
27364
27381
|
* @fires Core#columnDataBinding
|
27365
27382
|
* @fires Core#postSectionDataBinding
|
@@ -29163,6 +29180,7 @@ Core_Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
|
29163
29180
|
* @param {number=} fromRowIndex INCLUSIVE If the value is undefined, the first row index will be used
|
29164
29181
|
* @param {number=} lastRowIndex INCLUSIVE If the value is undefined, the last row index will be used
|
29165
29182
|
* @param {Object=} userParam Addtional parameters to be fired with the event
|
29183
|
+
* @fires Core#beforeContentBinding
|
29166
29184
|
* @fires Core#preSectionDataBinding
|
29167
29185
|
* @fires Core#columnDataBinding
|
29168
29186
|
* @fires Core#postSectionDataBinding
|
@@ -29768,6 +29786,53 @@ Core_Core.prototype.getColumnGroupChildIds = function (groupId) {
|
|
29768
29786
|
return null;
|
29769
29787
|
};
|
29770
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
|
+
|
29771
29836
|
/** @public
|
29772
29837
|
* @param {string} batchType
|
29773
29838
|
* @return {boolean}
|
@@ -29805,6 +29870,17 @@ Core_Core.prototype.stopBatch = function (batchType) {
|
|
29805
29870
|
|
29806
29871
|
//#region Private Methods
|
29807
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
|
29808
29884
|
*/
|
29809
29885
|
Core_Core.prototype._dispatchColumnPositionChanged = function () {
|
29810
29886
|
if(this._columnPositionConflator.conflate()) {
|
@@ -30044,20 +30120,16 @@ Core_Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle
|
|
30044
30120
|
if (this._hasListener("columnAdded")) {
|
30045
30121
|
var e = {};
|
30046
30122
|
e["atTheMiddle"] = atTheMiddle;
|
30047
|
-
var batches = this._batches;
|
30048
|
-
if(batches){
|
30049
|
-
e["batches"] = batches;
|
30050
|
-
}
|
30051
30123
|
if(count === 1) {
|
30052
30124
|
e["colIndex"] = at;
|
30053
30125
|
e["context"] = ctx;
|
30054
|
-
this.
|
30126
|
+
this._dispatchColumnEvent("columnAdded", e);
|
30055
30127
|
} else {
|
30056
30128
|
var ary = Array.isArray(ctx) ? ctx : [];
|
30057
30129
|
for (var i = 0; i < count; ++i) {
|
30058
30130
|
e["colIndex"] = at + i;
|
30059
30131
|
e["context"] = ary[i];
|
30060
|
-
this.
|
30132
|
+
this._dispatchColumnEvent("columnAdded", e);
|
30061
30133
|
}
|
30062
30134
|
}
|
30063
30135
|
}
|
@@ -30199,15 +30271,11 @@ Core_Core.prototype._removeColumn = function (num) { // TODO: change the logic
|
|
30199
30271
|
|
30200
30272
|
if (this._hasListener("columnRemoved")) {
|
30201
30273
|
var e = {};
|
30202
|
-
var batches = this._batches;
|
30203
|
-
if(batches){
|
30204
|
-
e["batches"] = batches;
|
30205
|
-
}
|
30206
30274
|
for (var c = colCount; --c >= newCount; ) {
|
30207
30275
|
var colDef = removedCols[c - newCount];
|
30208
30276
|
e["colIndex"] = c;
|
30209
30277
|
e["columnData"] = colDef ? colDef["columnData"] : null;
|
30210
|
-
this.
|
30278
|
+
this._dispatchColumnEvent("columnRemoved", e);
|
30211
30279
|
}
|
30212
30280
|
}
|
30213
30281
|
};
|
@@ -30240,6 +30308,9 @@ Core_Core.prototype._onSectionDataChanged = function (e) {
|
|
30240
30308
|
rowDataCollection = dataView.getMultipleRowData(rids, fromR, toR);
|
30241
30309
|
e["dataRows"] = rowDataCollection;
|
30242
30310
|
}
|
30311
|
+
if(e["sectionType"] === "content"){
|
30312
|
+
this._dispatch("beforeContentBinding", e);
|
30313
|
+
}
|
30243
30314
|
this._dispatch("preSectionDataBinding", e);
|
30244
30315
|
|
30245
30316
|
var dataMap = this.getDataColumnMap();
|
@@ -30254,9 +30325,13 @@ Core_Core.prototype._onSectionDataChanged = function (e) {
|
|
30254
30325
|
for (var r = fromR; r < toR; ++r) {
|
30255
30326
|
if(hasDataView) {
|
30256
30327
|
var rowData = rowDataCollection[r];
|
30328
|
+
if(!rowData) { // This is a header row
|
30329
|
+
continue;
|
30330
|
+
}
|
30331
|
+
|
30257
30332
|
e["rowData"] = rowData;
|
30258
30333
|
e["rowId"] = rids[r];
|
30259
|
-
e["dataValue"] = rowData
|
30334
|
+
e["dataValue"] = rowData[cid];
|
30260
30335
|
}
|
30261
30336
|
e["rowIndex"] = r;
|
30262
30337
|
e["cell"] = section["getCell"](c, r, false); // Accessing cell by using bracket allows extenal object to mock Section
|
@@ -30597,6 +30672,18 @@ Core_Core.prototype._onMouseMove = function () {
|
|
30597
30672
|
this._vscrollbar.flash();
|
30598
30673
|
this._hscrollbar.flash();
|
30599
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
|
+
};
|
30600
30687
|
|
30601
30688
|
/** @private
|
30602
30689
|
* @param {Object} e
|
@@ -32551,6 +32638,28 @@ SortableTitlePlugin.prototype.setSortingSequence = function (sequence, colRef) {
|
|
32551
32638
|
SortableTitlePlugin.prototype.clearAllColumnSortingSequences = function () {
|
32552
32639
|
this._sortingSequenceMap = null;
|
32553
32640
|
};
|
32641
|
+
/** @public
|
32642
|
+
* @description Sorting all separators according to compare function. If compare function is not specified, separators will will be sort by current sorting states.
|
32643
|
+
* @param {Function} comparer Compare function
|
32644
|
+
*/
|
32645
|
+
SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
|
32646
|
+
var host = this._hosts[0];
|
32647
|
+
var dv = host.getDataSource();
|
32648
|
+
if(comparer){
|
32649
|
+
dv.sortSeparators(comparer);
|
32650
|
+
} else {
|
32651
|
+
var sortLogics = dv.getSortingLogics();
|
32652
|
+
var sortOrders = [];
|
32653
|
+
var sortFields = [];
|
32654
|
+
var sortStateCount = this._sortStates.length;
|
32655
|
+
for(var i = 0; i < sortStateCount; i++){
|
32656
|
+
var sortState = this._sortStates[i];
|
32657
|
+
sortOrders.push(sortState["sortOrder"]);
|
32658
|
+
sortFields.push(sortState["field"]);
|
32659
|
+
}
|
32660
|
+
dv.sortSeparators(sortLogics, sortOrders, sortFields);
|
32661
|
+
}
|
32662
|
+
};
|
32554
32663
|
|
32555
32664
|
|
32556
32665
|
/** @private
|