@refinitiv-ui/efx-grid 6.0.91 → 6.0.93
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/column-dragging/es6/ColumnDragging.d.ts +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/filter-dialog/lib/filter-dialog.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -32
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-util/es6/CellPainter.js +94 -104
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +41 -41
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +14 -3
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -58
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -87
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +71 -80
- package/lib/tr-grid-util/es6/NumberFormatter.js +23 -23
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +52 -52
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +12 -12
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
@@ -2,7 +2,7 @@ import { cloneObject } from "./Util.js";
|
|
2
2
|
|
3
3
|
/** @constructor
|
4
4
|
*/
|
5
|
-
|
5
|
+
let GroupDefinitions = function () {
|
6
6
|
this._groupMap = {};
|
7
7
|
this._childToParent = {};
|
8
8
|
};
|
@@ -36,14 +36,14 @@ GroupDefinitions.getGroupId = function(groupDef) {
|
|
36
36
|
* @return {number} Return total number of parents. Return 0 if there is no parent.
|
37
37
|
*/
|
38
38
|
GroupDefinitions.calcTreeDepth = function (groupMap, groupDef) {
|
39
|
-
|
40
|
-
|
39
|
+
let curDepth = -1;
|
40
|
+
let curNode = groupDef;
|
41
41
|
while(curNode) { // WARNING: infinite loop could occured, if parentId is cycle back to one of the child group
|
42
42
|
if(++curDepth > 15) {
|
43
43
|
console.log("WARNING: Infinite loop detected during column group creation");
|
44
44
|
break;
|
45
45
|
}
|
46
|
-
|
46
|
+
let parentId = curNode.parentId;
|
47
47
|
curNode = groupMap[parentId];
|
48
48
|
}
|
49
49
|
return curDepth;
|
@@ -54,22 +54,22 @@ GroupDefinitions.calcTreeDepth = function (groupMap, groupDef) {
|
|
54
54
|
* @return {Array.<string>}
|
55
55
|
*/
|
56
56
|
GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
|
57
|
-
|
57
|
+
let groupDef = groupMap[groupId];
|
58
58
|
if(!groupDef) {
|
59
59
|
return null;
|
60
60
|
}
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
let leaves = [];
|
63
|
+
let unvisitedGroups = [groupDef];
|
64
|
+
let visitedCount = 0;
|
65
|
+
let visitedMap = {};
|
66
66
|
while(visitedCount < unvisitedGroups.length) {
|
67
67
|
groupDef = unvisitedGroups[visitedCount++];
|
68
68
|
visitedMap[groupDef.id] = true;
|
69
|
-
|
70
|
-
|
71
|
-
for(
|
72
|
-
|
69
|
+
let chdr = groupDef.children;
|
70
|
+
let len = chdr ? chdr.length : 0;
|
71
|
+
for(let i = 0; i < len; ++i) {
|
72
|
+
let childId = chdr[i];
|
73
73
|
groupDef = groupMap[childId];
|
74
74
|
if(groupDef) {
|
75
75
|
if(!visitedMap[groupDef.id]) { // Prevent infinite loop
|
@@ -90,7 +90,7 @@ GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
|
|
90
90
|
* @return {Object} Return a new object with guaranteed children property
|
91
91
|
*/
|
92
92
|
GroupDefinitions._cloneObject = function(obj) {
|
93
|
-
|
93
|
+
let newObj = cloneObject(obj);
|
94
94
|
if(Array.isArray(newObj.children)) { // This is to prevent modification from the outside source
|
95
95
|
newObj.children = newObj.children.slice();
|
96
96
|
} else {
|
@@ -106,7 +106,7 @@ GroupDefinitions._cloneObject = function(obj) {
|
|
106
106
|
* @return {Object} Return a new object with guaranteed children property
|
107
107
|
*/
|
108
108
|
GroupDefinitions._toGroupDefinition = function(obj, groupId) {
|
109
|
-
|
109
|
+
let groupDef = null;
|
110
110
|
if(obj) {
|
111
111
|
if(Array.isArray(obj)) {
|
112
112
|
groupDef = {
|
@@ -129,11 +129,11 @@ GroupDefinitions._toGroupDefinition = function(obj, groupId) {
|
|
129
129
|
* @return {string}
|
130
130
|
*/
|
131
131
|
GroupDefinitions.prototype.toString = function() {
|
132
|
-
|
133
|
-
|
132
|
+
let groupMap = this._groupMap;
|
133
|
+
let lines = [];
|
134
134
|
lines.push("=== groupDefs ===");
|
135
|
-
for(
|
136
|
-
|
135
|
+
for(let key in groupMap) {
|
136
|
+
let group = groupMap[key];
|
137
137
|
lines.push(key + ": " + JSON.stringify(group, ["id", "parentId", "children"]));
|
138
138
|
}
|
139
139
|
|
@@ -166,9 +166,9 @@ GroupDefinitions.prototype.getDefinition = GroupDefinitions.prototype.getGroup;
|
|
166
166
|
* @return {!Array.<Object>}
|
167
167
|
*/
|
168
168
|
GroupDefinitions.prototype.getGroups = function () {
|
169
|
-
|
170
|
-
|
171
|
-
for(
|
169
|
+
let groupDefs = [];
|
170
|
+
let groupMap = this._groupMap;
|
171
|
+
for(let key in groupMap) {
|
172
172
|
groupDefs.push(groupMap[key]);
|
173
173
|
}
|
174
174
|
return groupDefs;
|
@@ -190,11 +190,11 @@ GroupDefinitions.prototype.getGroupMap = function () {
|
|
190
190
|
* @return {!Object.<string, Object>}
|
191
191
|
*/
|
192
192
|
GroupDefinitions.prototype.cloneGroupMap = function () {
|
193
|
-
|
194
|
-
|
195
|
-
for(
|
196
|
-
|
197
|
-
|
193
|
+
let groupMap = this._groupMap;
|
194
|
+
let outMap = {};
|
195
|
+
for(let groupId in groupMap) {
|
196
|
+
let groupDef = groupMap[groupId];
|
197
|
+
let obj = GroupDefinitions._cloneObject(groupDef);
|
198
198
|
outMap[groupId] = obj;
|
199
199
|
}
|
200
200
|
return outMap;
|
@@ -203,18 +203,18 @@ GroupDefinitions.prototype.cloneGroupMap = function () {
|
|
203
203
|
* @public
|
204
204
|
*/
|
205
205
|
GroupDefinitions.prototype.rebuildMap = function () {
|
206
|
-
|
207
|
-
|
206
|
+
let groupMap = this._groupMap;
|
207
|
+
let childToParent = this._childToParent = {};
|
208
208
|
|
209
209
|
// Create child to parent map
|
210
|
-
|
211
|
-
|
212
|
-
|
210
|
+
let groupIds = Object.keys(groupMap);
|
211
|
+
let grpCount = groupIds.length;
|
212
|
+
let i, groupId;
|
213
213
|
for(i = 0; i < grpCount; ++i) {
|
214
214
|
groupId = groupIds[i];
|
215
|
-
|
216
|
-
|
217
|
-
for (
|
215
|
+
let chdr = groupMap[groupId].children;
|
216
|
+
let childCount = chdr ? chdr.length : 0;
|
217
|
+
for (let j = 0; j < childCount; j++) {
|
218
218
|
childToParent[chdr[j]] = groupId;
|
219
219
|
}
|
220
220
|
}
|
@@ -222,7 +222,7 @@ GroupDefinitions.prototype.rebuildMap = function () {
|
|
222
222
|
// Apply a parent id to group definition to make it easier to find depth
|
223
223
|
for(i = 0; i < grpCount; ++i) {
|
224
224
|
groupId = groupIds[i];
|
225
|
-
|
225
|
+
let parentId = childToParent[groupId];
|
226
226
|
if(parentId) {
|
227
227
|
groupMap[groupId].parentId = parentId;
|
228
228
|
}
|
@@ -235,7 +235,7 @@ GroupDefinitions.prototype.rebuildMap = function () {
|
|
235
235
|
* @return {Array.<string>}
|
236
236
|
*/
|
237
237
|
GroupDefinitions.prototype.getGroupChildren = function (groupId) {
|
238
|
-
|
238
|
+
let groupDef = this._groupMap[groupId];
|
239
239
|
return groupDef ? groupDef.children : null;
|
240
240
|
};
|
241
241
|
/** Get all non-group descendants of the given group id.
|
@@ -261,12 +261,12 @@ GroupDefinitions.prototype.getRootGroup = function (groupId) {
|
|
261
261
|
if (!groupId) {
|
262
262
|
return null;
|
263
263
|
}
|
264
|
-
|
265
|
-
|
264
|
+
let groupMap = this._groupMap;
|
265
|
+
let groupDef = groupMap[groupId] || null;
|
266
266
|
// TODO: Support column id
|
267
267
|
if(groupDef) {
|
268
268
|
while (groupDef.parentId) {
|
269
|
-
|
269
|
+
let parentDef = groupMap[groupDef.parentId];
|
270
270
|
if(parentDef) {
|
271
271
|
groupDef = parentDef;
|
272
272
|
} else {
|
@@ -289,10 +289,10 @@ GroupDefinitions.prototype.getParentGroup = function (childId) {
|
|
289
289
|
*/
|
290
290
|
GroupDefinitions.prototype.getParentIds = function(childId) {
|
291
291
|
if (childId && typeof childId === "string") {
|
292
|
-
|
292
|
+
let groupId = this._childToParent[childId];
|
293
293
|
if (groupId) {
|
294
|
-
|
295
|
-
|
294
|
+
let groupIds = [groupId];
|
295
|
+
let group = this._groupMap[groupId];
|
296
296
|
while (group && group.parentId) {
|
297
297
|
group = this._groupMap[group.parentId];
|
298
298
|
if (group) {
|
@@ -310,9 +310,9 @@ GroupDefinitions.prototype.getParentIds = function(childId) {
|
|
310
310
|
* @return {string}
|
311
311
|
*/
|
312
312
|
GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
|
313
|
-
|
313
|
+
let parentId = this._childToParent[childId];
|
314
314
|
if(groupLevel != null) {
|
315
|
-
|
315
|
+
let currentLevel = this.getGroupLevel(parentId);
|
316
316
|
while(currentLevel > groupLevel && parentId){
|
317
317
|
parentId = this._childToParent[parentId];
|
318
318
|
currentLevel--;
|
@@ -327,7 +327,7 @@ GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
|
|
327
327
|
* @return {boolean}
|
328
328
|
*/
|
329
329
|
GroupDefinitions.prototype.removeAllGroups = function () {
|
330
|
-
for(
|
330
|
+
for(let groupId in this._groupMap) { // eslint-disable-line
|
331
331
|
this._groupMap = {};
|
332
332
|
this._childToParent = {};
|
333
333
|
return true;
|
@@ -340,13 +340,13 @@ GroupDefinitions.prototype.removeAllGroups = function () {
|
|
340
340
|
*/
|
341
341
|
GroupDefinitions.prototype.setGroups = function (groupDefs) {
|
342
342
|
// Clear existing group structure
|
343
|
-
|
343
|
+
let groupMap = this._groupMap = {};
|
344
344
|
|
345
345
|
// Create group map
|
346
|
-
|
347
|
-
for (
|
348
|
-
|
349
|
-
|
346
|
+
let grpCount = groupDefs ? groupDefs.length : 0;
|
347
|
+
for (let i = 0; i < grpCount; i++) {
|
348
|
+
let groupDef = groupDefs[i];
|
349
|
+
let groupId = groupDef.id;
|
350
350
|
if(groupId) {
|
351
351
|
groupMap[groupId] = GroupDefinitions._cloneObject(groupDef);
|
352
352
|
}
|
@@ -360,7 +360,7 @@ GroupDefinitions.prototype.setGroups = function (groupDefs) {
|
|
360
360
|
* @return {string} Return group ID
|
361
361
|
*/
|
362
362
|
GroupDefinitions.prototype.addGroup = function (groupDef) {
|
363
|
-
|
363
|
+
let groupId = GroupDefinitions.getGroupId(groupDef);
|
364
364
|
if(groupId) {
|
365
365
|
return this.setGroup(groupId, groupDef);
|
366
366
|
}
|
@@ -371,7 +371,7 @@ GroupDefinitions.prototype.addGroup = function (groupDef) {
|
|
371
371
|
* @return {boolean}
|
372
372
|
*/
|
373
373
|
GroupDefinitions.prototype.removeGroup = function (groupId) {
|
374
|
-
|
374
|
+
let curDef = this._groupMap[groupId];
|
375
375
|
if(curDef) {
|
376
376
|
this.removeAllChildren(groupId);
|
377
377
|
this.unsetParent(groupId);
|
@@ -393,25 +393,25 @@ GroupDefinitions.prototype.setGroup = function (groupId, groupDef) {
|
|
393
393
|
}
|
394
394
|
|
395
395
|
if(groupDef) {
|
396
|
-
|
396
|
+
let newDef = GroupDefinitions._toGroupDefinition(groupDef, groupId);
|
397
397
|
this._ungroupChildren(newDef.children);
|
398
398
|
|
399
|
-
|
399
|
+
let curDef = this._groupMap[groupId];
|
400
400
|
if(curDef) { // Replace
|
401
401
|
this.removeAllChildren(groupId);
|
402
402
|
}
|
403
|
-
|
403
|
+
let parentDef = this._childToParent[groupId];
|
404
404
|
if(parentDef) {
|
405
405
|
newDef.parentId = parentDef.id;
|
406
406
|
}
|
407
407
|
this._groupMap[groupId] = newDef;
|
408
408
|
|
409
|
-
|
410
|
-
|
411
|
-
for(
|
412
|
-
|
409
|
+
let chdr = newDef.children; // newDef is guaranteed to have children property
|
410
|
+
let len = chdr.length;
|
411
|
+
for(let i = 0; i < len; ++i) {
|
412
|
+
let childId = chdr[i];
|
413
413
|
this._childToParent[childId] = groupId;
|
414
|
-
|
414
|
+
let childDef = this._groupMap[childId];
|
415
415
|
if(childDef) {
|
416
416
|
childDef.parentId = groupId;
|
417
417
|
}
|
@@ -431,8 +431,8 @@ GroupDefinitions.prototype.setGroup = function (groupId, groupDef) {
|
|
431
431
|
*/
|
432
432
|
GroupDefinitions.prototype._ungroupChildren = function(children) {
|
433
433
|
if (Array.isArray(children)) {
|
434
|
-
|
435
|
-
for(
|
434
|
+
let len = children.length;
|
435
|
+
for(let i = 0; i < len; ++i) {
|
436
436
|
this.unsetParent(children[i]);
|
437
437
|
}
|
438
438
|
}
|
@@ -445,9 +445,9 @@ GroupDefinitions.prototype._ungroupChildren = function(children) {
|
|
445
445
|
* @return {boolean}
|
446
446
|
*/
|
447
447
|
GroupDefinitions.prototype.hasGroupChild = function (parentId, childId) {
|
448
|
-
|
448
|
+
let groupDef = this._groupMap[parentId];
|
449
449
|
if(childId && groupDef) {
|
450
|
-
|
450
|
+
let chdr = groupDef.children;
|
451
451
|
if(chdr) {
|
452
452
|
return chdr.indexOf(childId) >= 0; // TODO: Use childToParent map to improve performance
|
453
453
|
}
|
@@ -465,8 +465,8 @@ GroupDefinitions.prototype.contains = function (groupId, childId) {
|
|
465
465
|
if(groupId === childId) {
|
466
466
|
return true;
|
467
467
|
}
|
468
|
-
|
469
|
-
|
468
|
+
let levelLimit = 20;
|
469
|
+
let parentId = this._childToParent[childId];
|
470
470
|
while(parentId && levelLimit) { // WARNING: Circular dependency could happen
|
471
471
|
if(groupId === parentId) {
|
472
472
|
return true;
|
@@ -484,15 +484,15 @@ GroupDefinitions.prototype.contains = function (groupId, childId) {
|
|
484
484
|
* @return {boolean}
|
485
485
|
*/
|
486
486
|
GroupDefinitions.prototype.addGroupChild = function (parentId, childId, position) {
|
487
|
-
|
487
|
+
let groupDef = this._groupMap[parentId];
|
488
488
|
|
489
489
|
if(childId && groupDef) {
|
490
|
-
|
490
|
+
let chdr = groupDef.children;
|
491
491
|
if(chdr && chdr.indexOf(childId) < 0) {
|
492
492
|
this.unsetParent(childId); // Remove previous parent
|
493
493
|
// Add new child to group structures
|
494
494
|
this._childToParent[childId] = parentId;
|
495
|
-
|
495
|
+
let childDef = this._groupMap[childId];
|
496
496
|
if(childDef) {
|
497
497
|
childDef.parentId = parentId;
|
498
498
|
}
|
@@ -527,20 +527,20 @@ GroupDefinitions.prototype.removeGroupChild = function (parentId, childId) {
|
|
527
527
|
* @return {boolean}
|
528
528
|
*/
|
529
529
|
GroupDefinitions.prototype.unsetParent = function (childId) {
|
530
|
-
|
530
|
+
let parentId = this._childToParent[childId];
|
531
531
|
if(!parentId) {
|
532
532
|
return false;
|
533
533
|
}
|
534
534
|
this._childToParent[childId] = "";
|
535
|
-
|
535
|
+
let childDef = this._groupMap[childId];
|
536
536
|
if(childDef) {
|
537
537
|
childDef.parentId = "";
|
538
538
|
}
|
539
|
-
|
539
|
+
let parentDef = this._groupMap[parentId];
|
540
540
|
if(parentDef) {
|
541
|
-
|
541
|
+
let chdr = parentDef.children;
|
542
542
|
if(chdr && chdr.length) {
|
543
|
-
|
543
|
+
let at = chdr.indexOf(childId);
|
544
544
|
if (at >= 0) {
|
545
545
|
chdr.splice(at, 1); // splice is slow
|
546
546
|
}
|
@@ -554,18 +554,18 @@ GroupDefinitions.prototype.unsetParent = function (childId) {
|
|
554
554
|
* @return {boolean}
|
555
555
|
*/
|
556
556
|
GroupDefinitions.prototype.removeAllChildren = function(groupId) {
|
557
|
-
|
557
|
+
let grpDef = this._groupMap[groupId];
|
558
558
|
if(grpDef) {
|
559
|
-
|
560
|
-
|
559
|
+
let chdr = grpDef.children;
|
560
|
+
let len = chdr ? chdr.length : 0;
|
561
561
|
if(len) {
|
562
562
|
grpDef.children = [];
|
563
|
-
for(
|
564
|
-
|
563
|
+
for(let i = 0; i < len; ++i) {
|
564
|
+
let childId = chdr[i];
|
565
565
|
if(this._childToParent[childId]) {
|
566
566
|
this._childToParent[childId] = "";
|
567
567
|
}
|
568
|
-
|
568
|
+
let childDef = this._groupMap[childId];
|
569
569
|
if(childDef) {
|
570
570
|
childDef.parentId = "";
|
571
571
|
}
|
@@ -582,20 +582,20 @@ GroupDefinitions.prototype.removeAllChildren = function(groupId) {
|
|
582
582
|
* @return {boolean}
|
583
583
|
*/
|
584
584
|
GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
|
585
|
-
|
585
|
+
let groupDef = this._groupMap[groupId];
|
586
586
|
if(groupDef) {
|
587
587
|
if(Array.isArray(newChildList)) {
|
588
|
-
|
588
|
+
let chdr = newChildList.slice();
|
589
589
|
this._ungroupChildren(chdr);
|
590
590
|
this.removeAllChildren(groupId);
|
591
591
|
groupDef.children = chdr;
|
592
592
|
|
593
|
-
|
594
|
-
|
595
|
-
for(
|
596
|
-
|
593
|
+
let parentId = groupDef.id;
|
594
|
+
let len = chdr.length;
|
595
|
+
for(let i = 0; i < len; ++i) {
|
596
|
+
let childId = chdr[i];
|
597
597
|
this._childToParent[childId] = parentId;
|
598
|
-
|
598
|
+
let childDef = this._groupMap[childId];
|
599
599
|
if(childDef) {
|
600
600
|
childDef.parentId = parentId;
|
601
601
|
}
|
@@ -615,7 +615,7 @@ GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
|
|
615
615
|
* @return {string}
|
616
616
|
*/
|
617
617
|
GroupDefinitions.prototype.getGroupName = function (groupId) {
|
618
|
-
|
618
|
+
let groupDef = this._groupMap[groupId];
|
619
619
|
if(groupDef) {
|
620
620
|
return groupDef.name || "";
|
621
621
|
}
|
@@ -627,7 +627,7 @@ GroupDefinitions.prototype.getGroupName = function (groupId) {
|
|
627
627
|
* @return {boolean}
|
628
628
|
*/
|
629
629
|
GroupDefinitions.prototype.setGroupName = function (groupId, groupName) {
|
630
|
-
|
630
|
+
let groupDef = this._groupMap[groupId];
|
631
631
|
if(groupDef) {
|
632
632
|
if(groupDef.name !== groupName) {
|
633
633
|
groupDef.name = groupName;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/** @namespace */
|
2
|
-
|
2
|
+
let Icon = {};
|
3
3
|
|
4
4
|
/** @public
|
5
5
|
* @function
|
@@ -8,7 +8,7 @@ var Icon = {};
|
|
8
8
|
* @return {!Element} ef-icon element
|
9
9
|
*/
|
10
10
|
Icon.create = function(iconName, className) {
|
11
|
-
|
11
|
+
let icon = document.createElement("ef-icon");
|
12
12
|
if(className) {
|
13
13
|
icon.className = className;
|
14
14
|
}
|
@@ -26,7 +26,7 @@ Icon.create = function(iconName, className) {
|
|
26
26
|
* @return {!Element} Element that contains the newly created icon
|
27
27
|
*/
|
28
28
|
Icon.box = function(iconName, className, boxRef) {
|
29
|
-
|
29
|
+
let boxElem = null;
|
30
30
|
if(boxRef) {
|
31
31
|
if(typeof boxRef == "string") {
|
32
32
|
boxElem = document.createElement(boxRef);
|
@@ -51,7 +51,7 @@ Icon.box = function(iconName, className, boxRef) {
|
|
51
51
|
* @param {string=} iconName
|
52
52
|
*/
|
53
53
|
Icon.change = function(iconElem, iconName) {
|
54
|
-
|
54
|
+
let curIcon = iconElem.getAttribute("icon");
|
55
55
|
if(curIcon !== iconName) {
|
56
56
|
iconElem.setAttribute("icon", iconName);
|
57
57
|
}
|
@@ -36,17 +36,17 @@ import {TouchProxy} from "./TouchProxy.js";
|
|
36
36
|
* @param {(string|MouseDownTrait~Options)=} options String is treated as mouse mode (eg. left|middle|right), or Option object
|
37
37
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button}
|
38
38
|
* @example
|
39
|
-
*
|
39
|
+
* let mdt = new MouseDownTrait(window);
|
40
40
|
*/
|
41
|
-
|
41
|
+
let MouseDownTrait = function(elem, options) {
|
42
42
|
this._onMouseDown = this._onMouseDown.bind(this);
|
43
43
|
this._onMouseUp = this._onMouseUp.bind(this);
|
44
44
|
this._onMouseMove = this._dispatch.bind(this, "mouseMove");
|
45
45
|
|
46
|
-
|
46
|
+
let obj;
|
47
47
|
if(options) {
|
48
48
|
if(typeof options == "string") {
|
49
|
-
|
49
|
+
let ch = options.charAt(0).toLowerCase();
|
50
50
|
if(ch === "m") { // Middle mouse
|
51
51
|
this._whichBtn = 1;
|
52
52
|
} else if(ch === "r") { // Right mouse
|
@@ -127,7 +127,7 @@ MouseDownTrait.prototype.getElement = function() {
|
|
127
127
|
* @param {Element=} elem
|
128
128
|
*/
|
129
129
|
MouseDownTrait.prototype.setElement = function(elem) {
|
130
|
-
|
130
|
+
let curElem = this._tchProxy.getElement();
|
131
131
|
if(curElem) {
|
132
132
|
curElem.removeEventListener("dragstart", EventDispatcher.preventDefault, false);
|
133
133
|
if(this._useDrag) {
|
@@ -178,7 +178,7 @@ MouseDownTrait.prototype.isMouseUp = function() {
|
|
178
178
|
*/
|
179
179
|
MouseDownTrait.prototype.getDuration = function(dateObj) {
|
180
180
|
if(this._down) {
|
181
|
-
|
181
|
+
let timeInMs = dateObj ? dateObj.getTime() : Date.now();
|
182
182
|
return timeInMs - this._down["timeStamp"];
|
183
183
|
}
|
184
184
|
return 0;
|