@refinitiv-ui/efx-grid 6.0.32 → 6.0.34
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +197 -46
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.d.ts +1 -1
- package/lib/core/es6/data/DataTable.js +9 -8
- package/lib/core/es6/data/DataView.js +1 -1
- package/lib/core/es6/data/Segment.d.ts +2 -0
- package/lib/core/es6/data/Segment.js +16 -0
- package/lib/core/es6/data/SegmentCollection.d.ts +1 -3
- package/lib/core/es6/data/SegmentCollection.js +25 -18
- package/lib/core/es6/grid/Core.d.ts +4 -0
- package/lib/core/es6/grid/Core.js +27 -6
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +1 -0
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +36 -12
- 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 +2 -0
- 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 +945 -331
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +13 -8
- package/lib/rt-grid/es6/DataConnector.js +3 -2
- package/lib/rt-grid/es6/Grid.d.ts +3 -1
- package/lib/rt-grid/es6/Grid.js +130 -28
- package/lib/rt-grid/es6/RowDefinition.d.ts +7 -2
- package/lib/rt-grid/es6/RowDefinition.js +49 -11
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +1 -0
- package/lib/rt-grid/es6/SnapshotFiller.js +1 -11
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +58 -30
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +2 -0
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +56 -22
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +12 -5
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +128 -42
- package/lib/tr-grid-heat-map/es6/HeatMap.d.ts +3 -3
- package/lib/tr-grid-heat-map/es6/HeatMap.js +13 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +142 -17
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +20 -20
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +37 -138
- package/lib/tr-grid-util/es6/CellPainter.d.ts +1 -1
- package/lib/tr-grid-util/es6/CellPainter.js +56 -55
- package/lib/tr-grid-util/es6/FieldFormatter.js +6 -2
- package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +2 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.js +15 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -11
- package/lib/tr-grid-util/es6/Util.d.ts +6 -0
- package/lib/tr-grid-util/es6/Util.js +68 -0
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +12 -2
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +170 -47
- package/lib/types/es6/ColumnGrouping.d.ts +4 -0
- package/lib/types/es6/ColumnSelection.d.ts +2 -0
- package/lib/types/es6/ColumnStack.d.ts +2 -0
- package/lib/types/es6/ConditionalColoring.d.ts +12 -5
- package/lib/types/es6/Core/data/Segment.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +1 -3
- package/lib/types/es6/Core/grid/Core.d.ts +4 -0
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +1 -0
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +6 -2
- package/lib/types/es6/HeatMap.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +7 -2
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +1 -0
- package/lib/types/es6/RowDragging.d.ts +25 -2
- package/lib/types/es6/StatisticsRow.d.ts +25 -25
- package/lib/types/es6/TextFormatting.d.ts +20 -20
- package/lib/versions.json +7 -7
- package/package.json +1 -1
@@ -18,6 +18,7 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
18
18
|
* @property {Function=} drag=null Function handler for drag event
|
19
19
|
* @property {Function=} dragEnd=null Function handler for dragEnd event
|
20
20
|
* @property {Function=} dataMoved=null Function handler for dataMoved event
|
21
|
+
* @property {Function=} beforeDataMoved=null Function handler for beforeDataMoved event
|
21
22
|
*/
|
22
23
|
|
23
24
|
/** @event RowDraggingPlugin#drag
|
@@ -42,8 +43,34 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
42
43
|
* @type {Object}
|
43
44
|
*/
|
44
45
|
/** @event RowDraggingPlugin#dataMoved
|
45
|
-
* @description Fired when rows or data are moved by drag operation.
|
46
|
+
* @description Fired when rows or data are moved by the drag operation.
|
46
47
|
* @type {Object}
|
48
|
+
* @property {Array.<number>} srcRowIndices row indices of the selected rows
|
49
|
+
* @property {Array.<string>} srcRowIds row ids of the selected rows
|
50
|
+
* @property {Array.<string>} srcRowTypes row types of the selected rows
|
51
|
+
* @property {string} consolidatedSrcRowType "MIXED" type is set if there are two or more row types in the srcRowTypes
|
52
|
+
* @property {number} destRowIndex row index of the drop area
|
53
|
+
* @property {string} destRowId row id of the drop area. This will be empty string for the end of grid
|
54
|
+
* @property {number} destRowType row type of the drop area. This will be empty string for the end of grid
|
55
|
+
*/
|
56
|
+
/** @event RowDraggingPlugin#beforeDataMoved
|
57
|
+
* @description Fired after mouseup and before the data/row is about to be moved. You can check the current drag and drop states, cancel operation or apply custom tasks in this event.
|
58
|
+
* @type {Object}
|
59
|
+
* @property {Array.<number>} srcRowIndices row indices of the selected rows
|
60
|
+
* @property {Array.<string>} srcRowIds row ids of the selected rows
|
61
|
+
* @property {Array.<string>} srcRowTypes row types of the selected rows
|
62
|
+
* @property {string} consolidatedSrcRowType "MIXED" type is set if there are two or more row types in the srcRowTypes
|
63
|
+
* @property {number} destRowIndex row index of the drop area
|
64
|
+
* @property {string} destRowId row id of the drop area. This will be empty string for the end of grid
|
65
|
+
* @property {number} destRowType row type of the drop area. This will be empty string for the end of grid
|
66
|
+
* @example
|
67
|
+
* beforeDataMoved: function(e) {
|
68
|
+
* var srcRowType = e.srcRowTypes[0];
|
69
|
+
* var destRowType = e.destRowType;
|
70
|
+
* if(srcRowType === "GROUP_MEMBER" && destRowType === "CONTENT") {
|
71
|
+
* e.cancel = true; // Prevent a group member row from moving outside of its own group
|
72
|
+
* }
|
73
|
+
* }
|
47
74
|
*/
|
48
75
|
|
49
76
|
|
@@ -55,6 +82,27 @@ var _isInContentSection = function (pos) {
|
|
55
82
|
return (pos && pos["sectionType"] === "content") ? true : false;
|
56
83
|
};
|
57
84
|
|
85
|
+
/** @private
|
86
|
+
* @param {string} rowType
|
87
|
+
* @return {boolean}
|
88
|
+
*/
|
89
|
+
var _isNormalRowType = function (rowType) {
|
90
|
+
if(rowType) {
|
91
|
+
if(rowType === "CONTENT") {
|
92
|
+
return true;
|
93
|
+
}
|
94
|
+
if(rowType === "CHAIN") {
|
95
|
+
return true;
|
96
|
+
}
|
97
|
+
if(rowType === "GROUP_HEADER") {
|
98
|
+
return true;
|
99
|
+
}
|
100
|
+
return false;
|
101
|
+
} else {
|
102
|
+
return true;
|
103
|
+
}
|
104
|
+
};
|
105
|
+
|
58
106
|
/** @constructor
|
59
107
|
* @param {RowDraggingPlugin.Options=} options
|
60
108
|
* @extends {GridPlugin}
|
@@ -397,6 +445,7 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
397
445
|
this.addListener(extOptions, "drag");
|
398
446
|
this.addListener(extOptions, "dragEnd");
|
399
447
|
this.addListener(extOptions, "dataMoved");
|
448
|
+
this.addListener(extOptions, "beforeDataMoved");
|
400
449
|
};
|
401
450
|
|
402
451
|
/** Get a current state of grid and extension config
|
@@ -795,7 +844,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
795
844
|
var destGrid = destPos["grid"] || srcGrid;
|
796
845
|
var destRowIndex = destPos["rowIndex"];
|
797
846
|
|
798
|
-
var rowSelection = srcGrid.getPlugin(
|
847
|
+
var rowSelection = srcGrid.getPlugin("RowSelectionPlugin");
|
799
848
|
var srcRowIndices = rowSelection && rowSelection.getSelectedRows();
|
800
849
|
if (!srcRowIndices || !srcRowIndices.length) {
|
801
850
|
// case no row selection or it disabled
|
@@ -834,10 +883,9 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
834
883
|
* @return {number}
|
835
884
|
*/
|
836
885
|
RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGrid, destGrid, evtArg) {
|
837
|
-
var destDv = destGrid.getDataSource();
|
838
|
-
|
839
886
|
var srcRowIndices = null;
|
840
887
|
var srcDv = srcGrid.getDataSource();
|
888
|
+
var destDv = destGrid.getDataSource();
|
841
889
|
if(typeof srcRowRef === "string") {
|
842
890
|
var srcRowIndex = srcDv.getRowIndex(this._startingRid);
|
843
891
|
if(srcRowIndex >= 0) {
|
@@ -851,27 +899,103 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
851
899
|
return 0;
|
852
900
|
}
|
853
901
|
|
902
|
+
// Available row types are ["CONTENT", "CHAIN", "CONSTITUENT", "GROUP_HEADER", "SUBGROUP_HEADER", "GROUP_MEMBER"]
|
903
|
+
var i, len;
|
904
|
+
var srcCount = srcRowIndices.length;
|
905
|
+
var srcRowIds = new Array(srcCount);
|
906
|
+
var srcRowTypes = [];
|
907
|
+
var conRowType = "";
|
908
|
+
var api = this.getGridApi();
|
909
|
+
for(i = 0; i < srcCount; ++i) {
|
910
|
+
var srcIndex = srcRowIndices[i];
|
911
|
+
var rowType = api.getRowType(srcIndex);
|
912
|
+
srcRowIds[i] = srcDv.getRowId(srcIndex);
|
913
|
+
srcRowTypes[i] = rowType;
|
914
|
+
if(conRowType) {
|
915
|
+
if(conRowType !== rowType) {
|
916
|
+
conRowType = "MIXED";
|
917
|
+
}
|
918
|
+
} else {
|
919
|
+
conRowType = rowType;
|
920
|
+
}
|
921
|
+
}
|
922
|
+
var destRowType = api.getRowType(destRowIndex); // TODO: this has to be get from destGrid
|
923
|
+
var destRowId = destDv.getRowId(destRowIndex);
|
924
|
+
var parentRowId, childRowIds;
|
925
|
+
|
926
|
+
if(this.hasListener("beforeDataMoved")) {
|
927
|
+
evtArg["srcRowIndices"] = srcRowIndices;
|
928
|
+
evtArg["srcRowIds"] = srcRowIds;
|
929
|
+
evtArg["srcRowTypes"] = srcRowTypes;
|
930
|
+
evtArg["consolidatedSrcRowType"] = conRowType;
|
931
|
+
evtArg["destRowIndex"] = destRowIndex;
|
932
|
+
evtArg["destRowId"] = destRowId;
|
933
|
+
evtArg["destRowType"] = destRowType;
|
934
|
+
this._dispatch("beforeDataMoved", evtArg);
|
935
|
+
if(evtArg["cancel"]) {
|
936
|
+
return 0;
|
937
|
+
}
|
938
|
+
}
|
854
939
|
|
940
|
+
var rsp = srcGrid.getPlugin("RowSegmentingPlugin");
|
855
941
|
var movedRowIds = null;
|
856
|
-
var destRowId = destDv.getRowId(destRowIndex);
|
857
942
|
if(srcGrid === destGrid) { // TODO: Support wrap mode
|
858
|
-
|
943
|
+
if(conRowType === "MIXED") {
|
944
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
945
|
+
} else if(conRowType === "CONTENT") {
|
946
|
+
if(destRowType === "GROUP_HEADER") {
|
947
|
+
childRowIds = rsp.getSegmentChildIds(destRowId);
|
948
|
+
if(childRowIds) {
|
949
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
950
|
+
} else { // Add content row as a new member only if there is no member
|
951
|
+
rsp.addSegmentChildren(destRowId, srcRowIds);
|
952
|
+
movedRowIds = srcRowIds;
|
953
|
+
}
|
954
|
+
} else if(_isNormalRowType(destRowType)) {
|
955
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
956
|
+
} else if(destRowType === "GROUP_MEMBER") {
|
957
|
+
parentRowId = rsp.getSegmentParentRowId(destRowId);
|
958
|
+
rsp.addSegmentChildren(parentRowId, srcRowIds);
|
959
|
+
|
960
|
+
srcDv.moveRow(srcRowIds, destRowId);
|
961
|
+
movedRowIds = srcRowIds;
|
962
|
+
}
|
963
|
+
} else if(conRowType === "CHAIN" || conRowType === "GROUP_HEADER") {
|
964
|
+
if(_isNormalRowType(destRowType)) {
|
965
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
966
|
+
}
|
967
|
+
} else if(conRowType === "GROUP_MEMBER") {
|
968
|
+
if(srcCount === 1) {
|
969
|
+
parentRowId = rsp.getSegmentParentRowId(srcRowIds[0]);
|
970
|
+
childRowIds = rsp.getSegmentChildIds(parentRowId);
|
971
|
+
var childCount = childRowIds ? childRowIds.length : 0;
|
972
|
+
var endOfSegment = srcDv.getRowIndex(parentRowId) + childCount + 1;
|
973
|
+
if(destRowIndex === endOfSegment) {
|
974
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
975
|
+
} else if(destRowType === "GROUP_MEMBER") {
|
976
|
+
var destParentRowId = rsp.getSegmentParentRowId(destRowId);
|
977
|
+
if(parentRowId === destParentRowId) {
|
978
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
979
|
+
}
|
980
|
+
} else if(_isNormalRowType(destRowType)) { // move member out of existing segment
|
981
|
+
rsp.removeSegmentChild(parentRowId, srcRowIds[0]);
|
982
|
+
|
983
|
+
movedRowIds = srcDv.moveRow(srcRowIds[0], destRowId);
|
984
|
+
}
|
985
|
+
} else {
|
986
|
+
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
987
|
+
}
|
988
|
+
} // else CONSTITUENT, SUBGROUP_HEADER and other types cannot be moved
|
859
989
|
} else {
|
990
|
+
// TODO: Add support moving row based on row types
|
860
991
|
// TODO: Check if we support moving to last row for multi table
|
861
|
-
|
862
|
-
// return 0;
|
863
|
-
// }
|
864
|
-
movedRowIds = [];
|
992
|
+
movedRowIds = srcRowIds;
|
865
993
|
evtArg["destGrid"] = destGrid;
|
866
994
|
|
867
995
|
var originalRows = [];
|
868
|
-
|
869
|
-
var len = srcRowIndices.length;
|
870
|
-
for(i = 0; i < len; ++i) {
|
871
|
-
var rowId = srcDv.getRowId(srcRowIndices[i]);
|
996
|
+
for(i = 0; i < srcCount; ++i) {
|
872
997
|
var rowData = srcDv.getRowData(rowId);
|
873
998
|
if(rowData) {
|
874
|
-
movedRowIds.push(rowId);
|
875
999
|
originalRows.push(rowData);
|
876
1000
|
}
|
877
1001
|
}
|
@@ -891,14 +1015,15 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
891
1015
|
}
|
892
1016
|
}
|
893
1017
|
|
894
|
-
|
1018
|
+
var moveCount = movedRowIds ? movedRowIds.length : 0;
|
1019
|
+
if(moveCount) {
|
895
1020
|
evtArg["originRowId"] = movedRowIds[0];
|
896
1021
|
evtArg["originRowIds"] = movedRowIds;
|
897
1022
|
evtArg["destinationRowId"] = destRowId; // Return empty string for the last row
|
898
1023
|
|
899
1024
|
this._dispatch("dataMoved", evtArg);
|
900
1025
|
}
|
901
|
-
return
|
1026
|
+
return moveCount;
|
902
1027
|
};
|
903
1028
|
/** @private
|
904
1029
|
* @return {boolean}
|
@@ -7,30 +7,30 @@ import { DateTime } from '../../tr-grid-util/es6/DateTime.js';
|
|
7
7
|
declare namespace TextFormattingPlugin {
|
8
8
|
|
9
9
|
type FormatOptions = {
|
10
|
-
formatType?: string,
|
11
|
-
type?: string,
|
12
|
-
field?: string,
|
13
|
-
decimalPlaces?: number,
|
14
|
-
precisionEnabled?: boolean,
|
15
|
-
plusSign?: boolean,
|
16
|
-
separator?: boolean,
|
17
|
-
percentSign?: boolean,
|
18
|
-
scalingUnit?: string,
|
19
|
-
multiplyBy100?: boolean,
|
20
|
-
mutiplyBy100?: boolean,
|
21
|
-
dateTimeFormat?: string,
|
22
|
-
useUTCTime?: boolean,
|
23
|
-
autoTextFormatting?: boolean,
|
24
|
-
formatLogic?: ((...params: any[]) => any)
|
10
|
+
formatType?: string|null,
|
11
|
+
type?: string|null,
|
12
|
+
field?: string|null,
|
13
|
+
decimalPlaces?: number|null,
|
14
|
+
precisionEnabled?: boolean|null,
|
15
|
+
plusSign?: boolean|null,
|
16
|
+
separator?: boolean|null,
|
17
|
+
percentSign?: boolean|null,
|
18
|
+
scalingUnit?: string|null,
|
19
|
+
multiplyBy100?: boolean|null,
|
20
|
+
mutiplyBy100?: boolean|null,
|
21
|
+
dateTimeFormat?: string|null,
|
22
|
+
useUTCTime?: boolean|null,
|
23
|
+
autoTextFormatting?: boolean|null,
|
24
|
+
formatLogic?: ((...params: any[]) => any)|null
|
25
25
|
};
|
26
26
|
|
27
27
|
type ColumnOptions = {
|
28
|
-
formatType?: (string|TextFormattingPlugin.FormatOptions),
|
29
|
-
autoTextFormatting?: boolean
|
28
|
+
formatType?: (string|TextFormattingPlugin.FormatOptions)|null,
|
29
|
+
autoTextFormatting?: boolean|null
|
30
30
|
};
|
31
31
|
|
32
32
|
type GridOptions = {
|
33
|
-
autoTextFormatting?: boolean
|
33
|
+
autoTextFormatting?: boolean|null
|
34
34
|
};
|
35
35
|
|
36
36
|
type FormatLogicArguments = {
|
@@ -40,7 +40,7 @@ declare namespace TextFormattingPlugin {
|
|
40
40
|
formattedText: string,
|
41
41
|
cell: any,
|
42
42
|
rowData: any,
|
43
|
-
format: ((...params: any[]) => any)
|
43
|
+
format: ((...params: any[]) => any)|null
|
44
44
|
};
|
45
45
|
|
46
46
|
}
|
@@ -61,7 +61,7 @@ declare class TextFormattingPlugin extends GridPlugin {
|
|
61
61
|
|
62
62
|
public getConfigObject(gridOptions?: any): any;
|
63
63
|
|
64
|
-
public setColumnFormat(colIndex: number, formatOptions: TextFormattingPlugin.FormatOptions): void;
|
64
|
+
public setColumnFormat(colIndex: number, formatOptions: TextFormattingPlugin.FormatOptions|null): void;
|
65
65
|
|
66
66
|
public getColumnFormatOptions(colIndex: number, options?: any): any;
|
67
67
|
|