@refinitiv-ui/efx-grid 6.0.84 → 6.0.85
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +199 -144
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +0 -4
- package/lib/core/es6/grid/Core.js +15 -13
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +13 -3
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +184 -131
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +275 -159
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +1 -2
- package/lib/rt-grid/es6/Grid.js +7 -7
- package/lib/tr-grid-filter-input/es6/FilterInput.js +31 -2
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +4 -1
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +3 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +13 -2
- package/lib/tr-grid-util/es6/FieldFormatter.js +4 -2
- package/lib/tr-grid-util/es6/NumberFormatter.js +2 -2
- package/lib/types/es6/Core/grid/Core.d.ts +0 -4
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +13 -3
- package/lib/types/es6/RowFiltering.d.ts +4 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
package/lib/core/dist/core.js
CHANGED
@@ -26155,7 +26155,7 @@ Core_Core.prototype._hasPendingRowChange = false;
|
|
26155
26155
|
* @return {string}
|
26156
26156
|
*/
|
26157
26157
|
Core_Core.getVersion = function () {
|
26158
|
-
return "5.1.
|
26158
|
+
return "5.1.89";
|
26159
26159
|
};
|
26160
26160
|
/** {@link ElementWrapper#dispose}
|
26161
26161
|
* @override
|
@@ -28270,27 +28270,30 @@ Core_Core.prototype.preserveGridSize = function (preserve) {
|
|
28270
28270
|
};
|
28271
28271
|
/** @public
|
28272
28272
|
* @param {number} colIndex
|
28273
|
-
* @return {Object}
|
28273
|
+
* @return {!Object} Column data object
|
28274
28274
|
*/
|
28275
28275
|
Core_Core.prototype.getColumnData = function (colIndex) {
|
28276
|
-
return this._getColumnDef(colIndex)["columnData"]
|
28276
|
+
return this._getColumnDef(colIndex)["columnData"];
|
28277
28277
|
};
|
28278
28278
|
/** @public
|
28279
|
+
* @deprecated
|
28280
|
+
* @ignore
|
28279
28281
|
* @param {number} colIndex
|
28280
28282
|
* @param {Object} userData
|
28281
28283
|
* @return {Object}
|
28282
28284
|
*/
|
28283
|
-
Core_Core.prototype.setColumnData = function (colIndex, userData) {
|
28284
|
-
this._getColumnDef(colIndex)["columnData"] = userData;
|
28285
|
+
Core_Core.prototype.setColumnData = function (colIndex, userData) {
|
28286
|
+
this._getColumnDef(colIndex)["columnData"] = userData || {};
|
28285
28287
|
return userData;
|
28286
28288
|
};
|
28287
28289
|
/** @public
|
28290
|
+
* @function
|
28291
|
+
* @deprecated
|
28292
|
+
* @ignore
|
28288
28293
|
* @param {number} colIndex
|
28289
28294
|
* @return {!Object}
|
28290
28295
|
*/
|
28291
|
-
Core_Core.prototype.newColumnData =
|
28292
|
-
return this.getColumnData(colIndex) || {};
|
28293
|
-
};
|
28296
|
+
Core_Core.prototype.newColumnData = Core_Core.prototype.getColumnData;
|
28294
28297
|
/** @public
|
28295
28298
|
* @param {number} colIndex
|
28296
28299
|
* @param {boolean=} alwaysRender
|
@@ -28304,10 +28307,7 @@ Core_Core.prototype.setAlwaysRenderColumn = function(colIndex, alwaysRender) {
|
|
28304
28307
|
*/
|
28305
28308
|
Core_Core.prototype._isAlwaysRenderColumn = function (colIndex) {
|
28306
28309
|
var colData = this.getColumnData(colIndex);
|
28307
|
-
|
28308
|
-
return colData["alwaysRender"] === true;
|
28309
|
-
}
|
28310
|
-
return false;
|
28310
|
+
return colData["alwaysRender"] === true;
|
28311
28311
|
};
|
28312
28312
|
|
28313
28313
|
/** @public
|
@@ -30763,7 +30763,9 @@ Core_Core.prototype._getColumnDef = function (colIndex) {
|
|
30763
30763
|
}
|
30764
30764
|
return def;
|
30765
30765
|
}
|
30766
|
-
return {
|
30766
|
+
return {
|
30767
|
+
"columnData": {}
|
30768
|
+
};
|
30767
30769
|
};
|
30768
30770
|
/** Retrieve 1 or 2 level of nested object definition
|
30769
30771
|
* @private
|
@@ -31620,16 +31622,26 @@ es6_Ext.inherits(SortableTitlePlugin, event_EventDispatcher);
|
|
31620
31622
|
* @typedef {"a" | "ascending" | "d" | "descending" | "n" | null} SortableTitlePlugin~SortOrder
|
31621
31623
|
*/
|
31622
31624
|
|
31623
|
-
/**
|
31625
|
+
/** An object that specifies how sorting should be performed
|
31624
31626
|
* @typedef {Object} SortableTitlePlugin~InitialSort
|
31625
|
-
* @property {number=} colIndex
|
31626
|
-
* @property {string=} colId
|
31627
|
-
* @property {string=} field
|
31627
|
+
* @property {number=} colIndex Column index of a column to be sorted
|
31628
|
+
* @property {string=} colId Column id of a column to be sorted
|
31629
|
+
* @property {string=} field Field of a column to be sorted
|
31628
31630
|
* @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
|
31629
|
-
* @property {SortableTitlePlugin~SortOrder=} order Alias
|
31631
|
+
* @property {SortableTitlePlugin~SortOrder=} order Alias to sortOrder
|
31630
31632
|
*/
|
31631
31633
|
SortableTitlePlugin.InitialSort;
|
31632
31634
|
|
31635
|
+
/** An object that specifies how sorting should be performed
|
31636
|
+
* @typedef {Object} SortableTitlePlugin~SortingDefinition
|
31637
|
+
* @property {number=} colIndex Column index of a column to be sorted
|
31638
|
+
* @property {string=} colId Column id of a column to be sorted
|
31639
|
+
* @property {string=} field Field of a column to be sorted
|
31640
|
+
* @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
|
31641
|
+
* @property {SortableTitlePlugin~SortOrder=} order Alias to sortOrder
|
31642
|
+
*/
|
31643
|
+
SortableTitlePlugin.SortingDefinition;
|
31644
|
+
|
31633
31645
|
/** The sorting properties for column option.
|
31634
31646
|
* @typedef {Object} SortableTitlePlugin~ColumnOptions
|
31635
31647
|
* @property {boolean=} sortable=false If enable, the column can be sorted by user click
|
@@ -31645,7 +31657,7 @@ SortableTitlePlugin.ColumnOptions;
|
|
31645
31657
|
|
31646
31658
|
/** The configuration object for sorting options. This can be defined by `sorting` property in CompositeGrid configuration object.
|
31647
31659
|
* @typedef {Object} SortableTitlePlugin~Options
|
31648
|
-
* @property {(SortableTitlePlugin~InitialSort|Array.<SortableTitlePlugin.
|
31660
|
+
* @property {(SortableTitlePlugin~InitialSort|Array.<SortableTitlePlugin.SortingDefinition>)=} initialSort=null Set this config to initiate sorting after grid is created.
|
31649
31661
|
* @property {(boolean|number)=} multicolumn=false Allow multiple columns to be sorted at the same time. If number is defined, it is treated as maximum number of column to be sorted.
|
31650
31662
|
* @property {(boolean|number)=} multiColumn=false Alias to `multicolumn`
|
31651
31663
|
* @property {boolean=} threeStatesSorting=false If enabled, sorting will cycle through ascending, descending and original order states. This option is deprecated in favor of sortingSequence option
|
@@ -31705,7 +31717,7 @@ SortableTitlePlugin.prototype._delayInterval = 0;
|
|
31705
31717
|
*/
|
31706
31718
|
SortableTitlePlugin.prototype._lastMouseDown = 0;
|
31707
31719
|
/** @private
|
31708
|
-
* @type {SortableTitlePlugin.
|
31720
|
+
* @type {SortableTitlePlugin.SortingDefinition}
|
31709
31721
|
*/
|
31710
31722
|
SortableTitlePlugin.prototype._initialSort = null;
|
31711
31723
|
/** @private
|
@@ -32028,7 +32040,8 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
|
|
32028
32040
|
}
|
32029
32041
|
field = opt["field"];
|
32030
32042
|
if (field) {
|
32031
|
-
|
32043
|
+
// WARNING: When Core's column has no field, sortBy property does not get returned
|
32044
|
+
if(col["field"] != null && col["field"] !== field) {
|
32032
32045
|
col["sortBy"] = field;
|
32033
32046
|
} // else The default value is an empty sortBy, which refers to the same column field by default.
|
32034
32047
|
|
@@ -32246,18 +32259,38 @@ SortableTitlePlugin.prototype.getSortOrder = function (colIndex) {
|
|
32246
32259
|
* @return {number} Return negative value if there is no sorted column
|
32247
32260
|
*/
|
32248
32261
|
SortableTitlePlugin.prototype.getSortedColumnIndex = function (priority) {
|
32249
|
-
return this.
|
32262
|
+
return this._getColumnIndex(this._sortStates[priority || 0]);
|
32250
32263
|
};
|
32251
32264
|
/** Start with 0 (the first column that is being sorted). The highest number will be sorted last. Negative value means the specified column is not sorted
|
32252
32265
|
* @public
|
32253
32266
|
* @param {number} colIndex
|
32267
|
+
* @param {string=} colRef field or column id
|
32254
32268
|
* @return {number}
|
32255
32269
|
*/
|
32256
|
-
SortableTitlePlugin.prototype.getSortPriority = function (colIndex) {
|
32257
|
-
var
|
32258
|
-
|
32259
|
-
|
32260
|
-
|
32270
|
+
SortableTitlePlugin.prototype.getSortPriority = function (colIndex, colRef) {
|
32271
|
+
var host = this._hosts[0];
|
32272
|
+
if(host) {
|
32273
|
+
var i;
|
32274
|
+
var len = this._sortStates.length;
|
32275
|
+
if(colIndex >= 0) {
|
32276
|
+
var colId = host.getColumnId(colIndex);
|
32277
|
+
if(colId) {
|
32278
|
+
for(i = 0; i < len; ++i) {
|
32279
|
+
if(this._sortStates[i]["colId"] === colId) {
|
32280
|
+
return i;
|
32281
|
+
}
|
32282
|
+
}
|
32283
|
+
}
|
32284
|
+
} else if(colRef) {
|
32285
|
+
for(i = 0; i < len; ++i) {
|
32286
|
+
var sortState = this._sortStates[i];
|
32287
|
+
if(sortState["colId"] === colRef) {
|
32288
|
+
return i;
|
32289
|
+
}
|
32290
|
+
if(sortState["field"] === colRef) {
|
32291
|
+
return i;
|
32292
|
+
}
|
32293
|
+
}
|
32261
32294
|
}
|
32262
32295
|
}
|
32263
32296
|
return -1;
|
@@ -32270,7 +32303,7 @@ SortableTitlePlugin.prototype.isColumnSorted = function (colIndex) {
|
|
32270
32303
|
return this.getSortPriority(colIndex) >= 0;
|
32271
32304
|
};
|
32272
32305
|
/** @public
|
32273
|
-
* @return {Array.<Object>} Array of
|
32306
|
+
* @return {Array.<Object>} Array of objects with colIndex, colId, field, and sortOrder properties
|
32274
32307
|
*/
|
32275
32308
|
SortableTitlePlugin.prototype.getSortedColumns = function () {
|
32276
32309
|
var len = this._sortStates.length;
|
@@ -32280,12 +32313,21 @@ SortableTitlePlugin.prototype.getSortedColumns = function () {
|
|
32280
32313
|
for (var i = 0; i < len; ++i) {
|
32281
32314
|
var colIndex = this.getSortedColumnIndex(i);
|
32282
32315
|
var state = this._sortStates[i];
|
32283
|
-
|
32284
|
-
|
32285
|
-
|
32286
|
-
|
32287
|
-
|
32288
|
-
}
|
32316
|
+
var retObj = {};
|
32317
|
+
var colId = "";
|
32318
|
+
if(colIndex >= 0) {
|
32319
|
+
retObj["colIndex"] = colIndex;
|
32320
|
+
colId = this._getColumnId(colIndex);
|
32321
|
+
}
|
32322
|
+
if(colId) {
|
32323
|
+
retObj["colId"] = colId;
|
32324
|
+
}
|
32325
|
+
var field = state["field"] || "";
|
32326
|
+
if(field) {
|
32327
|
+
retObj["field"] = field;
|
32328
|
+
}
|
32329
|
+
retObj["sortOrder"] = state["sortOrder"] || "n";
|
32330
|
+
arr[i] = retObj;
|
32289
32331
|
}
|
32290
32332
|
return arr;
|
32291
32333
|
};
|
@@ -32304,35 +32346,22 @@ SortableTitlePlugin.prototype.isSorting = function () {
|
|
32304
32346
|
* @fires SortableTitlePlugin#columnSorted
|
32305
32347
|
*/
|
32306
32348
|
SortableTitlePlugin.prototype.sortColumn = function (colRef, sortOrder, opt_arg) {
|
32307
|
-
|
32308
|
-
if (state) {
|
32309
|
-
this._sortColumn([state], opt_arg);
|
32310
|
-
}
|
32349
|
+
this._sortColumn(this._prepareSorting(colRef, sortOrder), opt_arg);
|
32311
32350
|
};
|
32312
32351
|
|
32313
32352
|
/** Sort multiple columns at once
|
32314
32353
|
* @public
|
32315
|
-
* @param {Array.<SortableTitlePlugin.
|
32354
|
+
* @param {Array.<SortableTitlePlugin.SortingDefinition>} sortOptions Input an array to specify the multiple column sort order
|
32316
32355
|
* @param {Object=} opt_arg Event argument to be sent with preDataSorting event
|
32317
32356
|
* @fires SortableTitlePlugin#preDataSorting
|
32318
32357
|
* @fires SortableTitlePlugin#columnSorted
|
32319
32358
|
*/
|
32320
32359
|
SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
|
32321
32360
|
if (Array.isArray(sortOptions)) {
|
32322
|
-
var
|
32323
|
-
|
32324
|
-
|
32325
|
-
|
32326
|
-
if(colRef == null) {
|
32327
|
-
colRef = opt["colIndex"];
|
32328
|
-
}
|
32329
|
-
var state = this._prepareSorting(
|
32330
|
-
colRef,
|
32331
|
-
opt["sortOrder"] || opt["order"]
|
32332
|
-
);
|
32333
|
-
if (state) {
|
32334
|
-
states.push(state);
|
32335
|
-
}
|
32361
|
+
var len = sortOptions.length;
|
32362
|
+
var states = new Array(len);
|
32363
|
+
for (var i = 0; i < len; i++) {
|
32364
|
+
states[i] = this._prepareSorting(sortOptions[i]);
|
32336
32365
|
}
|
32337
32366
|
this._sortColumn(states, opt_arg);
|
32338
32367
|
}
|
@@ -32433,7 +32462,10 @@ SortableTitlePlugin.prototype.getColumnSortingField = function (colIndex) {
|
|
32433
32462
|
if (field == null && !this._rowDefMode) { // Old CompositeGrid may store sorting field in DataColumnName
|
32434
32463
|
var host = this._hosts[0];
|
32435
32464
|
if (host) {
|
32436
|
-
field = host.
|
32465
|
+
field = host.getColumnField(colIndex);
|
32466
|
+
if(!field) {
|
32467
|
+
field = host.getDataColumnName(colIndex);
|
32468
|
+
}
|
32437
32469
|
if(field && sortOptions) {
|
32438
32470
|
sortOptions["field"] = field; // Cache for later use
|
32439
32471
|
}
|
@@ -32468,28 +32500,20 @@ SortableTitlePlugin.prototype.setColumnSortingField = function (colIndex, field,
|
|
32468
32500
|
}
|
32469
32501
|
}
|
32470
32502
|
};
|
32503
|
+
|
32504
|
+
/** @private
|
32505
|
+
* @param {Object} sortState
|
32506
|
+
* @returns {string}
|
32507
|
+
*/
|
32508
|
+
var _toField = function(sortState) {
|
32509
|
+
return sortState["field"] || "";
|
32510
|
+
};
|
32471
32511
|
/** Return array of the fields from the currently sorted columns
|
32472
32512
|
* @public
|
32473
32513
|
* @return {!Array.<string>} fields of each sorting states
|
32474
32514
|
*/
|
32475
32515
|
SortableTitlePlugin.prototype.getColumnSortingFields = function () {
|
32476
|
-
|
32477
|
-
var ary = new Array(len);
|
32478
|
-
var host = this._hosts[0];
|
32479
|
-
|
32480
|
-
for(var i = 0; i < len; ++i) {
|
32481
|
-
var sortOptions = this._sortStates[i];
|
32482
|
-
var field = sortOptions["field"];
|
32483
|
-
if(!field && !this._rowDefMode) {
|
32484
|
-
var colIndex = this._getColumnIndexByOptions(sortOptions); // Slow
|
32485
|
-
field = host.getDataColumnName(colIndex);
|
32486
|
-
if(field) {
|
32487
|
-
sortOptions["field"] = field; // Cache for later use
|
32488
|
-
}
|
32489
|
-
}
|
32490
|
-
ary[i] = field || "";
|
32491
|
-
}
|
32492
|
-
return ary;
|
32516
|
+
return this._sortStates.map(_toField);
|
32493
32517
|
};
|
32494
32518
|
|
32495
32519
|
/** This is deprecated in favor of setSortingSequence method. Move existing sort order to the front of sorting sequence. New sort order will be added, if the specified sort order does not exist in current sorting sequence.
|
@@ -32498,7 +32522,6 @@ SortableTitlePlugin.prototype.getColumnSortingFields = function () {
|
|
32498
32522
|
* @param {string=} sortOrder="a" "ascending", "descending", "none"
|
32499
32523
|
* @see {@link SortableTitlePlugin#setSortingSequence}
|
32500
32524
|
*/
|
32501
|
-
|
32502
32525
|
SortableTitlePlugin.prototype.setFirstSortOrder = function (colIdentifier, sortOrder) {
|
32503
32526
|
if (sortOrder) {
|
32504
32527
|
sortOrder = SortableTitlePlugin._toSortOrder(sortOrder);
|
@@ -32716,10 +32739,8 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
|
|
32716
32739
|
if (this._canClickToSort(hitObj)) {
|
32717
32740
|
var colIndex = hitObj["colIndex"];
|
32718
32741
|
// _proceedSorting() method is always produced by user clicking at the header // Thus, this operation is guaranteed to be a user action
|
32719
|
-
|
32720
|
-
|
32721
|
-
this._sortColumn([state], { "isUserAction": true });
|
32722
|
-
}
|
32742
|
+
this.sortColumn(colIndex, null, { "isUserAction": true });
|
32743
|
+
|
32723
32744
|
var grid = hitObj["grid"];
|
32724
32745
|
if(grid && grid["focus"]) {
|
32725
32746
|
grid["focus"]();
|
@@ -32729,7 +32750,7 @@ SortableTitlePlugin.prototype._proceedSorting = function (hitObj) {
|
|
32729
32750
|
var ce = {};
|
32730
32751
|
ce["colIndex"] = colIndex;
|
32731
32752
|
ce["sortOrder"] = this.getSortOrder(colIndex);
|
32732
|
-
ce["dataColumnName"] = this.getColumnSortingField(colIndex);
|
32753
|
+
ce["dataColumnName"] = this.getColumnSortingField(colIndex); // This should be deprecated
|
32733
32754
|
this._dispatch("clicked", ce);
|
32734
32755
|
}
|
32735
32756
|
}
|
@@ -32919,7 +32940,7 @@ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
|
|
32919
32940
|
var sortStateCount = this._sortStates.length;
|
32920
32941
|
var rowDefField = SortableTitlePlugin._toRowDefField();
|
32921
32942
|
for(var i = 0; i < sortStateCount; i++){
|
32922
|
-
var sortState =
|
32943
|
+
var sortState = this._sortStates[i];
|
32923
32944
|
var field = this._rowDefMode ? rowDefField : sortState["field"];
|
32924
32945
|
sortOrders.push(sortState["sortOrder"]);
|
32925
32946
|
sortFields.push(field);
|
@@ -32930,19 +32951,51 @@ SortableTitlePlugin.prototype.sortSeparators = function (comparer) {
|
|
32930
32951
|
|
32931
32952
|
|
32932
32953
|
/** @private
|
32933
|
-
* @param {number|string}
|
32954
|
+
* @param {(number|string|SortableTitlePlugin.SortingDefinition)} sortingDef This could be column index, field, or SortingDefinition
|
32934
32955
|
* @param {string=} sortOrder "a" for ascending, "d" for descending, and "n" for no sorting
|
32935
32956
|
* @returns {Object} state Returns null, if nothing is changed
|
32936
32957
|
*/
|
32937
|
-
SortableTitlePlugin.prototype._prepareSorting = function (
|
32958
|
+
SortableTitlePlugin.prototype._prepareSorting = function (sortingDef, sortOrder) {
|
32938
32959
|
if (!this._maxCount) {
|
32939
32960
|
return null;
|
32940
32961
|
}
|
32962
|
+
var host = this._hosts[0];
|
32963
|
+
if(!host) {
|
32964
|
+
return null;
|
32965
|
+
}
|
32941
32966
|
|
32942
|
-
var colIndex =
|
32943
|
-
var
|
32944
|
-
|
32967
|
+
var colIndex = -1;
|
32968
|
+
var colRef = "";
|
32969
|
+
if(typeof sortingDef === "number") {
|
32970
|
+
colIndex = sortingDef;
|
32971
|
+
} else if(typeof sortingDef === "string") { // This would be either column id or field
|
32972
|
+
colRef = sortingDef;
|
32973
|
+
colIndex = this._getColumnIndex(colRef);
|
32974
|
+
} else if(sortingDef && typeof sortingDef === "object") {
|
32975
|
+
colRef = sortingDef["colId"] || sortingDef["field"];
|
32976
|
+
if(colRef) {
|
32977
|
+
colIndex = this._getColumnIndex(colRef);
|
32978
|
+
} else if(typeof sortingDef["colIndex"] === "number") {
|
32979
|
+
colIndex = sortingDef["colIndex"];
|
32980
|
+
}
|
32981
|
+
if(!sortOrder) {
|
32982
|
+
sortOrder = sortingDef["sortOrder"] || sortingDef["order"] || null;
|
32983
|
+
}
|
32984
|
+
}
|
32985
|
+
|
32986
|
+
var field = "";
|
32987
|
+
var sortLogic = null;
|
32988
|
+
if(colIndex >= 0) {
|
32989
|
+
field = this.getColumnSortingField(colIndex);
|
32990
|
+
var sortOptions = this._getSortOptions(colIndex);
|
32991
|
+
if(sortOptions) {
|
32992
|
+
sortLogic = sortOptions["sortLogic"];
|
32993
|
+
}
|
32994
|
+
} else if(colRef) {
|
32995
|
+
field = colRef; // Assume that colRef is a field and not a column id
|
32996
|
+
}
|
32945
32997
|
|
32998
|
+
var priority = this.getSortPriority(colIndex, field);
|
32946
32999
|
var curState = (priority >= 0) ? this._sortStates[priority] : null;
|
32947
33000
|
var curOrder = curState ? curState["sortOrder"] : "n";
|
32948
33001
|
|
@@ -32970,7 +33023,6 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
|
|
32970
33023
|
|
32971
33024
|
this._sortStates.splice(priority, 1); // Remove sort states
|
32972
33025
|
this._clearSortSymbols(curState); // Clear any previous symbols
|
32973
|
-
// TODO: Other states in curState should be cleared as it is actually a sortOptions object
|
32974
33026
|
}
|
32975
33027
|
|
32976
33028
|
if (nextOrder === "a" || nextOrder === "d") { // Reorder sort states
|
@@ -32978,12 +33030,14 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
|
|
32978
33030
|
return null;
|
32979
33031
|
}
|
32980
33032
|
if (!curState) {
|
32981
|
-
|
32982
|
-
|
32983
|
-
|
32984
|
-
|
32985
|
-
|
33033
|
+
curState = {};
|
33034
|
+
var colId = host.getColumnId(colIndex);
|
33035
|
+
if(colId) {
|
33036
|
+
curState["colId"] = colId;
|
33037
|
+
}
|
32986
33038
|
}
|
33039
|
+
curState["field"] = field;
|
33040
|
+
curState["sortLogic"] = sortLogic || null;
|
32987
33041
|
|
32988
33042
|
this._sortStates.push(curState); // Latest sorting have lowest priority (multiColumn sorting)
|
32989
33043
|
}
|
@@ -33018,31 +33072,47 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
|
|
33018
33072
|
};
|
33019
33073
|
|
33020
33074
|
/** @private
|
33021
|
-
* @param {Array.<Object>} states States from _prepareSorting for dispatching columnSorted event.
|
33075
|
+
* @param {Object|Array.<Object>} states States from _prepareSorting for dispatching columnSorted event.
|
33022
33076
|
* @param {Object=} opt_arg Event argument to be sent with preDataSorting event
|
33023
33077
|
* @fires SortableTitlePlugin#preDataSorting
|
33024
33078
|
* @fires SortableTitlePlugin#columnSorted
|
33025
33079
|
*/
|
33026
33080
|
SortableTitlePlugin.prototype._sortColumn = function (states, opt_arg) {
|
33081
|
+
if(!states) {
|
33082
|
+
return;
|
33083
|
+
}
|
33084
|
+
|
33027
33085
|
this._sortDataView(opt_arg); // Update Data
|
33028
33086
|
this.updateSortSymbols(); // Update Display
|
33029
33087
|
|
33030
|
-
var
|
33031
|
-
|
33032
|
-
|
33033
|
-
|
33034
|
-
|
33035
|
-
|
33036
|
-
|
33037
|
-
|
33038
|
-
|
33039
|
-
|
33040
|
-
|
33041
|
-
|
33042
|
-
|
33088
|
+
var evtArg = null;
|
33089
|
+
if(Array.isArray(states)) {
|
33090
|
+
var len = states.length;
|
33091
|
+
for(var i = 0; i < len; ++i) {
|
33092
|
+
var state = states[i];
|
33093
|
+
if(state) {
|
33094
|
+
if(evtArg) {
|
33095
|
+
if(!evtArg["colIndices"]) {
|
33096
|
+
evtArg["colIndices"] = [];
|
33097
|
+
evtArg["sortedFields"] = [];
|
33098
|
+
evtArg["sortOrders"] = [];
|
33099
|
+
evtArg["prevOrders"] = [];
|
33100
|
+
}
|
33101
|
+
|
33102
|
+
evtArg["colIndices"].push(state["colIndex"]);
|
33103
|
+
evtArg["sortedFields"].push(state["sortedField"]);
|
33104
|
+
evtArg["sortOrders"].push(state["sortOrder"]);
|
33105
|
+
evtArg["prevOrders"].push(state["prevOrder"]);
|
33106
|
+
} else {
|
33107
|
+
evtArg = state;
|
33108
|
+
}
|
33109
|
+
}
|
33043
33110
|
}
|
33111
|
+
evtArg = states[0];
|
33112
|
+
} else {
|
33113
|
+
evtArg = states;
|
33044
33114
|
}
|
33045
|
-
this._dispatch("columnSorted",
|
33115
|
+
this._dispatch("columnSorted", evtArg);
|
33046
33116
|
};
|
33047
33117
|
|
33048
33118
|
/** @private
|
@@ -33100,24 +33170,23 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
|
|
33100
33170
|
* @fires SortableTitlePlugin#columnSorted
|
33101
33171
|
*/
|
33102
33172
|
SortableTitlePlugin.prototype._onColumnRemoved = function (e) {
|
33103
|
-
if (!e["atTheMiddle"]) { return; }
|
33104
|
-
|
33105
33173
|
var sortCount = this._sortStates.length;
|
33106
33174
|
if (!sortCount) {
|
33107
33175
|
return;
|
33108
33176
|
}
|
33109
|
-
var
|
33110
|
-
|
33111
|
-
|
33112
|
-
|
33113
|
-
//
|
33114
|
-
|
33115
|
-
var
|
33116
|
-
if (
|
33117
|
-
this._sortStates.splice(
|
33177
|
+
var colId = e["colId"];
|
33178
|
+
if (!colId) {
|
33179
|
+
return;
|
33180
|
+
}
|
33181
|
+
// WARNING: columnRemoved event could be fired repeatedly. Sorting could be triggered multiple times
|
33182
|
+
for(var i = 0; i < sortCount; ++i) {
|
33183
|
+
var sortState = this._sortStates[i];
|
33184
|
+
if (sortState["colId"] === colId) {
|
33185
|
+
this._sortStates.splice(i, 1);
|
33186
|
+
this._clearSortSymbols(sortState);
|
33187
|
+
this._sortDataView();
|
33188
|
+
break;
|
33118
33189
|
}
|
33119
|
-
this._clearSortSymbols(sortOptions);
|
33120
|
-
this._sortDataView();
|
33121
33190
|
}
|
33122
33191
|
};
|
33123
33192
|
|
@@ -33211,8 +33280,8 @@ SortableTitlePlugin.prototype._updateSortableIndicator = function (hostIndex) {
|
|
33211
33280
|
|
33212
33281
|
var section = host.getSection("title");
|
33213
33282
|
if (section == null) { return; }
|
33214
|
-
var
|
33215
|
-
for (var col =
|
33283
|
+
var colCount = section["getColumnCount"]();
|
33284
|
+
for (var col = colCount; --col >= 0;) {
|
33216
33285
|
|
33217
33286
|
var rowCount = section["getRowCount"]();
|
33218
33287
|
for (var r = 0; r < rowCount; r++) {
|
@@ -33306,35 +33375,24 @@ SortableTitlePlugin.prototype._createIconElem = function (icon, fallback) {
|
|
33306
33375
|
};
|
33307
33376
|
|
33308
33377
|
/** @private
|
33309
|
-
* @param {Object}
|
33378
|
+
* @param {string|number|Object} colRef This can be sortState, column id, column field, or column index
|
33310
33379
|
* @return {number}
|
33311
33380
|
*/
|
33312
|
-
SortableTitlePlugin.prototype.
|
33313
|
-
if(
|
33381
|
+
SortableTitlePlugin.prototype._getColumnIndex = function (colRef) {
|
33382
|
+
if(colRef != null) {
|
33314
33383
|
var host = this._hosts[0];
|
33315
|
-
|
33316
|
-
|
33317
|
-
|
33318
|
-
if
|
33319
|
-
|
33320
|
-
|
33321
|
-
|
33384
|
+
if(host) {
|
33385
|
+
if(typeof colRef === "number") {
|
33386
|
+
return colRef;
|
33387
|
+
} else if(typeof colRef === "string") {
|
33388
|
+
return host.getColumnIndex(colRef);
|
33389
|
+
} else {
|
33390
|
+
return host.getColumnIndex(colRef["colId"]);
|
33322
33391
|
}
|
33323
33392
|
}
|
33324
33393
|
}
|
33325
33394
|
return -1;
|
33326
33395
|
};
|
33327
|
-
/** @private
|
33328
|
-
* @param {string|number} colRef
|
33329
|
-
* @return {number}
|
33330
|
-
*/
|
33331
|
-
SortableTitlePlugin.prototype._getColumnIndex = function (colRef) {
|
33332
|
-
var host = this._hosts[0];
|
33333
|
-
if(host && colRef != null) {
|
33334
|
-
return host.getColumnIndex(colRef);
|
33335
|
-
}
|
33336
|
-
return -1;
|
33337
|
-
};
|
33338
33396
|
|
33339
33397
|
/** @private
|
33340
33398
|
* @param {string|number} colRef
|
@@ -33355,10 +33413,7 @@ SortableTitlePlugin.prototype._getColumnId = function (colRef) {
|
|
33355
33413
|
SortableTitlePlugin.prototype._getSortOptions = function (colIndex) {
|
33356
33414
|
var host = this._hosts[0];
|
33357
33415
|
if (host) {
|
33358
|
-
|
33359
|
-
if (colData) {
|
33360
|
-
return colData["sortableTitle"];
|
33361
|
-
}
|
33416
|
+
return host.getColumnData(colIndex)["sortableTitle"] || null;
|
33362
33417
|
}
|
33363
33418
|
return null;
|
33364
33419
|
};
|