forked from HTMLElements/smart-webcomponents-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmart-webcomponents-angular-menu.js
1327 lines (1318 loc) · 55.2 KB
/
smart-webcomponents-angular-menu.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
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
if (!window['Smart']) {
window['Smart'] = { RenderMode: 'manual' };
}
else {
window['Smart'].RenderMode = 'manual';
}
import './../source/modules/smart.menu';
import { __decorate, __extends, __awaiter, __generator } from 'tslib';
import { EventEmitter, Output, Input, ElementRef, Directive, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
var BaseElement = /** @class */ (function () {
function BaseElement(ref) {
this.onCreate = new EventEmitter();
this.onReady = new EventEmitter();
this.onAttach = new EventEmitter();
this.onDetach = new EventEmitter();
var that = this;
this.nativeElement = ref.nativeElement;
that.nativeElement.onAttached = function () {
that.onAttach.emit(that.nativeElement);
};
that.nativeElement.onDetached = function () {
that.onDetach.emit(that.nativeElement);
};
}
BaseElement.prototype.addEventListener = function (type, listener, options) {
if (options === void 0) { options = false; }
this.nativeElement.addEventListener(type, listener, options);
};
BaseElement.prototype.removeEventListener = function (type, listener, options) {
if (options === void 0) { options = false; }
this.nativeElement.removeEventListener(type, listener, options);
};
BaseElement.prototype.dispatchEvent = function (event) {
return this.nativeElement.dispatchEvent(event);
};
BaseElement.prototype.blur = function () {
this.nativeElement.blur();
};
BaseElement.prototype.click = function () {
this.nativeElement.click();
};
BaseElement.prototype.focus = function (options) {
this.nativeElement.focus(options);
};
Object.defineProperty(BaseElement.prototype, "locale", {
/** @description Sets or gets the language. Used in conjunction with the property messages. */
get: function () {
return this.nativeElement ? this.nativeElement.locale : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.locale = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BaseElement.prototype, "localizeFormatFunction", {
/** @description Callback used to customize the format of the messages that are returned from the Localization Module. */
get: function () {
return this.nativeElement ? this.nativeElement.localizeFormatFunction : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.localizeFormatFunction = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BaseElement.prototype, "messages", {
/** @description Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale. */
get: function () {
return this.nativeElement ? this.nativeElement.messages : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.messages = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BaseElement.prototype, "rightToLeft", {
/** @description Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts. */
get: function () {
return this.nativeElement ? this.nativeElement.rightToLeft : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.rightToLeft = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(BaseElement.prototype, "theme", {
/** @description Determines the theme. Theme defines the look of the element */
get: function () {
return this.nativeElement ? this.nativeElement.theme : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.theme = value : undefined;
},
enumerable: true,
configurable: true
});
__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);
return BaseElement;
}());
var Smart = window.Smart;
var MenuComponent = /** @class */ (function (_super) {
__extends(MenuComponent, _super);
function MenuComponent(ref) {
var _this = _super.call(this, ref) || this;
_this.eventHandlers = [];
/** @description This event is triggered when the menu is closed. The event is fired only in 'dropDown' mode.
* @param event. The custom event. */
_this.onClose = new EventEmitter();
/** @description This event is triggered when the menu is about to be closed. The closing operation can be canceled by calling event.preventDefault() in the event handler function. The event is fired only in 'dropDown' mode.
* @param event. The custom event. Custom event was created with: event.detail( trigger)
* trigger - Indicates whether the event was called from inside the element or programatically.
*/
_this.onClosing = new EventEmitter();
/** @description This event is triggered when a smart-menu-items-group is collapsed.
* @param event. The custom event. Custom event was created with: event.detail( item, label, value, path, children)
* item - The menu item that was collapsed.
* label - The label of the toggled item that was collapsed.
* value - The value of the toggled item that was collapsed.
* path - The path of the toggled item that was collapsed, e.g. '0.1', '1.1.2'.
* children - The children items of the toggled item that was collapsed.
*/
_this.onCollapse = new EventEmitter();
/** @description This event is triggered when a smart-menu-items-group is collapsing.
* @param event. The custom event. Custom event was created with: event.detail( item, label, value, path, children)
* item - The menu item that is going to be collapsed.
* label - The label of the toggled item that is going to be collapsed.
* value - The value of the toggled item that is going to be collapsed.
* path - The path of the toggled item that is going to be collapsed, e.g. '0.1', '1.1.2'.
* children - The children items of the toggled item that is going to be collapsed.
*/
_this.onCollapsing = new EventEmitter();
/** @description This event is triggered when a smart-menu-items-group is expanded.
* @param event. The custom event. Custom event was created with: event.detail( item, label, value, path, children)
* item - The menu item that was expanded.
* label - The label of the toggled item that was expanded.
* value - The value of the toggled item that was expanded.
* path - The path of the toggled item that was expanded, e.g. '0.1', '1.1.2'.
* children - The children items of the toggled item that was expanded.
*/
_this.onExpand = new EventEmitter();
/** @description This event is triggered before a smart-menu-items-group is expanded.
* @param event. The custom event. Custom event was created with: event.detail( item, label, value, path, children)
* item - The menu item that is going to be expanded.
* label - The label of the toggled item that is going to be expanded.
* value - The value of the toggled item that is going to be expanded.
* path - The path of the toggled item that is going to be expanded, e.g. '0.1', '1.1.2'.
* children - The children items of the toggled item that is going to be expanded.
*/
_this.onExpanding = new EventEmitter();
/** @description This event is triggered when a menu item check state is changed.
* @param event. The custom event. Custom event was created with: event.detail( item, label, value, checked)
* item - The menu item which state was changed.
* label - The label of the item which state was changed.
* value - The value of the item which state was changed.
* checked - The checked state of the toggled item. If false the item is not toggled.
*/
_this.onItemCheckChange = new EventEmitter();
/** @description This event is triggered when a menu item is clicked.
* @param event. The custom event. Custom event was created with: event.detail( item, label, value)
* item - The menu item that is toggled.
* label - The label of the toggled item.
* value - The value of the toggled item.
*/
_this.onItemClick = new EventEmitter();
/** @description This event is triggered when the menu is opened. The event is fired only in 'dropDown' mode.
* @param event. The custom event. */
_this.onOpen = new EventEmitter();
/** @description This event is triggered when the menu is about to be opened. The opening operation can be canceled by calling event.preventDefault() in the event handler function. The event is fired only in 'dropDown' mode.
* @param event. The custom event. */
_this.onOpening = new EventEmitter();
_this.nativeElement = ref.nativeElement;
return _this;
}
/** @description Creates the component on demand.
* @param properties An optional object of properties, which will be added to the template binded ones.
*/
MenuComponent.prototype.createComponent = function (properties) {
if (properties === void 0) { properties = {}; }
this.nativeElement = document.createElement('smart-menu');
for (var propertyName in properties) {
this.nativeElement[propertyName] = properties[propertyName];
}
return this.nativeElement;
};
Object.defineProperty(MenuComponent.prototype, "animation", {
/** @description Sets or gets the animation mode. Animation is disabled when the property is set to 'none' */
get: function () {
return this.nativeElement ? this.nativeElement.animation : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.animation = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "autoCloseDelay", {
/** @description Determines delay (in milliseconds) before a Menu dropdown is closed when leaving the Menu with the mouse. Applicable only when selectionMode is 'mouseenter'. */
get: function () {
return this.nativeElement ? this.nativeElement.autoCloseDelay : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.autoCloseDelay = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "autoFocusOnMouseenter", {
/** @description If set to true, on mouseenter, the element receives focus automatically. */
get: function () {
return this.nativeElement ? this.nativeElement.autoFocusOnMouseenter : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.autoFocusOnMouseenter = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "checkable", {
/** @description Allows top-level Menu items (immediate children of the Menu) to be checkable. Sublevels are controlled by setting checkable to the respective smart-menu-items-group. */
get: function () {
return this.nativeElement ? this.nativeElement.checkable : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.checkable = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "checkboxes", {
/** @description Sets or gets whether checkboxes and radio buttons can be displayed in the Menu. This property is applicable only to the Menu itself, and not its smart-menu-item/smart-menu-items-group subitems. See also the property checkable. */
get: function () {
return this.nativeElement ? this.nativeElement.checkboxes : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.checkboxes = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "checkMode", {
/** @description Sets the check mode of top-level Menu items (immediate children of the Menu). checkMode can be set to 'checkbox', 'radioButton', or a comma-separated list containing 'checkbox', 'radioButton', or 'none' (e.g. 'checkbox, radioButton, none, checkbox'). When set to a list, each value in the list is applied to groups of Menu items separated by an item with separator (item after the one with separator is the start of a new checkMode context). Sublevels are controlled by setting checkMode to the respective smart-menu-items-group. */
get: function () {
return this.nativeElement ? this.nativeElement.checkMode : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.checkMode = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "closeAction", {
/** @description Sets the document event which closes any open Menu drop downs (or the Menu itself when mode is 'dropDown'). */
get: function () {
return this.nativeElement ? this.nativeElement.closeAction : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.closeAction = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "dataSource", {
/** @description Determines the data source that will be loaded to the Menu. The data source represents an array of objects with the following properties: label - a string representing the text content of the item.value - the value of the item.shortcut - a string representing a shortuct for the item. It will be displayed inside the item.items - allows to define an array of sub menu items. */
get: function () {
return this.nativeElement ? this.nativeElement.dataSource : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dataSource = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "disabled", {
/** @description Enables or disables element. */
get: function () {
return this.nativeElement ? this.nativeElement.disabled : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.disabled = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "displayMember", {
/** @description Determines the field in the data source that corresponds to an item's label. */
get: function () {
return this.nativeElement ? this.nativeElement.displayMember : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.displayMember = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "dropDownAppendTo", {
/** @description Sets custom outer container, where all dropdown containers must be appended. By default they are inside the menu. The value of the property can be an HTML element or the id of an HTML element. In mode 'dropDown', the property dropDownAppendTo also controls the parent element of the whole Menu. The open method works relatively to the original place of the Menu in the DOM. */
get: function () {
return this.nativeElement ? this.nativeElement.dropDownAppendTo : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dropDownAppendTo = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "dropDownOverlay", {
/** @description If this property is enabled, when an element's dropdown is opened, a transparent overlay is positioned between the dropdown and the rest of the document. */
get: function () {
return this.nativeElement ? this.nativeElement.dropDownOverlay : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dropDownOverlay = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "dropDownPosition", {
/** @description Determines the opening direction of Menu dropdowns. */
get: function () {
return this.nativeElement ? this.nativeElement.dropDownPosition : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dropDownPosition = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "items", {
/** @description A getter that returns an array of all Menu items. */
get: function () {
return this.nativeElement ? this.nativeElement.items : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.items = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "itemsMember", {
/** @description Determines the field in the data source that corresponds to an item group's subitems collection. */
get: function () {
return this.nativeElement ? this.nativeElement.itemsMember : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.itemsMember = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "locale", {
/** @description Sets or gets the language. Used in conjunction with the property messages. */
get: function () {
return this.nativeElement ? this.nativeElement.locale : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.locale = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "localizeFormatFunction", {
/** @description Callback used to customize the format of the messages that are returned from the Localization Module. */
get: function () {
return this.nativeElement ? this.nativeElement.localizeFormatFunction : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.localizeFormatFunction = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "messages", {
/** @description Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale. */
get: function () {
return this.nativeElement ? this.nativeElement.messages : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.messages = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "minimizeIconTemplate", {
/** @description Used to load a custom minimize icon from an HTMLTemplateElement object. The HTMLTemplateElement is selected by it's id. */
get: function () {
return this.nativeElement ? this.nativeElement.minimizeIconTemplate : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.minimizeIconTemplate = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "minimizeWidth", {
/** @description Determines the minimum width of the Menu at which it will switch from normal to minimized mode. If set to null, the Menu does not minimize automatically. */
get: function () {
return this.nativeElement ? this.nativeElement.minimizeWidth : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.minimizeWidth = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "mode", {
/** @description Determines the menu's display mode. */
get: function () {
return this.nativeElement ? this.nativeElement.mode : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.mode = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "opened", {
/** @description Opens or closes thte menu when it's in 'dropDown' mode. */
get: function () {
return this.nativeElement ? this.nativeElement.opened : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.opened = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "overflow", {
/** @description Sets or gets the menu's scroll buttons behavior. Applicable only when dropDownAppendTo is not null. */
get: function () {
return this.nativeElement ? this.nativeElement.overflow : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.overflow = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "preventCloseOnCheck", {
/** @description If set to true, prevents the closing of the Menu or its dropdowns when Menu items are checked/unchecked. */
get: function () {
return this.nativeElement ? this.nativeElement.preventCloseOnCheck : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.preventCloseOnCheck = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "readonly", {
/** @description If the element is readonly, users cannot interact with it. */
get: function () {
return this.nativeElement ? this.nativeElement.readonly : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.readonly = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "rightToLeft", {
/** @description Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts. */
get: function () {
return this.nativeElement ? this.nativeElement.rightToLeft : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.rightToLeft = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "selectionMode", {
/** @description Determines the menu's selection mode. */
get: function () {
return this.nativeElement ? this.nativeElement.selectionMode : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.selectionMode = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "theme", {
/** @description Determines the theme. Theme defines the look of the element */
get: function () {
return this.nativeElement ? this.nativeElement.theme : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.theme = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "unfocusable", {
/** @description If is set to true, the element cannot be focused. */
get: function () {
return this.nativeElement ? this.nativeElement.unfocusable : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.unfocusable = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuComponent.prototype, "valueMember", {
/** @description Determines the field in the data source that corresponds to an item's value. */
get: function () {
return this.nativeElement ? this.nativeElement.valueMember : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.valueMember = value : undefined;
},
enumerable: true,
configurable: true
});
/** @description Adds an item to the menu.
* @param {HTMLElement} Item. A smart-menu-item to add to the Menu.
* @param {HTMLElement | string} Parent?. The smart-menu-items-group or its id or numeric path to add the item to.
*/
MenuComponent.prototype.addItem = function (Item, Parent) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.addItem(Item, Parent);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.addItem(Item, Parent);
});
}
};
/** @description Checks an item.
* @param {HTMLElement | string} item. smart-menu-item/smart-menu-items-group or its id or numeric path.
*/
MenuComponent.prototype.checkItem = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.checkItem(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.checkItem(item);
});
}
};
/** @description Clears all Menu items.
*/
MenuComponent.prototype.clear = function () {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.clear();
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.clear();
});
}
};
/** @description Clicks on an item programatically.
* @param {HTMLElement | string} item. smart-menu-item/smart-menu-items-group or its id or numeric path.
*/
MenuComponent.prototype.clickItem = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.clickItem(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.clickItem(item);
});
}
};
/** @description Closes the Menu when mode is 'dropDown'.
*/
MenuComponent.prototype.close = function () {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.close();
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.close();
});
}
};
/** @description Collapses an item.
* @param {HTMLElement | string} item?. smart-menu-item/smart-menu-items-group or its id or numeric path. If no item is passed, all open items are collapsed.
* @param {boolean} animation?. If set to false, disables collapse animation even if animation is enabled for the element.
*/
MenuComponent.prototype.collapseItem = function (item, animation) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.collapseItem(item, animation);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.collapseItem(item, animation);
});
}
};
/** @description Expands an item.
* @param {HTMLElement | string} item. smart-menu-item/smart-menu-items-group or its id or numeric path.
* @param {boolean} animation?. If set to false, disables expand animation even if animation is enabled for the element.
*/
MenuComponent.prototype.expandItem = function (item, animation) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.expandItem(item, animation);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.expandItem(item, animation);
});
}
};
/** @description Gets an item by its id or numeric path.
* @param {string} id. The id or numeric path of an item
* @returns {HTMLElement}
*/
MenuComponent.prototype.getItem = function (id) {
return __awaiter(this, void 0, void 0, function () {
var getResultOnRender, result;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
getResultOnRender = function () {
return new Promise(function (resolve) {
_this.nativeElement.whenRendered(function () {
var result = _this.nativeElement.getItem(id);
resolve(result);
});
});
};
return [4 /*yield*/, getResultOnRender()];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
});
};
/** @description Maximizes the Menu.
*/
MenuComponent.prototype.maximize = function () {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.maximize();
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.maximize();
});
}
};
/** @description Minimizes the Menu.
*/
MenuComponent.prototype.minimize = function () {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.minimize();
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.minimize();
});
}
};
/** @description Opens the Menu when mode is 'dropDown'.
* @param {number} left. Horizontal position
* @param {number} top. Vertical position
*/
MenuComponent.prototype.open = function (left, top) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.open(left, top);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.open(left, top);
});
}
};
/** @description Removes an item from the menu.
* @param {HTMLElement | string} item. The smart-menu-item/smart-menu-items-group or its id or numeric path to remove.
*/
MenuComponent.prototype.removeItem = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.removeItem(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.removeItem(item);
});
}
};
/** @description Unchecks an item.
* @param {HTMLElement | string} item. smart-menu-item/smart-menu-items-group (or its id or numeric path)
*/
MenuComponent.prototype.uncheckItem = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.uncheckItem(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.uncheckItem(item);
});
}
};
Object.defineProperty(MenuComponent.prototype, "isRendered", {
get: function () {
return this.nativeElement ? this.nativeElement.isRendered : false;
},
enumerable: true,
configurable: true
});
MenuComponent.prototype.ngOnInit = function () {
};
MenuComponent.prototype.ngAfterViewInit = function () {
var that = this;
that.onCreate.emit(that.nativeElement);
Smart.Render();
this.nativeElement.classList.add('smart-angular');
this.nativeElement.whenRendered(function () { that.onReady.emit(that.nativeElement); });
this.listen();
};
MenuComponent.prototype.ngOnDestroy = function () {
this.unlisten();
};
MenuComponent.prototype.ngOnChanges = function (changes) {
if (this.nativeElement && this.nativeElement.isRendered) {
for (var propName in changes) {
if (changes.hasOwnProperty(propName)) {
this.nativeElement[propName] = changes[propName].currentValue;
}
}
}
};
/** @description Add event listeners. */
MenuComponent.prototype.listen = function () {
var that = this;
that.eventHandlers['closeHandler'] = function (event) { that.onClose.emit(event); };
that.nativeElement.addEventListener('close', that.eventHandlers['closeHandler']);
that.eventHandlers['closingHandler'] = function (event) { that.onClosing.emit(event); };
that.nativeElement.addEventListener('closing', that.eventHandlers['closingHandler']);
that.eventHandlers['collapseHandler'] = function (event) { that.onCollapse.emit(event); };
that.nativeElement.addEventListener('collapse', that.eventHandlers['collapseHandler']);
that.eventHandlers['collapsingHandler'] = function (event) { that.onCollapsing.emit(event); };
that.nativeElement.addEventListener('collapsing', that.eventHandlers['collapsingHandler']);
that.eventHandlers['expandHandler'] = function (event) { that.onExpand.emit(event); };
that.nativeElement.addEventListener('expand', that.eventHandlers['expandHandler']);
that.eventHandlers['expandingHandler'] = function (event) { that.onExpanding.emit(event); };
that.nativeElement.addEventListener('expanding', that.eventHandlers['expandingHandler']);
that.eventHandlers['itemCheckChangeHandler'] = function (event) { that.onItemCheckChange.emit(event); };
that.nativeElement.addEventListener('itemCheckChange', that.eventHandlers['itemCheckChangeHandler']);
that.eventHandlers['itemClickHandler'] = function (event) { that.onItemClick.emit(event); };
that.nativeElement.addEventListener('itemClick', that.eventHandlers['itemClickHandler']);
that.eventHandlers['openHandler'] = function (event) { that.onOpen.emit(event); };
that.nativeElement.addEventListener('open', that.eventHandlers['openHandler']);
that.eventHandlers['openingHandler'] = function (event) { that.onOpening.emit(event); };
that.nativeElement.addEventListener('opening', that.eventHandlers['openingHandler']);
};
/** @description Remove event listeners. */
MenuComponent.prototype.unlisten = function () {
var that = this;
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['collapseHandler']) {
that.nativeElement.removeEventListener('collapse', that.eventHandlers['collapseHandler']);
}
if (that.eventHandlers['collapsingHandler']) {
that.nativeElement.removeEventListener('collapsing', that.eventHandlers['collapsingHandler']);
}
if (that.eventHandlers['expandHandler']) {
that.nativeElement.removeEventListener('expand', that.eventHandlers['expandHandler']);
}
if (that.eventHandlers['expandingHandler']) {
that.nativeElement.removeEventListener('expanding', that.eventHandlers['expandingHandler']);
}
if (that.eventHandlers['itemCheckChangeHandler']) {
that.nativeElement.removeEventListener('itemCheckChange', that.eventHandlers['itemCheckChangeHandler']);
}
if (that.eventHandlers['itemClickHandler']) {
that.nativeElement.removeEventListener('itemClick', that.eventHandlers['itemClickHandler']);
}
if (that.eventHandlers['openHandler']) {
that.nativeElement.removeEventListener('open', that.eventHandlers['openHandler']);
}
if (that.eventHandlers['openingHandler']) {
that.nativeElement.removeEventListener('opening', that.eventHandlers['openingHandler']);
}
};
MenuComponent.ctorParameters = function () { return [
{ type: ElementRef }
]; };
__decorate([
Input()
], MenuComponent.prototype, "animation", null);
__decorate([
Input()
], MenuComponent.prototype, "autoCloseDelay", null);
__decorate([
Input()
], MenuComponent.prototype, "autoFocusOnMouseenter", null);
__decorate([
Input()
], MenuComponent.prototype, "checkable", null);
__decorate([
Input()
], MenuComponent.prototype, "checkboxes", null);
__decorate([
Input()
], MenuComponent.prototype, "checkMode", null);
__decorate([
Input()
], MenuComponent.prototype, "closeAction", null);
__decorate([
Input()
], MenuComponent.prototype, "dataSource", null);
__decorate([
Input()
], MenuComponent.prototype, "disabled", null);
__decorate([
Input()
], MenuComponent.prototype, "displayMember", null);
__decorate([
Input()
], MenuComponent.prototype, "dropDownAppendTo", null);
__decorate([
Input()
], MenuComponent.prototype, "dropDownOverlay", null);
__decorate([
Input()
], MenuComponent.prototype, "dropDownPosition", null);
__decorate([
Input()
], MenuComponent.prototype, "items", null);
__decorate([
Input()
], MenuComponent.prototype, "itemsMember", null);
__decorate([
Input()
], MenuComponent.prototype, "locale", null);
__decorate([
Input()
], MenuComponent.prototype, "localizeFormatFunction", null);
__decorate([
Input()
], MenuComponent.prototype, "messages", null);
__decorate([
Input()
], MenuComponent.prototype, "minimizeIconTemplate", null);
__decorate([
Input()
], MenuComponent.prototype, "minimizeWidth", null);
__decorate([
Input()
], MenuComponent.prototype, "mode", null);
__decorate([
Input()
], MenuComponent.prototype, "opened", null);
__decorate([
Input()
], MenuComponent.prototype, "overflow", null);
__decorate([
Input()
], MenuComponent.prototype, "preventCloseOnCheck", null);
__decorate([
Input()
], MenuComponent.prototype, "readonly", null);
__decorate([
Input()
], MenuComponent.prototype, "rightToLeft", null);
__decorate([
Input()
], MenuComponent.prototype, "selectionMode", null);
__decorate([
Input()
], MenuComponent.prototype, "theme", null);
__decorate([
Input()
], MenuComponent.prototype, "unfocusable", null);
__decorate([
Input()
], MenuComponent.prototype, "valueMember", null);
__decorate([
Output()
], MenuComponent.prototype, "onClose", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onClosing", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onCollapse", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onCollapsing", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onExpand", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onExpanding", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onItemCheckChange", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onItemClick", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onOpen", void 0);
__decorate([
Output()
], MenuComponent.prototype, "onOpening", void 0);
MenuComponent = __decorate([
Directive({
exportAs: 'smart-menu', selector: 'smart-menu, [smart-menu]'
})
], MenuComponent);
return MenuComponent;
}(BaseElement));
var MenuItemComponent = /** @class */ (function (_super) {
__extends(MenuItemComponent, _super);
function MenuItemComponent(ref) {
var _this = _super.call(this, ref) || this;
_this.eventHandlers = [];
_this.nativeElement = ref.nativeElement;
return _this;
}
/** @description Creates the component on demand.
* @param properties An optional object of properties, which will be added to the template binded ones.
*/
MenuItemComponent.prototype.createComponent = function (properties) {
if (properties === void 0) { properties = {}; }
this.nativeElement = document.createElement('smart-menu-item');
for (var propertyName in properties) {
this.nativeElement[propertyName] = properties[propertyName];
}
return this.nativeElement;
};
Object.defineProperty(MenuItemComponent.prototype, "checked", {
/** @description */
get: function () {
return this.nativeElement ? this.nativeElement.checked : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.checked = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MenuItemComponent.prototype, "disabled", {
/** @description Enables or disables element. */
get: function () {
return this.nativeElement ? this.nativeElement.disabled : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.disabled = value : undefined;
},
enumerable: true,
configurable: true