@refinitiv-ui/efx-grid 6.0.40 → 6.0.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +2 -1
  2. package/lib/column-selection-dialog/lib/column-selection-dialog.js +23 -7
  3. package/lib/core/dist/core.js +846 -881
  4. package/lib/core/dist/core.min.js +1 -1
  5. package/lib/core/es6/grid/Core.d.ts +4 -0
  6. package/lib/core/es6/grid/Core.js +91 -27
  7. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +3 -2
  8. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +26 -26
  9. package/lib/core/es6/grid/util/util.js +25 -9
  10. package/lib/grid/index.js +1 -1
  11. package/lib/rt-grid/dist/rt-grid.js +2253 -1755
  12. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  13. package/lib/rt-grid/es6/Grid.d.ts +22 -0
  14. package/lib/rt-grid/es6/Grid.js +146 -11
  15. package/lib/rt-grid/es6/RowDefinition.d.ts +2 -2
  16. package/lib/rt-grid/es6/RowDefinition.js +37 -18
  17. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +4 -0
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +60 -59
  19. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +9 -3
  20. package/lib/tr-grid-column-stack/es6/ColumnStack.js +290 -364
  21. package/lib/tr-grid-util/es6/CellPainter.d.ts +2 -1
  22. package/lib/tr-grid-util/es6/CellPainter.js +6 -4
  23. package/lib/tr-grid-util/es6/DateTime.js +3 -3
  24. package/lib/tr-grid-util/es6/ExpressionParser.d.ts +10 -0
  25. package/lib/tr-grid-util/es6/ExpressionParser.js +366 -0
  26. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +10 -6
  27. package/lib/tr-grid-util/es6/FilterBuilder.js +264 -234
  28. package/lib/tr-grid-util/es6/FilterOperators.d.ts +3 -1
  29. package/lib/tr-grid-util/es6/FilterOperators.js +51 -2
  30. package/lib/tr-grid-util/es6/GridPlugin.js +1 -1
  31. package/lib/tr-grid-util/es6/Util.d.ts +0 -3
  32. package/lib/tr-grid-util/es6/Util.js +0 -53
  33. package/lib/tr-grid-util/es6/formula/Formula.js +3 -3
  34. package/lib/types/es6/ColumnDragging.d.ts +51 -0
  35. package/lib/types/es6/ColumnGrouping.d.ts +4 -0
  36. package/lib/types/es6/ColumnStack.d.ts +9 -3
  37. package/lib/types/es6/Core/grid/Core.d.ts +4 -0
  38. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +3 -2
  39. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  40. package/lib/types/es6/Extensions.d.ts +3 -1
  41. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -2
  42. package/lib/types/es6/index.d.ts +1 -0
  43. package/lib/versions.json +4 -4
  44. package/package.json +1 -1
@@ -1,644 +1,6 @@
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 */ "Qr": () => (/* binding */ isEmptyObject),
10
- /* harmony export */ "kI": () => (/* binding */ cloneObject)
11
- /* harmony export */ });
12
- /* unused harmony exports Util, extendObject, deepEqual, arrayToObject, extendProperty, extendArrayProperty, parseCondition, prettifyCss, getShadowRoot, injectCss, isIE, isMac, isTouchDevice, nestedObjectToArray, rgb2Hex, prepareTSVContent */
13
- /** @namespace */
14
- var Util = {};
15
-
16
- /** This is a shorthand for fetch() API by POST method and with json body <br>
17
- * WARNING: fetch is not supported in IE (including IE11)
18
- * @public
19
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
20
- * @function
21
- * @param {string} url
22
- * @param {Object|string} obj
23
- * @return {!Promise<Response>}
24
- */
25
- Util.post = function(url, obj) { // Not supported in IE
26
- return Util._post(url, obj).then(Util.toJSON);
27
- };
28
- /** Request a server response from server as text by POST method <br>
29
- * WARNING: fetch is not supported in IE (including IE11)
30
- * @public
31
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
32
- * @function
33
- * @param {string} url
34
- * @param {Object|string} obj
35
- * @return {!Promise<Response>}
36
- */
37
- Util.requestText = function(url, obj) { // Not supported in IE
38
- return Util._post(url, obj, "text/plain").then(Util.toText);
39
- };
40
- /** Request a server response from server by POST method and with url-encoded body <br>
41
- * WARNING: fetch is not supported in IE (including IE11)
42
- * @public
43
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
44
- * @function
45
- * @param {string} url
46
- * @param {string} obj
47
- * @return {!Promise<Response>}
48
- */
49
- Util.requestByUrlEncoded = function(url, obj) { // Not supported in IE
50
- return Util._post(url, obj, "application/x-www-form-urlencoded").then(Util.toJSON);
51
- };
52
-
53
- /** @public
54
- * @function
55
- * @param {Response} resp
56
- * @return {!Promise<Object>}
57
- */
58
- Util.toJSON = function (resp) {
59
- if(Util._logError(resp)) {
60
- return Promise.reject(resp);
61
- }
62
- return resp.json();
63
- };
64
- /** @public
65
- * @function
66
- * @param {Response} resp
67
- * @return {!Promise<string>}
68
- */
69
- Util.toText = function (resp) {
70
- if(Util._logError(resp)) {
71
- return Promise.reject(resp);
72
- }
73
- return resp.text();
74
- };
75
-
76
- /** @private
77
- * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
78
- * @function
79
- * @param {Response} resp
80
- * @return {boolean}
81
- */
82
- Util._logError = function(resp) {
83
- if(resp && resp.status >= 300) {
84
- console.log("Response " + resp.status + ": " + resp.statusText);
85
- return true;
86
- }
87
- return false;
88
- };
89
- /** @private
90
- * @function
91
- * @param {string} url
92
- * @param {Object|string} obj
93
- * @param {string=} contentType
94
- * @return {!Promise<Response>}
95
- */
96
- Util._post = function(url, obj, contentType) {
97
- var options = {
98
- method: obj ? "POST" : "GET",
99
- headers: { "Content-Type": contentType || "application/json" }
100
- };
101
- if(obj) {
102
- options.body = typeof obj === "string" ? obj : JSON.stringify(obj);
103
- }
104
-
105
- return fetch(url, options);
106
- };
107
-
108
- /** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
109
- * Property with undefined or null value will not have an impact on the object. <br>
110
- * Existing properties will be overridden.
111
- * @public
112
- * @function
113
- * @param {Object} obj Object that is extended (new properties will be added to this object)
114
- * @param {Object=} extender Master object (no modification will be made on the extender)
115
- * @param {Array.<string>=} limiters Specify property to be extended
116
- * @return {Object}
117
- */
118
- var extendObject = function (obj, extender, limiters) {
119
- if(!obj) { // null undefined NaN empty string and 0
120
- return null;
121
- }
122
- if(!extender || obj === extender) {
123
- return obj;
124
- }
125
-
126
- var key;
127
- if(limiters) {
128
- var len = limiters.length;
129
- for(var i = 0; i < len; ++i) {
130
- key = limiters[i];
131
- if(key) {
132
- extendProperty(obj, extender, key);
133
- }
134
- }
135
- } else {
136
- for(key in extender) {
137
- extendProperty(obj, extender, key);
138
- }
139
- }
140
- return obj;
141
- };
142
- /** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
143
- * Property with undefined or null value will not be cloned.
144
- * @public
145
- * @function
146
- * @param {Object} obj
147
- * @param {Array.<string>=} limiters
148
- * @return {Object}
149
- */
150
- var cloneObject = function (obj, limiters) {
151
- return extendObject({}, obj, limiters);
152
- };
153
-
154
- /** Check empty object
155
- * @public
156
- * @function
157
- * @param {Object} obj
158
- * @return {boolean}=true, if the obj is empty
159
- */
160
- var isEmptyObject = function (obj) {
161
- for (var key in obj) {
162
- return false;
163
- }
164
- return true;
165
- };
166
-
167
- /** @public
168
- * @param {Array=} data
169
- * @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
170
- * @return {Object|null}
171
- */
172
- var arrayToObject = function(data, fields) {
173
- if(!Array.isArray(data)) {
174
- return data;
175
- } else if(!fields) {
176
- return null;
177
- }
178
- var ary = data;
179
- data = {};
180
- var len = ary.length;
181
- for(var i = 0; i < len; ++i) {
182
- var field = fields[i];
183
- // eslint-disable-next-line no-undefined
184
- if(field && ary[i] !== undefined) {
185
- data[field] = ary[i];
186
- }
187
- }
188
- return data;
189
- };
190
- /** 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
191
- * @public
192
- * @function
193
- * @param {Object} obj
194
- * @param {Object} extender
195
- * @param {string} propName
196
- * @example
197
- * extendProperty({a: 0}, {a: 1}, "a"); // {a: 1}
198
- * extendProperty({a: 0}, {b: 1}, "b"); // {a: 0, b: 1}
199
- * extendProperty({a: [0]}, {a: 1}, "a"); // {a: [0, 1]}
200
- * extendProperty({a: [0]}, {a: [1, 2]}, "a"); // {a: [0, 1, 2]}
201
- */
202
- var extendProperty = function (obj, extender, propName) {
203
- var val = extender[propName];
204
- if(val != null) {
205
- var objVal = obj[propName];
206
- if(Array.isArray(objVal)) {
207
- obj[propName] = objVal.concat(val);
208
- } else if(Array.isArray(val) && objVal) {
209
- obj[propName] = val.concat(objVal); // TODO: Preserve the order
210
- } else {
211
- obj[propName] = val; // WARNING: Overriding existing data
212
- }
213
- }
214
- };
215
-
216
-
217
- /** Compare the values of obj1 and obj2. if they are the same object or have the same value, the result will be true. Otherwise, it will return false.
218
- * @public
219
- * @param {*} obj1
220
- * @param {*} obj2
221
- * @return {boolean}
222
- */
223
- var deepEqual = function (obj1, obj2) {
224
-
225
- if(obj1 === obj2) {
226
- return true;
227
- }
228
-
229
- if (typeof obj1 !== typeof obj2) {
230
- return false;
231
- }
232
-
233
- if (typeof obj1 === "object") {
234
-
235
- // We need to split array and object for performance reason
236
- if(Array.isArray(obj1)) {
237
- if(obj1.length !== obj2.length) {
238
- return false;
239
- }
240
-
241
- for (var i = 0; i < obj1.length; i++) {
242
- if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
243
- return false;
244
- }
245
- }
246
-
247
- } else {
248
-
249
- if (Object.keys(obj1).length !== Object.keys(obj2).length) {
250
- return false;
251
- }
252
-
253
- for (var key in obj1) {
254
- if (!deepEqual(obj1[key], obj2[key])) {
255
- return false;
256
- }
257
- }
258
- }
259
-
260
-
261
- return true;
262
- }
263
-
264
- return false;
265
-
266
- };
267
- /** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
268
- * This method excels in extending known array property in an object.
269
- * @public
270
- * @function
271
- * @param {Object} obj
272
- * @param {string} propName
273
- * @param {*} ary
274
- * @return {Array} Returns the result of the extended array
275
- * @see {@link https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki}
276
- * @example
277
- * var obj = {};
278
- * extendArrayProperty(obj, "prop1", 1); // [1]
279
- * extendArrayProperty(obj, "prop1", 2); // [1, 2]
280
- * extendArrayProperty(obj, "prop1", [3, 4]); // [1, 2, 3, 4]
281
- * obj.prop2 = 5;
282
- * extendArrayProperty(obj, "prop2", 6); // [5, 6]
283
- * extendArrayProperty(obj, "prop2", [7]); // [5, 6, 7]
284
- * extendArrayProperty(obj, "prop2", null); // null
285
- */
286
- var extendArrayProperty = function (obj, propName, ary) {
287
- var objAry = null;
288
- if(ary) {
289
- var objVal = obj[propName];
290
- if(objVal) {
291
- if(Array.isArray(objVal)) {
292
- objAry = objVal;
293
- } else {
294
- objAry = obj[propName] = [objVal];
295
- }
296
- } else {
297
- objAry = obj[propName] = [];
298
- }
299
- // objAry is guaranteed to be an array at this point
300
-
301
- if(Array.isArray(ary)) {
302
- if(ary.length) {
303
- if(ary.length > 1) {
304
- Array.prototype.push.apply(objAry, ary);
305
- } else {
306
- objAry.push(ary[0]);
307
- }
308
- }
309
- } else {
310
- objAry.push(ary);
311
- }
312
- }
313
- return objAry;
314
- };
315
-
316
-
317
- /** Regex for matching the field token E.g. '[CF_BID]'
318
- * @type {!RegExp}
319
- * @private
320
- * @const
321
- */
322
- var _bracketExp = (/* unused pure expression or super */ null && (new RegExp(/\[[^\[]*\]/g))); // eslint-disable-line no-useless-escape
323
- /** @public
324
- * @function
325
- * @param {string|Function} expression
326
- * @return {Function}
327
- * @example
328
- * var fn = parseCondition("[CF_BID] >= 10 && [CF_BID] <= 100");
329
- * window.console.log(fn(25));
330
- */
331
- var parseCondition = function(expression) {
332
- if(!expression) {
333
- return null;
334
- }
335
- if(typeof expression !== "string") {
336
- return (typeof expression == "function") ? /** @type {Function} */(expression) : null;
337
- }
338
-
339
- var brackets = expression.match(_bracketExp); // Retrieving field tokens (anything in between brackets)
340
- var map = {}; // For checking duplication
341
- var fields = [];
342
- var len = brackets ? brackets.length : 0;
343
- for(var i = len; --i >= 0;) {
344
- var field = brackets[i];
345
- if(!map[field]) {
346
- map[field] = "f[" + fields.length + "]"; // Create mapping of field token to array with index E.g. { "[CF_BID]": "f[0]" }
347
- fields.push(field.substring(1, field.length - 1)); // Strip '[' and ']' of field token to get field name
348
- }
349
- }
350
-
351
- // Replace the field tokens with rowData of array with index E.g. [CF_BID] ==> rowData[f[0]]
352
- expression = expression.replace(_bracketExp, function(match) {
353
- return "rowData[" + map[match] + "]";
354
- });
355
- var finalExp = "(function(f, rowData) { return (" + expression + "); })";
356
-
357
- var fn = null;
358
- try {
359
- fn = eval(finalExp);
360
- fn = fn.bind(null, fields); // Bind fields for matching field name
361
- } catch(err) {
362
- console.log(err.message);
363
- }
364
- return (fn) ? fn : null;
365
- };
366
-
367
-
368
- /** @private
369
- * @param {string|Array.<string>} item
370
- * @return {string}
371
- */
372
- var _encloseBracket = function(item) {
373
- return Array.isArray(item) ? "{\n" + item.join("\n") + "\n}" : item;
374
- };
375
- /** @private
376
- * @param {string} str
377
- * @return {string}
378
- */
379
- var _indentBracketContent = function(str){
380
- return str.replace(/\n+/g, "\n\t").replace(/\n\t}$/, "\n}");
381
- };
382
- /** @public
383
- * @param {string|Array} css
384
- * @return {string} prettified CSS string
385
- * @example
386
- * prettifyCss(["div", [
387
- * "color: red;",
388
- * "padding: 20px;"
389
- * ],
390
- * ".class", [
391
- * "margin: 0;"
392
- * ]
393
- * ]);
394
- */
395
- var prettifyCss = function(css) {
396
- if(css) {
397
- var cssStr = "";
398
- if (Array.isArray(css)) {
399
- var ary = css.map(_encloseBracket);
400
- cssStr = ary.join("\n").replace(/{\s*{/g, "{").replace(/\s+{/g, " {");
401
- } else {
402
- cssStr = (typeof css === "string") ? css : css + "";
403
- }
404
-
405
- if(cssStr) {
406
- return cssStr.replace(/{[\w\W]*?}/g, _indentBracketContent);
407
- }
408
- }
409
- return "";
410
- };
411
- /** 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.
412
- * @public
413
- * @param {Element} elem
414
- * @return {DocumentFragment}
415
- */
416
- var getShadowRoot = function(elem) {
417
- if(elem) {
418
- var rootNode;
419
- if(elem.shadowRoot) {
420
- rootNode = elem.shadowRoot;
421
- } else if(elem.getRootNode) {
422
- rootNode = elem.getRootNode();
423
- }
424
- if(rootNode) { // getRootNode does not supported in IE. It should be implemented by the polyfills
425
- if(rootNode !== document) { // element that is in the DOM and not in the shadow has document as its root node
426
- if(rootNode !== elem) { // element that is NOT in the DOM and not in the shadow has itself as its root node
427
- return rootNode;
428
- }
429
- }
430
- }
431
- }
432
- return null;
433
- };
434
- /** Attach style tag to the proper document (in case of element inside a shadow root)
435
- * @public
436
- * @param {string} cssStr Valid CSS string (e.g. "div {color: red;}")
437
- * @param {Element=} targetContext Element that needs the CSS
438
- * @return {Element} New style tag
439
- */
440
- var injectCss = function(cssStr, targetContext) {
441
- if(!cssStr) {
442
- return null;
443
- }
444
-
445
- var styleTag = document.createElement("style");
446
- styleTag.textContent = "\n" + cssStr + "\n";
447
-
448
- var styleHost = getShadowRoot(targetContext);
449
- var isInShadow = true;
450
- if(!styleHost) {
451
- isInShadow = false;
452
- styleHost = document.head;
453
- }
454
-
455
- // Find a place to insert the style tag
456
- var beforeElem;
457
- if(isInShadow) {
458
- if(styleHost.children && styleHost.children.length) {
459
- beforeElem = styleHost.children[0];
460
- }
461
- }
462
- if(beforeElem) {
463
- styleHost.insertBefore(styleTag, beforeElem);
464
- } else {
465
- styleHost.appendChild(styleTag);
466
- }
467
- return styleTag;
468
- };
469
-
470
- /** return true if browser is IE or Edge
471
- * @public
472
- * @return {boolean}
473
- */
474
- var isIE = function () {
475
- var ua = window.navigator.userAgent;
476
- return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
477
- };
478
-
479
- /** return true if device is mac
480
- * @public
481
- * @return {boolean}
482
- */
483
- var isMac = function () {
484
- return /Mac/.test(navigator.platform);
485
- };
486
-
487
- /** Return true if device is mac
488
- * @public
489
- * @return {boolean}
490
- */
491
- var isTouchDevice = function () {
492
- if ((navigator["maxTouchPoints"] && navigator["maxTouchPoints"] < 256) ||
493
- (navigator["msMaxTouchPoints"] && navigator["msMaxTouchPoints"] < 256)) {
494
- return true;
495
- }
496
- return false;
497
- };
498
-
499
- /** parse nested object in to array
500
- * @public
501
- * @param {Object} obj
502
- * @param {Array=} ary
503
- * @return {Array}
504
- */
505
- var nestedObjectToArray = function (obj, ary) {
506
- if (!ary) {
507
- ary = [];
508
- }
509
- for (var key in obj) {
510
- var element = obj[key];
511
- if ('object' === typeof element) {
512
- nestedObjectToArray(element, ary);
513
- } else {
514
- ary.push(element);
515
- }
516
- }
517
- return ary;
518
- };
519
-
520
- /** Convert CSS rgb or rgba formats to CSS hex color string (# prefix)
521
- * @public
522
- * @param {string} rgbCode
523
- * @return {string}
524
- * @example
525
- * rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
526
- * rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
527
- * rgb2Hex("255 255.0"); // "#FFFF00"
528
- * rgb2Hex("#FFFF00"); // "#FFFF00"
529
- * rgb2Hex("#1a1a1a"); // "#1a1a1a"
530
- * rgb2Hex("2552550"); // "2552550"
531
- * rgb2Hex("invalid"); // "invalid"
532
- * rgb2Hex(null); // ""
533
- */
534
- var rgb2Hex = function (rgbCode) {
535
- if(!rgbCode || typeof rgbCode !== "string") {
536
- return "";
537
- }
538
- if(rgbCode.charAt(0) === "#") {
539
- return rgbCode;
540
- }
541
- var rgb = rgbCode.match(/\d+/g);
542
- if(!rgb || rgb.length < 3) {
543
- return rgbCode;
544
- }
545
-
546
- var hex = "#";
547
- for(var i = 0; i < 3; i++) {
548
- var num = +rgb[i];
549
- if(!(num >= 16)) { // Handle NaN case
550
- hex += "0";
551
- }
552
- hex += (num) ? num.toString(16).toUpperCase() : "0";
553
- }
554
- return hex;
555
- };
556
-
557
- /** transform data to tab seperated value
558
- * @public
559
- * @param {*} data
560
- * @return {string}
561
- */
562
- var prepareTSVContent = function (data) {
563
- if (data == null) {
564
- return "";
565
- }
566
-
567
- var content = (typeof data === 'string') ? data : data.toString();
568
-
569
- if (!content.length) { return ""; }
570
-
571
- // Replace any new line and tab
572
- if (content.indexOf("\n") >= 0) {
573
- content = content.replace(/[\r\n]/g, " ");
574
- }
575
-
576
- if (content.indexOf("\t") >= 0) {
577
- content = content.replace(/\t/g, " ");
578
- }
579
-
580
- // Trim front and back spaces
581
- if (content.charAt(0) === " " || content.charAt(content.length - 1) === " ") {
582
- content = content.trim();
583
- }
584
-
585
- return content;
586
- };
587
-
588
- /* unused harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = ((/* unused pure expression or super */ null && (Util)));
589
-
590
-
591
-
592
- /***/ })
593
-
594
- /******/ });
595
- /************************************************************************/
596
- /******/ // The module cache
597
- /******/ var __webpack_module_cache__ = {};
598
- /******/
599
- /******/ // The require function
600
- /******/ function __webpack_require__(moduleId) {
601
- /******/ // Check if module is in cache
602
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
603
- /******/ if (cachedModule !== undefined) {
604
- /******/ return cachedModule.exports;
605
- /******/ }
606
- /******/ // Create a new module (and put it into the cache)
607
- /******/ var module = __webpack_module_cache__[moduleId] = {
608
- /******/ // no module.id needed
609
- /******/ // no module.loaded needed
610
- /******/ exports: {}
611
- /******/ };
612
- /******/
613
- /******/ // Execute the module function
614
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
615
- /******/
616
- /******/ // Return the exports of the module
617
- /******/ return module.exports;
618
- /******/ }
619
- /******/
620
- /************************************************************************/
621
- /******/ /* webpack/runtime/define property getters */
622
- /******/ (() => {
623
- /******/ // define getter functions for harmony exports
624
- /******/ __webpack_require__.d = (exports, definition) => {
625
- /******/ for(var key in definition) {
626
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
627
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
628
- /******/ }
629
- /******/ }
630
- /******/ };
631
- /******/ })();
632
- /******/
633
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
634
- /******/ (() => {
635
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
636
- /******/ })();
637
- /******/
638
- /************************************************************************/
639
3
  var __webpack_exports__ = {};
640
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
641
- (() => {
642
4
 
643
5
  // 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
644
6
 
@@ -647,23 +9,46 @@ var __webpack_exports__ = {};
647
9
  * @namespace
648
10
  */
649
11
  var Util = {};
12
+
13
+ // TODO: move to tr-grid-util
14
+
650
15
  /** @const
651
16
  * @type {boolean}
652
17
  */
653
- Util.isIE = Util.isIE || (function () {
18
+ Util.isIE = (function () {
654
19
  var ua = window.navigator.userAgent;
655
20
  return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
656
21
  }());
657
22
  /** @const
658
23
  * @type {boolean}
659
24
  */
660
- Util.isTouchDevice = Util.isTouchDevice || (function () {
25
+ Util.isTouchDevice = (function () {
661
26
  if ((navigator["maxTouchPoints"] && navigator["maxTouchPoints"] < 256) ||
662
27
  (navigator["msMaxTouchPoints"] && navigator["msMaxTouchPoints"] < 256)) {
663
28
  return true;
664
29
  }
665
30
  return false;
666
31
  }());
32
+ /** @const
33
+ * @type {boolean}
34
+ */
35
+ Util.isSafari = (function () {
36
+ var rejectedExpression = /Chrome|Android|CriOS|FxiOS|EdgiOS/i;
37
+ var safariExpression = /Safari/i;
38
+ var agent = navigator.userAgent;
39
+ if (rejectedExpression.test(agent)) {
40
+ return false;
41
+ }
42
+ return safariExpression.test(agent);
43
+ }());
44
+
45
+ /** @public
46
+ * @type {boolean}
47
+ */
48
+ Util.isMobile = (function () {
49
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
50
+ }());
51
+
667
52
  /** Retrieve an element from Novakit control or any object that has "getElement" method.
668
53
  * @public
669
54
  * @ignore
@@ -1009,13 +394,6 @@ Util._preventDefault = function (e) {
1009
394
  e.stopPropagation();
1010
395
  };
1011
396
 
1012
- /** @public
1013
- * @type {boolean}
1014
- */
1015
- Util.isMobile = Util.isMobile || (function () {
1016
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1017
- }());
1018
-
1019
397
  /* harmony default export */ const util = (Util);
1020
398
 
1021
399
 
@@ -11229,236 +10607,761 @@ LayoutGrid.prototype._dispatchRowHeightChangedEvent = function (from, to) {
11229
10607
  if (from >= to) {
11230
10608
  return;
11231
10609
  }
11232
-
11233
- var e = {};
11234
-
11235
- e["rowIndex"] = from;
11236
- e["changeLength"] = to - from;
11237
- this._dispatch("rowHeightChanged", e);
10610
+
10611
+ var e = {};
10612
+
10613
+ e["rowIndex"] = from;
10614
+ e["changeLength"] = to - from;
10615
+ this._dispatch("rowHeightChanged", e);
10616
+ };
10617
+
10618
+ /**
10619
+ * @private
10620
+ * @param {number} indexX
10621
+ * @param {number} indexY
10622
+ * @param {CellSpan} cellSpan
10623
+ */
10624
+ LayoutGrid.prototype._updateCellSpanSize = function (indexX, indexY, cellSpan) {
10625
+ var cell = this._getCell(indexX, indexY);
10626
+
10627
+ if (cell == null) {
10628
+ return;
10629
+ }
10630
+
10631
+ if (cellSpan && cellSpan.colSpan > 1) {
10632
+ cell.setWidth(this.getCellWidth(indexX, indexY));
10633
+ this._columns[indexX].disableDeactivation(); // HACK: If a cell has column span, the column cannot be virtualized
10634
+ } else {
10635
+ cell.setWidth(-1);
10636
+ }
10637
+
10638
+ if (cellSpan && cellSpan.rowSpan > 1) {
10639
+ cell.setHeight(this.getCellHeight(indexX, indexY)); /////
10640
+ } else {
10641
+ var height = this._trackY.isAtDefaultSize(indexY) ? -1 : this._trackY.getLaneSize(indexY);
10642
+
10643
+ cell.setHeight(height);
10644
+ }
10645
+ };
10646
+
10647
+ /**
10648
+ * @private
10649
+ * @param {Array.<CellSpan>} cellSpans
10650
+ */
10651
+ LayoutGrid.prototype._updateCellSpanLayout = function (cellSpans) {
10652
+ if (cellSpans == null) { return; }
10653
+
10654
+ for (var i = cellSpans.length; --i >= 0; ) {
10655
+ var cellSpan = cellSpans[i];
10656
+
10657
+ this._updateCellSpanSize(cellSpan.indexX, cellSpan.indexY, cellSpan);
10658
+ }
10659
+ };
10660
+
10661
+ /**
10662
+ * @private
10663
+ * @param {number} indexX
10664
+ * @param {number} indexY
10665
+ * @param {!CellSpan} cellSpan
10666
+ * @param {boolean} adding
10667
+ */
10668
+ LayoutGrid.prototype._updateCellSpan = function (indexX, indexY, cellSpan, adding) {
10669
+ this._updateCellSpanSize(indexX, indexY, adding ? cellSpan : null);
10670
+ this._updateCellSpanClass(indexX, indexY, cellSpan.colSpan, cellSpan.rowSpan, adding);
10671
+ };
10672
+
10673
+ /**
10674
+ * @private
10675
+ * @param {number} indexX
10676
+ * @param {number} indexY
10677
+ * @param {number} colSpan
10678
+ * @param {number} rowSpan
10679
+ * @param {boolean} adding
10680
+ */
10681
+ LayoutGrid.prototype._updateCellSpanClass = function (indexX, indexY, colSpan, rowSpan, adding) {
10682
+ var column;
10683
+
10684
+ for (var c = 0; c < colSpan; ++c) {
10685
+ column = this._columns[indexX + c];
10686
+
10687
+ if (!column) {
10688
+ break;
10689
+ }
10690
+
10691
+ column.collapseCells(indexY, rowSpan, adding, (c === 0), (c > 0));
10692
+ }
10693
+
10694
+ var cell = this._getCell(indexX, indexY);
10695
+
10696
+ if (cell) {
10697
+ cell._colSpan = (adding) ? colSpan : 1;
10698
+ cell._rowSpan = (adding) ? rowSpan : 1; // For quick rendering
10699
+ }
10700
+ };
10701
+
10702
+ /**
10703
+ * @private
10704
+ * @param {Array.<CellSpan>} cellSpans
10705
+ * @param {boolean} adding
10706
+ */
10707
+ LayoutGrid.prototype._updateCellSpans = function (cellSpans, adding) {
10708
+ if (cellSpans == null) { return; }
10709
+
10710
+ for (var i = cellSpans.length; --i >= 0; ) {
10711
+ var cellSpan = cellSpans[i];
10712
+
10713
+ this._updateCellSpan(cellSpan.indexX, cellSpan.indexY, cellSpan, adding);
10714
+ }
10715
+ };
10716
+
10717
+ /**
10718
+ * @private
10719
+ * @param {Object} e
10720
+ */
10721
+ LayoutGrid.prototype._onMouseMove = function (e) {
10722
+ var target = e["target"];
10723
+
10724
+ var cellElement = util.closestElement(target, "cell");
10725
+ var colIndex = this._stretchedCells.getColumnIndex(cellElement);
10726
+ if(colIndex < 0) { // Not found colIndex in stretching cell, then get from normal row
10727
+ var colElement = util.closestElement(target, "column");
10728
+ colIndex = this.getColumnIndex(colElement);
10729
+ }
10730
+ var rowIndex = this.getCellIndex(colIndex, cellElement);
10731
+
10732
+ this.setRowHighlight(rowIndex);
10733
+ };
10734
+
10735
+ /**
10736
+ * @private
10737
+ * @param {Object} e
10738
+ */
10739
+ LayoutGrid.prototype._onMouseOut = function (e) {
10740
+ var rel = e.relatedTarget;
10741
+
10742
+ if (rel) {
10743
+ var thisElem = this._element;
10744
+
10745
+ while (rel.parentNode !== null) {
10746
+ rel = rel.parentNode;
10747
+
10748
+ if (rel === thisElem) {
10749
+ return;
10750
+ }
10751
+ }
10752
+ }
10753
+
10754
+ this.setRowHighlight(-1);
10755
+ };
10756
+
10757
+ /**
10758
+ * @private
10759
+ * @param {number} rowIndex
10760
+ */
10761
+ LayoutGrid.prototype._updateSelectionUI = function (rowIndex) { // Update UI of the specified row index
10762
+ var selected = this._selectionList.getSelection(rowIndex);
10763
+ this._enableStretchCellClass(rowIndex, "selected-row", selected);
10764
+ this.enableRowClass(rowIndex, "selected-row", selected);
10765
+ };
10766
+
10767
+ /** @private
10768
+ * @param {number} rowIndex
10769
+ */
10770
+ LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
10771
+ this._enableStretchCellClass(rowIndex, "selected-row", true);
10772
+ this.enableRowClass(rowIndex, "selected-row", true);
10773
+ };
10774
+
10775
+ /**
10776
+ * @private
10777
+ * @param {number} rowIndex
10778
+ */
10779
+ LayoutGrid.prototype._removeSelectionUI = function (rowIndex) {
10780
+ this._enableStretchCellClass(rowIndex, "selected-row", false);
10781
+ this.enableRowClass(rowIndex, "selected-row", false);
10782
+ };
10783
+
10784
+ /**
10785
+ * @public
10786
+ * @ignore
10787
+ */
10788
+ LayoutGrid.prototype._onEnterDocument = function () {
10789
+ if (!this._initialized && this.getParent()) {
10790
+ for (var c = 0; c < this._colCount; ++c) {
10791
+ this._columns[c].enableAutoStyleUpdating();
10792
+ }
10793
+
10794
+ this._syncLayoutToColumns(0);
10795
+ this._initialized = true;
10796
+ }
10797
+ };
10798
+
10799
+ /** @public
10800
+ * @ignore
10801
+ * @param {*} ctx
10802
+ */
10803
+ LayoutGrid.prototype._setContext = function(ctx) {
10804
+ this._ctx = ctx;
10805
+ };
10806
+
10807
+ /** @public
10808
+ * @ignore
10809
+ * @return {*} ctx
10810
+ */
10811
+ LayoutGrid.prototype._getContext = function () {
10812
+ return this._ctx;
10813
+ };
10814
+
10815
+ /** This is a WORKAROUND to fix Internet Explorer couldn't render top 50% with translateX -50% correctly
10816
+ * @private
10817
+ */
10818
+ LayoutGrid.prototype._resetTransformIETimer = function () {
10819
+ if (util.isIE) {
10820
+ if(!this._transformIETimer) {
10821
+ this.enableClass("reset-transform");
10822
+ this._transformIETimer = setTimeout(this._onResetTransformIE, 20);
10823
+ }
10824
+ }
10825
+ };
10826
+ /** @private
10827
+ */
10828
+ LayoutGrid.prototype._onResetTransformIE = function () {
10829
+ this._transformIETimer = 0;
10830
+ this.enableClass("reset-transform", false);
10831
+ };
10832
+
10833
+ LayoutGrid._proto = LayoutGrid.prototype;
10834
+
10835
+ /* harmony default export */ const grid_LayoutGrid = (LayoutGrid);
10836
+
10837
+
10838
+ ;// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Util.js
10839
+ /** @namespace */
10840
+ var Util_Util = {};
10841
+
10842
+ /** This is a shorthand for fetch() API by POST method and with json body <br>
10843
+ * WARNING: fetch is not supported in IE (including IE11)
10844
+ * @public
10845
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
10846
+ * @function
10847
+ * @param {string} url
10848
+ * @param {Object|string} obj
10849
+ * @return {!Promise<Response>}
10850
+ */
10851
+ Util_Util.post = function(url, obj) { // Not supported in IE
10852
+ return Util_Util._post(url, obj).then(Util_Util.toJSON);
10853
+ };
10854
+ /** Request a server response from server as text by POST method <br>
10855
+ * WARNING: fetch is not supported in IE (including IE11)
10856
+ * @public
10857
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
10858
+ * @function
10859
+ * @param {string} url
10860
+ * @param {Object|string} obj
10861
+ * @return {!Promise<Response>}
10862
+ */
10863
+ Util_Util.requestText = function(url, obj) { // Not supported in IE
10864
+ return Util_Util._post(url, obj, "text/plain").then(Util_Util.toText);
10865
+ };
10866
+ /** Request a server response from server by POST method and with url-encoded body <br>
10867
+ * WARNING: fetch is not supported in IE (including IE11)
10868
+ * @public
10869
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch}
10870
+ * @function
10871
+ * @param {string} url
10872
+ * @param {string} obj
10873
+ * @return {!Promise<Response>}
10874
+ */
10875
+ Util_Util.requestByUrlEncoded = function(url, obj) { // Not supported in IE
10876
+ return Util_Util._post(url, obj, "application/x-www-form-urlencoded").then(Util_Util.toJSON);
10877
+ };
10878
+
10879
+ /** @public
10880
+ * @function
10881
+ * @param {Response} resp
10882
+ * @return {!Promise<Object>}
10883
+ */
10884
+ Util_Util.toJSON = function (resp) {
10885
+ if(Util_Util._logError(resp)) {
10886
+ return Promise.reject(resp);
10887
+ }
10888
+ return resp.json();
10889
+ };
10890
+ /** @public
10891
+ * @function
10892
+ * @param {Response} resp
10893
+ * @return {!Promise<string>}
10894
+ */
10895
+ Util_Util.toText = function (resp) {
10896
+ if(Util_Util._logError(resp)) {
10897
+ return Promise.reject(resp);
10898
+ }
10899
+ return resp.text();
10900
+ };
10901
+
10902
+ /** @private
10903
+ * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
10904
+ * @function
10905
+ * @param {Response} resp
10906
+ * @return {boolean}
10907
+ */
10908
+ Util_Util._logError = function(resp) {
10909
+ if(resp && resp.status >= 300) {
10910
+ console.log("Response " + resp.status + ": " + resp.statusText);
10911
+ return true;
10912
+ }
10913
+ return false;
10914
+ };
10915
+ /** @private
10916
+ * @function
10917
+ * @param {string} url
10918
+ * @param {Object|string} obj
10919
+ * @param {string=} contentType
10920
+ * @return {!Promise<Response>}
10921
+ */
10922
+ Util_Util._post = function(url, obj, contentType) {
10923
+ var options = {
10924
+ method: obj ? "POST" : "GET",
10925
+ headers: { "Content-Type": contentType || "application/json" }
10926
+ };
10927
+ if(obj) {
10928
+ options.body = typeof obj === "string" ? obj : JSON.stringify(obj);
10929
+ }
10930
+
10931
+ return fetch(url, options);
10932
+ };
10933
+
10934
+ /** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
10935
+ * Property with undefined or null value will not have an impact on the object. <br>
10936
+ * Existing properties will be overridden.
10937
+ * @public
10938
+ * @function
10939
+ * @param {Object} obj Object that is extended (new properties will be added to this object)
10940
+ * @param {Object=} extender Master object (no modification will be made on the extender)
10941
+ * @param {Array.<string>=} limiters Specify property to be extended
10942
+ * @return {Object}
10943
+ */
10944
+ var extendObject = function (obj, extender, limiters) {
10945
+ if(!obj) { // null undefined NaN empty string and 0
10946
+ return null;
10947
+ }
10948
+ if(!extender || obj === extender) {
10949
+ return obj;
10950
+ }
10951
+
10952
+ var key;
10953
+ if(limiters) {
10954
+ var len = limiters.length;
10955
+ for(var i = 0; i < len; ++i) {
10956
+ key = limiters[i];
10957
+ if(key) {
10958
+ extendProperty(obj, extender, key);
10959
+ }
10960
+ }
10961
+ } else {
10962
+ for(key in extender) {
10963
+ extendProperty(obj, extender, key);
10964
+ }
10965
+ }
10966
+ return obj;
10967
+ };
10968
+ /** WARNING: Only one level of property tree is affected (i.e. no recursive or nested operation). <br>
10969
+ * Property with undefined or null value will not be cloned.
10970
+ * @public
10971
+ * @function
10972
+ * @param {Object} obj
10973
+ * @param {Array.<string>=} limiters
10974
+ * @return {Object}
10975
+ */
10976
+ var cloneObject = function (obj, limiters) {
10977
+ return extendObject({}, obj, limiters);
10978
+ };
10979
+
10980
+ /** Check empty object
10981
+ * @public
10982
+ * @function
10983
+ * @param {Object} obj
10984
+ * @return {boolean}=true, if the obj is empty
10985
+ */
10986
+ var isEmptyObject = function (obj) {
10987
+ for (var key in obj) {
10988
+ return false;
10989
+ }
10990
+ return true;
10991
+ };
10992
+
10993
+ /** @public
10994
+ * @param {Array=} data
10995
+ * @param {Array.<string>=} fields In case of the given data is an array, this param will be used for mapping index to field
10996
+ * @return {Object|null}
10997
+ */
10998
+ var arrayToObject = function(data, fields) {
10999
+ if(!Array.isArray(data)) {
11000
+ return data;
11001
+ } else if(!fields) {
11002
+ return null;
11003
+ }
11004
+ var ary = data;
11005
+ data = {};
11006
+ var len = ary.length;
11007
+ for(var i = 0; i < len; ++i) {
11008
+ var field = fields[i];
11009
+ // eslint-disable-next-line no-undefined
11010
+ if(field && ary[i] !== undefined) {
11011
+ data[field] = ary[i];
11012
+ }
11013
+ }
11014
+ return data;
11015
+ };
11016
+ /** 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
11017
+ * @public
11018
+ * @function
11019
+ * @param {Object} obj
11020
+ * @param {Object} extender
11021
+ * @param {string} propName
11022
+ * @example
11023
+ * extendProperty({a: 0}, {a: 1}, "a"); // {a: 1}
11024
+ * extendProperty({a: 0}, {b: 1}, "b"); // {a: 0, b: 1}
11025
+ * extendProperty({a: [0]}, {a: 1}, "a"); // {a: [0, 1]}
11026
+ * extendProperty({a: [0]}, {a: [1, 2]}, "a"); // {a: [0, 1, 2]}
11027
+ */
11028
+ var extendProperty = function (obj, extender, propName) {
11029
+ var val = extender[propName];
11030
+ if(val != null) {
11031
+ var objVal = obj[propName];
11032
+ if(Array.isArray(objVal)) {
11033
+ obj[propName] = objVal.concat(val);
11034
+ } else if(Array.isArray(val) && objVal) {
11035
+ obj[propName] = val.concat(objVal); // TODO: Preserve the order
11036
+ } else {
11037
+ obj[propName] = val; // WARNING: Overriding existing data
11038
+ }
11039
+ }
11238
11040
  };
11239
11041
 
11240
- /**
11241
- * @private
11242
- * @param {number} indexX
11243
- * @param {number} indexY
11244
- * @param {CellSpan} cellSpan
11245
- */
11246
- LayoutGrid.prototype._updateCellSpanSize = function (indexX, indexY, cellSpan) {
11247
- var cell = this._getCell(indexX, indexY);
11248
11042
 
11249
- if (cell == null) {
11250
- return;
11251
- }
11043
+ /** Compare the values of obj1 and obj2. if they are the same object or have the same value, the result will be true. Otherwise, it will return false.
11044
+ * @public
11045
+ * @param {*} obj1
11046
+ * @param {*} obj2
11047
+ * @return {boolean}
11048
+ */
11049
+ var deepEqual = function (obj1, obj2) {
11252
11050
 
11253
- if (cellSpan && cellSpan.colSpan > 1) {
11254
- cell.setWidth(this.getCellWidth(indexX, indexY));
11255
- this._columns[indexX].disableDeactivation(); // HACK: If a cell has column span, the column cannot be virtualized
11256
- } else {
11257
- cell.setWidth(-1);
11051
+ if(obj1 === obj2) {
11052
+ return true;
11258
11053
  }
11259
11054
 
11260
- if (cellSpan && cellSpan.rowSpan > 1) {
11261
- cell.setHeight(this.getCellHeight(indexX, indexY)); /////
11262
- } else {
11263
- var height = this._trackY.isAtDefaultSize(indexY) ? -1 : this._trackY.getLaneSize(indexY);
11264
-
11265
- cell.setHeight(height);
11055
+ if (typeof obj1 !== typeof obj2) {
11056
+ return false;
11266
11057
  }
11267
- };
11268
-
11269
- /**
11270
- * @private
11271
- * @param {Array.<CellSpan>} cellSpans
11272
- */
11273
- LayoutGrid.prototype._updateCellSpanLayout = function (cellSpans) {
11274
- if (cellSpans == null) { return; }
11275
11058
 
11276
- for (var i = cellSpans.length; --i >= 0; ) {
11277
- var cellSpan = cellSpans[i];
11059
+ if (typeof obj1 === "object") {
11278
11060
 
11279
- this._updateCellSpanSize(cellSpan.indexX, cellSpan.indexY, cellSpan);
11280
- }
11281
- };
11061
+ // We need to split array and object for performance reason
11062
+ if(Array.isArray(obj1)) {
11063
+ if(obj1.length !== obj2.length) {
11064
+ return false;
11065
+ }
11282
11066
 
11283
- /**
11284
- * @private
11285
- * @param {number} indexX
11286
- * @param {number} indexY
11287
- * @param {!CellSpan} cellSpan
11288
- * @param {boolean} adding
11289
- */
11290
- LayoutGrid.prototype._updateCellSpan = function (indexX, indexY, cellSpan, adding) {
11291
- this._updateCellSpanSize(indexX, indexY, adding ? cellSpan : null);
11292
- this._updateCellSpanClass(indexX, indexY, cellSpan.colSpan, cellSpan.rowSpan, adding);
11293
- };
11067
+ for (var i = 0; i < obj1.length; i++) {
11068
+ if (!deepEqual(obj1[i], obj2[i])) { // The array may not be a match if the elements are not sorted, so it will not be considered equal if there is a mismatch.
11069
+ return false;
11070
+ }
11071
+ }
11294
11072
 
11295
- /**
11296
- * @private
11297
- * @param {number} indexX
11298
- * @param {number} indexY
11299
- * @param {number} colSpan
11300
- * @param {number} rowSpan
11301
- * @param {boolean} adding
11302
- */
11303
- LayoutGrid.prototype._updateCellSpanClass = function (indexX, indexY, colSpan, rowSpan, adding) {
11304
- var column;
11073
+ } else {
11305
11074
 
11306
- for (var c = 0; c < colSpan; ++c) {
11307
- column = this._columns[indexX + c];
11075
+ if (Object.keys(obj1).length !== Object.keys(obj2).length) {
11076
+ return false;
11077
+ }
11308
11078
 
11309
- if (!column) {
11310
- break;
11079
+ for (var key in obj1) {
11080
+ if (!deepEqual(obj1[key], obj2[key])) {
11081
+ return false;
11082
+ }
11083
+ }
11311
11084
  }
11312
11085
 
11313
- column.collapseCells(indexY, rowSpan, adding, (c === 0), (c > 0));
11314
- }
11315
-
11316
- var cell = this._getCell(indexX, indexY);
11317
11086
 
11318
- if (cell) {
11319
- cell._colSpan = (adding) ? colSpan : 1;
11320
- cell._rowSpan = (adding) ? rowSpan : 1; // For quick rendering
11087
+ return true;
11321
11088
  }
11322
- };
11323
11089
 
11324
- /**
11325
- * @private
11326
- * @param {Array.<CellSpan>} cellSpans
11327
- * @param {boolean} adding
11328
- */
11329
- LayoutGrid.prototype._updateCellSpans = function (cellSpans, adding) {
11330
- if (cellSpans == null) { return; }
11090
+ return false;
11331
11091
 
11332
- for (var i = cellSpans.length; --i >= 0; ) {
11333
- var cellSpan = cellSpans[i];
11092
+ };
11093
+ /** Array.push() is much faster than Array.concat(). The downside is the parameters must be an array, whereas concat() has no such requirement. <br>
11094
+ * This method excels in extending known array property in an object.
11095
+ * @public
11096
+ * @function
11097
+ * @param {Object} obj
11098
+ * @param {string} propName
11099
+ * @param {*} ary
11100
+ * @return {Array} Returns the result of the extended array
11101
+ * @see {@link https://dev.to/uilicious/javascript-array-push-is-945x-faster-than-array-concat-1oki}
11102
+ * @example
11103
+ * var obj = {};
11104
+ * extendArrayProperty(obj, "prop1", 1); // [1]
11105
+ * extendArrayProperty(obj, "prop1", 2); // [1, 2]
11106
+ * extendArrayProperty(obj, "prop1", [3, 4]); // [1, 2, 3, 4]
11107
+ * obj.prop2 = 5;
11108
+ * extendArrayProperty(obj, "prop2", 6); // [5, 6]
11109
+ * extendArrayProperty(obj, "prop2", [7]); // [5, 6, 7]
11110
+ * extendArrayProperty(obj, "prop2", null); // null
11111
+ */
11112
+ var extendArrayProperty = function (obj, propName, ary) {
11113
+ var objAry = null;
11114
+ if(ary) {
11115
+ var objVal = obj[propName];
11116
+ if(objVal) {
11117
+ if(Array.isArray(objVal)) {
11118
+ objAry = objVal;
11119
+ } else {
11120
+ objAry = obj[propName] = [objVal];
11121
+ }
11122
+ } else {
11123
+ objAry = obj[propName] = [];
11124
+ }
11125
+ // objAry is guaranteed to be an array at this point
11334
11126
 
11335
- this._updateCellSpan(cellSpan.indexX, cellSpan.indexY, cellSpan, adding);
11127
+ if(Array.isArray(ary)) {
11128
+ if(ary.length) {
11129
+ if(ary.length > 1) {
11130
+ Array.prototype.push.apply(objAry, ary);
11131
+ } else {
11132
+ objAry.push(ary[0]);
11133
+ }
11134
+ }
11135
+ } else {
11136
+ objAry.push(ary);
11137
+ }
11336
11138
  }
11139
+ return objAry;
11337
11140
  };
11338
11141
 
11339
- /**
11340
- * @private
11341
- * @param {Object} e
11342
- */
11343
- LayoutGrid.prototype._onMouseMove = function (e) {
11344
- var target = e["target"];
11142
+ /** @private
11143
+ * @param {string|Array.<string>} item
11144
+ * @return {string}
11145
+ */
11146
+ var _encloseBracket = function(item) {
11147
+ return Array.isArray(item) ? "{\n" + item.join("\n") + "\n}" : item;
11148
+ };
11149
+ /** @private
11150
+ * @param {string} str
11151
+ * @return {string}
11152
+ */
11153
+ var _indentBracketContent = function(str){
11154
+ return str.replace(/\n+/g, "\n\t").replace(/\n\t}$/, "\n}");
11155
+ };
11156
+ /** @public
11157
+ * @param {string|Array} css
11158
+ * @return {string} prettified CSS string
11159
+ * @example
11160
+ * prettifyCss(["div", [
11161
+ * "color: red;",
11162
+ * "padding: 20px;"
11163
+ * ],
11164
+ * ".class", [
11165
+ * "margin: 0;"
11166
+ * ]
11167
+ * ]);
11168
+ */
11169
+ var prettifyCss = function(css) {
11170
+ if(css) {
11171
+ var cssStr = "";
11172
+ if (Array.isArray(css)) {
11173
+ var ary = css.map(_encloseBracket);
11174
+ cssStr = ary.join("\n").replace(/{\s*{/g, "{").replace(/\s+{/g, " {");
11175
+ } else {
11176
+ cssStr = (typeof css === "string") ? css : css + "";
11177
+ }
11345
11178
 
11346
- var cellElement = util.closestElement(target, "cell");
11347
- var colIndex = this._stretchedCells.getColumnIndex(cellElement);
11348
- if(colIndex < 0) { // Not found colIndex in stretching cell, then get from normal row
11349
- var colElement = util.closestElement(target, "column");
11350
- colIndex = this.getColumnIndex(colElement);
11179
+ if(cssStr) {
11180
+ return cssStr.replace(/{[\w\W]*?}/g, _indentBracketContent);
11181
+ }
11351
11182
  }
11352
- var rowIndex = this.getCellIndex(colIndex, cellElement);
11353
-
11354
- this.setRowHighlight(rowIndex);
11183
+ return "";
11355
11184
  };
11356
-
11357
- /**
11358
- * @private
11359
- * @param {Object} e
11360
- */
11361
- LayoutGrid.prototype._onMouseOut = function (e) {
11362
- var rel = e.relatedTarget;
11363
-
11364
- if (rel) {
11365
- var thisElem = this._element;
11366
-
11367
- while (rel.parentNode !== null) {
11368
- rel = rel.parentNode;
11369
-
11370
- if (rel === thisElem) {
11371
- return;
11185
+ /** 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.
11186
+ * @public
11187
+ * @param {Element} elem
11188
+ * @return {DocumentFragment}
11189
+ */
11190
+ var getShadowRoot = function(elem) {
11191
+ if(elem) {
11192
+ var rootNode;
11193
+ if(elem.shadowRoot) {
11194
+ rootNode = elem.shadowRoot;
11195
+ } else if(elem.getRootNode) {
11196
+ rootNode = elem.getRootNode();
11197
+ }
11198
+ if(rootNode) { // getRootNode does not supported in IE. It should be implemented by the polyfills
11199
+ if(rootNode !== document) { // element that is in the DOM and not in the shadow has document as its root node
11200
+ if(rootNode !== elem) { // element that is NOT in the DOM and not in the shadow has itself as its root node
11201
+ return rootNode;
11202
+ }
11372
11203
  }
11373
11204
  }
11374
11205
  }
11375
-
11376
- this.setRowHighlight(-1);
11206
+ return null;
11377
11207
  };
11208
+ /** Attach style tag to the proper document (in case of element inside a shadow root)
11209
+ * @public
11210
+ * @param {string} cssStr Valid CSS string (e.g. "div {color: red;}")
11211
+ * @param {Element=} targetContext Element that needs the CSS
11212
+ * @return {Element} New style tag
11213
+ */
11214
+ var injectCss = function(cssStr, targetContext) {
11215
+ if(!cssStr) {
11216
+ return null;
11217
+ }
11378
11218
 
11379
- /**
11380
- * @private
11381
- * @param {number} rowIndex
11382
- */
11383
- LayoutGrid.prototype._updateSelectionUI = function (rowIndex) { // Update UI of the specified row index
11384
- var selected = this._selectionList.getSelection(rowIndex);
11385
- this._enableStretchCellClass(rowIndex, "selected-row", selected);
11386
- this.enableRowClass(rowIndex, "selected-row", selected);
11219
+ var styleTag = document.createElement("style");
11220
+ styleTag.textContent = "\n" + cssStr + "\n";
11221
+
11222
+ var styleHost = getShadowRoot(targetContext);
11223
+ var isInShadow = true;
11224
+ if(!styleHost) {
11225
+ isInShadow = false;
11226
+ styleHost = document.head;
11227
+ }
11228
+
11229
+ // Find a place to insert the style tag
11230
+ var beforeElem;
11231
+ if(isInShadow) {
11232
+ if(styleHost.children && styleHost.children.length) {
11233
+ beforeElem = styleHost.children[0];
11234
+ }
11235
+ }
11236
+ if(beforeElem) {
11237
+ styleHost.insertBefore(styleTag, beforeElem);
11238
+ } else {
11239
+ styleHost.appendChild(styleTag);
11240
+ }
11241
+ return styleTag;
11387
11242
  };
11388
11243
 
11389
- /** @private
11390
- * @param {number} rowIndex
11244
+ /** return true if browser is IE or Edge
11245
+ * @public
11246
+ * @return {boolean}
11391
11247
  */
11392
- LayoutGrid.prototype._addSelectionUI = function (rowIndex) {
11393
- this._enableStretchCellClass(rowIndex, "selected-row", true);
11394
- this.enableRowClass(rowIndex, "selected-row", true);
11248
+ var isIE = function () {
11249
+ var ua = window.navigator.userAgent;
11250
+ return (ua.indexOf('MSIE ') > 0) || (ua.indexOf('Trident/') > 0) || (ua.indexOf('Edge/') > 0);
11395
11251
  };
11396
11252
 
11397
- /**
11398
- * @private
11399
- * @param {number} rowIndex
11400
- */
11401
- LayoutGrid.prototype._removeSelectionUI = function (rowIndex) {
11402
- this._enableStretchCellClass(rowIndex, "selected-row", false);
11403
- this.enableRowClass(rowIndex, "selected-row", false);
11253
+ /** return true if device is mac
11254
+ * @public
11255
+ * @return {boolean}
11256
+ */
11257
+ var isMac = function () {
11258
+ return /Mac/.test(navigator.platform);
11404
11259
  };
11405
11260
 
11406
- /**
11407
- * @public
11408
- * @ignore
11409
- */
11410
- LayoutGrid.prototype._onEnterDocument = function () {
11411
- if (!this._initialized && this.getParent()) {
11412
- for (var c = 0; c < this._colCount; ++c) {
11413
- this._columns[c].enableAutoStyleUpdating();
11414
- }
11415
-
11416
- this._syncLayoutToColumns(0);
11417
- this._initialized = true;
11261
+ /** Return true if device is mac
11262
+ * @public
11263
+ * @return {boolean}
11264
+ */
11265
+ var isTouchDevice = function () {
11266
+ if ((navigator["maxTouchPoints"] && navigator["maxTouchPoints"] < 256) ||
11267
+ (navigator["msMaxTouchPoints"] && navigator["msMaxTouchPoints"] < 256)) {
11268
+ return true;
11418
11269
  }
11270
+ return false;
11419
11271
  };
11420
11272
 
11421
- /** @public
11422
- * @ignore
11423
- * @param {*} ctx
11273
+ /** parse nested object in to array
11274
+ * @public
11275
+ * @param {Object} obj
11276
+ * @param {Array=} ary
11277
+ * @return {Array}
11424
11278
  */
11425
- LayoutGrid.prototype._setContext = function(ctx) {
11426
- this._ctx = ctx;
11279
+ var nestedObjectToArray = function (obj, ary) {
11280
+ if (!ary) {
11281
+ ary = [];
11282
+ }
11283
+ for (var key in obj) {
11284
+ var element = obj[key];
11285
+ if ('object' === typeof element) {
11286
+ nestedObjectToArray(element, ary);
11287
+ } else {
11288
+ ary.push(element);
11289
+ }
11290
+ }
11291
+ return ary;
11427
11292
  };
11428
11293
 
11429
- /** @public
11430
- * @ignore
11431
- * @return {*} ctx
11294
+ /** Convert CSS rgb or rgba formats to CSS hex color string (# prefix)
11295
+ * @public
11296
+ * @param {string} rgbCode
11297
+ * @return {string}
11298
+ * @example
11299
+ * rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
11300
+ * rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
11301
+ * rgb2Hex("255 255.0"); // "#FFFF00"
11302
+ * rgb2Hex("#FFFF00"); // "#FFFF00"
11303
+ * rgb2Hex("#1a1a1a"); // "#1a1a1a"
11304
+ * rgb2Hex("2552550"); // "2552550"
11305
+ * rgb2Hex("invalid"); // "invalid"
11306
+ * rgb2Hex(null); // ""
11432
11307
  */
11433
- LayoutGrid.prototype._getContext = function () {
11434
- return this._ctx;
11435
- };
11308
+ var rgb2Hex = function (rgbCode) {
11309
+ if(!rgbCode || typeof rgbCode !== "string") {
11310
+ return "";
11311
+ }
11312
+ if(rgbCode.charAt(0) === "#") {
11313
+ return rgbCode;
11314
+ }
11315
+ var rgb = rgbCode.match(/\d+/g);
11316
+ if(!rgb || rgb.length < 3) {
11317
+ return rgbCode;
11318
+ }
11436
11319
 
11437
- /** This is a WORKAROUND to fix Internet Explorer couldn't render top 50% with translateX -50% correctly
11438
- * @private
11439
- */
11440
- LayoutGrid.prototype._resetTransformIETimer = function () {
11441
- if (util.isIE) {
11442
- if(!this._transformIETimer) {
11443
- this.enableClass("reset-transform");
11444
- this._transformIETimer = setTimeout(this._onResetTransformIE, 20);
11320
+ var hex = "#";
11321
+ for(var i = 0; i < 3; i++) {
11322
+ var num = +rgb[i];
11323
+ if(!(num >= 16)) { // Handle NaN case
11324
+ hex += "0";
11445
11325
  }
11326
+ hex += (num) ? num.toString(16).toUpperCase() : "0";
11446
11327
  }
11328
+ return hex;
11447
11329
  };
11448
- /** @private
11330
+
11331
+ /** transform data to tab seperated value
11332
+ * @public
11333
+ * @param {*} data
11334
+ * @return {string}
11449
11335
  */
11450
- LayoutGrid.prototype._onResetTransformIE = function () {
11451
- this._transformIETimer = 0;
11452
- this.enableClass("reset-transform", false);
11453
- };
11336
+ var prepareTSVContent = function (data) {
11337
+ if (data == null) {
11338
+ return "";
11339
+ }
11454
11340
 
11455
- LayoutGrid._proto = LayoutGrid.prototype;
11341
+ var content = (typeof data === 'string') ? data : data.toString();
11456
11342
 
11457
- /* harmony default export */ const grid_LayoutGrid = (LayoutGrid);
11343
+ if (!content.length) { return ""; }
11344
+
11345
+ // Replace any new line and tab
11346
+ if (content.indexOf("\n") >= 0) {
11347
+ content = content.replace(/[\r\n]/g, " ");
11348
+ }
11349
+
11350
+ if (content.indexOf("\t") >= 0) {
11351
+ content = content.replace(/\t/g, " ");
11352
+ }
11353
+
11354
+ // Trim front and back spaces
11355
+ if (content.charAt(0) === " " || content.charAt(content.length - 1) === " ") {
11356
+ content = content.trim();
11357
+ }
11358
+
11359
+ return content;
11360
+ };
11361
+
11362
+ /* harmony default export */ const es6_Util = ((/* unused pure expression or super */ null && (Util_Util)));
11458
11363
 
11459
11364
 
11460
- // EXTERNAL MODULE: ./node_modules/tr-grid-util/es6/Util.js
11461
- var es6_Util = __webpack_require__(869);
11462
11365
  ;// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/GroupDefinitions.js
11463
11366
 
11464
11367
 
@@ -11552,7 +11455,7 @@ GroupDefinitions.getLeafDescendants = function (groupMap, groupId) {
11552
11455
  * @return {Object}
11553
11456
  */
11554
11457
  GroupDefinitions._cloneObject = function(obj) {
11555
- var newObj = (0,es6_Util/* cloneObject */.kI)(obj);
11458
+ var newObj = cloneObject(obj);
11556
11459
  if(Array.isArray(newObj.children)) {
11557
11460
  newObj.children = newObj.children;
11558
11461
  } else {
@@ -25443,6 +25346,7 @@ var Core_Core = function (opt_initializer) {
25443
25346
 
25444
25347
  _t._onMouseMove = _t._onMouseMove.bind(_t);
25445
25348
  _t._onRowHightlighted = _t._onRowHightlighted.bind(_t);
25349
+ _t._onGridClicked = _t._onGridClicked.bind(_t);
25446
25350
 
25447
25351
  _t._onWindowResize = _t._onWindowResize.bind(_t);
25448
25352
  _t._onSectionDataChanged = _t._onSectionDataChanged.bind(_t);
@@ -25528,11 +25432,16 @@ var Core_Core = function (opt_initializer) {
25528
25432
  _t._hscrollbar.setOtherScrollbar(_t._vscrollbar);
25529
25433
  _t._vscrollbar.setOtherScrollbar(_t._hscrollbar);
25530
25434
 
25531
- if (util.isMobile) {
25435
+ if (util.isMobile || util.isTouchDevice) {
25532
25436
  _t._element.addEventListener("touchmove", this._onMouseMove, false);
25533
25437
  } else {
25534
25438
  _t._element.addEventListener("mousemove", this._onMouseMove, false);
25535
25439
  }
25440
+
25441
+ if(util.isSafari){
25442
+ _t._element.addEventListener("click", this._onGridClicked);
25443
+ }
25444
+
25536
25445
  window.addEventListener("resize", _t._onWindowResize, false); // Should be unlistened after destroyed
25537
25446
  _t._rowVirtualizer.listen("indexChanged", _t._onRowInViewChanged);
25538
25447
  _t._colVirtualizer.listen("indexChanged", _t._onColInViewChanged);
@@ -25917,7 +25826,7 @@ Core_Core.prototype._batches = null;
25917
25826
  * @return {string}
25918
25827
  */
25919
25828
  Core_Core.getVersion = function () {
25920
- return "5.1.57";
25829
+ return "5.1.63";
25921
25830
  };
25922
25831
  /** {@link ElementWrapper#dispose}
25923
25832
  * @override
@@ -26864,16 +26773,12 @@ Core_Core.prototype.removeColumnAt = function (index) {
26864
26773
 
26865
26774
  if (this._hasListener("columnRemoved")) {
26866
26775
  var e = {};
26867
- var batches = this._batches;
26868
- if(batches){
26869
- e["batches"] = batches;
26870
- }
26871
26776
  e["atTheMiddle"] = true;
26872
26777
  e["colIndex"] = index;
26873
26778
  e["columns"] = "deprecated";
26874
26779
  e["columnData"] = colDef["columnData"];
26875
26780
  e["colId"] = colDef["id"] || "";
26876
- this._dispatch("columnRemoved", e);
26781
+ this._dispatchColumnEvent("columnRemoved", e);
26877
26782
  }
26878
26783
 
26879
26784
  // Last index in view here might be different from before moving column if columns have different width.
@@ -27126,7 +27031,7 @@ Core_Core.prototype._moveColumn = function (fromCol, destCol) {
27126
27031
  e["fromColIndex"] = fromCol;
27127
27032
  e["toColIndex"] = destCol;
27128
27033
  e["colId"] = colId; // TODO: Id may not needed
27129
- this._dispatch("columnMoved", e);
27034
+ this._dispatchColumnEvent("columnMoved", e); // add remove move
27130
27035
  }
27131
27036
 
27132
27037
  // Last index in view here might be different from before moving column if columns have different width.
@@ -27196,6 +27101,9 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
27196
27101
  destId = destCol;
27197
27102
  }
27198
27103
 
27104
+ this.startBatch("move");
27105
+
27106
+ var dirty = 0;
27199
27107
  if(Array.isArray(colRefs)) {
27200
27108
  var srcLen = colRefs.length;
27201
27109
  if(srcLen > 1) {
@@ -27238,7 +27146,6 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
27238
27146
  }
27239
27147
  }
27240
27148
 
27241
- var dirty = 0;
27242
27149
  for(i = srcLen; --i >= 0;) {
27243
27150
  srcId = srcIds[i]; // Only valid source columns are left at this point
27244
27151
  srcIdx = this.getColumnIndex(srcId);
@@ -27249,17 +27156,15 @@ Core_Core.prototype.reorderColumns = function (colRefs, destCol) {
27249
27156
  dirty |= this._moveColumnByIndex(srcIdx, destIdx);
27250
27157
  destId = srcId;
27251
27158
  }
27252
- return dirty ? true : false;
27253
27159
  } else {
27254
- return this.moveColumnById(colRefs[0], destId);
27160
+ dirty = this.moveColumnById(colRefs[0], destId);
27255
27161
  }
27256
- }
27257
-
27258
- if(colRefs != null) {
27162
+ } else if(colRefs != null) {
27259
27163
  // colRefs will be a number or string
27260
- return this.moveColumnById(colRefs, destId);
27164
+ dirty = this.moveColumnById(colRefs, destId);
27261
27165
  }
27262
- return false;
27166
+ this.stopBatch("move");
27167
+ return dirty ? true : false;
27263
27168
  };
27264
27169
 
27265
27170
  /** @public
@@ -29776,6 +29681,53 @@ Core_Core.prototype.getColumnGroupChildIds = function (groupId) {
29776
29681
  return null;
29777
29682
  };
29778
29683
 
29684
+ /** @public
29685
+ * @description Get a list of objects with column id and column index in sorted order
29686
+ * @param {Array.<string>} colIds
29687
+ * @param {Object=} columnMap
29688
+ * @return {!Array.<string>} Return column array with corresponding order to UI
29689
+ * @example
29690
+ * core.getValidColumnList(["c1","c2","c5"]); // Get list of valid columns
29691
+ * core.getValidColumnList(["c1","c2","c5"],{ "c2":true, "c5":true }); // Get list of valid columns from specific mapping
29692
+ */
29693
+ Core_Core.prototype.getValidColumnList = function (colIds, columnMap) {
29694
+ var colList = [];
29695
+ if(!colIds){
29696
+ return colList;
29697
+ }
29698
+ if(!columnMap){
29699
+ columnMap = this.createColumnMap(colIds);
29700
+ }
29701
+ var colCount = this.getColumnCount();
29702
+ for(var c = 0; c < colCount; ++c) {
29703
+ var id = this._getColumnDef(c)["id"];
29704
+ if(columnMap[id] != null){
29705
+ colList.push({"index": c, "id": id});
29706
+ }
29707
+ }
29708
+ return colList;
29709
+ };
29710
+
29711
+ /** @public
29712
+ * @description Create mapping object from an array of strings
29713
+ * @param {Array.<string>=} colIds
29714
+ * @return {!Object} Column mapping object
29715
+ */
29716
+ Core_Core.prototype.createColumnMap = function (colIds) {
29717
+ if(!colIds){
29718
+ colIds = this.getColumnIds();
29719
+ }
29720
+ var mappingObj = {};
29721
+ var count = colIds.length;
29722
+ for(var i = 0; i < count; i++){
29723
+ var colId = colIds[i];
29724
+ if(colId){
29725
+ mappingObj[colId] = true;
29726
+ }
29727
+ }
29728
+ return mappingObj;
29729
+ };
29730
+
29779
29731
  /** @public
29780
29732
  * @param {string} batchType
29781
29733
  * @return {boolean}
@@ -29804,7 +29756,7 @@ Core_Core.prototype.stopBatch = function (batchType) {
29804
29756
  this._dispatch("afterBatchOperation", { batches: this._batches, batchType: batchType });
29805
29757
 
29806
29758
  delete this._batches[batchType];
29807
- if((0,es6_Util/* isEmptyObject */.Qr)(this._batches)){
29759
+ if(isEmptyObject(this._batches)){
29808
29760
  this._batches = null;
29809
29761
  }
29810
29762
  return true;
@@ -29813,6 +29765,17 @@ Core_Core.prototype.stopBatch = function (batchType) {
29813
29765
 
29814
29766
  //#region Private Methods
29815
29767
  /** @private
29768
+ * @param {string} type
29769
+ * @param {!Object} eventArg
29770
+ */
29771
+ Core_Core.prototype._dispatchColumnEvent = function (type, eventArg) {
29772
+ var batches = this._batches;
29773
+ if(batches){
29774
+ eventArg["batches"] = batches;
29775
+ }
29776
+ this._dispatch(type, eventArg);
29777
+ };
29778
+ /** @private
29816
29779
  */
29817
29780
  Core_Core.prototype._dispatchColumnPositionChanged = function () {
29818
29781
  if(this._columnPositionConflator.conflate()) {
@@ -30052,20 +30015,16 @@ Core_Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle
30052
30015
  if (this._hasListener("columnAdded")) {
30053
30016
  var e = {};
30054
30017
  e["atTheMiddle"] = atTheMiddle;
30055
- var batches = this._batches;
30056
- if(batches){
30057
- e["batches"] = batches;
30058
- }
30059
30018
  if(count === 1) {
30060
30019
  e["colIndex"] = at;
30061
30020
  e["context"] = ctx;
30062
- this._dispatch("columnAdded", e);
30021
+ this._dispatchColumnEvent("columnAdded", e);
30063
30022
  } else {
30064
30023
  var ary = Array.isArray(ctx) ? ctx : [];
30065
30024
  for (var i = 0; i < count; ++i) {
30066
30025
  e["colIndex"] = at + i;
30067
30026
  e["context"] = ary[i];
30068
- this._dispatch("columnAdded", e);
30027
+ this._dispatchColumnEvent("columnAdded", e);
30069
30028
  }
30070
30029
  }
30071
30030
  }
@@ -30207,15 +30166,11 @@ Core_Core.prototype._removeColumn = function (num) { // TODO: change the logic
30207
30166
 
30208
30167
  if (this._hasListener("columnRemoved")) {
30209
30168
  var e = {};
30210
- var batches = this._batches;
30211
- if(batches){
30212
- e["batches"] = batches;
30213
- }
30214
30169
  for (var c = colCount; --c >= newCount; ) {
30215
30170
  var colDef = removedCols[c - newCount];
30216
30171
  e["colIndex"] = c;
30217
30172
  e["columnData"] = colDef ? colDef["columnData"] : null;
30218
- this._dispatch("columnRemoved", e);
30173
+ this._dispatchColumnEvent("columnRemoved", e);
30219
30174
  }
30220
30175
  }
30221
30176
  };
@@ -30612,6 +30567,18 @@ Core_Core.prototype._onMouseMove = function () {
30612
30567
  this._vscrollbar.flash();
30613
30568
  this._hscrollbar.flash();
30614
30569
  };
30570
+ /** @private */
30571
+ Core_Core.prototype._onGridClicked = function () {
30572
+ // research for dragging
30573
+ var selection = window.getSelection();
30574
+ if(selection.toString()){
30575
+ return;
30576
+ }
30577
+ var activeElem = document.activeElement;
30578
+ if(!this._element.contains(activeElem)){
30579
+ this.focus();
30580
+ }
30581
+ };
30615
30582
 
30616
30583
  /** @private
30617
30584
  * @param {Object} e
@@ -31289,8 +31256,9 @@ es6_Ext.inherits(SortableTitlePlugin, event_EventDispatcher);
31289
31256
 
31290
31257
  /** The sorting object which will be used for initialSort config.
31291
31258
  * @typedef {Object} SortableTitlePlugin~InitialSort
31292
- * @property {number} colIndex Index of the column
31293
- * @property {string} field field of the column
31259
+ * @property {number=} colIndex Index of the column
31260
+ * @property {string=} colId column id of the column
31261
+ * @property {string=} field field of the column
31294
31262
  * @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
31295
31263
  * @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
31296
31264
  */
@@ -31752,7 +31720,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
31752
31720
  extOptions["sortingSequence"] = sortingSeq.slice();
31753
31721
  }
31754
31722
 
31755
- if((0,es6_Util/* isEmptyObject */.Qr)(obj["sorting"])) {
31723
+ if(isEmptyObject(obj["sorting"])) {
31756
31724
  delete obj["sorting"];
31757
31725
  }
31758
31726
 
@@ -31948,6 +31916,7 @@ SortableTitlePlugin.prototype.getSortedColumns = function () {
31948
31916
  var state = this._sortStates[i];
31949
31917
  arr[i] = {
31950
31918
  "colIndex": colIndex,
31919
+ "colId": this._getColumnId(colIndex),
31951
31920
  "field": state["field"] || "",
31952
31921
  "sortOrder": state["sortOrder"] || "n"
31953
31922
  };
@@ -31989,7 +31958,7 @@ SortableTitlePlugin.prototype.sortColumns = function (sortOptions, opt_arg) {
31989
31958
  var opt = sortOptions[i];
31990
31959
  var colRef = opt["colIndex"];
31991
31960
  if(colRef < 0 || colRef == null) {
31992
- colRef = opt["field"];
31961
+ colRef = opt["colId"] || opt["field"];
31993
31962
  }
31994
31963
  var state = this._prepareSorting(
31995
31964
  colRef,
@@ -32576,19 +32545,9 @@ SortableTitlePlugin.prototype._prepareSorting = function (colRef, sortOrder) {
32576
32545
  return null;
32577
32546
  }
32578
32547
 
32579
- var colIndex = -1;
32580
- var field = "";
32581
- var priority = -1;
32582
- if(typeof colRef === "number") {
32583
- colIndex = colRef;
32584
- field = this.getColumnSortingField(colIndex);
32585
- priority = this.getSortPriority(colIndex);
32586
- } else if(typeof colRef === "string") {
32587
- field = colRef;
32588
- colIndex = this._getColumnIndexByField(field);
32589
- var fields = this.getColumnSortingFields();
32590
- priority = fields.indexOf(field);
32591
- }
32548
+ var colIndex = this._getColumnIndex(colRef);
32549
+ var priority = this.getSortPriority(colIndex);
32550
+ var field = this.getColumnSortingField(colIndex);
32592
32551
 
32593
32552
  var curState = (priority >= 0) ? this._sortStates[priority] : null;
32594
32553
  var curOrder = curState ? curState["sortOrder"] : "n";
@@ -32972,21 +32931,29 @@ SortableTitlePlugin.prototype._getColumnIndexByOptions = function (sortOptions)
32972
32931
  return -1;
32973
32932
  };
32974
32933
  /** @private
32975
- * @param {string} field
32934
+ * @param {string|number} colRef
32976
32935
  * @return {number}
32977
32936
  */
32978
- SortableTitlePlugin.prototype._getColumnIndexByField = function (field) {
32979
- if(field) {
32980
- var host = this._hosts[0];
32981
- var colCount = host ? host.getColumnCount() : 0;
32982
- for (var c = 0; c < colCount; ++c) {
32983
- if(field === this.getColumnSortingField(c)) {
32984
- return c;
32985
- }
32986
- }
32937
+ SortableTitlePlugin.prototype._getColumnIndex = function (colRef) {
32938
+ var host = this._hosts[0];
32939
+ if(host && colRef != null) {
32940
+ return host.getColumnIndex(colRef);
32987
32941
  }
32988
32942
  return -1;
32989
32943
  };
32944
+
32945
+ /** @private
32946
+ * @param {string|number} colRef
32947
+ * @return {string} column id or empty string for not found
32948
+ */
32949
+ SortableTitlePlugin.prototype._getColumnId = function (colRef) {
32950
+ var host = this._hosts[0];
32951
+ if(host && colRef != null) {
32952
+ return host.getColumnId(colRef);
32953
+ }
32954
+ return "";
32955
+ };
32956
+
32990
32957
  /** @private
32991
32958
  * @param {number} colIndex
32992
32959
  * @return {Object}
@@ -33148,7 +33115,5 @@ grid.SortableTitlePlugin = plugins_SortableTitlePlugin;
33148
33115
 
33149
33116
  /* harmony default export */ const src = ((/* unused pure expression or super */ null && (Core)));
33150
33117
 
33151
- })();
33152
-
33153
33118
  /******/ })()
33154
33119
  ;