@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
@@ -276,8 +276,6 @@ declare class DataView extends EventDispatcher {
|
|
276
276
|
|
277
277
|
public sortSegments(compare: ((...params: any[]) => any)|null): void;
|
278
278
|
|
279
|
-
public enableEmptySegmentFiltering(enabled?: boolean|null): void;
|
280
|
-
|
281
279
|
public setSegmentClassification(segmentRef: string|number|null, fields: string|(string)[]|null): boolean;
|
282
280
|
|
283
281
|
public getWrapSize(): number;
|
@@ -68,8 +68,6 @@ var DataView = function(source) {
|
|
68
68
|
t._onRefreshTimeout = t._onRefreshTimeout.bind(t);
|
69
69
|
t._updateWrapCount = t._updateWrapCount.bind(t);
|
70
70
|
|
71
|
-
t._byRemovalMap = t._byRemovalMap.bind(t);
|
72
|
-
|
73
71
|
t._rids = [];
|
74
72
|
t._sortingDefs = [];
|
75
73
|
t._columnStats = {};
|
@@ -123,15 +121,6 @@ DataView.prototype._hiddenRids = null;
|
|
123
121
|
* @type {Object.<string, boolean>}
|
124
122
|
*/
|
125
123
|
DataView.prototype._collapsedRids = null; // for segmentation
|
126
|
-
/** @private
|
127
|
-
* @type {Object.<string, number>}
|
128
|
-
*/
|
129
|
-
DataView.prototype._excludedRids = null;
|
130
|
-
/** @private
|
131
|
-
* @type {boolean}
|
132
|
-
*/
|
133
|
-
DataView.prototype._emptySegmentFiltering = false;
|
134
|
-
|
135
124
|
/** @private
|
136
125
|
* @type {Object.<string, number>}
|
137
126
|
*/
|
@@ -828,6 +817,8 @@ DataView.prototype.hideRow = function(rId, hidden) {
|
|
828
817
|
*/
|
829
818
|
DataView.prototype.hideRows = function(rowRefs, hidden) {
|
830
819
|
hidden = hidden !== false;
|
820
|
+
var dirty = false;
|
821
|
+
var rids = this._toRowIds(rowRefs);
|
831
822
|
var hiddenRids = this._hiddenRids;
|
832
823
|
|
833
824
|
if(hidden){
|
@@ -838,19 +829,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
838
829
|
return; // All rows are visible
|
839
830
|
}
|
840
831
|
|
841
|
-
var rids = this._toRowIds(rowRefs);
|
842
|
-
var dirty = false;
|
843
|
-
|
844
832
|
for(var i = rids.length; --i >= 0;) {
|
845
833
|
var rid = rids[i];
|
846
834
|
if(rid) { // undefined, null, and an empty string value are not a valid row id
|
847
|
-
if(hidden) {
|
848
|
-
|
849
|
-
hiddenRids[rid] = true;
|
850
|
-
dirty = true;
|
851
|
-
}
|
852
|
-
} else if(hiddenRids[rid]) {
|
853
|
-
delete hiddenRids[rid];
|
835
|
+
if(!!hiddenRids[rid] !== hidden) {
|
836
|
+
hiddenRids[rid] = hidden;
|
854
837
|
dirty = true;
|
855
838
|
}
|
856
839
|
}
|
@@ -859,9 +842,11 @@ DataView.prototype.hideRows = function(rowRefs, hidden) {
|
|
859
842
|
if(dirty) {
|
860
843
|
if(!hidden) {
|
861
844
|
var hasHiddenRow = false;
|
862
|
-
for(var key in hiddenRids) {
|
863
|
-
|
864
|
-
|
845
|
+
for(var key in hiddenRids) {
|
846
|
+
if(hiddenRids[key]) {
|
847
|
+
hasHiddenRow = true;
|
848
|
+
break;
|
849
|
+
}
|
865
850
|
}
|
866
851
|
if(!hasHiddenRow) {
|
867
852
|
hiddenRids = this._hiddenRids = null;
|
@@ -950,14 +935,23 @@ DataView.prototype.filterOut = function(cid, value) {
|
|
950
935
|
*/
|
951
936
|
DataView.prototype.filterInOnce = function(cid, value, opt_filteringOut) {
|
952
937
|
var checker = this._getFilterLogic(cid, value);
|
938
|
+
if(!checker) { return; }
|
939
|
+
|
940
|
+
var filteringOut = (opt_filteringOut === true);
|
941
|
+
var rids = this._rids;
|
942
|
+
var dt = this._dt;
|
953
943
|
var removalMap = {};
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
944
|
+
var totalRem = 0;
|
945
|
+
var len = rids.length;
|
946
|
+
for(var i = len; --i >= 0;) {
|
947
|
+
var rid = rids[i];
|
948
|
+
var values = dt.getRowData(rid);
|
949
|
+
if (!values || checker(rid, values) === filteringOut) {
|
950
|
+
removalMap[rid] = true;
|
951
|
+
++totalRem;
|
952
|
+
}
|
960
953
|
}
|
954
|
+
if(totalRem <= 0) { return; }
|
961
955
|
|
962
956
|
var firstChange = this._removeRowIds(removalMap);
|
963
957
|
|
@@ -980,13 +974,13 @@ DataView.prototype.filterOutOnce = function(cid, value) {
|
|
980
974
|
this.filterInOnce(cid, value, true);
|
981
975
|
};
|
982
976
|
/** @private
|
983
|
-
* @param {!Object} removalMap
|
977
|
+
* @param {!Object.<string, *>} removalMap
|
984
978
|
* @return {number}
|
985
979
|
*/
|
986
980
|
DataView.prototype._removeRowIds = function(removalMap) {
|
987
|
-
var firstChange =
|
981
|
+
var firstChange = this._removeArrayItems(this._rids, removalMap);
|
988
982
|
if(this._groupView) {
|
989
|
-
firstChange =
|
983
|
+
firstChange = this._removeArrayItems(this._groupView, removalMap);
|
990
984
|
}
|
991
985
|
|
992
986
|
if(this._groupMembers) {
|
@@ -2564,19 +2558,6 @@ DataView.prototype.sortSeparators = function (sortLogics, sortOrders, cids) {
|
|
2564
2558
|
DataView.prototype.sortSegments = function (compare) {
|
2565
2559
|
this._dt.sortSegments(compare);
|
2566
2560
|
};
|
2567
|
-
/** 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.
|
2568
|
-
* @public
|
2569
|
-
* @param {boolean=} enabled
|
2570
|
-
*/
|
2571
|
-
DataView.prototype.enableEmptySegmentFiltering = function (enabled) {
|
2572
|
-
enabled = enabled !== false;
|
2573
|
-
if(this._emptySegmentFiltering !== enabled) {
|
2574
|
-
this._emptySegmentFiltering = enabled;
|
2575
|
-
if(this._userFilter) {
|
2576
|
-
this._refreshAndNotify();
|
2577
|
-
}
|
2578
|
-
}
|
2579
|
-
};
|
2580
2561
|
|
2581
2562
|
/**
|
2582
2563
|
* @public
|
@@ -2737,35 +2718,26 @@ DataView.prototype._updateRowIds = function(opt_rowIds) {
|
|
2737
2718
|
// Perform the following sequences: parent view cloning >> row hiding >> row filtering >> row grouping >> sorting >> paging
|
2738
2719
|
this._rids = opt_rowIds || this._parent.getAllRowIds(); // Get all data ids
|
2739
2720
|
|
2740
|
-
this.
|
2741
|
-
|
2742
|
-
|
2743
|
-
var exclusionCount = 0;
|
2744
|
-
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._hiddenRids);
|
2745
|
-
|
2746
|
-
// Segment separators should not be filtered out (hidden)
|
2721
|
+
if(this._hiddenRids) {
|
2722
|
+
this._removeArrayItems(this._rids, this._hiddenRids);
|
2723
|
+
}
|
2747
2724
|
var segments = this._dt._getSegmentSeparators();
|
2748
|
-
var filterExceptions = segments ? segments.getSegments() : null;
|
2749
|
-
var userRemoval = this._getRemovalMap(this._excludedRids, this._userFilter, this._filteringOut, filterExceptions);
|
2750
|
-
exclusionCount += userRemoval;
|
2751
|
-
|
2752
2725
|
this._collapsedRids = null;
|
2726
|
+
var filterExceptions = null;
|
2753
2727
|
if(segments) {
|
2754
|
-
|
2755
|
-
|
2728
|
+
filterExceptions = segments.getSegments(); // Segment separators should not be filtered out (hidden)
|
2729
|
+
var collapsedRows = this._collapsedRids = segments.getCollapsedRows(); // Children of collapsed segments must be filtered out (hidden)
|
2730
|
+
if(collapsedRows) {
|
2731
|
+
this._removeArrayItems(this._rids, collapsedRows);
|
2756
2732
|
}
|
2757
|
-
this._collapsedRids = segments.getCollapsedRows();
|
2758
|
-
// Children of collapsed segments must be filtered out (hidden)
|
2759
|
-
exclusionCount += DataView._copyObjectKeys(this._excludedRids, this._collapsedRids);
|
2760
2733
|
}
|
2761
2734
|
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
if(
|
2766
|
-
this.
|
2735
|
+
this._dispatch("beforeFiltering", {});
|
2736
|
+
this._quickFilter(this._userFilter, this._filteringOut, filterExceptions);
|
2737
|
+
|
2738
|
+
if(this._groupLevel > 0 && !opt_rowIds) {
|
2739
|
+
this._quickFilter(this._groupFilterLogic, false); // Filter In
|
2767
2740
|
}
|
2768
|
-
this._excludedRids = null;
|
2769
2741
|
|
2770
2742
|
if(this._groupMembers) { // Has grouping
|
2771
2743
|
this._populateGroups(); // View will be properly re-populate inside _populateGroups()
|
@@ -3037,9 +3009,9 @@ DataView.prototype._onRowUpdated = function(e) { // onUpdate
|
|
3037
3009
|
|
3038
3010
|
if(this._groupLevel > 0) {
|
3039
3011
|
if(processingFlag === 1) { // The row is moved to the other group
|
3040
|
-
if(
|
3012
|
+
if(this._removeArrayItem(this._rids, rid) >= 0) {
|
3041
3013
|
if(this._groupView) {
|
3042
|
-
|
3014
|
+
this._removeArrayItem(this._groupView, rid);
|
3043
3015
|
}
|
3044
3016
|
}
|
3045
3017
|
if(this._shared.multiGroupRow) {
|
@@ -3239,31 +3211,34 @@ DataView.prototype._getRowIndex = function(rids, opt_nextRid, opt_fallback) {
|
|
3239
3211
|
* @returns {number}
|
3240
3212
|
*/
|
3241
3213
|
DataView.prototype._removeDataRow = function(rid) {
|
3242
|
-
var at =
|
3214
|
+
var at = this._removeArrayItem(this._rids, rid);
|
3243
3215
|
if(this._groupView && at >= 0) {
|
3244
|
-
at =
|
3216
|
+
at = this._removeArrayItem(this._groupView, rid);
|
3245
3217
|
}
|
3246
3218
|
return at;
|
3247
3219
|
};
|
3248
3220
|
/** @private
|
3249
|
-
* @param {
|
3221
|
+
* @param {Array} ary
|
3250
3222
|
* @param {*} item
|
3251
3223
|
* @return {number} Index of the removed item
|
3252
3224
|
*/
|
3253
|
-
DataView._removeArrayItem = function(ary, item) {
|
3254
|
-
var
|
3255
|
-
|
3256
|
-
ary
|
3225
|
+
DataView.prototype._removeArrayItem = function(ary, item) {
|
3226
|
+
var len = ary.length;
|
3227
|
+
for(var i = 0; i < len; ++i) {
|
3228
|
+
if(ary[i] === item) {
|
3229
|
+
ary.splice(i, 1);
|
3230
|
+
return i;
|
3231
|
+
}
|
3257
3232
|
}
|
3258
|
-
return
|
3233
|
+
return -1;
|
3259
3234
|
};
|
3260
3235
|
/** Remove multiple array items
|
3261
3236
|
* @private
|
3262
3237
|
* @param {Array.<string>} ary
|
3263
|
-
* @param {Object} items
|
3238
|
+
* @param {Object.<string, *>} items
|
3264
3239
|
* @return {number} First item index that is being removed. NaN if no item is removed
|
3265
3240
|
*/
|
3266
|
-
DataView._removeArrayItems = function(ary, items) {
|
3241
|
+
DataView.prototype._removeArrayItems = function(ary, items) {
|
3267
3242
|
var f = NaN;
|
3268
3243
|
var c = 0;
|
3269
3244
|
for(var i = ary.length; --i >= 0;) {
|
@@ -3282,23 +3257,6 @@ DataView._removeArrayItems = function(ary, items) {
|
|
3282
3257
|
return f;
|
3283
3258
|
};
|
3284
3259
|
/** @private
|
3285
|
-
* @param {Object} baseObj
|
3286
|
-
* @param {Object} masterObj
|
3287
|
-
* @returns {number}
|
3288
|
-
*/
|
3289
|
-
DataView._copyObjectKeys = function(baseObj, masterObj) {
|
3290
|
-
if(masterObj) {
|
3291
|
-
var count = 0;
|
3292
|
-
|
3293
|
-
for(var key in masterObj) {
|
3294
|
-
baseObj[key] = 1;
|
3295
|
-
++count; // WARNING: duplicated key can be counted more than once
|
3296
|
-
}
|
3297
|
-
return count;
|
3298
|
-
}
|
3299
|
-
return 0;
|
3300
|
-
};
|
3301
|
-
/** @private
|
3302
3260
|
* @param {string|null} rid
|
3303
3261
|
* @param {Object} rowData
|
3304
3262
|
* @return {boolean}
|
@@ -3332,6 +3290,9 @@ DataView.prototype.isRowFiltered = function(rid, rowData) {
|
|
3332
3290
|
return true;
|
3333
3291
|
}
|
3334
3292
|
}
|
3293
|
+
if(this.isSegmentSeparator(rid)) {
|
3294
|
+
return false; // Segment separator cannot be filtered
|
3295
|
+
}
|
3335
3296
|
if(this._collapsedRids) {
|
3336
3297
|
if(this._collapsedRids[rid]) {
|
3337
3298
|
return true;
|
@@ -3373,90 +3334,40 @@ DataView.prototype._sort = function() {
|
|
3373
3334
|
};
|
3374
3335
|
|
3375
3336
|
/** @private
|
3376
|
-
* @param {string} rid
|
3377
|
-
* @returns {boolean}
|
3378
|
-
*/
|
3379
|
-
DataView.prototype._byRemovalMap = function(rid) {
|
3380
|
-
return !this._excludedRids[rid];
|
3381
|
-
};
|
3382
|
-
/** @private
|
3383
|
-
* @param {Object} removalMap
|
3384
3337
|
* @param {Function} checker
|
3385
3338
|
* @param {boolean} filteringOut
|
3386
3339
|
* @param {Object=} exceptions
|
3387
|
-
* @returns {number} Number of rids that would be filtered out
|
3388
3340
|
*/
|
3389
|
-
DataView.prototype.
|
3341
|
+
DataView.prototype._quickFilter = function(checker, filteringOut, exceptions) {
|
3390
3342
|
if(!checker) {
|
3391
|
-
return
|
3343
|
+
return;
|
3392
3344
|
}
|
3393
3345
|
|
3394
3346
|
var rids = this._rids; // Make local variable to speed up the process
|
3395
|
-
var dt = this._dt;
|
3396
|
-
var count = 0;
|
3397
|
-
var rid, i, values;
|
3398
3347
|
var len = rids.length;
|
3399
|
-
|
3400
|
-
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
if(checker(rid, values) === filteringOut) {
|
3407
|
-
removalMap[rid] = 1;
|
3408
|
-
++count;
|
3409
|
-
}
|
3410
|
-
} else {
|
3411
|
-
removalMap[rid] = 1;
|
3412
|
-
++count;
|
3413
|
-
}
|
3414
|
-
}
|
3415
|
-
}
|
3416
|
-
} else {
|
3417
|
-
for(i = len; --i >= 0;) {
|
3418
|
-
rid = rids[i];
|
3419
|
-
values = dt.getRowData(rid);
|
3348
|
+
var dt = this._dt;
|
3349
|
+
var spliceCount = 0;
|
3350
|
+
for(var i = len; --i >= 0;) {
|
3351
|
+
var rid = rids[i];
|
3352
|
+
var removed = false;
|
3353
|
+
if(!exceptions || !exceptions[rid]) {
|
3354
|
+
var values = dt.getRowData(rid);
|
3420
3355
|
if (values) {
|
3421
|
-
|
3422
|
-
removalMap[rid] = 1;
|
3423
|
-
++count;
|
3424
|
-
}
|
3356
|
+
removed = checker(rid, values) === filteringOut;
|
3425
3357
|
} else {
|
3426
|
-
|
3427
|
-
++count;
|
3358
|
+
removed = true;
|
3428
3359
|
}
|
3429
3360
|
}
|
3430
|
-
|
3431
|
-
|
3432
|
-
}
|
3433
|
-
|
3434
|
-
|
3435
|
-
* @param {Object} segmentRids
|
3436
|
-
* @returns {number} Number of rids that would be filtered out
|
3437
|
-
*/
|
3438
|
-
DataView.prototype._getEmptySegments = function(removalMap, segmentRids) {
|
3439
|
-
var segments = this._dt._getSegmentSeparators();
|
3440
|
-
var count = 0;
|
3441
|
-
for(var segmentId in segmentRids) {
|
3442
|
-
var segment = segments.getSegment(segmentId);
|
3443
|
-
if(segment) {
|
3444
|
-
var chdr = segment.getChildren();
|
3445
|
-
var emptySegment = true;
|
3446
|
-
for(var childId in chdr) {
|
3447
|
-
if(!removalMap[childId]) {
|
3448
|
-
emptySegment = false;
|
3449
|
-
break;
|
3450
|
-
}
|
3451
|
-
}
|
3452
|
-
if(emptySegment) {
|
3453
|
-
removalMap[segmentId] = 1;
|
3454
|
-
++count;
|
3455
|
-
}
|
3361
|
+
if(removed) {
|
3362
|
+
++spliceCount;
|
3363
|
+
} else if(spliceCount > 0) {
|
3364
|
+
rids.splice(i + 1, spliceCount);
|
3365
|
+
spliceCount = 0;
|
3456
3366
|
}
|
3457
3367
|
}
|
3458
|
-
|
3459
|
-
|
3368
|
+
if(spliceCount > 0) {
|
3369
|
+
rids.splice(0, spliceCount);
|
3370
|
+
}
|
3460
3371
|
};
|
3461
3372
|
/** @private
|
3462
3373
|
* @param {string|Function|undefined} cid
|
@@ -3736,13 +3647,13 @@ DataView.prototype._removeGroupMember = function (groupIndex, groupId) {
|
|
3736
3647
|
};
|
3737
3648
|
/** @private
|
3738
3649
|
* @param {string} cid
|
3739
|
-
* @param {Object} values
|
3650
|
+
* @param {Object.<string, *>} values
|
3740
3651
|
* @return {Array.<string>}
|
3741
3652
|
*/
|
3742
3653
|
DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
3743
3654
|
var val = values[cid];
|
3744
3655
|
if(Array.isArray(val)) {
|
3745
|
-
return val.map(function(data) {
|
3656
|
+
return val.map(function(data) {
|
3746
3657
|
return data + "";
|
3747
3658
|
});
|
3748
3659
|
} else {
|
@@ -3751,11 +3662,11 @@ DataView.prototype._defaultGroupCriteria = function(cid, values) {
|
|
3751
3662
|
};
|
3752
3663
|
/** @private
|
3753
3664
|
* @param {string|null} rid
|
3754
|
-
* @param {Object} values
|
3665
|
+
* @param {Object.<string, *>} values
|
3755
3666
|
* @return {boolean}
|
3756
3667
|
*/
|
3757
3668
|
DataView.prototype._groupFilterLogic = function(rid, values) {
|
3758
|
-
var gids = this._groupCriteria[this._groupLevel - 1](values);
|
3669
|
+
var gids = this._groupCriteria[this._groupLevel - 1](values);
|
3759
3670
|
return gids.indexOf(this._groupId) >= 0;
|
3760
3671
|
};
|
3761
3672
|
|
@@ -292,12 +292,6 @@ Segment.prototype.getChildIds = function() {
|
|
292
292
|
return this._childCount ? Object.keys(this._children) : [];
|
293
293
|
};
|
294
294
|
/** @public
|
295
|
-
* @return {!Object}
|
296
|
-
*/
|
297
|
-
Segment.prototype.getChildren = function() {
|
298
|
-
return this._children;
|
299
|
-
};
|
300
|
-
/** @public
|
301
295
|
* @return {number}
|
302
296
|
*/
|
303
297
|
Segment.prototype.getChildCount = function() {
|
@@ -405,6 +405,10 @@ declare class Core extends ElementWrapper {
|
|
405
405
|
|
406
406
|
public getColumnGroupChildIds(groupId: string): (string)[]|null;
|
407
407
|
|
408
|
+
public getValidColumnList(colIds: (string)[]|null, columnMap?: any): (string)[];
|
409
|
+
|
410
|
+
public createColumnMap(colIds?: (string)[]|null): any;
|
411
|
+
|
408
412
|
public startBatch(batchType: string): boolean;
|
409
413
|
|
410
414
|
public stopBatch(batchType: string): boolean;
|