@refinitiv-ui/efx-grid 6.0.78 → 6.0.80
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.js +1 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +12 -11
- package/lib/column-selection-dialog/lib/locale/translation-de.js +2 -1
- package/lib/column-selection-dialog/lib/locale/translation-en.js +2 -1
- package/lib/column-selection-dialog/lib/locale/translation-ja.js +2 -1
- package/lib/column-selection-dialog/lib/locale/translation-zh-hant.js +2 -1
- package/lib/column-selection-dialog/lib/locale/translation-zh.js +2 -1
- package/lib/column-selection-dialog/themes/base.less +45 -24
- package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/core/dist/core.js +26 -1
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +4 -0
- package/lib/core/es6/data/DataView.js +25 -0
- package/lib/core/es6/grid/Core.js +1 -1
- package/lib/filter-dialog/lib/filter-dialog.js +4 -2
- package/lib/formatters/es6/TextFormatter.js +6 -1
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +24 -3
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +1 -2
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +12 -42
- package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +1 -2
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +99 -132
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +4 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +51 -16
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +1 -2
- package/lib/tr-grid-row-selection/es6/RowSelection.js +28 -51
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +8 -0
- package/lib/tr-grid-util/es6/GridPlugin.js +95 -0
- package/lib/types/es6/ColumnSelection.d.ts +1 -2
- package/lib/types/es6/ContextMenu.d.ts +1 -2
- package/lib/types/es6/Core/data/DataView.d.ts +4 -0
- package/lib/types/es6/RowGrouping.d.ts +4 -0
- package/lib/types/es6/RowSelection.d.ts +1 -2
- package/lib/versions.json +10 -10
- package/package.json +1 -1
@@ -198,6 +198,10 @@ declare class DataView extends EventDispatcher {
|
|
198
198
|
|
199
199
|
public disableCollapsing(bool?: boolean|null): void;
|
200
200
|
|
201
|
+
public setGroupColor(groupColor: string): void;
|
202
|
+
|
203
|
+
public getGroupColor(): string;
|
204
|
+
|
201
205
|
public getVisibleRowCount(): number;
|
202
206
|
|
203
207
|
public isRowDataInGroup(rowData: any, groupID?: string|null): boolean;
|
@@ -233,6 +233,10 @@ DataView.prototype._groupRows = null; // Shared between groups
|
|
233
233
|
*/
|
234
234
|
DataView.prototype._groupId = "";
|
235
235
|
/** @private
|
236
|
+
* @type {string}
|
237
|
+
*/
|
238
|
+
DataView.prototype._groupColor = "";
|
239
|
+
/** @private
|
236
240
|
* @type {*}
|
237
241
|
*/
|
238
242
|
DataView.prototype._groupValue;
|
@@ -1815,6 +1819,27 @@ DataView.prototype.isCollapsible = function() {
|
|
1815
1819
|
DataView.prototype.disableCollapsing = function(bool) {
|
1816
1820
|
this._collapsible = !(bool !== false);
|
1817
1821
|
};
|
1822
|
+
/**
|
1823
|
+
* @public
|
1824
|
+
* @param {string} groupColor
|
1825
|
+
*/
|
1826
|
+
DataView.prototype.setGroupColor = function(groupColor) {
|
1827
|
+
if(this._groupLevel === 1) {
|
1828
|
+
this._groupColor = groupColor;
|
1829
|
+
}
|
1830
|
+
};
|
1831
|
+
/**
|
1832
|
+
* @public
|
1833
|
+
* @return {string}
|
1834
|
+
*/
|
1835
|
+
DataView.prototype.getGroupColor = function() {
|
1836
|
+
if(this._groupLevel === 0) {
|
1837
|
+
return "";
|
1838
|
+
} else if(this._groupLevel === 1) {
|
1839
|
+
return this._groupColor;
|
1840
|
+
}
|
1841
|
+
return this._parent.getGroupColor();
|
1842
|
+
};
|
1818
1843
|
/** @private
|
1819
1844
|
* @return {?Array.<string>}
|
1820
1845
|
*/
|
@@ -73,7 +73,9 @@ const TEXT_FILTERS = [
|
|
73
73
|
DEFAULT_FILTERS[6],
|
74
74
|
DEFAULT_FILTERS[7],
|
75
75
|
DEFAULT_FILTERS[8],
|
76
|
-
DEFAULT_FILTERS[9]
|
76
|
+
DEFAULT_FILTERS[9],
|
77
|
+
DEFAULT_FILTERS[10],
|
78
|
+
DEFAULT_FILTERS[11]
|
77
79
|
];
|
78
80
|
/** @type {Array.<Array>}
|
79
81
|
* @private
|
@@ -736,7 +738,7 @@ class FilterDialog extends BasicElement {
|
|
736
738
|
var fdt = dateTimeType ? dateTimeType : this.fieldDataType.toLowerCase();
|
737
739
|
if(fdt === "number") {
|
738
740
|
filterItems = NUMBER_FILTERS;
|
739
|
-
} else if(fdt === "
|
741
|
+
} else if(fdt === "string" || fdt === "text") {
|
740
742
|
filterItems = TEXT_FILTERS;
|
741
743
|
} else {
|
742
744
|
filterItems = DEFAULT_FILTERS;
|
@@ -5,6 +5,10 @@ var onElementUpdated = function (element, ctx) {
|
|
5
5
|
element.textContent = ctx.value;
|
6
6
|
};
|
7
7
|
|
8
|
+
var onElementCreated = function (element, ctx) {
|
9
|
+
element.classList.add("text");
|
10
|
+
};
|
11
|
+
|
8
12
|
/** @constructor
|
9
13
|
* @param {*=} options
|
10
14
|
*/
|
@@ -20,7 +24,8 @@ TextFormatter.create = function (options) {
|
|
20
24
|
var defaultOpt = {
|
21
25
|
tagName: "div",
|
22
26
|
refName: "TextFormatter",
|
23
|
-
onElementUpdated: onElementUpdated
|
27
|
+
onElementUpdated: onElementUpdated,
|
28
|
+
onElementCreated: onElementCreated
|
24
29
|
};
|
25
30
|
|
26
31
|
return FormatterBuilder.create(options, defaultOpt);
|
package/lib/grid/index.js
CHANGED
@@ -1111,12 +1111,12 @@ CheckboxPlugin.prototype._getSectionState = function (sectionSettings) {
|
|
1111
1111
|
}
|
1112
1112
|
};
|
1113
1113
|
/** @private
|
1114
|
-
* @param {Object} sectionSettings
|
1114
|
+
* @param {Object} sectionSettings Section or SectionSettings
|
1115
1115
|
* @param {number} rowIndex
|
1116
1116
|
* @return {Element}
|
1117
1117
|
*/
|
1118
1118
|
CheckboxPlugin.prototype._getCheckbox = function (sectionSettings, rowIndex) {
|
1119
|
-
var section = sectionSettings.getSection();
|
1119
|
+
var section = sectionSettings.getSection ? sectionSettings.getSection() : sectionSettings;
|
1120
1120
|
var chkbox = /** @type{Element} */(section.getCellContent(this._displayColumn, rowIndex));
|
1121
1121
|
if (!chkbox) {
|
1122
1122
|
return null;
|
@@ -1444,9 +1444,30 @@ CheckboxPlugin.prototype._onCheckboxClicked = function (e) {
|
|
1444
1444
|
* @param {Event} e
|
1445
1445
|
*/
|
1446
1446
|
CheckboxPlugin.prototype._onCheckboxKeydown = function (e) {
|
1447
|
-
|
1447
|
+
var keyCode = e.keyCode;
|
1448
|
+
if(keyCode === 32) {
|
1449
|
+
this._onCheckboxMousedown(e); // Set anchor if no shift key is pressed
|
1448
1450
|
this._onCheckboxChanged(e, true);
|
1449
1451
|
e.preventDefault();
|
1452
|
+
} if(keyCode === 38 || keyCode === 40) { // Arrow key up and down
|
1453
|
+
var host = this._hosts[0];
|
1454
|
+
var pos = host.getRelativePosition(e.currentTarget);
|
1455
|
+
if(pos.sectionType === "content") {
|
1456
|
+
var dv = host.getDataSource();
|
1457
|
+
var offset = (keyCode === 38) ? -1 : 1;
|
1458
|
+
var nextIndex = pos.rowIndex + offset;
|
1459
|
+
var rowId = dv.getRowId(nextIndex);
|
1460
|
+
if(rowId) {
|
1461
|
+
host.scrollToRow(null, nextIndex);
|
1462
|
+
var chkbox = this._getCheckbox(pos.section, nextIndex);
|
1463
|
+
if(chkbox) {
|
1464
|
+
chkbox.focus();
|
1465
|
+
}
|
1466
|
+
e.preventDefault();
|
1467
|
+
}
|
1468
|
+
}
|
1469
|
+
|
1470
|
+
|
1450
1471
|
}
|
1451
1472
|
};
|
1452
1473
|
/** @private
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
2
|
import { Dom } from "../../tr-grid-util/es6/Dom.js";
|
3
3
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
4
|
-
import {
|
5
|
-
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
4
|
+
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
5
|
|
7
6
|
declare namespace ColumnSelectionPlugin {
|
8
7
|
|
@@ -3,8 +3,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
3
3
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
4
4
|
import { Dom } from "../../tr-grid-util/es6/Dom.js";
|
5
5
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
6
|
-
import {
|
7
|
-
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
+
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
8
7
|
/** @event ColumnSelectionPlugin#selectionChanged
|
9
8
|
* @description Fired when selection is changed by mouse down or key press. A change by JavaScript APIs will not trigger this event.
|
10
9
|
*/
|
@@ -36,7 +35,6 @@ var ColumnSelectionPlugin = function ColumnSelectionPlugin(options) {
|
|
36
35
|
t._onColumnRemoved = t._onColumnRemoved.bind(t);
|
37
36
|
t._onColumnAdded = t._onColumnAdded.bind(t);
|
38
37
|
t._onReselection = t._onReselection.bind(t);
|
39
|
-
t._onThemeLoaded = t._onThemeLoaded.bind(t);
|
40
38
|
t._onColumnPositionChanged = t._onColumnPositionChanged.bind(t);
|
41
39
|
t._onBeforeBatchOperation = t._onBeforeBatchOperation.bind(t);
|
42
40
|
t._onAfterBatchOperation = t._onAfterBatchOperation.bind(t);
|
@@ -129,10 +127,20 @@ ColumnSelectionPlugin.prototype._cgp = null; // Column grouping extension
|
|
129
127
|
|
130
128
|
ColumnSelectionPlugin.prototype._prevSelectedCols = {}; // previous selected columns during batch operation
|
131
129
|
|
130
|
+
/** @private
|
131
|
+
* @return {string}
|
132
|
+
*/
|
133
|
+
|
134
|
+
ColumnSelectionPlugin._styleCalculator = function () {
|
135
|
+
var styles = [".column-selection-menu", ["position: absolute;", "background-color: var(--grid-column-menu-icon-bgcolor);", "color: var(--grid-column-menu-icon-color);", "z-index: 1;", "cursor: pointer;", "text-align: center;", "width: 16px;", "height: 16px;", "padding: 6px;"], ".column-selection-menu:hover", ["background-color: var(--grid-column-menu-icon-hover-bgcolor);"], ".column-selection-menu-inside", ["padding: 4px;" // if not outside icon, move to inside
|
136
|
+
], ".selected-column .cell.selected-group", ["background-color: var(--grid-selection-bgcolor);"]];
|
137
|
+
return prettifyCss(styles);
|
138
|
+
};
|
132
139
|
/** @public
|
133
140
|
* @return {string}
|
134
141
|
*/
|
135
142
|
|
143
|
+
|
136
144
|
ColumnSelectionPlugin.prototype.getName = function () {
|
137
145
|
return "ColumnSelectionPlugin"; // Read Only
|
138
146
|
};
|
@@ -167,45 +175,7 @@ ColumnSelectionPlugin.prototype.initialize = function (host, options) {
|
|
167
175
|
host.listen("beforeBatchOperation", this._onBeforeBatchOperation);
|
168
176
|
host.listen("afterBatchOperation", this._onAfterBatchOperation);
|
169
177
|
this.config(options);
|
170
|
-
|
171
|
-
if (ColumnSelectionPlugin._stylePromise) {
|
172
|
-
ColumnSelectionPlugin._applyThemeColor(host);
|
173
|
-
} else {
|
174
|
-
ColumnSelectionPlugin._stylePromise = ElfUtil.getThemeColors();
|
175
|
-
|
176
|
-
ColumnSelectionPlugin._stylePromise.then(this._onThemeLoaded)["catch"](this._onThemeLoaded);
|
177
|
-
}
|
178
|
-
};
|
179
|
-
/** @private
|
180
|
-
*/
|
181
|
-
|
182
|
-
|
183
|
-
ColumnSelectionPlugin.prototype._onThemeLoaded = function () {
|
184
|
-
if (!ColumnSelectionPlugin._styles) {
|
185
|
-
var styles = [".column-selection-menu", ["position: absolute;", "background-color: var(--grid-column-menu-icon-bgcolor);", "color: var(--grid-column-menu-icon-color);", "z-index: 1;", "cursor: pointer;", "text-align: center;", "width: 16px;", "height: 16px;", "padding: 6px;"], ".column-selection-menu:hover", ["background-color: var(--grid-column-menu-icon-hover-bgcolor);"], ".column-selection-menu-inside", ["padding: 4px;" // if not outside icon, move to inside
|
186
|
-
], ".selected-column .cell.selected-group", ["background-color: var(--grid-selection-bgcolor);"]];
|
187
|
-
ColumnSelectionPlugin._styles = prettifyCss(styles);
|
188
|
-
}
|
189
|
-
|
190
|
-
for (var i = this._hosts.length; --i >= 0;) {
|
191
|
-
ColumnSelectionPlugin._applyThemeColor(this._hosts[i]);
|
192
|
-
}
|
193
|
-
};
|
194
|
-
/** @private
|
195
|
-
* @param {Object} grid core grid instance
|
196
|
-
*/
|
197
|
-
|
198
|
-
|
199
|
-
ColumnSelectionPlugin._applyThemeColor = function (grid) {
|
200
|
-
if (!grid || grid._columnSelectionStyles) {
|
201
|
-
return;
|
202
|
-
}
|
203
|
-
|
204
|
-
if (ColumnSelectionPlugin._styles) {
|
205
|
-
grid._columnSelectionStyles = true; // Prevent loading the same style twice
|
206
|
-
|
207
|
-
injectCss(ColumnSelectionPlugin._styles, grid.getParent());
|
208
|
-
}
|
178
|
+
this.applyStaticStyles(ColumnSelectionPlugin._styleCalculator);
|
209
179
|
};
|
210
180
|
/**
|
211
181
|
* @protected
|
@@ -2,8 +2,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
2
2
|
import Ext from "../../tr-grid-util/es6/Ext.js";
|
3
3
|
import MenuEventAPI from "./MenuEventAPI.js";
|
4
4
|
import PopupMenu from "./PopupMenu.js";
|
5
|
-
import {
|
6
|
-
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
5
|
+
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
6
|
import CellPainter from "../../tr-grid-util/es6/CellPainter.js";
|
8
7
|
|
9
8
|
declare namespace ContextMenuPlugin {
|
@@ -2,8 +2,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
2
2
|
import Ext from "../../tr-grid-util/es6/Ext.js";
|
3
3
|
import MenuEventAPI from "./MenuEventAPI.js";
|
4
4
|
import PopupMenu from "./PopupMenu.js";
|
5
|
-
import {
|
6
|
-
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
5
|
+
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
6
|
import CellPainter from "../../tr-grid-util/es6/CellPainter.js";
|
8
7
|
|
9
8
|
/** @typedef {"header" | "content" | "footer" | "filterRow"} ContextMenuPlugin~Context
|
@@ -78,7 +77,6 @@ var ContextMenuPlugin = function (options) {
|
|
78
77
|
|
79
78
|
t._onItemClicked = t._onItemClicked.bind(t);
|
80
79
|
t._rightClickedHandler = t._rightClickedHandler.bind(t);
|
81
|
-
t._onThemeLoaded = t._onThemeLoaded.bind(t);
|
82
80
|
|
83
81
|
t.config({ "contextMenu": options });
|
84
82
|
};
|
@@ -93,14 +91,7 @@ ContextMenuPlugin.prototype._contextMap = {
|
|
93
91
|
"footer": "footer",
|
94
92
|
"filterRow": "filterRow"
|
95
93
|
};
|
96
|
-
|
97
|
-
* @private
|
98
|
-
*/
|
99
|
-
ContextMenuPlugin._styles = ""; // Static variable
|
100
|
-
/** @type {Promise<Object>}
|
101
|
-
* @private
|
102
|
-
*/
|
103
|
-
ContextMenuPlugin._stylePromise = null; // Static variable
|
94
|
+
|
104
95
|
/** @type {boolean}
|
105
96
|
* @private
|
106
97
|
*/
|
@@ -130,6 +121,102 @@ ContextMenuPlugin.prototype._rsp = null;
|
|
130
121
|
*/
|
131
122
|
ContextMenuPlugin.prototype._contextMenu = null;
|
132
123
|
|
124
|
+
/** @private
|
125
|
+
* @param {Object} colors
|
126
|
+
* @return {string}
|
127
|
+
*/
|
128
|
+
ContextMenuPlugin._styleCalculator = function (colors) {
|
129
|
+
var css = prettifyCss([
|
130
|
+
".tr-contextmenu", [
|
131
|
+
"outline: none;",
|
132
|
+
"box-sizing: border-box;",
|
133
|
+
"-moz-box-sizing: border-box;",
|
134
|
+
"border-style: solid;",
|
135
|
+
"border-width: 1px;",
|
136
|
+
"overflow: hidden;",
|
137
|
+
"padding: 1px;",
|
138
|
+
"margin: 0;",
|
139
|
+
"user-select: none;",
|
140
|
+
"list-style-type: none;",
|
141
|
+
"background-color: backgroundColor;",
|
142
|
+
"color: fontColor;",
|
143
|
+
"border-color: borderColor;"
|
144
|
+
],
|
145
|
+
".tr-contextmenu-item", [
|
146
|
+
"list-style: none;",
|
147
|
+
"padding: 3px 7px;",
|
148
|
+
"margin: 0;",
|
149
|
+
"vertical-align: middle;",
|
150
|
+
"white-space: nowrap;",
|
151
|
+
"cursor: pointer;",
|
152
|
+
"line-height: 20px;"
|
153
|
+
],
|
154
|
+
".tr-contextmenu-item[disabled]", [
|
155
|
+
"color: disabledColor;",
|
156
|
+
"cursor: default;"
|
157
|
+
],
|
158
|
+
".tr-contextmenu-item", [
|
159
|
+
"padding-right: 20px;"
|
160
|
+
],
|
161
|
+
".tr-contextmenu-item:hover:not([disabled])", [
|
162
|
+
"background-color: hoveredColor;"
|
163
|
+
],
|
164
|
+
".tr-contextmenu-popup", [
|
165
|
+
"box-shadow: 0 0 10px rgba(0,0,0,0.5);",
|
166
|
+
"z-index: 10;"
|
167
|
+
],
|
168
|
+
".tr-contextmenu-item.has-child", [
|
169
|
+
"position: relative;"
|
170
|
+
],
|
171
|
+
".tr-contextmenu-item.has-child:after", [
|
172
|
+
"box-sizing: border-box;",
|
173
|
+
"-moz-box-sizing: border-box;",
|
174
|
+
"display: inline-block;",
|
175
|
+
"width: 7px;",
|
176
|
+
"height: 7px;",
|
177
|
+
"border-style: solid;",
|
178
|
+
"border-width: 1px;",
|
179
|
+
"content: \"\";",
|
180
|
+
"-webkit-transform: rotate(45deg);",
|
181
|
+
"transform: rotate(45deg);",
|
182
|
+
"border-left-width: 0;",
|
183
|
+
"border-bottom-width: 0;",
|
184
|
+
"position: absolute;",
|
185
|
+
"right: 8px;",
|
186
|
+
"top: -webkit-calc(50% - 4px);",
|
187
|
+
"top: -moz-calc(50% - 4px);",
|
188
|
+
"top: calc(50% - 4px);",
|
189
|
+
"border-color: fontColor;"
|
190
|
+
],
|
191
|
+
".tr-contextmenu-item[data-type=\"separator\"]", [
|
192
|
+
"padding: 0;",
|
193
|
+
"border: none;",
|
194
|
+
"border-bottom-style: solid;",
|
195
|
+
"border-bottom-width: 1px;",
|
196
|
+
"border-bottom-color: disabledColor;"
|
197
|
+
]
|
198
|
+
]);
|
199
|
+
|
200
|
+
var hex = CellPainter.rgb2Hex(colors.tableBg);
|
201
|
+
var triplet = CellPainter.hex2Num(hex);
|
202
|
+
var bw = CellPainter.blackAndWhite(triplet);
|
203
|
+
var blendRatio;
|
204
|
+
if (bw === "#000000") { // Light theme
|
205
|
+
blendRatio = 0.1;
|
206
|
+
css = css.replace(/disabledColor/g, "lightgrey");
|
207
|
+
} else { // Dark theme
|
208
|
+
blendRatio = 0.2;
|
209
|
+
css = css.replace(/disabledColor/g, "gray");
|
210
|
+
}
|
211
|
+
var hoverd = CellPainter.num2Hex(CellPainter.blendColor(hex, bw, blendRatio));
|
212
|
+
css = css.replace(/hoveredColor/g, hoverd);
|
213
|
+
css = css.replace(/backgroundColor/g, colors.tableBg);
|
214
|
+
css = css.replace(/fontColor/g, colors.tableText);
|
215
|
+
css = css.replace(/borderColor/g, colors.tableBorder);
|
216
|
+
|
217
|
+
return css;
|
218
|
+
};
|
219
|
+
|
133
220
|
/** @public
|
134
221
|
* @return {string}
|
135
222
|
*/
|
@@ -151,14 +238,7 @@ ContextMenuPlugin.prototype.initialize = function (host, options) {
|
|
151
238
|
|
152
239
|
t.config(options);
|
153
240
|
|
154
|
-
|
155
|
-
ContextMenuPlugin._applyThemeColor(host);
|
156
|
-
} else { // Theme has NOT been loaded. Wait for the theme to be loaded
|
157
|
-
if(!ContextMenuPlugin._stylePromise) {
|
158
|
-
ContextMenuPlugin._stylePromise = ElfUtil.getThemeColors();
|
159
|
-
}
|
160
|
-
ContextMenuPlugin._stylePromise.then(t._onThemeLoaded).catch(t._onThemeLoaded);
|
161
|
-
}
|
241
|
+
t.applyStaticStyles(ContextMenuPlugin._styleCalculator);
|
162
242
|
};
|
163
243
|
|
164
244
|
/** @public
|
@@ -356,119 +436,6 @@ ContextMenuPlugin.prototype._onItemClicked = function (e) {
|
|
356
436
|
}
|
357
437
|
};
|
358
438
|
|
359
|
-
/** @private
|
360
|
-
*/
|
361
|
-
ContextMenuPlugin.prototype._onThemeLoaded = function () {
|
362
|
-
if(!ContextMenuPlugin._styles) { // Theme can be loaded only once
|
363
|
-
var colors = ElfUtil.getColors();
|
364
|
-
var css = prettifyCss([
|
365
|
-
".tr-contextmenu", [
|
366
|
-
"outline: none;",
|
367
|
-
"box-sizing: border-box;",
|
368
|
-
"-moz-box-sizing: border-box;",
|
369
|
-
"border-style: solid;",
|
370
|
-
"border-width: 1px;",
|
371
|
-
"overflow: hidden;",
|
372
|
-
"padding: 1px;",
|
373
|
-
"margin: 0;",
|
374
|
-
"user-select: none;",
|
375
|
-
"list-style-type: none;",
|
376
|
-
"background-color: backgroundColor;",
|
377
|
-
"color: fontColor;",
|
378
|
-
"border-color: borderColor;"
|
379
|
-
],
|
380
|
-
".tr-contextmenu-item", [
|
381
|
-
"list-style: none;",
|
382
|
-
"padding: 3px 7px;",
|
383
|
-
"margin: 0;",
|
384
|
-
"vertical-align: middle;",
|
385
|
-
"white-space: nowrap;",
|
386
|
-
"cursor: pointer;",
|
387
|
-
"line-height: 20px;"
|
388
|
-
],
|
389
|
-
".tr-contextmenu-item[disabled]", [
|
390
|
-
"color: disabledColor;",
|
391
|
-
"cursor: default;"
|
392
|
-
],
|
393
|
-
".tr-contextmenu-item", [
|
394
|
-
"padding-right: 20px;"
|
395
|
-
],
|
396
|
-
".tr-contextmenu-item:hover:not([disabled])", [
|
397
|
-
"background-color: hoveredColor;"
|
398
|
-
],
|
399
|
-
".tr-contextmenu-popup", [
|
400
|
-
"box-shadow: 0 0 10px rgba(0,0,0,0.5);",
|
401
|
-
"z-index: 10;"
|
402
|
-
],
|
403
|
-
".tr-contextmenu-item.has-child", [
|
404
|
-
"position: relative;"
|
405
|
-
],
|
406
|
-
".tr-contextmenu-item.has-child:after", [
|
407
|
-
"box-sizing: border-box;",
|
408
|
-
"-moz-box-sizing: border-box;",
|
409
|
-
"display: inline-block;",
|
410
|
-
"width: 7px;",
|
411
|
-
"height: 7px;",
|
412
|
-
"border-style: solid;",
|
413
|
-
"border-width: 1px;",
|
414
|
-
"content: \"\";",
|
415
|
-
"-webkit-transform: rotate(45deg);",
|
416
|
-
"transform: rotate(45deg);",
|
417
|
-
"border-left-width: 0;",
|
418
|
-
"border-bottom-width: 0;",
|
419
|
-
"position: absolute;",
|
420
|
-
"right: 8px;",
|
421
|
-
"top: -webkit-calc(50% - 4px);",
|
422
|
-
"top: -moz-calc(50% - 4px);",
|
423
|
-
"top: calc(50% - 4px);",
|
424
|
-
"border-color: fontColor;"
|
425
|
-
],
|
426
|
-
".tr-contextmenu-item[data-type=\"separator\"]", [
|
427
|
-
"padding: 0;",
|
428
|
-
"border: none;",
|
429
|
-
"border-bottom-style: solid;",
|
430
|
-
"border-bottom-width: 1px;",
|
431
|
-
"border-bottom-color: disabledColor;"
|
432
|
-
]
|
433
|
-
]);
|
434
|
-
|
435
|
-
var hex = CellPainter.rgb2Hex(colors.tableBg);
|
436
|
-
var triplet = CellPainter.hex2Num(hex);
|
437
|
-
var bw = CellPainter.blackAndWhite(triplet);
|
438
|
-
var blendRatio;
|
439
|
-
if (bw === "#000000") { // Light theme
|
440
|
-
blendRatio = 0.1;
|
441
|
-
css = css.replace(/disabledColor/g, "lightgrey");
|
442
|
-
} else { // Dark theme
|
443
|
-
blendRatio = 0.2;
|
444
|
-
css = css.replace(/disabledColor/g, "gray");
|
445
|
-
}
|
446
|
-
var hoverd = CellPainter.num2Hex(CellPainter.blendColor(hex, bw, blendRatio));
|
447
|
-
css = css.replace(/hoveredColor/g, hoverd);
|
448
|
-
css = css.replace(/backgroundColor/g, colors.tableBg);
|
449
|
-
css = css.replace(/fontColor/g, colors.tableText);
|
450
|
-
css = css.replace(/borderColor/g, colors.tableBorder);
|
451
|
-
|
452
|
-
ContextMenuPlugin._styles = css;
|
453
|
-
}
|
454
|
-
|
455
|
-
for(var i = this._hosts.length; --i >= 0;) {
|
456
|
-
ContextMenuPlugin._applyThemeColor(this._hosts[i]);
|
457
|
-
}
|
458
|
-
};
|
459
|
-
/** @private
|
460
|
-
* @param {Object} grid core grid object
|
461
|
-
*/
|
462
|
-
ContextMenuPlugin._applyThemeColor = function(grid) {
|
463
|
-
if(!grid || grid._contextMenuStyles) {
|
464
|
-
return;
|
465
|
-
}
|
466
|
-
if(ContextMenuPlugin._styles) {
|
467
|
-
grid._contextMenuStyles = true; // Prevent loading the same style twice
|
468
|
-
injectCss(ContextMenuPlugin._styles, grid.getElement());
|
469
|
-
}
|
470
|
-
};
|
471
|
-
|
472
439
|
|
473
440
|
|
474
441
|
export default ContextMenuPlugin;
|
@@ -87,6 +87,8 @@ declare class RowGroupingPlugin extends GridPlugin {
|
|
87
87
|
|
88
88
|
public setDefaultCollapse(collapse: boolean): void;
|
89
89
|
|
90
|
+
public setGroupColor(groupRef: string, groupColor: string): void;
|
91
|
+
|
90
92
|
public getDefaultCollapse(): boolean;
|
91
93
|
|
92
94
|
public sortGroups(): void;
|
@@ -111,6 +113,8 @@ declare class RowGroupingPlugin extends GridPlugin {
|
|
111
113
|
|
112
114
|
public enableFooterRow(opt_num?: (boolean|number)|null): void;
|
113
115
|
|
116
|
+
public getFooterRowCount(): number;
|
117
|
+
|
114
118
|
}
|
115
119
|
|
116
120
|
declare function isNonFunction(obj: any): boolean;
|
@@ -25,7 +25,7 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
25
25
|
* @property {(boolean|number|Array.<number>)=} indentSize Use array to define indent for each group level. Use boolean to turn on or off indentation. Use number to define incremental step.
|
26
26
|
* @property {boolean=} colorTag If not specified, the color tag will be disabled when using extension without halo theme.
|
27
27
|
* @property {Object=} predefinedColors Predefined color object map for color tag
|
28
|
-
* @property {Object=} groupColors
|
28
|
+
* @property {Object=} groupColors - Deprecated, the object map of group ID and predefined color.
|
29
29
|
* @property {boolean=} defaultCollapse=false Collapsing groups by default when a group is created
|
30
30
|
* @property {Function=} clicked=null Event handler when user clicks on arrows or cells
|
31
31
|
* @property {Function=} groupAdded=null Event handler
|
@@ -650,7 +650,7 @@ RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
650
650
|
extOptions.headerSpanning = this._headerSpanning;
|
651
651
|
}
|
652
652
|
if(this._footerSpanning) {
|
653
|
-
extOptions.
|
653
|
+
extOptions.footerSpanning = this._footerSpanning;
|
654
654
|
}
|
655
655
|
if(this._autoGroupSorting) {
|
656
656
|
extOptions.autoGroupSorting = this._autoGroupSorting;
|
@@ -1012,6 +1012,25 @@ RowGroupingPlugin.prototype.setDefaultCollapse = function(collapse) {
|
|
1012
1012
|
}
|
1013
1013
|
};
|
1014
1014
|
|
1015
|
+
/** @public
|
1016
|
+
* @param {string} groupRef
|
1017
|
+
* @param {string} groupColor color name from predefinedColors
|
1018
|
+
*/
|
1019
|
+
RowGroupingPlugin.prototype.setGroupColor = function(groupRef, groupColor) {
|
1020
|
+
var dv = this.getDataView();
|
1021
|
+
if(!dv) {
|
1022
|
+
return;
|
1023
|
+
}
|
1024
|
+
var grp = dv.getGroup(groupRef);
|
1025
|
+
if(grp) {
|
1026
|
+
grp.setGroupColor(groupColor);
|
1027
|
+
var host = this._hosts[0];
|
1028
|
+
if(host) {
|
1029
|
+
host.requestRowRefresh();
|
1030
|
+
}
|
1031
|
+
}
|
1032
|
+
};
|
1033
|
+
|
1015
1034
|
/** @public
|
1016
1035
|
* @return {boolean}
|
1017
1036
|
*/
|
@@ -1165,8 +1184,25 @@ RowGroupingPlugin.prototype._onGroupAdded = function (e) {
|
|
1165
1184
|
if (this._footerRows) {
|
1166
1185
|
e.newGroup.addFooter(this._footerRows);
|
1167
1186
|
}
|
1168
|
-
|
1187
|
+
var newGroup = e.newGroup;
|
1188
|
+
// WARNING: contentAsHeader mode is overwrite arrow hidden to boolean
|
1189
|
+
if(!this._contentAsHeader && newGroup.disableCollapsing) {
|
1190
|
+
if(this._isArrowHidden(newGroup)) {
|
1191
|
+
newGroup.disableCollapsing();
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
var groupColors = this._groupColors;
|
1196
|
+
var groupColor;
|
1197
|
+
if(groupColors) { // Backward compatibility
|
1198
|
+
var groupId = newGroup.getGroupId();
|
1199
|
+
groupColor = groupColors[groupId];
|
1200
|
+
if(groupColor) {
|
1201
|
+
newGroup.setGroupColor(groupColor);
|
1202
|
+
}
|
1203
|
+
}
|
1169
1204
|
|
1205
|
+
this._dispatch("groupAdded", e);
|
1170
1206
|
if (this._autoGroupSorting) {
|
1171
1207
|
if (!this._sortingTimer) {
|
1172
1208
|
this._sortingTimer = setTimeout(this.sortGroups, 100);
|
@@ -1380,20 +1416,9 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1380
1416
|
indentSize = maxColWidth;
|
1381
1417
|
}
|
1382
1418
|
|
1419
|
+
var groupColor = currentGroup.getGroupColor();
|
1420
|
+
arg.colorTagClass = groupColor;
|
1383
1421
|
arg.indentSize = indentSize;
|
1384
|
-
|
1385
|
-
if (this._groupColors) {
|
1386
|
-
// TODO: Need better method to find the first level parent's group id
|
1387
|
-
var rootGroup = currentGroup ? currentGroup : dataSource.getGroup(rowId); // Slow
|
1388
|
-
if (curGroupLevel > 1) {
|
1389
|
-
for (var i = curGroupLevel; i > 1; i--) {
|
1390
|
-
rootGroup = rootGroup.getDataSource();
|
1391
|
-
}
|
1392
|
-
}
|
1393
|
-
var groupId = rootGroup.getGroupId();
|
1394
|
-
arg.colorTagClass = this._groupColors[groupId];
|
1395
|
-
}
|
1396
|
-
|
1397
1422
|
if (groupView) {
|
1398
1423
|
rowPainter.applyHeaderStyle(arg);
|
1399
1424
|
this._dispatch(footerRow ? "groupFooterBinding" : "groupHeaderBinding", arg);
|
@@ -1502,6 +1527,9 @@ RowGroupingPlugin.prototype._onCellClicked = function (e) {
|
|
1502
1527
|
var grpView = dv.getGroupByRowId(rowId);
|
1503
1528
|
if (grpView) {
|
1504
1529
|
changed = true;
|
1530
|
+
if(grpView.isCollapsible && !grpView.isCollapsible()) { // Prevent applied styles
|
1531
|
+
return;
|
1532
|
+
}
|
1505
1533
|
grpView.collapse(!collapsed);
|
1506
1534
|
} else if (this._contentAsHeader) {
|
1507
1535
|
changed = true;
|
@@ -1656,6 +1684,13 @@ RowGroupingPlugin.prototype.enableFooterRow = function (opt_num) {
|
|
1656
1684
|
this._footerRows = /** @type{number} */(opt_num);
|
1657
1685
|
};
|
1658
1686
|
|
1687
|
+
/** @public
|
1688
|
+
* @return {number}
|
1689
|
+
*/
|
1690
|
+
RowGroupingPlugin.prototype.getFooterRowCount = function () {
|
1691
|
+
return this._footerRows;
|
1692
|
+
};
|
1693
|
+
|
1659
1694
|
/** @function
|
1660
1695
|
* @param {Object} obj
|
1661
1696
|
* @return {boolean}
|
@@ -3,8 +3,7 @@ import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
|
|
3
3
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
4
4
|
import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
|
5
5
|
import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
|
6
|
-
import {
|
7
|
-
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
+
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
8
7
|
|
9
8
|
declare namespace RowSelectionPlugin {
|
10
9
|
|