-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsmart-webcomponents-angular-dockinglayout.js
944 lines (937 loc) · 46.6 KB
/
smart-webcomponents-angular-dockinglayout.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
if (!window['Smart']) {
window['Smart'] = { RenderMode: 'manual' };
}
else {
window['Smart'].RenderMode = 'manual';
}
import './../source/modules/smart.dockinglayout';
import { __decorate, __awaiter } from 'tslib';
import { EventEmitter, Output, Input, ElementRef, Directive, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
class BaseElement {
constructor(ref) {
this.onCreate = new EventEmitter();
this.onReady = new EventEmitter();
this.onAttach = new EventEmitter();
this.onDetach = new EventEmitter();
const that = this;
this.nativeElement = ref.nativeElement;
that.nativeElement.onAttached = () => {
that.onAttach.emit(that.nativeElement);
};
that.nativeElement.onDetached = () => {
that.onDetach.emit(that.nativeElement);
};
}
addEventListener(type, listener, options = false) {
this.nativeElement.addEventListener(type, listener, options);
}
removeEventListener(type, listener, options = false) {
this.nativeElement.removeEventListener(type, listener, options);
}
dispatchEvent(event) {
return this.nativeElement.dispatchEvent(event);
}
blur() {
this.nativeElement.blur();
}
click() {
this.nativeElement.click();
}
focus(options) {
this.nativeElement.focus(options);
}
/** @description Sets or gets the language. Used in conjunction with the property messages. */
get locale() {
return this.nativeElement ? this.nativeElement.locale : undefined;
}
set locale(value) {
this.nativeElement ? this.nativeElement.locale = value : undefined;
}
/** @description Callback used to customize the format of the messages that are returned from the Localization Module. */
get localizeFormatFunction() {
return this.nativeElement ? this.nativeElement.localizeFormatFunction : undefined;
}
set localizeFormatFunction(value) {
this.nativeElement ? this.nativeElement.localizeFormatFunction = value : undefined;
}
/** @description Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale. */
get messages() {
return this.nativeElement ? this.nativeElement.messages : undefined;
}
set messages(value) {
this.nativeElement ? this.nativeElement.messages = value : undefined;
}
/** @description Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts. */
get rightToLeft() {
return this.nativeElement ? this.nativeElement.rightToLeft : undefined;
}
set rightToLeft(value) {
this.nativeElement ? this.nativeElement.rightToLeft = value : undefined;
}
/** @description Determines the theme. Theme defines the look of the element */
get theme() {
return this.nativeElement ? this.nativeElement.theme : undefined;
}
set theme(value) {
this.nativeElement ? this.nativeElement.theme = value : undefined;
}
}
__decorate([
Output()
], BaseElement.prototype, "onCreate", void 0);
__decorate([
Output()
], BaseElement.prototype, "onReady", void 0);
__decorate([
Output()
], BaseElement.prototype, "onAttach", void 0);
__decorate([
Output()
], BaseElement.prototype, "onDetach", void 0);
__decorate([
Input()
], BaseElement.prototype, "locale", null);
__decorate([
Input()
], BaseElement.prototype, "localizeFormatFunction", null);
__decorate([
Input()
], BaseElement.prototype, "messages", null);
__decorate([
Input()
], BaseElement.prototype, "rightToLeft", null);
__decorate([
Input()
], BaseElement.prototype, "theme", null);
const Smart = window.Smart;
let DockingLayoutComponent = class DockingLayoutComponent extends BaseElement {
constructor(ref) {
super(ref);
this.eventHandlers = [];
/** @description This event is triggered when the tab selection is changed. Note: Change event may be thrown by other JQX Custom Elements nested inside the Tab items.
* @param event. The custom event. */
this.onChange = new EventEmitter();
/** @description This event is triggered when a Tab item or a whole Tabs Window item ( DockingLayout item ) is closed.
* @param event. The custom event. */
this.onClose = new EventEmitter();
/** @description This event is triggered when a Tab item/Tabs Window is about to be closed. The closing operation can be canceled by calling event.preventDefault() in the event handler function.
* @param event. The custom event. */
this.onClosing = new EventEmitter();
/** @description This event is triggered when an item's position inside the Layout or it's size has been changed. Indicates that a state change has occured.
* @param event. The custom event. */
this.onStateChange = new EventEmitter();
/** @description This event is triggered when item resizing begins.
* @param event. The custom event. */
this.onResizeStart = new EventEmitter();
/** @description This event is triggered when item resizing finishes.
* @param event. The custom event. */
this.onResizeEnd = new EventEmitter();
this.nativeElement = ref.nativeElement;
}
/** @description Creates the component on demand.
* @param properties An optional object of properties, which will be added to the template binded ones.
*/
createComponent(properties = {}) {
this.nativeElement = document.createElement('smart-docking-layout');
for (let propertyName in properties) {
this.nativeElement[propertyName] = properties[propertyName];
}
return this.nativeElement;
}
/** @description Sets or gets the animation mode. Animation is disabled when the property is set to 'none' */
get animation() {
return this.nativeElement ? this.nativeElement.animation : undefined;
}
set animation(value) {
this.nativeElement ? this.nativeElement.animation = value : undefined;
}
/** @description A getter that returns an array of all DockingLayout items that are auto hidden inside the element. */
get autoHideItems() {
return this.nativeElement ? this.nativeElement.autoHideItems : undefined;
}
set autoHideItems(value) {
this.nativeElement ? this.nativeElement.autoHideItems = value : undefined;
}
/** @description Enable/Disable the automatic state loading. There must be a previously saved state of the Layout in order to load it. */
get autoLoadState() {
return this.nativeElement ? this.nativeElement.autoLoadState : undefined;
}
set autoLoadState(value) {
this.nativeElement ? this.nativeElement.autoLoadState = value : undefined;
}
/** @description Enable/Disable the automatic state saving. Note: In order to save the state of the element it must have an id. */
get autoSaveState() {
return this.nativeElement ? this.nativeElement.autoSaveState : undefined;
}
set autoSaveState(value) {
this.nativeElement ? this.nativeElement.autoSaveState = value : undefined;
}
/** @description Enables or disables the element. */
get disabled() {
return this.nativeElement ? this.nativeElement.disabled : undefined;
}
set disabled(value) {
this.nativeElement ? this.nativeElement.disabled = value : undefined;
}
/** @description If set to false it will disable the dragging of DockingLayout items. If set items can only be repositioned using the API methods. */
get draggable() {
return this.nativeElement ? this.nativeElement.draggable : undefined;
}
set draggable(value) {
this.nativeElement ? this.nativeElement.draggable = value : undefined;
}
/** @description If set to false it will disable item floating. This means that if a Window is floated as a result of dragging it will be returned back ot it's original position instead of being floated outside the DockingLayout. Already floated LayoutPanel items will not be affected. */
get floatable() {
return this.nativeElement ? this.nativeElement.floatable : undefined;
}
set floatable(value) {
this.nativeElement ? this.nativeElement.floatable = value : undefined;
}
/** @description Hides all splitter bars inside the element. */
get hideSplitterBars() {
return this.nativeElement ? this.nativeElement.hideSplitterBars : undefined;
}
set hideSplitterBars(value) {
this.nativeElement ? this.nativeElement.hideSplitterBars = value : undefined;
}
/** @description A getter that returns an array of all DockingLayout items that are docked inside the element. */
get items() {
return this.nativeElement ? this.nativeElement.items : undefined;
}
set items(value) {
this.nativeElement ? this.nativeElement.items = value : undefined;
}
/** @description A getter that returns an array of all DockingLayout items that have been closed. */
get closedItems() {
return this.nativeElement ? this.nativeElement.closedItems : undefined;
}
set closedItems(value) {
this.nativeElement ? this.nativeElement.closedItems = value : undefined;
}
/** @description Determines the structure of the element. This property represents an array of objects that define the hierarchy of the items inside the element and their specific settings. Each object must have a type attribute that defines it's behavior. Three types of objects are allowed: LayoutGroup - Represents a group of items (Splitter). Used when the user wants more than one DockingLayout item in a single container. Properties: orientation - A string value indicating the orientation of the Splitter group. Possible values: 'horizontal', 'vertical'. size - A string | number value indicating the size of the Splitter group. items - An array of LayoutPanel object definitions. resizeMode - A string indicating the resize mode. Possible values: 'none', 'adjacent', 'end', 'proportional'. resizeStep - A nummeric value that determines the step of resizing. liveResize - Determines if splitter resizing happens while dragging or not. LayoutPanel - Represents a DockingLayout item (TabsWindow). LayoutPanels can have one or many items (TabItem). Properties: id - the ID of the LayoutPanel. autoHide - a boolean property that determines if the LayoutPanel is autoHidden. autoHidePosition - determines the autoHide position of the item if 'autoHide' property is set. Possible values: 'top', 'bottom', 'left', 'right'. dropPosition - Determines the possible positions for the item at which a new item can be dropped as a result of dragging. Possible values: 'top', 'bottom', 'left', 'right', 'center', 'header', 'layout-top', 'layout-bottom', 'layout-left', 'layout-right'. Positions with the 'layout' prefix reflect on LayoutPanelItems that are children of the LayoutPanel. label - the Label of the LayoutPanel window. tabPosition - Determines the position of the Tab labels inside the LayoutPanel. layout - determines the DockingLayout owner of the LayoutPanel. Accepts a string indicating the ID of a DockingLayout on the page or a direct reference to it. headerButtons - an Array of strings that define the buttons in the header section of the DockingLayout item. tabCloseButtons - a boolean property that Enables or disables the close buttons inside each Tab item label inside the DockingLayout item. tabOverflow - same as 'overflow' property of jqxTabs. It defines the overflow mode of the labels of the Tab items inside a DockingLayout item.selectionMode - the same as jqxTabs selection modes. Applies to Tab items inside a DockingLayout item. tabResize - the same as 'resize' property of jqxTabs. Allows resizing the Tab labels inside the DockingLayout item. locked - Locks the size of the item and does not allow resizing. max - sets the maximum size of the item. min - sets the minimum size of the item size - sets the size of the item. items - an array of objects. Each object defines the structure of a LayoutPanelItem. LayoutPanelItem - Represents a LayoutPanel item (TabItem). Properties: id - the ID of the Tab item. label - a string representing the label of the Tab item. content - represents the content of the Tab item. Can be anything. selected - determines if the item is selected. By default the first added item to the LayoutPanel is automatically selected. draggable - a boolean property that allows to disable the dragging of the Tab item. */
get layout() {
return this.nativeElement ? this.nativeElement.layout : undefined;
}
set layout(value) {
this.nativeElement ? this.nativeElement.layout = value : undefined;
}
/** @description When enabled the resizing operation happens live. By default this feature is not enabled and the user sees a hightlighted bar while dragging instead of the actual splitter bar. */
get liveResize() {
return this.nativeElement ? this.nativeElement.liveResize : undefined;
}
set liveResize(value) {
this.nativeElement ? this.nativeElement.liveResize = value : undefined;
}
/** @description Sets or gets the language. Used in conjunction with the property messages. */
get locale() {
return this.nativeElement ? this.nativeElement.locale : undefined;
}
set locale(value) {
this.nativeElement ? this.nativeElement.locale = value : undefined;
}
/** @description Callback, related to localization module. */
get localizeFormatFunction() {
return this.nativeElement ? this.nativeElement.localizeFormatFunction : undefined;
}
set localizeFormatFunction(value) {
this.nativeElement ? this.nativeElement.localizeFormatFunction = value : undefined;
}
/** @description Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale. */
get messages() {
return this.nativeElement ? this.nativeElement.messages : undefined;
}
set messages(value) {
this.nativeElement ? this.nativeElement.messages = value : undefined;
}
/** @description If the element is readonly, users cannot interact with it. */
get readonly() {
return this.nativeElement ? this.nativeElement.readonly : undefined;
}
set readonly(value) {
this.nativeElement ? this.nativeElement.readonly = value : undefined;
}
/** @description Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts. */
get rightToLeft() {
return this.nativeElement ? this.nativeElement.rightToLeft : undefined;
}
set rightToLeft(value) {
this.nativeElement ? this.nativeElement.rightToLeft = value : undefined;
}
/** @description Determines the resize step during reisizing */
get resizeStep() {
return this.nativeElement ? this.nativeElement.resizeStep : undefined;
}
set resizeStep(value) {
this.nativeElement ? this.nativeElement.resizeStep = value : undefined;
}
/** @description Determines the snap mode. Two modes are available: simple - allows dragging of a single tab item inside or outside the layout. A semi-transparent highlighter is used to indicate the possible locations where the dragged item can be dropped. The user has to drop the dragged item inside one of the possible drop zones indicated by the highlighter. advanced - allows dragging of a whole TabsWindow with items or a single tab item. Uses a Visual Studio style feedback that indicates the possible drop locations. The user has to drop the target over one of the icons inside the feedback. The feedback/highlighter is displayed when the dragging of an item begins. */
get snapMode() {
return this.nativeElement ? this.nativeElement.snapMode : undefined;
}
set snapMode(value) {
this.nativeElement ? this.nativeElement.snapMode = value : undefined;
}
/** @description Determines the theme. Theme defines the look of the element */
get theme() {
return this.nativeElement ? this.nativeElement.theme : undefined;
}
set theme(value) {
this.nativeElement ? this.nativeElement.theme = value : undefined;
}
/** @description A getter that returns an array of all DockingLayout items that have been undocked. Undocked items are no more part of the Layout's interal structure but can be inserted by dragging them in. */
get undockedItems() {
return this.nativeElement ? this.nativeElement.undockedItems : undefined;
}
set undockedItems(value) {
this.nativeElement ? this.nativeElement.undockedItems = value : undefined;
}
/** @description If is set to true, the element cannot be focused. */
get unfocusable() {
return this.nativeElement ? this.nativeElement.unfocusable : undefined;
}
set unfocusable(value) {
this.nativeElement ? this.nativeElement.unfocusable = value : undefined;
}
/** @description Makes a "smart-tabs-window" node, that is a child of the Layout, auto hidden by placing it at the Bottom position inside the element. This means that the item will be positioned near the bottom side of the layout and it's content will be hidden until the user selects one of it's labels.
* @param {HTMLElement | number | string} node. The "smart-tabs-window" or "smart-tab-item" node to append
*/
autoHideBottom(node) {
if (this.nativeElement.isRendered) {
this.nativeElement.autoHideBottom(node);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.autoHideBottom(node);
});
}
}
/** @description Makes a "smart-tabs-window" node, that is a child of the Layout, auto hidden by placing it at the Left position inside the layout. This means that the item will be positioned near the left side of the layout and it's content will be hidden until the user selects one of it's labels.
* @param {HTMLElement | number | string} node. The "smart-tabs-window" or "smart-tab-item" node to append
*/
autoHideLeft(node) {
if (this.nativeElement.isRendered) {
this.nativeElement.autoHideLeft(node);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.autoHideLeft(node);
});
}
}
/** @description Makes a "smart-tabs-window" node, that is a child of the Layout, auto hidden by placing it at the Right position inside the layout. This means that the item will be positioned near the right side of the layout and it's content will be hidden until the user selects one of it's labels.
* @param {HTMLElement | number | string} node. The "smart-tabs-window" or "smart-tab-item" node to append
*/
autoHideRight(node) {
if (this.nativeElement.isRendered) {
this.nativeElement.autoHideRight(node);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.autoHideRight(node);
});
}
}
/** @description Makes a "smart-tabs-window" node, that is a child of the Layout, auto hidden by placing it at the Top position inside the layout. This means that the item will be positioned near the top side of the layout and it's content will be hidden until the user selects one of it's labels.
* @param {HTMLElement | number | string} node. The "smart-tabs-window" or "smart-tab-item" node to append
*/
autoHideTop(node) {
if (this.nativeElement.isRendered) {
this.nativeElement.autoHideTop(node);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.autoHideTop(node);
});
}
}
/** @description Clears the localStorage of any previous cached state of the DockingLayout.
*/
clearState() {
if (this.nativeElement.isRendered) {
this.nativeElement.clearState();
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.clearState();
});
}
}
/** @description The method will reset an autohidden item to it's normal behavior and re-insert it at a specified position. It can also be used to insert items into the DockingLayout. Note: Items inserted via this method are added as a top level items.
* @param {string | number | Node} node. An autohidden "smart-tabs-window" item instance or a new "smart-tabs-window" instance.
* @returns {Node}
*/
dock(node) {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.dock(node);
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted before the target item which corresponds to the index passed as the first argument to the method.
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertBeforeItem(index, item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertBeforeItem(index, item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertBeforeItem(index, item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted after the target item which corresponds to the index passed as the first argument to the method.
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertAfterItem(index, item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertAfterItem(index, item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertAfterItem(index, item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted by splitting the target item which corresponds to the index passed as the first argument to the method in two and placing the new item as it's left neighbour horizontally.
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertIntoLeft(index, item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertIntoLeft(index, item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertIntoLeft(index, item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted by splitting the target item which corresponds to the index passed as the first argument to the method in two and placing the new item as it's right neighbour horizontally.
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertIntoRight(index, item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertIntoRight(index, item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertIntoRight(index, item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted by splitting the target item which corresponds to the index passed as the first argument to the method in two and placing the new item as it's top neighbour vertically.
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertIntoTop(index, item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertIntoTop(index, item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertIntoTop(index, item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted by splitting the target item which corresponds to the index passed as the first argument to the method in two and placing the new item as it's bottom neighbour vertically.
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertIntoBottom(index, item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertIntoBottom(index, item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertIntoBottom(index, item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted as a top level item positioned at the top side inside the Layout.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertLayoutTop(item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertLayoutTop(item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertLayoutTop(item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted as a top level item positioned at the bottom side inside the Layout.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertLayoutBottom(item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertLayoutBottom(item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertLayoutBottom(item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted as a top level item positioned at the left side inside the Layout.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertLayoutLeft(item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertLayoutLeft(item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertLayoutLeft(item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The new item is inserted as a top level item positioned at the right inside the Layout.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertLayoutRight(item) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertLayoutRight(item);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertLayoutRight(item);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The target item and it's neighbour items are placed inside a new splitter item that acts as the new neghbour of the newly added item via this method. The new item is inserted above the target ( at position Top).
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} tabsWindow. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertOutsideTargetGroupTop(index, tabsWindow) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertOutsideTargetGroupTop(index, tabsWindow);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertOutsideTargetGroupTop(index, tabsWindow);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The target item and it's neighbour items are placed inside a new splitter item that acts as the new neghbour of the newly added item via this method. The new item is inserted bellow the target ( at position Bottom).
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} tabsWindow. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertOutsideTargetGroupBottom(index, tabsWindow) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertOutsideTargetGroupBottom(index, tabsWindow);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertOutsideTargetGroupBottom(index, tabsWindow);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The target item and it's neighbour items are placed inside a new splitter item that acts as the new neghbour of the newly added item via this method. The new item is inserted before the target ( at position Left).
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} tabsWindow. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertOutsideTargetGroupLeft(index, tabsWindow) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertOutsideTargetGroupLeft(index, tabsWindow);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertOutsideTargetGroupLeft(index, tabsWindow);
});
}
}
/** @description Inserts a new TabsWindow into the DockingLayout or creates a TabsWindow instance from an object passed as the second argument. The target item and it's neighbour items are placed inside a new splitter item that acts as the new neghbour of the newly added item via this method. The new item is inserted after the target ( at position Right).
* @param {number | HTMLElement | string} index. The index to insert a new TabsWindow at.
* @param {any} tabsWindow. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
*/
insertOutsideTargetGroupRight(index, tabsWindow) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertOutsideTargetGroupRight(index, tabsWindow);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertOutsideTargetGroupRight(index, tabsWindow);
});
}
}
/** @description Inserts a new TabsWindow. The window is in floating mode and is undocked.
* @param {any} item. An instance of a TabsWindow or an Object with the fields "label", "items" and other additional.
* @param {number | string} left?. The left position of the new window. You can use number, px or %. For example: '10px'.
* @param {number | string} top?. The top position of the new window. You can use number, px or %. For example: '10px'.
*/
insertFloatingWindow(item, left, top) {
if (this.nativeElement.isRendered) {
this.nativeElement.insertFloatingWindow(item, left, top);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.insertFloatingWindow(item, left, top);
});
}
}
/** @description The method returns an array of all autohidden items.
* @param {string} orientation?. Determines which auto hidden items to return ( vertical or horizontal ). If not set the method will return all autohidden items. Possible values: 'vertical', 'horizontal'.
* @returns {any[]}
*/
getAutoHideItems(orientation) {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.getAutoHideItems(orientation);
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description The method returns the index of a target item.
* @param {HTMLElement} node. Returns the index of the target item.
* @returns {number}
*/
getIndex(node) {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.getIndex(node);
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description Returns an array of objects representing the current structure of the element. Each object represents a Layout item with it's settings and hierarchy.
* @param {boolean} noInstances?. Determines if the returned array will contain HTML references or not. When saving to localStorage the resulted array should not contain any HTMLElement references.
* @returns {any[]}
*/
getState(noInstances) {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.getState(noInstances);
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description Returns the Splitter parent of a Layout item
* @param {HTMLElement} item?. DockingLayout item
* @returns {HTMLElement}
*/
getItemGroupElement(item) {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.getItemGroupElement(item);
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description Returns a JSON array of objects representing the current structure of the element. Ready to be persisted to LocalStorage.
* @returns {any[]}
*/
getJSONStructure() {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.getJSONStructure();
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description Loads a previously saved state of the element. If no state is provided as an argument the method will do a localStorage lookup.
* @param {any[]} state?. An array of objects that represents a cached state of the DockingLayout. The result of calling the 'saveState' method.
*/
loadState(state) {
if (this.nativeElement.isRendered) {
this.nativeElement.loadState(state);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.loadState(state);
});
}
}
/** @description Removes a DockingLayout item (TabsWindow) from the element.
* @param {number | HTMLElement | string} index. The index of the TabsWindow to remove or a reference to it.
*/
removeAt(index) {
if (this.nativeElement.isRendered) {
this.nativeElement.removeAt(index);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.removeAt(index);
});
}
}
/** @description Removes all items from the element.
*/
removeAll() {
if (this.nativeElement.isRendered) {
this.nativeElement.removeAll();
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.removeAll();
});
}
}
/** @description Removes a "smart-tabs-window" node that is a DockingLayout item.
* @param {Node} node. The "smart-tabs-window" node to remove.
* @returns {Node}
*/
removeChild(node) {
return __awaiter(this, void 0, void 0, function* () {
const getResultOnRender = () => {
return new Promise(resolve => {
this.nativeElement.whenRendered(() => {
const result = this.nativeElement.removeChild(node);
resolve(result);
});
});
};
const result = yield getResultOnRender();
return result;
});
}
/** @description Saves the current state of the DockingLayout to LocalStorage. The state includes the hierarchy and size of the items.
*/
saveState() {
if (this.nativeElement.isRendered) {
this.nativeElement.saveState();
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.saveState();
});
}
}
/** @description The method undocks/removes an item from the Layout and places it at the same position but it's no more part of the layout. The item becomes an 'outher' item that can be reinserted at any time.
* @param {string | number | Node} node. A "smart-tabs-window" instance that is part of the DockingLayout.
*/
undock(node) {
if (this.nativeElement.isRendered) {
this.nativeElement.undock(node);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.undock(node);
});
}
}
/** @description Updates a TabsWindow and it's contents.
* @param {number | HTMLElement | string} index. The index of the TabsWindow to update.
* @param {any} settings. An object that contains the new settings for the TabsWindow item. Settings object is the same as defining a new TabsWindow with the exception of 'items' array where the items are defined. In order to change the label or content of a Tab item the user has to specify the index of the target tab item.
*/
update(index, settings) {
if (this.nativeElement.isRendered) {
this.nativeElement.update(index, settings);
}
else {
this.nativeElement.whenRendered(() => {
this.nativeElement.update(index, settings);
});
}
}
get isRendered() {
return this.nativeElement ? this.nativeElement.isRendered : false;
}
ngOnInit() {
}
ngAfterViewInit() {
const that = this;
that.onCreate.emit(that.nativeElement);
Smart.Render();
this.nativeElement.classList.add('smart-angular');
this.nativeElement.whenRendered(() => { that.onReady.emit(that.nativeElement); });
this.listen();
}
ngOnDestroy() {
this.unlisten();
}
ngOnChanges(changes) {
if (this.nativeElement && this.nativeElement.isRendered) {
for (const propName in changes) {
if (changes.hasOwnProperty(propName)) {
this.nativeElement[propName] = changes[propName].currentValue;
}
}
}
}
/** @description Add event listeners. */
listen() {
const that = this;
that.eventHandlers['changeHandler'] = (event) => { that.onChange.emit(event); };
that.nativeElement.addEventListener('change', that.eventHandlers['changeHandler']);
that.eventHandlers['closeHandler'] = (event) => { that.onClose.emit(event); };
that.nativeElement.addEventListener('close', that.eventHandlers['closeHandler']);
that.eventHandlers['closingHandler'] = (event) => { that.onClosing.emit(event); };
that.nativeElement.addEventListener('closing', that.eventHandlers['closingHandler']);
that.eventHandlers['stateChangeHandler'] = (event) => { that.onStateChange.emit(event); };
that.nativeElement.addEventListener('stateChange', that.eventHandlers['stateChangeHandler']);
that.eventHandlers['resizeStartHandler'] = (event) => { that.onResizeStart.emit(event); };
that.nativeElement.addEventListener('resizeStart', that.eventHandlers['resizeStartHandler']);
that.eventHandlers['resizeEndHandler'] = (event) => { that.onResizeEnd.emit(event); };
that.nativeElement.addEventListener('resizeEnd', that.eventHandlers['resizeEndHandler']);
}
/** @description Remove event listeners. */
unlisten() {
const that = this;
if (that.eventHandlers['changeHandler']) {
that.nativeElement.removeEventListener('change', that.eventHandlers['changeHandler']);
}
if (that.eventHandlers['closeHandler']) {
that.nativeElement.removeEventListener('close', that.eventHandlers['closeHandler']);
}
if (that.eventHandlers['closingHandler']) {
that.nativeElement.removeEventListener('closing', that.eventHandlers['closingHandler']);
}
if (that.eventHandlers['stateChangeHandler']) {
that.nativeElement.removeEventListener('stateChange', that.eventHandlers['stateChangeHandler']);
}
if (that.eventHandlers['resizeStartHandler']) {
that.nativeElement.removeEventListener('resizeStart', that.eventHandlers['resizeStartHandler']);
}
if (that.eventHandlers['resizeEndHandler']) {
that.nativeElement.removeEventListener('resizeEnd', that.eventHandlers['resizeEndHandler']);
}
}
};
DockingLayoutComponent.ctorParameters = () => [
{ type: ElementRef }
];
__decorate([
Input()
], DockingLayoutComponent.prototype, "animation", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "autoHideItems", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "autoLoadState", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "autoSaveState", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "disabled", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "draggable", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "floatable", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "hideSplitterBars", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "items", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "closedItems", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "layout", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "liveResize", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "locale", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "localizeFormatFunction", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "messages", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "readonly", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "rightToLeft", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "resizeStep", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "snapMode", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "theme", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "undockedItems", null);
__decorate([
Input()
], DockingLayoutComponent.prototype, "unfocusable", null);
__decorate([
Output()
], DockingLayoutComponent.prototype, "onChange", void 0);
__decorate([
Output()
], DockingLayoutComponent.prototype, "onClose", void 0);
__decorate([
Output()
], DockingLayoutComponent.prototype, "onClosing", void 0);
__decorate([
Output()
], DockingLayoutComponent.prototype, "onStateChange", void 0);
__decorate([
Output()
], DockingLayoutComponent.prototype, "onResizeStart", void 0);
__decorate([
Output()
], DockingLayoutComponent.prototype, "onResizeEnd", void 0);
DockingLayoutComponent = __decorate([
Directive({
exportAs: 'smart-docking-layout', selector: 'smart-docking-layout, [smart-docking-layout]'
})
], DockingLayoutComponent);
let DockingLayoutModule = class DockingLayoutModule {
};
DockingLayoutModule = __decorate([
NgModule({
declarations: [DockingLayoutComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
exports: [DockingLayoutComponent]
})
], DockingLayoutModule);
/**
* Generated bundle index. Do not edit.
*/
export { DockingLayoutComponent, DockingLayoutModule, Smart, BaseElement as ɵa };
//# sourceMappingURL=smart-webcomponents-angular-dockinglayout.js.map