@refinitiv-ui/efx-grid 6.0.26 → 6.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/dist/core.js +41 -6
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/core/es6/grid/components/Scrollbar.js +6 -0
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +11 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +139 -30
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +14 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +323 -187
- package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +4 -0
- package/lib/tr-grid-range-bar/es6/RangeBar.js +8 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +5 -1
- package/lib/tr-grid-util/es6/GroupDefinitions.js +34 -5
- package/lib/types/es6/ColumnGrouping.d.ts +11 -1
- package/lib/types/es6/ColumnStack.d.ts +14 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
@@ -1317,6 +1317,12 @@ Scrollbar.prototype.getDefaultMouseWheelLogic = function () {
|
|
1317
1317
|
* @param {Event} e
|
1318
1318
|
*/
|
1319
1319
|
Scrollbar.prototype._onMouseWheel = function (e) {
|
1320
|
+
|
1321
|
+
// Blacklist for prevent triggering the scrollbar when the dialog is opened.
|
1322
|
+
if(e.target.opened) { // get attribute method doesn't work in elf element
|
1323
|
+
return;
|
1324
|
+
}
|
1325
|
+
|
1320
1326
|
if (this._isFrozen) {
|
1321
1327
|
Util._preventDefault(e);
|
1322
1328
|
return;
|
package/lib/grid/index.js
CHANGED
@@ -69,12 +69,22 @@ declare class ColumnGroupingPlugin extends GridPlugin {
|
|
69
69
|
|
70
70
|
public moveColumnIntoGroup(colRef: number|string|null, to: number, groupId: string): void;
|
71
71
|
|
72
|
-
public setColumnParent(colRef: number|string|null, groupId: string):
|
72
|
+
public setColumnParent(colRef: number|string|null, groupId: string): boolean;
|
73
|
+
|
74
|
+
public addGroupChild(parentId: string, childRef: number|string|null): boolean;
|
75
|
+
|
76
|
+
public removeGroupChild(parentId: string, childRef: number|string|null): boolean;
|
77
|
+
|
78
|
+
public unsetParent(childRef: number|string|null): boolean;
|
73
79
|
|
74
80
|
public getValidDestinationIndex(id: string, destCol: number|string|null): number;
|
75
81
|
|
76
82
|
public moveGroup(id: string, destCol: number|string|null): void;
|
77
83
|
|
84
|
+
public reorderColumns(colList: (number|string)[]|null, destCol: number|string|null): boolean;
|
85
|
+
|
86
|
+
public moveColumnById(srcCol: number|string|null, destCol?: number|string|null): boolean;
|
87
|
+
|
78
88
|
}
|
79
89
|
|
80
90
|
export default ColumnGroupingPlugin;
|
@@ -591,7 +591,7 @@ ColumnGroupingPlugin.prototype._applyNearestGrouping = function (colIndex) {
|
|
591
591
|
}
|
592
592
|
}
|
593
593
|
// The current column is no longer close to its parent
|
594
|
-
if (this._groupDefs.
|
594
|
+
if (this._groupDefs.unsetParent(colId)) {
|
595
595
|
chdr = this._groupDefs.getGroupChildren(parentId);
|
596
596
|
childCount = chdr ? chdr.length : 0;
|
597
597
|
if (childCount === 1) {
|
@@ -808,7 +808,7 @@ ColumnGroupingPlugin.prototype._onColumnRemoved = function (e) {
|
|
808
808
|
var colData = e.columnData;
|
809
809
|
if (colData && colData.columnGrouping) {
|
810
810
|
var colId = colData.columnGrouping.id;
|
811
|
-
if (this._groupDefs.
|
811
|
+
if (this._groupDefs.unsetParent(colId)) {
|
812
812
|
this._requestApplyGrouping();
|
813
813
|
}
|
814
814
|
}
|
@@ -1002,11 +1002,7 @@ ColumnGroupingPlugin.prototype.setGroupDefinition = function (groupId, groupDef)
|
|
1002
1002
|
var len = chdr.length;
|
1003
1003
|
// TODO: Filter out group id
|
1004
1004
|
if (len > 1) {
|
1005
|
-
|
1006
|
-
if (gridApi && gridApi.reorderColumns) {
|
1007
|
-
// TODO: Support multi-table feature
|
1008
|
-
gridApi.reorderColumns(chdr, chdr[0]); // WARNING: group id doesn't work
|
1009
|
-
}
|
1005
|
+
this.reorderColumns(chdr, chdr[0]); // WARNING: group id doesn't work
|
1010
1006
|
}
|
1011
1007
|
}
|
1012
1008
|
|
@@ -1086,10 +1082,10 @@ ColumnGroupingPlugin.prototype.getChildColumnIndices = function (groupId) {
|
|
1086
1082
|
var colIds = this._groupDefs.getLeafDescendants(groupId);
|
1087
1083
|
if (colIds) {
|
1088
1084
|
var colIndices = [];
|
1089
|
-
var
|
1090
|
-
for (var i = 0; i <
|
1091
|
-
index = this.getColumnIndex(colIds[i]);
|
1092
|
-
if (index
|
1085
|
+
var leafCount = colIds.length;
|
1086
|
+
for (var i = 0; i < leafCount; i++) {
|
1087
|
+
var index = this.getColumnIndex(colIds[i]);
|
1088
|
+
if (index >= 0) {
|
1093
1089
|
colIndices.push(index);
|
1094
1090
|
}
|
1095
1091
|
}
|
@@ -1268,31 +1264,114 @@ ColumnGroupingPlugin.prototype.moveColumnIntoGroup = function (colRef, to, group
|
|
1268
1264
|
}
|
1269
1265
|
}
|
1270
1266
|
};
|
1271
|
-
/**
|
1267
|
+
/**
|
1268
|
+
* @public
|
1272
1269
|
* @param {number|string} colRef Column index or id that should be moved
|
1273
1270
|
* @param {string} groupId
|
1271
|
+
* @return {boolean}
|
1274
1272
|
*/
|
1275
1273
|
ColumnGroupingPlugin.prototype.setColumnParent = function (colRef, groupId) {
|
1276
|
-
|
1277
|
-
|
1278
|
-
return;
|
1274
|
+
if (groupId) {
|
1275
|
+
return this.addGroupChild(groupId, colRef);
|
1279
1276
|
}
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1277
|
+
return this.unsetParent(colRef);
|
1278
|
+
};
|
1279
|
+
/** If a column is added as a new child in a group, the column will be moved to the last position in the group. If the column is already a child of the group, nothing happens.
|
1280
|
+
* @public
|
1281
|
+
* @param {string} parentId
|
1282
|
+
* @param {number|string} childRef Column index, column id, group id to be added
|
1283
|
+
* @return {boolean}
|
1284
|
+
*/
|
1285
|
+
ColumnGroupingPlugin.prototype.addGroupChild = function (parentId, childRef) {
|
1286
|
+
var parentDef = this._groupDefs.getGroup(parentId);
|
1287
|
+
if (!parentDef) {
|
1288
|
+
return false;
|
1289
|
+
}
|
1290
|
+
var colId = "";
|
1291
|
+
if (typeof childRef === "string") {
|
1292
|
+
var groupDef = this._groupDefs.getGroup(childRef);
|
1293
|
+
if (groupDef) {
|
1294
|
+
if (this._groupDefs.addGroupChild(parentId, childRef)) {
|
1295
|
+
this._applyGrouping();
|
1296
|
+
return true;
|
1297
|
+
}
|
1298
|
+
} else {
|
1299
|
+
colId = childRef;
|
1300
|
+
}
|
1301
|
+
} else {
|
1302
|
+
colId = this.getColumnId(childRef);
|
1303
|
+
}
|
1304
|
+
if (!colId) {
|
1305
|
+
return false;
|
1306
|
+
}
|
1307
|
+
var leafIndices = this.getChildColumnIndices(parentId);
|
1308
|
+
if (this._groupDefs.addGroupChild(parentId, colId)) {
|
1309
|
+
if (leafIndices && leafIndices.length) {
|
1310
|
+
if (this.moveColumnById(colId, leafIndices[leafIndices.length - 1] + 1)) {
|
1311
|
+
return true;
|
1312
|
+
}
|
1313
|
+
}
|
1314
|
+
this._applyGrouping();
|
1315
|
+
return true;
|
1316
|
+
}
|
1317
|
+
return false;
|
1318
|
+
};
|
1319
|
+
/**
|
1320
|
+
* @public
|
1321
|
+
* @param {string} parentId
|
1322
|
+
* @param {number|string} childRef Column index, column id, group id to be added
|
1323
|
+
* @return {boolean}
|
1324
|
+
*/
|
1325
|
+
ColumnGroupingPlugin.prototype.removeGroupChild = function (parentId, childRef) {
|
1326
|
+
var parentDef = this._groupDefs.getGroup(parentId);
|
1327
|
+
if (!parentDef) {
|
1328
|
+
return false;
|
1329
|
+
}
|
1330
|
+
var colId = "";
|
1331
|
+
if (typeof childRef === "string") {
|
1332
|
+
var groupDef = this._groupDefs.getGroup(childRef);
|
1333
|
+
if (groupDef) {
|
1334
|
+
if (this._groupDefs.unsetParent(childRef)) {
|
1335
|
+
this._applyGrouping();
|
1336
|
+
return true;
|
1337
|
+
}
|
1338
|
+
} else {
|
1339
|
+
colId = childRef;
|
1340
|
+
}
|
1288
1341
|
} else {
|
1289
|
-
|
1342
|
+
colId = this.getColumnId(childRef);
|
1343
|
+
}
|
1344
|
+
if (!colId) {
|
1345
|
+
return false;
|
1346
|
+
}
|
1347
|
+
var leafIndices = this.getChildColumnIndices(parentId);
|
1348
|
+
if (this._groupDefs.removeGroupChild(parentId, colId)) {
|
1349
|
+
if (leafIndices && leafIndices.length > 1) {
|
1350
|
+
if (this.moveColumnById(colId, leafIndices[leafIndices.length - 1] + 1)) {
|
1351
|
+
return true;
|
1352
|
+
}
|
1353
|
+
}
|
1354
|
+
this._applyGrouping();
|
1355
|
+
return true;
|
1356
|
+
}
|
1357
|
+
return false;
|
1358
|
+
};
|
1359
|
+
/**
|
1360
|
+
* @public
|
1361
|
+
* @param {number|string} childRef Column index, column id, group id to be removed from its own parent
|
1362
|
+
* @return {boolean}
|
1363
|
+
*/
|
1364
|
+
ColumnGroupingPlugin.prototype.unsetParent = function (childRef) {
|
1365
|
+
var refId = typeof childRef === "string" ? childRef : this.getColumnId(childRef);
|
1366
|
+
var parentId = this._groupDefs.getParentId(refId);
|
1367
|
+
if (parentId) {
|
1368
|
+
return this.removeGroupChild(parentId, refId);
|
1290
1369
|
}
|
1291
|
-
|
1370
|
+
return false;
|
1292
1371
|
};
|
1293
1372
|
|
1294
1373
|
/** @public
|
1295
|
-
* Get a valid index for moving group/column to specific index
|
1374
|
+
* @description Get a valid index for moving group/column to specific index.
|
1296
1375
|
* @param {string} id group id or column id
|
1297
1376
|
* @param {number|string} destCol destination column index / id
|
1298
1377
|
* @returns {number} destination index
|
@@ -1357,7 +1436,7 @@ ColumnGroupingPlugin.prototype.getValidDestinationIndex = function (id, destCol)
|
|
1357
1436
|
};
|
1358
1437
|
|
1359
1438
|
/** @public
|
1360
|
-
* Move group or column to left side of the destination column.
|
1439
|
+
* @description Move group or column to left side of the destination column.
|
1361
1440
|
* Group or column can only be moved within the parent group.
|
1362
1441
|
* If the destination is between other column group, the destination will change to the end of that group instead.
|
1363
1442
|
* @param {string} id group id or column id
|
@@ -1380,16 +1459,46 @@ ColumnGroupingPlugin.prototype.moveGroup = function (id, destCol) {
|
|
1380
1459
|
return;
|
1381
1460
|
}
|
1382
1461
|
var destColIndex = this.getValidDestinationIndex(id, destCol);
|
1383
|
-
var destColId = this.getColumnId(destColIndex);
|
1462
|
+
var destColId = this.getColumnId(destColIndex); // TODO: This may not necessary
|
1384
1463
|
|
1464
|
+
this.reorderColumns(members, destColId);
|
1465
|
+
};
|
1466
|
+
/** Move and reorder the specified columns to position before the destination
|
1467
|
+
* @public
|
1468
|
+
* @param {Array.<number|string>} colList Column list to be reordered
|
1469
|
+
* @param {number|string} destCol destination destination column id or index
|
1470
|
+
* @return {boolean}
|
1471
|
+
*/
|
1472
|
+
ColumnGroupingPlugin.prototype.reorderColumns = function (colList, destCol) {
|
1473
|
+
var dirty = false;
|
1385
1474
|
// TODO: create method for toggling autoGrouping flag
|
1386
|
-
this._autoGrouping = false;
|
1475
|
+
this._autoGrouping = false; // Prevent re-grouping in columnMoved event
|
1476
|
+
|
1387
1477
|
var gridApi = this.getGridApi();
|
1388
1478
|
if (gridApi && gridApi.reorderColumns) {
|
1389
|
-
gridApi.reorderColumns(
|
1479
|
+
dirty = gridApi.reorderColumns(colList, destCol); // TODO: Support multi-table feature
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
this._autoGrouping = true;
|
1483
|
+
return dirty;
|
1484
|
+
};
|
1485
|
+
/** Move the specified column to position before the destination
|
1486
|
+
* @public
|
1487
|
+
* @param {number|string} srcCol source column id or index
|
1488
|
+
* @param {number|string=} destCol destination column id or index
|
1489
|
+
* @return {boolean}
|
1490
|
+
*/
|
1491
|
+
ColumnGroupingPlugin.prototype.moveColumnById = function (srcCol, destCol) {
|
1492
|
+
var dirty = false;
|
1493
|
+
this._autoGrouping = false; // Prevent re-grouping in columnMoved event
|
1494
|
+
|
1495
|
+
var gridApi = this.getGridApi();
|
1496
|
+
if (gridApi && gridApi.moveColumnById) {
|
1497
|
+
dirty = gridApi.moveColumnById(srcCol, destCol); // TODO: Support multi-table feature
|
1390
1498
|
}
|
1391
1499
|
|
1392
1500
|
this._autoGrouping = true;
|
1501
|
+
return dirty;
|
1393
1502
|
};
|
1394
1503
|
export default ColumnGroupingPlugin;
|
1395
1504
|
export { ColumnGroupingPlugin, ColumnGroupingPlugin as ColumnGrouping, ColumnGroupingPlugin as ColumnGroupingExtension };
|
@@ -12,7 +12,8 @@ declare namespace ColumnStackPlugin {
|
|
12
12
|
type Options = {
|
13
13
|
fields: (string)[]|null,
|
14
14
|
stacks: (ColumnStackPlugin.StackDefinition)[]|null,
|
15
|
-
autoStacking?: boolean|null
|
15
|
+
autoStacking?: boolean|null,
|
16
|
+
clicked?: ((...params: any[]) => any)|null
|
16
17
|
};
|
17
18
|
|
18
19
|
type ColumnOptions = {
|
@@ -90,6 +91,8 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
90
91
|
|
91
92
|
public unstackColumns(colIndices?: (number)[]|null): boolean;
|
92
93
|
|
94
|
+
public removeStack(stackId: string): boolean;
|
95
|
+
|
93
96
|
public removeAllStacks(enableUpdateUI?: boolean|null): boolean;
|
94
97
|
|
95
98
|
public swapColumn(colRef: number|Event|null, swappingIndex: number): boolean;
|
@@ -116,6 +119,16 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
116
119
|
|
117
120
|
public getActiveColumnField(stackId: string): string;
|
118
121
|
|
122
|
+
public addStackChild(stackId: string, colRef: number|string|null): void;
|
123
|
+
|
124
|
+
public removeStackChild(stackId: string, colRef: number|string|null): void;
|
125
|
+
|
126
|
+
public unsetParent(colRef: number|string|null): void;
|
127
|
+
|
128
|
+
public reorderColumns(colList: (number|string)[]|null, destCol?: (number|string)|null): boolean;
|
129
|
+
|
130
|
+
public moveColumnById(srcCol: number|string|null, destCol?: (number|string)|null): boolean;
|
131
|
+
|
119
132
|
}
|
120
133
|
|
121
134
|
export default ColumnStackPlugin;
|