@refinitiv-ui/efx-grid 6.0.24 → 6.0.25
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +1330 -144
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +11 -0
- package/lib/core/es6/grid/Core.js +81 -10
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +707 -51
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +1 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
- package/lib/rt-grid/es6/FieldDefinition.js +13 -2
- package/lib/rt-grid/es6/Grid.js +75 -38
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +314 -566
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -3
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +45 -53
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +21 -9
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +1 -1
- package/lib/tr-grid-util/es6/GridPlugin.js +13 -15
- package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +58 -0
- package/lib/tr-grid-util/es6/GroupDefinitions.js +538 -0
- package/lib/tr-grid-util/es6/Popup.js +1 -1
- package/lib/tr-grid-util/es6/index.d.ts +2 -0
- package/lib/tr-grid-util/es6/index.js +3 -0
- package/lib/types/es6/ColumnGrouping.d.ts +3 -2
- package/lib/types/es6/Core/grid/Core.d.ts +11 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
- package/lib/versions.json +4 -4
- package/package.json +1 -1
package/lib/core/dist/core.js
CHANGED
@@ -1,6 +1,577 @@
|
|
1
1
|
/******/ (() => { // webpackBootstrap
|
2
2
|
/******/ "use strict";
|
3
|
+
/******/ var __webpack_modules__ = ({
|
4
|
+
|
5
|
+
/***/ 869:
|
6
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
7
|
+
|
8
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
9
|
+
/* harmony export */ "kI": () => (/* binding */ cloneObject)
|
10
|
+
/* harmony export */ });
|
11
|
+
/* unused harmony exports Util, extendObject, arrayToObject, extendProperty, extendArrayProperty, parseCondition, prettifyCss, getShadowRoot, injectCss, isIE, isMac, isTouchDevice, nestedObjectToArray, rgb2Hex, prepareTSVContent */
|
12
|
+
/** @namespace */
|
13
|
+
var Util = {};
|
14
|
+
|
15
|
+
/** This is a shorthand for fetch() API by POST method and with json body <br>
|
16
|
+
* WARNING: fetch is not supported in IE (including IE11)
|
17
|
+
* @public
|
18
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
19
|
+
* @function
|
20
|
+
* @param {string} url
|
21
|
+
* @param {Object|string} obj
|
22
|
+
* @return {!Promise<Response>}
|
23
|
+
*/
|
24
|
+
Util.post = function(url, obj) { // Not supported in IE
|
25
|
+
return Util._post(url, obj).then(Util.toJSON);
|
26
|
+
};
|
27
|
+
/** Request a server response from server as text by POST method <br>
|
28
|
+
* WARNING: fetch is not supported in IE (including IE11)
|
29
|
+
* @public
|
30
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
31
|
+
* @function
|
32
|
+
* @param {string} url
|
33
|
+
* @param {Object|string} obj
|
34
|
+
* @return {!Promise<Response>}
|
35
|
+
*/
|
36
|
+
Util.requestText = function(url, obj) { // Not supported in IE
|
37
|
+
return Util._post(url, obj, "text/plain").then(Util.toText);
|
38
|
+
};
|
39
|
+
/** Request a server response from server by POST method and with url-encoded body <br>
|
40
|
+
* WARNING: fetch is not supported in IE (including IE11)
|
41
|
+
* @public
|
42
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
|
43
|
+
* @function
|
44
|
+
* @param {string} url
|
45
|
+
* @param {string} obj
|
46
|
+
* @return {!Promise<Response>}
|
47
|
+
*/
|
48
|
+
Util.requestByUrlEncoded = function(url, obj) { // Not supported in IE
|
49
|
+
return Util._post(url, obj, "application/x-www-form-urlencoded").then(Util.toJSON);
|
50
|
+
};
|
51
|
+
|
52
|
+
/** @public
|
53
|
+
* @function
|
54
|
+
* @param {Response} resp
|
55
|
+
* @return {!Promise<Object>}
|
56
|
+
*/
|
57
|
+
Util.toJSON = function (resp) {
|
58
|
+
if(Util._logError(resp)) {
|
59
|
+
return Promise.reject(resp);
|
60
|
+
}
|
61
|
+
return resp.json();
|
62
|
+
};
|
63
|
+
/** @public
|
64
|
+
* @function
|
65
|
+
* @param {Response} resp
|
66
|
+
* @return {!Promise<string>}
|
67
|
+
*/
|
68
|
+
Util.toText = function (resp) {
|
69
|
+
if(Util._logError(resp)) {
|
70
|
+
return Promise.reject(resp);
|
71
|
+
}
|
72
|
+
return resp.text();
|
73
|
+
};
|
74
|
+
|
75
|
+
/** @private
|
76
|
+
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
|
77
|
+
* @function
|
78
|
+
* @param {Response} resp
|
79
|
+
* @return {boolean}
|
80
|
+
*/
|
81
|
+
Util._logError = function(resp) {
|
82
|
+
if(resp && resp.status >= 300) {
|
83
|
+
console.log("Response " + resp.status + ": " + resp.statusText);
|
84
|
+
return true;
|
85
|
+
}
|
86
|
+
return false;
|
87
|
+
};
|
88
|
+
/** @private
|
89
|
+
* @function
|
90
|
+
* @param {string} url
|
91
|
+
* @param {Object|string} obj
|
92
|
+
* @param {string=} contentType
|
93
|
+
* @return {!Promise<Response>}
|
94
|
+
*/
|
95
|
+
Util._post = function(url, obj, contentType) {
|
96
|
+
var options = {
|
97
|
+
method: obj ? "POST" : "GET",
|
98
|
+
headers: { "Content-Type": contentType || "application/json" }
|
99
|
+
};
|
100
|
+
if(obj) {
|
101
|
+
options.body = typeof obj === "string" ? obj : JSON.stringify(obj);
|
102
|
+
}
|
103
|
+
|
104
|
+
return fetch(url, options);
|
105
|
+
};
|
106
|
+
|
107
|
+
/** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
|
108
|
+
* Property with undefined or null value will not have an impact on the object. <br>
|
109
|
+
* Existing properties will be overridden.
|
110
|
+
* @public
|
111
|
+
* @function
|
112
|
+
* @param {Object} obj Object that is extended (new properties will be added to this object)
|
113
|
+
* @param {Object=} extender Master object (no modification will be made on the extender)
|
114
|
+
* @param {Array.<string>=} limiters Specify property to be extended
|
115
|
+
* @return {Object}
|
116
|
+
*/
|
117
|
+
var extendObject = function (obj, extender, limiters) {
|
118
|
+
if(!obj) { // null undefined NaN empty string and 0
|
119
|
+
return null;
|
120
|
+
}
|
121
|
+
if(!extender || obj === extender) {
|
122
|
+
return obj;
|
123
|
+
}
|
124
|
+
|
125
|
+
var key;
|
126
|
+
if(limiters) {
|
127
|
+
var len = limiters.length;
|
128
|
+
for(var i = 0; i < len; ++i) {
|
129
|
+
key = limiters[i];
|
130
|
+
if(key) {
|
131
|
+
extendProperty(obj, extender, key);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
} else {
|
135
|
+
for(key in extender) {
|
136
|
+
extendProperty(obj, extender, key);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
return obj;
|
140
|
+
};
|
141
|
+
/** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
|
142
|
+
* Property with undefined or null value will not be cloned.
|
143
|
+
* @public
|
144
|
+
* @function
|
145
|
+
* @param {Object} obj
|
146
|
+
* @param {Array.<string>=} limiters
|
147
|
+
* @return {Object}
|
148
|
+
*/
|
149
|
+
var cloneObject = function (obj, limiters) {
|
150
|
+
return extendObject({}, obj, limiters);
|
151
|
+
};
|
152
|
+
/** @public
|
153
|
+
* @param {Array=} data
|
154
|
+
* @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
|
155
|
+
* @return {Object|null}
|
156
|
+
*/
|
157
|
+
var arrayToObject = function(data, fields) {
|
158
|
+
if(!Array.isArray(data)) {
|
159
|
+
return data;
|
160
|
+
} else if(!fields) {
|
161
|
+
return null;
|
162
|
+
}
|
163
|
+
var ary = data;
|
164
|
+
data = {};
|
165
|
+
var len = ary.length;
|
166
|
+
for(var i = 0; i < len; ++i) {
|
167
|
+
var field = fields[i];
|
168
|
+
// eslint-disable-next-line no-undefined
|
169
|
+
if(field && ary[i] !== undefined) {
|
170
|
+
data[field] = ary[i];
|
171
|
+
}
|
172
|
+
}
|
173
|
+
return data;
|
174
|
+
};
|
175
|
+
/** Replace the specified property with the value from the extender. If the value is an array, the value will be added to the array instead of replacement
|
176
|
+
* @public
|
177
|
+
* @function
|
178
|
+
* @param {Object} obj
|
179
|
+
* @param {Object} extender
|
180
|
+
* @param {string} propName
|
181
|
+
* @example
|
182
|
+
* extendProperty({a: 0}, {a: 1}, "a"); // {a: 1}
|
183
|
+
* extendProperty({a: 0}, {b: 1}, "b"); // {a: 0, b: 1}
|
184
|
+
* extendProperty({a: [0]}, {a: 1}, "a"); // {a: [0, 1]}
|
185
|
+
* extendProperty({a: [0]}, {a: [1, 2]}, "a"); // {a: [0, 1, 2]}
|
186
|
+
*/
|
187
|
+
var extendProperty = function (obj, extender, propName) {
|
188
|
+
var val = extender[propName];
|
189
|
+
if(val != null) {
|
190
|
+
var objVal = obj[propName];
|
191
|
+
if(Array.isArray(objVal)) {
|
192
|
+
obj[propName] = objVal.concat(val);
|
193
|
+
} else if(Array.isArray(val) && objVal) {
|
194
|
+
obj[propName] = val.concat(objVal); // TODO: Preserve the order
|
195
|
+
} else {
|
196
|
+
obj[propName] = val; // WARNING: Overriding existing data
|
197
|
+
}
|
198
|
+
}
|
199
|
+
};
|
200
|
+
/** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
|
201
|
+
* This method excels in extending known array property in an object.
|
202
|
+
* @public
|
203
|
+
* @function
|
204
|
+
* @param {Object} obj
|
205
|
+
* @param {string} propName
|
206
|
+
* @param {*} ary
|
207
|
+
* @return {Array} Returns the result of the extended array
|
208
|
+
* @see {@link https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki}
|
209
|
+
* @example
|
210
|
+
* var obj = {};
|
211
|
+
* extendArrayProperty(obj, "prop1", 1); // [1]
|
212
|
+
* extendArrayProperty(obj, "prop1", 2); // [1, 2]
|
213
|
+
* extendArrayProperty(obj, "prop1", [3, 4]); // [1, 2, 3, 4]
|
214
|
+
* obj.prop2 = 5;
|
215
|
+
* extendArrayProperty(obj, "prop2", 6); // [5, 6]
|
216
|
+
* extendArrayProperty(obj, "prop2", [7]); // [5, 6, 7]
|
217
|
+
* extendArrayProperty(obj, "prop2", null); // null
|
218
|
+
*/
|
219
|
+
var extendArrayProperty = function (obj, propName, ary) {
|
220
|
+
var objAry = null;
|
221
|
+
if(ary) {
|
222
|
+
var objVal = obj[propName];
|
223
|
+
if(objVal) {
|
224
|
+
if(Array.isArray(objVal)) {
|
225
|
+
objAry = objVal;
|
226
|
+
} else {
|
227
|
+
objAry = obj[propName] = [objVal];
|
228
|
+
}
|
229
|
+
} else {
|
230
|
+
objAry = obj[propName] = [];
|
231
|
+
}
|
232
|
+
// objAry is guaranteed to be an array at this point
|
233
|
+
|
234
|
+
if(Array.isArray(ary)) {
|
235
|
+
if(ary.length) {
|
236
|
+
if(ary.length > 1) {
|
237
|
+
Array.prototype.push.apply(objAry, ary);
|
238
|
+
} else {
|
239
|
+
objAry.push(ary[0]);
|
240
|
+
}
|
241
|
+
}
|
242
|
+
} else {
|
243
|
+
objAry.push(ary);
|
244
|
+
}
|
245
|
+
}
|
246
|
+
return objAry;
|
247
|
+
};
|
248
|
+
|
249
|
+
|
250
|
+
/** Regex for matching the field token E.g. '[CF_BID]'
|
251
|
+
* @type {!RegExp}
|
252
|
+
* @private
|
253
|
+
* @const
|
254
|
+
*/
|
255
|
+
var _bracketExp = (/* unused pure expression or super */ null && (new RegExp(/\[[^\[]*\]/g))); // eslint-disable-line no-useless-escape
|
256
|
+
/** @public
|
257
|
+
* @function
|
258
|
+
* @param {string|Function} expression
|
259
|
+
* @return {Function}
|
260
|
+
* @example
|
261
|
+
* var fn = parseCondition("[CF_BID] >= 10 && [CF_BID] <= 100");
|
262
|
+
* window.console.log(fn(25));
|
263
|
+
*/
|
264
|
+
var parseCondition = function(expression) {
|
265
|
+
if(!expression) {
|
266
|
+
return null;
|
267
|
+
}
|
268
|
+
if(typeof expression !== "string") {
|
269
|
+
return (typeof expression == "function") ? /** @type {Function} */(expression) : null;
|
270
|
+
}
|
271
|
+
|
272
|
+
var brackets = expression.match(_bracketExp); // Retrieving field tokens (anything in between brackets)
|
273
|
+
var map = {}; // For checking duplication
|
274
|
+
var fields = [];
|
275
|
+
var len = brackets ? brackets.length : 0;
|
276
|
+
for(var i = len; --i >= 0;) {
|
277
|
+
var field = brackets[i];
|
278
|
+
if(!map[field]) {
|
279
|
+
map[field] = "f[" + fields.length + "]"; // Create mapping of field token to array with index E.g. { "[CF_BID]": "f[0]" }
|
280
|
+
fields.push(field.substring(1, field.length - 1)); // Strip '[' and ']' of field token to get field name
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
// Replace the field tokens with rowData of array with index E.g. [CF_BID] ==> rowData[f[0]]
|
285
|
+
expression = expression.replace(_bracketExp, function(match) {
|
286
|
+
return "rowData[" + map[match] + "]";
|
287
|
+
});
|
288
|
+
var finalExp = "(function(f, rowData) { return (" + expression + "); })";
|
289
|
+
|
290
|
+
var fn = null;
|
291
|
+
try {
|
292
|
+
fn = eval(finalExp);
|
293
|
+
fn = fn.bind(null, fields); // Bind fields for matching field name
|
294
|
+
} catch(err) {
|
295
|
+
console.log(err.message);
|
296
|
+
}
|
297
|
+
return (fn) ? fn : null;
|
298
|
+
};
|
299
|
+
|
300
|
+
|
301
|
+
/** @private
|
302
|
+
* @param {string|Array.<string>} item
|
303
|
+
* @return {string}
|
304
|
+
*/
|
305
|
+
var _encloseBracket = function(item) {
|
306
|
+
return Array.isArray(item) ? "{\n" + item.join("\n") + "\n}" : item;
|
307
|
+
};
|
308
|
+
/** @private
|
309
|
+
* @param {string} str
|
310
|
+
* @return {string}
|
311
|
+
*/
|
312
|
+
var _indentBracketContent = function(str){
|
313
|
+
return str.replace(/\n+/g, "\n\t").replace(/\n\t}$/, "\n}");
|
314
|
+
};
|
315
|
+
/** @public
|
316
|
+
* @param {string|Array} css
|
317
|
+
* @return {string} prettified CSS string
|
318
|
+
* @example
|
319
|
+
* prettifyCss(["div", [
|
320
|
+
* "color: red;",
|
321
|
+
* "padding: 20px;"
|
322
|
+
* ],
|
323
|
+
* ".class", [
|
324
|
+
* "margin: 0;"
|
325
|
+
* ]
|
326
|
+
* ]);
|
327
|
+
*/
|
328
|
+
var prettifyCss = function(css) {
|
329
|
+
if(css) {
|
330
|
+
var cssStr = "";
|
331
|
+
if (Array.isArray(css)) {
|
332
|
+
var ary = css.map(_encloseBracket);
|
333
|
+
cssStr = ary.join("\n").replace(/{\s*{/g, "{").replace(/\s+{/g, " {");
|
334
|
+
} else {
|
335
|
+
cssStr = (typeof css === "string") ? css : css + "";
|
336
|
+
}
|
337
|
+
|
338
|
+
if(cssStr) {
|
339
|
+
return cssStr.replace(/{[\w\W]*?}/g, _indentBracketContent);
|
340
|
+
}
|
341
|
+
}
|
342
|
+
return "";
|
343
|
+
};
|
344
|
+
/** Get shadow root of the given element regardless of whether the element is in the DOM or not. The immediate shadow root parent is returned in case of nested shadow roots. Any other case return null.
|
345
|
+
* @public
|
346
|
+
* @param {Element} elem
|
347
|
+
* @return {DocumentFragment}
|
348
|
+
*/
|
349
|
+
var getShadowRoot = function(elem) {
|
350
|
+
if(elem) {
|
351
|
+
var rootNode;
|
352
|
+
if(elem.shadowRoot) {
|
353
|
+
rootNode = elem.shadowRoot;
|
354
|
+
} else if(elem.getRootNode) {
|
355
|
+
rootNode = elem.getRootNode();
|
356
|
+
}
|
357
|
+
if(rootNode) { // getRootNode does not supported in IE. It should be implemented by the polyfills
|
358
|
+
if(rootNode !== document) { // element that is in the DOM and not in the shadow has document as its root node
|
359
|
+
if(rootNode !== elem) { // element that is NOT in the DOM and not in the shadow has itself as its root node
|
360
|
+
return rootNode;
|
361
|
+
}
|
362
|
+
}
|
363
|
+
}
|
364
|
+
}
|
365
|
+
return null;
|
366
|
+
};
|
367
|
+
/** Attach style tag to the proper document (in case of element inside a shadow root)
|
368
|
+
* @public
|
369
|
+
* @param {string} cssStr Valid CSS string (e.g. "div {color: red;}")
|
370
|
+
* @param {Element=} targetContext Element that needs the CSS
|
371
|
+
* @return {Element} New style tag
|
372
|
+
*/
|
373
|
+
var injectCss = function(cssStr, targetContext) {
|
374
|
+
if(!cssStr) {
|
375
|
+
return null;
|
376
|
+
}
|
377
|
+
|
378
|
+
var styleTag = document.createElement("style");
|
379
|
+
styleTag.textContent = "\n" + cssStr + "\n";
|
380
|
+
|
381
|
+
var styleHost = getShadowRoot(targetContext);
|
382
|
+
var isInShadow = true;
|
383
|
+
if(!styleHost) {
|
384
|
+
isInShadow = false;
|
385
|
+
styleHost = document.head;
|
386
|
+
}
|
387
|
+
|
388
|
+
// Find a place to insert the style tag
|
389
|
+
var beforeElem;
|
390
|
+
if(isInShadow) {
|
391
|
+
if(styleHost.children && styleHost.children.length) {
|
392
|
+
beforeElem = styleHost.children[0];
|
393
|
+
}
|
394
|
+
}
|
395
|
+
if(beforeElem) {
|
396
|
+
styleHost.insertBefore(styleTag, beforeElem);
|
397
|
+
} else {
|
398
|
+
styleHost.appendChild(styleTag);
|
399
|
+
}
|
400
|
+
return styleTag;
|
401
|
+
};
|
402
|
+
|
403
|
+
/** return true if browser is IE or Edge
|
404
|
+
* @public
|
405
|
+
* @return {boolean}
|
406
|
+
*/
|
407
|
+
var isIE = function () {
|
408
|
+
var ua = window.navigator.userAgent;
|
409
|
+
return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
|
410
|
+
};
|
411
|
+
|
412
|
+
/** return true if device is mac
|
413
|
+
* @public
|
414
|
+
* @return {boolean}
|
415
|
+
*/
|
416
|
+
var isMac = function () {
|
417
|
+
return /Mac/.test(navigator.platform);
|
418
|
+
};
|
419
|
+
|
420
|
+
/** Return true if device is mac
|
421
|
+
* @public
|
422
|
+
* @return {boolean}
|
423
|
+
*/
|
424
|
+
var isTouchDevice = function () {
|
425
|
+
if ((navigator["maxTouchPoints"] && navigator["maxTouchPoints"] < 256) ||
|
426
|
+
(navigator["msMaxTouchPoints"] && navigator["msMaxTouchPoints"] < 256)) {
|
427
|
+
return true;
|
428
|
+
}
|
429
|
+
return false;
|
430
|
+
};
|
431
|
+
|
432
|
+
/** parse nested object in to array
|
433
|
+
* @public
|
434
|
+
* @param {Object} obj
|
435
|
+
* @param {Array=} ary
|
436
|
+
* @return {Array}
|
437
|
+
*/
|
438
|
+
var nestedObjectToArray = function (obj, ary) {
|
439
|
+
if (!ary) {
|
440
|
+
ary = [];
|
441
|
+
}
|
442
|
+
for (var key in obj) {
|
443
|
+
var element = obj[key];
|
444
|
+
if ('object' === typeof element) {
|
445
|
+
nestedObjectToArray(element, ary);
|
446
|
+
} else {
|
447
|
+
ary.push(element);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
return ary;
|
451
|
+
};
|
452
|
+
|
453
|
+
/** Convert CSS rgb or rgba formats to CSS hex color string (# prefix)
|
454
|
+
* @public
|
455
|
+
* @param {string} rgbCode
|
456
|
+
* @return {string}
|
457
|
+
* @example
|
458
|
+
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
459
|
+
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
460
|
+
* rgb2Hex("255 255.0"); // "#FFFF00"
|
461
|
+
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
462
|
+
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
463
|
+
* rgb2Hex("2552550"); // "2552550"
|
464
|
+
* rgb2Hex("invalid"); // "invalid"
|
465
|
+
* rgb2Hex(null); // ""
|
466
|
+
*/
|
467
|
+
var rgb2Hex = function (rgbCode) {
|
468
|
+
if(!rgbCode || typeof rgbCode !== "string") {
|
469
|
+
return "";
|
470
|
+
}
|
471
|
+
if(rgbCode.charAt(0) === "#") {
|
472
|
+
return rgbCode;
|
473
|
+
}
|
474
|
+
var rgb = rgbCode.match(/\d+/g);
|
475
|
+
if(!rgb || rgb.length < 3) {
|
476
|
+
return rgbCode;
|
477
|
+
}
|
478
|
+
|
479
|
+
var hex = "#";
|
480
|
+
for(var i = 0; i < 3; i++) {
|
481
|
+
var num = +rgb[i];
|
482
|
+
if(!(num >= 16)) { // Handle NaN case
|
483
|
+
hex += "0";
|
484
|
+
}
|
485
|
+
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
486
|
+
}
|
487
|
+
return hex;
|
488
|
+
};
|
489
|
+
|
490
|
+
/** transform data to tab seperated value
|
491
|
+
* @public
|
492
|
+
* @param {*} data
|
493
|
+
* @return {string}
|
494
|
+
*/
|
495
|
+
var prepareTSVContent = function (data) {
|
496
|
+
if (data == null) {
|
497
|
+
return "";
|
498
|
+
}
|
499
|
+
|
500
|
+
var content = (typeof data === 'string') ? data : data.toString();
|
501
|
+
|
502
|
+
if (!content.length) { return ""; }
|
503
|
+
|
504
|
+
// Replace any new line and tab
|
505
|
+
if (content.indexOf("\n") >= 0) {
|
506
|
+
content = content.replace(/[\r\n]/g, " ");
|
507
|
+
}
|
508
|
+
|
509
|
+
if (content.indexOf("\t") >= 0) {
|
510
|
+
content = content.replace(/\t/g, " ");
|
511
|
+
}
|
512
|
+
|
513
|
+
// Trim front and back spaces
|
514
|
+
if (content.charAt(0) === " " || content.charAt(content.length - 1) === " ") {
|
515
|
+
content = content.trim();
|
516
|
+
}
|
517
|
+
|
518
|
+
return content;
|
519
|
+
};
|
520
|
+
|
521
|
+
/* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (Util)));
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
/***/ })
|
526
|
+
|
527
|
+
/******/ });
|
528
|
+
/************************************************************************/
|
529
|
+
/******/ // The module cache
|
530
|
+
/******/ var __webpack_module_cache__ = {};
|
531
|
+
/******/
|
532
|
+
/******/ // The require function
|
533
|
+
/******/ function __webpack_require__(moduleId) {
|
534
|
+
/******/ // Check if module is in cache
|
535
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
536
|
+
/******/ if (cachedModule !== undefined) {
|
537
|
+
/******/ return cachedModule.exports;
|
538
|
+
/******/ }
|
539
|
+
/******/ // Create a new module (and put it into the cache)
|
540
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
541
|
+
/******/ // no module.id needed
|
542
|
+
/******/ // no module.loaded needed
|
543
|
+
/******/ exports: {}
|
544
|
+
/******/ };
|
545
|
+
/******/
|
546
|
+
/******/ // Execute the module function
|
547
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
548
|
+
/******/
|
549
|
+
/******/ // Return the exports of the module
|
550
|
+
/******/ return module.exports;
|
551
|
+
/******/ }
|
552
|
+
/******/
|
553
|
+
/************************************************************************/
|
554
|
+
/******/ /* webpack/runtime/define property getters */
|
555
|
+
/******/ (() => {
|
556
|
+
/******/ // define getter functions for harmony exports
|
557
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
558
|
+
/******/ for(var key in definition) {
|
559
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
560
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
561
|
+
/******/ }
|
562
|
+
/******/ }
|
563
|
+
/******/ };
|
564
|
+
/******/ })();
|
565
|
+
/******/
|
566
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
567
|
+
/******/ (() => {
|
568
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
569
|
+
/******/ })();
|
570
|
+
/******/
|
571
|
+
/************************************************************************/
|
3
572
|
var __webpack_exports__ = {};
|
573
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
574
|
+
(() => {
|
4
575
|
|
5
576
|
// UNUSED EXPORTS: Cell, CellFloatingPanel, CellSpan, CellSpans, Column, ColumnStats, Conflator, Core, DataCache, DataTable, DataView, ElementFrameWork, ElementWrapper, EventDispatcher, HScrollbar, ILayoutGrid, LayoutGrid, Reverter, Scrollbar, SectionSettings, SelectionList, SortableTitlePlugin, TrackLayout, VScrollbar, VirtualizedLayoutGrid, Virtualizer, default
|
6
577
|
|
@@ -10390,181 +10961,723 @@ LayoutGrid.prototype._updateCellSpanLayout = function (cellSpans) {
|
|
10390
10961
|
}
|
10391
10962
|
};
|
10392
10963
|
|
10393
|
-
/**
|
10394
|
-
* @private
|
10395
|
-
* @param {number} indexX
|
10396
|
-
* @param {number} indexY
|
10397
|
-
* @param {!CellSpan} cellSpan
|
10398
|
-
* @param {boolean} adding
|
10399
|
-
*/
|
10400
|
-
LayoutGrid.prototype._updateCellSpan = function (indexX, indexY, cellSpan, adding) {
|
10401
|
-
this._updateCellSpanSize(indexX, indexY, adding ? cellSpan : null);
|
10402
|
-
this._updateCellSpanClass(indexX, indexY, cellSpan.colSpan, cellSpan.rowSpan, adding);
|
10964
|
+
/**
|
10965
|
+
* @private
|
10966
|
+
* @param {number} indexX
|
10967
|
+
* @param {number} indexY
|
10968
|
+
* @param {!CellSpan} cellSpan
|
10969
|
+
* @param {boolean} adding
|
10970
|
+
*/
|
10971
|
+
LayoutGrid.prototype._updateCellSpan = function (indexX, indexY, cellSpan, adding) {
|
10972
|
+
this._updateCellSpanSize(indexX, indexY, adding ? cellSpan : null);
|
10973
|
+
this._updateCellSpanClass(indexX, indexY, cellSpan.colSpan, cellSpan.rowSpan, adding);
|
10974
|
+
};
|
10975
|
+
|
10976
|
+
/**
|
10977
|
+
* @private
|
10978
|
+
* @param {number} indexX
|
10979
|
+
* @param {number} indexY
|
10980
|
+
* @param {number} colSpan
|
10981
|
+
* @param {number} rowSpan
|
10982
|
+
* @param {boolean} adding
|
10983
|
+
*/
|
10984
|
+
LayoutGrid.prototype._updateCellSpanClass = function (indexX, indexY, colSpan, rowSpan, adding) {
|
10985
|
+
var column;
|
10986
|
+
|
10987
|
+
for (var c = 0; c < colSpan; ++c) {
|
10988
|
+
column = this._columns[indexX + c];
|
10989
|
+
|
10990
|
+
if (!column) {
|
10991
|
+
break;
|
10992
|
+
}
|
10993
|
+
|
10994
|
+
column.collapseCells(indexY, rowSpan, adding, (c === 0), (c > 0));
|
10995
|
+
}
|
10996
|
+
|
10997
|
+
var cell = this._getCell(indexX, indexY);
|
10998
|
+
|
10999
|
+
if (cell) {
|
11000
|
+
cell._colSpan = (adding) ? colSpan : 1;
|
11001
|
+
cell._rowSpan = (adding) ? rowSpan : 1; // For quick rendering
|
11002
|
+
}
|
11003
|
+
};
|
11004
|
+
|
11005
|
+
/**
|
11006
|
+
* @private
|
11007
|
+
* @param {Array.<CellSpan>} cellSpans
|
11008
|
+
* @param {boolean} adding
|
11009
|
+
*/
|
11010
|
+
LayoutGrid.prototype._updateCellSpans = function (cellSpans, adding) {
|
11011
|
+
if (cellSpans == null) { return; }
|
11012
|
+
|
11013
|
+
for (var i = cellSpans.length; --i >= 0; ) {
|
11014
|
+
var cellSpan = cellSpans[i];
|
11015
|
+
|
11016
|
+
this._updateCellSpan(cellSpan.indexX, cellSpan.indexY, cellSpan, adding);
|
11017
|
+
}
|
11018
|
+
};
|
11019
|
+
|
11020
|
+
/**
|
11021
|
+
* @private
|
11022
|
+
* @param {Object} e
|
11023
|
+
*/
|
11024
|
+
LayoutGrid.prototype._onMouseMove = function (e) {
|
11025
|
+
var target = e["target"];
|
11026
|
+
|
11027
|
+
var cellElement = util.closestElement(target, "cell");
|
11028
|
+
var colIndex = this._stretchedCells.getColumnIndex(cellElement);
|
11029
|
+
if(colIndex < 0) { // Not found colIndex in stretching cell, then get from normal row
|
11030
|
+
var colElement = util.closestElement(target, "column");
|
11031
|
+
colIndex = this.getColumnIndex(colElement);
|
11032
|
+
}
|
11033
|
+
var rowIndex = this.getCellIndex(colIndex, cellElement);
|
11034
|
+
|
11035
|
+
this.setRowHighlight(rowIndex);
|
11036
|
+
};
|
11037
|
+
|
11038
|
+
/**
|
11039
|
+
* @private
|
11040
|
+
* @param {Object} e
|
11041
|
+
*/
|
11042
|
+
LayoutGrid.prototype._onMouseOut = function (e) {
|
11043
|
+
var rel = e.relatedTarget;
|
11044
|
+
|
11045
|
+
if (rel) {
|
11046
|
+
var thisElem = this._element;
|
11047
|
+
|
11048
|
+
while (rel.parentNode !== null) {
|
11049
|
+
rel = rel.parentNode;
|
11050
|
+
|
11051
|
+
if (rel === thisElem) {
|
11052
|
+
return;
|
11053
|
+
}
|
11054
|
+
}
|
11055
|
+
}
|
11056
|
+
|
11057
|
+
this.setRowHighlight(-1);
|
11058
|
+
};
|
11059
|
+
|
11060
|
+
/**
|
11061
|
+
* @private
|
11062
|
+
* @param {number} rowIndex
|
11063
|
+
*/
|
11064
|
+
LayoutGrid.prototype._updateSelectionUI = function (rowIndex) { // Update UI of the specified row index
|
11065
|
+
var selected = this._selectionList.getSelection(rowIndex);
|
11066
|
+
this._enableStretchCellClass(rowIndex, "selected-row", selected);
|
11067
|
+
this.enableRowClass(rowIndex, "selected-row", selected);
|
11068
|
+
};
|
11069
|
+
|
11070
|
+
/** @private
|
11071
|
+
* @param {number} rowIndex
|
11072
|
+
*/
|
11073
|
+
LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
|
11074
|
+
this._enableStretchCellClass(rowIndex, "selected-row", true);
|
11075
|
+
this.enableRowClass(rowIndex, "selected-row", true);
|
11076
|
+
};
|
11077
|
+
|
11078
|
+
/**
|
11079
|
+
* @private
|
11080
|
+
* @param {number} rowIndex
|
11081
|
+
*/
|
11082
|
+
LayoutGrid.prototype._removeSelectionUI = function (rowIndex) {
|
11083
|
+
this._enableStretchCellClass(rowIndex, "selected-row", false);
|
11084
|
+
this.enableRowClass(rowIndex, "selected-row", false);
|
11085
|
+
};
|
11086
|
+
|
11087
|
+
/**
|
11088
|
+
* @public
|
11089
|
+
* @ignore
|
11090
|
+
*/
|
11091
|
+
LayoutGrid.prototype._onEnterDocument = function () {
|
11092
|
+
if (!this._initialized && this.getParent()) {
|
11093
|
+
for (var c = 0; c < this._colCount; ++c) {
|
11094
|
+
this._columns[c].enableAutoStyleUpdating();
|
11095
|
+
}
|
11096
|
+
|
11097
|
+
this._syncLayoutToColumns(0);
|
11098
|
+
this._initialized = true;
|
11099
|
+
}
|
11100
|
+
};
|
11101
|
+
|
11102
|
+
/** @public
|
11103
|
+
* @ignore
|
11104
|
+
* @param {*} ctx
|
11105
|
+
*/
|
11106
|
+
LayoutGrid.prototype._setContext = function(ctx) {
|
11107
|
+
this._ctx = ctx;
|
11108
|
+
};
|
11109
|
+
|
11110
|
+
/** @public
|
11111
|
+
* @ignore
|
11112
|
+
* @return {*} ctx
|
11113
|
+
*/
|
11114
|
+
LayoutGrid.prototype._getContext = function () {
|
11115
|
+
return this._ctx;
|
11116
|
+
};
|
11117
|
+
|
11118
|
+
/** This is a WORKAROUND to fix Internet Explorer couldn't render top 50% with translateX -50% correctly
|
11119
|
+
* @private
|
11120
|
+
*/
|
11121
|
+
LayoutGrid.prototype._resetTransformIETimer = function () {
|
11122
|
+
if (util.isIE) {
|
11123
|
+
if(!this._transformIETimer) {
|
11124
|
+
this.enableClass("reset-transform");
|
11125
|
+
this._transformIETimer = setTimeout(this._onResetTransformIE, 20);
|
11126
|
+
}
|
11127
|
+
}
|
11128
|
+
};
|
11129
|
+
/** @private
|
11130
|
+
*/
|
11131
|
+
LayoutGrid.prototype._onResetTransformIE = function () {
|
11132
|
+
this._transformIETimer = 0;
|
11133
|
+
this.enableClass("reset-transform", false);
|
11134
|
+
};
|
11135
|
+
|
11136
|
+
LayoutGrid._proto = LayoutGrid.prototype;
|
11137
|
+
|
11138
|
+
/* harmony default export */ const grid_LayoutGrid = (LayoutGrid);
|
11139
|
+
|
11140
|
+
|
11141
|
+
// EXTERNAL MODULE: ./node_modules/tr-grid-util/es6/Util.js
|
11142
|
+
var es6_Util = __webpack_require__(869);
|
11143
|
+
;// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/GroupDefinitions.js
|
11144
|
+
|
11145
|
+
|
11146
|
+
/** @constructor
|
11147
|
+
*/
|
11148
|
+
var GroupDefinitions = function () {
|
11149
|
+
this._groupMap = {};
|
11150
|
+
this._childToParent = {};
|
11151
|
+
};
|
11152
|
+
|
11153
|
+
/** @type {!Object.<string, Object>}
|
11154
|
+
* @description A map of group id to group defintion
|
11155
|
+
* @private
|
11156
|
+
*/
|
11157
|
+
GroupDefinitions.prototype._groupMap;
|
11158
|
+
/** @type {!Object.<string, string>}
|
11159
|
+
* @description A map of child id to parent id
|
11160
|
+
* @private
|
11161
|
+
*/
|
11162
|
+
GroupDefinitions.prototype._childToParent;
|
11163
|
+
|
11164
|
+
|
11165
|
+
/** @public
|
11166
|
+
* @function
|
11167
|
+
* @param {Object} groupDef
|
11168
|
+
* @return {string}
|
11169
|
+
*/
|
11170
|
+
GroupDefinitions.getGroupId = function(groupDef) {
|
11171
|
+
if(groupDef) {
|
11172
|
+
return groupDef.id || "";
|
11173
|
+
}
|
11174
|
+
return "";
|
11175
|
+
};
|
11176
|
+
/** @public
|
11177
|
+
* @param {Object.<string, Object>} groupMap
|
11178
|
+
* @param {Object} groupDef
|
11179
|
+
* @return {number} Return total number of parents. Return 0 if there is no parent.
|
11180
|
+
*/
|
11181
|
+
GroupDefinitions.calcTreeDepth = function (groupMap, groupDef) {
|
11182
|
+
var curDepth = -1;
|
11183
|
+
var curNode = groupDef;
|
11184
|
+
while(curNode) { // WARNING: infinite loop could occured, if parentId is cycle back to one of the child group
|
11185
|
+
if(++curDepth > 15) {
|
11186
|
+
console.log("WARNING: Infinite loop detected during column group creation");
|
11187
|
+
break;
|
11188
|
+
}
|
11189
|
+
var parentId = curNode.parentId;
|
11190
|
+
curNode = groupMap[parentId];
|
11191
|
+
}
|
11192
|
+
return curDepth;
|
11193
|
+
};
|
11194
|
+
/** @public
|
11195
|
+
* @param {Object.<string, Object>} groupMap
|
11196
|
+
* @param {string} groupId
|
11197
|
+
* @return {Array.<string>}
|
11198
|
+
*/
|
11199
|
+
GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
|
11200
|
+
var groupDef = groupMap[groupId];
|
11201
|
+
if(!groupDef) {
|
11202
|
+
return null;
|
11203
|
+
}
|
11204
|
+
|
11205
|
+
var leaves = [];
|
11206
|
+
var unvisitedGroups = [groupDef];
|
11207
|
+
var visitedCount = 0;
|
11208
|
+
var visitedMap = {};
|
11209
|
+
while(visitedCount < unvisitedGroups.length) {
|
11210
|
+
groupDef = unvisitedGroups[visitedCount++];
|
11211
|
+
visitedMap[groupDef.id] = true;
|
11212
|
+
var chdr = groupDef.children;
|
11213
|
+
var len = chdr.length;
|
11214
|
+
for(var i = 0; i < len; ++i) {
|
11215
|
+
var childId = chdr[i];
|
11216
|
+
groupDef = groupMap[childId];
|
11217
|
+
if(groupDef) {
|
11218
|
+
if(!visitedMap[groupDef.id]) { // Prevent infinite loop
|
11219
|
+
unvisitedGroups.push(groupDef);
|
11220
|
+
}
|
11221
|
+
} else {
|
11222
|
+
leaves.push(childId);
|
11223
|
+
}
|
11224
|
+
}
|
11225
|
+
}
|
11226
|
+
return leaves;
|
11227
|
+
};
|
11228
|
+
|
11229
|
+
|
11230
|
+
/** @private
|
11231
|
+
* @function
|
11232
|
+
* @param {Object} obj
|
11233
|
+
* @return {Object}
|
11234
|
+
*/
|
11235
|
+
GroupDefinitions._cloneObject = function(obj) {
|
11236
|
+
var newObj = (0,es6_Util/* cloneObject */.kI)(obj);
|
11237
|
+
if(Array.isArray(newObj.children)) {
|
11238
|
+
newObj.children = newObj.children;
|
11239
|
+
} else {
|
11240
|
+
newObj.children = [];
|
11241
|
+
}
|
11242
|
+
return newObj;
|
11243
|
+
};
|
11244
|
+
/** @private
|
11245
|
+
* @param {Object} groupMap
|
11246
|
+
* @return {!Object}
|
11247
|
+
*/
|
11248
|
+
GroupDefinitions._cloneGroupMap = function (groupMap) {
|
11249
|
+
var outMap = {};
|
11250
|
+
for(var groupId in groupMap) {
|
11251
|
+
var groupDef = groupMap[groupId];
|
11252
|
+
var obj = GroupDefinitions._cloneObject(groupDef);
|
11253
|
+
obj.children = groupDef.children.slice();
|
11254
|
+
outMap[groupId] = obj;
|
11255
|
+
}
|
11256
|
+
return outMap;
|
11257
|
+
};
|
11258
|
+
|
11259
|
+
/** @private
|
11260
|
+
* @function
|
11261
|
+
* @param {Array.<string>|Object} obj
|
11262
|
+
* @param {string=} groupId
|
11263
|
+
* @return {Object}
|
11264
|
+
*/
|
11265
|
+
GroupDefinitions._toGroupDefinition = function(obj, groupId) {
|
11266
|
+
var groupDef = null;
|
11267
|
+
if(obj) {
|
11268
|
+
if(Array.isArray(obj)) {
|
11269
|
+
groupDef = {
|
11270
|
+
children: obj
|
11271
|
+
};
|
11272
|
+
} else {
|
11273
|
+
groupDef = GroupDefinitions._cloneObject(obj);
|
11274
|
+
}
|
11275
|
+
if(groupId) {
|
11276
|
+
if(!groupDef.id) {
|
11277
|
+
groupDef.name = groupId;
|
11278
|
+
}
|
11279
|
+
groupDef.id = groupId;
|
11280
|
+
}
|
11281
|
+
}
|
11282
|
+
return groupDef;
|
11283
|
+
};
|
11284
|
+
|
11285
|
+
/** @public
|
11286
|
+
* @return {string}
|
11287
|
+
*/
|
11288
|
+
GroupDefinitions.prototype.toString = function() {
|
11289
|
+
var groupMap = this._groupMap;
|
11290
|
+
var lines = [];
|
11291
|
+
lines.push("=== groupDefs ===");
|
11292
|
+
for(var key in groupMap) {
|
11293
|
+
var group = groupMap[key];
|
11294
|
+
lines.push(key + ": " + JSON.stringify(group, ["id", "parentId", "children"]));
|
11295
|
+
}
|
11296
|
+
|
11297
|
+
lines.push("=== childToParent ===");
|
11298
|
+
lines.push(JSON.stringify(this._childToParent, null, 2));
|
11299
|
+
lines.push("");
|
11300
|
+
|
11301
|
+
return lines.join("\n");
|
11302
|
+
};
|
11303
|
+
|
11304
|
+
/** Get group definition object. This method can be used to check whether the given id is a group id or not (i.e., isGroupId).
|
11305
|
+
* @public
|
11306
|
+
* @param {string} groupId
|
11307
|
+
* @return {Object}
|
11308
|
+
*/
|
11309
|
+
GroupDefinitions.prototype.getGroup = function (groupId) {
|
11310
|
+
if(groupId) {
|
11311
|
+
return this._groupMap[groupId] || null;
|
11312
|
+
}
|
11313
|
+
return null;
|
11314
|
+
};
|
11315
|
+
/** @public
|
11316
|
+
* @function
|
11317
|
+
* @param {string} groupId
|
11318
|
+
* @return {Object}
|
11319
|
+
*/
|
11320
|
+
GroupDefinitions.prototype.getDefinition = GroupDefinitions.prototype.getGroup;
|
11321
|
+
/** Get array of all existing group definitions
|
11322
|
+
* @public
|
11323
|
+
* @return {!Array.<Object>}
|
11324
|
+
*/
|
11325
|
+
GroupDefinitions.prototype.getGroups = function () {
|
11326
|
+
var groupDefs = [];
|
11327
|
+
var groupMap = this._groupMap;
|
11328
|
+
for(var key in groupMap) {
|
11329
|
+
groupDefs.push(groupMap[key]);
|
11330
|
+
}
|
11331
|
+
return groupDefs;
|
11332
|
+
};
|
11333
|
+
/** @public
|
11334
|
+
* @return {!Object.<string, Object>}
|
11335
|
+
*/
|
11336
|
+
GroupDefinitions.prototype.getGroupMap = function () {
|
11337
|
+
return this._groupMap; // WARNING: Allow access to private member
|
11338
|
+
};
|
11339
|
+
/** @public
|
11340
|
+
* @return {!Object.<string, Object>}
|
11341
|
+
*/
|
11342
|
+
GroupDefinitions.prototype.cloneGroupMap = function () {
|
11343
|
+
return GroupDefinitions._cloneGroupMap(this._groupMap);
|
11344
|
+
};
|
11345
|
+
|
11346
|
+
/** Get immediate child ids of the specified group. The returned array can contain both child ids and group ids
|
11347
|
+
* @public
|
11348
|
+
* @param {string} groupId
|
11349
|
+
* @return {Array.<string>}
|
11350
|
+
*/
|
11351
|
+
GroupDefinitions.prototype.getGroupChildren = function (groupId) {
|
11352
|
+
var groupDef = this._groupMap[groupId];
|
11353
|
+
return groupDef ? groupDef.children : null;
|
11354
|
+
};
|
11355
|
+
/** Get all non-group descendants of the given group id.
|
11356
|
+
* @public
|
11357
|
+
* @param {string} groupId
|
11358
|
+
* @return {Array.<string>}
|
11359
|
+
*/
|
11360
|
+
GroupDefinitions.prototype.getLeafDescendants = function (groupId) {
|
11361
|
+
return GroupDefinitions.getLeafDescendants(this._groupMap, groupId);
|
11362
|
+
};
|
11363
|
+
/** @public
|
11364
|
+
* @param {string} groupId
|
11365
|
+
* @return {number} Return -1 if the given groupDef is null. Return 0 if there is no parent. Return 1 or more if it has a parent
|
11366
|
+
*/
|
11367
|
+
GroupDefinitions.prototype.getGroupLevel = function (groupId) {
|
11368
|
+
return GroupDefinitions.calcTreeDepth(this._groupMap, this._groupMap[groupId]);
|
11369
|
+
};
|
11370
|
+
/** @public
|
11371
|
+
* @param {string} groupId
|
11372
|
+
* @return {Object}
|
11373
|
+
*/
|
11374
|
+
GroupDefinitions.prototype.getRootGroup = function (groupId) {
|
11375
|
+
if (!groupId) {
|
11376
|
+
return null;
|
11377
|
+
}
|
11378
|
+
var groupMap = this._groupMap;
|
11379
|
+
var groupDef = groupMap[groupId] || null;
|
11380
|
+
// TODO: Support column id
|
11381
|
+
if(groupDef) {
|
11382
|
+
while (groupDef.parentId) {
|
11383
|
+
var parentDef = groupMap[groupDef.parentId];
|
11384
|
+
if(parentDef) {
|
11385
|
+
groupDef = parentDef;
|
11386
|
+
} else {
|
11387
|
+
break;
|
11388
|
+
}
|
11389
|
+
}
|
11390
|
+
}
|
11391
|
+
return groupDef;
|
11392
|
+
};
|
11393
|
+
/** @public
|
11394
|
+
* @param {string} childId
|
11395
|
+
* @return {Object}
|
11396
|
+
*/
|
11397
|
+
GroupDefinitions.prototype.getParentGroup = function (childId) {
|
11398
|
+
return this.getGroup(this._childToParent[childId]);
|
11399
|
+
};
|
11400
|
+
/** @public
|
11401
|
+
* @param {string} childId
|
11402
|
+
* @return {Array.<string>}
|
11403
|
+
*/
|
11404
|
+
GroupDefinitions.prototype.getParentIds = function(childId) {
|
11405
|
+
if (childId && typeof childId === "string") {
|
11406
|
+
var groupId = this._childToParent[childId];
|
11407
|
+
if (groupId) {
|
11408
|
+
var groupIds = [groupId];
|
11409
|
+
var group = this._groupMap[groupId];
|
11410
|
+
while (group && group.parentId) {
|
11411
|
+
group = this._groupMap[group.parentId];
|
11412
|
+
if (group) {
|
11413
|
+
groupIds.push(group.id);
|
11414
|
+
}
|
11415
|
+
}
|
11416
|
+
return groupIds;
|
11417
|
+
}
|
11418
|
+
}
|
11419
|
+
return null;
|
11420
|
+
};
|
11421
|
+
/** @public
|
11422
|
+
* @param {string} childId
|
11423
|
+
* @param {number=} groupLevel
|
11424
|
+
* @return {string}
|
11425
|
+
*/
|
11426
|
+
GroupDefinitions.prototype.getParentId = function (childId, groupLevel) {
|
11427
|
+
var parentId = this._childToParent[childId];
|
11428
|
+
if(groupLevel != null) {
|
11429
|
+
var currentLevel = this.getGroupLevel(parentId);
|
11430
|
+
while(currentLevel > groupLevel && parentId){
|
11431
|
+
parentId = this._childToParent[parentId];
|
11432
|
+
currentLevel--;
|
11433
|
+
}
|
11434
|
+
}
|
11435
|
+
|
11436
|
+
return parentId || "";
|
10403
11437
|
};
|
10404
11438
|
|
10405
|
-
/**
|
10406
|
-
* @private
|
10407
|
-
* @param {number} indexX
|
10408
|
-
* @param {number} indexY
|
10409
|
-
* @param {number} colSpan
|
10410
|
-
* @param {number} rowSpan
|
10411
|
-
* @param {boolean} adding
|
10412
|
-
*/
|
10413
|
-
LayoutGrid.prototype._updateCellSpanClass = function (indexX, indexY, colSpan, rowSpan, adding) {
|
10414
|
-
var column;
|
10415
11439
|
|
10416
|
-
|
10417
|
-
|
11440
|
+
/** Remove all existing group definitions and replace them with the given definitions.
|
11441
|
+
* @public
|
11442
|
+
* @param {Array.<Object>=} groupDefs Use null or empty array to remove all existing groups
|
11443
|
+
*/
|
11444
|
+
GroupDefinitions.prototype.setGroups = function (groupDefs) {
|
11445
|
+
// Clear existing group structure
|
11446
|
+
var groupMap = this._groupMap = {};
|
11447
|
+
var childToParent = this._childToParent = {};
|
10418
11448
|
|
10419
|
-
|
10420
|
-
|
11449
|
+
// Create group map
|
11450
|
+
var i;
|
11451
|
+
var grpCount = groupDefs ? groupDefs.length : 0;
|
11452
|
+
var groupId = "";
|
11453
|
+
for (i = 0; i < grpCount; i++) {
|
11454
|
+
var groupDef = groupDefs[i];
|
11455
|
+
groupId = groupDef.id;
|
11456
|
+
if(groupId) {
|
11457
|
+
groupMap[groupId] = groupDef;
|
11458
|
+
}
|
11459
|
+
}
|
11460
|
+
|
11461
|
+
// Create child to parent map
|
11462
|
+
var groupIds = Object.keys(groupMap);
|
11463
|
+
grpCount = groupIds.length;
|
11464
|
+
for(i = 0; i < grpCount; ++i) {
|
11465
|
+
groupId = groupIds[i];
|
11466
|
+
var children = groupMap[groupId].children;
|
11467
|
+
var childCount = children.length;
|
11468
|
+
for (var j = 0; j < childCount; j++) {
|
11469
|
+
childToParent[children[j]] = groupId;
|
10421
11470
|
}
|
10422
|
-
|
10423
|
-
column.collapseCells(indexY, rowSpan, adding, (c === 0), (c > 0));
|
10424
11471
|
}
|
10425
11472
|
|
10426
|
-
|
10427
|
-
|
10428
|
-
|
10429
|
-
|
10430
|
-
|
11473
|
+
// Apply a parent id to group definition to make it easier to find depth
|
11474
|
+
for(i = 0; i < grpCount; ++i) {
|
11475
|
+
groupId = groupIds[i];
|
11476
|
+
var parentId = childToParent[groupId];
|
11477
|
+
if(parentId) {
|
11478
|
+
groupMap[groupId].parentId = parentId;
|
11479
|
+
}
|
10431
11480
|
}
|
10432
11481
|
};
|
10433
|
-
|
10434
|
-
|
10435
|
-
|
10436
|
-
|
10437
|
-
|
10438
|
-
|
10439
|
-
|
10440
|
-
if
|
10441
|
-
|
10442
|
-
for (var i = cellSpans.length; --i >= 0; ) {
|
10443
|
-
var cellSpan = cellSpans[i];
|
10444
|
-
|
10445
|
-
this._updateCellSpan(cellSpan.indexX, cellSpan.indexY, cellSpan, adding);
|
11482
|
+
/** Add new group definition to existing group structure. Existing group with the same id will be replaced.
|
11483
|
+
* @public
|
11484
|
+
* @param {Object} groupDef Group definition object
|
11485
|
+
* @return {string} Return group ID
|
11486
|
+
*/
|
11487
|
+
GroupDefinitions.prototype.addGroup = function (groupDef) {
|
11488
|
+
var groupId = GroupDefinitions.getGroupId(groupDef);
|
11489
|
+
if(groupId) {
|
11490
|
+
return this.setGroup(groupId, groupDef);
|
10446
11491
|
}
|
11492
|
+
return groupId;
|
10447
11493
|
};
|
11494
|
+
/** @public
|
11495
|
+
* @param {string} groupId
|
11496
|
+
* @return {boolean}
|
11497
|
+
*/
|
11498
|
+
GroupDefinitions.prototype.removeGroup = function (groupId) {
|
11499
|
+
var curDef = this._groupMap[groupId];
|
11500
|
+
if(curDef) {
|
11501
|
+
this.removeAllChildren(groupId);
|
11502
|
+
this.removeGroupChild(groupId);
|
11503
|
+
delete this._groupMap[groupId];
|
10448
11504
|
|
10449
|
-
|
10450
|
-
* @private
|
10451
|
-
* @param {Object} e
|
10452
|
-
*/
|
10453
|
-
LayoutGrid.prototype._onMouseMove = function (e) {
|
10454
|
-
var target = e["target"];
|
10455
|
-
|
10456
|
-
var cellElement = util.closestElement(target, "cell");
|
10457
|
-
var colIndex = this._stretchedCells.getColumnIndex(cellElement);
|
10458
|
-
if(colIndex < 0) { // Not found colIndex in stretching cell, then get from normal row
|
10459
|
-
var colElement = util.closestElement(target, "column");
|
10460
|
-
colIndex = this.getColumnIndex(colElement);
|
11505
|
+
return true;
|
10461
11506
|
}
|
10462
|
-
|
10463
|
-
|
10464
|
-
this.setRowHighlight(rowIndex);
|
11507
|
+
return false;
|
10465
11508
|
};
|
11509
|
+
/** Replace and update existing group definition. New group is added if the given id has no match. Existing group will be removed of no new definition is given.
|
11510
|
+
* @public
|
11511
|
+
* @param {string} groupId
|
11512
|
+
* @param {Array.<string>|Object=} groupDef
|
11513
|
+
* @return {string} Return group Id. Return empty string if nothing has been changed.
|
11514
|
+
*/
|
11515
|
+
GroupDefinitions.prototype.setGroup = function (groupId, groupDef) {
|
11516
|
+
if(!groupId) {
|
11517
|
+
return "";
|
11518
|
+
}
|
10466
11519
|
|
10467
|
-
|
10468
|
-
|
10469
|
-
|
10470
|
-
*/
|
10471
|
-
LayoutGrid.prototype._onMouseOut = function (e) {
|
10472
|
-
var rel = e.relatedTarget;
|
10473
|
-
|
10474
|
-
if (rel) {
|
10475
|
-
var thisElem = this._element;
|
11520
|
+
if(groupDef) {
|
11521
|
+
var newDef = GroupDefinitions._toGroupDefinition(groupDef, groupId);
|
11522
|
+
this._ungroupChildren(newDef.children);
|
10476
11523
|
|
10477
|
-
|
10478
|
-
|
11524
|
+
var curDef = this._groupMap[groupId];
|
11525
|
+
if(curDef) { // Replace
|
11526
|
+
this.removeAllChildren(groupId);
|
11527
|
+
}
|
11528
|
+
var parentDef = this._childToParent[groupId];
|
11529
|
+
if(parentDef) {
|
11530
|
+
newDef.parentId = parentDef.id;
|
11531
|
+
}
|
11532
|
+
this._groupMap[groupId] = newDef;
|
10479
11533
|
|
10480
|
-
|
10481
|
-
|
11534
|
+
var chdr = newDef.children;
|
11535
|
+
var len = chdr.length;
|
11536
|
+
for(var i = 0; i < len; ++i) {
|
11537
|
+
var childId = chdr[i];
|
11538
|
+
this._childToParent[childId] = groupId;
|
11539
|
+
var childDef = this._groupMap[childId];
|
11540
|
+
if(childDef) {
|
11541
|
+
childDef.parentId = groupId;
|
10482
11542
|
}
|
10483
11543
|
}
|
11544
|
+
} else { // Remove
|
11545
|
+
if(!this.removeGroup(groupId)) {
|
11546
|
+
return "";
|
11547
|
+
}
|
10484
11548
|
}
|
10485
11549
|
|
10486
|
-
|
10487
|
-
};
|
10488
|
-
|
10489
|
-
/**
|
10490
|
-
* @private
|
10491
|
-
* @param {number} rowIndex
|
10492
|
-
*/
|
10493
|
-
LayoutGrid.prototype._updateSelectionUI = function (rowIndex) { // Update UI of the specified row index
|
10494
|
-
var selected = this._selectionList.getSelection(rowIndex);
|
10495
|
-
this._enableStretchCellClass(rowIndex, "selected-row", selected);
|
10496
|
-
this.enableRowClass(rowIndex, "selected-row", selected);
|
10497
|
-
};
|
10498
|
-
|
10499
|
-
/** @private
|
10500
|
-
* @param {number} rowIndex
|
10501
|
-
*/
|
10502
|
-
LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
|
10503
|
-
this._enableStretchCellClass(rowIndex, "selected-row", true);
|
10504
|
-
this.enableRowClass(rowIndex, "selected-row", true);
|
11550
|
+
return groupId;
|
10505
11551
|
};
|
10506
11552
|
|
10507
|
-
/**
|
11553
|
+
/** Remove each child from any group
|
10508
11554
|
* @private
|
10509
|
-
* @param {
|
10510
|
-
*/
|
10511
|
-
LayoutGrid.prototype._removeSelectionUI = function (rowIndex) {
|
10512
|
-
this._enableStretchCellClass(rowIndex, "selected-row", false);
|
10513
|
-
this.enableRowClass(rowIndex, "selected-row", false);
|
10514
|
-
};
|
10515
|
-
|
10516
|
-
/**
|
10517
|
-
* @public
|
10518
|
-
* @ignore
|
11555
|
+
* @param {Array.<string>} children
|
10519
11556
|
*/
|
10520
|
-
|
10521
|
-
if (
|
10522
|
-
|
10523
|
-
|
11557
|
+
GroupDefinitions.prototype._ungroupChildren = function(children) {
|
11558
|
+
if (Array.isArray(children)) {
|
11559
|
+
var len = children.length;
|
11560
|
+
for(var i = 0; i < len; ++i) {
|
11561
|
+
this.removeGroupChild(children[i]);
|
10524
11562
|
}
|
10525
|
-
|
10526
|
-
this._syncLayoutToColumns(0);
|
10527
|
-
this._initialized = true;
|
10528
11563
|
}
|
10529
11564
|
};
|
10530
11565
|
|
10531
|
-
/** @public
|
10532
|
-
* @ignore
|
10533
|
-
* @param {*} ctx
|
10534
|
-
*/
|
10535
|
-
LayoutGrid.prototype._setContext = function(ctx) {
|
10536
|
-
this._ctx = ctx;
|
10537
|
-
};
|
10538
11566
|
|
10539
11567
|
/** @public
|
10540
|
-
* @
|
10541
|
-
* @
|
11568
|
+
* @param {string} parentId Group id
|
11569
|
+
* @param {string} childId
|
11570
|
+
* @return {boolean}
|
10542
11571
|
*/
|
10543
|
-
|
10544
|
-
|
10545
|
-
};
|
11572
|
+
GroupDefinitions.prototype.addGroupChild = function (parentId, childId) {
|
11573
|
+
var groupDef = this._groupMap[parentId];
|
10546
11574
|
|
10547
|
-
|
10548
|
-
|
11575
|
+
if(childId && groupDef) {
|
11576
|
+
var chdr = groupDef.children;
|
11577
|
+
if(chdr && chdr.indexOf(childId) < 0) {
|
11578
|
+
this.removeGroupChild(childId); // Remove previous parent
|
11579
|
+
// Add new child to group structures
|
11580
|
+
this._childToParent[childId] = parentId;
|
11581
|
+
var childDef = this._groupMap[childId];
|
11582
|
+
if(childDef) {
|
11583
|
+
childDef.parentId = parentId;
|
11584
|
+
}
|
11585
|
+
chdr.push(childId);
|
11586
|
+
return true;
|
11587
|
+
}
|
11588
|
+
}
|
11589
|
+
return false;
|
11590
|
+
};
|
11591
|
+
/** Remove the given child from its own parent (i.e., unset Parent of the given child).
|
11592
|
+
* @public
|
11593
|
+
* @param {string} childId
|
11594
|
+
* @return {boolean}
|
10549
11595
|
*/
|
10550
|
-
|
10551
|
-
|
10552
|
-
|
10553
|
-
|
10554
|
-
|
11596
|
+
GroupDefinitions.prototype.removeGroupChild = function (childId) {
|
11597
|
+
var parentId = this._childToParent[childId];
|
11598
|
+
if(!parentId) {
|
11599
|
+
return false;
|
11600
|
+
}
|
11601
|
+
this._childToParent[childId] = "";
|
11602
|
+
var childDef = this._groupMap[childId];
|
11603
|
+
if(childDef) {
|
11604
|
+
childDef.parentId = "";
|
11605
|
+
}
|
11606
|
+
var parentDef = this._groupMap[parentId];
|
11607
|
+
if(parentDef) {
|
11608
|
+
var chdr = parentDef.children;
|
11609
|
+
if(chdr.length) {
|
11610
|
+
var at = chdr.indexOf(childId);
|
11611
|
+
if (at >= 0) {
|
11612
|
+
chdr.splice(at, 1); // splice is slow
|
11613
|
+
}
|
10555
11614
|
}
|
10556
11615
|
}
|
11616
|
+
return true;
|
10557
11617
|
};
|
10558
|
-
/**
|
11618
|
+
/** Remove all children from the specified group
|
11619
|
+
* @public
|
11620
|
+
* @param {string} groupId
|
11621
|
+
* @return {boolean}
|
10559
11622
|
*/
|
10560
|
-
|
10561
|
-
|
10562
|
-
|
11623
|
+
GroupDefinitions.prototype.removeAllChildren = function(groupId) {
|
11624
|
+
var grpDef = this._groupMap[groupId];
|
11625
|
+
if(grpDef) {
|
11626
|
+
var chdr = grpDef.children;
|
11627
|
+
var len = chdr.length;
|
11628
|
+
if(len) {
|
11629
|
+
grpDef.children = [];
|
11630
|
+
for(var i = 0; i < len; ++i) {
|
11631
|
+
var childId = chdr[i];
|
11632
|
+
if(this._childToParent[childId]) {
|
11633
|
+
this._childToParent[childId] = "";
|
11634
|
+
}
|
11635
|
+
var childDef = this._groupMap[childId];
|
11636
|
+
if(childDef) {
|
11637
|
+
childDef.parentId = "";
|
11638
|
+
}
|
11639
|
+
}
|
11640
|
+
return true;
|
11641
|
+
}
|
11642
|
+
}
|
11643
|
+
return false;
|
10563
11644
|
};
|
11645
|
+
/** Replace and update existing group definition.
|
11646
|
+
* @public
|
11647
|
+
* @param {string} groupId
|
11648
|
+
* @param {Array.<string>} newChildList If null is given, all existing children in the group will be removed
|
11649
|
+
* @return {boolean}
|
11650
|
+
*/
|
11651
|
+
GroupDefinitions.prototype.setGroupChildren = function (groupId, newChildList) {
|
11652
|
+
var groupDef = this._groupMap[groupId];
|
11653
|
+
if(groupDef) {
|
11654
|
+
if(Array.isArray(newChildList)) {
|
11655
|
+
var chdr = newChildList.slice();
|
11656
|
+
this._ungroupChildren(chdr);
|
11657
|
+
this.removeAllChildren(groupId);
|
11658
|
+
groupDef.children = chdr;
|
11659
|
+
|
11660
|
+
var parentId = groupDef.id;
|
11661
|
+
var len = chdr.length;
|
11662
|
+
for(var i = 0; i < len; ++i) {
|
11663
|
+
var childId = chdr[i];
|
11664
|
+
this._childToParent[childId] = parentId;
|
11665
|
+
var childDef = this._groupMap[childId];
|
11666
|
+
if(childDef) {
|
11667
|
+
childDef.parentId = parentId;
|
11668
|
+
}
|
11669
|
+
}
|
10564
11670
|
|
10565
|
-
|
11671
|
+
return true;
|
11672
|
+
} else if(!newChildList && groupDef.children.length) {
|
11673
|
+
this.removeAllChildren(groupId);
|
11674
|
+
return true;
|
11675
|
+
}
|
11676
|
+
}
|
11677
|
+
return false;
|
11678
|
+
};
|
10566
11679
|
|
10567
|
-
/* harmony default export */ const
|
11680
|
+
/* harmony default export */ const es6_GroupDefinitions = ((/* unused pure expression or super */ null && (GroupDefinitions)));
|
10568
11681
|
|
10569
11682
|
|
10570
11683
|
;// CONCATENATED MODULE: ./src/js/data/DataCache.js
|
@@ -23722,6 +24835,7 @@ VirtualizedLayoutGrid._proto = VirtualizedLayoutGrid.prototype;
|
|
23722
24835
|
|
23723
24836
|
;// CONCATENATED MODULE: ./src/js/grid/Core.js
|
23724
24837
|
|
24838
|
+
// eslint-disable-line
|
23725
24839
|
|
23726
24840
|
// eslint-disable-line
|
23727
24841
|
|
@@ -23797,6 +24911,9 @@ var Core_Core = function (opt_initializer) {
|
|
23797
24911
|
var _t = this;
|
23798
24912
|
|
23799
24913
|
// Initialize method binding
|
24914
|
+
_t.getColumnId = _t.getColumnId.bind(_t);
|
24915
|
+
_t.getColumnIndex = _t.getColumnIndex.bind(_t);
|
24916
|
+
|
23800
24917
|
_t._onMouseMove = _t._onMouseMove.bind(_t);
|
23801
24918
|
_t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
|
23802
24919
|
|
@@ -24244,6 +25361,10 @@ Core_Core.prototype._preserveGridSize = false;
|
|
24244
25361
|
* @private
|
24245
25362
|
*/
|
24246
25363
|
Core_Core.prototype._rowHeightTimerId = 0;
|
25364
|
+
/** @type {GroupDefinitions}
|
25365
|
+
* @private
|
25366
|
+
*/
|
25367
|
+
Core_Core.prototype._groupDefs = null;
|
24247
25368
|
//#region Public Methods
|
24248
25369
|
|
24249
25370
|
/**
|
@@ -24251,7 +25372,7 @@ Core_Core.prototype._rowHeightTimerId = 0;
|
|
24251
25372
|
* @return {string}
|
24252
25373
|
*/
|
24253
25374
|
Core_Core.getVersion = function () {
|
24254
|
-
return "5.1.
|
25375
|
+
return "5.1.34";
|
24255
25376
|
};
|
24256
25377
|
/** {@link ElementWrapper#dispose}
|
24257
25378
|
* @override
|
@@ -25379,7 +26500,7 @@ Core_Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
25379
26500
|
vEnd = this._colVirtualizer.getLastIndexInView();
|
25380
26501
|
}
|
25381
26502
|
|
25382
|
-
var colId = this.
|
26503
|
+
var colId = this.getColumnId(fromCol);
|
25383
26504
|
this._layoutX.moveLane(fromCol, destCol);
|
25384
26505
|
var sectionCount = this._settings.length;
|
25385
26506
|
for (var i = 0; i < sectionCount; ++i) {
|
@@ -25499,6 +26620,11 @@ Core_Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
25499
26620
|
// TODO: Load specific styles for each column type (e.g. "content", "title", "header")
|
25500
26621
|
|
25501
26622
|
var colDef = this._getColumnDef(index);
|
26623
|
+
var colId = jsonObj["id"];
|
26624
|
+
if(colId && typeof colId === "string") {
|
26625
|
+
colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
|
26626
|
+
}
|
26627
|
+
|
25502
26628
|
var value = jsonObj["dataColumnName"];
|
25503
26629
|
if (value != null) {
|
25504
26630
|
colDef["dataColumnName"] = value;
|
@@ -26942,14 +28068,19 @@ Core_Core.prototype.getRelativePosition = function (obj, context) {
|
|
26942
28068
|
return ret_obj;
|
26943
28069
|
};
|
26944
28070
|
|
26945
|
-
/**
|
26946
|
-
* @
|
26947
|
-
* @
|
28071
|
+
/** Find column index by column id or data column name
|
28072
|
+
* @public
|
28073
|
+
* @param {string} str Column id or data column name
|
28074
|
+
* @return {number} Return negative value if there is no match
|
26948
28075
|
*/
|
26949
28076
|
Core_Core.prototype.getColumnIndex = function (str) {
|
26950
|
-
|
26951
|
-
|
26952
|
-
|
28077
|
+
if(str) {
|
28078
|
+
var colCount = this.getColumnCount();
|
28079
|
+
for(var c = 0; c < colCount; ++c) {
|
28080
|
+
var colDef = this._getColumnDef(c);
|
28081
|
+
if(str === colDef["id"] || str === colDef["dataColumnName"]) {
|
28082
|
+
return c;
|
28083
|
+
}
|
26953
28084
|
}
|
26954
28085
|
}
|
26955
28086
|
return -1;
|
@@ -27834,6 +28965,37 @@ Core_Core.prototype.normalizeConfig = function (configObj) {
|
|
27834
28965
|
|
27835
28966
|
return configObj;
|
27836
28967
|
};
|
28968
|
+
/** @public
|
28969
|
+
* @param {GroupDefinitions} groupDefs
|
28970
|
+
*/
|
28971
|
+
Core_Core.prototype.setColumnGrouping = function (groupDefs) {
|
28972
|
+
this._groupDefs = groupDefs || null;
|
28973
|
+
};
|
28974
|
+
/** @public
|
28975
|
+
* @param {string|number} colRef
|
28976
|
+
* @return {string} Return group id of immediate group parent. Return empty string, if no parent is found.
|
28977
|
+
*/
|
28978
|
+
Core_Core.prototype.getColumnGroupParentId = function (colRef) {
|
28979
|
+
if(this._groupDefs) {
|
28980
|
+
var colId = (typeof colRef === "number") ? this.getColumnId(colRef) : colRef;
|
28981
|
+
return this._groupDefs.getParentId(colId);
|
28982
|
+
}
|
28983
|
+
return "";
|
28984
|
+
};
|
28985
|
+
|
28986
|
+
/** @public
|
28987
|
+
* @param {string} groupId
|
28988
|
+
* @return {Array.<string>} Return array of column id. Return null if the specified group has no child
|
28989
|
+
*/
|
28990
|
+
Core_Core.prototype.getColumnGroupChildIds = function (groupId) {
|
28991
|
+
if(this._groupDefs) {
|
28992
|
+
var ary = this._groupDefs.getLeafDescendants(groupId);
|
28993
|
+
if(ary && ary.length > 0) {
|
28994
|
+
return ary;
|
28995
|
+
}
|
28996
|
+
}
|
28997
|
+
return null;
|
28998
|
+
};
|
27837
28999
|
//#endregion Public Methods
|
27838
29000
|
|
27839
29001
|
//#region Private Methods
|
@@ -28491,13 +29653,35 @@ Core_Core.prototype._getNestedColumnDef = function (colIndex, firstLvl, secondLv
|
|
28491
29653
|
}
|
28492
29654
|
return def;
|
28493
29655
|
};
|
29656
|
+
|
28494
29657
|
/** @public
|
29658
|
+
* @param {number} colIndex
|
29659
|
+
* @return {string} Return empty string if the specified column does not exist
|
29660
|
+
*/
|
29661
|
+
Core_Core.prototype.getColumnId = function (colIndex) {
|
29662
|
+
if(colIndex >= 0 && colIndex < this.getColumnCount()) {
|
29663
|
+
return this._getColumnDef(colIndex)["id"] || "";
|
29664
|
+
}
|
29665
|
+
return "";
|
29666
|
+
};
|
29667
|
+
/** @deprecated
|
29668
|
+
* @public
|
29669
|
+
* @function
|
28495
29670
|
* @ignore
|
28496
29671
|
* @param {number} colIndex
|
28497
29672
|
* @return {string}
|
28498
29673
|
*/
|
28499
|
-
Core_Core.prototype._getColumnId =
|
28500
|
-
|
29674
|
+
Core_Core.prototype._getColumnId = Core_Core.prototype.getColumnId;
|
29675
|
+
/** @public
|
29676
|
+
* @return {!Array.<string>} Return all column ids from existing column
|
29677
|
+
*/
|
29678
|
+
Core_Core.prototype.getColumnIds = function () {
|
29679
|
+
var colCount = this.getColumnCount();
|
29680
|
+
var ary = new Array(colCount);
|
29681
|
+
for(var c = 0; c < colCount; ++c) {
|
29682
|
+
ary[c] = this._getColumnDef(c)["id"] || "";
|
29683
|
+
}
|
29684
|
+
return ary;
|
28501
29685
|
};
|
28502
29686
|
|
28503
29687
|
|
@@ -30969,5 +32153,7 @@ grid.SortableTitlePlugin = plugins_SortableTitlePlugin;
|
|
30969
32153
|
|
30970
32154
|
/* harmony default export */ const src = ((/* unused pure expression or super */ null && (Core)));
|
30971
32155
|
|
32156
|
+
})();
|
32157
|
+
|
30972
32158
|
/******/ })()
|
30973
32159
|
;
|