@progress/kendo-angular-listbox 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +654 -0
  3. package/README.md +31 -0
  4. package/dist/cdn/js/kendo-angular-listbox.js +20 -0
  5. package/dist/cdn/main.js +5 -0
  6. package/dist/es/constants.js +65 -0
  7. package/dist/es/data-binding.directive.js +145 -0
  8. package/dist/es/index.js +11 -0
  9. package/dist/es/item-selectable.directive.js +49 -0
  10. package/dist/es/item-template.directive.js +38 -0
  11. package/dist/es/listbox.component.js +196 -0
  12. package/dist/es/listbox.module.js +28 -0
  13. package/dist/es/main.js +7 -0
  14. package/dist/es/package-metadata.js +15 -0
  15. package/dist/es/selection.service.js +30 -0
  16. package/dist/es/size.js +4 -0
  17. package/dist/es/toolbar.js +4 -0
  18. package/dist/es/util.js +38 -0
  19. package/dist/es2015/constants.d.ts +25 -0
  20. package/dist/es2015/constants.js +65 -0
  21. package/dist/es2015/data-binding.directive.d.ts +36 -0
  22. package/dist/es2015/data-binding.directive.js +140 -0
  23. package/dist/es2015/index.d.ts +11 -0
  24. package/dist/es2015/index.js +11 -0
  25. package/dist/es2015/index.metadata.json +1 -0
  26. package/dist/es2015/item-selectable.directive.d.ts +15 -0
  27. package/dist/es2015/item-selectable.directive.js +44 -0
  28. package/dist/es2015/item-template.directive.d.ts +28 -0
  29. package/dist/es2015/item-template.directive.js +37 -0
  30. package/dist/es2015/listbox.component.d.ts +93 -0
  31. package/dist/es2015/listbox.component.js +216 -0
  32. package/dist/es2015/listbox.module.d.ts +9 -0
  33. package/dist/es2015/listbox.module.js +25 -0
  34. package/dist/es2015/main.d.ts +12 -0
  35. package/dist/es2015/main.js +7 -0
  36. package/dist/es2015/package-metadata.d.ts +9 -0
  37. package/dist/es2015/package-metadata.js +15 -0
  38. package/dist/es2015/selection.service.d.ts +21 -0
  39. package/dist/es2015/selection.service.js +32 -0
  40. package/dist/es2015/size.d.ts +13 -0
  41. package/dist/es2015/size.js +4 -0
  42. package/dist/es2015/toolbar.d.ts +42 -0
  43. package/dist/es2015/toolbar.js +4 -0
  44. package/dist/es2015/util.d.ts +31 -0
  45. package/dist/es2015/util.js +38 -0
  46. package/dist/fesm2015/index.js +565 -0
  47. package/dist/fesm5/index.js +557 -0
  48. package/dist/npm/constants.js +67 -0
  49. package/dist/npm/data-binding.directive.js +147 -0
  50. package/dist/npm/index.js +17 -0
  51. package/dist/npm/item-selectable.directive.js +51 -0
  52. package/dist/npm/item-template.directive.js +40 -0
  53. package/dist/npm/listbox.component.js +198 -0
  54. package/dist/npm/listbox.module.js +30 -0
  55. package/dist/npm/main.js +12 -0
  56. package/dist/npm/package-metadata.js +17 -0
  57. package/dist/npm/selection.service.js +32 -0
  58. package/dist/npm/size.js +6 -0
  59. package/dist/npm/toolbar.js +6 -0
  60. package/dist/npm/util.js +40 -0
  61. package/dist/systemjs/kendo-angular-listbox.js +5 -0
  62. package/package.json +153 -0
  63. package/schematics/collection.json +12 -0
  64. package/schematics/ngAdd/index.js +18 -0
  65. package/schematics/ngAdd/index.js.map +1 -0
  66. package/schematics/ngAdd/schema.json +28 -0
@@ -0,0 +1,147 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
10
+ var rxjs_1 = require("rxjs");
11
+ var listbox_component_1 = require("./listbox.component");
12
+ var util_1 = require("./util");
13
+ /**
14
+ * A directive which manages the functoinality of the ListBox tools out of the box, and modifies the provided data accordingly.
15
+ */
16
+ var DataBindingDirective = /** @class */ (function () {
17
+ function DataBindingDirective(listbox) {
18
+ var _this = this;
19
+ this.listbox = listbox;
20
+ /**
21
+ * @hidden
22
+ */
23
+ this.data = [];
24
+ this.sub = new rxjs_1.Subscription();
25
+ this.selectedBox = this.listbox;
26
+ this.sub.add(this.listbox.actionClick.subscribe(function (actionName) {
27
+ switch (actionName) {
28
+ case 'moveUp': {
29
+ _this.moveVertically('up');
30
+ break;
31
+ }
32
+ case 'moveDown': {
33
+ _this.moveVertically('down');
34
+ break;
35
+ }
36
+ case 'transferTo': {
37
+ _this.transferItem(_this.connectedWith, _this.listbox);
38
+ break;
39
+ }
40
+ case 'transferFrom': {
41
+ _this.transferItem(_this.listbox, _this.connectedWith);
42
+ break;
43
+ }
44
+ case 'transferAllTo': {
45
+ _this.transferAll(_this.listbox, _this.connectedWith);
46
+ break;
47
+ }
48
+ case 'transferAllFrom': {
49
+ _this.transferAll(_this.connectedWith, _this.listbox);
50
+ break;
51
+ }
52
+ case 'remove': {
53
+ _this.removeItem();
54
+ break;
55
+ }
56
+ default: {
57
+ break;
58
+ }
59
+ }
60
+ }));
61
+ }
62
+ /**
63
+ * @hidden
64
+ */
65
+ DataBindingDirective.prototype.ngOnChanges = function (changes) {
66
+ var _this = this;
67
+ if (kendo_angular_common_1.isChanged('connectedWith', changes, false)) {
68
+ this.sub.add(this.listbox.selectionChange.subscribe(function () {
69
+ _this.selectedBox = _this.listbox;
70
+ _this.connectedWith.clearSelection();
71
+ }));
72
+ this.sub.add(this.connectedWith.selectionChange.subscribe(function () {
73
+ _this.selectedBox = _this.connectedWith;
74
+ _this.listbox.clearSelection();
75
+ }));
76
+ }
77
+ if (kendo_angular_common_1.isChanged('data', changes, true)) {
78
+ this.listbox.data = changes.data.currentValue;
79
+ }
80
+ };
81
+ /**
82
+ * @hidden
83
+ */
84
+ DataBindingDirective.prototype.ngOnDestroy = function () {
85
+ this.sub.unsubscribe();
86
+ };
87
+ DataBindingDirective.prototype.moveVertically = function (dir) {
88
+ var _a;
89
+ var index = this.selectedBox.selectedIndex;
90
+ if (!util_1.isPresent(index)) {
91
+ return;
92
+ }
93
+ var topReached = dir === 'up' && index <= 0;
94
+ var bottomReached = dir === 'down' && index >= this.selectedBox.data.length - 1;
95
+ if (topReached || bottomReached) {
96
+ return;
97
+ }
98
+ var newIndex = dir === 'up' ? index - 1 : index + 1;
99
+ // ES6 Destructuring swap
100
+ _a = [this.selectedBox.data[index], this.selectedBox.data[newIndex]], this.selectedBox.data[newIndex] = _a[0], this.selectedBox.data[index] = _a[1];
101
+ this.selectedBox.selectionService.select(newIndex);
102
+ };
103
+ DataBindingDirective.prototype.removeItem = function () {
104
+ var index = this.selectedBox.selectedIndex;
105
+ if (!util_1.isPresent(index)) {
106
+ return;
107
+ }
108
+ this.selectedBox.data.splice(index, 1);
109
+ this.selectedBox.selectionService.clearSelection();
110
+ };
111
+ DataBindingDirective.prototype.transferItem = function (source, target) {
112
+ var item = source && source.data[source.selectedIndex];
113
+ if (!item || !target || !source) {
114
+ return;
115
+ }
116
+ target.data.push(item);
117
+ source.data.splice(source.selectedIndex, 1);
118
+ source.clearSelection();
119
+ target.selectItem(target.data.length - 1);
120
+ this.selectedBox = target;
121
+ };
122
+ DataBindingDirective.prototype.transferAll = function (source, target) {
123
+ var _a;
124
+ if (!target || !source) {
125
+ return;
126
+ }
127
+ (_a = target.data).splice.apply(_a, [target.data.length, 0].concat(source.data.splice(0, source.data.length)));
128
+ target.selectItem(target.data.length - 1);
129
+ this.selectedBox = target;
130
+ };
131
+ tslib_1.__decorate([
132
+ core_1.Input('kendoListBoxDataBinding'),
133
+ tslib_1.__metadata("design:type", Array)
134
+ ], DataBindingDirective.prototype, "data", void 0);
135
+ tslib_1.__decorate([
136
+ core_1.Input(),
137
+ tslib_1.__metadata("design:type", listbox_component_1.ListBoxComponent)
138
+ ], DataBindingDirective.prototype, "connectedWith", void 0);
139
+ DataBindingDirective = tslib_1.__decorate([
140
+ core_1.Directive({
141
+ selector: '[kendoListBoxDataBinding]'
142
+ }),
143
+ tslib_1.__metadata("design:paramtypes", [listbox_component_1.ListBoxComponent])
144
+ ], DataBindingDirective);
145
+ return DataBindingDirective;
146
+ }());
147
+ exports.DataBindingDirective = DataBindingDirective;
@@ -0,0 +1,17 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ /**
7
+ * Generated bundle index. Do not edit.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ var tslib_1 = require("tslib");
11
+ tslib_1.__exportStar(require("./main"), exports);
12
+ var item_selectable_directive_1 = require("./item-selectable.directive");
13
+ exports.ItemSelectableDirective = item_selectable_directive_1.ItemSelectableDirective
14
+ var item_template_directive_1 = require("./item-template.directive");
15
+ exports.ItemTemplateDirective = item_template_directive_1.ItemTemplateDirective
16
+ var selection_service_1 = require("./selection.service");
17
+ exports.ListBoxSelectionService = selection_service_1.ListBoxSelectionService
@@ -0,0 +1,51 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var selection_service_1 = require("./selection.service");
10
+ /**
11
+ * @hidden
12
+ */
13
+ var ItemSelectableDirective = /** @class */ (function () {
14
+ function ItemSelectableDirective(selectionService) {
15
+ this.selectionService = selectionService;
16
+ }
17
+ Object.defineProperty(ItemSelectableDirective.prototype, "selectedClassName", {
18
+ get: function () {
19
+ return this.selectionService.isSelected(this.index);
20
+ },
21
+ enumerable: true,
22
+ configurable: true
23
+ });
24
+ ItemSelectableDirective.prototype.onClick = function (event) {
25
+ event.stopPropagation();
26
+ this.selectionService.select(this.index);
27
+ };
28
+ tslib_1.__decorate([
29
+ core_1.Input(),
30
+ tslib_1.__metadata("design:type", Number)
31
+ ], ItemSelectableDirective.prototype, "index", void 0);
32
+ tslib_1.__decorate([
33
+ core_1.HostBinding('class.k-selected'),
34
+ tslib_1.__metadata("design:type", Boolean),
35
+ tslib_1.__metadata("design:paramtypes", [])
36
+ ], ItemSelectableDirective.prototype, "selectedClassName", null);
37
+ tslib_1.__decorate([
38
+ core_1.HostListener('click', ['$event']),
39
+ tslib_1.__metadata("design:type", Function),
40
+ tslib_1.__metadata("design:paramtypes", [Object]),
41
+ tslib_1.__metadata("design:returntype", void 0)
42
+ ], ItemSelectableDirective.prototype, "onClick", null);
43
+ ItemSelectableDirective = tslib_1.__decorate([
44
+ core_1.Directive({
45
+ selector: '[kendoListBoxItemSelectable]'
46
+ }),
47
+ tslib_1.__metadata("design:paramtypes", [selection_service_1.ListBoxSelectionService])
48
+ ], ItemSelectableDirective);
49
+ return ItemSelectableDirective;
50
+ }());
51
+ exports.ItemSelectableDirective = ItemSelectableDirective;
@@ -0,0 +1,40 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ /**
10
+ * Renders the ListBox item content. To define the item template, nest an `<ng-template>` tag
11
+ * with the `kendoListBoxItemTemplate` directive inside the `<kendo-listbox>` tag. The template context is
12
+ * set to the current data item.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * _@Component({
17
+ * selector: 'my-app',
18
+ * template: `
19
+ * <kendo-listbox [data]="listBoxItems">
20
+ * <ng-template kendoListBoxItemTemplate let-dataItem>
21
+ * <span>{{ dataItem }} item</span>
22
+ * </ng-template>
23
+ * </kendo-listbox>
24
+ * `
25
+ * })
26
+ * ```
27
+ */
28
+ var ItemTemplateDirective = /** @class */ (function () {
29
+ function ItemTemplateDirective(templateRef) {
30
+ this.templateRef = templateRef;
31
+ }
32
+ ItemTemplateDirective = tslib_1.__decorate([
33
+ core_1.Directive({
34
+ selector: '[kendoListBoxItemTemplate]'
35
+ }),
36
+ tslib_1.__metadata("design:paramtypes", [core_1.TemplateRef])
37
+ ], ItemTemplateDirective);
38
+ return ItemTemplateDirective;
39
+ }());
40
+ exports.ItemTemplateDirective = ItemTemplateDirective;
@@ -0,0 +1,198 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var kendo_licensing_1 = require("@progress/kendo-licensing");
10
+ var rxjs_1 = require("rxjs");
11
+ var package_metadata_1 = require("./package-metadata");
12
+ var selection_service_1 = require("./selection.service");
13
+ var item_template_directive_1 = require("./item-template.directive");
14
+ var util_1 = require("./util");
15
+ var constants_1 = require("./constants");
16
+ /**
17
+ * Represents the [Kendo UI ListBox component for Angular]({% slug overview_listbox %}).
18
+ */
19
+ var ListBoxComponent = /** @class */ (function () {
20
+ function ListBoxComponent(selectionService, renderer, hostElement) {
21
+ var _this = this;
22
+ this.selectionService = selectionService;
23
+ this.renderer = renderer;
24
+ this.hostElement = hostElement;
25
+ /**
26
+ * @hidden
27
+ */
28
+ this.listboxClassName = true;
29
+ /**
30
+ * The data which will be displayed by the ListBox.
31
+ */
32
+ this.data = [];
33
+ /**
34
+ * Sets the size of the component.
35
+ *
36
+ * The possible values are:
37
+ * - `'small'`
38
+ * - `'medium'` (default)
39
+ * - `'large'`
40
+ */
41
+ this.size = 'medium';
42
+ /**
43
+ * A function which determines if a specific item is disabled.
44
+ */
45
+ this.itemDisabled = util_1.defaultItemDisabled;
46
+ /**
47
+ * Fires when the user selects a different ListBox item. Also fires when a node is moved, since that also changes its index.
48
+ */
49
+ this.selectionChange = new core_1.EventEmitter();
50
+ /**
51
+ * Fires when the user clicks a ListBox item.
52
+ */
53
+ this.actionClick = new core_1.EventEmitter();
54
+ /**
55
+ * @hidden
56
+ */
57
+ this.selectedTools = constants_1.allTools;
58
+ this.sub = new rxjs_1.Subscription();
59
+ kendo_licensing_1.validatePackage(package_metadata_1.packageMetadata);
60
+ this.setToolbarClass(constants_1.DEFAULT_TOOLBAR_POSITION);
61
+ this.sub.add(this.selectionService.onSelect.subscribe(function (e) {
62
+ _this.selectionChange.next(e);
63
+ }));
64
+ }
65
+ Object.defineProperty(ListBoxComponent.prototype, "toolbar", {
66
+ /**
67
+ * Sets whether a toolbar should be displayed with the ListBox, as well as what tools and position should be used.
68
+ */
69
+ set: function (config) {
70
+ var position = constants_1.DEFAULT_TOOLBAR_POSITION;
71
+ if (typeof config === 'boolean') {
72
+ this.selectedTools = config ? constants_1.allTools : [];
73
+ }
74
+ else {
75
+ this.selectedTools = config.tools ? util_1.getTools(config.tools) : constants_1.allTools;
76
+ if (config.position) {
77
+ position = config.position;
78
+ }
79
+ }
80
+ this.setToolbarClass(position);
81
+ },
82
+ enumerable: true,
83
+ configurable: true
84
+ });
85
+ Object.defineProperty(ListBoxComponent.prototype, "listClasses", {
86
+ /**
87
+ * @hidden
88
+ */
89
+ get: function () {
90
+ return "k-list k-list-" + constants_1.sizeClassMap[this.size];
91
+ },
92
+ enumerable: true,
93
+ configurable: true
94
+ });
95
+ /**
96
+ * @hidden
97
+ */
98
+ ListBoxComponent.prototype.ngOnDestroy = function () {
99
+ this.sub.unsubscribe();
100
+ };
101
+ /**
102
+ * @hidden
103
+ */
104
+ ListBoxComponent.prototype.performAction = function (actionName) {
105
+ this.actionClick.next(actionName);
106
+ };
107
+ /**
108
+ * Programmatically selects a ListBox node.
109
+ */
110
+ ListBoxComponent.prototype.selectItem = function (index) {
111
+ this.selectionService.selectedIndex = index;
112
+ };
113
+ /**
114
+ * Programmatically clears the ListBox selection.
115
+ */
116
+ ListBoxComponent.prototype.clearSelection = function () {
117
+ this.selectionService.clearSelection();
118
+ };
119
+ Object.defineProperty(ListBoxComponent.prototype, "selectedIndex", {
120
+ /**
121
+ * The index of the currently selected item in the ListBox.
122
+ */
123
+ get: function () {
124
+ return this.selectionService.selectedIndex;
125
+ },
126
+ enumerable: true,
127
+ configurable: true
128
+ });
129
+ /**
130
+ * @hidden
131
+ */
132
+ ListBoxComponent.prototype.getText = function (dataItem) {
133
+ if (typeof dataItem !== 'string' && !this.textField && core_1.isDevMode()) {
134
+ throw new Error('Missing textField input. When passing an array of objects as data, please set the textField input of the ListBox accordingly.');
135
+ }
136
+ return util_1.fieldAccessor(dataItem, this.textField);
137
+ };
138
+ ListBoxComponent.prototype.setToolbarClass = function (pos) {
139
+ var _this = this;
140
+ Object.keys(constants_1.toolbarClasses).forEach(function (className) {
141
+ if (pos === className) {
142
+ _this.renderer.addClass(_this.hostElement.nativeElement, constants_1.toolbarClasses[className]);
143
+ }
144
+ else {
145
+ _this.renderer.removeClass(_this.hostElement.nativeElement, constants_1.toolbarClasses[className]);
146
+ }
147
+ });
148
+ };
149
+ tslib_1.__decorate([
150
+ core_1.HostBinding('class.k-listbox'),
151
+ tslib_1.__metadata("design:type", Boolean)
152
+ ], ListBoxComponent.prototype, "listboxClassName", void 0);
153
+ tslib_1.__decorate([
154
+ core_1.ContentChild(item_template_directive_1.ItemTemplateDirective, { static: false }),
155
+ tslib_1.__metadata("design:type", item_template_directive_1.ItemTemplateDirective)
156
+ ], ListBoxComponent.prototype, "itemTemplate", void 0);
157
+ tslib_1.__decorate([
158
+ core_1.Input(),
159
+ tslib_1.__metadata("design:type", String)
160
+ ], ListBoxComponent.prototype, "textField", void 0);
161
+ tslib_1.__decorate([
162
+ core_1.Input(),
163
+ tslib_1.__metadata("design:type", Array)
164
+ ], ListBoxComponent.prototype, "data", void 0);
165
+ tslib_1.__decorate([
166
+ core_1.Input(),
167
+ tslib_1.__metadata("design:type", String)
168
+ ], ListBoxComponent.prototype, "size", void 0);
169
+ tslib_1.__decorate([
170
+ core_1.Input(),
171
+ tslib_1.__metadata("design:type", Object),
172
+ tslib_1.__metadata("design:paramtypes", [Object])
173
+ ], ListBoxComponent.prototype, "toolbar", null);
174
+ tslib_1.__decorate([
175
+ core_1.Input(),
176
+ tslib_1.__metadata("design:type", Function)
177
+ ], ListBoxComponent.prototype, "itemDisabled", void 0);
178
+ tslib_1.__decorate([
179
+ core_1.Output(),
180
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
181
+ ], ListBoxComponent.prototype, "selectionChange", void 0);
182
+ tslib_1.__decorate([
183
+ core_1.Output(),
184
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
185
+ ], ListBoxComponent.prototype, "actionClick", void 0);
186
+ ListBoxComponent = tslib_1.__decorate([
187
+ core_1.Component({
188
+ selector: 'kendo-listbox',
189
+ providers: [selection_service_1.ListBoxSelectionService],
190
+ template: "\n <div class=\"k-listbox-toolbar\" *ngIf=\"selectedTools.length > 0\">\n <ul class=\"k-reset\">\n <li *ngFor=\"let tool of selectedTools\">\n <button kendoButton [icon]=\"tool.icon\" (click)=\"performAction(tool.name)\"></button>\n </li>\n\n <!-- react moving items has a smoother removal of the style: https://www.telerik.com/kendo-react-ui/components/listbox/ -->\n </ul>\n </div>\n <div class=\"k-list-scroller k-selectable\">\n <div class=\"{{ listClasses }}\">\n <div class=\"k-list-content\">\n <ul class=\"k-list-ul\">\n <li\n class=\"k-list-item\"\n *ngFor=\"let item of data; let i = index;\"\n kendoListBoxItemSelectable\n [index]=\"i\"\n [class.k-disabled]=\"itemDisabled(item)\"\n >\n <ng-template *ngIf=\"itemTemplate; else defaultItemTemplate\"\n [templateContext]=\"{\n templateRef: itemTemplate.templateRef,\n $implicit: item\n }\">\n </ng-template>\n <ng-template #defaultItemTemplate>\n <span class=\"k-list-item-text\">{{ getText(item) }}</span>\n </ng-template>\n </li>\n </ul>\n </div>\n </div>\n </div>\n "
191
+ }),
192
+ tslib_1.__metadata("design:paramtypes", [selection_service_1.ListBoxSelectionService,
193
+ core_1.Renderer2,
194
+ core_1.ElementRef])
195
+ ], ListBoxComponent);
196
+ return ListBoxComponent;
197
+ }());
198
+ exports.ListBoxComponent = ListBoxComponent;
@@ -0,0 +1,30 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var listbox_component_1 = require("./listbox.component");
10
+ var kendo_angular_buttons_1 = require("@progress/kendo-angular-buttons");
11
+ var common_1 = require("@angular/common");
12
+ var item_template_directive_1 = require("./item-template.directive");
13
+ var item_selectable_directive_1 = require("./item-selectable.directive");
14
+ var data_binding_directive_1 = require("./data-binding.directive");
15
+ /**
16
+ * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the ListBox component.
17
+ */
18
+ var ListBoxModule = /** @class */ (function () {
19
+ function ListBoxModule() {
20
+ }
21
+ ListBoxModule = tslib_1.__decorate([
22
+ core_1.NgModule({
23
+ imports: [kendo_angular_buttons_1.ButtonsModule, common_1.CommonModule],
24
+ declarations: [listbox_component_1.ListBoxComponent, item_template_directive_1.ItemTemplateDirective, item_selectable_directive_1.ItemSelectableDirective, data_binding_directive_1.DataBindingDirective],
25
+ exports: [listbox_component_1.ListBoxComponent, item_template_directive_1.ItemTemplateDirective, item_selectable_directive_1.ItemSelectableDirective, data_binding_directive_1.DataBindingDirective]
26
+ })
27
+ ], ListBoxModule);
28
+ return ListBoxModule;
29
+ }());
30
+ exports.ListBoxModule = ListBoxModule;
@@ -0,0 +1,12 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var listbox_component_1 = require("./listbox.component");
8
+ exports.ListBoxComponent = listbox_component_1.ListBoxComponent;
9
+ var data_binding_directive_1 = require("./data-binding.directive");
10
+ exports.DataBindingDirective = data_binding_directive_1.DataBindingDirective;
11
+ var listbox_module_1 = require("./listbox.module");
12
+ exports.ListBoxModule = listbox_module_1.ListBoxModule;
@@ -0,0 +1,17 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ /**
8
+ * @hidden
9
+ */
10
+ exports.packageMetadata = {
11
+ name: '@progress/kendo-angular-listbox',
12
+ productName: 'Kendo UI for Angular',
13
+ productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
+ publishDate: 1649835747,
15
+ version: '',
16
+ licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
17
+ };
@@ -0,0 +1,32 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ /**
10
+ * @hidden
11
+ */
12
+ var ListBoxSelectionService = /** @class */ (function () {
13
+ function ListBoxSelectionService() {
14
+ this.onSelect = new core_1.EventEmitter();
15
+ this.selectedIndex = null;
16
+ }
17
+ ListBoxSelectionService.prototype.select = function (index) {
18
+ this.selectedIndex = index;
19
+ this.onSelect.next({ index: this.selectedIndex });
20
+ };
21
+ ListBoxSelectionService.prototype.isSelected = function (index) {
22
+ return index === this.selectedIndex;
23
+ };
24
+ ListBoxSelectionService.prototype.clearSelection = function () {
25
+ this.selectedIndex = null;
26
+ };
27
+ ListBoxSelectionService = tslib_1.__decorate([
28
+ core_1.Injectable()
29
+ ], ListBoxSelectionService);
30
+ return ListBoxSelectionService;
31
+ }());
32
+ exports.ListBoxSelectionService = ListBoxSelectionService;
@@ -0,0 +1,6 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,40 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var kendo_common_1 = require("@progress/kendo-common");
8
+ var constants_1 = require("./constants");
9
+ /**
10
+ * @hidden
11
+ */
12
+ exports.isPresent = function (value) { return value !== null && value !== undefined; };
13
+ /**
14
+ * @hidden
15
+ */
16
+ exports.isObject = function (value) { return exports.isPresent(value) && typeof value === 'object'; };
17
+ /**
18
+ * @hidden
19
+ */
20
+ exports.fieldAccessor = function (dataItem, field) {
21
+ if (!exports.isPresent(dataItem)) {
22
+ return null;
23
+ }
24
+ if (!exports.isPresent(field) || !exports.isObject(dataItem)) {
25
+ return dataItem;
26
+ }
27
+ // creates a field accessor supporting nested fields processing
28
+ var valueFrom = kendo_common_1.getter(field);
29
+ return valueFrom(dataItem);
30
+ };
31
+ /**
32
+ * @hidden
33
+ */
34
+ exports.defaultItemDisabled = function () { return false; };
35
+ /**
36
+ * @hidden
37
+ */
38
+ exports.getTools = function (names) {
39
+ return names.map(function (tool) { return constants_1.allTools.find(function (meta) { return meta.name === tool; }); });
40
+ };
@@ -0,0 +1,5 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ System.register("@progress/kendo-angular-listbox",["tslib","@progress/kendo-angular-common","@angular/core","rxjs","@progress/kendo-licensing","@progress/kendo-angular-buttons","@angular/common","@progress/kendo-common"],function(a){var s,r,l,c,d,u,p,m;function t(e){return e.__useDefault?e.default:e}return{setters:[function(e){s=t(e)},function(e){r=t(e)},function(e){l=t(e)},function(e){c=t(e)},function(e){d=t(e)},function(e){u=t(e)},function(e){p=t(e)},function(e){m=t(e)}],execute:function(){function n(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}var o,i;o=[function(e,t){e.exports=l},function(e,t){e.exports=s},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),i=o(0),s=o(16),a=o(8),r=o(15),l=o(7),c=o(6),d=o(5),u=o(4),o=(Object.defineProperty(p.prototype,"toolbar",{set:function(e){var t=u.DEFAULT_TOOLBAR_POSITION;"boolean"==typeof e?this.selectedTools=e?u.allTools:[]:(this.selectedTools=e.tools?d.getTools(e.tools):u.allTools,e.position&&(t=e.position)),this.setToolbarClass(t)},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"listClasses",{get:function(){return"k-list k-list-"+u.sizeClassMap[this.size]},enumerable:!0,configurable:!0}),p.prototype.ngOnDestroy=function(){this.sub.unsubscribe()},p.prototype.performAction=function(e){this.actionClick.next(e)},p.prototype.selectItem=function(e){this.selectionService.selectedIndex=e},p.prototype.clearSelection=function(){this.selectionService.clearSelection()},Object.defineProperty(p.prototype,"selectedIndex",{get:function(){return this.selectionService.selectedIndex},enumerable:!0,configurable:!0}),p.prototype.getText=function(e){if("string"!=typeof e&&!this.textField&&i.isDevMode())throw new Error("Missing textField input. When passing an array of objects as data, please set the textField input of the ListBox accordingly.");return d.fieldAccessor(e,this.textField)},p.prototype.setToolbarClass=function(t){var o=this;Object.keys(u.toolbarClasses).forEach(function(e){t===e?o.renderer.addClass(o.hostElement.nativeElement,u.toolbarClasses[e]):o.renderer.removeClass(o.hostElement.nativeElement,u.toolbarClasses[e])})},n.__decorate([i.HostBinding("class.k-listbox"),n.__metadata("design:type",Boolean)],p.prototype,"listboxClassName",void 0),n.__decorate([i.ContentChild(c.ItemTemplateDirective,{static:!1}),n.__metadata("design:type",c.ItemTemplateDirective)],p.prototype,"itemTemplate",void 0),n.__decorate([i.Input(),n.__metadata("design:type",String)],p.prototype,"textField",void 0),n.__decorate([i.Input(),n.__metadata("design:type",Array)],p.prototype,"data",void 0),n.__decorate([i.Input(),n.__metadata("design:type",String)],p.prototype,"size",void 0),n.__decorate([i.Input(),n.__metadata("design:type",Object),n.__metadata("design:paramtypes",[Object])],p.prototype,"toolbar",null),n.__decorate([i.Input(),n.__metadata("design:type",Function)],p.prototype,"itemDisabled",void 0),n.__decorate([i.Output(),n.__metadata("design:type",i.EventEmitter)],p.prototype,"selectionChange",void 0),n.__decorate([i.Output(),n.__metadata("design:type",i.EventEmitter)],p.prototype,"actionClick",void 0),n.__decorate([i.Component({selector:"kendo-listbox",providers:[l.ListBoxSelectionService],template:'\n <div class="k-listbox-toolbar" *ngIf="selectedTools.length > 0">\n <ul class="k-reset">\n <li *ngFor="let tool of selectedTools">\n <button kendoButton [icon]="tool.icon" (click)="performAction(tool.name)"></button>\n </li>\n\n \x3c!-- react moving items has a smoother removal of the style: https://www.telerik.com/kendo-react-ui/components/listbox/ --\x3e\n </ul>\n </div>\n <div class="k-list-scroller k-selectable">\n <div class="{{ listClasses }}">\n <div class="k-list-content">\n <ul class="k-list-ul">\n <li\n class="k-list-item"\n *ngFor="let item of data; let i = index;"\n kendoListBoxItemSelectable\n [index]="i"\n [class.k-disabled]="itemDisabled(item)"\n >\n <ng-template *ngIf="itemTemplate; else defaultItemTemplate"\n [templateContext]="{\n templateRef: itemTemplate.templateRef,\n $implicit: item\n }">\n </ng-template>\n <ng-template #defaultItemTemplate>\n <span class="k-list-item-text">{{ getText(item) }}</span>\n </ng-template>\n </li>\n </ul>\n </div>\n </div>\n </div>\n '}),n.__metadata("design:paramtypes",[l.ListBoxSelectionService,i.Renderer2,i.ElementRef])],p));function p(e,t,o){var n=this;this.selectionService=e,this.renderer=t,this.hostElement=o,this.listboxClassName=!0,this.data=[],this.size="medium",this.itemDisabled=d.defaultItemDisabled,this.selectionChange=new i.EventEmitter,this.actionClick=new i.EventEmitter,this.selectedTools=u.allTools,this.sub=new a.Subscription,s.validatePackage(r.packageMetadata),this.setToolbarClass(u.DEFAULT_TOOLBAR_POSITION),this.sub.add(this.selectionService.onSelect.subscribe(function(e){n.selectionChange.next(e)}))}t.ListBoxComponent=o},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),i=o(0),s=o(13),a=o(8),r=o(2),l=o(5),o=(c.prototype.ngOnChanges=function(e){var t=this;s.isChanged("connectedWith",e,!1)&&(this.sub.add(this.listbox.selectionChange.subscribe(function(){t.selectedBox=t.listbox,t.connectedWith.clearSelection()})),this.sub.add(this.connectedWith.selectionChange.subscribe(function(){t.selectedBox=t.connectedWith,t.listbox.clearSelection()}))),s.isChanged("data",e,!0)&&(this.listbox.data=e.data.currentValue)},c.prototype.ngOnDestroy=function(){this.sub.unsubscribe()},c.prototype.moveVertically=function(e){var t,o=this.selectedBox.selectedIndex;l.isPresent(o)&&(t="down"===e&&o>=this.selectedBox.data.length-1,"up"===e&&o<=0||t||(e=[this.selectedBox.data[o],this.selectedBox.data[t="up"===e?o-1:o+1]],this.selectedBox.data[t]=e[0],this.selectedBox.data[o]=e[1],this.selectedBox.selectionService.select(t)))},c.prototype.removeItem=function(){var e=this.selectedBox.selectedIndex;l.isPresent(e)&&(this.selectedBox.data.splice(e,1),this.selectedBox.selectionService.clearSelection())},c.prototype.transferItem=function(e,t){var o=e&&e.data[e.selectedIndex];o&&t&&e&&(t.data.push(o),e.data.splice(e.selectedIndex,1),e.clearSelection(),t.selectItem(t.data.length-1),this.selectedBox=t)},c.prototype.transferAll=function(e,t){var o;t&&e&&((o=t.data).splice.apply(o,[t.data.length,0].concat(e.data.splice(0,e.data.length))),t.selectItem(t.data.length-1),this.selectedBox=t)},n.__decorate([i.Input("kendoListBoxDataBinding"),n.__metadata("design:type",Array)],c.prototype,"data",void 0),n.__decorate([i.Input(),n.__metadata("design:type",r.ListBoxComponent)],c.prototype,"connectedWith",void 0),n.__decorate([i.Directive({selector:"[kendoListBoxDataBinding]"}),n.__metadata("design:paramtypes",[r.ListBoxComponent])],c));function c(e){var t=this;this.listbox=e,this.data=[],this.sub=new a.Subscription,this.selectedBox=this.listbox,this.sub.add(this.listbox.actionClick.subscribe(function(e){switch(e){case"moveUp":t.moveVertically("up");break;case"moveDown":t.moveVertically("down");break;case"transferTo":t.transferItem(t.connectedWith,t.listbox);break;case"transferFrom":t.transferItem(t.listbox,t.connectedWith);break;case"transferAllTo":t.transferAll(t.listbox,t.connectedWith);break;case"transferAllFrom":t.transferAll(t.connectedWith,t.listbox);break;case"remove":t.removeItem()}}))}t.DataBindingDirective=o},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_TOOLBAR_POSITION="right",t.allTools=[{name:"moveUp",label:"Move Up",icon:"arrow-n"},{name:"moveDown",label:"Move Down",icon:"arrow-s"},{name:"transferTo",label:"Transfer From",icon:"arrow-w"},{name:"transferFrom",label:"Transfer To",icon:"arrow-e"},{name:"transferAllTo",label:"Transfer All To",icon:"arrow-double-60-right"},{name:"transferAllFrom",label:"Transfer All From",icon:"arrow-double-60-left"},{name:"remove",label:"Remove",icon:"x"}],t.sizeClassMap={small:"sm",medium:"md",large:"lg"},t.toolbarClasses={left:"k-listbox-toolbar-left",right:"k-listbox-toolbar-right",top:"k-listbox-toolbar-top",bottom:"k-listbox-toolbar-bottom"}},function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var n=t(14),i=t(4);o.isPresent=function(e){return null!=e},o.isObject=function(e){return o.isPresent(e)&&"object"==typeof e},o.fieldAccessor=function(e,t){return o.isPresent(e)?o.isPresent(t)&&o.isObject(e)?n.getter(t)(e):e:null},o.defaultItemDisabled=function(){return!1},o.getTools=function(e){return e.map(function(t){return i.allTools.find(function(e){return e.name===t})})}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),o=o(0),n=n.__decorate([o.Directive({selector:"[kendoListBoxItemTemplate]"}),n.__metadata("design:paramtypes",[o.TemplateRef])],i);function i(e){this.templateRef=e}t.ItemTemplateDirective=n},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),i=o(0),o=(s.prototype.select=function(e){this.selectedIndex=e,this.onSelect.next({index:this.selectedIndex})},s.prototype.isSelected=function(e){return e===this.selectedIndex},s.prototype.clearSelection=function(){this.selectedIndex=null},n.__decorate([i.Injectable()],s));function s(){this.onSelect=new i.EventEmitter,this.selectedIndex=null}t.ListBoxSelectionService=o},function(e,t){e.exports=c},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),i=o(0),o=o(7),i=(Object.defineProperty(s.prototype,"selectedClassName",{get:function(){return this.selectionService.isSelected(this.index)},enumerable:!0,configurable:!0}),s.prototype.onClick=function(e){e.stopPropagation(),this.selectionService.select(this.index)},n.__decorate([i.Input(),n.__metadata("design:type",Number)],s.prototype,"index",void 0),n.__decorate([i.HostBinding("class.k-selected"),n.__metadata("design:type",Boolean),n.__metadata("design:paramtypes",[])],s.prototype,"selectedClassName",null),n.__decorate([i.HostListener("click",["$event"]),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[Object]),n.__metadata("design:returntype",void 0)],s.prototype,"onClick",null),n.__decorate([i.Directive({selector:"[kendoListBoxItemSelectable]"}),n.__metadata("design:paramtypes",[o.ListBoxSelectionService])],s));function s(e){this.selectionService=e}t.ItemSelectableDirective=i},function(e,t){e.exports=p},function(e,t){e.exports=u},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o(1),i=o(0),s=o(2),a=o(11),r=o(10),l=o(6),c=o(9),o=o(3),n=n.__decorate([i.NgModule({imports:[a.ButtonsModule,r.CommonModule],declarations:[s.ListBoxComponent,l.ItemTemplateDirective,c.ItemSelectableDirective,o.DataBindingDirective],exports:[s.ListBoxComponent,l.ItemTemplateDirective,c.ItemSelectableDirective,o.DataBindingDirective]})],d);function d(){}t.ListBoxModule=n},function(e,t){e.exports=r},function(e,t){e.exports=m},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.packageMetadata={name:"@progress/kendo-angular-listbox",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1649835747,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"}},function(e,t){e.exports=d},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,i=o(2),i=(t.ListBoxComponent=i.ListBoxComponent,o(3)),i=(t.DataBindingDirective=i.DataBindingDirective,o(12)),s=(t.ListBoxModule=i.ListBoxModule,t);for(n in s)a(n,s[n])}],i={},n.m=o,n.c=i,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}}});