@refinitiv-ui/efx-grid 6.0.34 → 6.0.36

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/lib/column-dragging/es6/ColumnDragging.js +50 -40
  2. package/lib/core/dist/core.css +1 -1
  3. package/lib/core/dist/core.js +248 -8
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/data/DataCache.js +20 -1
  6. package/lib/core/es6/data/DataTable.d.ts +2 -0
  7. package/lib/core/es6/data/DataTable.js +18 -1
  8. package/lib/core/es6/data/DataView.d.ts +2 -0
  9. package/lib/core/es6/data/DataView.js +11 -0
  10. package/lib/core/es6/grid/Core.d.ts +12 -0
  11. package/lib/core/es6/grid/Core.js +88 -3
  12. package/lib/core/es6/grid/ILayoutGrid.js +4 -0
  13. package/lib/core/es6/grid/LayoutGrid.d.ts +4 -0
  14. package/lib/core/es6/grid/LayoutGrid.js +95 -3
  15. package/lib/core/es6/grid/VirtualizedLayoutGrid.js +6 -0
  16. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +6 -0
  17. package/lib/core/es6/tr-grid-theme.js +1 -1
  18. package/lib/grid/index.js +1 -1
  19. package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
  20. package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
  21. package/lib/grid/themes/halo/efx-grid.less +1 -1
  22. package/lib/grid/themes/halo/light/efx-grid.js +1 -1
  23. package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
  24. package/lib/rt-grid/dist/rt-grid.js +367 -148
  25. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  26. package/lib/rt-grid/es6/Grid.js +37 -31
  27. package/lib/rt-grid/es6/RowDefSorter.d.ts +5 -5
  28. package/lib/rt-grid/es6/RowDefSorter.js +165 -71
  29. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +66 -0
  30. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -0
  31. package/lib/tr-grid-column-stack/es6/ColumnStack.js +566 -607
  32. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +1 -1
  33. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +4 -1
  34. package/lib/tr-grid-range-bar/es6/RangeBar.js +99 -39
  35. package/lib/tr-grid-row-dragging/es6/RowDragging.js +14 -3
  36. package/lib/tr-grid-rowcoloring/es6/RowColoring.js +3 -2
  37. package/lib/tr-grid-util/es6/DragUI.js +7 -3
  38. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +7 -1
  39. package/lib/tr-grid-util/es6/GroupDefinitions.js +39 -3
  40. package/lib/tr-grid-util/es6/jet/DataGenerator.js +36 -33
  41. package/lib/types/es6/ColumnStack.d.ts +2 -0
  42. package/lib/types/es6/Core/data/DataTable.d.ts +3 -1
  43. package/lib/types/es6/Core/data/DataView.d.ts +2 -0
  44. package/lib/types/es6/Core/grid/Core.d.ts +12 -0
  45. package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +5 -5
  46. package/lib/versions.json +8 -8
  47. package/package.json +1 -1
@@ -9380,7 +9380,8 @@ DataCache_DataCache.prototype._insertRic = function (subId, ric, values) {
9380
9380
  // We cannot cache event arguments because user may want to collect all the updates
9381
9381
  this._onADCForNewRic(subId, ric);
9382
9382
 
9383
- if (!this.getRowData(rid)) { // Ensure that we have subscription id and ric from Quotes2
9383
+ var rowData = this.getRowData(rid);
9384
+ if (!rowData) { // Ensure that we have subscription id and ric from Quotes2
9384
9385
  var tmp = values;
9385
9386
 
9386
9387
  values = {}; // Clone a new object for duplicated ric
@@ -9391,6 +9392,11 @@ DataCache_DataCache.prototype._insertRic = function (subId, ric, values) {
9391
9392
 
9392
9393
  values["SUB_ID"] = subId;
9393
9394
  values["RIC"] = ric;
9395
+ } else {
9396
+ var rowDef = rowData["ROW_DEF"];
9397
+ if(rowDef && rowDef.isChain()){
9398
+ values["SUB_ID"] = subId;
9399
+ }
9394
9400
  }
9395
9401
 
9396
9402
  this.setRowData(rid, values);
@@ -9427,6 +9433,12 @@ DataCache_DataCache.prototype._onQ2SubAdded = function (e) {
9427
9433
  var sub = subs[i];
9428
9434
  var ric = sub["ric"];
9429
9435
 
9436
+ // chain subId fires twice, one with "_ci_" and one without "_ci_"
9437
+ // the subId with "_ci_" should be ignore
9438
+ if(sub["id"].indexOf("_ci_") >= 0){
9439
+ continue;
9440
+ }
9441
+
9430
9442
  this.addSubscription(sub, ric);
9431
9443
 
9432
9444
  if (duplicateSubIds) { // There will be no network request for duplicate subs, and hence we need to update the data from our cache
@@ -9451,6 +9463,13 @@ DataCache_DataCache.prototype._onQ2SubRemoved = function (e) {
9451
9463
 
9452
9464
  for (var i = 0; i < len; ++i) {
9453
9465
  var sub = subs[i];
9466
+
9467
+ // chain subId fires twice, one with "_ci_" and one without "_ci_"
9468
+ // the subId with "_ci_" should be ignore
9469
+ if(sub["id"].indexOf("_ci_") >= 0){
9470
+ continue;
9471
+ }
9472
+
9454
9473
  this.removeSubscription(sub);
9455
9474
  }
9456
9475
  };
@@ -12129,7 +12148,24 @@ DataTable.prototype.setSortingLogic = function(func) {
12129
12148
  * @param {DataTable.SortLogic} func Use null to remove current sorting logic
12130
12149
  */
12131
12150
  DataTable.prototype.setColumnSortingLogic = function(cid, func) {
12132
- this._compMap[cid] = func;
12151
+ if(cid) {
12152
+ this._compMap[cid] = func;
12153
+ }
12154
+ };
12155
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
12156
+ * @public
12157
+ * @param {string=} cid
12158
+ * @return {DataTable.SortLogic}
12159
+ */
12160
+ DataTable.prototype.getColumnSortingLogic = function(cid) {
12161
+ if(cid) {
12162
+ var logic = this._compMap[cid];
12163
+ if(logic) {
12164
+ return logic;
12165
+ }
12166
+ }
12167
+
12168
+ return this._compMap["_default"] || null;
12133
12169
  };
12134
12170
 
12135
12171
  /** Freeze data table so that no event is fired for data processing until executing {@link DataTable#unfreeze} method
@@ -12292,11 +12328,12 @@ DataTable.prototype.getSegmentParentRowId = function(rid) {
12292
12328
  /**
12293
12329
  * @public
12294
12330
  * @param {Array.<string>=} rids If no row id is given, row ids of this data table is used instead
12331
+ * @param {boolean=} partial Indicating that the given ids are not the whole list
12295
12332
  * @return {Array.<number>} Return null if there is no segmentation
12296
12333
  */
12297
- DataTable.prototype.getSegmentValues = function(rids) {
12334
+ DataTable.prototype.getSegmentValues = function(rids, partial) {
12298
12335
  if(this._segments) {
12299
- return this._segments.getSegmentValues(rids || this._rids);
12336
+ return this._segments.getSegmentValues(rids || this._rids, partial);
12300
12337
  }
12301
12338
  return null;
12302
12339
  };
@@ -29444,6 +29481,17 @@ DataView.prototype.setColumnSortingLogic = function(cid, func) {
29444
29481
  this._dt.setColumnSortingLogic(cid, func);
29445
29482
  }
29446
29483
  };
29484
+ /** Get sorting logic for the specified field. Default logic is returned, if no logic is specified for the column
29485
+ * @public
29486
+ * @param {string=} cid
29487
+ * @return {DataTable.SortLogic}
29488
+ */
29489
+ DataView.prototype.getColumnSortingLogic = function(cid) {
29490
+ if(this._dt) {
29491
+ return this._dt.getColumnSortingLogic(cid);
29492
+ }
29493
+ return null;
29494
+ };
29447
29495
  /** Check if this view is in sorting mode
29448
29496
  * @public
29449
29497
  * @return {boolean}
@@ -35180,6 +35228,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
35180
35228
 
35181
35229
  // eslint-disable-line
35182
35230
 
35231
+
35183
35232
  // eslint-disable-line
35184
35233
 
35185
35234
 
@@ -35379,7 +35428,9 @@ var Core = function (opt_initializer) {
35379
35428
  "rowRemoved",
35380
35429
  "columnPositionChanged",
35381
35430
  "rowPositionChanged",
35382
- "beforeColumnBoundUpdate"
35431
+ "beforeColumnBoundUpdate",
35432
+ "beforeBatchOperation",
35433
+ "afterBatchOperation"
35383
35434
  );
35384
35435
 
35385
35436
  // For debugging in advanced optimization mode
@@ -35454,6 +35505,15 @@ Core.SectionReference;
35454
35505
  */
35455
35506
  Core.MouseInfo;
35456
35507
 
35508
+ /** @typedef {Object} Core~BatchInfo
35509
+ * @private
35510
+ * @property {string=} reset //set columns
35511
+ * @property {string=} insertion //add cols
35512
+ * @property {string=} removal //remove cols
35513
+ * @property {string=} moving //reorder
35514
+ */
35515
+ Core.BatchInfo;
35516
+
35457
35517
  /** @typedef {Core.MouseInfo|ElementWrapper|Element} Core~CellReference
35458
35518
  * @description A section in core grid can be refered by the following object <br>
35459
35519
  * `{Core.MouseInfo}` : Object with valid x, y coordinates and section index <br>
@@ -35708,6 +35768,10 @@ Core.prototype._rowHeightTimerId = 0;
35708
35768
  * @private
35709
35769
  */
35710
35770
  Core.prototype._groupDefs = null;
35771
+ /** @type {BatchInfo}
35772
+ * @private
35773
+ */
35774
+ Core.prototype._batches = null;
35711
35775
  //#region Public Methods
35712
35776
 
35713
35777
  /**
@@ -35715,7 +35779,7 @@ Core.prototype._groupDefs = null;
35715
35779
  * @return {string}
35716
35780
  */
35717
35781
  Core.getVersion = function () {
35718
- return "5.1.44";
35782
+ return "5.1.49";
35719
35783
  };
35720
35784
  /** {@link ElementWrapper#dispose}
35721
35785
  * @override
@@ -36654,6 +36718,10 @@ Core.prototype.removeColumnAt = function (index) {
36654
36718
 
36655
36719
  if (this._hasListener("columnRemoved")) {
36656
36720
  var e = {};
36721
+ var batches = this._batches;
36722
+ if(batches){
36723
+ e["batches"] = batches;
36724
+ }
36657
36725
  e["atTheMiddle"] = true;
36658
36726
  e["colIndex"] = index;
36659
36727
  e["columns"] = "deprecated";
@@ -39498,6 +39566,40 @@ Core.prototype.getColumnGroupChildIds = function (groupId) {
39498
39566
  }
39499
39567
  return null;
39500
39568
  };
39569
+
39570
+ /** @public
39571
+ * @param {string} batchType
39572
+ * @return {boolean}
39573
+ * @fires Core#beforeBatchOperation
39574
+ */
39575
+ Core.prototype.startBatch = function (batchType) {
39576
+ if(!batchType){
39577
+ return false;
39578
+ }
39579
+ if(!this._batches){
39580
+ this._batches = {};
39581
+ }
39582
+ this._batches[batchType] = batchType;
39583
+ this._dispatch("beforeBatchOperation", { batches: this._batches, batchType: batchType });
39584
+ return true;
39585
+ };
39586
+ /** @public
39587
+ * @param {string} batchType
39588
+ * @return {boolean}
39589
+ * @fires Core#afterBatchOperation
39590
+ */
39591
+ Core.prototype.stopBatch = function (batchType) {
39592
+ if(!batchType){
39593
+ return false;
39594
+ }
39595
+ this._dispatch("afterBatchOperation", { batches: this._batches, batchType: batchType });
39596
+
39597
+ delete this._batches[batchType];
39598
+ if(Object(Util["f" /* isEmptyObject */])(this._batches)){
39599
+ this._batches = null;
39600
+ }
39601
+ return true;
39602
+ };
39501
39603
  //#endregion Public Methods
39502
39604
 
39503
39605
  //#region Private Methods
@@ -39741,6 +39843,10 @@ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx
39741
39843
  if (this._hasListener("columnAdded")) {
39742
39844
  var e = {};
39743
39845
  e["atTheMiddle"] = atTheMiddle;
39846
+ var batches = this._batches;
39847
+ if(batches){
39848
+ e["batches"] = batches;
39849
+ }
39744
39850
  if(count === 1) {
39745
39851
  e["colIndex"] = at;
39746
39852
  e["context"] = ctx;
@@ -39892,6 +39998,10 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
39892
39998
 
39893
39999
  if (this._hasListener("columnRemoved")) {
39894
40000
  var e = {};
40001
+ var batches = this._batches;
40002
+ if(batches){
40003
+ e["batches"] = batches;
40004
+ }
39895
40005
  for (var c = colCount; --c >= newCount; ) {
39896
40006
  var colDef = removedCols[c - newCount];
39897
40007
  e["colIndex"] = c;
@@ -41442,73 +41552,150 @@ DataConnector.prototype.reset = function () {
41442
41552
  /* harmony default export */ var js_DataConnector = (DataConnector);
41443
41553
 
41444
41554
  // CONCATENATED MODULE: ./src/js/RowDefSorter.js
41555
+
41556
+
41557
+ /** @private
41558
+ * @param {*} a
41559
+ * @param {*} b
41560
+ * @param {number} order
41561
+ * @return {number}
41562
+ */
41563
+ var _defaultCompare = function(a, b, order) {
41564
+ if(a == null || a !== a) {
41565
+ if(b == null || b !== b) {
41566
+ return 0;
41567
+ }
41568
+ return 1;
41569
+ }
41570
+ if(b == null || b !== b) {
41571
+ return -1;
41572
+ }
41573
+
41574
+ if(a < b) {
41575
+ return -order;
41576
+ }
41577
+ if(b < a) {
41578
+ return order;
41579
+ }
41580
+ return 0;
41581
+ };
41582
+
41445
41583
  /** @constructor
41446
41584
  */
41447
41585
  var RowDefSorter = function() {
41448
41586
  this._defaultSorter = this._defaultSorter.bind(this);
41449
41587
  this._dataSorter = this._dataSorter.bind(this);
41450
41588
  this._rowDefSorter = this._rowDefSorter.bind(this);
41589
+ this._multiColumnsSorter = this._multiColumnsSorter.bind(this);
41451
41590
 
41452
- this._sortContext = {};
41591
+ this._globalContext = {};
41592
+ this._sortParams = [];
41593
+ this._ctxCaches = [];
41453
41594
  };
41454
41595
 
41455
-
41456
- /** @type {string}
41596
+ /** @type {!Object}
41457
41597
  * @private
41458
41598
  */
41459
- RowDefSorter.prototype._field = "";
41460
- /** @type {!Object}
41599
+ RowDefSorter.prototype._globalContext;
41600
+ /** @type {!Array.<Array>}
41461
41601
  * @private
41462
41602
  */
41463
- RowDefSorter.prototype._sortContext;
41464
- /** @type {Function}
41603
+ RowDefSorter.prototype._sortParams;
41604
+ /** @type {!Array.<Object>}
41605
+ * @private
41606
+ */
41607
+ RowDefSorter.prototype._ctxCaches;
41608
+ /** @type {Array}
41465
41609
  * @private
41466
41610
  */
41467
- RowDefSorter.prototype._sortLogic = null;
41611
+ RowDefSorter.prototype._primaryParams;
41468
41612
 
41469
41613
 
41470
41614
  /** @public
41471
41615
  */
41472
41616
  RowDefSorter.prototype.dispose = function() {
41473
- this._sortLogic = null;
41474
- this._sortContext = {}; // Clear any existing reference
41617
+ this._globalContext = {}; // Clear any existing reference
41618
+ this._sortParams.length = 0;
41619
+ this._ctxCaches.length = 0;
41620
+ this._primaryParams = null;
41475
41621
  };
41476
41622
 
41477
41623
  /** @public
41478
- * @param {boolean=} rowSorting=false
41479
41624
  * @return {Function}
41480
41625
  */
41481
- RowDefSorter.prototype.getSorter = function(rowSorting) {
41482
- if(this._sortLogic) {
41483
- return rowSorting ? this._rowDefSorter : this._dataSorter;
41484
- } else {
41485
- return this._defaultSorter;
41626
+ RowDefSorter.prototype.getSorter = function() {
41627
+ this._primaryParams = null;
41628
+ var sortCount = this._sortParams.length;
41629
+ if(sortCount === 1) {
41630
+ var params = this._primaryParams = this._sortParams[0];
41631
+ var sortLogic = params[1];
41632
+ if(sortLogic) {
41633
+ var rowSorting = params[3];
41634
+ return rowSorting ? this._rowDefSorter : this._dataSorter;
41635
+ } else {
41636
+ return this._defaultSorter;
41637
+ }
41638
+ } else if(sortCount > 1) {
41639
+ return this._multiColumnsSorter;
41486
41640
  }
41487
- };
41488
- /** @public
41489
- * @param {Function=} func
41490
- */
41491
- RowDefSorter.prototype.setSortLogic = function(func) {
41492
- this._sortLogic = (typeof func === "function") ? func : null;
41493
- };
41494
41641
 
41642
+ return RowDefSorter._noSorting;
41643
+ };
41495
41644
 
41496
41645
  /** @public
41497
- * @param {string} field
41646
+ * @param {string} key
41647
+ * @param {*} value
41498
41648
  */
41499
- RowDefSorter.prototype.setField = function(field) {
41500
- if(!field) {
41501
- field = "";
41649
+ RowDefSorter.prototype.reset = function() {
41650
+ if(this._sortParams.length) {
41651
+ this._sortParams.length = 0;
41502
41652
  }
41503
- this._sortContext["field"] = this._field = field;
41504
- this._sortContext["formattedField"] = field + "_FORMATTED";
41505
41653
  };
41506
41654
  /** @public
41507
41655
  * @param {string} key
41508
41656
  * @param {*} value
41509
41657
  */
41510
41658
  RowDefSorter.prototype.setContext = function(key, value) {
41511
- this._sortContext[key] = value;
41659
+ this._globalContext[key] = value;
41660
+ };
41661
+ /** @public
41662
+ * @param {string} field
41663
+ * @param {Function} logic
41664
+ * @param {boolean} rowSorting
41665
+ * @param {string} order
41666
+ * @param {number} colIndex
41667
+ * @param {*} colDef
41668
+ */
41669
+ RowDefSorter.prototype.addColumnContext = function(field, logic, rowSorting, order, colIndex, colDef) {
41670
+ if(!field) {
41671
+ field = "";
41672
+ }
41673
+ var sortPriority = this._sortParams.length;
41674
+ var ctx = this._ctxCaches[sortPriority];
41675
+ if(!ctx) {
41676
+ ctx = this._ctxCaches[sortPriority] = Object(Util["b" /* cloneObject */])(this._globalContext);
41677
+ }
41678
+ var orderNum = 0;
41679
+ if(order === "a") {
41680
+ orderNum = 1;
41681
+ } else if(order === "d") {
41682
+ orderNum = -1;
41683
+ }
41684
+
41685
+ var params = [
41686
+ field, // 0
41687
+ (typeof logic === "function") ? logic : null, // 1
41688
+ ctx, // 2
41689
+ rowSorting, // 3
41690
+ orderNum // 4
41691
+ ];
41692
+
41693
+ ctx["colIndex"] = colIndex;
41694
+ ctx["field"] = field;
41695
+ ctx["formattedField"] = field + "_FORMATTED";
41696
+ ctx["colDef"] = colDef;
41697
+
41698
+ this._sortParams.push(params);
41512
41699
  };
41513
41700
 
41514
41701
  /** @private
@@ -41517,32 +41704,7 @@ RowDefSorter.prototype.setContext = function(key, value) {
41517
41704
  * @param {number} order
41518
41705
  * @return {number}
41519
41706
  */
41520
- RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
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
- }
41707
+ RowDefSorter._noSorting = function(rowDefA, rowDefB, order) {
41546
41708
  return 0;
41547
41709
  };
41548
41710
  /** @private
@@ -41551,16 +41713,30 @@ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
41551
41713
  * @param {number} order
41552
41714
  * @return {number}
41553
41715
  */
41716
+ RowDefSorter.prototype._defaultSorter = function(rowDefA, rowDefB, order) {
41717
+ var field = this._primaryParams[0];
41718
+ return _defaultCompare(
41719
+ rowDefA.getData(field),
41720
+ rowDefB.getData(field),
41721
+ order
41722
+ );
41723
+ };
41724
+ /** @private
41725
+ * @param {RowDefinition} rowDefA
41726
+ * @param {RowDefinition} rowDefB
41727
+ * @param {number} order
41728
+ * @return {number}
41729
+ */
41554
41730
  RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
41555
- var orderA = rowDefA.getGroupOrder();
41556
- var orderB = rowDefB.getGroupOrder();
41557
- if(orderA !== orderB) {
41558
- return orderA - orderB; // Regardless of sort order
41559
- }
41560
-
41561
- var a = rowDefA.getData(this._field);
41562
- var b = rowDefB.getData(this._field);
41563
- return this._sortLogic(a, b, order, this._sortContext);
41731
+ var params = this._primaryParams;
41732
+ var field = params[0];
41733
+ var sortLogic = params[1];
41734
+ return sortLogic(
41735
+ rowDefA.getData(field),
41736
+ rowDefB.getData(field),
41737
+ order,
41738
+ params[2]
41739
+ );
41564
41740
  };
41565
41741
  /** @private
41566
41742
  * @param {RowDefinition} rowDefA
@@ -41569,13 +41745,41 @@ RowDefSorter.prototype._dataSorter = function(rowDefA, rowDefB, order) {
41569
41745
  * @return {number}
41570
41746
  */
41571
41747
  RowDefSorter.prototype._rowDefSorter = function(rowDefA, rowDefB, order) {
41572
- var orderA = rowDefA.getGroupOrder();
41573
- var orderB = rowDefB.getGroupOrder();
41574
- if(orderA !== orderB) {
41575
- return orderA - orderB; // Regardless of sort order
41748
+ var params = this._primaryParams;
41749
+ var sortLogic = params[1];
41750
+ return sortLogic(rowDefA, rowDefB, order, params[2]);
41751
+ };
41752
+ /** @private
41753
+ * @param {RowDefinition} rowDefA
41754
+ * @param {RowDefinition} rowDefB
41755
+ * @param {number} primaryOrder
41756
+ * @return {number}
41757
+ */
41758
+ RowDefSorter.prototype._multiColumnsSorter = function(rowDefA, rowDefB, primaryOrder) {
41759
+ var sortParams = this._sortParams;
41760
+ var sortCount = sortParams.length;
41761
+ for(var i = 0; i < sortCount; ++i) {
41762
+ var params = sortParams[i];
41763
+ var field = params[0];
41764
+ var sortLogic = params[1];
41765
+ var ctx = params[2];
41766
+ var rowSorting = params[3];
41767
+ var orderNum = params[4];
41768
+ var ret = 0;
41769
+ if(sortLogic) {
41770
+ if(rowSorting) {
41771
+ ret = sortLogic(rowDefA, rowDefB, orderNum, ctx);
41772
+ } else {
41773
+ ret = sortLogic(rowDefA.getData(field), rowDefB.getData(field), orderNum, ctx);
41774
+ }
41775
+ } else {
41776
+ ret = _defaultCompare(rowDefA.getData(field), rowDefB.getData(field), orderNum);
41777
+ }
41778
+ if(ret) {
41779
+ return ret;
41780
+ }
41576
41781
  }
41577
-
41578
- return this._sortLogic(rowDefA, rowDefB, order, this._sortContext);
41782
+ return 0;
41579
41783
  };
41580
41784
 
41581
41785
  /* harmony default export */ var js_RowDefSorter = (RowDefSorter);
@@ -43124,6 +43328,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
43124
43328
  if (!this._dataSorting) { return; }
43125
43329
 
43126
43330
  var sortCount = this._sortStates.length;
43331
+ if(this._userManagedLogic && sortCount > 1) { // The logic is managed by the user. There is no point in using multi-column sorting
43332
+ sortCount = 1;
43333
+ }
43127
43334
  var orders = null;
43128
43335
  var sortLogics = null;
43129
43336
  var c_ref = null;
@@ -43139,6 +43346,9 @@ SortableTitlePlugin.prototype._sortDataView = function (opt_action) {
43139
43346
  } else {
43140
43347
  c_ref = this.getColumnSortingFields();
43141
43348
  }
43349
+ if(this._userManagedLogic && c_ref.length > 1) {
43350
+ c_ref = c_ref.slice(0, 1);
43351
+ }
43142
43352
  }
43143
43353
 
43144
43354
  // Perform sorting even if there is no sort state
@@ -43247,16 +43457,16 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
43247
43457
  symbol = t._createIconElem(icon, textContent);
43248
43458
  symbol.className = "sort-symbol";
43249
43459
  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
43460
  } else {
43258
43461
  cell["addClass"]("edge-indicator");
43259
43462
  }
43463
+
43464
+ if (t._sortStates.length > 1) {
43465
+ symbol = document.createElement("span");
43466
+ symbol.className = "priority-symbol";
43467
+ symbol.textContent = priority + 1;
43468
+ cell["insertFloatingIcon"](symbol, 1);
43469
+ }
43260
43470
  } else if (t._sortableIndicator) { // Can sort but currently not sorting
43261
43471
  icon = SortableTitlePlugin._icons["sortable"];
43262
43472
  symbol = t._createIconElem(icon, CODE_DIAMOND);
@@ -43716,6 +43926,7 @@ var Grid = function(placeholder, config) {
43716
43926
  t._dc = new DataCache_DataCache();
43717
43927
  t._dc.listen("dataChanged", t._onDataChanged);
43718
43928
  t._dc.listen("dataComposed", t._onDataComposed);
43929
+ t._dc.addStaticFields([ROW_DEF, SUB_ID]); // Static fields are deprecated, set fields to be ignore during clone in DataCache
43719
43930
 
43720
43931
  t._dt = new DataTable();
43721
43932
  t._dt.setSortingLogic(/** @type{Function} */(t._mainSorter));
@@ -44916,8 +45127,11 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
44916
45127
  if(colDef.getChildren()) { // Parent time series field doesn't provide hidden property
44917
45128
  colConfig["hidden"] = false;
44918
45129
  }
45130
+
45131
+ this._grid.startBatch("reset");
44919
45132
  this.insertColumn(colConfig, colIndex);
44920
45133
  this.removeColumn(colIndex + 1); // remove existing column after insert
45134
+ this._grid.stopBatch("reset");
44921
45135
  };
44922
45136
 
44923
45137
  /** to update column name when field info is loaded
@@ -45010,21 +45224,24 @@ Grid.prototype._shouldLoadFieldInfo = function (field) {
45010
45224
  * @param {Array.<Object>} columns Array of column options
45011
45225
  */
45012
45226
  Grid.prototype.setColumns = function(columns) {
45227
+ var grid = this._grid;
45013
45228
  var colCount = (columns) ? columns.length : 0;
45014
45229
 
45230
+ grid.startBatch("reset");
45015
45231
  this.removeAllColumns();
45016
45232
  if(colCount > 0) {
45017
45233
  var prevState = false;
45018
45234
  if(colCount > 1) {
45019
- prevState = this._grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
45235
+ prevState = grid.freezeLayout(true); // Insert multiple columns can be a huge time consuming
45020
45236
  }
45021
45237
  for(var i = 0; i < colCount; ++i) {
45022
45238
  this.insertColumn(columns[i], i);
45023
45239
  }
45024
45240
  if(colCount > 1) {
45025
- this._grid.freezeLayout(prevState);
45241
+ grid.freezeLayout(prevState);
45026
45242
  }
45027
45243
  }
45244
+ grid.stopBatch("reset");
45028
45245
  };
45029
45246
 
45030
45247
 
@@ -45033,6 +45250,8 @@ Grid.prototype.setColumns = function(columns) {
45033
45250
  * @param {Array.<Object>} columns Array of column options
45034
45251
  */
45035
45252
  Grid.prototype.restoreColumns = function(columns) {
45253
+ var grid = this._grid;
45254
+ grid.startBatch("reset");
45036
45255
  var configObj = this.getConfigObject();
45037
45256
  var previousColumns = configObj.columns;
45038
45257
 
@@ -45096,7 +45315,8 @@ Grid.prototype.restoreColumns = function(columns) {
45096
45315
  this._stp.sortColumns(sortingStates);
45097
45316
  }
45098
45317
 
45099
- this._grid.reorderColumns(columnOrdering);
45318
+ grid.reorderColumns(columnOrdering);
45319
+ grid.stopBatch("reset");
45100
45320
  };
45101
45321
 
45102
45322
  /** Remove all existing columns and add new columns based on the given texts/fields
@@ -45172,11 +45392,6 @@ Grid.prototype._onColumnAdded = function(e) {
45172
45392
  this._grid.enableColumnClass(idx, classes[i]);
45173
45393
  }
45174
45394
  var colField = colDef.getField();
45175
- if (!colDef.isRealTimeField()) {
45176
- if(this._dc) {
45177
- this._dc.addStaticFields([colField]);
45178
- }
45179
- }
45180
45395
  this._grid.setDataColumnName(idx, ROW_DEF); // This make ColumnDefinition renderer work
45181
45396
  var fields = colDef.getAllFields();
45182
45397
  var referrer = colDef.getId();
@@ -46789,33 +47004,34 @@ Grid.prototype._updateStreamingData = function() {
46789
47004
  * @param {Object} e
46790
47005
  */
46791
47006
  Grid.prototype._onPreDataSorting = function (e) {
46792
- var field = "";
46793
- var rowSorting = false;
46794
- var sortLogic = null;
46795
-
46796
- var states = this._stp.getSortingStates(); // WARNING: Use of deprecated function
46797
- var state = states ? states[0] : null; // TODO: Support multi-column sorting
46798
-
46799
- if(state) {
46800
- field = state["field"] || "";
46801
- var colIndex = this._stp.getSortedColumnIndex(0);
46802
- var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
46803
- this._sorter.setContext("colIndex", colIndex);
46804
- this._sorter.setContext("colDef", colDef);
47007
+ var objs = this._stp.getSortedColumns();
47008
+
47009
+ this._sorter.reset();
47010
+ if(Array.isArray(objs)) {
47011
+ var sortCount = objs.length;
47012
+ for(var i = 0; i < sortCount; ++i) {
47013
+ var obj = objs[i];
47014
+ var field = obj["field"] || "";
47015
+ var colIndex = obj["colIndex"];
47016
+ var colDef = (colIndex >= 0) ? this.getColumnDefinition(colIndex) : null;
47017
+
47018
+ var rowSorting = false;
47019
+ var sortLogic = null;
47020
+ if(colDef) {
47021
+ field = colDef.getField(); // WARNING: Field and logic could be out of sync
47022
+ rowSorting = colDef.isRowSorting();
47023
+ sortLogic = colDef.getSorter();
47024
+ }
47025
+ // TODO: get sortLogic from DataView
47026
+ // if(!sortLogic && field) {
47027
+ // sortLogic = state["sortLogic"];
47028
+ // }
46805
47029
 
46806
- if(colDef) {
46807
- field = colDef.getField(); // WARNING: Field and logic could be out of sync
46808
- sortLogic = colDef.getSorter();
46809
- rowSorting = colDef.isRowSorting();
47030
+ this._sorter.addColumnContext(field, sortLogic, rowSorting, obj["sortOrder"], colIndex, colDef);
46810
47031
  }
46811
47032
  }
46812
- if(!sortLogic && field) {
46813
- sortLogic = state["sortLogic"];
46814
- }
46815
47033
 
46816
- this._sorter.setField(field);
46817
- this._sorter.setSortLogic(sortLogic);
46818
- this._columnSorter = this._sorter.getSorter(rowSorting);
47034
+ this._columnSorter = this._sorter.getSorter();
46819
47035
  };
46820
47036
  /** @private
46821
47037
  * @param {RowDefinition} rowDefA
@@ -47716,7 +47932,7 @@ var _fieldInfo = {
47716
47932
  "words2": {type: "string", min: 3, max: 10},
47717
47933
  "words3": {type: "string", min: 5, max: 15},
47718
47934
  "sentence": {type: "string", min: 8, max: 20},
47719
- "id": {type: "function", generate: _generateId},
47935
+ "id": {type: "function", hash: 0, generate: _generateId},
47720
47936
  "companyName": {type: "set", members: jet_DataSet.companyName },
47721
47937
  "industry": {type: "set", members: jet_DataSet.industry },
47722
47938
  "market": {type: "set", members: jet_DataSet.market },
@@ -47736,14 +47952,16 @@ var getFieldInfo = function(field) {
47736
47952
  * @param {Object|Function} options
47737
47953
  */
47738
47954
  var addFieldInfo = function(field, options) {
47739
- var opt = options;
47740
- if(typeof options === "function") {
47741
- opt = {
47742
- type: "function",
47743
- generate: options
47744
- };
47955
+ if(field) {
47956
+ var opt = options;
47957
+ if(typeof options === "function") {
47958
+ opt = {
47959
+ type: "function",
47960
+ generate: options
47961
+ };
47962
+ }
47963
+ _fieldInfo[field] = opt; // WARNING: This could replace existing info
47745
47964
  }
47746
- _fieldInfo[field] = opt;
47747
47965
  };
47748
47966
 
47749
47967
  /** Return pseudo random number in the range of 0 to 1 (exclusive of 1)
@@ -48085,8 +48303,9 @@ var _generate2DArray = function(fields, options, seed) {
48085
48303
  */
48086
48304
  var _hash = function(str) {
48087
48305
  var sum = 0;
48088
- for(var i = str.length; --i >= 0;) {
48089
- sum += str.charCodeAt(i) * (i + 0.9);
48306
+ var i = str ? str.length : 0;
48307
+ while(--i >= 0) {
48308
+ sum += str.charCodeAt(i) * (i + 0.9879);
48090
48309
  }
48091
48310
  return sum;
48092
48311
  };
@@ -48098,35 +48317,34 @@ var _hash = function(str) {
48098
48317
  */
48099
48318
  var _generateFieldData = function(field, options, seed) {
48100
48319
  var fInfo = getFieldInfo(field);
48320
+ if(!fInfo.type) {
48321
+ fInfo.type = "number";
48322
+ addFieldInfo(field, fInfo);
48323
+ }
48324
+ if(fInfo.fixedValue){
48325
+ fInfo.value = value;
48326
+ return fInfo;
48327
+ }
48328
+ if(seed != null) {
48329
+ if(fInfo.hash == null) {
48330
+ fInfo.hash = _hash(field);
48331
+ }
48332
+ seed += fInfo.hash; // Make each field unique for the same seed
48333
+ }
48334
+
48101
48335
  var min = fInfo.min != null ? fInfo.min : 100; // WARNING: Default values are non-standard values
48102
48336
  var max = fInfo.max != null ? fInfo.max : 10000;
48103
- var prec = fInfo.prec != null ? fInfo.prec : 0;
48104
48337
  var value;
48105
48338
 
48106
- if(fInfo.fixedValue){
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") {
48339
+ if(fInfo.type === "string") {
48120
48340
  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
48341
  value = randString(min, max, seed);
48128
48342
  } else {
48129
- value = options.text || "";
48343
+ if(options) {
48344
+ value = options.text || "";
48345
+ } else {
48346
+ value = "";
48347
+ }
48130
48348
  }
48131
48349
  } else if(fInfo.type === "set") {
48132
48350
  value = randMember(fInfo.members, seed);
@@ -48143,7 +48361,8 @@ var _generateFieldData = function(field, options, seed) {
48143
48361
  } else if(fInfo.type === "function") {
48144
48362
  fInfo.field = field;
48145
48363
  value = fInfo.generate(fInfo, seed);
48146
- } else { // Default is number
48364
+ } else { // Default is number for all unknown type
48365
+ var prec = fInfo.prec != null ? fInfo.prec : 0;
48147
48366
  value = randNumber(min, max, prec, seed);
48148
48367
  }
48149
48368
  fInfo.value = value;