@refinitiv-ui/efx-grid 6.0.34 → 6.0.35
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.js +50 -40
- package/lib/core/dist/core.js +99 -3
- 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 +18 -1
- package/lib/core/es6/data/DataView.d.ts +2 -0
- package/lib/core/es6/data/DataView.js +11 -0
- package/lib/core/es6/grid/Core.d.ts +12 -0
- package/lib/core/es6/grid/Core.js +64 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +6 -0
- package/lib/grid/index.js +1 -1
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/efx-grid.less +1 -1
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +343 -142
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +33 -26
- package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
- package/lib/rt-grid/es6/RowDefSorter.js +165 -71
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +17 -3
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +14 -3
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
- package/lib/tr-grid-util/es6/DragUI.js +7 -3
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
- package/lib/types/es6/ColumnStack.d.ts +2 -0
- package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
- package/lib/versions.json +7 -7
- package/package.json +1 -1
@@ -12129,7 +12129,24 @@ DataTable.prototype.setSortingLogic = function(func) {
|
|
12129
12129
|
* @param {DataTable.SortLogic} func Use null to remove current sorting logic
|
12130
12130
|
*/
|
12131
12131
|
DataTable.prototype.setColumnSortingLogic = function(cid, func) {
|
12132
|
-
|
12132
|
+
if(cid) {
|
12133
|
+
this._compMap[cid] = func;
|
12134
|
+
}
|
12135
|
+
};
|
12136
|
+
/** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
|
12137
|
+
* @public
|
12138
|
+
* @param {string=} cid
|
12139
|
+
* @return {DataTable.SortLogic}
|
12140
|
+
*/
|
12141
|
+
DataTable.prototype.getColumnSortingLogic = function(cid) {
|
12142
|
+
if(cid) {
|
12143
|
+
var logic = this._compMap[cid];
|
12144
|
+
if(logic) {
|
12145
|
+
return logic;
|
12146
|
+
}
|
12147
|
+
}
|
12148
|
+
|
12149
|
+
return this._compMap["_default"] || null;
|
12133
12150
|
};
|
12134
12151
|
|
12135
12152
|
/** Freeze data table so that no event is fired for data processing until executing {@link DataTable#unfreeze} method
|
@@ -12292,11 +12309,12 @@ DataTable.prototype.getSegmentParentRowId = function(rid) {
|
|
12292
12309
|
/**
|
12293
12310
|
* @public
|
12294
12311
|
* @param {Array.<string>=} rids If no row id is given, row ids of this data table is used instead
|
12312
|
+
* @param {boolean=} partial Indicating that the given ids are not the whole list
|
12295
12313
|
* @return {Array.<number>} Return null if there is no segmentation
|
12296
12314
|
*/
|
12297
|
-
DataTable.prototype.getSegmentValues = function(rids) {
|
12315
|
+
DataTable.prototype.getSegmentValues = function(rids, partial) {
|
12298
12316
|
if(this._segments) {
|
12299
|
-
return this._segments.getSegmentValues(rids || this._rids);
|
12317
|
+
return this._segments.getSegmentValues(rids || this._rids, partial);
|
12300
12318
|
}
|
12301
12319
|
return null;
|
12302
12320
|
};
|
@@ -29444,6 +29462,17 @@ DataView.prototype.setColumnSortingLogic = function(cid, func) {
|
|
29444
29462
|
this._dt.setColumnSortingLogic(cid, func);
|
29445
29463
|
}
|
29446
29464
|
};
|
29465
|
+
/** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
|
29466
|
+
* @public
|
29467
|
+
* @param {string=} cid
|
29468
|
+
* @return {DataTable.SortLogic}
|
29469
|
+
*/
|
29470
|
+
DataView.prototype.getColumnSortingLogic = function(cid) {
|
29471
|
+
if(this._dt) {
|
29472
|
+
return this._dt.getColumnSortingLogic(cid);
|
29473
|
+
}
|
29474
|
+
return null;
|
29475
|
+
};
|
29447
29476
|
/** Check if this view is in sorting mode
|
29448
29477
|
* @public
|
29449
29478
|
* @return {boolean}
|
@@ -35180,6 +35209,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
|
|
35180
35209
|
|
35181
35210
|
// eslint-disable-line
|
35182
35211
|
|
35212
|
+
|
35183
35213
|
// eslint-disable-line
|
35184
35214
|
|
35185
35215
|
|
@@ -35379,7 +35409,9 @@ var Core = function (opt_initializer) {
|
|
35379
35409
|
"rowRemoved",
|
35380
35410
|
"columnPositionChanged",
|
35381
35411
|
"rowPositionChanged",
|
35382
|
-
"beforeColumnBoundUpdate"
|
35412
|
+
"beforeColumnBoundUpdate",
|
35413
|
+
"beforeBatchOperation",
|
35414
|
+
"afterBatchOperation"
|
35383
35415
|
);
|
35384
35416
|
|
35385
35417
|
// For debugging in advanced optimization mode
|
@@ -35454,6 +35486,15 @@ Core.SectionReference;
|
|
35454
35486
|
*/
|
35455
35487
|
Core.MouseInfo;
|
35456
35488
|
|
35489
|
+
/** @typedef {Object} Core~BatchInfo
|
35490
|
+
* @private
|
35491
|
+
* @property {string=} reset //set columns
|
35492
|
+
* @property {string=} insertion //add cols
|
35493
|
+
* @property {string=} removal //remove cols
|
35494
|
+
* @property {string=} moving //reorder
|
35495
|
+
*/
|
35496
|
+
Core.BatchInfo;
|
35497
|
+
|
35457
35498
|
/** @typedef {Core.MouseInfo|ElementWrapper|Element} Core~CellReference
|
35458
35499
|
* @description A section in core grid can be refered by the following object <br>
|
35459
35500
|
* `{Core.MouseInfo}` : Object with valid x, y coordinates and section index <br>
|
@@ -35708,6 +35749,10 @@ Core.prototype._rowHeightTimerId = 0;
|
|
35708
35749
|
* @private
|
35709
35750
|
*/
|
35710
35751
|
Core.prototype._groupDefs = null;
|
35752
|
+
/** @type {BatchInfo}
|
35753
|
+
* @private
|
35754
|
+
*/
|
35755
|
+
Core.prototype._batches = null;
|
35711
35756
|
//#region Public Methods
|
35712
35757
|
|
35713
35758
|
/**
|
@@ -35715,7 +35760,7 @@ Core.prototype._groupDefs = null;
|
|
35715
35760
|
* @return {string}
|
35716
35761
|
*/
|
35717
35762
|
Core.getVersion = function () {
|
35718
|
-
return "5.1.
|
35763
|
+
return "5.1.48";
|
35719
35764
|
};
|
35720
35765
|
/** {@link ElementWrapper#dispose}
|
35721
35766
|
* @override
|
@@ -36654,6 +36699,10 @@ Core.prototype.removeColumnAt = function (index) {
|
|
36654
36699
|
|
36655
36700
|
if (this._hasListener("columnRemoved")) {
|
36656
36701
|
var e = {};
|
36702
|
+
var batches = this._batches;
|
36703
|
+
if(batches){
|
36704
|
+
e["batches"] = batches;
|
36705
|
+
}
|
36657
36706
|
e["atTheMiddle"] = true;
|
36658
36707
|
e["colIndex"] = index;
|
36659
36708
|
e["columns"] = "deprecated";
|
@@ -39498,6 +39547,40 @@ Core.prototype.getColumnGroupChildIds = function (groupId) {
|
|
39498
39547
|
}
|
39499
39548
|
return null;
|
39500
39549
|
};
|
39550
|
+
|
39551
|
+
/** @public
|
39552
|
+
* @param {string} batchType
|
39553
|
+
* @return {boolean}
|
39554
|
+
* @fires Core#beforeBatchOperation
|
39555
|
+
*/
|
39556
|
+
Core.prototype.startBatch = function (batchType) {
|
39557
|
+
if(!batchType){
|
39558
|
+
return false;
|
39559
|
+
}
|
39560
|
+
if(!this._batches){
|
39561
|
+
this._batches = {};
|
39562
|
+
}
|
39563
|
+
this._batches[batchType] = batchType;
|
39564
|
+
this._dispatch("beforeBatchOperation", { batches: this._batches, batchType: batchType });
|
39565
|
+
return true;
|
39566
|
+
};
|
39567
|
+
/** @public
|
39568
|
+
* @param {string} batchType
|
39569
|
+
* @return {boolean}
|
39570
|
+
* @fires Core#afterBatchOperation
|
39571
|
+
*/
|
39572
|
+
Core.prototype.stopBatch = function (batchType) {
|
39573
|
+
if(!batchType){
|
39574
|
+
return false;
|
39575
|
+
}
|
39576
|
+
this._dispatch("afterBatchOperation", { batches: this._batches, batchType: batchType });
|
39577
|
+
|
39578
|
+
delete this._batches[batchType];
|
39579
|
+
if(Object(Util["f" /* isEmptyObject */])(this._batches)){
|
39580
|
+
this._batches = null;
|
39581
|
+
}
|
39582
|
+
return true;
|
39583
|
+
};
|
39501
39584
|
//#endregion Public Methods
|
39502
39585
|
|
39503
39586
|
//#region Private Methods
|
@@ -39741,6 +39824,10 @@ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx
|
|
39741
39824
|
if (this._hasListener("columnAdded")) {
|
39742
39825
|
var e = {};
|
39743
39826
|
e["atTheMiddle"] = atTheMiddle;
|
39827
|
+
var batches = this._batches;
|
39828
|
+
if(batches){
|
39829
|
+
e["batches"] = batches;
|
39830
|
+
}
|
39744
39831
|
if(count === 1) {
|
39745
39832
|
e["colIndex"] = at;
|
39746
39833
|
e["context"] = ctx;
|
@@ -39892,6 +39979,10 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
|
|
39892
39979
|
|
39893
39980
|
if (this._hasListener("columnRemoved")) {
|
39894
39981
|
var e = {};
|
39982
|
+
var batches = this._batches;
|
39983
|
+
if(batches){
|
39984
|
+
e["batches"] = batches;
|
39985
|
+
}
|
39895
39986
|
for (var c = colCount; --c >= newCount; ) {
|
39896
39987
|
var colDef = removedCols[c - newCount];
|
39897
39988
|
e["colIndex"] = c;
|
@@ -41442,73 +41533,150 @@ DataConnector.prototype.reset = function () {
|
|
41442
41533
|
/* harmony default export */ var js_DataConnector = (DataConnector);
|
41443
41534
|
|
41444
41535
|
// CONCATENATED MODULE: ./src/js/RowDefSorter.js
|
41536
|
+
|
41537
|
+
|
41538
|
+
/** @private
|
41539
|
+
* @param {*} a
|
41540
|
+
* @param {*} b
|
41541
|
+
* @param {number} order
|
41542
|
+
* @return {number}
|
41543
|
+
*/
|
41544
|
+
var _defaultCompare = function(a, b, order) {
|
41545
|
+
if(a == null || a !== a) {
|
41546
|
+
if(b == null || b !== b) {
|
41547
|
+
return 0;
|
41548
|
+
}
|
41549
|
+
return 1;
|
41550
|
+
}
|
41551
|
+
if(b == null || b !== b) {
|
41552
|
+
return -1;
|
41553
|
+
}
|
41554
|
+
|
41555
|
+
if(a < b) {
|
41556
|
+
return -order;
|
41557
|
+
}
|
41558
|
+
if(b < a) {
|
41559
|
+
return order;
|
41560
|
+
}
|
41561
|
+
return 0;
|
41562
|
+
};
|
41563
|
+
|
41445
41564
|
/** @constructor
|
41446
41565
|
*/
|
41447
41566
|
var RowDefSorter = function() {
|
41448
41567
|
this._defaultSorter = this._defaultSorter.bind(this);
|
41449
41568
|
this._dataSorter = this._dataSorter.bind(this);
|
41450
41569
|
this._rowDefSorter = this._rowDefSorter.bind(this);
|
41570
|
+
this._multiColumnsSorter = this._multiColumnsSorter.bind(this);
|
41451
41571
|
|
41452
|
-
this.
|
41572
|
+
this._globalContext = {};
|
41573
|
+
this._sortParams = [];
|
41574
|
+
this._ctxCaches = [];
|
41453
41575
|
};
|
41454
41576
|
|
41455
|
-
|
41456
|
-
/** @type {string}
|
41577
|
+
/** @type {!Object}
|
41457
41578
|
* @private
|
41458
41579
|
*/
|
41459
|
-
RowDefSorter.prototype.
|
41460
|
-
/** @type {!
|
41580
|
+
RowDefSorter.prototype._globalContext;
|
41581
|
+
/** @type {!Array.<Array>}
|
41461
41582
|
* @private
|
41462
41583
|
*/
|
41463
|
-
RowDefSorter.prototype.
|
41464
|
-
/** @type {
|
41584
|
+
RowDefSorter.prototype._sortParams;
|
41585
|
+
/** @type {!Array.<Object>}
|
41586
|
+
* @private
|
41587
|
+
*/
|
41588
|
+
RowDefSorter.prototype._ctxCaches;
|
41589
|
+
/** @type {Array}
|
41465
41590
|
* @private
|
41466
41591
|
*/
|
41467
|
-
RowDefSorter.prototype.
|
41592
|
+
RowDefSorter.prototype._primaryParams;
|
41468
41593
|
|
41469
41594
|
|
41470
41595
|
/** @public
|
41471
41596
|
*/
|
41472
41597
|
RowDefSorter.prototype.dispose = function() {
|
41473
|
-
this.
|
41474
|
-
this.
|
41598
|
+
this._globalContext = {}; // Clear any existing reference
|
41599
|
+
this._sortParams.length = 0;
|
41600
|
+
this._ctxCaches.length = 0;
|
41601
|
+
this._primaryParams = null;
|
41475
41602
|
};
|
41476
41603
|
|
41477
41604
|
/** @public
|
41478
|
-
* @param {boolean=} rowSorting=false
|
41479
41605
|
* @return {Function}
|
41480
41606
|
*/
|
41481
|
-
RowDefSorter.prototype.getSorter = function(
|
41482
|
-
|
41483
|
-
|
41484
|
-
|
41485
|
-
|
41607
|
+
RowDefSorter.prototype.getSorter = function() {
|
41608
|
+
this._primaryParams = null;
|
41609
|
+
var sortCount = this._sortParams.length;
|
41610
|
+
if(sortCount === 1) {
|
41611
|
+
var params = this._primaryParams = this._sortParams[0];
|
41612
|
+
var sortLogic = params[1];
|
41613
|
+
if(sortLogic) {
|
41614
|
+
var rowSorting = params[3];
|
41615
|
+
return rowSorting ? this._rowDefSorter : this._dataSorter;
|
41616
|
+
} else {
|
41617
|
+
return this._defaultSorter;
|
41618
|
+
}
|
41619
|
+
} else if(sortCount > 1) {
|
41620
|
+
return this._multiColumnsSorter;
|
41486
41621
|
}
|
41487
|
-
};
|
41488
|
-
/** @public
|
41489
|
-
* @param {Function=} func
|
41490
|
-
*/
|
41491
|
-
RowDefSorter.prototype.setSortLogic = function(func) {
|
41492
|
-
this._sortLogic = (typeof func === "function") ? func : null;
|
41493
|
-
};
|
41494
41622
|
|
41623
|
+
return RowDefSorter._noSorting;
|
41624
|
+
};
|
41495
41625
|
|
41496
41626
|
/** @public
|
41497
|
-
* @param {string}
|
41627
|
+
* @param {string} key
|
41628
|
+
* @param {*} value
|
41498
41629
|
*/
|
41499
|
-
RowDefSorter.prototype.
|
41500
|
-
if(
|
41501
|
-
|
41630
|
+
RowDefSorter.prototype.reset = function() {
|
41631
|
+
if(this._sortParams.length) {
|
41632
|
+
this._sortParams.length = 0;
|
41502
41633
|
}
|
41503
|
-
this._sortContext["field"] = this._field = field;
|
41504
|
-
this._sortContext["formattedField"] = field + "_FORMATTED";
|
41505
41634
|
};
|
41506
41635
|
/** @public
|
41507
41636
|
* @param {string} key
|
41508
41637
|
* @param {*} value
|
41509
41638
|
*/
|
41510
41639
|
RowDefSorter.prototype.setContext = function(key, value) {
|
41511
|
-
this.
|
41640
|
+
this._globalContext[key] = value;
|
41641
|
+
};
|
41642
|
+
/** @public
|
41643
|
+
* @param {string} field
|
41644
|
+
* @param {Function} logic
|
41645
|
+
* @param {boolean} rowSorting
|
41646
|
+
* @param {string} order
|
41647
|
+
* @param {number} colIndex
|
41648
|
+
* @param {*} colDef
|
41649
|
+
*/
|
41650
|
+
RowDefSorter.prototype.addColumnContext = function(field, logic, rowSorting, order, colIndex, colDef) {
|
41651
|
+
if(!field) {
|
41652
|
+
field = "";
|
41653
|
+
}
|
41654
|
+
var sortPriority = this._sortParams.length;
|
41655
|
+
var ctx = this._ctxCaches[sortPriority];
|
41656
|
+
if(!ctx) {
|
41657
|
+
ctx = this._ctxCaches[sortPriority] = Object(Util["b" /* cloneObject */])(this._globalContext);
|
41658
|
+
}
|
41659
|
+
var orderNum = 0;
|
41660
|
+
if(order === "a") {
|
41661
|
+
orderNum = 1;
|
41662
|
+
} else if(order === "d") {
|
41663
|
+
orderNum = -1;
|
41664
|
+
}
|
41665
|
+
|
41666
|
+
var params = [
|
41667
|
+
field, // 0
|
41668
|
+
(typeof logic === "function") ? logic : null, // 1
|
41669
|
+
ctx, // 2
|
41670
|
+
rowSorting, // 3
|
41671
|
+
orderNum // 4
|
41672
|
+
];
|
41673
|
+
|
41674
|
+
ctx["colIndex"] = colIndex;
|
41675
|
+
ctx["field"] = field;
|
41676
|
+
ctx["formattedField"] = field + "_FORMATTED";
|
41677
|
+
ctx["colDef"] = colDef;
|
41678
|
+
|
41679
|
+
this._sortParams.push(params);
|
41512
41680
|
};
|
41513
41681
|
|
41514
41682
|
/** @private
|
@@ -41517,32 +41685,7 @@ RowDefSorter.prototype.setContext = function(key, value) {
|
|
41517
41685
|
* @param {number} order
|
41518
41686
|
* @return {number}
|
41519
41687
|
*/
|
41520
|
-
RowDefSorter.
|
41521
|
-
var orderA = rowDefA.getGroupOrder();
|
41522
|
-
var orderB = rowDefB.getGroupOrder();
|
41523
|
-
if(orderA !== orderB) {
|
41524
|
-
return orderA - orderB; // Regardless of sort order
|
41525
|
-
}
|
41526
|
-
|
41527
|
-
var a = rowDefA.getData(this._field);
|
41528
|
-
var b = rowDefB.getData(this._field);
|
41529
|
-
|
41530
|
-
if(a == null || a !== a) {
|
41531
|
-
if(b == null || b !== b) {
|
41532
|
-
return 0;
|
41533
|
-
}
|
41534
|
-
return 1;
|
41535
|
-
}
|
41536
|
-
if(b == null || b !== b) {
|
41537
|
-
return -1;
|
41538
|
-
}
|
41539
|
-
|
41540
|
-
if(a < b) {
|
41541
|
-
return -order;
|
41542
|
-
}
|
41543
|
-
if(b < a) {
|
41544
|
-
return order;
|
41545
|
-
}
|
41688
|
+
RowDefSorter._noSorting = function(rowDefA, rowDefB, order) {
|
41546
41689
|
return 0;
|
41547
41690
|
};
|
41548
41691
|
/** @private
|
@@ -41551,16 +41694,30 @@ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
|
41551
41694
|
* @param {number} order
|
41552
41695
|
* @return {number}
|
41553
41696
|
*/
|
41697
|
+
RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
|
41698
|
+
var field = this._primaryParams[0];
|
41699
|
+
return _defaultCompare(
|
41700
|
+
rowDefA.getData(field),
|
41701
|
+
rowDefB.getData(field),
|
41702
|
+
order
|
41703
|
+
);
|
41704
|
+
};
|
41705
|
+
/** @private
|
41706
|
+
* @param {RowDefinition} rowDefA
|
41707
|
+
* @param {RowDefinition} rowDefB
|
41708
|
+
* @param {number} order
|
41709
|
+
* @return {number}
|
41710
|
+
*/
|
41554
41711
|
RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
41555
|
-
var
|
41556
|
-
var
|
41557
|
-
|
41558
|
-
|
41559
|
-
|
41560
|
-
|
41561
|
-
|
41562
|
-
|
41563
|
-
|
41712
|
+
var params = this._primaryParams;
|
41713
|
+
var field = params[0];
|
41714
|
+
var sortLogic = params[1];
|
41715
|
+
return sortLogic(
|
41716
|
+
rowDefA.getData(field),
|
41717
|
+
rowDefB.getData(field),
|
41718
|
+
order,
|
41719
|
+
params[2]
|
41720
|
+
);
|
41564
41721
|
};
|
41565
41722
|
/** @private
|
41566
41723
|
* @param {RowDefinition} rowDefA
|
@@ -41569,13 +41726,41 @@ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
|
|
41569
41726
|
* @return {number}
|
41570
41727
|
*/
|
41571
41728
|
RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
|
41572
|
-
var
|
41573
|
-
var
|
41574
|
-
|
41575
|
-
|
41729
|
+
var params = this._primaryParams;
|
41730
|
+
var sortLogic = params[1];
|
41731
|
+
return sortLogic(rowDefA, rowDefB, order, params[2]);
|
41732
|
+
};
|
41733
|
+
/** @private
|
41734
|
+
* @param {RowDefinition} rowDefA
|
41735
|
+
* @param {RowDefinition} rowDefB
|
41736
|
+
* @param {number} primaryOrder
|
41737
|
+
* @return {number}
|
41738
|
+
*/
|
41739
|
+
RowDefSorter.prototype._multiColumnsSorter = function(rowDefA, rowDefB, primaryOrder) {
|
41740
|
+
var sortParams = this._sortParams;
|
41741
|
+
var sortCount = sortParams.length;
|
41742
|
+
for(var i = 0; i < sortCount; ++i) {
|
41743
|
+
var params = sortParams[i];
|
41744
|
+
var field = params[0];
|
41745
|
+
var sortLogic = params[1];
|
41746
|
+
var ctx = params[2];
|
41747
|
+
var rowSorting = params[3];
|
41748
|
+
var orderNum = params[4];
|
41749
|
+
var ret = 0;
|
41750
|
+
if(sortLogic) {
|
41751
|
+
if(rowSorting) {
|
41752
|
+
ret = sortLogic(rowDefA, rowDefB, orderNum, ctx);
|
41753
|
+
} else {
|
41754
|
+
ret = sortLogic(rowDefA.getData(field), rowDefB.getData(field), orderNum, ctx);
|
41755
|
+
}
|
41756
|
+
} else {
|
41757
|
+
ret = _defaultCompare(rowDefA.getData(field), rowDefB.getData(field), orderNum);
|
41758
|
+
}
|
41759
|
+
if(ret) {
|
41760
|
+
return ret;
|
41761
|
+
}
|
41576
41762
|
}
|
41577
|
-
|
41578
|
-
return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
|
41763
|
+
return 0;
|
41579
41764
|
};
|
41580
41765
|
|
41581
41766
|
/* harmony default export */ var js_RowDefSorter = (RowDefSorter);
|
@@ -43124,6 +43309,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
|
|
43124
43309
|
if (!this._dataSorting) { return; }
|
43125
43310
|
|
43126
43311
|
var sortCount = this._sortStates.length;
|
43312
|
+
if(this._userManagedLogic && sortCount > 1) { // The logic is managed by the user. There is no point in using multi-column sorting
|
43313
|
+
sortCount = 1;
|
43314
|
+
}
|
43127
43315
|
var orders = null;
|
43128
43316
|
var sortLogics = null;
|
43129
43317
|
var c_ref = null;
|
@@ -43139,6 +43327,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
|
|
43139
43327
|
} else {
|
43140
43328
|
c_ref = this.getColumnSortingFields();
|
43141
43329
|
}
|
43330
|
+
if(this._userManagedLogic && c_ref.length > 1) {
|
43331
|
+
c_ref = c_ref.slice(0, 1);
|
43332
|
+
}
|
43142
43333
|
}
|
43143
43334
|
|
43144
43335
|
// Perform sorting even if there is no sort state
|
@@ -43247,16 +43438,16 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
|
|
43247
43438
|
symbol = t._createIconElem(icon, textContent);
|
43248
43439
|
symbol.className = "sort-symbol";
|
43249
43440
|
cell["insertFloatingIcon"](symbol, 0);
|
43250
|
-
|
43251
|
-
if (t._sortStates.length > 1) {
|
43252
|
-
symbol = document.createElement("span");
|
43253
|
-
symbol.className = "priority-symbol";
|
43254
|
-
symbol.textContent = priority + 1;
|
43255
|
-
cell["insertFloatingIcon"](symbol, 1);
|
43256
|
-
}
|
43257
43441
|
} else {
|
43258
43442
|
cell["addClass"]("edge-indicator");
|
43259
43443
|
}
|
43444
|
+
|
43445
|
+
if (t._sortStates.length > 1) {
|
43446
|
+
symbol = document.createElement("span");
|
43447
|
+
symbol.className = "priority-symbol";
|
43448
|
+
symbol.textContent = priority + 1;
|
43449
|
+
cell["insertFloatingIcon"](symbol, 1);
|
43450
|
+
}
|
43260
43451
|
} else if (t._sortableIndicator) { // Can sort but currently not sorting
|
43261
43452
|
icon = SortableTitlePlugin._icons["sortable"];
|
43262
43453
|
symbol = t._createIconElem(icon, CODE_DIAMOND);
|
@@ -45010,21 +45201,24 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
|
|
45010
45201
|
* @param {Array.<Object>} columns Array of column options
|
45011
45202
|
*/
|
45012
45203
|
Grid.prototype.setColumns = function(columns) {
|
45204
|
+
var grid = this._grid;
|
45013
45205
|
var colCount = (columns) ? columns.length : 0;
|
45014
45206
|
|
45207
|
+
grid.startBatch("reset");
|
45015
45208
|
this.removeAllColumns();
|
45016
45209
|
if(colCount > 0) {
|
45017
45210
|
var prevState = false;
|
45018
45211
|
if(colCount > 1) {
|
45019
|
-
prevState =
|
45212
|
+
prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
|
45020
45213
|
}
|
45021
45214
|
for(var i = 0; i < colCount; ++i) {
|
45022
45215
|
this.insertColumn(columns[i], i);
|
45023
45216
|
}
|
45024
45217
|
if(colCount > 1) {
|
45025
|
-
|
45218
|
+
grid.freezeLayout(prevState);
|
45026
45219
|
}
|
45027
45220
|
}
|
45221
|
+
grid.stopBatch("reset");
|
45028
45222
|
};
|
45029
45223
|
|
45030
45224
|
|
@@ -45033,6 +45227,8 @@ Grid.prototype.setColumns = function(columns) {
|
|
45033
45227
|
* @param {Array.<Object>} columns Array of column options
|
45034
45228
|
*/
|
45035
45229
|
Grid.prototype.restoreColumns = function(columns) {
|
45230
|
+
var grid = this._grid;
|
45231
|
+
grid.startBatch("reset");
|
45036
45232
|
var configObj = this.getConfigObject();
|
45037
45233
|
var previousColumns = configObj.columns;
|
45038
45234
|
|
@@ -45096,7 +45292,8 @@ Grid.prototype.restoreColumns = function(columns) {
|
|
45096
45292
|
this._stp.sortColumns(sortingStates);
|
45097
45293
|
}
|
45098
45294
|
|
45099
|
-
|
45295
|
+
grid.reorderColumns(columnOrdering);
|
45296
|
+
grid.stopBatch("reset");
|
45100
45297
|
};
|
45101
45298
|
|
45102
45299
|
/** Remove all existing columns and add new columns based on the given texts/fields
|
@@ -46789,33 +46986,34 @@ Grid.prototype._updateStreamingData = function() {
|
|
46789
46986
|
* @param {Object} e
|
46790
46987
|
*/
|
46791
46988
|
Grid.prototype._onPreDataSorting = function (e) {
|
46792
|
-
var
|
46793
|
-
|
46794
|
-
|
46795
|
-
|
46796
|
-
|
46797
|
-
|
46798
|
-
|
46799
|
-
|
46800
|
-
|
46801
|
-
|
46802
|
-
|
46803
|
-
|
46804
|
-
|
46989
|
+
var objs = this._stp.getSortedColumns();
|
46990
|
+
|
46991
|
+
this._sorter.reset();
|
46992
|
+
if(Array.isArray(objs)) {
|
46993
|
+
var sortCount = objs.length;
|
46994
|
+
for(var i = 0; i < sortCount; ++i) {
|
46995
|
+
var obj = objs[i];
|
46996
|
+
var field = obj["field"] || "";
|
46997
|
+
var colIndex = obj["colIndex"];
|
46998
|
+
var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
|
46999
|
+
|
47000
|
+
var rowSorting = false;
|
47001
|
+
var sortLogic = null;
|
47002
|
+
if(colDef) {
|
47003
|
+
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
47004
|
+
rowSorting = colDef.isRowSorting();
|
47005
|
+
sortLogic = colDef.getSorter();
|
47006
|
+
}
|
47007
|
+
// TODO: get sortLogic from DataView
|
47008
|
+
// if(!sortLogic && field) {
|
47009
|
+
// sortLogic = state["sortLogic"];
|
47010
|
+
// }
|
46805
47011
|
|
46806
|
-
|
46807
|
-
field = colDef.getField(); // WARNING: Field and logic could be out of sync
|
46808
|
-
sortLogic = colDef.getSorter();
|
46809
|
-
rowSorting = colDef.isRowSorting();
|
47012
|
+
this._sorter.addColumnContext(field, sortLogic, rowSorting, obj["sortOrder"], colIndex, colDef);
|
46810
47013
|
}
|
46811
47014
|
}
|
46812
|
-
if(!sortLogic && field) {
|
46813
|
-
sortLogic = state["sortLogic"];
|
46814
|
-
}
|
46815
47015
|
|
46816
|
-
this._sorter.
|
46817
|
-
this._sorter.setSortLogic(sortLogic);
|
46818
|
-
this._columnSorter = this._sorter.getSorter(rowSorting);
|
47016
|
+
this._columnSorter = this._sorter.getSorter();
|
46819
47017
|
};
|
46820
47018
|
/** @private
|
46821
47019
|
* @param {RowDefinition} rowDefA
|
@@ -47716,7 +47914,7 @@ var _fieldInfo = {
|
|
47716
47914
|
"words2": {type: "string", min: 3, max: 10},
|
47717
47915
|
"words3": {type: "string", min: 5, max: 15},
|
47718
47916
|
"sentence": {type: "string", min: 8, max: 20},
|
47719
|
-
"id": {type: "function", generate: _generateId},
|
47917
|
+
"id": {type: "function", hash: 0, generate: _generateId},
|
47720
47918
|
"companyName": {type: "set", members: jet_DataSet.companyName },
|
47721
47919
|
"industry": {type: "set", members: jet_DataSet.industry },
|
47722
47920
|
"market": {type: "set", members: jet_DataSet.market },
|
@@ -47736,14 +47934,16 @@ var getFieldInfo = function(field) {
|
|
47736
47934
|
* @param {Object|Function} options
|
47737
47935
|
*/
|
47738
47936
|
var addFieldInfo = function(field, options) {
|
47739
|
-
|
47740
|
-
|
47741
|
-
|
47742
|
-
|
47743
|
-
|
47744
|
-
|
47937
|
+
if(field) {
|
47938
|
+
var opt = options;
|
47939
|
+
if(typeof options === "function") {
|
47940
|
+
opt = {
|
47941
|
+
type: "function",
|
47942
|
+
generate: options
|
47943
|
+
};
|
47944
|
+
}
|
47945
|
+
_fieldInfo[field] = opt; // WARNING: This could replace existing info
|
47745
47946
|
}
|
47746
|
-
_fieldInfo[field] = opt;
|
47747
47947
|
};
|
47748
47948
|
|
47749
47949
|
/** Return pseudo random number in the range of 0 to 1 (exclusive of 1)
|
@@ -48085,8 +48285,9 @@ var _generate2DArray = function(fields, options, seed) {
|
|
48085
48285
|
*/
|
48086
48286
|
var _hash = function(str) {
|
48087
48287
|
var sum = 0;
|
48088
|
-
|
48089
|
-
|
48288
|
+
var i = str ? str.length : 0;
|
48289
|
+
while(--i >= 0) {
|
48290
|
+
sum += str.charCodeAt(i) * (i + 0.9879);
|
48090
48291
|
}
|
48091
48292
|
return sum;
|
48092
48293
|
};
|
@@ -48098,35 +48299,34 @@ var _hash = function(str) {
|
|
48098
48299
|
*/
|
48099
48300
|
var _generateFieldData = function(field, options, seed) {
|
48100
48301
|
var fInfo = getFieldInfo(field);
|
48302
|
+
if(!fInfo.type) {
|
48303
|
+
fInfo.type = "number";
|
48304
|
+
addFieldInfo(field, fInfo);
|
48305
|
+
}
|
48306
|
+
if(fInfo.fixedValue){
|
48307
|
+
fInfo.value = value;
|
48308
|
+
return fInfo;
|
48309
|
+
}
|
48310
|
+
if(seed != null) {
|
48311
|
+
if(fInfo.hash == null) {
|
48312
|
+
fInfo.hash = _hash(field);
|
48313
|
+
}
|
48314
|
+
seed += fInfo.hash; // Make each field unique for the same seed
|
48315
|
+
}
|
48316
|
+
|
48101
48317
|
var min = fInfo.min != null ? fInfo.min : 100; // WARNING: Default values are non-standard values
|
48102
48318
|
var max = fInfo.max != null ? fInfo.max : 10000;
|
48103
|
-
var prec = fInfo.prec != null ? fInfo.prec : 0;
|
48104
48319
|
var value;
|
48105
48320
|
|
48106
|
-
if(fInfo.
|
48107
|
-
value = fInfo.fixedValue;
|
48108
|
-
} else if(!fInfo.type) { // Unknown type
|
48109
|
-
if(seed != null) {
|
48110
|
-
if(field) {
|
48111
|
-
if(!fInfo.hash) {
|
48112
|
-
fInfo.hash = _hash(field);
|
48113
|
-
addFieldInfo(field, fInfo); // WARNING: modify global state
|
48114
|
-
}
|
48115
|
-
seed += fInfo.hash;
|
48116
|
-
}
|
48117
|
-
}
|
48118
|
-
value = randNumber(min, max, prec, seed);
|
48119
|
-
} else if(fInfo.type === "string") {
|
48321
|
+
if(fInfo.type === "string") {
|
48120
48322
|
if(fInfo.min != null || fInfo.max != null) {
|
48121
|
-
if(seed != null) {
|
48122
|
-
if(!fInfo.hash) {
|
48123
|
-
fInfo.hash = _hash(field);
|
48124
|
-
}
|
48125
|
-
seed += fInfo.hash;
|
48126
|
-
}
|
48127
48323
|
value = randString(min, max, seed);
|
48128
48324
|
} else {
|
48129
|
-
|
48325
|
+
if(options) {
|
48326
|
+
value = options.text || "";
|
48327
|
+
} else {
|
48328
|
+
value = "";
|
48329
|
+
}
|
48130
48330
|
}
|
48131
48331
|
} else if(fInfo.type === "set") {
|
48132
48332
|
value = randMember(fInfo.members, seed);
|
@@ -48143,7 +48343,8 @@ var _generateFieldData = function(field, options, seed) {
|
|
48143
48343
|
} else if(fInfo.type === "function") {
|
48144
48344
|
fInfo.field = field;
|
48145
48345
|
value = fInfo.generate(fInfo, seed);
|
48146
|
-
} else { // Default is number
|
48346
|
+
} else { // Default is number for all unknown type
|
48347
|
+
var prec = fInfo.prec != null ? fInfo.prec : 0;
|
48147
48348
|
value = randNumber(min, max, prec, seed);
|
48148
48349
|
}
|
48149
48350
|
fInfo.value = value;
|