forked from HTMLElements/smart-webcomponents-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmart.listbox.js
1273 lines (1273 loc) · 154 KB
/
smart.listbox.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
import * as tslib_1 from "tslib";
import { Component, Directive, AfterViewInit, ElementRef, Input, OnInit, OnChanges, OnDestroy, SimpleChanges, forwardRef, ChangeDetectionStrategy, Output, EventEmitter, QueryList, ContentChildren } from '@angular/core';
import { BaseElement, Smart } from './smart.element';
export { Smart } from './smart.element';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
var CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(function () { return ListBoxComponent; }),
multi: true
};
var ListBoxComponent = /** @class */ (function (_super) {
tslib_1.__extends(ListBoxComponent, _super);
function ListBoxComponent(ref) {
var _this = _super.call(this, ref) || this;
_this.eventHandlers = [];
/**
* @description
* The registered callback function called when a change event occurs on the form elements.
*/
_this._onChange = function () { };
/**
* @description
* The registered callback function called when a blur event occurs on the form elements.
*/
_this._onTouched = function () { };
/** @description This event is triggered when listbox binding is completed.
* @param event. The custom event. */
_this.onBindingComplete = new EventEmitter();
/** @description This event is triggered when selection is changed.
* @param event. The custom event. Custom event was created with: event.detail( addedItems, disabled, index, label, removedItems, selected, value)
* addedItems - An array of List items that have been selected.
* disabled - A flag indicating whether or not the item that caused the change event is disabled.
* index - The index of the List item that triggered the event.
* label - The label of the List item that triggered the event.
* removedItems - An array of List items that have been unselected before the event was fired.
* selected - The selected state of the List item that triggered the event. If an item was selected the value will be true and vice versa.
* value - The value of the List item that triggered the event.
*/
_this.onChange = new EventEmitter();
/** @description This event is triggered when an item is dropped. The dragging operation can be canceled by calling event.preventDefault() in the event handler function.
* @param event. The custom event. Custom event was created with: event.detail( container, data, item, originalEvent, previousContainer, target)
* container - The List box that an item was dragged <strong>to.</strong>
* data - An object that contains data about the dragging operation like start position, start time, etc.
* item - The List item that was dragged.
* originalEvent - That original event that was fired.
* previousContainer - The List box that an item was dragged <strong>from</strong>.
* target - The event target.
*/
_this.onDragEnd = new EventEmitter();
/** @description This event is triggered when a List item is being dragged.
* @param event. The custom event. Custom event was created with: event.detail( data, item, originalEvent)
* data - An object that contains data about the dragging operation like start position, start time, etc.
* item - The List item that is being dragged. This is the item that has been clicked when initiating the drag operation
* originalEvent - The original event that initiates the dragging operation.
*/
_this.onDragging = new EventEmitter();
/** @description This event is triggered when an item is dragged. The dragging operation can be canceled by calling event.preventDefault() in the event handler function.
* @param event. The custom event. Custom event was created with: event.detail( container, data, item, originalEvent, previousContainer, target)
* container - The List box that an item was dragged <strong>to.</strong>
* data - An object that contains data about the dragging oepration like start position, start time, etc.
* item - The List item that was dragged.
* originalEvent - That original event that was fired.
* previousContainer - The List box that an item was dragged <strong>from</strong>.
* target - The event target.
*/
_this.onDragStart = new EventEmitter();
/** @description This event is triggered when an item is clicked.
* @param event. The custom event. Custom event was created with: event.detail( disabled, index, label, selected, value)
* disabled - Indicates whether the List item that was clicked is disabled or not.
* index - Indicates the index of the List item that was clicked.
* label - The label of the List item that was clicked.
* selected - Indicates whether the List item that was clicked is selected or not.
* value - The value of the List item that was clicked.
*/
_this.onItemClick = new EventEmitter();
/** @description This event is triggered when an item has been edited.
* @param event. The custom event. Custom event was created with: event.detail( selected, disabled, index, label, value)
* selected - Indicates whether the List item is selected or not.
* disabled - Indicates whether the List item is disabled or not.
* index - The index of the List item that was edited.
* label - The label of the edited List item.
* value - The value of the List item that was edited.
*/
_this.onItemLabelChange = new EventEmitter();
/** @description This event is triggered when user scrolls to the end of the list.
* @param event. The custom event. */
_this.onScrollBottomReached = new EventEmitter();
/** @description This event is triggered when user scrolls to the beginning of the list.
* @param event. The custom event. */
_this.onScrollTopReached = new EventEmitter();
/** @description This event is triggered when the user swipes to the left, inside the listBox.
* @param event. The custom event. */
_this.onSwipeleft = new EventEmitter();
/** @description This event is triggered when the user swipes to the right, inside the listBox.
* @param event. The custom event. */
_this.onSwiperight = new EventEmitter();
_this._initialChange = true;
_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.
*/
ListBoxComponent.prototype.createComponent = function (properties) {
if (properties === void 0) { properties = {}; }
this.nativeElement = document.createElement('smart-list-box');
for (var propertyName in properties) {
this.nativeElement[propertyName] = properties[propertyName];
}
return this.nativeElement;
};
Object.defineProperty(ListBoxComponent.prototype, "allowDrag", {
/** @description Enables or disables the ability to drag list items out of the List box. Disabled items cannot be dragged. */
get: function () {
return this.nativeElement ? this.nativeElement.allowDrag : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.allowDrag = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "allowDrop", {
/** @description Enables or disables the ability to drop list items inside the target List box. */
get: function () {
return this.nativeElement ? this.nativeElement.allowDrop : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.allowDrop = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "alternationCount", {
/** @description Determines the number of color alternations in rows. */
get: function () {
return this.nativeElement ? this.nativeElement.alternationCount : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.alternationCount = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "alternationEnd", {
/** @description Determines the ending index of color alternations in rows. */
get: function () {
return this.nativeElement ? this.nativeElement.alternationEnd : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.alternationEnd = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "alternationStart", {
/** @description Determines the starting index of color alternations in rows */
get: function () {
return this.nativeElement ? this.nativeElement.alternationStart : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.alternationStart = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.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(ListBoxComponent.prototype, "autoSort", {
/** @description Enables or disables auto sorting. If sorted is enabled, but autoSort is false, the element will not be re-sorted automatically. */
get: function () {
return this.nativeElement ? this.nativeElement.autoSort : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.autoSort = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "dataSource", {
/** @description Determines the data source that will be loaded to the ListBox. The dataSource can be an array of strings/numbers or objects where the attributes represent the properties of a List Item. For example label, value, group. It can also be a callback that returns an Array of items as previously described. */
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(ListBoxComponent.prototype, "disabled", {
/** @description Enables or disables the list box. */
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(ListBoxComponent.prototype, "displayLoadingIndicator", {
/** @description Determines whether an indicator will appear during filtering and remote item loading. */
get: function () {
return this.nativeElement ? this.nativeElement.displayLoadingIndicator : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.displayLoadingIndicator = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "displayMember", {
/** @description Sets or gets the displayMember. The displayMember specifies the name of an object property to display. The name is contained in the collection specified by the 'dataSource' property. */
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(ListBoxComponent.prototype, "dragFeedbackFormatFunction", {
/** @description A callback function for customizing the HTML of the drag feedback. It receives one parameter - the currently dragged item. */
get: function () {
return this.nativeElement ? this.nativeElement.dragFeedbackFormatFunction : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dragFeedbackFormatFunction = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "dragOffset", {
/** @description Determines the offset of the drag feedback element from the mouse cursor when dragging an item. The first member of the array is the horizontal offset and the second one - the vertical offset. */
get: function () {
return this.nativeElement ? this.nativeElement.dragOffset : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dragOffset = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "dropAction", {
/** @description Determines what happens when an item is dropped. */
get: function () {
return this.nativeElement ? this.nativeElement.dropAction : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.dropAction = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "editable", {
/** @description Determines if list items can be edited or not. If enabled, items can be edited by double clicking on a target item ( that is not disabled ) or pressing the F2 key on the keyboard. */
get: function () {
return this.nativeElement ? this.nativeElement.editable : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.editable = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "filterable", {
/** @description Determines whether list items can be filtered or not. If enable a filter input appears at the top of the list box. */
get: function () {
return this.nativeElement ? this.nativeElement.filterable : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.filterable = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "filterCallback", {
/** @description A callback that should return a condition that will be used for custom item filtering. Used in conjunction with filterMode 'custom' */
get: function () {
return this.nativeElement ? this.nativeElement.filterCallback : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.filterCallback = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "filterMode", {
/** @description Determines the filtering mode. */
get: function () {
return this.nativeElement ? this.nativeElement.filterMode : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.filterMode = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "filterInputPlaceholder", {
/** @description Determines the placeholder for the filter input field. */
get: function () {
return this.nativeElement ? this.nativeElement.filterInputPlaceholder : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.filterInputPlaceholder = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "grouped", {
/** @description If enabled, the items will be grouped by their first letter. Can't be applied if the dataSource already contains groups. */
get: function () {
return this.nativeElement ? this.nativeElement.grouped : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.grouped = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "groupMember", {
/** @description Determines which attribute from the dataSource object will be used as the group member for the items. If not set, by default 'group' property is used from the source object. groupMember is especially usefull when loading the data from a JSON file as a dataSource for the ListBox and there's a specific property that should be used to group the items. */
get: function () {
return this.nativeElement ? this.nativeElement.groupMember : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.groupMember = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "horizontalScrollBarVisibility", {
/** @description Determines the visibility of the horizontal Scroll bar. */
get: function () {
return this.nativeElement ? this.nativeElement.horizontalScrollBarVisibility : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.horizontalScrollBarVisibility = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "incrementalSearchDelay", {
/** @description IncrementalSearchDelay property specifies the time-interval in milliseconds until the previous search query is cleared. The timer starts when the user stops typing. A new query can be started only when the delay has passed. */
get: function () {
return this.nativeElement ? this.nativeElement.incrementalSearchDelay : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.incrementalSearchDelay = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "incrementalSearchMode", {
/** @description Sets ot gets the mode of the incremental search mode. Incremental search is enabled by default. Typing while the List box is focused starts the incremental search. */
get: function () {
return this.nativeElement ? this.nativeElement.incrementalSearchMode : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.incrementalSearchMode = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "itemHeight", {
/** @description Sets the height for all list box items. Used only when virtualization is enabled. */
get: function () {
return this.nativeElement ? this.nativeElement.itemHeight : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.itemHeight = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "itemMeasureMode", {
/** @description Determines the item width measuring algorithm. */
get: function () {
return this.nativeElement ? this.nativeElement.itemMeasureMode : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.itemMeasureMode = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "items", {
/** @description A getter that returns an array of all ListBox 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(ListBoxComponent.prototype, "itemTemplate", {
/** @description A string that represents the id of an HTMLTemplateElement inside the DOM or a reference to the template itself. It's used to set a custom template for the list items. */
get: function () {
return this.nativeElement ? this.nativeElement.itemTemplate : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.itemTemplate = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "loadingIndicatorPlaceholder", {
/** @description Determines the text that will be displayed next to the loading indicator when the loader is visible and it's position is top or bottom. */
get: function () {
return this.nativeElement ? this.nativeElement.loadingIndicatorPlaceholder : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.loadingIndicatorPlaceholder = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "loadingIndicatorPosition", {
/** @description Determines the position of the loading indicator. */
get: function () {
return this.nativeElement ? this.nativeElement.loadingIndicatorPosition : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.loadingIndicatorPosition = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.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(ListBoxComponent.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(ListBoxComponent.prototype, "messages", {
/** @description Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property language. */
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(ListBoxComponent.prototype, "name", {
/** @description Sets or gets the name attribute for the element. Name is used when submiting HTML forms. */
get: function () {
return this.nativeElement ? this.nativeElement.name : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.name = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "placeholder", {
/** @description Determines the placeholder that will be shown when the List box is empty. */
get: function () {
return this.nativeElement ? this.nativeElement.placeholder : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.placeholder = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "readonly", {
/** @description Sets or gets the readonly property. 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(ListBoxComponent.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(ListBoxComponent.prototype, "selectedIndexes", {
/** @description Sets or gets the selected indexes. Selected indexes represents an array of the indexes of the items that should be selected. */
get: function () {
return this.nativeElement ? this.nativeElement.selectedIndexes : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.selectedIndexes = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "selectedValues", {
/** @description Sets or gets elected indexes. Selected values represents the values of the items that should be selected. */
get: function () {
return this.nativeElement ? this.nativeElement.selectedValues : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.selectedValues = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "selectionMode", {
/** @description Determines how many items can be selected depending on the 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(ListBoxComponent.prototype, "selectionChangeAction", {
/** @description Determines when listbox selection is achieved - on 'press' or 'release'. */
get: function () {
return this.nativeElement ? this.nativeElement.selectionChangeAction : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.selectionChangeAction = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "sorted", {
/** @description Determines whether the items are sorted alphabetically or not */
get: function () {
return this.nativeElement ? this.nativeElement.sorted : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.sorted = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "sortDirection", {
/** @description Determines sorting direction - ascending(asc) or descending(desc) */
get: function () {
return this.nativeElement ? this.nativeElement.sortDirection : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.sortDirection = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "theme", {
/** @description Determines the theme for the element. Themes define the look of the elements. */
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(ListBoxComponent.prototype, "topVisibleIndex", {
/** @description Ensures the item with the target index is in view as the first (top) item in the list box. */
get: function () {
return this.nativeElement ? this.nativeElement.topVisibleIndex : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.topVisibleIndex = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.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(ListBoxComponent.prototype, "value", {
/** @description Sets or gets the value. Returns the selection. Return type: {label: string, value: any}[]. */
get: function () {
return this.nativeElement ? this.nativeElement.value : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.value = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "valueMember", {
/** @description Determines the value member of an item. Stored as value in the item object. Similar to groupMember, valueMember is especially usefull when using data from a JSON file as a dataSource for the ListBox and there's a specific property that should be used for the value the items. */
get: function () {
return this.nativeElement ? this.nativeElement.valueMember : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.valueMember = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "verticalScrollBarVisibility", {
/** @description Determines the visibility of the vertical scroll bar. */
get: function () {
return this.nativeElement ? this.nativeElement.verticalScrollBarVisibility : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.verticalScrollBarVisibility = value : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ListBoxComponent.prototype, "virtualized", {
/** @description Determines weather or not Virtualization is used for the ListBox. Virtualization allows a huge amount of items to be loaded to the List box while preserving the performance. For example a milion items can be loaded to the list box. */
get: function () {
return this.nativeElement ? this.nativeElement.virtualized : undefined;
},
set: function (value) {
this.nativeElement ? this.nativeElement.virtualized = value : undefined;
},
enumerable: true,
configurable: true
});
/** @description Appends a ListItem to the end of the list of items inside element.
* @param {Node} node. A ListItem element that should be added to the rest of the items as the last item.
* @returns {Node}
*/
ListBoxComponent.prototype.appendChild = function (node) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var getResultOnRender, result;
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
getResultOnRender = function () {
return new Promise(function (resolve) {
_this.nativeElement.whenRendered(function () {
var result = _this.nativeElement.appendChild(node);
resolve(result);
});
});
};
return [4 /*yield*/, getResultOnRender()];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
});
};
/** @description Removes all items from the listBox.
*/
ListBoxComponent.prototype.clearItems = function () {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.clearItems();
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.clearItems();
});
}
};
/** @description Unselects all items.
*/
ListBoxComponent.prototype.clearSelection = function () {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.clearSelection();
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.clearSelection();
});
}
};
/** @description Ensures the target item is visible by scrolling to it.
* @param {HTMLElement | string} item. A list item or value of the desired item to be visible.
*/
ListBoxComponent.prototype.ensureVisible = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.ensureVisible(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.ensureVisible(item);
});
}
};
/** @description Returns an item instance from the listBox.
* @param {string} value. The value of an item from the listBox.
* @returns {HTMLElement}
*/
ListBoxComponent.prototype.getItem = function (value) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var getResultOnRender, result;
var _this = this;
return tslib_1.__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(value);
resolve(result);
});
});
};
return [4 /*yield*/, getResultOnRender()];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
});
};
/** @description Returns an array of ListBox items.
* @returns {{label: string, value: string}[]}
*/
ListBoxComponent.prototype.getItems = function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var getResultOnRender, result;
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
getResultOnRender = function () {
return new Promise(function (resolve) {
_this.nativeElement.whenRendered(function () {
var result = _this.nativeElement.getItems();
resolve(result);
});
});
};
return [4 /*yield*/, getResultOnRender()];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
});
};
/** @description Inserts a new item at a specified index.
* @param {number} index. The index where the item must be inserted.
* @param {any} items. A single item/definition or an array of List Items/definitions of list items to be inserted. The format of the item definitions is the same as the format of the <strong>dataSource</strong> property.
*/
ListBoxComponent.prototype.insert = function (index, items) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.insert(index, items);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.insert(index, items);
});
}
};
/** @description Inserts a new ListItem before another in the list.
* @param {Node} node. A ListItem element that should be added before the referenceItem in the list.
* @param {Node | null} referenceNode. A ListItem element that acts as the reference item before which a new item is about to be inserted. The referenceNode must be in the same list as the node.
* @returns {Node}
*/
ListBoxComponent.prototype.insertBefore = function (node, referenceNode) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var getResultOnRender, result;
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
getResultOnRender = function () {
return new Promise(function (resolve) {
_this.nativeElement.whenRendered(function () {
var result = _this.nativeElement.insertBefore(node, referenceNode);
resolve(result);
});
});
};
return [4 /*yield*/, getResultOnRender()];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
});
};
/** @description Removes an item at a specified index.
* @param {number} index. The index of the removed item.
*/
ListBoxComponent.prototype.removeAt = function (index) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.removeAt(index);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.removeAt(index);
});
}
};
/** @description Removes a ListItem from the list of items inside element.
* @param {Node} node. A ListItem element that is part of the list of items inside the element.
* @returns {Node}
*/
ListBoxComponent.prototype.removeChild = function (node) {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var getResultOnRender, result;
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0:
getResultOnRender = function () {
return new Promise(function (resolve) {
_this.nativeElement.whenRendered(function () {
var result = _this.nativeElement.removeChild(node);
resolve(result);
});
});
};
return [4 /*yield*/, getResultOnRender()];
case 1:
result = _a.sent();
return [2 /*return*/, result];
}
});
});
};
/** @description Selects an item from the listBox.
* @param {string | number | HTMLElement} item. A string, representing the value of the item or an HTML Element referencing an item from the list.
*/
ListBoxComponent.prototype.select = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.select(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.select(item);
});
}
};
/** @description Unselects an item from the listBox.
* @param {string | HTMLElement} item. A string, representing the value of the item or an HTML Element referencing an item from the list
*/
ListBoxComponent.prototype.unselect = function (item) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.unselect(item);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.unselect(item);
});
}
};
/** @description Updates an item from the listBox.
* @param {number} index. The index of the item that is going to be updated.
* @param {any} details. An object that contains the properties and their new values for the List item that should be updated. For example, label, value or selected attributes.
*/
ListBoxComponent.prototype.update = function (index, details) {
var _this = this;
if (this.nativeElement.isRendered) {
this.nativeElement.update(index, details);
}
else {
this.nativeElement.whenRendered(function () {
_this.nativeElement.update(index, details);
});
}
};
Object.defineProperty(ListBoxComponent.prototype, "isRendered", {
get: function () {
return this.nativeElement ? this.nativeElement.isRendered : false;
},
enumerable: true,
configurable: true
});
ListBoxComponent.prototype.ngOnInit = function () {
};
ListBoxComponent.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();
};
ListBoxComponent.prototype.ngOnDestroy = function () {
this.unlisten();
};
Object.defineProperty(ListBoxComponent.prototype, "ngValue", {
get: function () {
if (!this.nativeElement) {
return null;
}
if (this.selectedValues && this.selectedValues.length > 0) {
var value_1 = this.selectedValues.length === 1 ? this.nativeElement.selectedValues[0] : this.nativeElement.selectedValues;
return value_1;
}
return null;
var value = this.nativeElement.value;
return value;
},
set: function (value) {
if (this.nativeElement) {
this.writeValue(value);
}
},
enumerable: true,
configurable: true
});
ListBoxComponent.prototype.writeValue = function (value) {
var _this = this;
var that = this;
var normalizedValue = value == null ? '' : value;
that.nativeElement.whenRendered(function () {
that.nativeElement.isInitialized = that._initialChange ? false : true;
that.clearSelection();
if (Array.isArray(normalizedValue)) {
value.forEach(function (currentValue) { return _this.select(currentValue); });
}
else {
that.select(normalizedValue);
}
that.nativeElement.isInitialized = true;
if (that._initialChange === false) {
if (that.selectedValues && that.selectedValues.length > 1) {
that._onChange(that.selectedValues);
}
else {
that._onChange((that.selectedValues && that.selectedValues.length > 0) ? that.selectedValues[0] : null);
}
}
});
};
ListBoxComponent.prototype.registerOnChange = function (fn) {
this._onChange = fn;
};
ListBoxComponent.prototype.registerOnTouched = function (fn) {
this._onTouched = fn;
};
ListBoxComponent.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. */
ListBoxComponent.prototype.listen = function () {
var that = this;
that.eventHandlers['bindingCompleteHandler'] = function (event) { that.onBindingComplete.emit(event); };
that.nativeElement.addEventListener('bindingComplete', that.eventHandlers['bindingCompleteHandler']);
that.eventHandlers['changeHandler'] = function (event) { that.onChange.emit(event); };
that.nativeElement.addEventListener('change', that.eventHandlers['changeHandler']);
that.eventHandlers['dragEndHandler'] = function (event) { that.onDragEnd.emit(event); };
that.nativeElement.addEventListener('dragEnd', that.eventHandlers['dragEndHandler']);
that.eventHandlers['draggingHandler'] = function (event) { that.onDragging.emit(event); };
that.nativeElement.addEventListener('dragging', that.eventHandlers['draggingHandler']);
that.eventHandlers['dragStartHandler'] = function (event) { that.onDragStart.emit(event); };