jqwidgets-ng 23.0.5 → 23.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/jqwidgets/jqx-all.js +4 -28
  2. package/jqwidgets/jqxbarcode.js +0 -6
  3. package/jqwidgets/jqxchart.core.js +1 -1
  4. package/jqwidgets/jqxchart.js +1 -1
  5. package/jqwidgets/jqxcheckboxgroup.js +0 -6
  6. package/jqwidgets/jqxdatatable.js +1 -1
  7. package/jqwidgets/jqxqrcode.js +0 -6
  8. package/jqwidgets/jqxradiobuttongroup.js +0 -6
  9. package/jqwidgets/jqxscheduler.js +1 -1
  10. package/jqwidgets/jqxsplitlayout.js +2 -2455
  11. package/jqwidgets/modules/jqxbarcode.js +15 -65
  12. package/jqwidgets/modules/jqxbargauge.js +17 -67
  13. package/jqwidgets/modules/jqxbulletchart.js +19 -69
  14. package/jqwidgets/modules/jqxbuttongroup.js +17 -67
  15. package/jqwidgets/modules/jqxbuttons.js +15 -65
  16. package/jqwidgets/modules/jqxcalendar.js +21 -71
  17. package/jqwidgets/modules/jqxchart.js +29 -79
  18. package/jqwidgets/modules/jqxcheckbox.js +19 -69
  19. package/jqwidgets/modules/jqxcheckboxgroup.js +19 -69
  20. package/jqwidgets/modules/jqxcolorpicker.js +21 -71
  21. package/jqwidgets/modules/jqxcombobox.js +25 -75
  22. package/jqwidgets/modules/jqxcomplexinput.js +17 -67
  23. package/jqwidgets/modules/jqxdatatable.js +45 -95
  24. package/jqwidgets/modules/jqxdatetimeinput.js +39 -89
  25. package/jqwidgets/modules/jqxdocking.js +19 -69
  26. package/jqwidgets/modules/jqxdockinglayout.js +27 -77
  27. package/jqwidgets/modules/jqxdockpanel.js +17 -67
  28. package/jqwidgets/modules/jqxdragdrop.js +19 -69
  29. package/jqwidgets/modules/jqxdraw.js +15 -65
  30. package/jqwidgets/modules/jqxdropdownbutton.js +17 -67
  31. package/jqwidgets/modules/jqxdropdownlist.js +37 -87
  32. package/jqwidgets/modules/jqxeditor.js +49 -99
  33. package/jqwidgets/modules/jqxexpander.js +23 -73
  34. package/jqwidgets/modules/jqxfileupload.js +19 -69
  35. package/jqwidgets/modules/jqxform.js +48 -98
  36. package/jqwidgets/modules/jqxformattedinput.js +39 -89
  37. package/jqwidgets/modules/jqxgantt.js +17 -67
  38. package/jqwidgets/modules/jqxgauge.js +21 -71
  39. package/jqwidgets/modules/jqxgrid.js +94 -121
  40. package/jqwidgets/modules/jqxheatmap.js +17 -67
  41. package/jqwidgets/modules/jqxinput.js +19 -69
  42. package/jqwidgets/modules/jqxkanban.js +49 -99
  43. package/jqwidgets/modules/jqxknob.js +19 -69
  44. package/jqwidgets/modules/jqxlayout.js +27 -77
  45. package/jqwidgets/modules/jqxlineargauge.js +21 -71
  46. package/jqwidgets/modules/jqxlinkbutton.js +15 -65
  47. package/jqwidgets/modules/jqxlistbox.js +29 -79
  48. package/jqwidgets/modules/jqxlistmenu.js +45 -95
  49. package/jqwidgets/modules/jqxloader.js +15 -65
  50. package/jqwidgets/modules/jqxmaskedinput.js +15 -65
  51. package/jqwidgets/modules/jqxmenu.js +27 -77
  52. package/jqwidgets/modules/jqxnavbar.js +23 -73
  53. package/jqwidgets/modules/jqxnavigationbar.js +31 -81
  54. package/jqwidgets/modules/jqxnotification.js +23 -73
  55. package/jqwidgets/modules/jqxnumberinput.js +29 -79
  56. package/jqwidgets/modules/jqxpanel.js +21 -71
  57. package/jqwidgets/modules/jqxpasswordinput.js +23 -73
  58. package/jqwidgets/modules/jqxpivotdesigner.js +53 -103
  59. package/jqwidgets/modules/jqxpivotgrid.js +53 -103
  60. package/jqwidgets/modules/jqxpopover.js +17 -67
  61. package/jqwidgets/modules/jqxprogressbar.js +15 -65
  62. package/jqwidgets/modules/jqxqrcode.js +23 -73
  63. package/jqwidgets/modules/jqxradiobutongroup.js +19 -69
  64. package/jqwidgets/modules/jqxradiobutton.js +17 -67
  65. package/jqwidgets/modules/jqxrangeselector.js +19 -69
  66. package/jqwidgets/modules/jqxrating.js +17 -67
  67. package/jqwidgets/modules/jqxrepeatbutton.js +15 -65
  68. package/jqwidgets/modules/jqxresponsivepanel.js +17 -67
  69. package/jqwidgets/modules/jqxribbon.js +19 -69
  70. package/jqwidgets/modules/jqxscheduler.js +55 -105
  71. package/jqwidgets/modules/jqxscrollbar.js +17 -67
  72. package/jqwidgets/modules/jqxscrollview.js +17 -67
  73. package/jqwidgets/modules/jqxslider.js +17 -57
  74. package/jqwidgets/modules/jqxsortable.js +14114 -8
  75. package/jqwidgets/modules/jqxsplitlayout.js +11479 -8
  76. package/jqwidgets/modules/jqxsplitter.js +13463 -8
  77. package/jqwidgets/modules/jqxswitchbutton.js +21 -61
  78. package/jqwidgets/modules/jqxtabs.js +29 -69
  79. package/jqwidgets/modules/jqxtagcloud.js +23 -63
  80. package/jqwidgets/modules/jqxtextarea.js +23 -63
  81. package/jqwidgets/modules/jqxtimeline.js +15 -55
  82. package/jqwidgets/modules/jqxtimepicker.js +17 -57
  83. package/jqwidgets/modules/jqxtogglebutton.js +15 -55
  84. package/jqwidgets/modules/jqxtoolbar.js +47 -87
  85. package/jqwidgets/modules/jqxtooltip.js +15 -55
  86. package/jqwidgets/modules/jqxtree.js +27 -67
  87. package/jqwidgets/modules/jqxtreegrid.js +47 -87
  88. package/jqwidgets/modules/jqxtreemap.js +19 -59
  89. package/jqwidgets/modules/jqxvalidator.js +21 -61
  90. package/jqwidgets/modules/jqxwindow.js +17 -57
  91. package/package.json +1 -1
@@ -1,2464 +1,11 @@
1
1
  /*
2
- jQWidgets v22.0.0 (2025-Jan)
2
+ jQWidgets v23.0.0 (2025-May)
3
3
  Copyright (c) 2011-2025 jQWidgets.
4
4
  License: https://jqwidgets.com/license/
5
5
  */
6
6
  /* eslint-disable */
7
7
 
8
- /* tslint:disable */
9
- /* eslint-disable */
10
- (function(){
11
- if (typeof document === 'undefined') {
12
- return;
13
- }
14
- if (!window.JQX) {
15
- window.JQX = {
16
- Utilities: {
17
- Core: {
18
- isMobile() {
19
- var isMobile = /(iphone|ipod|ipad|android|iemobile|blackberry|bada)/.test(window.navigator.userAgent.toLowerCase());
20
- var iOS = function () {
21
- return [
22
- 'iPad Simulator',
23
- 'iPhone Simulator',
24
- 'iPod Simulator',
25
- 'iPad',
26
- 'iPhone',
27
- 'iPod'
28
- ].includes(navigator.platform)
29
- // iPad on iOS 13 detection
30
- || (navigator.userAgent.includes('Mac') && 'ontouchend' in document)
31
- }
32
-
33
- if (!isMobile) {
34
- return iOS();
35
- }
36
-
37
- return isMobile;
38
- }
39
- }
40
- }
41
- }
42
- }
43
-
44
-
45
- class LayoutItem extends HTMLElement {
46
- constructor() {
47
- super();
48
-
49
- this._properties = {
50
- 'min': 50,
51
- 'label': 'Item',
52
- 'modifiers': ['resize', 'drag', 'close'],
53
- 'size': null
54
- }
55
- }
56
-
57
- _setProperty(property, value) {
58
- var that = this;
59
-
60
- if (that._properties[property] === value) {
61
- return;
62
- }
63
-
64
- that._properties[property] = value;
65
- that._updating = true;
66
-
67
- if (property === 'disabled' || property === 'modifiers') {
68
- if (value) {
69
- that.setAttribute(property, value);
70
- }
71
- else {
72
- that.removeAttribute(property);
73
- }
74
- }
75
- else {
76
- if (value === null) {
77
- that.removeAttribute(property);
78
- }
79
- else {
80
- that.setAttribute(property, value);
81
- }
82
- }
83
-
84
- if (!that.isCompleted) {
85
- return;
86
- }
87
-
88
- var layout = that.closest('jqx-layout');
89
-
90
- if (layout) {
91
- if (!layout._resizeDetails && !layout._updating && layout.isRendered) {
92
- layout.refresh();
93
- }
94
- }
95
- that._updating = false;
96
- }
97
-
98
- get label() {
99
- return this._properties['label'];
100
- }
101
-
102
- set label(value) {
103
- this._setProperty('label', value);
104
- }
105
-
106
- get modifiers() {
107
- return this._properties['modifiers'];
108
- }
109
-
110
- set modifiers(value) {
111
- this._setProperty('modifiers', value);
112
- }
113
-
114
- get min() {
115
- return this._properties['min'];
116
- }
117
-
118
- set min(value) {
119
- this._setProperty('min', value);
120
- }
121
-
122
- get size() {
123
- return this._properties['size'];
124
- }
125
-
126
- set size(value) {
127
- if (value !== null) {
128
- if (typeof value === 'string') {
129
- this._setProperty('size', value);
130
- }
131
- else {
132
- this._setProperty('size', Math.max(this.min, value));
133
- }
134
- }
135
- else {
136
- this._setProperty('size', value);
137
- }
138
- }
139
-
140
- static get observedAttributes() {
141
- return ['min', 'size', 'label', 'modifiers'];
142
- }
143
-
144
-
145
- attributeChangedCallback(name, oldValue, newValue) {
146
- var that = this;
147
-
148
- if (oldValue === newValue) {
149
- return;
150
- }
151
-
152
- if (!that.isCompleted) {
153
- return;
154
- }
155
-
156
- if (name === 'size') {
157
- if (!that._updating) {
158
- if (newValue === null) {
159
- this[name] = null;
160
- return;
161
- }
162
-
163
- that[name] = Math.max(that.min, parseInt(newValue));
164
- }
165
- }
166
- else {
167
- that[name] = newValue;
168
- }
169
- }
170
-
171
- connectedCallback() {
172
- if (!this.isCompleted) {
173
- this.render();
174
- }
175
- }
176
-
177
- whenRendered(callback) {
178
- var that = this;
179
-
180
- if (that.isRendered) {
181
- callback();
182
- return;
183
- }
184
-
185
- if (!that.whenRenderedCallbacks) {
186
- that.whenRenderedCallbacks = [];
187
- }
188
-
189
- that.whenRenderedCallbacks.push(callback);
190
- }
191
-
192
- render() {
193
- var that = this;
194
-
195
- if (!that.hasAttribute('data-id')) {
196
- that.setAttribute('data-id', 'id' + Math.random().toString(16).slice(2));
197
- }
198
-
199
- if (!that.hasAttribute('label')) {
200
- that.setAttribute('label', that.label);
201
- }
202
-
203
- if (!that.hasAttribute('min')) {
204
- that.setAttribute('min', that.min);
205
- }
206
-
207
- if (!that.hasAttribute('label')) {
208
- that.setAttribute('label', that.label);
209
- }
210
-
211
- if (!that.hasAttribute('modifiers')) {
212
- that.setAttribute('modifiers', that.modifiers);
213
- }
214
-
215
- for (var i = 0; i < that.attributes.length; i++) {
216
- var attribute = that.attributes[i];
217
- var attributeName = attribute.name;
218
- var attributeValue = attribute.value;
219
-
220
- if (!isNaN(attributeValue) && (attributeName === 'min' || attributeName === 'size')) {
221
- that._properties[attributeName] = parseInt(attributeValue);
222
- continue;
223
- }
224
-
225
- that._properties[attributeName] = attributeValue;
226
- }
227
-
228
- that.classList.add('jqx-layout-item');
229
-
230
- that.isCompleted = true;
231
-
232
- if (that.whenRenderedCallbacks) {
233
- for (var i = 0; i < that.whenRenderedCallbacks.length; i++) {
234
- that.whenRenderedCallbacks[i]();
235
- }
236
-
237
- that.whenRenderedCallbacks = [];
238
- }
239
- }
240
- }
241
-
242
- class LayoutGroup extends LayoutItem {
243
- constructor() {
244
- super();
245
-
246
- this._properties['label'] = 'Group';
247
- this._properties['orientation'] = 'vertical'
248
- }
249
-
250
- get orientation() {
251
- return this._properties.orientation;
252
- }
253
-
254
- set orientation(value) {
255
- this._setProperty('orientation', value);
256
- }
257
-
258
- static get observedAttributes() {
259
- return ['min', 'size', 'modifiers', 'orientation', 'position'];
260
- }
261
-
262
- render() {
263
- var that = this;
264
-
265
- super.render();
266
-
267
- that.className = 'jqx-layout-group';
268
-
269
- if (!that.hasAttribute('orientation')) {
270
- that.setAttribute('orientation', that._properties['orientation']);
271
- }
272
- else {
273
- that._properties['orientation'] = that.getAttribute('orientation');
274
- }
275
- }
276
- }
277
-
278
- class TabLayoutGroup extends LayoutGroup {
279
- constructor() {
280
- super();
281
- this._properties['position'] = 'top'
282
- this._properties['label'] = 'TabGroup';
283
- }
284
-
285
- get position() {
286
- return this._properties.position;
287
- }
288
-
289
- set position(value) {
290
- this._setProperty('position', value);
291
- }
292
-
293
- render() {
294
- var that = this;
295
-
296
- super.render();
297
-
298
- if (!that.hasAttribute('position') && that.position) {
299
- that.setAttribute('position', 'top');
300
- }
301
- }
302
-
303
- static get observedAttributes() {
304
- return ['min', 'size', 'modifiers', 'orientation', 'position'];
305
- }
306
- }
307
-
308
- class TabLayoutItem extends LayoutGroup {
309
- constructor() {
310
- super();
311
- this._properties['label'] = 'TabItem';
312
- }
313
- }
314
-
315
-
316
- (function ($) {
317
- "use strict";
318
- $.jqx.jqxWidget("jqxSplitLayout", "", {});
319
-
320
- $.extend($.jqx._jqxSplitLayout.prototype, {
321
- defineInstance: function () {
322
- var settings = {
323
- 'dataSource': null,
324
- 'ready': null,
325
- 'orientation': 'vertical'
326
- };
327
-
328
- if (this === $.jqx._jqxSplitLayout.prototype) {
329
- return settings;
330
- }
331
-
332
- $.extend(true, this, settings);
333
- return settings;
334
- },
335
-
336
- createInstance: function () {
337
- var that = this;
338
- this._properties = {
339
- 'dataSource': null,
340
- 'ready': null,
341
- 'orientation': 'vertical'
342
- }
343
-
344
- var that = this;
345
-
346
- that.layout = document.createElement('jqx-split-layout');
347
- that.layout.style.width = '100%';
348
- that.layout.style.height = '100%';
349
- that.element.className += that.toThemeProperty("jqx-split-layout-component jqx-rc-all jqx-widget");
350
- that.layout.dataSource = that.dataSource;
351
- that.layout.orientation = that.orientation;
352
- that.layout.ready = that.ready;
353
- that.element.appendChild(that.layout);
354
- },
355
-
356
- propertyChangedHandler: function (object, key, oldValue, value) {
357
- var that = object;
358
-
359
- if (oldValue != value || value instanceof Object) {
360
- if (!that.layout) {
361
- return;
362
- }
363
-
364
- that.layout[key] = value;
365
- }
366
- },
367
-
368
- render: function () {
369
- var that = this;
370
-
371
- if (!that.layout) {
372
- return;
373
- }
374
-
375
- that.layout.render();
376
- },
377
-
378
- refresh() {
379
- var that = this;
380
-
381
- if (!that.layout) {
382
- return;
383
- }
384
-
385
- if (!that.layout.isRendered) {
386
- return;
387
- }
388
-
389
- that.layout.refresh();
390
- },
391
-
392
- dataBind() {
393
- var that = this;
394
-
395
- if (!that.layout) {
396
- return;
397
- }
398
-
399
- that.layout.dataBind();
400
- }
401
- });
402
- })(jqxBaseFramework);
403
-
404
- class SplitLayout extends HTMLElement {
405
- constructor() {
406
- super();
407
-
408
- this._properties = {
409
- 'dataSource': null,
410
- 'orientation': 'vertical'
411
- }
412
- }
413
-
414
-
415
- get orientation() {
416
- return this._properties['orientation'];
417
- }
418
-
419
- set orientation(value) {
420
- this._properties['orientation'] = value;
421
- }
422
-
423
- get dataSource() {
424
- return this._properties['dataSource'];
425
- }
426
-
427
- set dataSource(value) {
428
- this._properties['dataSource'] = value;
429
- }
430
-
431
-
432
- _dragStart(event) {
433
- event.stopPropagation();
434
- event.preventDefault();
435
- }
436
-
437
- _leaveHandler() {
438
- var that = this;
439
-
440
- if (that._resizeDetails) {
441
- return;
442
- }
443
-
444
- that._handleButtonsVisibility(null);
445
- that._hideSplitter();
446
-
447
- requestAnimationFrame(function () {
448
- // that.classList.remove('outline');
449
- })
450
- }
451
-
452
- _enterHandler() {
453
- var that = this;
454
-
455
- if (that._resizeDetails) {
456
- return;
457
- }
458
-
459
- that._handleButtonsVisibility(that._selectedItem);
460
-
461
- that._updateSplitter();
462
-
463
- requestAnimationFrame(function () {
464
- that.classList.add('outline');
465
- })
466
- }
467
-
468
- /**
469
- * Element's HTML template.
470
- */
471
- template() {
472
- return '<div class="jqx-container" id="container" role="presentation"><jqx-layout-group data-id="root" id="itemsContainer"></jqx-layout-group><div root-splitter id="splitter" class="jqx-layout-splitter"></div>';
473
- }
474
-
475
- /**
476
- * Updates the element when a property is changed.
477
- * @param {string} propertyName The name of the property.
478
- * @param {number/string} oldValue The previously entered value. Max, min and value are of type Number. The rest are of type String.
479
- * @param {number/string} newValue The new entered value. Max, min and value are of type Number. The rest are of type String.
480
- */
481
- propertyChangedHandler(propertyName, oldValue, newValue) {
482
- var that = this;
483
-
484
- switch (propertyName) {
485
- case 'orientation':
486
- if (that.$.itemsContainer) {
487
- that.$.itemsContainer.orientation = that.orientation;
488
- }
489
- break;
490
- case 'dataSource':
491
- that.dataBind();
492
- break;
493
- case 'selectedIndex':
494
- that._handleItemClick(that.getItem(newValue + ''), true);
495
- break;
496
- default:
497
- super.propertyChangedHandler(propertyName, oldValue, newValue);
498
- break;
499
- }
500
- }
501
-
502
- dataBind() {
503
- var that = this;
504
-
505
- that.$.itemsContainer.innerHTML = '';
506
-
507
- var template = '';
508
- var processDataSource = function (dataSource, isTabLayoutGroup) {
509
- for (var i = 0; i < dataSource.length; i++) {
510
- var item = dataSource[i];
511
-
512
- var size = item.size;
513
- var min = item.min;
514
- var modifiers = item.modifiers;
515
- var type = item.type;
516
- var position = item.position;
517
- var orientation = item.orientation ? item.orientation : 'vertical';
518
- var id = item.id;
519
- var label = item.label;
520
-
521
- var props = '';
522
-
523
- if (id !== undefined) {
524
- props += `id="${id}" `
525
- }
526
-
527
- if (size !== undefined) {
528
- props += `size="${size}" `
529
- }
530
-
531
- if (label !== undefined) {
532
- props += `label="${label}" `
533
- }
534
-
535
-
536
- if (min !== undefined) {
537
- props += `min="${min}" `
538
- }
539
-
540
- if (modifiers !== undefined) {
541
- props += `modifiers="${modifiers}" `
542
- }
543
-
544
- if (position !== undefined) {
545
- props += `position="${position}" `
546
- }
547
-
548
- if (item.items) {
549
- props += `orientation=${orientation} `
550
-
551
- if (type === 'tabs') {
552
- template += `<jqx-tab-layout-group ${props}>`;
553
- processDataSource(item.items, true);
554
- template += '</jqx-tab-layout-group>'
555
- }
556
- else {
557
- template += `<jqx-layout-group ${props}>`;
558
- processDataSource(item.items);
559
- template += '</jqx-layout-group>'
560
- }
561
- }
562
- else {
563
- var content = item.content || '';
564
- if (isTabLayoutGroup) {
565
- template += `<jqx-tab-layout-item ${props}>` + content + '</jqx-tab-layout-item>';
566
- }
567
- else {
568
- if (type === 'tabs') {
569
- template += `<jqx-tab-layout-group>`;
570
- template += `<jqx-tab-layout-item ${props}>` + content + '</jqx-tab-layout-item>';
571
- template += '</jqx-tab-layout-group>'
572
- }
573
- else {
574
- template += `<jqx-layout-item ${props}>` + content + '</jqx-layout-item>';
575
- }
576
- }
577
- }
578
- }
579
- }
580
-
581
- processDataSource(that.dataSource);
582
- that.$.itemsContainer.innerHTML = template;
583
- that.refresh();
584
- }
585
-
586
-
587
- /**
588
- * Element's render funciton
589
- */
590
- render() {
591
- var that = this;
592
-
593
- that.setAttribute('role', 'group');
594
-
595
- if (that.selectedIndex) {
596
- that._handleItemClick(that.getItem(that.selectedIndex + ''), true);
597
- }
598
-
599
-
600
- var render = (function () {
601
- if (!that.dataSource) {
602
- that.dataSource = that._getDataSource(that._getLayout());
603
- }
604
- else {
605
- that.dataBind();
606
- }
607
-
608
- that.$.itemsContainer.orientation = that.orientation;
609
-
610
- that.refresh();
611
- that._updateSplitter();
612
- that.isRendered = true;
613
- that.classList.add('outline');
614
-
615
- if (that.ready) {
616
- that.ready();
617
- }
618
- })
619
-
620
- if (document.readyState === 'complete') {
621
- render();
622
- }
623
- else {
624
- window.addEventListener('load', (function () {
625
- render();
626
- }));
627
- }
628
- }
629
-
630
- connectedCallback() {
631
- var that = this;
632
-
633
- var setup = function () {
634
- var fragment = document.createDocumentFragment();
635
-
636
- while (that.childNodes.length) {
637
- fragment.appendChild(that.firstChild);
638
- }
639
-
640
- that.innerHTML = that.template();
641
- that.classList.add('jqx-widget');
642
- that.$ = {
643
- container: that.querySelector("#container"),
644
- itemsContainer: that.querySelector("#itemsContainer"),
645
- splitter: that.querySelector("#splitter")
646
- };
647
-
648
- delete that.$.container.id;
649
- delete that.$.itemsContainer.id;
650
- delete that.$.splitter.id;
651
-
652
- that.$.itemsContainer.appendChild(fragment);
653
- that.classList.add('jqx-split-layout');
654
-
655
- document.addEventListener('pointerdown', function (event) {
656
- that._documentDownHandler(event);
657
- });
658
-
659
- document.addEventListener('pointermove', function (event) {
660
- that._documentMoveHandler(event);
661
- });
662
-
663
- document.addEventListener('pointerup', function (event) {
664
- that._documentUpHandler(event);
665
- });
666
-
667
- document.addEventListener('selectstart', function (event) {
668
- that._documentSelectStartHandler(event);
669
- });
670
-
671
- document.addEventListener('keyup', function (event) {
672
- that._keyUpHandler(event);
673
- });
674
-
675
- that.addEventListener('mouseleave', function (event) {
676
- that._leaveHandler(event);
677
- });
678
-
679
- that.addEventListener('mouseenter', function (event) {
680
- that._enterHandler(event);
681
- });
682
-
683
- that.addEventListener('dragStart', function (event) {
684
- that._dragStart(event);
685
- });
686
-
687
- that.render();
688
- }
689
-
690
- if (document.readyState === 'complete') {
691
- setup();
692
- }
693
- else {
694
- window.addEventListener('load', function () {
695
- setup();
696
- });
697
- }
698
- }
699
-
700
- /**
701
- * Returns the Splitter item according to the index
702
- * @param {any} index - string, e.g. '0.1'
703
- */
704
- getItem(index) {
705
- var that = this;
706
-
707
- if (index === undefined || index === null) {
708
- return;
709
- }
710
-
711
- index = (index + '').split('.');
712
-
713
- var items = that._getDataSource(that._getLayout()),
714
- item;
715
-
716
- for (var i = 0; i < index.length; i++) {
717
- item = items[index[i]];
718
-
719
- if (!item) {
720
- break;
721
- }
722
-
723
- items = item.items;
724
- }
725
-
726
- return item;
727
- }
728
-
729
-
730
- /**
731
- * Document down handler
732
- * @param {any} event
733
- */
734
- _documentDownHandler(event) {
735
- var that = this,
736
- target = event.target;
737
-
738
- if (that.contains(target) && target.closest) {
739
- that._target = target;
740
- that._updateSplitter();
741
- }
742
- }
743
-
744
- /**
745
- * Document move handler
746
- * @param {any} event
747
- */
748
- _documentMoveHandler(event) {
749
- var that = this,
750
- target = event.target,
751
- menu = that._contextMenu;
752
-
753
- if (menu && !JQX.Utilities.Core.isMobile) {
754
- if (menu.querySelector('.jqx-layout-context-menu-item[hover]')) {
755
- var items = menu.children;
756
-
757
- for (var i = 0; i < items.length; i++) {
758
- items[i].removeAttribute('hover');
759
- }
760
- }
761
-
762
- if (menu.contains(target) && target.closest && target.closest('.jqx-layout-context-menu-item')) {
763
- target.setAttribute('hover', '');
764
- }
765
- }
766
-
767
- if (that._dragDetails) {
768
- var offsetX = Math.abs(that._dragDetails.pageX - event.pageX);
769
- var offsetY = Math.abs(that._dragDetails.pageY - event.pageY);
770
-
771
- if (offsetY <= 5 && offsetX <= 5) {
772
- return;
773
- }
774
-
775
- if (!that._dragDetails.feedback.parentElement) {
776
- document.body.appendChild(that._dragDetails.feedback);
777
- document.body.appendChild(that._dragDetails.overlay)
778
- setTimeout(function () {
779
- that._dragDetails.feedback.classList.add('dragging');
780
- }, 100);
781
- }
782
-
783
- that._dragDetails.dragging = true;
784
-
785
- that._dragDetails.feedback.style.left = event.pageX - that._dragDetails.feedback.offsetWidth / 2 - 5 + 'px';
786
- that._dragDetails.feedback.style.top = event.pageY - that._dragDetails.feedback.offsetHeight / 2 - 5 + 'px';
787
-
788
- var elements = document.elementsFromPoint(event.pageX, event.pageY);
789
- var group = null;
790
- var isTabStrip = false;
791
-
792
- for (var i = 0; i < elements.length; i++) {
793
- var element = elements[i];
794
-
795
- if (that._dragDetails.feedback.contains(element)) {
796
- continue;
797
- }
798
-
799
- if (element.classList.contains('jqx-layout-tab-strip')) {
800
- if (that._dragDetails.element.contains(element)) {
801
- continue;
802
- }
803
-
804
- group = element.parentElement;
805
- isTabStrip = true;
806
- break;
807
- }
808
-
809
- if ((element.parentElement === that._dragDetails.parent || element === that._dragDetails.parent) && that._dragDetails.layoutGroup.items.length === 1) {
810
- continue;
811
- }
812
-
813
- if (that._dragDetails.element.contains(element)) {
814
- continue;
815
- }
816
-
817
- if (element instanceof TabLayoutItem) {
818
- group = element.parentElement;
819
- break;
820
- }
821
- else if (element instanceof TabLayoutGroup) {
822
- group = element;
823
- break;
824
- }
825
- }
826
-
827
- var getPosition = function (group, size) {
828
- var offset = that.offset(group);
829
- var position = null;
830
- var edgeSize = 50;
831
-
832
- var height = size;
833
- var width = size;
834
-
835
- if (!size) {
836
- width = group.offsetWidth / 3;
837
- height = group.offsetHeight / 3;
838
- }
839
- else {
840
- edgeSize = 0;
841
- }
842
-
843
- var positionRects = [
844
- {
845
- left: offset.left,
846
- top: offset.top,
847
- right: offset.left + edgeSize,
848
- bottom: offset.top + edgeSize,
849
- position: 'top'
850
- },
851
- {
852
- left: offset.left + edgeSize,
853
- top: offset.top,
854
- right: offset.left + group.offsetWidth - edgeSize,
855
- bottom: offset.top + height - edgeSize,
856
- position: 'top'
857
- },
858
- {
859
- left: offset.left + group.offsetWidth - edgeSize,
860
- top: offset.top,
861
- right: offset.left + group.offsetWidth,
862
- bottom: offset.top + edgeSize,
863
- position: 'top'
864
- },
865
- {
866
- left: offset.left,
867
- top: offset.top + edgeSize,
868
- right: offset.left + width,
869
- bottom: offset.top + group.offsetHeight - edgeSize,
870
- position: 'left'
871
- },
872
- {
873
- left: offset.left + group.offsetWidth - width,
874
- top: offset.top + edgeSize,
875
- right: offset.left + group.offsetWidth,
876
- bottom: offset.top + group.offsetHeight - edgeSize,
877
- position: 'right'
878
- },
879
- {
880
- left: offset.left,
881
- top: offset.top + group.offsetHeight - edgeSize,
882
- right: offset.left + edgeSize,
883
- bottom: offset.top + group.offsetHeight,
884
- position: 'bottom'
885
- },
886
- {
887
- left: offset.left + edgeSize,
888
- top: offset.top + group.offsetHeight - height + edgeSize,
889
- right: offset.left + group.offsetWidth - edgeSize,
890
- bottom: offset.top + group.offsetHeight,
891
- position: 'bottom'
892
- },
893
- {
894
- left: offset.left + group.offsetWidth - edgeSize,
895
- top: offset.top + group.offsetHeight - edgeSize,
896
- right: offset.left + group.offsetWidth,
897
- bottom: offset.top + group.offsetHeight,
898
- position: 'bottom'
899
- },
900
- ]
901
-
902
- for (var i = 0; i < positionRects.length; i++) {
903
- var rect = positionRects[i];
904
-
905
- if (rect.left <= event.pageX && event.pageX <= rect.right) {
906
- if (rect.top <= event.pageY && event.pageY <= rect.bottom) {
907
- position = rect.position;
908
- break;
909
- }
910
- }
911
- }
912
-
913
- return position;
914
- }
915
-
916
- var rootGroup = that.querySelector('jqx-layout-group');
917
-
918
- var position = getPosition(rootGroup, 10);
919
- var currentGroup = null;
920
-
921
- if (!position) {
922
- if (!group) {
923
- that._handleDropArea(null);
924
- }
925
- else {
926
- if (isTabStrip) {
927
- if (group !== that._dragDetails.parent) {
928
- position = 'center';
929
- currentGroup = group;
930
- }
931
- }
932
- else {
933
- position = getPosition(group) || 'center';
934
- currentGroup = group
935
- }
936
- }
937
- }
938
- else {
939
- currentGroup = rootGroup;
940
- }
941
-
942
- if (currentGroup) {
943
- that._dragDetails.current = currentGroup;
944
- that._dragDetails.position = position;
945
- that._handleDropArea(currentGroup, position);
946
- }
947
- }
948
-
949
- if (that._resizeDetails) {
950
- var offsetX = Math.abs(that._resizeDetails.clientX - event.clientX);
951
- var offsetY = Math.abs(that._resizeDetails.clientY - event.clientY);
952
-
953
- var splitter = that._resizeDetails.splitter;
954
- var item = that._resizeDetails.item;
955
- var itemRect = that._resizeDetails.itemRect;
956
- var previousItemRect = that._resizeDetails.previousItemRect;
957
- var previousItem = that._resizeDetails.previousItem;
958
- var nextItemRect = that._resizeDetails.nextItemRect;
959
- var nextItem = that._resizeDetails.nextItem;
960
- var minSize = parseInt(item.getAttribute('min'));
961
-
962
- var resetSplitter = function (splitter) {
963
- if (splitter.classList.contains('jqx-visibility-hidden')) {
964
- return;
965
- }
966
-
967
- splitter.style.right = '';
968
- splitter.style.top = '';
969
- splitter.style.left = '';
970
- splitter.style.bottom = '';
971
- }
972
-
973
- resetSplitter(splitter);
974
- resetSplitter(that.$.splitter);
975
-
976
- splitter.classList.remove('error');
977
- splitter.classList.add('active');
978
-
979
- if (!that._resizeDetails.dragging) {
980
- if (splitter.classList.contains('horizontal') && offsetY <= 5) {
981
- return;
982
- }
983
- else if (splitter.classList.contains('vertical') && offsetX <= 5) {
984
- return;
985
- }
986
-
987
- that._resizeDetails.dragging = true;
988
- }
989
-
990
- var normalized = {
991
- 'clientPos': 'clientX',
992
- 'pos': 'x',
993
- 'size': 'width',
994
- 'near': 'left',
995
- 'far': 'right',
996
- 'offsetSize': 'offsetWidth'
997
- }
998
-
999
- if (splitter.classList.contains('horizontal')) {
1000
- normalized = {
1001
- 'clientPos': 'clientY',
1002
- 'pos': 'y',
1003
- 'size': 'height',
1004
- 'near': 'top',
1005
- 'far': 'bottom',
1006
- 'offsetSize': 'offsetHeight'
1007
- }
1008
- }
1009
-
1010
- var updateSplitter = function (splitter) {
1011
- var offset = that.offset(splitter);
1012
- var elementOffset = that.offset(that);
1013
-
1014
- elementOffset.left++;
1015
- elementOffset.top++;
1016
-
1017
- that.$.splitter.style.width = splitter.offsetWidth + 'px';
1018
- that.$.splitter.style.height = splitter.offsetHeight + 'px';
1019
-
1020
- that.$.splitter.className = splitter.className;
1021
-
1022
- that.$.splitter.style.left = offset.left - elementOffset.left + 'px';
1023
- that.$.splitter.style.top = offset.top - elementOffset.top + 'px';
1024
-
1025
- splitter.setAttribute('drag', '');
1026
- that.$.splitter.setAttribute('drag', '');
1027
- }
1028
-
1029
- if (splitter.classList.contains('last')) {
1030
- var newPosition = event[normalized.clientPos] - that._resizeDetails.splitterRect[normalized.pos];
1031
- var maxPosition = itemRect[normalized.size] - minSize;
1032
-
1033
- if (newPosition > maxPosition) {
1034
- newPosition = maxPosition;
1035
- splitter.classList.add('error');
1036
- }
1037
-
1038
- if (previousItemRect) {
1039
- var minSize = parseInt(previousItem.getAttribute('min'));
1040
-
1041
- var minPosition = previousItemRect[normalized.size] - minSize;
1042
- if (newPosition < -minPosition) {
1043
- newPosition = -minPosition;
1044
- splitter.classList.add('error');
1045
- }
1046
- }
1047
-
1048
- splitter.style[normalized.near] = newPosition + 'px';
1049
-
1050
- var newSize = item[normalized.offsetSize] - newPosition;
1051
-
1052
- item.setAttribute('size', newSize);
1053
-
1054
- if (previousItem) {
1055
- var previousItemSize = item[normalized.offsetSize] + previousItem[normalized.offsetSize] - newSize;
1056
-
1057
- previousItem.setAttribute('size', previousItemSize);
1058
- }
1059
- }
1060
- else {
1061
- var newPosition = -event[normalized.clientPos] + that._resizeDetails.splitterRect[normalized.pos];
1062
- var minPosition = itemRect[normalized.size] - minSize;
1063
-
1064
- if (newPosition > minPosition) {
1065
- newPosition = minPosition;
1066
- splitter.classList.add('error');
1067
- }
1068
-
1069
- if (nextItemRect) {
1070
- var minSize = parseInt(nextItem.getAttribute('min'));
1071
-
1072
- var maxPosition = -nextItemRect[normalized.size] + minSize;
1073
- if (newPosition < maxPosition) {
1074
- newPosition = maxPosition;
1075
- splitter.classList.add('error');
1076
- }
1077
- }
1078
-
1079
-
1080
- splitter.style[normalized.far] = newPosition + 'px';
1081
-
1082
- var newSize = item[normalized.offsetSize] - newPosition;
1083
-
1084
- item.setAttribute('size', newSize);
1085
-
1086
- if (nextItem) {
1087
- var nextItemSize = nextItem[normalized.offsetSize] + item[normalized.offsetSize] - newSize;
1088
-
1089
- nextItem.setAttribute('size', nextItemSize);
1090
- }
1091
- }
1092
-
1093
- updateSplitter(splitter);
1094
- }
1095
- }
1096
-
1097
- _offsetTop(element) {
1098
- var that = this;
1099
-
1100
- if (!element) {
1101
- return 0;
1102
- }
1103
-
1104
- return element.offsetTop + that._offsetTop(element.offsetParent);
1105
- }
1106
-
1107
- _offsetLeft(element) {
1108
- var that = this;
1109
-
1110
- if (!element) {
1111
- return 0;
1112
- }
1113
-
1114
- return element.offsetLeft + that._offsetLeft(element.offsetParent);
1115
- }
1116
-
1117
- offset(element) {
1118
- return { left: this._offsetLeft(element), top: this._offsetTop(element) }
1119
- }
1120
-
1121
- _keyUpHandler(event) {
1122
- var that = this;
1123
- if (event.key === 'Escape') {
1124
- if (that._dragDetails) {
1125
- that._dragDetails.feedback.remove();
1126
- that._dragDetails.overlay.remove();
1127
- that._dragDetails = null;
1128
- that._handleDropArea(null);
1129
- }
1130
-
1131
- if (that._resizeDetails) {
1132
- var drag = that._resizeDetails;
1133
-
1134
- drag.splitter.classList.contains('last') ? drag.previousItem.size = drag.previousItemSize : drag.nextItem.size = drag.nextItem.previousItemSize;
1135
- drag.item.size = drag.itemSize;
1136
-
1137
- that.refresh();
1138
- that._handleItemClick(drag.item);
1139
- that._resizeDetails = null;
1140
- return;
1141
- }
1142
- }
1143
- else if (event.key === 'Delete') {
1144
- if (that._selectedItem) {
1145
- that._removeLayoutItem(that._selectedItem);
1146
- }
1147
- }
1148
- }
1149
-
1150
- _endDrag() {
1151
- var that = this;
1152
-
1153
- that._handleDropArea(null);
1154
-
1155
- if (!that._dragDetails.dragging) {
1156
- that._dragDetails = null;
1157
- return;
1158
- }
1159
-
1160
- var group = that._dragDetails.current;
1161
- var item = that._dragDetails.element;
1162
- var position = that._dragDetails.position;
1163
-
1164
- that._handleDropArea(null);
1165
-
1166
- if (group) {
1167
- that._addTabLayoutItem(group, position, item);
1168
- that._removeLayoutItem(item);
1169
-
1170
- if (group.parentElement && Array.from(group.parentElement.parentElement.children).filter(function (value) {
1171
- if (value.classList.contains('jqx-layout-group')) {
1172
- return true;
1173
- }
1174
-
1175
- return false;
1176
- }).length === 1) {
1177
- var parent = group.parentElement;
1178
- var parentGroup = parent.parentElement;
1179
- var ownerGroup = parentGroup.parentElement;
1180
-
1181
- if (!(parentGroup.getAttribute('data-id') === 'root' || ownerGroup.getAttribute('data-id') === 'root') && ownerGroup !== that) {
1182
- var index = Array.from(ownerGroup.children).indexOf(parent.parentElement);
1183
-
1184
- if (index >= 0) {
1185
- ownerGroup.insertBefore(parent, ownerGroup.children[index])
1186
- }
1187
- else {
1188
- ownerGroup.appendChild(parent);
1189
- }
1190
-
1191
- parentGroup.remove();
1192
- }
1193
- }
1194
-
1195
- that.refresh();
1196
- that._updateSplitter();
1197
-
1198
- requestAnimationFrame(function () {
1199
- that.classList.add('outline');
1200
- that.querySelectorAll('.jqx-element').forEach(function (control) {
1201
- that.dispatchEvent(new CustomEvent('resize'));
1202
-
1203
- });
1204
- })
1205
- }
1206
-
1207
- that.dispatchEvent(new CustomEvent('stateChange', { type: 'insert', item: item }));
1208
-
1209
- that._dragDetails.feedback.remove();
1210
- that._dragDetails.overlay.remove();
1211
- that._dragDetails = null;
1212
- }
1213
- /**
1214
- * Document up handler
1215
- * @param {any} event
1216
- */
1217
- _documentUpHandler(event) {
1218
- var that = this,
1219
- isMobile = JQX.Utilities.Core.isMobile,
1220
- target = isMobile ? document.elementFromPoint(event.pageX - window.pageXOffset, event.pageY - window.pageYOffset) : event.target;
1221
-
1222
-
1223
- if (event.button === 2) {
1224
- return;
1225
- }
1226
-
1227
- if (that._dragDetails) {
1228
- that._endDrag(event);
1229
- }
1230
-
1231
- if (that._resizeDetails) {
1232
- var drag = that._resizeDetails;
1233
-
1234
- if (drag.item) {
1235
- drag.item.style.overflow = '';
1236
- }
1237
-
1238
- if (drag.previousItem) {
1239
- drag.previousItem.style.overflow = '';
1240
- }
1241
-
1242
- if (drag.nextItem) {
1243
- drag.nextItem.style.overflow = '';
1244
- }
1245
-
1246
- that.refresh();
1247
- that._handleItemClick(drag.item);
1248
- that._resizeDetails = null;
1249
- window.dispatchEvent(new Event('resize'));
1250
-
1251
- that.querySelectorAll('.jqx-element').forEach(function (control) {
1252
- control.dispatchEvent(new CustomEvent('resize'));
1253
- });
1254
- return;
1255
- }
1256
-
1257
- if (!that.contains(target)) {
1258
- return;
1259
- }
1260
-
1261
- that.classList.add('outline');
1262
-
1263
- if (that._target && !target.item) {
1264
- if (target instanceof TabLayoutItem) {
1265
- that._handleItemClick(target);
1266
- }
1267
- else {
1268
- that._handleItemClick(target.closest('.jqx-layout-item'));
1269
- }
1270
- }
1271
-
1272
- if (that._target) {
1273
- if (that._target !== target) {
1274
- delete that._target;
1275
- return;
1276
- }
1277
-
1278
- if (!event.button && target.closest('.jqx-layout-buttons-container')) {
1279
- var button = event.target;
1280
-
1281
- that._handleButtonClick(button.item, button.position);
1282
- }
1283
- else if (target.closest('.jqx-layout-context-menu') && (!isMobile && !event.button || isMobile)) {
1284
- that._handleMenuItemClick(target.closest('.jqx-layout-context-menu-item'));
1285
- }
1286
-
1287
- delete that._target;
1288
- }
1289
- }
1290
-
1291
- /**
1292
- * Document Select Start event handler
1293
- */
1294
- _documentSelectStartHandler(event) {
1295
- var that = this;
1296
-
1297
- if (that._target) {
1298
- event.preventDefault();
1299
- }
1300
- }
1301
-
1302
- /**
1303
- * Adds labels to the items that do not have set
1304
- * @param {any} data
1305
- */
1306
- _getDataSource(layout, path, index) {
1307
- var that = this;
1308
-
1309
- var data = [];
1310
-
1311
- if (!index) {
1312
- index = 0;
1313
- }
1314
-
1315
- if (!path) {
1316
- path = '';
1317
- }
1318
-
1319
- for (var i = 0; i < layout.length; i++) {
1320
- var layoutItem = layout[i];
1321
-
1322
- var item = {
1323
- label: layoutItem.label,
1324
- id: layoutItem.getAttribute('data-id'),
1325
- orientation: layoutItem.orientation,
1326
- size: layoutItem.size,
1327
- min: layoutItem.min,
1328
- type: layoutItem.type,
1329
- modifiers: layoutItem.modifiers,
1330
- position: layoutItem.position
1331
- }
1332
-
1333
- layoutItem.removeAttribute('index');
1334
-
1335
- if (layoutItem instanceof LayoutGroup) {
1336
- data.push(item);
1337
-
1338
- item.index = path !== '' ? path + '.' + index : index.toString();
1339
- layoutItem.setAttribute('index', item.index);
1340
-
1341
- if (layoutItem.items) {
1342
- var items = that._getDataSource(layoutItem.items, item.index, 0);
1343
- item.items = items;
1344
- }
1345
- }
1346
- else if (layoutItem instanceof LayoutItem) {
1347
- if (layoutItem.items) {
1348
- var items = that._getDataSource(layoutItem.items, path, index);
1349
-
1350
- data = data.concat(items);
1351
- }
1352
- else {
1353
- item.index = path !== '' ? path + '.' + index : index.toString();
1354
- layoutItem.setAttribute('index', item.index);
1355
-
1356
- data.push(item);
1357
- }
1358
- }
1359
-
1360
- index++;
1361
- }
1362
-
1363
- return data;
1364
- }
1365
-
1366
- /**
1367
- * Generates the JSON array of the current structure of the element
1368
- */
1369
- _getLayout() {
1370
- var that = this;
1371
- var group = !arguments.length ? that.$.itemsContainer : arguments[0];
1372
-
1373
- if (that._buttons) {
1374
- that._buttons.remove();
1375
- }
1376
-
1377
- if (that._dropArea) {
1378
- that._dropArea.remove();
1379
- }
1380
-
1381
- var splitters = that.querySelectorAll('.jqx-layout-splitter');
1382
-
1383
- for (var i = 0; i < splitters.length; i++) {
1384
- var splitter = splitters[i];
1385
-
1386
- if (splitter !== that.$.splitter) {
1387
- splitter.remove();
1388
- }
1389
- }
1390
-
1391
- group.items = Array.from(group.children);
1392
- group.items = group.items.filter(function (value) {
1393
- return value !== group.tabs && value.hasAttribute('data-id');
1394
- });
1395
-
1396
- var items = group.items.map(function (value) {
1397
- if (value.classList.contains('jqx-layout-tab-strip')) {
1398
- return null;
1399
- }
1400
-
1401
- var item = value;
1402
- var itemGroup = value instanceof LayoutGroup ? value : null;
1403
-
1404
- if (itemGroup) {
1405
- item.items = that._getLayout(itemGroup)
1406
- }
1407
-
1408
- return item;
1409
- });
1410
-
1411
- if (group !== that.$.itemsContainer) {
1412
- return items.filter(function (value) {
1413
- return value !== null && value !== group.tabs
1414
- });
1415
- }
1416
-
1417
- var data = [];
1418
- var item = group;
1419
-
1420
- item.items = items.filter(function (value) {
1421
- return value !== null && value !== group.tabs
1422
- });
1423
-
1424
- data.push(item);
1425
-
1426
- return data;
1427
- }
1428
-
1429
-
1430
- _updateSplitter() {
1431
- var that = this;
1432
-
1433
- if (that._buttons && that._dragDetails) {
1434
- that._buttons.remove();
1435
- }
1436
-
1437
- that._removeSplitter();
1438
- var items = that.querySelectorAll('[data-id]');
1439
-
1440
- for (var i = 0; i < items.length; i++) {
1441
- var item = items[i];
1442
-
1443
- if (item.getAttribute('data-id') === 'root') {
1444
- continue;
1445
- }
1446
-
1447
- if (item.hasAttribute('role')) {
1448
- var role = item.getAttribute('role');
1449
-
1450
- if (role === 'gridcell' || role === 'row' || role === 'columnheader' || role === 'rowheader') {
1451
- continue;
1452
- }
1453
- }
1454
-
1455
- item.setAttribute('hover', '');
1456
- that._handleSplitter(item);
1457
- }
1458
- }
1459
-
1460
- _hideSplitter() {
1461
- var that = this;
1462
-
1463
- var items = that.querySelectorAll('[data-id]');
1464
-
1465
- for (var i = 0; i < items.length; i++) {
1466
- var item = items[i];
1467
-
1468
- item.removeAttribute('hover');
1469
- }
1470
- }
1471
-
1472
- _removeSplitter() {
1473
- var that = this;
1474
- var splitters = that.querySelectorAll('.jqx-layout-splitter');
1475
-
1476
- for (var i = 0; i < splitters.length; i++) {
1477
- var splitter = splitters[i];
1478
-
1479
- if (splitter !== that.$.splitter) {
1480
- splitter.remove();
1481
- }
1482
- }
1483
-
1484
- that._hideSplitter();
1485
- }
1486
-
1487
- /**
1488
- * Handles item selection
1489
- * @param {any} target - target element that was clicked
1490
- * @param {any} isOnDemand - selection on demand
1491
- */
1492
- _handleItemClick(target) {
1493
- var that = this,
1494
- previouslySelectedIndex = that.selectedIndex;
1495
-
1496
- var item = null;
1497
-
1498
- if (!target) {
1499
- that.selectedIndex = null;
1500
- that.querySelectorAll('[data-id]').forEach(function (i) { i.removeAttribute('selected') });
1501
- that._selectedItem = null;
1502
- return;
1503
- }
1504
- else {
1505
- item = target instanceof HTMLElement ? target : that.querySelector('[data-id=' + target.id + ']');
1506
-
1507
- if (item && item.readonly) {
1508
- that.selectedIndex = null;
1509
- return;
1510
- }
1511
-
1512
- that.querySelectorAll('[data-id]').forEach(function (i) { i.removeAttribute('selected') });
1513
-
1514
- if (!item) {
1515
- that.refresh();
1516
- return;
1517
- }
1518
-
1519
- that.selectedIndex = item.getAttribute('index');
1520
-
1521
- item.setAttribute('selected', '');
1522
- item.setAttribute('hover', '');
1523
- that._selectedItem = item;
1524
- if (item.classList.contains('jqx-hidden')) {
1525
- that.refresh();
1526
- }
1527
-
1528
- that._handleButtonsVisibility(item);
1529
-
1530
- if (previouslySelectedIndex !== that.selectedIndex) {
1531
- that.dispatchEvent(new CustomEvent('change'));
1532
- }
1533
- }
1534
-
1535
- that._updateSplitter();
1536
- }
1537
-
1538
- /**
1539
- * Handles Layout Button click
1540
- * @param {any} target
1541
- */
1542
- _handleButtonClick(target, position) {
1543
- var that = this,
1544
- newItem = that._addLayoutItem(target, position);
1545
-
1546
- //Select the new empty item
1547
- that.dispatchEvent(new CustomEvent('stateChange', { type: 'insert', item: newItem }));
1548
-
1549
- that._handleItemClick(newItem, true);
1550
- }
1551
-
1552
-
1553
-
1554
- _removeLayoutItem(item) {
1555
- var that = this;
1556
-
1557
- if (item.getAttribute('data-id') === 'root') {
1558
- return;
1559
- }
1560
-
1561
- if (item instanceof LayoutItem && item.parentElement.items.length === 1) {
1562
- var parent = item.parentElement;
1563
- var currentParent = parent;
1564
-
1565
- while (parent && parent.items && parent.items.length === 1) {
1566
- if (parent.getAttribute('data-id') === 'root') {
1567
- break;
1568
- }
1569
-
1570
- currentParent = parent;
1571
- parent = parent.parentElement;
1572
- }
1573
-
1574
- if (currentParent.getAttribute('data-id') !== 'root') {
1575
- currentParent.remove();
1576
- }
1577
- else if (that.allowLiveSplit) {
1578
- currentParent.appendChild(document.createElement('jqx-layout-item'));
1579
- }
1580
- }
1581
- else {
1582
- item.remove();
1583
- }
1584
-
1585
- that.refresh();
1586
-
1587
- that.dispatchEvent(new CustomEvent('stateChange', { type: 'delete', item: item }));
1588
- }
1589
-
1590
- /**
1591
- * Refreshes the UI Component.
1592
- */
1593
- refresh() {
1594
- var that = this;
1595
-
1596
- if (that._isUpdating) {
1597
- return;
1598
- }
1599
-
1600
- that.dataSource = that._getDataSource(that._getLayout());
1601
-
1602
- that.$.splitter.className = 'jqx-visibility-hidden jqx-layout-splitter';
1603
-
1604
- var refreshLayoutGroup = function (group) {
1605
- var item = that.getItem(group.getAttribute('index'));
1606
-
1607
- if (!item) {
1608
- return;
1609
- }
1610
- group.style.gridTemplateColumns = '';
1611
- group.style.gridTemplateRows = '';
1612
-
1613
- var template = '';
1614
- var percentages = 0;
1615
- var withSizeCount = 0;
1616
-
1617
- if (group instanceof TabLayoutGroup) {
1618
- if (group.tabs) {
1619
- group.tabs.remove();
1620
- }
1621
-
1622
- var header = document.createElement('div');
1623
- header.classList.add('jqx-layout-tab-strip');
1624
-
1625
- if (that._selectedItem && group.contains(that._selectedItem) && that._selectedItem instanceof TabLayoutItem) {
1626
- group.selectedIndex = Math.max(0, group.items.indexOf(that._selectedItem));
1627
- }
1628
-
1629
- if (group.selectedIndex >= group.children.length) {
1630
- group.selectedIndex = 0;
1631
- }
1632
-
1633
- for (var i = 0; i < group.children.length; i++) {
1634
- var child = group.children[i];
1635
- var childItem = that.getItem(child.getAttribute('index'));
1636
-
1637
- if (!childItem) {
1638
- continue;
1639
- }
1640
-
1641
- var tab = document.createElement('div');
1642
- tab.classList.add('jqx-layout-tab');
1643
- tab.innerHTML = '<label>' + childItem.label + '</label><span class="jqx-close-button"></span>';
1644
- header.appendChild(tab);
1645
- child.setAttribute('tab', '');
1646
- child.classList.add('jqx-hidden');
1647
- tab.content = child;
1648
- tab.item = childItem;
1649
- tab.group = item;
1650
-
1651
- if (child.modifiers) {
1652
- if (child.modifiers.indexOf('close') === -1) {
1653
- tab.querySelector('.jqx-close-button').classList.add('jqx-hidden');
1654
- }
1655
- }
1656
- else {
1657
- tab.querySelector('.jqx-close-button').classList.add('jqx-hidden');
1658
- }
1659
-
1660
- if (undefined === group.selectedIndex || i === group.selectedIndex) {
1661
- tab.classList.add('selected');
1662
- child.classList.remove('jqx-hidden');
1663
- group.selectedIndex = i;
1664
- }
1665
-
1666
-
1667
- tab.onpointerup = function (event) {
1668
- if (event.target.classList.contains('jqx-close-button') && tab.close) {
1669
- group.selectedIndex = 0;
1670
- that._removeLayoutItem(that._selectedItem);
1671
- that._handleItemClick(parent);
1672
- }
1673
- }
1674
- tab.onpointerdown = function (event) {
1675
- var parent = this.closest('.jqx-layout-group');
1676
- that._handleItemClick(this.content);
1677
- tab.close = false;
1678
- if (!event.target.classList.contains('jqx-close-button')) {
1679
- if (childItem.modifiers && childItem.modifiers.indexOf('drag') >= 0 && parent.modifiers.indexOf('drag') >= 0) {
1680
- that._beginDrag(parent, this, event);
1681
- }
1682
- }
1683
- else {
1684
- tab.close = true;
1685
- }
1686
- }
1687
-
1688
- }
1689
-
1690
-
1691
- group.tabs = header;
1692
-
1693
- if (item.position === 'top' || item.position === 'left') {
1694
- group.insertBefore(header, group.firstChild);
1695
- }
1696
- else {
1697
- group.appendChild(header);
1698
- }
1699
- }
1700
- else {
1701
- for (var i = 0; i < group.children.length; i++) {
1702
- var child = group.children[i];
1703
-
1704
- if (child.hasAttribute('size')) {
1705
- var size = child.getAttribute('size');
1706
-
1707
- var pixels = parseFloat(size);
1708
- var groupSize = group.orientation === 'vertical' ? group.offsetWidth : group.offsetHeight;
1709
- var percentage = size.indexOf('%') >= 0 ? parseFloat(size) : parseFloat((pixels / groupSize) * 100);
1710
-
1711
- percentages += percentage;
1712
- withSizeCount++;
1713
-
1714
- if (withSizeCount === group.children.length) {
1715
- if (percentages < 100) {
1716
- template += '1fr ';
1717
- percentages = 100;
1718
- continue;
1719
- }
1720
- else if (percentages > 100) {
1721
- percentages -= percentage;
1722
- percentage = 100 - percentages;
1723
- percentages = 100;
1724
- }
1725
- }
1726
- else if (percentages > 100 || percentage === 0) {
1727
- withSizeCount = group.children.length;
1728
- percentages = 0;
1729
- break;
1730
- }
1731
-
1732
- template += percentage + '% ';
1733
- continue;
1734
- }
1735
-
1736
- template += '1fr ';
1737
- }
1738
-
1739
- if (withSizeCount === group.children.length) {
1740
- if (percentages < 99 || percentages > 100) {
1741
- template = '';
1742
-
1743
- for (var i = 0; i < group.children.length; i++) {
1744
- var child = group.children[i];
1745
-
1746
- child.removeAttribute('size');
1747
- template += '1fr ';
1748
- }
1749
- }
1750
- }
1751
-
1752
- if (group.orientation === 'vertical') {
1753
- group.style.gridTemplateColumns = template;
1754
- }
1755
- else {
1756
- group.style.gridTemplateRows = template;
1757
- }
1758
- }
1759
-
1760
- group.items = Array.from(group.children);
1761
- group.items = group.items.filter(function (value) {
1762
- return value !== group.tabs;
1763
- });
1764
- }
1765
-
1766
- var layoutGroups = that.querySelectorAll('.jqx-layout-group');
1767
-
1768
- for (var i = 0; i < layoutGroups.length; i++) {
1769
- refreshLayoutGroup(layoutGroups[i]);
1770
- }
1771
- }
1772
-
1773
- _beginDrag(parent, element, event) {
1774
- var that = this;
1775
-
1776
- if (that._dragDetails) {
1777
- that._dragDetails.feedback.remove();
1778
- }
1779
-
1780
- var feedback = document.createElement('div');
1781
- var overlay = document.createElement('div');
1782
- var tabs = parent.querySelector('.jqx-layout-tab-strip');
1783
- var label = '';
1784
-
1785
- if (tabs) {
1786
- for (var i = 0; i < Array.from(tabs.children).length; i++) {
1787
- if (i === parent.selectedIndex) {
1788
- label = tabs.children[i].innerText;
1789
- }
1790
- }
1791
- }
1792
-
1793
- feedback.innerHTML = `<jqx-split-layout><jqx-tab-layout-group><jqx-tab-layout-item label="${label}"></jqx-tab-layout-item></jqx-tab-layout-group></jqx-split-layout>`
1794
- that._feedback = feedback;
1795
- that._feedback.classList.add('jqx-split-layout-feedback', 'jqx-split-layout', 'jqx-widget');
1796
-
1797
- overlay.classList.add('jqx-split-layout-overlay');
1798
-
1799
- that._dragDetails = {
1800
- element: element.content,
1801
- item: element.item,
1802
- layoutGroup: element.group,
1803
- parent: parent,
1804
- overlay: overlay,
1805
- feedback: feedback,
1806
- pageX: event.pageX,
1807
- pageY: event.pageY
1808
- }
1809
- }
1810
-
1811
- moveChildren(oldItem, newItem) {
1812
- newItem.innerHTML = '';
1813
- var content = oldItem;
1814
-
1815
- while (content.firstChild) {
1816
- var child = content.firstChild;
1817
- newItem.appendChild(child);
1818
- }
1819
- }
1820
-
1821
- createLayoutItem(type, position) {
1822
- var that = this;
1823
-
1824
- var getLayoutItem = function () {
1825
- var item = document.createElement('jqx-layout-item');
1826
-
1827
- item.innerHTML = '';
1828
-
1829
- that.dispatchEvent(new CustomEvent('createItem', { type: 'layoutItem', item: item }));
1830
-
1831
- return item;
1832
- }
1833
-
1834
- var getTabLayoutItem = function () {
1835
- var item = document.createElement('jqx-tab-layout-item');
1836
-
1837
- item.innerHTML = '';
1838
-
1839
- that.dispatchEvent(new CustomEvent('createItem', { type: 'tabLayoutItem', item: item }));
1840
-
1841
- return item;
1842
- }
1843
-
1844
- var getLayoutGroup = function (position) {
1845
- var item = document.createElement('jqx-layout-group');
1846
- var orientation = position === 'top' || position === 'bottom' ? 'horizontal' : 'vertical';
1847
-
1848
- that.dispatchEvent(new CustomEvent('createGroup', { type: 'layoutGroup', item: item }));
1849
-
1850
- item.setAttribute('orientation', orientation);
1851
- item.orientation = orientation;
1852
-
1853
- return item;
1854
- }
1855
-
1856
- var getTabLayoutGroup = function (position) {
1857
- var item = document.createElement('jqx-tab-layout-group');
1858
- var orientation = position === 'top' || position === 'bottom' ? 'horizontal' : 'vertical';
1859
-
1860
- item.setAttribute('orientation', orientation);
1861
- item.orientation = orientation;
1862
-
1863
- that.dispatchEvent(new CustomEvent('tabLayoutGroup', { type: 'layoutGroup', item: item }));
1864
-
1865
- return item;
1866
- }
1867
-
1868
- if (type === 'layoutItem' || !type) {
1869
- return getLayoutItem();
1870
- }
1871
- else if (type === 'tabLayoutItem' || !type) {
1872
- return getTabLayoutItem();
1873
- }
1874
- else if (type === 'tabLayoutGroup') {
1875
- return getTabLayoutGroup(position);
1876
- }
1877
- else {
1878
- return getLayoutGroup(position);
1879
- }
1880
- }
1881
-
1882
- _addTabLayoutItem(targetItem, position, myItem) {
1883
- var that = this;
1884
- var newItem = that.createLayoutItem('tabLayoutItem');
1885
-
1886
- var parentLayoutGroup = targetItem.closest('jqx-tab-layout-group');
1887
- var layoutGroup;
1888
-
1889
- if (myItem) {
1890
- newItem.label = myItem.label;
1891
- newItem.modifiers = myItem.modifiers;
1892
- that.moveChildren(myItem, newItem);
1893
- }
1894
-
1895
- var resetGroup = function (group) {
1896
- for (var i = 0; i < group.children.length; i++) {
1897
- var child = group.children[i];
1898
-
1899
- child.removeAttribute('size');
1900
- }
1901
-
1902
- group.removeAttribute('size');
1903
- }
1904
-
1905
- var addTabItemChild = function (position) {
1906
- targetItem.removeAttribute('size');
1907
-
1908
- if (targetItem.querySelector('jqx-layout-group')) {
1909
- that._addLayoutItem(targetItem.querySelector('jqx-layout-group'), position);
1910
- }
1911
- else {
1912
- layoutGroup = that.createLayoutItem('layoutGroup', position);
1913
-
1914
- var newLayoutItem = that.createLayoutItem();
1915
- that.moveChildren(targetItem, newLayoutItem)
1916
-
1917
- if (position === 'top' || position === 'left') {
1918
- layoutGroup.appendChild(that.createLayoutItem());
1919
- layoutGroup.appendChild(newLayoutItem);
1920
- }
1921
- else {
1922
- layoutGroup.appendChild(newLayoutItem);
1923
- layoutGroup.appendChild(that.createLayoutItem());
1924
- }
1925
-
1926
- targetItem.appendChild(layoutGroup);
1927
- }
1928
- }
1929
-
1930
- var addRootTab = function (tabLayoutGroup, position) {
1931
-
1932
- var parentLayoutGroup = targetItem.parentElement;
1933
- var layoutGroup = targetItem;
1934
- var newLayoutGroup = that.createLayoutItem('layoutGroup', position);
1935
-
1936
- parentLayoutGroup.insertBefore(newLayoutGroup, layoutGroup);
1937
-
1938
- if (position === 'top' || position === 'left') {
1939
- newLayoutGroup.append(tabLayoutGroup);
1940
- newLayoutGroup.appendChild(layoutGroup);
1941
- }
1942
- else {
1943
- newLayoutGroup.appendChild(layoutGroup);
1944
- newLayoutGroup.append(tabLayoutGroup);
1945
- }
1946
-
1947
- if (layoutGroup.getAttribute('data-id') === 'root') {
1948
- layoutGroup.setAttribute('data-id', newLayoutGroup.getAttribute('data-id'));
1949
- newLayoutGroup.setAttribute('data-id', 'root');
1950
- that.$.itemsContainer = newLayoutGroup;
1951
- }
1952
-
1953
- resetGroup(layoutGroup);
1954
- resetGroup(parentLayoutGroup);
1955
- }
1956
-
1957
- if (myItem) {
1958
- switch (position) {
1959
- case 'center': {
1960
- if (targetItem instanceof TabLayoutGroup || targetItem instanceof TabLayoutItem) {
1961
- parentLayoutGroup.appendChild(newItem);
1962
- }
1963
- else {
1964
- var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
1965
- tabLayoutGroup.appendChild(newItem);
1966
-
1967
- if (targetItem instanceof LayoutGroup && !(targetItem instanceof TabLayoutItem)) {
1968
- targetItem.appendChild(tabLayoutGroup);
1969
- resetGroup(targetItem);
1970
- }
1971
- else if (targetItem instanceof LayoutItem) {
1972
- layoutGroup = that.createLayoutItem('layoutGroup');
1973
-
1974
- targetItem.parentElement.insertBefore(layoutGroup, targetItem);
1975
- layoutGroup.appendChild(targetItem);
1976
- layoutGroup.appendChild(tabLayoutGroup);
1977
- resetGroup(layoutGroup);
1978
- }
1979
- }
1980
- }
1981
- break;
1982
- case 'left':
1983
- case 'right': {
1984
- var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
1985
- tabLayoutGroup.appendChild(newItem);
1986
- if (targetItem.getAttribute('data-id') === 'root') {
1987
- tabLayoutGroup.position = position;
1988
- addRootTab(tabLayoutGroup, position);
1989
- }
1990
- else {
1991
- addRootTab(tabLayoutGroup, position);
1992
- }
1993
- }
1994
- break;
1995
- case 'top':
1996
- case 'bottom': {
1997
- var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
1998
- tabLayoutGroup.appendChild(newItem);
1999
-
2000
- if (targetItem.getAttribute('data-id') === 'root') {
2001
- tabLayoutGroup.position = position;
2002
- addRootTab(tabLayoutGroup, position);
2003
- }
2004
- else {
2005
- addRootTab(tabLayoutGroup, position);
2006
- }
2007
- break;
2008
- }
2009
- }
2010
-
2011
- return;
2012
- }
2013
-
2014
- switch (position) {
2015
- case 'center':
2016
- if (targetItem instanceof TabLayoutGroup || targetItem instanceof TabLayoutItem) {
2017
- parentLayoutGroup.appendChild(newItem);
2018
- }
2019
- else {
2020
- addTabItemChild();
2021
- }
2022
- break;
2023
- case 'left':
2024
- case 'right':
2025
- if (targetItem instanceof TabLayoutGroup) {
2026
- var firstItem = targetItem.querySelector('jqx-tab-layout-item');
2027
-
2028
- if (firstItem && position === 'left') {
2029
- targetItem.insertBefore(newItem, firstItem);
2030
- }
2031
- else {
2032
- targetItem.appendChild(newItem);
2033
- }
2034
- }
2035
- else if (targetItem instanceof TabLayoutItem) {
2036
- var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
2037
- var parentLayoutGroup = targetItem.parentElement;
2038
-
2039
- tabLayoutGroup.appendChild(newItem);
2040
-
2041
- layoutGroup = that.createLayoutItem('layoutGroup');
2042
-
2043
- parentLayoutGroup.parentElement.insertBefore(layoutGroup, parentLayoutGroup);
2044
-
2045
- if (position === 'right') {
2046
- layoutGroup.appendChild(parentLayoutGroup);
2047
- layoutGroup.appendChild(tabLayoutGroup);
2048
- }
2049
- else if (position === 'left') {
2050
- layoutGroup.appendChild(tabLayoutGroup);
2051
- layoutGroup.appendChild(parentLayoutGroup);
2052
- }
2053
- }
2054
- else if (myItem) {
2055
- var tabLayoutGroup = that.createLayoutItem('tabLayoutGroup', 'top');
2056
- tabLayoutGroup.appendChild(newItem);
2057
-
2058
- if (targetItem instanceof LayoutGroup) {
2059
- targetItem.insertBefore(targetItem.firstChild, tabLayoutGroup);
2060
- }
2061
- else if (targetItem instanceof LayoutItem) {
2062
- layoutGroup = that.createLayoutItem('layoutGroup');
2063
- layoutGroup.orientation = parentLayoutGroup.orientation;
2064
- layoutGroup.setAttribute('orientation', parentLayoutGroup.orientation);
2065
-
2066
- targetItem.removeAttribute('size');
2067
- targetItem.parentElement.insertBefore(layoutGroup, targetItem);
2068
- layoutGroup.appendChild(targetItem);
2069
- layoutGroup.appendChild(tabLayoutGroup);
2070
- }
2071
- }
2072
- else {
2073
- addTabItemChild(position);
2074
- }
2075
- break;
2076
- case 'top':
2077
- case 'bottom':
2078
- if (targetItem instanceof TabLayoutGroup) {
2079
- layoutGroup = that.createLayoutItem('layoutGroup', 'top');
2080
- targetItem.removeAttribute('size');
2081
-
2082
- targetItem.parentElement.insertBefore(layoutGroup, targetItem);
2083
-
2084
- if (position === 'top') {
2085
- layoutGroup.appendChild(that.createLayoutItem());
2086
- layoutGroup.appendChild(targetItem);
2087
- }
2088
- else {
2089
- layoutGroup.appendChild(targetItem);
2090
- layoutGroup.appendChild(that.createLayoutItem());
2091
- }
2092
- }
2093
- else {
2094
- addTabItemChild(position);
2095
- }
2096
- break;
2097
- }
2098
-
2099
- that.refresh();
2100
- }
2101
-
2102
- /**
2103
- * Creates a new item by splitting the target Splitter
2104
- */
2105
- _addLayoutItem(targetItem, position, myItem) {
2106
- var that = this;
2107
-
2108
- if (!targetItem) {
2109
- return;
2110
- }
2111
-
2112
- var resetGroup = function (group) {
2113
- for (var i = 0; i < group.children.length; i++) {
2114
- var child = group.children[i];
2115
-
2116
- child.removeAttribute('size');
2117
- }
2118
-
2119
- group.removeAttribute('size');
2120
- }
2121
-
2122
- var isTabItem = targetItem instanceof TabLayoutItem || targetItem instanceof TabLayoutGroup || (myItem && myItem instanceof TabLayoutItem);
2123
-
2124
- if (isTabItem) {
2125
- return that._addTabLayoutItem(targetItem, position, myItem);
2126
- }
2127
-
2128
- var newItem = that.createLayoutItem();
2129
-
2130
- var parentLayoutGroup = targetItem.closest('.jqx-layout-group');
2131
- var layoutGroup;
2132
-
2133
- if (myItem) {
2134
- that.moveChildren(myItem, newItem);
2135
- }
2136
-
2137
- if (position === 'center') {
2138
- if (targetItem instanceof LayoutGroup) {
2139
- layoutGroup = parentLayoutGroup;
2140
- layoutGroup.appendChild(newItem);
2141
-
2142
- resetGroup(layoutGroup);
2143
- that.refresh();
2144
-
2145
- return newItem;
2146
- }
2147
- else if (targetItem instanceof LayoutItem) {
2148
- layoutGroup = that.createLayoutItem('layoutGroup');
2149
- layoutGroup.orientation = parentLayoutGroup.orientation;
2150
- layoutGroup.setAttribute('orientation', parentLayoutGroup.orientation);
2151
-
2152
- targetItem.removeAttribute('size');
2153
- targetItem.parentElement.insertBefore(layoutGroup, targetItem);
2154
- layoutGroup.appendChild(targetItem);
2155
- layoutGroup.appendChild(newItem);
2156
-
2157
- that.refresh();
2158
-
2159
- return layoutGroup;
2160
- }
2161
- }
2162
-
2163
- if (parentLayoutGroup.orientation === 'vertical' && (position === 'left' || position === 'right') ||
2164
- parentLayoutGroup.orientation === 'horizontal' && (position === 'top' || position === 'bottom')) {
2165
- layoutGroup = parentLayoutGroup;
2166
-
2167
- if (targetItem instanceof LayoutGroup) {
2168
- if (position === 'left' || position === 'top') {
2169
- layoutGroup.insertBefore(newItem, layoutGroup.children[0]);
2170
- }
2171
- else {
2172
- layoutGroup.appendChild(newItem);
2173
- }
2174
-
2175
- resetGroup(targetItem);
2176
- }
2177
- else {
2178
- var layoutGroupItems = layoutGroup.items,
2179
- newItemIndex = Math.max(0, layoutGroupItems.indexOf(targetItem) + (position === 'top' || position === 'left' ? 0 : 1));
2180
-
2181
- layoutGroup.insertBefore(newItem, layoutGroupItems[newItemIndex]);
2182
- resetGroup(layoutGroup);
2183
- }
2184
- }
2185
- else {
2186
- if (targetItem instanceof LayoutGroup) {
2187
- var parentLayoutGroup = targetItem.parentElement;
2188
- layoutGroup = targetItem;
2189
- var newLayoutGroup = that.createLayoutItem('layoutGroup', position);
2190
-
2191
- parentLayoutGroup.insertBefore(newLayoutGroup, layoutGroup);
2192
-
2193
- if (position === 'top' || position === 'left') {
2194
- newLayoutGroup.append(newItem);
2195
- newLayoutGroup.appendChild(layoutGroup);
2196
- }
2197
- else {
2198
- newLayoutGroup.appendChild(layoutGroup);
2199
- newLayoutGroup.append(newItem);
2200
- }
2201
-
2202
- if (layoutGroup.getAttribute('data-id') === 'root') {
2203
- layoutGroup.setAttribute('data-id', newLayoutGroup.getAttribute('data-id'));
2204
- newLayoutGroup.setAttribute('data-id', 'root');
2205
- that.$.itemsContainer = newLayoutGroup;
2206
- }
2207
-
2208
- resetGroup(parentLayoutGroup);
2209
- }
2210
- else {
2211
- layoutGroup = that.createLayoutItem('layoutGroup', position);
2212
-
2213
- parentLayoutGroup.insertBefore(layoutGroup, targetItem);
2214
-
2215
- if (position === 'top' || position === 'left') {
2216
- layoutGroup.appendChild(newItem);
2217
- layoutGroup.appendChild(targetItem);
2218
- }
2219
- else {
2220
- layoutGroup.appendChild(targetItem);
2221
- layoutGroup.appendChild(newItem);
2222
- }
2223
-
2224
- resetGroup(layoutGroup);
2225
- }
2226
- }
2227
-
2228
- that.refresh();
2229
-
2230
- return newItem;
2231
- }
2232
-
2233
- /**
2234
- * Shows/Hides the Add buttons
2235
- * @param {any} item
2236
- */
2237
- _handleButtonsVisibility(item) {
2238
- var that = this;
2239
-
2240
- if (!that._buttons) {
2241
- that._buttons = document.createElement('div');
2242
- that._buttons.classList.add('jqx-layout-buttons-container');
2243
- that._buttons.innerHTML = `<div role="button" position="top"></div>
2244
- <div role="button" position="bottom"></div>
2245
- <div role="button" position="center"></div>
2246
- <div role="button" position="left"></div>
2247
- <div role="button" position="right"></div>`;
2248
-
2249
- }
2250
-
2251
- if (!item) {
2252
- if (that._buttons.parentElement) {
2253
- that._buttons.parentElement.removeChild(that._buttons);
2254
-
2255
- return;
2256
- }
2257
- }
2258
-
2259
- if (item) {
2260
- var buttonPosition = item._buttonPosition || [],
2261
- buttons = that._buttons.children;
2262
-
2263
-
2264
- for (var b = 0; b < buttons.length; b++) {
2265
- var button = buttons[b];
2266
-
2267
- button.position = button.getAttribute('position');
2268
- button.item = item;
2269
- buttonPosition.length && buttonPosition.indexOf(button.getAttribute('position')) < 0 ? button.classList.add('jqx-hidden') : button.classList.remove('jqx-hidden');
2270
-
2271
- button.onmouseenter = function () {
2272
- button.setAttribute('hover', '');
2273
- }
2274
- button.onmouseleave = function () {
2275
- button.removeAttribute('hover')
2276
- }
2277
- }
2278
-
2279
- if (that.allowLiveSplit && that._buttons.parentElement !== item) {
2280
- item.appendChild(that._buttons);
2281
- }
2282
- }
2283
- }
2284
-
2285
- _handleDropArea(item, position = 'center') {
2286
- var that = this;
2287
-
2288
- var positionDropArea = function (position) {
2289
- var areaSize = 50;
2290
-
2291
- switch (position) {
2292
- case 'left':
2293
- that._dropArea.style.top = '0px';
2294
- that._dropArea.style.left = '0px';
2295
- that._dropArea.style.width = areaSize + '%';
2296
- that._dropArea.style.height = '100%';
2297
- break;
2298
- case 'right':
2299
- that._dropArea.style.top = '0px';
2300
- that._dropArea.style.left = `calc(100% - ${areaSize}%)`;
2301
- that._dropArea.style.width = areaSize + '%';
2302
- that._dropArea.style.height = '100%';
2303
- break;
2304
- case 'top':
2305
- that._dropArea.style.top = '0px';
2306
- that._dropArea.style.left = '0px';
2307
- that._dropArea.style.width = '100%';
2308
- that._dropArea.style.height = areaSize + '%';
2309
- break;
2310
- case 'bottom':
2311
- that._dropArea.style.top = `calc(100% - ${areaSize}%)`;
2312
- that._dropArea.style.left = '0px';
2313
- that._dropArea.style.width = '100%';
2314
- that._dropArea.style.height = areaSize + '%';
2315
- break;
2316
- case 'center':
2317
- that._dropArea.style.top = '0px';
2318
- that._dropArea.style.left = '0px';
2319
- that._dropArea.style.width = '100%';
2320
- that._dropArea.style.height = '100%';
2321
- break;
2322
- }
2323
- }
2324
-
2325
- if (that._dropArea && that._dropArea.parentElement === item) {
2326
- positionDropArea(position);
2327
- return;
2328
- }
2329
-
2330
- if (that._dropArea) {
2331
- that._dropArea.remove();
2332
- }
2333
-
2334
- if (!that._dragDetails || !item) {
2335
- return;
2336
- }
2337
-
2338
- that._dropArea = document.createElement('div');
2339
- that._dropArea.classList.add('jqx-layout-drop-area');
2340
-
2341
- item.appendChild(that._dropArea);
2342
-
2343
- that._dropArea.style.opacity = 1;
2344
- positionDropArea(position);
2345
- }
2346
-
2347
- _handleSplitter(item) {
2348
- var that = this;
2349
-
2350
- if (!item) {
2351
- return;
2352
- }
2353
-
2354
- if (item.hasAttribute('tab')) {
2355
- item = item.parentElement;
2356
- }
2357
-
2358
- if (item._splitter) {
2359
- item._splitter.remove();
2360
- }
2361
-
2362
- if (!item._splitter) {
2363
- item._splitter = document.createElement('div');
2364
- }
2365
-
2366
- if (that._dragDetails && that._dragDetails.dragging) {
2367
- item._splitter.remove();
2368
- return;
2369
- }
2370
-
2371
- if (item.modifiers.indexOf('resize') === -1) {
2372
- return;
2373
- }
2374
-
2375
- item.appendChild(item._splitter);
2376
-
2377
- var layoutGroup = item.parentElement;
2378
-
2379
- if (layoutGroup) {
2380
- item._splitter.className = 'jqx-layout-splitter';
2381
-
2382
- item._splitter.item = item;
2383
-
2384
- item._splitter.removeAttribute('drag');
2385
-
2386
- var orientation = layoutGroup.orientation;
2387
-
2388
- if (item.nextElementSibling && item.nextElementSibling.hasAttribute('data-id')) {
2389
- item._splitter.classList.add(orientation);
2390
- }
2391
- else if (item.previousElementSibling && item.previousElementSibling.hasAttribute('data-id')) {
2392
- item._splitter.classList.add(orientation);
2393
- item._splitter.classList.add('last');
2394
- }
2395
-
2396
- var handleResize = function (splitter) {
2397
- splitter.style.top = '';
2398
- splitter.style.left = '';
2399
- splitter.style.bottom = '';
2400
- splitter.style.right = '';
2401
-
2402
- splitter.onpointerdown = function (event) {
2403
- var item = event.target.item;
2404
- item.style.overflow = 'hidden';
2405
-
2406
- that._resizeDetails = {
2407
- splitter: event.target,
2408
- splitterRect: event.target.getBoundingClientRect(),
2409
- itemRect: item.getBoundingClientRect(),
2410
- item: item,
2411
- itemSize: item.size,
2412
- group: item.parentElement,
2413
- clientX: event.clientX,
2414
- clientY: event.clientY
2415
- }
2416
-
2417
- if (that._selectedItem !== item) {
2418
- that.querySelectorAll('[data-id]').forEach(function (i) { i.removeAttribute('selected') });
2419
- that.selectedIndex = item.getAttribute('index');
2420
- item.setAttribute('selected', '');
2421
- that._selectedItem = item;
2422
- that._handleButtonsVisibility(item);
2423
- }
2424
-
2425
- if (item.previousElementSibling && item.previousElementSibling.hasAttribute('data-id')) {
2426
- that._resizeDetails.previousItemRect = item.previousElementSibling.getBoundingClientRect();
2427
- that._resizeDetails.previousItem = item.previousElementSibling;
2428
- that._resizeDetails.previousItemSize = item.previousElementSibling.size;
2429
- that._resizeDetails.previousItem.style.overflow = 'hidden';
2430
- }
2431
- else {
2432
- that._resizeDetails.previousItemRect = null;
2433
- that._resizeDetails.previousItem = null;
2434
- }
2435
-
2436
- if (item.nextElementSibling && item.nextElementSibling.hasAttribute('data-id')) {
2437
- that._resizeDetails.nextItemRect = item.nextElementSibling.getBoundingClientRect();
2438
- that._resizeDetails.nextItem = item.nextElementSibling;
2439
- that._resizeDetails.nextItemSize = item.nextElementSibling.size;
2440
- that._resizeDetails.nextItem.style.overflow = 'hidden';
2441
- }
2442
- else {
2443
- that._resizeDetails.nextItemRect = null;
2444
- that._resizeDetails.nextItem = null;
2445
- }
2446
- }
2447
- }
2448
-
2449
- handleResize(item._splitter);
2450
- }
2451
- }
2452
- }
2453
-
2454
-
2455
- customElements.define('jqx-layout-group', LayoutGroup);
2456
- customElements.define('jqx-layout-item', LayoutItem);
2457
- customElements.define('jqx-tab-layout-group', TabLayoutGroup);
2458
- customElements.define('jqx-tab-layout-item', TabLayoutItem);
2459
- customElements.define('jqx-split-layout', SplitLayout);
2460
-
2461
- })();
8
+ function _typeof(c){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){d=function d(a){return typeof a}}else{d=function d(a){return a&&typeof Symbol==="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return d(c)}function _get(g,h,e){if(typeof Reflect!=="undefined"&&Reflect.get){f=Reflect.get}else{f=function f(b,c,d){var j=_superPropBase(b,c);if(!j){return}var a=Object.getOwnPropertyDescriptor(j,c);if(a.get){return a.get.call(d)}return a.value}}return f(g,h,e||g)}function _superPropBase(d,c){while(!Object.prototype.hasOwnProperty.call(d,c)){d=_getPrototypeOf(d);if(d===null){break}}return d}function _classCallCheck(d,c){if(!(d instanceof c)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(g,e){for(var f=0;f<e.length;f++){var h=e[f];h.enumerable=h.enumerable||false;h.configurable=true;if("value" in h){h.writable=true}Object.defineProperty(g,h.key,h)}}function _createClass(f,e,d){if(e){_defineProperties(f.prototype,e)}if(d){_defineProperties(f,d)}return f}function _inherits(c,d){if(typeof d!=="function"&&d!==null){throw new TypeError("Super expression must either be null or a function")}c.prototype=Object.create(d&&d.prototype,{constructor:{value:c,writable:true,configurable:true}});if(d){_setPrototypeOf(c,d)}}function _createSuper(d){var f=_isNativeReflectConstruct();return function e(){var b=_getPrototypeOf(d),c;if(f){var a=_getPrototypeOf(this).constructor;c=Reflect.construct(b,arguments,a)}else{c=b.apply(this,arguments)}return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(d,c){if(c&&(_typeof(c)==="object"||typeof c==="function")){return c}return _assertThisInitialized(d)}function _assertThisInitialized(b){if(b===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return b}function _wrapNativeSuper(e){var f=typeof Map==="function"?new Map():undefined;d=function d(b){if(b===null||!_isNativeFunction(b)){return b}if(typeof b!=="function"){throw new TypeError("Super expression must either be null or a function")}if(typeof f!=="undefined"){if(f.has(b)){return f.get(b)}f.set(b,a)}function a(){return _construct(b,arguments,_getPrototypeOf(this).constructor)}a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(a,b)};return d(e)}function _construct(g,h,e){if(_isNativeReflectConstruct()){f=Reflect.construct}else{f=function f(b,c,d){var k=[null];k.push.apply(k,c);var a=Function.bind.apply(b,k);var l=new a();if(d){_setPrototypeOf(l,d.prototype)}return l}}return f.apply(null,arguments)}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct){return false}if(Reflect.construct.sham){return false}if(typeof Proxy==="function"){return true}try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true}catch(b){return false}}function _isNativeFunction(b){return Function.toString.call(b).indexOf("[native code]")!==-1}function _setPrototypeOf(d,e){f=Object.setPrototypeOf||function f(a,b){a.__proto__=b;return a};return f(d,e)}function _getPrototypeOf(c){d=Object.setPrototypeOf?Object.getPrototypeOf:function d(a){return a.__proto__||Object.getPrototypeOf(a)};return d(c)}if(!window.JQX){window.JQX={Utilities:{Core:{isMobile:function isMobile(){var d=/(iphone|ipod|ipad|android|iemobile|blackberry|bada)/.test(window.navigator.userAgent.toLowerCase());var c=function c(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend" in document};if(!d){return c()}return d}}}}}var LayoutItem=function(p){_inherits(k,p);var l=_createSuper(k);function k(){var a;_classCallCheck(this,k);a=l.call(this);a._properties={min:50,label:"Item",modifiers:["resize","drag","close"],size:null};return a}_createClass(k,[{key:"_setProperty",value:function q(d,a){var b=this;if(b._properties[d]===a){return}b._properties[d]=a;b._updating=true;if(d==="disabled"||d==="modifiers"){if(a){b.setAttribute(d,a)}else{b.removeAttribute(d)}}else{if(a===null){b.removeAttribute(d)}else{b.setAttribute(d,a)}}if(!b.isCompleted){return}var c=b.closest("jqx-layout");if(c){if(!c._resizeDetails&&!c._updating&&c.isRendered){c.refresh()}}b._updating=false}},{key:"label",get:function s(){return this._properties.label},set:function m(a){this._setProperty("label",a)}},{key:"modifiers",get:function s(){return this._properties.modifiers},set:function m(a){this._setProperty("modifiers",a)}},{key:"min",get:function s(){return this._properties.min},set:function m(a){this._setProperty("min",a)}},{key:"size",get:function s(){return this._properties.size},set:function m(a){if(a!==null){if(typeof a==="string"){this._setProperty("size",a)}else{this._setProperty("size",Math.max(this.min,a))}}else{this._setProperty("size",a)}}},{key:"attributeChangedCallback",value:function o(b,c,d){var a=this;if(c===d){return}if(!a.isCompleted){return}if(b==="size"){if(!a._updating){if(d===null){this[b]=null;return}a[b]=Math.max(a.min,parseInt(d))}}else{a[b]=d}}},{key:"connectedCallback",value:function n(){if(!this.isCompleted){this.render()}}},{key:"whenRendered",value:function r(a){var b=this;if(b.isRendered){a();return}if(!b.whenRenderedCallbacks){b.whenRenderedCallbacks=[]}b.whenRenderedCallbacks.push(a)}},{key:"render",value:function t(){var d=this;if(!d.hasAttribute("data-id")){d.setAttribute("data-id","id"+Math.random().toString(16).slice(2))}if(!d.hasAttribute("label")){d.setAttribute("label",d.label)}if(!d.hasAttribute("min")){d.setAttribute("min",d.min)}if(!d.hasAttribute("label")){d.setAttribute("label",d.label)}if(!d.hasAttribute("modifiers")){d.setAttribute("modifiers",d.modifiers)}for(var b=0;b<d.attributes.length;b++){var e=d.attributes[b];var c=e.name;var a=e.value;if(!isNaN(a)&&(c==="min"||c==="size")){d._properties[c]=parseInt(a);continue}d._properties[c]=a}d.classList.add("jqx-layout-item");d.isCompleted=true;if(d.whenRenderedCallbacks){for(var b=0;b<d.whenRenderedCallbacks.length;b++){d.whenRenderedCallbacks[b]()}d.whenRenderedCallbacks=[]}}}],[{key:"observedAttributes",get:function s(){return["min","size","label","modifiers"]}}]);return k}(_wrapNativeSuper(HTMLElement));var LayoutGroup=function(j){_inherits(k,j);var l=_createSuper(k);function k(){var a;_classCallCheck(this,k);a=l.call(this);a._properties.label="Group";a._properties.orientation="vertical";return a}_createClass(k,[{key:"orientation",get:function h(){return this._properties.orientation},set:function i(a){this._setProperty("orientation",a)}},{key:"render",value:function g(){var a=this;_get(_getPrototypeOf(k.prototype),"render",this).call(this);a.className="jqx-layout-group";if(!a.hasAttribute("orientation")){a.setAttribute("orientation",a._properties.orientation)}else{a._properties.orientation=a.getAttribute("orientation")}}}],[{key:"observedAttributes",get:function h(){return["min","size","modifiers","orientation","position"]}}]);return k}(LayoutItem);var TabLayoutGroup=function(k){_inherits(g,k);var j=_createSuper(g);function g(){var a;_classCallCheck(this,g);a=j.call(this);a._properties.position="top";a._properties.label="TabGroup";return a}_createClass(g,[{key:"position",get:function h(){return this._properties.position},set:function i(a){this._setProperty("position",a)}},{key:"render",value:function l(){var a=this;_get(_getPrototypeOf(g.prototype),"render",this).call(this);if(!a.hasAttribute("position")&&a.position){a.setAttribute("position","top")}}}],[{key:"observedAttributes",get:function h(){return["min","size","modifiers","orientation","position"]}}]);return g}(LayoutGroup);var TabLayoutItem=function(d){_inherits(e,d);var f=_createSuper(e);function e(){var a;_classCallCheck(this,e);a=f.call(this);a._properties.label="TabItem";return a}return e}(LayoutGroup);(function(j){j.jqx.jqxWidget("jqxSplitLayout","",{});j.extend(j.jqx._jqxSplitLayout.prototype,{defineInstance:function l(){var a={dataSource:null,ready:null,orientation:"vertical"};if(this===j.jqx._jqxSplitLayout.prototype){return a}j.extend(true,this,a);return a},createInstance:function i(){var a=this;this._properties={dataSource:null,ready:null,orientation:"vertical"};var a=this;a.layout=document.createElement("jqx-split-layout");a.layout.style.width="100%";a.layout.style.height="100%";a.element.className+=a.toThemeProperty("jqx-split-layout-component jqx-rc-all jqx-widget");a.layout.dataSource=a.dataSource;a.layout.orientation=a.orientation;a.layout.ready=a.ready;a.element.appendChild(a.layout)},propertyChangedHandler:function h(d,c,e,a){var b=d;if(e!=a||a instanceof Object){if(!b.layout){return}b.layout[c]=a}},render:function m(){var a=this;if(!a.layout){return}a.layout.render()},refresh:function n(){var a=this;if(!a.layout){return}if(!a.layout.isRendered){return}a.layout.refresh()},dataBind:function k(){var a=this;if(!a.layout){return}a.layout.dataBind()}})})(jqxBaseFramework);var SplitLayout=function(V){_inherits(au,V);var aw=_createSuper(au);function au(){var a;_classCallCheck(this,au);a=aw.call(this);a._properties={dataSource:null,orientation:"vertical"};return a}_createClass(au,[{key:"orientation",get:function S(){return this._properties.orientation},set:function aj(a){this._properties.orientation=a}},{key:"dataSource",get:function S(){return this._properties.dataSource},set:function aj(a){this._properties.dataSource=a}},{key:"_dragStart",value:function Q(a){a.stopPropagation();a.preventDefault()}},{key:"_leaveHandler",value:function Z(){var a=this;if(a._resizeDetails){return}a._handleButtonsVisibility(null);a._hideSplitter();requestAnimationFrame(function(){})}},{key:"_enterHandler",value:function ad(){var a=this;if(a._resizeDetails){return}a._handleButtonsVisibility(a._selectedItem);a._updateSplitter();requestAnimationFrame(function(){a.classList.add("outline")})}},{key:"template",value:function at(){return'<div class="jqx-container" id="container" role="presentation"><jqx-layout-group data-id="root" id="itemsContainer"></jqx-layout-group><div root-splitter id="splitter" class="jqx-layout-splitter"></div>'}},{key:"propertyChangedHandler",value:function aa(d,c,a){var b=this;switch(d){case"orientation":if(b.$.itemsContainer){b.$.itemsContainer.orientation=b.orientation}break;case"dataSource":b.dataBind();break;case"selectedIndex":b._handleItemClick(b.getItem(a+""),true);break;default:_get(_getPrototypeOf(au.prototype),"propertyChangedHandler",this).call(this,d,c,a);break}}},{key:"dataBind",value:function am(){var a=this;a.$.itemsContainer.innerHTML="";var c="";var b=function b(m,f){for(var i=0;i<m.length;i++){var o=m[i];var n=o.size;var j=o.min;var p=o.modifiers;var d=o.type;var h=o.position;var k=o.orientation?o.orientation:"vertical";var l=o.id;var q=o.label;var e="";if(l!==undefined){e+='id="'.concat(l,'" ')}if(n!==undefined){e+='size="'.concat(n,'" ')}if(q!==undefined){e+='label="'.concat(q,'" ')}if(j!==undefined){e+='min="'.concat(j,'" ')}if(p!==undefined){e+='modifiers="'.concat(p,'" ')}if(h!==undefined){e+='position="'.concat(h,'" ')}if(o.items){e+="orientation=".concat(k," ");if(d==="tabs"){c+="<jqx-tab-layout-group ".concat(e,">");b(o.items,true);c+="</jqx-tab-layout-group>"}else{c+="<jqx-layout-group ".concat(e,">");b(o.items);c+="</jqx-layout-group>"}}else{var g=o.content||"";if(f){c+="<jqx-tab-layout-item ".concat(e,">")+g+"</jqx-tab-layout-item>"}else{if(d==="tabs"){c+="<jqx-tab-layout-group>";c+="<jqx-tab-layout-item ".concat(e,">")+g+"</jqx-tab-layout-item>";c+="</jqx-tab-layout-group>"}else{c+="<jqx-layout-item ".concat(e,">")+g+"</jqx-layout-item>"}}}}};b(a.dataSource);a.$.itemsContainer.innerHTML=c;a.refresh()}},{key:"render",value:function af(){var a=this;a.setAttribute("role","group");if(a.selectedIndex){a._handleItemClick(a.getItem(a.selectedIndex+""),true)}var b=function b(){if(!a.dataSource){a.dataSource=a._getDataSource(a._getLayout())}else{a.dataBind()}a.$.itemsContainer.orientation=a.orientation;a.refresh();a._updateSplitter();a.isRendered=true;a.classList.add("outline");if(a.ready){a.ready()}};if(document.readyState==="complete"){b()}else{window.addEventListener("load",function(){b()})}}},{key:"connectedCallback",value:function U(){var a=this;var b=function b(){var c=document.createDocumentFragment();while(a.childNodes.length){c.appendChild(a.firstChild)}a.innerHTML=a.template();a.classList.add("jqx-widget");a.$={container:a.querySelector("#container"),itemsContainer:a.querySelector("#itemsContainer"),splitter:a.querySelector("#splitter")};delete a.$.container.id;delete a.$.itemsContainer.id;delete a.$.splitter.id;a.$.itemsContainer.appendChild(c);a.classList.add("jqx-split-layout");document.addEventListener("pointerdown",function(d){a._documentDownHandler(d)});document.addEventListener("pointermove",function(d){a._documentMoveHandler(d)});document.addEventListener("pointerup",function(d){a._documentUpHandler(d)});document.addEventListener("selectstart",function(d){a._documentSelectStartHandler(d)});document.addEventListener("keyup",function(d){a._keyUpHandler(d)});a.addEventListener("mouseleave",function(d){a._leaveHandler(d)});a.addEventListener("mouseenter",function(d){a._enterHandler(d)});a.addEventListener("dragStart",function(d){a._dragStart(d)});a.render()};if(document.readyState==="complete"){b()}else{window.addEventListener("load",function(){b()})}}},{key:"getItem",value:function aA(d){var a=this;if(d===undefined||d===null){return}d=(d+"").split(".");var e=a._getDataSource(a._getLayout()),b;for(var c=0;c<d.length;c++){b=e[d[c]];if(!b){break}e=b.items}return b}},{key:"_documentDownHandler",value:function Y(b){var c=this,a=b.target;if(c.contains(a)&&a.closest){c._target=a;c._updateSplitter()}}},{key:"_documentMoveHandler",value:function ah(w){var F=this,n=w.target,j=F._contextMenu;if(j&&!JQX.Utilities.Core.isMobile){if(j.querySelector(".jqx-layout-context-menu-item[hover]")){var y=j.children;for(var v=0;v<y.length;v++){y[v].removeAttribute("hover")}}if(j.contains(n)&&n.closest&&n.closest(".jqx-layout-context-menu-item")){n.setAttribute("hover","")}}if(F._dragDetails){var s=Math.abs(F._dragDetails.pageX-w.pageX);var t=Math.abs(F._dragDetails.pageY-w.pageY);if(t<=5&&s<=5){return}if(!F._dragDetails.feedback.parentElement){document.body.appendChild(F._dragDetails.feedback);document.body.appendChild(F._dragDetails.overlay);setTimeout(function(){F._dragDetails.feedback.classList.add("dragging")},100)}F._dragDetails.dragging=true;F._dragDetails.feedback.style.left=w.pageX-F._dragDetails.feedback.offsetWidth/2-5+"px";F._dragDetails.feedback.style.top=w.pageY-F._dragDetails.feedback.offsetHeight/2-5+"px";var A=document.elementsFromPoint(w.pageX,w.pageY);var D=null;var a=false;for(var v=0;v<A.length;v++){var h=A[v];if(F._dragDetails.feedback.contains(h)){continue}if(h.classList.contains("jqx-layout-tab-strip")){if(F._dragDetails.element.contains(h)){continue}D=h.parentElement;a=true;break}if((h.parentElement===F._dragDetails.parent||h===F._dragDetails.parent)&&F._dragDetails.layoutGroup.items.length===1){continue}if(F._dragDetails.element.contains(h)){continue}if(h instanceof TabLayoutItem){D=h.parentElement;break}else{if(h instanceof TabLayoutGroup){D=h;break}}}var o=function o(M,J){var aF=F.offset(M);var aD=null;var H=50;var K=J;var I=J;if(!J){I=M.offsetWidth/3;K=M.offsetHeight/3}else{H=0}var L=[{left:aF.left,top:aF.top,right:aF.left+H,bottom:aF.top+H,position:"top"},{left:aF.left+H,top:aF.top,right:aF.left+M.offsetWidth-H,bottom:aF.top+K-H,position:"top"},{left:aF.left+M.offsetWidth-H,top:aF.top,right:aF.left+M.offsetWidth,bottom:aF.top+H,position:"top"},{left:aF.left,top:aF.top+H,right:aF.left+I,bottom:aF.top+M.offsetHeight-H,position:"left"},{left:aF.left+M.offsetWidth-I,top:aF.top+H,right:aF.left+M.offsetWidth,bottom:aF.top+M.offsetHeight-H,position:"right"},{left:aF.left,top:aF.top+M.offsetHeight-H,right:aF.left+H,bottom:aF.top+M.offsetHeight,position:"bottom"},{left:aF.left+H,top:aF.top+M.offsetHeight-K+H,right:aF.left+M.offsetWidth-H,bottom:aF.top+M.offsetHeight,position:"bottom"},{left:aF.left+M.offsetWidth-H,top:aF.top+M.offsetHeight-H,right:aF.left+M.offsetWidth,bottom:aF.top+M.offsetHeight,position:"bottom"}];for(var aE=0;aE<L.length;aE++){var N=L[aE];if(N.left<=w.pageX&&w.pageX<=N.right){if(N.top<=w.pageY&&w.pageY<=N.bottom){aD=N.position;break}}}return aD};var B=F.querySelector("jqx-layout-group");var m=o(B,10);var f=null;if(!m){if(!D){F._handleDropArea(null)}else{if(a){if(D!==F._dragDetails.parent){m="center";f=D}}else{m=o(D)||"center";f=D}}}else{f=B}if(f){F._dragDetails.current=f;F._dragDetails.position=m;F._handleDropArea(f,m)}}if(F._resizeDetails){var s=Math.abs(F._resizeDetails.clientX-w.clientX);var t=Math.abs(F._resizeDetails.clientY-w.clientY);var g=F._resizeDetails.splitter;var q=F._resizeDetails.item;var r=F._resizeDetails.itemRect;var p=F._resizeDetails.previousItemRect;var u=F._resizeDetails.previousItem;var i=F._resizeDetails.nextItemRect;var G=F._resizeDetails.nextItem;var k=parseInt(q.getAttribute("min"));var E=function E(H){if(H.classList.contains("jqx-visibility-hidden")){return}H.style.right="";H.style.top="";H.style.left="";H.style.bottom=""};E(g);E(F.$.splitter);g.classList.remove("error");g.classList.add("active");if(!F._resizeDetails.dragging){if(g.classList.contains("horizontal")&&t<=5){return}else{if(g.classList.contains("vertical")&&s<=5){return}}F._resizeDetails.dragging=true}var x={clientPos:"clientX",pos:"x",size:"width",near:"left",far:"right",offsetSize:"offsetWidth"};if(g.classList.contains("horizontal")){x={clientPos:"clientY",pos:"y",size:"height",near:"top",far:"bottom",offsetSize:"offsetHeight"}}var d=function d(I){var H=F.offset(I);var J=F.offset(F);J.left++;J.top++;F.$.splitter.style.width=I.offsetWidth+"px";F.$.splitter.style.height=I.offsetHeight+"px";F.$.splitter.className=I.className;F.$.splitter.style.left=H.left-J.left+"px";F.$.splitter.style.top=H.top-J.top+"px";I.setAttribute("drag","");F.$.splitter.setAttribute("drag","")};if(g.classList.contains("last")){var e=w[x.clientPos]-F._resizeDetails.splitterRect[x.pos];var b=r[x.size]-k;if(e>b){e=b;g.classList.add("error")}if(p){var k=parseInt(u.getAttribute("min"));var c=p[x.size]-k;if(e<-c){e=-c;g.classList.add("error")}}g.style[x.near]=e+"px";var l=q[x.offsetSize]-e;q.setAttribute("size",l);if(u){var C=q[x.offsetSize]+u[x.offsetSize]-l;u.setAttribute("size",C)}}else{var e=-w[x.clientPos]+F._resizeDetails.splitterRect[x.pos];var c=r[x.size]-k;if(e>c){e=c;g.classList.add("error")}if(i){var k=parseInt(G.getAttribute("min"));var b=-i[x.size]+k;if(e<b){e=b;g.classList.add("error")}}g.style[x.far]=e+"px";var l=q[x.offsetSize]-e;q.setAttribute("size",l);if(G){var z=G[x.offsetSize]+q[x.offsetSize]-l;G.setAttribute("size",z)}}d(g)}}},{key:"_offsetTop",value:function ak(b){var a=this;if(!b){return 0}return b.offsetTop+a._offsetTop(b.offsetParent)}},{key:"_offsetLeft",value:function ac(b){var a=this;if(!b){return 0}return b.offsetLeft+a._offsetLeft(b.offsetParent)}},{key:"offset",value:function W(a){return{left:this._offsetLeft(a),top:this._offsetTop(a)}}},{key:"_keyUpHandler",value:function P(a){var b=this;if(a.key==="Escape"){if(b._dragDetails){b._dragDetails.feedback.remove();b._dragDetails.overlay.remove();b._dragDetails=null;b._handleDropArea(null)}if(b._resizeDetails){var c=b._resizeDetails;c.splitter.classList.contains("last")?c.previousItem.size=c.previousItemSize:c.nextItem.size=c.nextItem.previousItemSize;c.item.size=c.itemSize;b.refresh();b._handleItemClick(c.item);b._resizeDetails=null;return}}else{if(a.key==="Delete"){if(b._selectedItem){b._removeLayoutItem(b._selectedItem)}}}}},{key:"_endDrag",value:function ay(){var c=this;c._handleDropArea(null);if(!c._dragDetails.dragging){c._dragDetails=null;return}var a=c._dragDetails.current;var d=c._dragDetails.element;var h=c._dragDetails.position;c._handleDropArea(null);if(a){c._addTabLayoutItem(a,h,d);c._removeLayoutItem(d);if(a.parentElement&&Array.from(a.parentElement.parentElement.children).filter(function(i){if(i.classList.contains("jqx-layout-group")){return true}return false}).length===1){var e=a.parentElement;var b=e.parentElement;var g=b.parentElement;if(!(b.getAttribute("data-id")==="root"||g.getAttribute("data-id")==="root")&&g!==c){var f=Array.from(g.children).indexOf(e.parentElement);if(f>=0){g.insertBefore(e,g.children[f])}else{g.appendChild(e)}b.remove()}}c.refresh();c._updateSplitter();requestAnimationFrame(function(){c.classList.add("outline");c.querySelectorAll(".jqx-element").forEach(function(i){c.dispatchEvent(new CustomEvent("resize"))})})}c.dispatchEvent(new CustomEvent("stateChange",{type:"insert",item:d}));c._dragDetails.feedback.remove();c._dragDetails.overlay.remove();c._dragDetails=null}},{key:"_documentUpHandler",value:function al(b){var c=this,f=JQX.Utilities.Core.isMobile,a=f?document.elementFromPoint(b.pageX-window.pageXOffset,b.pageY-window.pageYOffset):b.target;if(b.button===2){return}if(c._dragDetails){c._endDrag(b)}if(c._resizeDetails){var d=c._resizeDetails;if(d.item){d.item.style.overflow=""}if(d.previousItem){d.previousItem.style.overflow=""}if(d.nextItem){d.nextItem.style.overflow=""}c.refresh();c._handleItemClick(d.item);c._resizeDetails=null;window.dispatchEvent(new Event("resize"));c.querySelectorAll(".jqx-element").forEach(function(g){g.dispatchEvent(new CustomEvent("resize"))});return}if(!c.contains(a)){return}c.classList.add("outline");if(c._target&&!a.item){if(a instanceof TabLayoutItem){c._handleItemClick(a)}else{c._handleItemClick(a.closest(".jqx-layout-item"))}}if(c._target){if(c._target!==a){delete c._target;return}if(!b.button&&a.closest(".jqx-layout-buttons-container")){var e=b.target;c._handleButtonClick(e.item,e.position)}else{if(a.closest(".jqx-layout-context-menu")&&(!f&&!b.button||f)){c._handleMenuItemClick(a.closest(".jqx-layout-context-menu-item"))}}delete c._target}}},{key:"_documentSelectStartHandler",value:function ai(a){var b=this;if(b._target){a.preventDefault()}}},{key:"_getDataSource",value:function an(f,a,d){var e=this;var h=[];if(!d){d=0}if(!a){a=""}for(var g=0;g<f.length;g++){var i=f[g];var b={label:i.label,id:i.getAttribute("data-id"),orientation:i.orientation,size:i.size,min:i.min,type:i.type,modifiers:i.modifiers,position:i.position};i.removeAttribute("index");if(i instanceof LayoutGroup){h.push(b);b.index=a!==""?a+"."+d:d.toString();i.setAttribute("index",b.index);if(i.items){var c=e._getDataSource(i.items,b.index,0);b.items=c}}else{if(i instanceof LayoutItem){if(i.items){var c=e._getDataSource(i.items,a,d);h=h.concat(c)}else{b.index=a!==""?a+"."+d:d.toString();i.setAttribute("index",b.index);h.push(b)}}}d++}return h}},{key:"_getLayout",value:function R(){var d=this;var a=!arguments.length?d.$.itemsContainer:arguments[0];if(d._buttons){d._buttons.remove()}if(d._dropArea){d._dropArea.remove()}var e=d.querySelectorAll(".jqx-layout-splitter");for(var g=0;g<e.length;g++){var b=e[g];if(b!==d.$.splitter){b.remove()}}a.items=Array.from(a.children);a.items=a.items.filter(function(i){return i!==a.tabs&&i.hasAttribute("data-id")});var h=a.items.map(function(k){if(k.classList.contains("jqx-layout-tab-strip")){return null}var i=k;var j=k instanceof LayoutGroup?k:null;if(j){i.items=d._getLayout(j)}return i});if(a!==d.$.itemsContainer){return h.filter(function(i){return i!==null&&i!==a.tabs})}var c=[];var f=a;f.items=h.filter(function(i){return i!==null&&i!==a.tabs});c.push(f);return c}},{key:"_updateSplitter",value:function aq(){var b=this;if(b._buttons&&b._dragDetails){b._buttons.remove()}b._removeSplitter();var e=b.querySelectorAll("[data-id]");for(var d=0;d<e.length;d++){var c=e[d];if(c.getAttribute("data-id")==="root"){continue}if(c.hasAttribute("role")){var a=c.getAttribute("role");if(a==="gridcell"||a==="row"||a==="columnheader"||a==="rowheader"){continue}}c.setAttribute("hover","");b._handleSplitter(c)}}},{key:"_hideSplitter",value:function av(){var a=this;var d=a.querySelectorAll("[data-id]");for(var c=0;c<d.length;c++){var b=d[c];b.removeAttribute("hover")}}},{key:"_removeSplitter",value:function ae(){var b=this;var c=b.querySelectorAll(".jqx-layout-splitter");for(var d=0;d<c.length;d++){var a=c[d];if(a!==b.$.splitter){a.remove()}}b._hideSplitter()}},{key:"_handleItemClick",value:function T(a){var b=this,d=b.selectedIndex;var c=null;if(!a){b.selectedIndex=null;b.querySelectorAll("[data-id]").forEach(function(e){e.removeAttribute("selected")});b._selectedItem=null;return}else{c=a instanceof HTMLElement?a:b.querySelector("[data-id="+a.id+"]");if(c&&c.readonly){b.selectedIndex=null;return}b.querySelectorAll("[data-id]").forEach(function(e){e.removeAttribute("selected")});if(!c){b.refresh();return}b.selectedIndex=c.getAttribute("index");c.setAttribute("selected","");c.setAttribute("hover","");b._selectedItem=c;if(c.classList.contains("jqx-hidden")){b.refresh()}b._handleButtonsVisibility(c);if(d!==b.selectedIndex){b.dispatchEvent(new CustomEvent("change"))}}b._updateSplitter()}},{key:"_handleButtonClick",value:function ao(a,d){var b=this,c=b._addLayoutItem(a,d);b.dispatchEvent(new CustomEvent("stateChange",{type:"insert",item:c}));b._handleItemClick(c,true)}},{key:"_removeLayoutItem",value:function ar(a){var b=this;if(a.getAttribute("data-id")==="root"){return}if(a instanceof LayoutItem&&a.parentElement.items.length===1){var c=a.parentElement;var d=c;while(c&&c.items&&c.items.length===1){if(c.getAttribute("data-id")==="root"){break}d=c;c=c.parentElement}if(d.getAttribute("data-id")!=="root"){d.remove()}else{if(b.allowLiveSplit){d.appendChild(document.createElement("jqx-layout-item"))}}}else{a.remove()}b.refresh();b.dispatchEvent(new CustomEvent("stateChange",{type:"delete",item:a}))}},{key:"refresh",value:function O(){var b=this;if(b._isUpdating){return}b.dataSource=b._getDataSource(b._getLayout());b.$.splitter.className="jqx-visibility-hidden jqx-layout-splitter";var a=function a(r){var o=b.getItem(r.getAttribute("index"));if(!o){return}r.style.gridTemplateColumns="";r.style.gridTemplateRows="";var q="";var m=0;var g=0;if(r instanceof TabLayoutGroup){if(r.tabs){r.tabs.remove()}var h=document.createElement("div");h.classList.add("jqx-layout-tab-strip");if(b._selectedItem&&r.contains(b._selectedItem)&&b._selectedItem instanceof TabLayoutItem){r.selectedIndex=Math.max(0,r.items.indexOf(b._selectedItem))}if(r.selectedIndex>=r.children.length){r.selectedIndex=0}for(var i=0;i<r.children.length;i++){var l=r.children[i];var f=b.getItem(l.getAttribute("index"));if(!f){continue}var k=document.createElement("div");k.classList.add("jqx-layout-tab");k.innerHTML="<label>"+f.label+'</label><span class="jqx-close-button"></span>';h.appendChild(k);l.setAttribute("tab","");l.classList.add("jqx-hidden");k.content=l;k.item=f;k.group=o;if(l.modifiers){if(l.modifiers.indexOf("close")===-1){k.querySelector(".jqx-close-button").classList.add("jqx-hidden")}}else{k.querySelector(".jqx-close-button").classList.add("jqx-hidden")}if(undefined===r.selectedIndex||i===r.selectedIndex){k.classList.add("selected");l.classList.remove("jqx-hidden");r.selectedIndex=i}k.onpointerup=function(s){if(s.target.classList.contains("jqx-close-button")&&k.close){r.selectedIndex=0;b._removeLayoutItem(b._selectedItem);b._handleItemClick(parent)}};k.onpointerdown=function(s){var t=this.closest(".jqx-layout-group");b._handleItemClick(this.content);k.close=false;if(!s.target.classList.contains("jqx-close-button")){if(f.modifiers&&f.modifiers.indexOf("drag")>=0&&t.modifiers.indexOf("drag")>=0){b._beginDrag(t,this,s)}}else{k.close=true}}}r.tabs=h;if(o.position==="top"||o.position==="left"){r.insertBefore(h,r.firstChild)}else{r.appendChild(h)}}else{for(var i=0;i<r.children.length;i++){var l=r.children[i];if(l.hasAttribute("size")){var n=l.getAttribute("size");var j=parseFloat(n);var e=r.orientation==="vertical"?r.offsetWidth:r.offsetHeight;var p=n.indexOf("%")>=0?parseFloat(n):parseFloat(j/e*100);m+=p;g++;if(g===r.children.length){if(m<100){q+="1fr ";m=100;continue}else{if(m>100){m-=p;p=100-m;m=100}}}else{if(m>100||p===0){g=r.children.length;m=0;break}}q+=p+"% ";continue}q+="1fr "}if(g===r.children.length){if(m<99||m>100){q="";for(var i=0;i<r.children.length;i++){var l=r.children[i];l.removeAttribute("size");q+="1fr "}}}if(r.orientation==="vertical"){r.style.gridTemplateColumns=q}else{r.style.gridTemplateRows=q}}r.items=Array.from(r.children);r.items=r.items.filter(function(s){return s!==r.tabs})};var c=b.querySelectorAll(".jqx-layout-group");for(var d=0;d<c.length;d++){a(c[d])}}},{key:"_beginDrag",value:function ab(a,e,i){var d=this;if(d._dragDetails){d._dragDetails.feedback.remove()}var h=document.createElement("div");var g=document.createElement("div");var c=a.querySelector(".jqx-layout-tab-strip");var b="";if(c){for(var f=0;f<Array.from(c.children).length;f++){if(f===a.selectedIndex){b=c.children[f].innerText}}}h.innerHTML='<jqx-split-layout><jqx-tab-layout-group><jqx-tab-layout-item label="'.concat(b,'"></jqx-tab-layout-item></jqx-tab-layout-group></jqx-split-layout>');d._feedback=h;d._feedback.classList.add("jqx-split-layout-feedback","jqx-split-layout","jqx-widget");g.classList.add("jqx-split-layout-overlay");d._dragDetails={element:e.content,item:e.item,layoutGroup:e.group,parent:a,overlay:g,feedback:h,pageX:i.pageX,pageY:i.pageY}}},{key:"moveChildren",value:function ag(b,d){d.innerHTML="";var c=b;while(c.firstChild){var a=c.firstChild;d.appendChild(a)}}},{key:"createLayoutItem",value:function az(d,g){var c=this;var f=function f(){var h=document.createElement("jqx-layout-item");h.innerHTML="";c.dispatchEvent(new CustomEvent("createItem",{type:"layoutItem",item:h}));return h};var a=function a(){var h=document.createElement("jqx-tab-layout-item");h.innerHTML="";c.dispatchEvent(new CustomEvent("createItem",{type:"tabLayoutItem",item:h}));return h};var b=function b(i){var j=document.createElement("jqx-layout-group");var h=i==="top"||i==="bottom"?"horizontal":"vertical";c.dispatchEvent(new CustomEvent("createGroup",{type:"layoutGroup",item:j}));j.setAttribute("orientation",h);j.orientation=h;return j};var e=function e(i){var j=document.createElement("jqx-tab-layout-group");var h=i==="top"||i==="bottom"?"horizontal":"vertical";j.setAttribute("orientation",h);j.orientation=h;c.dispatchEvent(new CustomEvent("tabLayoutGroup",{type:"layoutGroup",item:j}));return j};if(d==="layoutItem"||!d){return f()}else{if(d==="tabLayoutItem"||!d){return a()}else{if(d==="tabLayoutGroup"){return e(g)}else{return b(g)}}}}},{key:"_addTabLayoutItem",value:function aB(h,g,j){var d=this;var f=d.createLayoutItem("tabLayoutItem");var i=h.closest("jqx-tab-layout-group");var c;if(j){f.label=j.label;f.modifiers=j.modifiers;d.moveChildren(j,f)}var a=function a(n){for(var o=0;o<n.children.length;o++){var m=n.children[o];m.removeAttribute("size")}n.removeAttribute("size")};var k=function k(n){h.removeAttribute("size");if(h.querySelector("jqx-layout-group")){d._addLayoutItem(h.querySelector("jqx-layout-group"),n)}else{c=d.createLayoutItem("layoutGroup",n);var m=d.createLayoutItem();d.moveChildren(h,m);if(n==="top"||n==="left"){c.appendChild(d.createLayoutItem());c.appendChild(m)}else{c.appendChild(m);c.appendChild(d.createLayoutItem())}h.appendChild(c)}};var l=function l(p,q){var o=h.parentElement;var n=h;var m=d.createLayoutItem("layoutGroup",q);o.insertBefore(m,n);if(q==="top"||q==="left"){m.append(p);m.appendChild(n)}else{m.appendChild(n);m.append(p)}if(n.getAttribute("data-id")==="root"){n.setAttribute("data-id",m.getAttribute("data-id"));m.setAttribute("data-id","root");d.$.itemsContainer=m}a(n);a(o)};if(j){switch(g){case"center":if(h instanceof TabLayoutGroup||h instanceof TabLayoutItem){i.appendChild(f)}else{var e=d.createLayoutItem("tabLayoutGroup","top");e.appendChild(f);if(h instanceof LayoutGroup&&!(h instanceof TabLayoutItem)){h.appendChild(e);a(h)}else{if(h instanceof LayoutItem){c=d.createLayoutItem("layoutGroup");h.parentElement.insertBefore(c,h);c.appendChild(h);c.appendChild(e);a(c)}}}break;case"left":case"right":var e=d.createLayoutItem("tabLayoutGroup","top");e.appendChild(f);if(h.getAttribute("data-id")==="root"){e.position=g;l(e,g)}else{l(e,g)}break;case"top":case"bottom":var e=d.createLayoutItem("tabLayoutGroup","top");e.appendChild(f);if(h.getAttribute("data-id")==="root"){e.position=g;l(e,g)}else{l(e,g)}break}return}switch(g){case"center":if(h instanceof TabLayoutGroup||h instanceof TabLayoutItem){i.appendChild(f)}else{k()}break;case"left":case"right":if(h instanceof TabLayoutGroup){var b=h.querySelector("jqx-tab-layout-item");if(b&&g==="left"){h.insertBefore(f,b)}else{h.appendChild(f)}}else{if(h instanceof TabLayoutItem){var e=d.createLayoutItem("tabLayoutGroup","top");var i=h.parentElement;e.appendChild(f);c=d.createLayoutItem("layoutGroup");i.parentElement.insertBefore(c,i);if(g==="right"){c.appendChild(i);c.appendChild(e)}else{if(g==="left"){c.appendChild(e);c.appendChild(i)}}}else{if(j){var e=d.createLayoutItem("tabLayoutGroup","top");e.appendChild(f);if(h instanceof LayoutGroup){h.insertBefore(h.firstChild,e)}else{if(h instanceof LayoutItem){c=d.createLayoutItem("layoutGroup");c.orientation=i.orientation;c.setAttribute("orientation",i.orientation);h.removeAttribute("size");h.parentElement.insertBefore(c,h);c.appendChild(h);c.appendChild(e)}}}else{k(g)}}}break;case"top":case"bottom":if(h instanceof TabLayoutGroup){c=d.createLayoutItem("layoutGroup","top");h.removeAttribute("size");h.parentElement.insertBefore(c,h);if(g==="top"){c.appendChild(d.createLayoutItem());c.appendChild(h)}else{c.appendChild(h);c.appendChild(d.createLayoutItem())}}else{k(g)}break}d.refresh()}},{key:"_addLayoutItem",value:function X(i,h,l){var d=this;if(!i){return}var a=function a(n){for(var o=0;o<n.children.length;o++){var m=n.children[o];m.removeAttribute("size")}n.removeAttribute("size")};var b=i instanceof TabLayoutItem||i instanceof TabLayoutGroup||l&&l instanceof TabLayoutItem;if(b){return d._addTabLayoutItem(i,h,l)}var f=d.createLayoutItem();var k=i.closest(".jqx-layout-group");var c;if(l){d.moveChildren(l,f)}if(h==="center"){if(i instanceof LayoutGroup){c=k;c.appendChild(f);a(c);d.refresh();return f}else{if(i instanceof LayoutItem){c=d.createLayoutItem("layoutGroup");c.orientation=k.orientation;c.setAttribute("orientation",k.orientation);i.removeAttribute("size");i.parentElement.insertBefore(c,i);c.appendChild(i);c.appendChild(f);d.refresh();return c}}}if(k.orientation==="vertical"&&(h==="left"||h==="right")||k.orientation==="horizontal"&&(h==="top"||h==="bottom")){c=k;if(i instanceof LayoutGroup){if(h==="left"||h==="top"){c.insertBefore(f,c.children[0])}else{c.appendChild(f)}a(i)}else{var g=c.items,j=Math.max(0,g.indexOf(i)+(h==="top"||h==="left"?0:1));c.insertBefore(f,g[j]);a(c)}}else{if(i instanceof LayoutGroup){var k=i.parentElement;c=i;var e=d.createLayoutItem("layoutGroup",h);k.insertBefore(e,c);if(h==="top"||h==="left"){e.append(f);e.appendChild(c)}else{e.appendChild(c);e.append(f)}if(c.getAttribute("data-id")==="root"){c.setAttribute("data-id",e.getAttribute("data-id"));e.setAttribute("data-id","root");d.$.itemsContainer=e}a(k)}else{c=d.createLayoutItem("layoutGroup",h);k.insertBefore(c,i);if(h==="top"||h==="left"){c.appendChild(f);c.appendChild(i)}else{c.appendChild(i);c.appendChild(f)}a(c)}}d.refresh();return f}},{key:"_handleButtonsVisibility",value:function aC(a){var b=this;if(!b._buttons){b._buttons=document.createElement("div");b._buttons.classList.add("jqx-layout-buttons-container");b._buttons.innerHTML='<div role="button" position="top"></div>\n <div role="button" position="bottom"></div>\n <div role="button" position="center"></div>\n <div role="button" position="left"></div>\n <div role="button" position="right"></div>'}if(!a){if(b._buttons.parentElement){b._buttons.parentElement.removeChild(b._buttons);return}}if(a){var d=a._buttonPosition||[],c=b._buttons.children;for(var f=0;f<c.length;f++){var e=c[f];e.position=e.getAttribute("position");e.item=a;d.length&&d.indexOf(e.getAttribute("position"))<0?e.classList.add("jqx-hidden"):e.classList.remove("jqx-hidden");e.onmouseenter=function(){e.setAttribute("hover","")};e.onmouseleave=function(){e.removeAttribute("hover")}}if(b.allowLiveSplit&&b._buttons.parentElement!==a){a.appendChild(b._buttons)}}}},{key:"_handleDropArea",value:function ax(a){var d=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"center";var b=this;var c=function c(e){var f=50;switch(e){case"left":b._dropArea.style.top="0px";b._dropArea.style.left="0px";b._dropArea.style.width=f+"%";b._dropArea.style.height="100%";break;case"right":b._dropArea.style.top="0px";b._dropArea.style.left="calc(100% - ".concat(f,"%)");b._dropArea.style.width=f+"%";b._dropArea.style.height="100%";break;case"top":b._dropArea.style.top="0px";b._dropArea.style.left="0px";b._dropArea.style.width="100%";b._dropArea.style.height=f+"%";break;case"bottom":b._dropArea.style.top="calc(100% - ".concat(f,"%)");b._dropArea.style.left="0px";b._dropArea.style.width="100%";b._dropArea.style.height=f+"%";break;case"center":b._dropArea.style.top="0px";b._dropArea.style.left="0px";b._dropArea.style.width="100%";b._dropArea.style.height="100%";break}};if(b._dropArea&&b._dropArea.parentElement===a){c(d);return}if(b._dropArea){b._dropArea.remove()}if(!b._dragDetails||!a){return}b._dropArea=document.createElement("div");b._dropArea.classList.add("jqx-layout-drop-area");a.appendChild(b._dropArea);b._dropArea.style.opacity=1;c(d)}},{key:"_handleSplitter",value:function ap(b){var c=this;if(!b){return}if(b.hasAttribute("tab")){b=b.parentElement}if(b._splitter){b._splitter.remove()}if(!b._splitter){b._splitter=document.createElement("div")}if(c._dragDetails&&c._dragDetails.dragging){b._splitter.remove();return}if(b.modifiers.indexOf("resize")===-1){return}b.appendChild(b._splitter);var d=b.parentElement;if(d){b._splitter.className="jqx-layout-splitter";b._splitter.item=b;b._splitter.removeAttribute("drag");var e=d.orientation;if(b.nextElementSibling&&b.nextElementSibling.hasAttribute("data-id")){b._splitter.classList.add(e)}else{if(b.previousElementSibling&&b.previousElementSibling.hasAttribute("data-id")){b._splitter.classList.add(e);b._splitter.classList.add("last")}}var a=function a(f){f.style.top="";f.style.left="";f.style.bottom="";f.style.right="";f.onpointerdown=function(g){var h=g.target.item;h.style.overflow="hidden";c._resizeDetails={splitter:g.target,splitterRect:g.target.getBoundingClientRect(),itemRect:h.getBoundingClientRect(),item:h,itemSize:h.size,group:h.parentElement,clientX:g.clientX,clientY:g.clientY};if(c._selectedItem!==h){c.querySelectorAll("[data-id]").forEach(function(i){i.removeAttribute("selected")});c.selectedIndex=h.getAttribute("index");h.setAttribute("selected","");c._selectedItem=h;c._handleButtonsVisibility(h)}if(h.previousElementSibling&&h.previousElementSibling.hasAttribute("data-id")){c._resizeDetails.previousItemRect=h.previousElementSibling.getBoundingClientRect();c._resizeDetails.previousItem=h.previousElementSibling;c._resizeDetails.previousItemSize=h.previousElementSibling.size;c._resizeDetails.previousItem.style.overflow="hidden"}else{c._resizeDetails.previousItemRect=null;c._resizeDetails.previousItem=null}if(h.nextElementSibling&&h.nextElementSibling.hasAttribute("data-id")){c._resizeDetails.nextItemRect=h.nextElementSibling.getBoundingClientRect();c._resizeDetails.nextItem=h.nextElementSibling;c._resizeDetails.nextItemSize=h.nextElementSibling.size;c._resizeDetails.nextItem.style.overflow="hidden"}else{c._resizeDetails.nextItemRect=null;c._resizeDetails.nextItem=null}}};a(b._splitter)}}}]);return au}(_wrapNativeSuper(HTMLElement));customElements.define("jqx-layout-group",LayoutGroup);customElements.define("jqx-layout-item",LayoutItem);customElements.define("jqx-tab-layout-group",TabLayoutGroup);customElements.define("jqx-tab-layout-item",TabLayoutItem);customElements.define("jqx-split-layout",SplitLayout);
2462
9
 
2463
10
 
2464
11