@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
@@ -661,9 +661,10 @@ ColumnGroupingPlugin.prototype._spanGroupHorizontally = function (titleSection)
|
|
661
661
|
}
|
662
662
|
}
|
663
663
|
};
|
664
|
-
/**
|
664
|
+
/** Render all column group headers without affecting cell spans.
|
665
|
+
* @public
|
665
666
|
*/
|
666
|
-
ColumnGroupingPlugin.prototype.
|
667
|
+
ColumnGroupingPlugin.prototype.renderGroups = function () {
|
667
668
|
var hostCount = this._hosts.length;
|
668
669
|
var groupMap = this._visibleGroupMap;
|
669
670
|
for (var i = 0; i < hostCount; ++i) {
|
@@ -671,35 +672,42 @@ ColumnGroupingPlugin.prototype._renderGroups = function () {
|
|
671
672
|
if (!section) {
|
672
673
|
continue;
|
673
674
|
}
|
674
|
-
var arg = {};
|
675
675
|
for (var id in groupMap) {
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
676
|
+
this._renderGroup(groupMap[id], section);
|
677
|
+
}
|
678
|
+
}
|
679
|
+
};
|
680
|
+
/** Render single column group header without affecting cell span.
|
681
|
+
* @private
|
682
|
+
* @param {Object} groupDef
|
683
|
+
* @param {Object} section
|
684
|
+
*/
|
685
|
+
ColumnGroupingPlugin.prototype._renderGroup = function (groupDef, section) {
|
686
|
+
var colIndex = groupDef["colIndex"];
|
687
|
+
if (colIndex == null) {
|
688
|
+
return;
|
689
|
+
}
|
690
|
+
var rowIndex = groupDef["onRow"];
|
691
|
+
var cell = section.getCell(colIndex, rowIndex);
|
692
|
+
if (cell) {
|
693
|
+
// Overide the defaults
|
694
|
+
cell.setStyle("text-align", groupDef["alignment"] || "");
|
695
|
+
cell.setTooltip(ColumnGroupingPlugin._getTooltip(groupDef));
|
696
|
+
cell.setContent(groupDef["name"] || groupDef["title"]);
|
688
697
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
}
|
698
|
+
// Additional cell settings must be removed in the _applyGrouping() method
|
699
|
+
cell.addClass("no-sort");
|
700
|
+
cell.setAttribute("group-id", groupDef["id"]);
|
701
|
+
if (groupDef["legacyRender"]) {
|
702
|
+
// Built-in version if render receive colIndex, cell, groupDefinition as arguments
|
703
|
+
groupDef["legacyRender"](colIndex, cell, groupDef);
|
704
|
+
}
|
705
|
+
if (groupDef["render"]) {
|
706
|
+
var arg = {};
|
707
|
+
arg["cell"] = cell;
|
708
|
+
arg["colIndex"] = colIndex;
|
709
|
+
arg["groupNode"] = groupDef;
|
710
|
+
groupDef["render"](arg);
|
703
711
|
}
|
704
712
|
}
|
705
713
|
};
|
@@ -709,7 +717,7 @@ ColumnGroupingPlugin.prototype._renderGroups = function () {
|
|
709
717
|
*/
|
710
718
|
ColumnGroupingPlugin.prototype._onPostSectionRender = function (e) {
|
711
719
|
if (e.sectionType === "title" && !this._restructuring) {
|
712
|
-
this.
|
720
|
+
this.renderGroups();
|
713
721
|
}
|
714
722
|
};
|
715
723
|
|
@@ -1029,6 +1037,26 @@ ColumnGroupingPlugin.prototype.setGroupChildren = function (groupId, newChildLis
|
|
1029
1037
|
}
|
1030
1038
|
return false;
|
1031
1039
|
};
|
1040
|
+
/** @public
|
1041
|
+
* @param {string} groupId
|
1042
|
+
* @param {string} groupName
|
1043
|
+
*/
|
1044
|
+
ColumnGroupingPlugin.prototype.setGroupName = function (groupId, groupName) {
|
1045
|
+
if (this._groupDefs.setGroupName(groupId, groupName)) {
|
1046
|
+
var groupDef = this._visibleGroupMap[groupId];
|
1047
|
+
if (groupDef) {
|
1048
|
+
groupDef.name = groupName;
|
1049
|
+
var hostCount = this._hosts.length;
|
1050
|
+
for (var i = 0; i < hostCount; ++i) {
|
1051
|
+
var section = this._hosts[i].getSection("title");
|
1052
|
+
if (!section) {
|
1053
|
+
continue;
|
1054
|
+
}
|
1055
|
+
this._renderGroup(groupDef, section);
|
1056
|
+
}
|
1057
|
+
}
|
1058
|
+
}
|
1059
|
+
};
|
1032
1060
|
/** @private
|
1033
1061
|
* @param {string} groupId
|
1034
1062
|
* @return {!Array.<string>} The list of immediate valid child, including invisible child groups
|
@@ -119,6 +119,8 @@ declare class ColumnStackPlugin extends GridPlugin {
|
|
119
119
|
|
120
120
|
public getActiveColumnField(stackId: string): string;
|
121
121
|
|
122
|
+
public getActiveColumnIndex(stackId: string): number;
|
123
|
+
|
122
124
|
public addStackChild(stackId: string, colRef: number|string|null): void;
|
123
125
|
|
124
126
|
public removeStackChild(stackId: string, colRef: number|string|null): void;
|
@@ -1045,8 +1045,22 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
|
|
1045
1045
|
stack.activeColumn = stack.stackRefs[stack.stackRefs.length - 1]; // Right most column is the active column
|
1046
1046
|
} else {
|
1047
1047
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1048
|
-
if(csp && csp.isEnabled())
|
1049
|
-
|
1048
|
+
if(csp && csp.isEnabled()){
|
1049
|
+
var stackSelection = false;
|
1050
|
+
for(i = 0; i < len; ++i){
|
1051
|
+
colIndex = colRefs[i];
|
1052
|
+
if(colIndex === activeIndex){
|
1053
|
+
continue;
|
1054
|
+
}
|
1055
|
+
if(csp.isSelectedColumn(colIndex)){
|
1056
|
+
stackSelection = true;
|
1057
|
+
break;
|
1058
|
+
}
|
1059
|
+
}
|
1060
|
+
if(stackSelection) {
|
1061
|
+
csp.selectSingleColumn(activeIndex);
|
1062
|
+
csp.dispatchSelectionChanged();
|
1063
|
+
}
|
1050
1064
|
}
|
1051
1065
|
}
|
1052
1066
|
|
@@ -1113,7 +1127,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1113
1127
|
}
|
1114
1128
|
|
1115
1129
|
var dirty = false;
|
1116
|
-
var selFrom, selLen;
|
1117
1130
|
|
1118
1131
|
for(var sid in stacks) {
|
1119
1132
|
var stack = this._stacks[sid];
|
@@ -1124,8 +1137,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1124
1137
|
|
1125
1138
|
var stackRefs = stack.stackRefs;
|
1126
1139
|
len = stackRefs.length;
|
1127
|
-
selFrom = this._getColumnIndex(stack.stackRefs[0]);
|
1128
|
-
selLen = len - 1;
|
1129
1140
|
|
1130
1141
|
for(i = 0; i < len; ++i) {
|
1131
1142
|
var stackRef = stackRefs[i];
|
@@ -1140,10 +1151,6 @@ ColumnStackPlugin.prototype.unstackColumns = function(colIndices) {
|
|
1140
1151
|
delete this._stacks[sid]; // Remove all reference to the stack
|
1141
1152
|
}
|
1142
1153
|
if(dirty) {
|
1143
|
-
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1144
|
-
if(csp && csp.isEnabled()) {
|
1145
|
-
csp.selectRange(selFrom, selLen);
|
1146
|
-
}
|
1147
1154
|
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1148
1155
|
if(cfp) {
|
1149
1156
|
cfp["refresh"]();
|
@@ -1256,6 +1263,7 @@ ColumnStackPlugin.prototype.swapColumn = function(colRef, swappingIndex) {
|
|
1256
1263
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1257
1264
|
if(csp && csp.isEnabled()) {
|
1258
1265
|
csp.selectSingleColumn(newActiveColumnIndex);
|
1266
|
+
csp.dispatchSelectionChanged();
|
1259
1267
|
}
|
1260
1268
|
var cfp = this._getPlugin("ColumnFilterPlugin");
|
1261
1269
|
if(cfp) {
|
@@ -1306,16 +1314,7 @@ ColumnStackPlugin.prototype._onColumnRemoved = function (e) {
|
|
1306
1314
|
delete this._stacks[stackOpt.stackId];
|
1307
1315
|
}
|
1308
1316
|
} else {
|
1309
|
-
|
1310
|
-
stackOpt.activeColumn = stackOpt.stackRefs[stackOpt.stackRefs.length - 1];
|
1311
|
-
} else {
|
1312
|
-
stackOpt.activeColumn = stackOpt.stackRefs[0];
|
1313
|
-
}
|
1314
|
-
|
1315
|
-
// TODO: Add a proper way to set visibility to activeColumn when activeColumn is changed
|
1316
|
-
var activeColIndex = this._getColumnIndex(stackOpt.activeColumn);
|
1317
|
-
this._setColumnVisibility(activeColIndex, true);
|
1318
|
-
this._updateUI();
|
1317
|
+
this._updateActiveColumn(stackOpt);
|
1319
1318
|
}
|
1320
1319
|
}
|
1321
1320
|
}
|
@@ -1513,6 +1512,7 @@ ColumnStackPlugin.prototype._onStackButtonClicked = function(e) {
|
|
1513
1512
|
pos["columnIndices"] = colIndices;
|
1514
1513
|
pos["activeColIndex"] = this._getColumnIndex(colData.activeColumn);
|
1515
1514
|
pos["event"] = e;
|
1515
|
+
pos["stackId"] = colData.stackId;
|
1516
1516
|
|
1517
1517
|
elem.focus();
|
1518
1518
|
this._dispatch("clicked", pos);
|
@@ -1809,15 +1809,29 @@ ColumnStackPlugin.prototype.getStackName = function(stackId) {
|
|
1809
1809
|
*/
|
1810
1810
|
ColumnStackPlugin.prototype.getActiveColumnField = function(stackId) {
|
1811
1811
|
var field = "";
|
1812
|
+
var activeColIndex = this.getActiveColumnIndex(stackId);
|
1813
|
+
if(activeColIndex !== -1){
|
1814
|
+
field = this._getField(activeColIndex);
|
1815
|
+
}
|
1816
|
+
return field;
|
1817
|
+
};
|
1818
|
+
|
1819
|
+
/** @public
|
1820
|
+
* @description Get active column index of specific stack
|
1821
|
+
* @param {string} stackId
|
1822
|
+
* @return {number} active column index
|
1823
|
+
*/
|
1824
|
+
ColumnStackPlugin.prototype.getActiveColumnIndex = function(stackId) {
|
1825
|
+
var activeColIndex = -1;
|
1812
1826
|
if(stackId !== null) {
|
1813
1827
|
var stack = this._stacks[stackId];
|
1814
1828
|
if(stack){
|
1815
|
-
|
1816
|
-
field = this._getField(activeColIndex);
|
1829
|
+
activeColIndex = this._getColumnIndex(stack.activeColumn);
|
1817
1830
|
}
|
1818
1831
|
}
|
1819
|
-
return
|
1832
|
+
return activeColIndex;
|
1820
1833
|
};
|
1834
|
+
//getActiveColumnIndex
|
1821
1835
|
|
1822
1836
|
/** @public
|
1823
1837
|
* @param {string} stackId
|
@@ -1899,6 +1913,26 @@ ColumnStackPlugin.prototype._setStackVisibility = function(stackId, visible) {
|
|
1899
1913
|
}
|
1900
1914
|
};
|
1901
1915
|
|
1916
|
+
/** @private
|
1917
|
+
* @description Check for active column in a stack if it needs an update.
|
1918
|
+
* @param {Object} stackOpt
|
1919
|
+
*/
|
1920
|
+
ColumnStackPlugin.prototype._updateActiveColumn = function(stackOpt) {
|
1921
|
+
if(!stackOpt) { return; }
|
1922
|
+
|
1923
|
+
var stackRefs = stackOpt["stackRefs"];
|
1924
|
+
if(!stackRefs || !stackRefs.length) { return; }
|
1925
|
+
|
1926
|
+
if(stackRefs.indexOf(stackOpt.activeColumn) === -1) {
|
1927
|
+
stackOpt.activeColumn = stackOpt["spreading"] ? stackRefs[stackRefs.length - 1] : stackRefs[0];
|
1928
|
+
|
1929
|
+
// TODO: Add a proper way to set visibility to activeColumn when activeColumn is changed
|
1930
|
+
var activeColIndex = this._getColumnIndex(stackOpt.activeColumn);
|
1931
|
+
this._setColumnVisibility(activeColIndex, true);
|
1932
|
+
this._updateUI();
|
1933
|
+
}
|
1934
|
+
};
|
1935
|
+
|
1902
1936
|
/** @public
|
1903
1937
|
* @description Hide specific stack from grid
|
1904
1938
|
* @param {string} stackId
|
@@ -13,16 +13,16 @@ declare namespace ConditionalColoringPlugin {
|
|
13
13
|
|
14
14
|
type ColumnOptions = {
|
15
15
|
conditions?: (ConditionalColoringPlugin.Condition)[]|null,
|
16
|
-
colorText?: (string|boolean)|null,
|
17
|
-
tickColor?: (string|boolean)|null,
|
18
|
-
blinking?: (ConditionalColoringPlugin.Blinking
|
16
|
+
colorText?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
|
17
|
+
tickColor?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
|
18
|
+
blinking?: (string|boolean|ConditionalColoringPlugin.Blinking)|null,
|
19
19
|
field?: string|null
|
20
20
|
};
|
21
21
|
|
22
22
|
type ConditionalColoringOptions = {
|
23
23
|
conditions?: (ConditionalColoringPlugin.Condition)[]|null,
|
24
|
-
colorText?: (string|boolean)|null,
|
25
|
-
tickColor?: (string|boolean)|null,
|
24
|
+
colorText?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
|
25
|
+
tickColor?: (string|boolean|ConditionalColoringPlugin.ColorText)|null,
|
26
26
|
field?: string|null
|
27
27
|
};
|
28
28
|
|
@@ -41,6 +41,13 @@ declare namespace ConditionalColoringPlugin {
|
|
41
41
|
level?: (string|boolean)|null
|
42
42
|
};
|
43
43
|
|
44
|
+
type ColorText = {
|
45
|
+
field?: string|null,
|
46
|
+
upClass?: string|null,
|
47
|
+
downClass?: string|null,
|
48
|
+
levelClass?: string|null
|
49
|
+
};
|
50
|
+
|
44
51
|
}
|
45
52
|
|
46
53
|
declare class ConditionalColoringPlugin extends GridPlugin {
|
@@ -13,17 +13,17 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
13
13
|
/** @typedef {Object} ConditionalColoringPlugin~ColumnOptions
|
14
14
|
* @description Extension column options that can be specified on each individual grid's column option:
|
15
15
|
* @property {Array.<ConditionalColoringPlugin~Condition>=} conditions=null List of condition options
|
16
|
-
* @property {(string|boolean)=} colorText=null A shorthand for specifying default condition based on the field.
|
17
|
-
* @property {(string|boolean)=} tickColor=null Alias of colorText.
|
18
|
-
* @property {(ConditionalColoringPlugin~Blinking
|
16
|
+
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} colorText=null A shorthand for specifying default condition based on the field.
|
17
|
+
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText.
|
18
|
+
* @property {(string|boolean|ConditionalColoringPlugin~Blinking)=} blinking=null Blink Options. If specified, the cell will be blinked on data change.
|
19
19
|
* @property {string=} field
|
20
20
|
*/
|
21
21
|
|
22
22
|
/** @typedef {Object} ConditionalColoringPlugin~ConditionalColoringOptions
|
23
23
|
* @description Extension column options that can be specified on each individual grid's column option:
|
24
24
|
* @property {Array.<ConditionalColoringPlugin~Condition>=} conditions=null List of condition options
|
25
|
-
* @property {(string|boolean)=} colorText=null A shorthand for specifying default condition based on the field.
|
26
|
-
* @property {(string|boolean)=} tickColor=null Alias of colorText.
|
25
|
+
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} colorText=null A shorthand for specifying default condition based on the field.
|
26
|
+
* @property {(string|boolean|ConditionalColoringPlugin~ColorText)=} tickColor=null Alias of colorText.
|
27
27
|
* @property {string=} field
|
28
28
|
*/
|
29
29
|
|
@@ -45,6 +45,15 @@ import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
|
45
45
|
* @property {(string|boolean)=} level CSS color (e.g. #33333, grey). If false value is specified, blinking for level color is disabled.
|
46
46
|
*/
|
47
47
|
|
48
|
+
/** @typedef {(string|boolean|Object)} ConditionalColoringPlugin~ColorText
|
49
|
+
* @description Available options describing `colorText` object. Additionally if specify colorText as string of field, colorText will base on the field. <br>
|
50
|
+
* If specified true, field from column definition will be used.
|
51
|
+
* @property {string=} field If not specified, field from column definition will be used
|
52
|
+
* @property {string=} upClass CSS class name.
|
53
|
+
* @property {string=} downClass CSS class name.
|
54
|
+
* @property {string=} levelClass CSS class name.
|
55
|
+
*/
|
56
|
+
|
48
57
|
var COLORING_TYPE = "coloring";
|
49
58
|
var BLINKING_TYPE = "blinking";
|
50
59
|
|
@@ -89,6 +98,10 @@ ConditionalColoringPlugin._cleanUpTimer = 0;
|
|
89
98
|
* @private
|
90
99
|
*/
|
91
100
|
ConditionalColoringPlugin._controlClass = "predefined-conditional-color";
|
101
|
+
/** @type {string}
|
102
|
+
* @private
|
103
|
+
*/
|
104
|
+
ConditionalColoringPlugin._colorTextStyles;
|
92
105
|
|
93
106
|
/** @type {boolean}
|
94
107
|
* @private
|
@@ -103,6 +116,10 @@ ConditionalColoringPlugin.prototype._pendingFields;
|
|
103
116
|
* @private
|
104
117
|
*/
|
105
118
|
ConditionalColoringPlugin.prototype._predefinedColors = null;
|
119
|
+
/** @type {string}
|
120
|
+
* @private
|
121
|
+
*/
|
122
|
+
ConditionalColoringPlugin._predefinedColorsStyles;
|
106
123
|
|
107
124
|
/** @override
|
108
125
|
* @return {string}
|
@@ -136,7 +153,12 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
136
153
|
if (extOptions) {
|
137
154
|
var predefinedColors = extOptions["predefinedColors"];
|
138
155
|
if (predefinedColors != null && typeof predefinedColors === "object") {
|
139
|
-
this.
|
156
|
+
if (!this._predefinedColors) {
|
157
|
+
this._predefinedColors = predefinedColors;
|
158
|
+
this._predefinedColorsStyles = this._prepareStyles(predefinedColors);
|
159
|
+
}
|
160
|
+
|
161
|
+
this._injectPredefinedColors(host);
|
140
162
|
host.enableClass(ConditionalColoringPlugin._controlClass);
|
141
163
|
}
|
142
164
|
}
|
@@ -145,6 +167,7 @@ ConditionalColoringPlugin.prototype.initialize = function (host, options) {
|
|
145
167
|
this.config(options);
|
146
168
|
} else {
|
147
169
|
this._applyStyle(host, options);
|
170
|
+
this._injectColorTextStyles();
|
148
171
|
}
|
149
172
|
|
150
173
|
host.listen("postSectionDataBinding", this._onSectionBinding);
|
@@ -455,7 +478,7 @@ ConditionalColoringPlugin.prototype._removeDataFields = function(fieldRef, colRe
|
|
455
478
|
};
|
456
479
|
|
457
480
|
/** @private
|
458
|
-
* @param {(
|
481
|
+
* @param {(string|number)=} colRef
|
459
482
|
* @param {string} type
|
460
483
|
*/
|
461
484
|
ConditionalColoringPlugin.prototype._removeFieldReferrer = function(colRef, type) {
|
@@ -464,8 +487,15 @@ ConditionalColoringPlugin.prototype._removeFieldReferrer = function(colRef, type
|
|
464
487
|
}
|
465
488
|
var referrer = null;
|
466
489
|
if (colRef != null) {
|
467
|
-
var
|
468
|
-
|
490
|
+
var colId = colRef;
|
491
|
+
if (typeof colRef === "number") {
|
492
|
+
var colDef = this._realTimeGrid.getColumnDefinition(colRef);
|
493
|
+
if (colDef) {
|
494
|
+
colId = colDef.getId();
|
495
|
+
}
|
496
|
+
}
|
497
|
+
|
498
|
+
referrer = colId ? colId + "_" + type : null;
|
469
499
|
this._realTimeGrid.removeFieldReferrer(referrer);
|
470
500
|
}
|
471
501
|
};
|
@@ -496,25 +526,16 @@ ConditionalColoringPlugin.prototype._removeFieldReferrer = function(colRef, type
|
|
496
526
|
* };
|
497
527
|
*/
|
498
528
|
ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, columnOptions) {
|
499
|
-
// Save column config state
|
500
|
-
var colData = this._newColumnData(colIndex);
|
501
529
|
var blinkingOptions, field;
|
502
530
|
if(columnOptions) {
|
503
|
-
|
504
|
-
|
505
|
-
colData["tickColor"] = columnOptions["tickColor"];
|
506
|
-
colData["blinking"] = blinkingOptions = columnOptions["blinking"];
|
507
|
-
colData["field"] = field = columnOptions["field"];
|
508
|
-
} else {
|
509
|
-
colData["conditions"] = null;
|
510
|
-
colData["colorText"] = null;
|
511
|
-
colData["tickColor"] = null;
|
512
|
-
colData["blinking"] = null;
|
531
|
+
blinkingOptions = columnOptions["blinking"];
|
532
|
+
field = columnOptions["field"];
|
513
533
|
}
|
514
534
|
|
515
535
|
this.setColumnBlinking(colIndex, blinkingOptions, field);
|
516
536
|
this.setConditionalColoring(colIndex, columnOptions);
|
517
537
|
|
538
|
+
var colData = this._newColumnData(colIndex);
|
518
539
|
if (colData["painter"] && !(colData["coloringFields"] || colData["blinkingField"])) { // Clear existing painter
|
519
540
|
this._clearPainter(colData);
|
520
541
|
}
|
@@ -526,6 +547,17 @@ ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, colu
|
|
526
547
|
*/
|
527
548
|
ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex, coloringOptions) {
|
528
549
|
var colData = this._newColumnData(colIndex);
|
550
|
+
if(coloringOptions) {
|
551
|
+
// Save column config state
|
552
|
+
colData["conditions"] = coloringOptions["conditions"];
|
553
|
+
colData["colorText"] = coloringOptions["colorText"];
|
554
|
+
colData["tickColor"] = coloringOptions["tickColor"];
|
555
|
+
colData["field"] = coloringOptions["field"];
|
556
|
+
} else {
|
557
|
+
colData["conditions"] = null;
|
558
|
+
colData["colorText"] = null;
|
559
|
+
colData["tickColor"] = null;
|
560
|
+
}
|
529
561
|
var painter = colData["painter"];
|
530
562
|
var prevFields = colData["coloringFields"] ? Object.keys(colData["coloringFields"]) : null;
|
531
563
|
var colorOptions = this._prepareColorOptions(colIndex, coloringOptions);
|
@@ -552,7 +584,28 @@ ConditionalColoringPlugin.prototype.setConditionalColoring = function (colIndex,
|
|
552
584
|
painter.setConditions(colorOptions.condColoring.conditions);
|
553
585
|
} else if(colorOptions.colorText) {
|
554
586
|
painter.resetColoring(); //Clear conditions before add new color
|
555
|
-
|
587
|
+
var options = colorOptions.colorText;
|
588
|
+
if (options.useThemeColors) {
|
589
|
+
if (!ConditionalColoringPlugin._colorTextStyles) {
|
590
|
+
var styles = {
|
591
|
+
positive: {
|
592
|
+
color: "var(--color-scheme-positive)"
|
593
|
+
},
|
594
|
+
negative: {
|
595
|
+
color: "var(--color-scheme-negative)"
|
596
|
+
},
|
597
|
+
neutral: {
|
598
|
+
color: "var(--color-scheme-neutral)"
|
599
|
+
}
|
600
|
+
};
|
601
|
+
|
602
|
+
ConditionalColoringPlugin._colorTextStyles = this._prepareStyles(styles);
|
603
|
+
}
|
604
|
+
this._injectColorTextStyles();
|
605
|
+
painter.addColorTextWithTheme(colorOptions.colorText.field);
|
606
|
+
} else {
|
607
|
+
painter.addColorText(options.field, options.upClass, options.downClass, options.levelClass);
|
608
|
+
}
|
556
609
|
}
|
557
610
|
|
558
611
|
var fields = Object.keys(newFieldsMap);
|
@@ -777,12 +830,19 @@ ConditionalColoringPlugin.prototype._prepareColorOptions = function(colIndex, co
|
|
777
830
|
colorOptions.hasColor = 1;
|
778
831
|
colorOptions.fields = {};
|
779
832
|
colorOptions.colorText = {};
|
780
|
-
|
833
|
+
colorOptions.colorText.useThemeColors = true;
|
781
834
|
var type = typeof colorText;
|
782
835
|
if(type === "string") {
|
783
836
|
field = colorText;
|
784
837
|
} else if(type === "object") {
|
785
838
|
field = /** @type{string} */(colorText["field"]) || field;
|
839
|
+
|
840
|
+
if (colorText["upClass"] || colorText["downClass"] || colorText["levelClass"]) {
|
841
|
+
colorOptions.colorText.useThemeColors = false;
|
842
|
+
colorOptions.colorText.upClass = colorText["upClass"];
|
843
|
+
colorOptions.colorText.downClass = colorText["downClass"];
|
844
|
+
colorOptions.colorText.levelClass = colorText["levelClass"];
|
845
|
+
}
|
786
846
|
}
|
787
847
|
colorOptions.colorText.field = field;
|
788
848
|
colorOptions.fields[field] = true;
|
@@ -856,16 +916,17 @@ ConditionalColoringPlugin._mergeUpdates = function(e) {
|
|
856
916
|
return changedRows;
|
857
917
|
};
|
858
918
|
/** @private
|
859
|
-
* @param {Object}
|
919
|
+
* @param {Object} colors Predefined color object map
|
920
|
+
* @return {string} prettified CSS string
|
860
921
|
*/
|
861
|
-
ConditionalColoringPlugin.prototype.
|
862
|
-
var prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .
|
922
|
+
ConditionalColoringPlugin.prototype._prepareStyles = function(colors) {
|
923
|
+
var prefix = ".tr-grid." + ConditionalColoringPlugin._controlClass + " .cell";
|
863
924
|
var css = [];
|
864
925
|
var ss, styles, value;
|
865
|
-
for (var className in
|
926
|
+
for (var className in colors) {
|
866
927
|
css.push(prefix + "." + className);
|
867
928
|
ss = [];
|
868
|
-
styles =
|
929
|
+
styles = colors[className];
|
869
930
|
|
870
931
|
value = styles["backgroundColor"];
|
871
932
|
if(value) {
|
@@ -880,22 +941,46 @@ ConditionalColoringPlugin.prototype._injectStyles = function(predefinedColors) {
|
|
880
941
|
css.push(ss);
|
881
942
|
}
|
882
943
|
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
944
|
+
return prettifyCss(css);
|
945
|
+
};
|
946
|
+
/** @private
|
947
|
+
*/
|
948
|
+
ConditionalColoringPlugin.prototype._injectColorTextStyles = function() {
|
949
|
+
if (ConditionalColoringPlugin._colorTextStyles) {
|
950
|
+
var hosts = this._hosts;
|
951
|
+
var len = hosts.length;
|
952
|
+
for (var i = 0; i < len; i++) {
|
953
|
+
var host = hosts[i];
|
954
|
+
host.enableClass(ConditionalColoringPlugin._controlClass);
|
955
|
+
if (!host._colorTextStyles) {
|
956
|
+
injectCss(ConditionalColoringPlugin._colorTextStyles, host.getElement());
|
957
|
+
host._colorTextStyles = true;
|
958
|
+
}
|
959
|
+
}
|
889
960
|
}
|
890
|
-
|
891
|
-
|
961
|
+
};
|
962
|
+
/** @private
|
963
|
+
* @param {Object} host
|
964
|
+
*/
|
965
|
+
ConditionalColoringPlugin.prototype._injectPredefinedColors = function(host) {
|
966
|
+
if(host._conditionalColoringStyleTag) {
|
967
|
+
host._conditionalColoringStyleTag.parentNode.removeChild(host._conditionalColoringStyleTag);
|
968
|
+
host._conditionalColoringStyleTag = null;
|
969
|
+
}
|
970
|
+
host._conditionalColoringStyleTag = injectCss(this._predefinedColorsStyles, host.getElement());
|
892
971
|
};
|
893
972
|
/** @public
|
894
973
|
* @param {Object} predefinedColors Predefined color object map
|
895
974
|
*/
|
896
975
|
ConditionalColoringPlugin.prototype.setPredefinedColors = function(predefinedColors) {
|
897
|
-
if(predefinedColors != null && typeof predefinedColors === "object") {
|
898
|
-
this.
|
976
|
+
if (predefinedColors != null && typeof predefinedColors === "object") {
|
977
|
+
this._predefinedColors = predefinedColors;
|
978
|
+
this._predefinedColorsStyles = this._prepareStyles(predefinedColors);
|
979
|
+
var hosts = this._hosts;
|
980
|
+
var len = hosts.length;
|
981
|
+
for (var i = 0; i < len; i++) {
|
982
|
+
this._injectPredefinedColors(hosts[i]);
|
983
|
+
}
|
899
984
|
}
|
900
985
|
};
|
901
986
|
/** @private
|
@@ -1073,19 +1158,20 @@ ConditionalColoringPlugin.prototype._onColumnRemoved = function(e) {
|
|
1073
1158
|
this._clearPainter(colData);
|
1074
1159
|
|
1075
1160
|
// Removed column
|
1076
|
-
var
|
1077
|
-
if (
|
1161
|
+
var colId = e["colId"];
|
1162
|
+
if (colId) {
|
1078
1163
|
if (colData["coloringFields"]) {
|
1079
|
-
this._removeFieldReferrer(
|
1164
|
+
this._removeFieldReferrer(colId, COLORING_TYPE);
|
1080
1165
|
}
|
1081
1166
|
if (colData["blinkingField"]) {
|
1082
|
-
this._removeFieldReferrer(
|
1167
|
+
this._removeFieldReferrer(colId, BLINKING_TYPE);
|
1083
1168
|
}
|
1084
1169
|
}
|
1085
1170
|
|
1086
1171
|
// Another columns
|
1087
1172
|
var field = colData["field"];
|
1088
1173
|
if (field) {
|
1174
|
+
var colDef = colData["COL_DEF"];
|
1089
1175
|
var isStaticField = colDef ? !colDef.isRealTimeField() : true;
|
1090
1176
|
if (isStaticField) {
|
1091
1177
|
var colCount = this.getColumnCount();
|
@@ -7,12 +7,12 @@ declare namespace HeatMapPlugin {
|
|
7
7
|
|
8
8
|
type ColumnOptions = {
|
9
9
|
field: string,
|
10
|
-
heatMap?: HeatMapPlugin.Heatmap
|
10
|
+
heatMap?: HeatMapPlugin.Heatmap|null
|
11
11
|
};
|
12
12
|
|
13
13
|
type Heatmap = {
|
14
|
-
midPoint?: number,
|
15
|
-
mode?: string
|
14
|
+
midPoint?: number|null,
|
15
|
+
mode?: string|null
|
16
16
|
};
|
17
17
|
|
18
18
|
}
|
@@ -144,14 +144,25 @@ HeatMapPlugin.prototype.getConfigObject = function (out_obj) {
|
|
144
144
|
col = columns[i] = {};
|
145
145
|
}
|
146
146
|
|
147
|
-
var heatMap = col.heatMap = {};
|
148
147
|
|
149
148
|
var opt = this.getColumnHeatMap(i);
|
150
149
|
|
151
|
-
if (!opt) {
|
150
|
+
if (!opt) { // We are only interested in the columns that have heat map informations
|
151
|
+
continue;
|
152
|
+
}
|
153
|
+
|
154
|
+
// default value of midPoint and mode
|
155
|
+
if(opt.midPoint === 0 && opt.mode === "cell") {
|
156
|
+
col.heatMap = true;
|
157
|
+
continue;
|
158
|
+
}
|
159
|
+
|
160
|
+
var heatMap = col.heatMap = {};
|
161
|
+
|
152
162
|
if (opt.midPoint != null) {
|
153
163
|
heatMap.midPoint = opt.midPoint;
|
154
164
|
}
|
165
|
+
|
155
166
|
if (opt.mode != null) {
|
156
167
|
heatMap.mode = opt.mode;
|
157
168
|
}
|
@@ -18,7 +18,8 @@ declare namespace RowDraggingPlugin {
|
|
18
18
|
dragStart?: ((...params: any[]) => any)|null,
|
19
19
|
drag?: ((...params: any[]) => any)|null,
|
20
20
|
dragEnd?: ((...params: any[]) => any)|null,
|
21
|
-
dataMoved?: ((...params: any[]) => any)|null
|
21
|
+
dataMoved?: ((...params: any[]) => any)|null,
|
22
|
+
beforeDataMoved?: ((...params: any[]) => any)|null
|
22
23
|
};
|
23
24
|
|
24
25
|
}
|